Skip to content

Commit

Permalink
core/generate/utility: rename 'count' field
Browse files Browse the repository at this point in the history
According to python/mypy#4507, the issue is that `NamedTuple` inherits from
`tuple`, and `tuple` defines a base method `tuple.count`. This causes a problem
for mypy, and currently the best solution is to just pick a different name.
  • Loading branch information
pdarragh committed Mar 24, 2021
1 parent e9d9692 commit 1d2d339
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sweetpea/core/generate/sample_non_uniform.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def sample_non_uniform_from_specification(spec: ProblemSpecification) -> List[So
SweetPea's input was given as JSON files. This should no longer be
necessary.
"""
return sample_non_uniform(spec.count, spec.cnf, spec.fresh, spec.support, spec.requests)
return sample_non_uniform(spec.sample_count, spec.cnf, spec.fresh, spec.support, spec.requests)


def compute_solutions(filename: Path,
Expand Down
4 changes: 2 additions & 2 deletions sweetpea/core/generate/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def from_json(s: str) -> SampleType:
class ProblemSpecification(NamedTuple):
"""A specification of a complete problem to be solved."""
sample_type: SampleType
count: int
sample_count: int
fresh: int
support: int
cnf: CNF
Expand All @@ -101,7 +101,7 @@ def from_json(data: JSONDict) -> ProblemSpecification:
"""Converts a JSON object to a ProblemSpecification."""
return ProblemSpecification(
sample_type=SampleType.from_json(data['action']),
count=data['sampleCount'],
sample_count=data['sampleCount'],
fresh=data['fresh'],
support=data['support'],
cnf=CNF(data['cnfs']),
Expand Down

0 comments on commit 1d2d339

Please sign in to comment.