Skip to content

Commit

Permalink
[dev] Bumping pre-commit version and running over all files
Browse files Browse the repository at this point in the history
  • Loading branch information
klieret committed Dec 30, 2020
1 parent 7ca9c6e commit 75b6c56
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
args: ["-l", "80", "-t", "py34"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Kilian Lieret
Copyright (c) 2019 Kilian Lieret

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion ankipandas/data/anki_fields.csv
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ rivl,ivl,revs,"The new interval that the card was pushed to after the review. Po
rlastIvl,lastIvl,revs,Last interval,TRUE,TRUE
rtime,time,revs,"How many milliseconds your review took, up to 60000 (60s)",TRUE,TRUE
rtype,type,revs,"Values: ‘learning’, ‘review’, ‘relearn’, ‘cram’ (cards being studied in a filtered deck when they are not due). In the raw Anki database this is 0 for learning cards, 1 for review cards, 2 for relearn cards, and 3 for cram cards. ",TRUE,TRUE
rusn,usn,revs,This column (update sequence number) is used to keep track of the sync state of reviews and provides no useful information for analysis.Value of -1 indicates changes that need to be pushed to server. usn < server usn indicates changes that need to be pulled from server.,TRUE,TRUE
rusn,usn,revs,This column (update sequence number) is used to keep track of the sync state of reviews and provides no useful information for analysis.Value of -1 indicates changes that need to be pushed to server. usn < server usn indicates changes that need to be pulled from server.,TRUE,TRUE
8 changes: 2 additions & 6 deletions ankipandas/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ def db_path_input(
"db_path_input: File '{}' does not exist.".format(str(path))
)
if path.is_file():
log.debug(
f"db_path_input: Database explicitly set to '{path}'."
)
log.debug(f"db_path_input: Database explicitly set to '{path}'.")
result = path
else:
result = find_db(
Expand Down Expand Up @@ -244,9 +242,7 @@ def get_anki_backup_folder(
"""
path = pathlib.Path(path)
if not path.is_file():
raise FileNotFoundError(
f"Database path {path} seems to be invalid."
)
raise FileNotFoundError(f"Database path {path} seems to be invalid.")
backup_folder = path.parent / "backups"
if nexist == "raise" and not backup_folder.is_dir():
raise ValueError(
Expand Down
4 changes: 1 addition & 3 deletions ankipandas/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ def read_info(db: sqlite3.Connection, table_name: str):
"""
version = get_db_version(db)
_df = pd.read_sql_query(
f"SELECT * FROM {table_name} ", db
)
_df = pd.read_sql_query(f"SELECT * FROM {table_name} ", db)
if version == 0:
assert len(_df) == 1, _df
ret = {}
Expand Down
16 changes: 4 additions & 12 deletions ankipandas/test/test_ankidf.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ def test_empty(self):
for table, eadf in eadfs.items():
self.assertEqual(len(eadf), 0)
adf = self.table2adf[table]
self.assertListEqual(
sorted(adf.columns), sorted(eadf.columns)
)
self.assertListEqual(sorted(adf.columns), sorted(eadf.columns))

def test_tags(self):
self.assertListEqual(
Expand All @@ -117,22 +115,16 @@ def test_tags(self):
def test_cards(self):
cards = self.cards
self.assertGreater(len(cards), 11)
self.assertEqual(
sorted(cards.columns), sorted(our_columns["cards"])
)
self.assertEqual(sorted(cards.columns), sorted(our_columns["cards"]))

def test_notes(self):
notes = self.notes
self.assertGreater(len(notes), 6)
self.assertEqual(
sorted(notes.columns), sorted(our_columns["notes"])
)
self.assertEqual(sorted(notes.columns), sorted(our_columns["notes"]))

def test_get_revs(self):
revs = self.revs
self.assertEqual(
sorted(revs.columns), sorted(our_columns["revs"])
)
self.assertEqual(sorted(revs.columns), sorted(our_columns["revs"]))
self.assertGreater(len(revs), 4)

# Test merging
Expand Down
3 changes: 1 addition & 2 deletions ankipandas/test/test_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,7 @@ def test_merge_dfs(self):
drop_columns=["id_add", "drop"],
)
self.assertListEqual(
sorted(df_merged.columns),
["_clash", "clash", "id_df", "value"],
sorted(df_merged.columns), ["_clash", "clash", "id_df", "value"],
)
self.assertListEqual(sorted(df_merged["value"]), [4, 4, 4, 5, 6])

Expand Down
1 change: 0 additions & 1 deletion doc/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ Readme
.. include:: ../README.rst
:start-after: start-body
:end-before: end-body

0 comments on commit 75b6c56

Please sign in to comment.