Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F-Strings - hardware / image / lb #1982

Merged
merged 12 commits into from Jun 15, 2023

Conversation

ramkishor-ch
Copy link
Contributor

Hi @allmightyspiff ,

I have updated line of code from .format() to f"{}" string.

Please review it and approve this pull request.

Please find the details.

Details:

Title: I am working on these files for hardware, image, licenses, loadbal, metadata and order command group.
Start using python f-strings #1981

Description:

hardware:
SoftLayer/CLI/hardware/create.py: click.secho('Warning: Closed soon: {}'.format(pod['name']), fg='yellow')
SoftLayer/CLI/hardware/detail.py: last_transaction = "{} ({})".format(utils.lookup(result, 'lastTransaction', 'transactionGroup', 'name'),
SoftLayer/CLI/hardware/dns.py: message = "{} does not have an ipv6 address".format(instance['fullyQualifiedDomainName'])
SoftLayer/CLI/hardware/notification_add.py: raise exceptions.CLIAbort("User not found: {}.".format(user))
SoftLayer/CLI/hardware/notification_delete.py: env.fout("The hardware notification instance: {} was deleted.".format(identifier))

image:
SoftLayer/CLI/image/share.py: env.fout("Image template {} was shared to account {}.".format(identifier, account_id))
SoftLayer/CLI/image/share_deny.py: env.fout("Image template {} was deny shared to account {}.".format(identifier, account_id))

licenses:
SoftLayer/CLI/licenses/cancel.py: env.fout("License key: {} was cancelled.".format(key))

loadbal:
SoftLayer/CLI/loadbal/detail.py: table.add_row(['Status', "{} / {}".format(this_lb.get('provisioningStatus'), this_lb.get('operatingStatus'))])
SoftLayer/CLI/loadbal/detail.py: priv_map = "{}:{}".format(pool['protocol'], pool['protocolPort'])
SoftLayer/CLI/loadbal/detail.py: mapping = "{}:{} -> {}".format(listener.get('protocol'), listener.get('protocolPort'), priv_map)
SoftLayer/CLI/loadbal/health.py: print("UUID: {}, ID: {}".format(lb_uuid, lb_id))
SoftLayer/CLI/loadbal/health.py: click.secho('Health Check {} updated successfully'.format(uuid), fg='green')
SoftLayer/CLI/loadbal/health.py: click.secho('Failed to update {}'.format(uuid), fg='red')
SoftLayer/CLI/loadbal/health.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')
SoftLayer/CLI/loadbal/members.py: click.secho("Member {} removed".format(member), fg='green')
SoftLayer/CLI/loadbal/members.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')
SoftLayer/CLI/loadbal/members.py: click.secho("Member {} added".format(member), fg='green')
SoftLayer/CLI/loadbal/members.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')
SoftLayer/CLI/loadbal/ns_detail.py: "{}/{}".format(subnet.get('networkIdentifier'), subnet.get('cidr')),
SoftLayer/CLI/loadbal/order.py: raise exceptions.ArgumentError("{}={} is not properly formatted.".format(param, value))
SoftLayer/CLI/loadbal/order.py: raise exceptions.CLIHalt('Datacenter {} was not found'.format(datacenter))
SoftLayer/CLI/loadbal/order.py: table = formatting.KeyValueTable(['Item', 'Cost'], title="Order: {}".format(receipt.get('orderId', 'Quote')))
SoftLayer/CLI/loadbal/order.py: space = "{}/{}".format(subnet.get('networkIdentifier'), subnet.get('cidr'))
SoftLayer/CLI/loadbal/order.py: vlan = "{}.{}".format(subnet['podName'], subnet['networkVlan']['vlanNumber'])
SoftLayer/CLI/loadbal/order.py: click.secho("LB {} canceled succesfully.".format(identifier), fg='green')
SoftLayer/CLI/loadbal/order.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')
SoftLayer/CLI/loadbal/pools.py: "--server needs a port and a weight. {} improperly formatted".format(server))
SoftLayer/CLI/loadbal/pools.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')
SoftLayer/CLI/loadbal/pools.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')
SoftLayer/CLI/loadbal/pools.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')
SoftLayer/CLI/loadbal/pools.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')
SoftLayer/CLI/loadbal/pools.py: click.secho("ERROR: {}".format(exception.faultString), fg='red')

metadata:
SoftLayer/CLI/metadata.py:""".format(choices="\n ".join(META_CHOICES))

order:
SoftLayer/CLI/order/lookup.py: title = "Order {id}".format(id=order.get('id'))
SoftLayer/CLI/order/lookup.py: ordered_by = "{} ({})".format(user.get('displayName'), utils.lookup(user, 'userStatus', 'name'))
SoftLayer/CLI/order/lookup.py: table.add_row(['Order Total Amount', "{price:.2f}".format(price=float(order.get('orderTotalAmount', '0')))])
SoftLayer/CLI/order/lookup.py: format(price=float(order.get('initialInvoice', {}).get('invoiceTotalAmount', '0')))])

Linked Big Issues: #1547
Child Issue: #1981

Thanks,
Ramkishor Chaladi.

added f{} strings
@ramkishor-ch ramkishor-ch added the Core Issues dealing with core functionality label Jun 9, 2023
@ramkishor-ch ramkishor-ch self-assigned this Jun 9, 2023
Ramkishor Chaladi added 2 commits June 9, 2023 20:37
adjusted indentation in lookup.py
removed comments in metadata.py
Ramkishor Chaladi added 3 commits June 9, 2023 20:59
removed  and update to ''
removed '' and update to
replaced identifier position to account_id position inside f string
@allmightyspiff allmightyspiff changed the title Issue 1981 F-Strings - hardware / image / lb Jun 12, 2023
Copy link
Member

@allmightyspiff allmightyspiff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix merge conflicts

@ramkishor-ch
Copy link
Contributor Author

Hi Christopher,
I have resolved merge conflicts for this pull request:
#1982

Can you please review it.

Thanks,
Ramkishor Chaladi.

updated the string changes
Updated the fstring
Updated the string
updated the fstring
@JayasilanJibm
Copy link
Contributor

Hi,

I have reviewed and verified the code. The changes seems to be fine to me.

Thanks,
Jayasilan

@allmightyspiff allmightyspiff merged commit eb36663 into softlayer:master Jun 15, 2023
9 checks passed
@allmightyspiff allmightyspiff linked an issue Jun 15, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Issues dealing with core functionality
Projects
No open projects
Status: Done
3 participants