diff --git a/autology/commands/main.py b/autology/commands/main.py index 9a63411..d7fedc4 100644 --- a/autology/commands/main.py +++ b/autology/commands/main.py @@ -2,12 +2,12 @@ from pkg_resources import iter_entry_points -from autology.configuration import load_configuration_file as _load_configuration_file from autology import topics +from autology.configuration import load_configuration_file as _load_configuration_file def _build_arguments(): - """Load subcommands defined in setup.py and allow them to build their arguments.""" + """Load sub-commands defined in setup.py and allow them to build their arguments.""" parser = argparse.ArgumentParser(description='Execute autology root command') parser.add_argument('--config', '-c', action='store', default='config.yaml',) diff --git a/autology/commands/subcommands/dump_config.py b/autology/commands/subcommands/dump_config.py index f99404f..f34ed9b 100644 --- a/autology/commands/subcommands/dump_config.py +++ b/autology/commands/subcommands/dump_config.py @@ -7,7 +7,7 @@ def register_command(subparser): - """Register the subcommand with any additional arguments.""" + """Register the sub-command with any additional arguments.""" parser = subparser.add_parser('dump_config', help='Create a new note object.') parser.set_defaults(func=_main) diff --git a/autology/commands/subcommands/export_log_templates.py b/autology/commands/subcommands/export_log_templates.py index 1538044..49cdaf0 100644 --- a/autology/commands/subcommands/export_log_templates.py +++ b/autology/commands/subcommands/export_log_templates.py @@ -6,7 +6,7 @@ def register_command(subparser): - """Register the subcommand with any additional arguments.""" + """Register the sub-command with any additional arguments.""" parser = subparser.add_parser('export_log_templates', help='Export the defined log templates to a directory') parser.set_defaults(func=_main) diff --git a/autology/commands/subcommands/generate.py b/autology/commands/subcommands/generate.py index 438bc62..ca6b21e 100644 --- a/autology/commands/subcommands/generate.py +++ b/autology/commands/subcommands/generate.py @@ -2,12 +2,12 @@ import datetime import pathlib -from autology.configuration import get_configuration from autology import topics +from autology.configuration import get_configuration def register_command(subparser): - """Register the subcommand with any additional arguments.""" + """Register the sub-command with any additional arguments.""" generator_parser = subparser.add_parser('generate', help='Generate the static content') generator_parser.set_defaults(func=_main) diff --git a/autology/commands/subcommands/initialize.py b/autology/commands/subcommands/initialize.py index ccd9fca..3cf77b8 100644 --- a/autology/commands/subcommands/initialize.py +++ b/autology/commands/subcommands/initialize.py @@ -1,16 +1,18 @@ """Sub-command that will initialize an autology area.""" import pathlib -from autology.configuration import get_configuration -import yaml -import io import zipfile + +import io import requests +import yaml + +from autology.configuration import get_configuration -DEFAULT_TEMPLATES_URL = 'https://github.com/MeerkatLabs/autology_templates/archive/master.zip' +DEFAULT_TEMPLATES_URL = 'https://github.com/MeerkatLabs/autology_templates/archive/v0.0.1.zip' def register_command(subparser): - """Register the subcommand with any additional arguments.""" + """Register the sub-command with any additional arguments.""" parser = subparser.add_parser('init', help='Initialize area for gathering content.') parser.set_defaults(func=_main) @@ -33,7 +35,7 @@ def _main(args): except requests.exceptions.MissingSchema: template_file = templates - # template output directory is output/templates, so need to create that location before pulling out the tempaltes + # template output directory is output/templates, so need to create that location before pulling out the templates template_location = main_path / 'templates' / 'output' template_location.mkdir(parents=True, exist_ok=True) templates_path = None diff --git a/autology/commands/subcommands/make_note.py b/autology/commands/subcommands/make_note.py index 76778b7..3c9f5de 100644 --- a/autology/commands/subcommands/make_note.py +++ b/autology/commands/subcommands/make_note.py @@ -1,15 +1,17 @@ """Sub-command that will create a new note file for the log.""" -from autology.configuration import add_default_configuration, get_configuration, get_configuration_root -from pkg_resources import iter_entry_points -import frontmatter import datetime import pathlib import subprocess + +import frontmatter +from pkg_resources import iter_entry_points + from autology import topics +from autology.configuration import add_default_configuration, get_configuration, get_configuration_root def register_command(subparser): - """Register the subcommand with any additional arguments.""" + """Register the sub-command with any additional arguments.""" parser = subparser.add_parser('make_note', help='Create a new note object.') parser.set_defaults(func=_main) diff --git a/autology/commands/subcommands/serve.py b/autology/commands/subcommands/serve.py index 29e0a20..ecd53b2 100644 --- a/autology/commands/subcommands/serve.py +++ b/autology/commands/subcommands/serve.py @@ -1,14 +1,16 @@ -"""Subcommand that hosts the output directory of the publisher as a web server.""" +"""Sub-command that hosts the output directory of the publisher as a web server.""" +import pathlib import urllib +from http.server import HTTPServer, SimpleHTTPRequestHandler + import os import posixpath -import pathlib + from autology.configuration import get_configuration -from http.server import HTTPServer, SimpleHTTPRequestHandler def register_command(subparser): - """Register the subcommand with any additional arguments.""" + """Register the sub-command with any additional arguments.""" parser = subparser.add_parser('serve', help='Serve the contents of the publishers output files') parser.set_defaults(func=_main) diff --git a/autology/publishing.py b/autology/publishing.py index 01815fc..24bd4f9 100644 --- a/autology/publishing.py +++ b/autology/publishing.py @@ -2,13 +2,15 @@ Provides wrapper around common publishing functionality. """ import pathlib + import markdown -import yaml import shutil +import yaml +from dict_recursive_update import recursive_update from jinja2 import Environment, FileSystemLoader, select_autoescape + from autology import topics from autology.configuration import add_default_configuration, get_configuration -from dict_recursive_update import recursive_update _environment = None _output_path = None @@ -96,7 +98,7 @@ def publish(template, output_file, context=None, **kwargs): def url_filter(url): - """Filter that will prepend the URL root for links in order to put the log in a directory on a webserver.""" + """Filter that will prepend the URL root for links in order to put the log in a directory on a web server.""" config = get_configuration() if config.publishing.url_root: return "{}{}".format(get_configuration().publishing.url_root, url) diff --git a/autology/reports/index.py b/autology/reports/index.py index 9bf1e0c..8135bc4 100644 --- a/autology/reports/index.py +++ b/autology/reports/index.py @@ -1,6 +1,7 @@ """Report that builds the index file.""" import datetime import pathlib + from autology import topics from autology.publishing import publish diff --git a/autology/reports/project/project.py b/autology/reports/project/project.py index affba87..06e3316 100644 --- a/autology/reports/project/project.py +++ b/autology/reports/project/project.py @@ -1,11 +1,14 @@ """Processes the front data in the markdown files to process project stat recordings.""" -import frontmatter -from autology import topics -from yaml import load_all import datetime import pathlib -from autology.reports.models import Report + +import frontmatter +from yaml import load_all + +from autology import topics from autology.publishing import publish +from autology.reports.models import Report + try: from yaml import CLoader as Loader except ImportError: diff --git a/autology/reports/project/template.py b/autology/reports/project/template.py index ae830e0..48ad80e 100644 --- a/autology/reports/project/template.py +++ b/autology/reports/project/template.py @@ -1,6 +1,6 @@ """Template for the project log files.""" -from autology.reports.timeline.template import template_start as timeline_start, template_end as timeline_end from autology.reports.models import Template +from autology.reports.timeline.template import template_start as timeline_start, template_end as timeline_end def register_template(): diff --git a/autology/reports/timeline/template.py b/autology/reports/timeline/template.py index cee2ab4..eace1f7 100644 --- a/autology/reports/timeline/template.py +++ b/autology/reports/timeline/template.py @@ -1,6 +1,8 @@ """Simple template definition for a log file that contains start time, end time, location, and empty content.""" from datetime import datetime + import frontmatter + from autology.reports.models import Template @@ -20,7 +22,7 @@ def template_start(): def template_end(post): """ - Finish the manipulation of the metadata in the frontmatter before saving the contents to the storage engine. + Finish the manipulation of the metadata in the front matter before saving the contents to the storage engine. :param post: the post file that will be modified. """ if not post.metadata['end_time']: diff --git a/autology/reports/timeline/timeline.py b/autology/reports/timeline/timeline.py index a1cf2c9..a3b8cd2 100644 --- a/autology/reports/timeline/timeline.py +++ b/autology/reports/timeline/timeline.py @@ -1,15 +1,15 @@ """ Timeline report that will process all of the files into a timeline in order to be published to the log. """ -from operator import attrgetter -import frontmatter import pathlib from datetime import datetime, time + +import frontmatter from collections import namedtuple -from autology.reports.models import Report from autology import topics from autology.publishing import publish +from autology.reports.models import Report from autology.utilities import log_file as log_file_utils # The content that is stored for each individual day diff --git a/autology/storage.py b/autology/storage.py index 9207cb5..483cdde 100644 --- a/autology/storage.py +++ b/autology/storage.py @@ -5,9 +5,9 @@ Current implementation assumes that git is initialized in the project directory, and has a remote named origin. """ import git -from autology.configuration import get_configuration_root, add_default_configuration, get_configuration -from autology import topics +from autology import topics +from autology.configuration import get_configuration_root, add_default_configuration, get_configuration # The current repository that all of the files will be stored/modified in. _repo = None diff --git a/autology/utilities/log_file.py b/autology/utilities/log_file.py index c01b54e..c008715 100644 --- a/autology/utilities/log_file.py +++ b/autology/utilities/log_file.py @@ -6,10 +6,10 @@ def get_start_time(date, front_matter, file_path=None): """ - Convert the details in frontmatter into a start time for the file. If there isn't a value stored in the frontmatter - data values, then if defined the file_path will be used. + Convert the details in front matter into a start time for the file. If there isn't a value stored in the front + matter data values, then if defined the file_path will be used. - Will search for start_time key in the frontmatter dictionary, if that value is a string, then it will be parsed as: + Will search for start_time key in the front matter dictionary, if that value is a string, then it will be parsed as: HH:MM. If it's an integer or a if it's a duration, then it will be parsed as [HH:]MM:SS duration value which is what YAML uses by default. Please know that this is because of YAML parsing rules. diff --git a/setup.py b/setup.py index 48bf346..3fc529b 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='autology', - version='0.1.0.dev', + version='0.1.0', packages=find_packages(), url='', license='MIT',