Skip to content

Commit

Permalink
chore: fmt f-strings lazily
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Apr 8, 2024
1 parent 462bb95 commit c688dc3
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scripts/exporters/wallets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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 @@ -163,7 +163,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 @@ -73,7 +73,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

0 comments on commit c688dc3

Please sign in to comment.