summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-02-18 16:36:30 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-02-18 16:36:30 -0600
commit0259f32e880041e3fbfd7bfba2698723c71700c8 (patch)
treefd747e5a93706544e5263f352e7ab21bb56a7730 /src
parentaed766e32e9bb4f05514e180c1468a5a86fb08be (diff)
fix flake8 issues, still need to fix 80+ col lines
Diffstat (limited to 'src')
-rw-r--r--src/pyssg/builder.py1
-rw-r--r--src/pyssg/configuration.py6
-rw-r--r--src/pyssg/database.py4
-rw-r--r--src/pyssg/database_entry.py1
-rw-r--r--src/pyssg/md_parser.py5
-rw-r--r--src/pyssg/page.py5
-rw-r--r--src/pyssg/per_level_formatter.py1
-rw-r--r--src/pyssg/pyssg.py1
-rw-r--r--src/pyssg/yaml_parser.py3
9 files changed, 10 insertions, 17 deletions
diff --git a/src/pyssg/builder.py b/src/pyssg/builder.py
index c70994d..f09bf08 100644
--- a/src/pyssg/builder.py
+++ b/src/pyssg/builder.py
@@ -1,6 +1,5 @@
import os
import sys
-import pprint
from copy import deepcopy
from operator import itemgetter
from logging import Logger, getLogger
diff --git a/src/pyssg/configuration.py b/src/pyssg/configuration.py
index b68930c..7b292d5 100644
--- a/src/pyssg/configuration.py
+++ b/src/pyssg/configuration.py
@@ -1,6 +1,5 @@
import sys
from importlib.metadata import version
-from importlib.resources import path as rpath
from datetime import datetime, timezone
from logging import Logger, getLogger
@@ -67,8 +66,7 @@ def get_static_config() -> dict[str, dict]:
log.debug('reading and setting static config')
config: dict = get_parsed_yaml('static_config.yaml', 'pyssg.plt')[0]
# do I really need a lambda function...
- time = lambda x : datetime.now(tz=timezone.utc).strftime(config['fmt'][x])
config['info']['version'] = VERSION
- config['info']['rss_run_date'] = time('rss_date')
- config['info']['sitemap_run_date'] = time('sitemap_date')
+ config['info']['rss_run_date'] = datetime.now(tz=timezone.utc).strftime(config['fmt']['rss_date'])
+ config['info']['sitemap_run_date'] = datetime.now(tz=timezone.utc).strftime(config['fmt']['sitemap_date'])
return config
diff --git a/src/pyssg/database.py b/src/pyssg/database.py
index 40065ef..5d7d71d 100644
--- a/src/pyssg/database.py
+++ b/src/pyssg/database.py
@@ -36,7 +36,7 @@ class Database:
sys.exit(1)
def update(self, file_name: str,
- remove: str='') -> None:
+ remove: str = '') -> None:
log.debug('updating entry for file "%s"', file_name)
f: str = file_name
tags: list[str] = []
@@ -55,7 +55,7 @@ class Database:
# three cases, 1) entry didn't exist,
# 2) entry has been mod and,
# 3) entry hasn't been mod
- #1)
+ # 1)
if f not in self.e:
log.debug('entry "%s" didn\'t exist, adding with defaults', f)
self.e[f] = DatabaseEntry([f, time, 0.0, checksum, tags])
diff --git a/src/pyssg/database_entry.py b/src/pyssg/database_entry.py
index 1674a7c..5c3e659 100644
--- a/src/pyssg/database_entry.py
+++ b/src/pyssg/database_entry.py
@@ -1,4 +1,3 @@
-from typing import Union
from logging import Logger, getLogger
log: Logger = getLogger(__name__)
diff --git a/src/pyssg/md_parser.py b/src/pyssg/md_parser.py
index 07c62f8..3119db7 100644
--- a/src/pyssg/md_parser.py
+++ b/src/pyssg/md_parser.py
@@ -1,6 +1,5 @@
import os
from operator import itemgetter
-from markdown import Markdown
from logging import Logger, getLogger
from markdown import Markdown
@@ -71,8 +70,8 @@ class MDParser:
self.db.e[f].ctimestamp,
self.db.e[f].mtimestamp,
content,
- self.md.toc, # type: ignore
- self.md.toc_tokens, # type: ignore
+ self.md.toc, # type: ignore
+ self.md.toc_tokens, # type: ignore
self.md.Meta, # type: ignore
self.config,
self.dir_config)
diff --git a/src/pyssg/page.py b/src/pyssg/page.py
index 19c92f9..6b8916d 100644
--- a/src/pyssg/page.py
+++ b/src/pyssg/page.py
@@ -1,4 +1,3 @@
-import os
import sys
from datetime import datetime, timezone
from logging import Logger, getLogger
@@ -75,7 +74,7 @@ class Page:
log.warning('no mdatetime found, can\'t return a formatted string')
return ''
if format in self.config['fmt']:
- return self.mdatetime.strftime(self.config['fmt'][format]) # type: ignore
+ return self.mdatetime.strftime(self.config['fmt'][format]) # type: ignore
else:
log.warning('format "%s" not found in config["fmt"], returning empty string', format)
return ''
@@ -160,4 +159,4 @@ class Page:
self.og[k] = v
else:
- log.debug('no tags to parse') \ No newline at end of file
+ log.debug('no tags to parse')
diff --git a/src/pyssg/per_level_formatter.py b/src/pyssg/per_level_formatter.py
index 394471e..e3b6977 100644
--- a/src/pyssg/per_level_formatter.py
+++ b/src/pyssg/per_level_formatter.py
@@ -1,5 +1,6 @@
from logging import Formatter, LogRecord, DEBUG, INFO, WARNING, ERROR, CRITICAL
+
# only reason for this class is to get info formatting as normal text
# and everything else with more info and with colors
class PerLevelFormatter(Formatter):
diff --git a/src/pyssg/pyssg.py b/src/pyssg/pyssg.py
index e9cf28c..678000b 100644
--- a/src/pyssg/pyssg.py
+++ b/src/pyssg/pyssg.py
@@ -101,7 +101,6 @@ def main() -> None:
log.info('finished initialization')
sys.exit(0)
-
if args['build']:
log.info('building the html files')
for config in config_all:
diff --git a/src/pyssg/yaml_parser.py b/src/pyssg/yaml_parser.py
index 3109cbc..fb19a23 100644
--- a/src/pyssg/yaml_parser.py
+++ b/src/pyssg/yaml_parser.py
@@ -1,7 +1,6 @@
import yaml
from yaml import SafeLoader
from yaml.nodes import SequenceNode
-from io import TextIOWrapper
from importlib.resources import path as rpath
from logging import Logger, getLogger
@@ -22,7 +21,7 @@ def __read_raw_yaml(path: str) -> list[dict]:
return all_docs
-def get_parsed_yaml(resource: str, package: str='') -> list[dict]:
+def get_parsed_yaml(resource: str, package: str = '') -> list[dict]:
if package == '':
log.debug('parsing yaml; reading "%s"', resource)
return __read_raw_yaml(resource)