chore(Linter): reformatted code with black (#211)

* chore(Linter): reformatted code with black

* Create black.yaml
This commit is contained in:
Mark Aron Szulyovszky
2022-02-17 19:22:17 +01:00
committed by GitHub
parent f3fee4a4e1
commit 8dd2d88740
101 changed files with 2596 additions and 2320 deletions
+9 -8
View File
@@ -18,11 +18,11 @@ def unix_timestamp(date_str):
def is_supported_by_endpoint(glassnode_client, url):
path = glassnode_client.endpoints.query(url)
if glassnode_client.asset not in path['assets']:
print(f'{url} metric is not available for {glassnode_client.asset}')
if glassnode_client.asset not in path["assets"]:
print(f"{url} metric is not available for {glassnode_client.asset}")
return False
if glassnode_client.resolution not in path['resolutions']:
print(f'{url} metric is not available for {glassnode_client.resolution}')
if glassnode_client.resolution not in path["resolutions"]:
print(f"{url} metric is not available for {glassnode_client.resolution}")
return False
return True
@@ -36,8 +36,8 @@ def response_to_dataframe(response):
"""
try:
df = pd.DataFrame(response)
df.set_index('t', inplace=True)
df.index = pd.to_datetime(df.index, unit='s')
df.set_index("t", inplace=True)
df.index = pd.to_datetime(df.index, unit="s")
df.index.name = None
df.sort_index(ascending=False, inplace=True)
return df
@@ -48,7 +48,8 @@ def response_to_dataframe(response):
def dataframe_with_inner_object(func):
def wrapper(*args, **kwargs):
df = func(*args, **kwargs)
return pd.concat([df.drop(['o'], axis=1), df['o'].apply(pd.Series)], axis=1)
return pd.concat([df.drop(["o"], axis=1), df["o"].apply(pd.Series)], axis=1)
return wrapper
@@ -60,7 +61,7 @@ def fetch(endpoint, params=None):
:param endpoint: Endpoint url corresponding to some metric (ex. '/v1/metrics/market/price_usd')
:return: DataFrame of {'t' : datetime, 'v' : 'metric-value'} pairs
"""
r = requests.get(f'https://api.glassnode.com{endpoint}', params=params, stream=True)
r = requests.get(f"https://api.glassnode.com{endpoint}", params=params, stream=True)
try:
r.raise_for_status()
except requests.exceptions.HTTPError as e: