Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gwax committed Jul 1, 2016
1 parent 40f64f8 commit df81388
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions mtg_ssm/mtg/counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ class CountTypes(enum.Enum):
foils = 'foils'


def new_print_counts():
"""Get an appropriate defaultdict set up for use ase print counts."""
return collections.defaultdict(
lambda: collections.defaultdict(int))


def find_printing(cdb, set_code, name, set_number, multiverseid, strict=True):
"""Attempt to find a CardPrinting from given parameters."""
name = name or ''
Expand Down Expand Up @@ -109,8 +115,7 @@ def aggregate_print_counts(cdb, card_rows, strict=True):

def merge_print_counts(*print_counts_args):
"""Merge two sets of print_counts."""
print_counts = collections.defaultdict(
lambda: collections.defaultdict(int))
print_counts = new_print_counts()
for in_print_counts in print_counts_args:
for printing, counts in in_print_counts.items():
for key, value in counts.items():
Expand All @@ -120,8 +125,7 @@ def merge_print_counts(*print_counts_args):

def diff_print_counts(left, right):
"""Subtract right print counts from left print counts."""
print_counts = collections.defaultdict(
lambda: collections.defaultdict(int))
print_counts = new_print_counts()
for printing in left.keys() | right.keys():
left_counts = left.get(printing, {})
right_counts = right.get(printing, {})
Expand Down
2 changes: 1 addition & 1 deletion mtg_ssm/ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def merge_cmd(args):
"""Merge counts from one or more inputs into a new/existing collection."""
cdb = build_card_db(args.data_path, args.include_online_only)
coll_serializer = get_serializer(cdb, args.dialect, args.collection)
print_counts = {}
print_counts = counts.new_print_counts()
if os.path.exists(args.collection):
print('Reading counts from ' + args.collection)
print_counts = coll_serializer.read(args.collection)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import os
import tempfile
import textwrap
from unittest import mock

import pytest

Expand Down Expand Up @@ -41,6 +40,7 @@ def mock_build_cdb(*_):


def get_namespace(**kwargs):
"""Namespace with defaults constructor."""
defaults = {
'data_path': ssm.DEFAULT_DATA_PATH,
'include_online_only': False,
Expand Down

0 comments on commit df81388

Please sign in to comment.