Skip to content

Sourcery refactored development branch#6

Open
sourcery-ai[bot] wants to merge 2 commits into
developmentfrom
sourcery/development
Open

Sourcery refactored development branch#6
sourcery-ai[bot] wants to merge 2 commits into
developmentfrom
sourcery/development

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Nov 21, 2023

Copy link
Copy Markdown

Branch development refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the development branch, then run:

git fetch origin sourcery/development
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai Bot requested a review from nameanon November 21, 2023 05:32
@sourcery-ai sourcery-ai Bot force-pushed the sourcery/development branch 22 times, most recently from ac9cb98 to 3ad9791 Compare November 21, 2023 05:39
@sourcery-ai sourcery-ai Bot force-pushed the sourcery/development branch from b48e46d to 27ad621 Compare November 21, 2023 05:43
if "-" in pool_name:
pool_name = sorted(pool_name.split("-"))
pool_name = "{}/{}".format(pool_name[0], pool_name[1])
pool_name = f"{pool_name[0]}/{pool_name[1]}"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_summary_detail refactored with the following changes:

Comment on lines -812 to +809
list_volume_1d["{}/{}".format(v["sold_ticker"], v["got_ticker"])] = {
list_volume_1d[f'{v["sold_ticker"]}/{v["got_ticker"]}'] = {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_summary refactored with the following changes:

Comment on lines -888 to +904
else:
all_coin_withdraw = await get_all_coin_names("cexswap_withdraw", 1, 100)
app.coin_list = await get_coin_setting()
list_coins = {}
if len(all_coin_withdraw) > 0:
for i in all_coin_withdraw:
min_tx = getattr(getattr(app.coin_list, i), "real_min_tx")
max_tx = getattr(getattr(app.coin_list, i), "real_max_tx")
list_coins[i] = {
"api_withdraw": 1,
"min_amount": truncate(min_tx, 8),
"max_amount": truncate(max_tx, 8),
}
try:
set_cache_kv(
app,
config["kv_db"]["prefix_cexswap"],
key="withdraw_list",
value=list_coins,
)
except Exception:
traceback.print_exc(file=sys.stdout)
return {"success": True, "result": list_coins, "time": int(time.time())}
all_coin_withdraw = await get_all_coin_names("cexswap_withdraw", 1, 100)
app.coin_list = await get_coin_setting()
list_coins = {}
if len(all_coin_withdraw) > 0:
for i in all_coin_withdraw:
min_tx = getattr(getattr(app.coin_list, i), "real_min_tx")
max_tx = getattr(getattr(app.coin_list, i), "real_max_tx")
list_coins[i] = {
"api_withdraw": 1,
"min_amount": truncate(min_tx, 8),
"max_amount": truncate(max_tx, 8),
}
try:
set_cache_kv(
app,
config["kv_db"]["prefix_cexswap"],
key="withdraw_list",
value=list_coins,
)
except Exception:
traceback.print_exc(file=sys.stdout)
return {"success": True, "result": list_coins, "time": int(time.time())}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function get_withdraw_list refactored with the following changes:

Comment on lines -2287 to +2288
name="Coins with CEXSwap: {}".format(len(self.bot.cexswap_coins)),
value="{}".format(", ".join(self.bot.cexswap_coins)),
name=f"Coins with CEXSwap: {len(self.bot.cexswap_coins)}",
value=f'{", ".join(self.bot.cexswap_coins)}',

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function ViewSummary.btn_summary_liqudity refactored with the following changes:

Comment on lines -2336 to +2337
name="Coins with CEXSwap: {}".format(len(self.bot.cexswap_coins)),
value="{}".format(", ".join(self.bot.cexswap_coins)),
name=f"Coins with CEXSwap: {len(self.bot.cexswap_coins)}",
value=f'{", ".join(self.bot.cexswap_coins)}',

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function ViewSummary.btn_summary_volume refactored with the following changes:

Comment on lines -2376 to +2377
name="Coins with CEXSwap: {}".format(len(self.bot.cexswap_coins)),
value="{}".format(", ".join(self.bot.cexswap_coins)),
name=f"Coins with CEXSwap: {len(self.bot.cexswap_coins)}",
value=f'{", ".join(self.bot.cexswap_coins)}',

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function ViewSummary.btn_summary_fee refactored with the following changes:

Comment thread wrkzcoin_tipbot/cogs/cexswap.py Outdated
Comment on lines +2415 to +2418
description="Select {}".format(each),
emoji=getattr(getattr(self.bot.coin_list, each), "coin_emoji_discord"),
description=f"Select {each}",
emoji=getattr(
getattr(self.bot.coin_list, each), "coin_emoji_discord"
),

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function DropdownLP.__init__ refactored with the following changes:

Comment on lines -2442 to +2472
text="Requested by: {}#{}".format(
self.ctx.author.name, self.ctx.author.discriminator
)
text=f"Requested by: {self.ctx.author.name}#{self.ctx.author.discriminator}"
)
embed.set_thumbnail(url=self.bot.user.display_avatar)
# get LP by coin
get_pools = await cexswap_get_pools(self.values[0])
showing_num = 8
if len(get_pools) > 0:
embed.add_field(
name="Selected Coin {}".format(self.values[0]),
name=f"Selected Coin {self.values[0]}",
value="There {} LP with {}".format(
"is {}".format(len(get_pools))
f"is {len(get_pools)}"
if len(get_pools) == 1
else "are {}".format(len(get_pools)),
else f"are {len(get_pools)}",
self.values[0],
),
inline=False,
)
for each_p in get_pools[0:showing_num]:
showing_num = 8
for each_p in get_pools[:showing_num]:
rate_1 = num_format_coin(
each_p["amount_ticker_2"] / each_p["amount_ticker_1"]
)
rate_2 = num_format_coin(
each_p["amount_ticker_1"] / each_p["amount_ticker_2"]
)
rate_coin_12 = "{} {} = {} {}\n{} {} = {} {}".format(
1,
each_p["ticker_1_name"],
rate_1,
each_p["ticker_2_name"],
1,
each_p["ticker_2_name"],
rate_2,
each_p["ticker_1_name"],
)
rate_coin_12 = f'1 {each_p["ticker_1_name"]} = {rate_1} {each_p["ticker_2_name"]}\n1 {each_p["ticker_2_name"]} = {rate_2} {each_p["ticker_1_name"]}'

embed.add_field(
name="Active LP {}{}".format(
each_p["pairs"],
" {} / {}".format(
self.utils.get_coin_emoji(each_p["ticker_1_name"]),
self.utils.get_coin_emoji(each_p["ticker_2_name"]),
),
),
value="{} {}\n{} {}\n{}".format(
num_format_coin(each_p["amount_ticker_1"]),
each_p["ticker_1_name"],
num_format_coin(each_p["amount_ticker_2"]),
each_p["ticker_2_name"],
rate_coin_12,
),
name=f'Active LP {each_p["pairs"]} {self.utils.get_coin_emoji(each_p["ticker_1_name"])} / {self.utils.get_coin_emoji(each_p["ticker_2_name"])}',
value=f'{num_format_coin(each_p["amount_ticker_1"])} {each_p["ticker_1_name"]}\n{num_format_coin(each_p["amount_ticker_2"])} {each_p["ticker_2_name"]}\n{rate_coin_12}',

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function DropdownLP.callback refactored with the following changes:

Comment thread wrkzcoin_tipbot/cogs/games.py Outdated
f"You do not get any reward because it is a free game! "
"Waiting to refresh your paid plays (24h max)."
)
result = 'You do not get any reward because it is a free game! Waiting to refresh your paid plays (24h max).'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Maze_Buttons.up_button refactored with the following changes:

Comment thread wrkzcoin_tipbot/cogs/games.py Outdated
Comment on lines +891 to +888
result = (
f"You do not get any reward because it is a free game! "
"Waiting to refresh your paid plays (24h max)."
)
result = 'You do not get any reward because it is a free game! Waiting to refresh your paid plays (24h max).'

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Function Maze_Buttons.down_button refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant