Skip to content

Commit

Permalink
blacken
Browse files Browse the repository at this point in the history
  • Loading branch information
betsybookwyrm committed Nov 16, 2021
1 parent 3daf9e0 commit 2db0a5d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 0 additions & 1 deletion tidy_tweet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@


logger = getLogger(__name__)

12 changes: 5 additions & 7 deletions tidy_tweet/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
logger = getLogger(__name__)


def initialise_sqlite(db_name: Union[str, PathLike], allow_existing_database: bool=False):
def initialise_sqlite(
db_name: Union[str, PathLike], allow_existing_database: bool = False
):
"""
Creates and initifromalises an empty sqlite database for loading tweet data into.
Expand Down Expand Up @@ -60,9 +62,7 @@ def _load_page_object(page_json: Mapping, connection: sqlite3.Connection):

# Includes
if "media" in page_json["includes"]:
add_mappings(
mappings, mapping.map_media(page_json["includes"]["media"])
)
add_mappings(mappings, mapping.map_media(page_json["includes"]["media"]))

for user in page_json["includes"]["users"]:
add_mappings(mappings, mapping.map_user(user))
Expand All @@ -81,9 +81,7 @@ def _load_page_object(page_json: Mapping, connection: sqlite3.Connection):
elif not isinstance(table_mappings, list):
db.execute(mapping.sql_by_table[table]["insert"], table_mappings)
else:
db.executemany(
mapping.sql_by_table[table]["insert"], table_mappings
)
db.executemany(mapping.sql_by_table[table]["insert"], table_mappings)


def load_twarc_json_to_sqlite(
Expand Down

0 comments on commit 2db0a5d

Please sign in to comment.