Skip to content

Commit ac607d6

Browse files
Update hello.py
1 parent 8832240 commit ac607d6

File tree

1 file changed

+41
-27
lines changed

1 file changed

+41
-27
lines changed

hello.py

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,72 @@
11
#!/usr/bin/env python3
22

3+
# fmt: off
34
# import argparse
5+
import arrow
46
# import git
57
# import numpy as np
68
# import os
7-
# import pandas as pd
9+
import pandas as pd
810
# import re
911
# import requests
1012
# import requests_cache
13+
# import subprocess
14+
# import time
1115
# from bs4 import BeautifulSoup, Comment
12-
# from datetime import timedelta
13-
# from decouple import config
16+
from datetime import timedelta
17+
from decouple import config
18+
# from functools import wraps
1419
# from icecream import ic
1520
# from <local.py_module> import *
1621
from pathlib import Path
1722
# from playwright.async_api import async_playwright
1823
# from playwright.sync_api import sync_playwright
1924
# from prettytable import PrettyTable
2025
# from requests_cache import CachedSession
26+
# fmt: on
2127

2228
"""
2329
The commented out section is boilerplate for common operations.
2430
Feel free to uncomment and/or delete after first commit.
2531
"""
26-
## env
32+
# env
2733
home = Path.home()
28-
# now = datetime.datetime.now()
29-
# out = f"{home}/Downloads/result_{now:%Y%m%d_%H%M%S}.csv"
30-
env = Path('.env')
34+
cwd = Path.cwd()
35+
now = arrow.now().format('YYYYMMDD_HHmmss')
36+
out = f"{cwd}/formatted/results_{now}.csv"
37+
38+
# env vars (hierachy: args, env, .env)
39+
HOST = config('HOST', default='localhost')
40+
USER = config('USER')
41+
PASS = config('PASS')
3142

3243
## verbose icecream
3344
# ic.configureOutput(includeContext=True)
3445

35-
## pwd
36-
cwd = Path.cwd()
37-
# print(f"Current working directory: {cwd}")
3846

39-
## create file and parent directories
40-
# meta_file = f"{cwd}/metadata/metadata.json"
41-
# Path(meta_file).parents[0].mkdir(parents=True, exist_ok=True)
47+
# def timeit(func):
48+
# @wraps(func)
49+
# def timeit_wrapper(*args, **kwargs):
50+
# start_time = time.perf_counter()
51+
# result = func(*args, **kwargs)
52+
# end_time = time.perf_counter()
53+
# total_time = end_time - start_time
54+
# print(f"Function {func.__name__}{args} {kwargs} Took {total_time:.4f} seconds")
55+
# return result
56+
57+
# return timeit_wrapper
58+
59+
60+
# @timeit
61+
# def sub_get_url(id):
62+
# cmd = f"mas info {id} | awk '/https/ {{print $NF}}'"
63+
64+
# return subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
65+
66+
67+
# # 0.1730, 1.7148 seconds
68+
# sub_get_url(490179405)
69+
4270

4371
# # clone substrapunks repo
4472
# if not Path(cwd/'substrapunks').exists():
@@ -64,26 +92,12 @@
6492
# print("Exiting...")
6593
# exit()
6694

67-
# if cwd != dir_path:
68-
# os.chdir(dir_path)
69-
# print(os.getcwd())
70-
7195
# folders = ['logs', 'user_data']
7296

7397
# for folder in folders:
7498
# if not Path(folder).exists():
7599
# os.mkdir(os.path.join(cwd, folder))
76100

77-
# # creds
78-
# if env.exists():
79-
# HOST = config('HOST', default='localhost')
80-
# USER = config('USER')
81-
# PASS = config('PASS')
82-
# else:
83-
# HOST = os.getenv('HOST', default='localhost')
84-
# USER = os.getenv('USER')
85-
# PASS = os.getenv('PASS')
86-
87101
## mkdir -p ./csv && cd $_
88102
# if Path('csv').exists():
89103
# os.chdir('./csv')

0 commit comments

Comments
 (0)