flake8: Is this the end?
This commit is contained in:
parent
65dff450c3
commit
329981fe49
12
cleanmedia
12
cleanmedia
@ -99,10 +99,10 @@ class MediaRepository:
|
|||||||
if not self.media_path.is_absolute():
|
if not self.media_path.is_absolute():
|
||||||
logging.warn("The media path is relative, make sure you run this script in the correct directory!")
|
logging.warn("The media path is relative, make sure you run this script in the correct directory!")
|
||||||
if not self.media_path.is_dir():
|
if not self.media_path.is_dir():
|
||||||
raise Exception(f"The configured media dir cannot be found!")
|
raise Exception("The configured media dir cannot be found!")
|
||||||
|
|
||||||
self.db_conn_string = connection_string # psql db connection
|
self.db_conn_string = connection_string # psql db connection
|
||||||
self.conn = self.connect_db();
|
self.conn = self.connect_db()
|
||||||
|
|
||||||
def connect_db(self) -> psycopg2.extensions.connection:
|
def connect_db(self) -> psycopg2.extensions.connection:
|
||||||
# postgresql://user:pass@localhost/database?params
|
# postgresql://user:pass@localhost/database?params
|
||||||
@ -166,8 +166,9 @@ def read_config(conf_file: Union[str, Path]) -> Tuple[Path, str]:
|
|||||||
exit(1)
|
exit(1)
|
||||||
return (BASE_PATH, CONN_STR)
|
return (BASE_PATH, CONN_STR)
|
||||||
|
|
||||||
|
|
||||||
def parse_options() -> argparse.Namespace:
|
def parse_options() -> argparse.Namespace:
|
||||||
loglevel=logging.INFO # default logging level
|
loglevel = logging.INFO # default logging level
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog='cleanmedia',
|
prog='cleanmedia',
|
||||||
description='Deletes 30 day old remote media files from dendrite servers')
|
description='Deletes 30 day old remote media files from dendrite servers')
|
||||||
@ -179,8 +180,9 @@ def parse_options() -> argparse.Namespace:
|
|||||||
help="Dry run (don't actually modify any files).")
|
help="Dry run (don't actually modify any files).")
|
||||||
parser.add_argument('-d', '--debug', action='store_true', help="Turn debug output on.")
|
parser.add_argument('-d', '--debug', action='store_true', help="Turn debug output on.")
|
||||||
args: argparse.Namespace = parser.parse_args()
|
args: argparse.Namespace = parser.parse_args()
|
||||||
if args.debug: loglevel=logging.DEBUG
|
if args.debug:
|
||||||
logging.basicConfig(level=loglevel, format= '%(levelname)s - %(message)s')
|
loglevel=logging.DEBUG
|
||||||
|
logging.basicConfig(level=loglevel, format='%(levelname)s - %(message)s')
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user