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

chore: fmt f-strings lazily #698

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/exporters/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_last_recorded_block():
def postgres_ready(snapshot: datetime) -> bool:
if (postgres_cached_thru_block := get_last_recorded_block()):
return chain[postgres_cached_thru_block].timestamp >= snapshot.timestamp()
logger.debug(f"postgress not yet popuated for {snapshot}")
logger.debug("postgress not yet popuated for %s", snapshot)
return False

class WalletExporter(Exporter):
Expand Down
2 changes: 1 addition & 1 deletion yearn/helpers/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def _generate_snapshot_range_forward(start: datetime, interval: timedelta)
snapshot = start + i * interval
while snapshot > datetime.now(tz=timezone.utc) + REORG_BUFFER:
diff = snapshot - datetime.now(tz=timezone.utc) + REORG_BUFFER
logger.debug(f"SLEEPING {diff}")
logger.debug("SLEEPING %s", diff)
await asyncio.sleep(diff.total_seconds())
yield snapshot

Expand Down
2 changes: 1 addition & 1 deletion yearn/outputs/victoria/victoria.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async def _post(metrics_to_export: List[Dict]) -> None:
if not isinstance(e, aiohttp.ClientError):
raise e
attempts += 1
logger.debug(f'You had a ClientError: {e}')
logger.debug('You had a ClientError: %s', e)
if attempts >= 10:
raise e

Expand Down
2 changes: 1 addition & 1 deletion yearn/partners/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async def get_data(self, partner: "Partner", use_postgres_cache: bool, verbose:
except KeyError:
start_block = partner.start_block
logger.debug('no harvests cached for %s %s', partner.name, self.name)
logger.debug(f'start block: {start_block}')
logger.debug('start block: %s', start_block)
else:
start_block = partner.start_block

Expand Down
2 changes: 1 addition & 1 deletion yearn/prices/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def find_price(
if price is None and return_price_during_vault_downtime:
for incident in INCIDENTS[token]:
if incident['start'] <= block <= incident['end']:
logger.debug(f"incidents -> {price}")
logger.debug("incidents -> %s", price)
return incident['result']

if price is None:
Expand Down
2 changes: 1 addition & 1 deletion yearn/prices/uniswap/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def pools(self) -> Dict[Address,Dict[Address,Address]]:
if len(pairs) < all_pairs_len:
logger.debug("Oh no! looks like your node can't look back that far. Checking for the missing pools...")
poolids_your_node_couldnt_get = [i for i in range(all_pairs_len) if i not in pairs]
logger.debug(f'missing poolids: {poolids_your_node_couldnt_get}')
logger.debug('missing poolids: %s', poolids_your_node_couldnt_get)
pools_your_node_couldnt_get = fetch_multicall(*[[self.factory,'allPairs',i] for i in poolids_your_node_couldnt_get])
token0s = fetch_multicall(*[[contract(pool), 'token0'] for pool in pools_your_node_couldnt_get if pool not in self.excluded_pools()])
token1s = fetch_multicall(*[[contract(pool), 'token1'] for pool in pools_your_node_couldnt_get if pool not in self.excluded_pools()])
Expand Down
2 changes: 1 addition & 1 deletion yearn/treasury/accountant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __ensure_signatures_are_known(addresses: List[Address]) -> None:
no_sigs.append(address)
except ContractNotFound:
# This is MOST LIKELY unimportant and not Yearn related.
logger.debug(f"{address.address} self destructed")
logger.debug("%s self destructed", address.address)
except ValueError as e:
if str(e).startswith("Source for") and str(e).endswith("has not been verified"):
continue
Expand Down
6 changes: 5 additions & 1 deletion yearn/treasury/accountant/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from typing import Any, Callable, Iterable, List, Optional, Tuple, Union

import sentry_sdk
from y import ContractNotVerified

from yearn.entities import TreasuryTx, TxGroup
from yearn.outputs.postgres.utils import cache_txgroup

Expand Down Expand Up @@ -57,8 +59,10 @@ def sort(self, tx: TreasuryTx) -> Optional[TxGroup]:
try:
if hasattr(self, 'check') and self.check(tx):
return self.txgroup
except ContractNotVerified:
logger.info("ContractNotVerified when sorting %s with %s", tx, self.label)
except Exception as e:
logger.warning(f"{e.__repr__()} when sorting {tx} with {self.label}.")
logger.warning("%s when sorting %s with %s.", e.__repr__(), tx, self.label)
sentry_sdk.capture_exception(e)
return None
return super().sort(tx)
Expand Down
Loading