Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rgioai committed Aug 26, 2016
1 parent b00c173 commit 3926a37
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
34 changes: 24 additions & 10 deletions CLI.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/usr/bin/env python3

"""Command line interface for EDGAR project.
When edgar bash function is in ~/.bash_profile, call using:
edgar fn arg1 arg2 arg3 arg4"""

import sys
import os
import subprocess
from crawling.IndexCrawler import IndexCrawler
from crawling.DocumentCrawler import DocumentCrawler
from objects.ref.ref_functions import *

"""
CLI for EDGAR project. When edgar bash function is in ~/.bash_profile, call using:
edgar fn arg1 arg2 arg3 arg4
Current implementations:
-CLI test: Prints arguments to verify correct edgar bash function, verifies and prints storage directory
fn: -t or test
Expand All @@ -34,11 +37,12 @@
arg2: ending year
arg3: List of files to download ['form1', form2']; -d to default ['10-K', '10-Q', '10-K/A', '10-Q/A']
arg4: Decimal hours of how long the document crawler should run before timeout
-Update reference: Updates CIK_List.pkl and file structure based on objects/ref/ref_functions.py
-Update reference: Updates package files (see args)
fn: -ref or update_ref'
arg1: n/a
arg2: n/a
arg3: n/a
1: update; 0: do nothing
arg1: CIK_List.pkl based on objects/ref/ref_functions.py
arg2: File structure based on objects/ref/ref_functions.py
arg3: docs via pydoc
arg4: n/a
"""

Expand Down Expand Up @@ -125,6 +129,16 @@
dc.crawl(start, end, to_download, timeout)

elif fn == '-ref' or fn == 'update_ref':
print("Updating reference")
init_cik_list()
update_file_structure()
if arg1 == '1':
print("Updating CIK_List.pkl")
init_cik_list()
elif arg2 == '1':
update_file_structure()
print("Updating file structure")
elif arg3 == '1':
# TODO Fix functionality
os.chdir('EDGAR/docs')
subprocess.run(['pydoc -w EDGAR/*/*/*'])
print("Generating docs")
elif arg4 == '1':
pass
8 changes: 4 additions & 4 deletions objects/ref/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# v0.1.1 requires no init.
from ref_functions import *
from .ref_functions import *
import subprocess

subprocess.run(['chmod 751 setup.sh', './setup.sh'])
#subprocess.run(['chmod 751 EDGAR/objects/ref/setup.sh', './EDGAR/objects/ref/setup.sh'])

ref_functions.init_cik_list()
#ref_functions.init_cik_list()

ref_functions.update_file_structure()
#ref_functions.update_file_structure()

0 comments on commit 3926a37

Please sign in to comment.