From 19ea3f3b87739738f414f7ff1fad3ceacb5decab Mon Sep 17 00:00:00 2001 From: Davis Thames Date: Tue, 24 Apr 2018 21:51:23 -0500 Subject: [PATCH] Added api cleaning tools, moved parser commands in script. --- CONTRIBUTING.rst | 2 +- tools/api_key_tool.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 1788b4e..6a506e6 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -118,7 +118,7 @@ To regenerate fixture remove it from tests/fixtures and run tests again:: $ rm tests/fixtures/NAME.yaml $ py.test -In order for py.test to have run, you will have had to create an environment variable containing a valid tiingo API key so that the test runner can make a valid api call. One way to do that is to:: +In order for py.test to run, you will have had to create an environment variable containing a valid tiingo API key so that the test runner can make a valid api call. One way to do that is to:: $ export TIINGO_API_KEY='...insert api key here...' diff --git a/tools/api_key_tool.py b/tools/api_key_tool.py index c2d260f..1d42d09 100644 --- a/tools/api_key_tool.py +++ b/tools/api_key_tool.py @@ -9,10 +9,6 @@ zeroapiregex = r'(\[Token )0{40}(\])' anyapiregex = r'(\[Token ).{40}(\])' zeroapistring = '[Token '+40*'0'+']' -parser = argparse.ArgumentParser() -parser.add_argument("path", help="path to test fixtures", - nargs='?', default=fixturesDirectory) -args = parser.parse_args() def api_key_detector(file): ''' @@ -55,4 +51,8 @@ def main(path): print("Changed {} files.".format(nFilesChanged)) if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument("path", help="path to test fixtures", + nargs='?', default=fixturesDirectory) + args = parser.parse_args() main(args.path)