Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructures project with proper imports. (#55)
- Loading branch information
Showing
26 changed files
with
66 additions
and
65 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import yaml | ||
import os | ||
|
||
|
||
def load_config(file_name): | ||
""" | ||
Loads the configurations located in the config file | ||
at config/config.yaml | ||
into the CONFIG dictionary. | ||
""" | ||
CONFIG = {} | ||
with open(file_name, 'r') as f: | ||
config_yaml = yaml.load(f) | ||
for config_key in config_yaml: | ||
CONFIG[config_key] = config_yaml[config_key] | ||
return CONFIG | ||
|
||
|
||
__location__ = os.path.realpath(os.path.join( | ||
os.getcwd(), os.path.dirname(__file__))) | ||
CONFIG = load_config(os.path.join(__location__, 'config.yaml')) | ||
|
||
|
||
def _get_seasons(): | ||
""" | ||
Returns a list of strings representing seasons in the format: | ||
'20XX-YY' | ||
""" | ||
start_year = CONFIG['START_YEAR'] | ||
end_year = CONFIG['END_YEAR'] | ||
|
||
seasons = [] | ||
while start_year != end_year: | ||
seasons.append('{}-{}'.format(start_year, (start_year + 1) % 100)) | ||
start_year += 1 | ||
return seasons | ||
|
||
|
||
SEASONS = _get_seasons() | ||
CONFIG['SEASONS'] = SEASONS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import initialize, request_logger, retrieve, store, utils |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
to prevent double scraping. | ||
""" | ||
|
||
import db.utils | ||
from nba_ss_db import db | ||
|
||
def init_db(): | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import scraper, utils |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from config import CONFIG | ||
from nba_ss_db import CONFIG | ||
CONFIG['DB_NAME'] = 'test_db' | ||
CONFIG['DB_PATH'] = 'tests/test_db/databases' | ||
from db.initialize import init_db | ||
import db.utils | ||
from nba_ss_db import db | ||
|
||
|
||
def init_test_db(): | ||
db.utils.drop_tables() | ||
init_db() | ||
db.initialize.init_db() | ||
db.utils.execute_sql("""CREATE TABLE IF NOT EXISTS | ||
player_ids (PLAYER_ID text, PLAYER_NAME text, SEASON text);""") |