Skip to content

Commit

Permalink
some CI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Nov 14, 2023
1 parent 58da2d6 commit 49784cd
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,21 @@ class DistinguishedState:
distinct from ones we have previously seen so far."""

# Index of this state in the learner's list of states
index = attr.ib()
index: int = attr.ib()

# A string that witnesses this state (i.e. when starting from the origin
# and following this string you will end up in this state).
label = attr.ib()
label: str = attr.ib()

# A boolean as to whether this is an accepting state.
accepting = attr.ib()
accepting: bool = attr.ib()

# A list of experiments that it is necessary to run to determine whether
# a string is in this state. This is stored as a dict mapping experiments
# to their expected result. A string is only considered to lead to this
# state if ``all(learner.member(s + experiment) == result for experiment,
# result in self.experiments.items())``.
experiments = attr.ib()
experiments: dict = attr.ib()

# A cache of transitions out of this state, mapping bytes to the states
# that they lead to.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ def new_shrinker(self, example, predicate=None, allow_transition=None):
self,
example,
predicate,
allow_transition,
allow_transition=allow_transition,
explain=Phase.explain in self.settings.phases,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def __init__(
engine: "ConjectureRunner",
initial: ConjectureData,
predicate: Optional[Callable[..., bool]],
*,
allow_transition: bool,
explain: bool,
):
Expand All @@ -282,7 +283,7 @@ def __init__(
self.engine = engine
self.__predicate = predicate or (lambda data: True)
self.__allow_transition = allow_transition or (lambda source, destination: True)
self.__derived_values = {}
self.__derived_values: dict = {}
self.__pending_shrink_explanation = None

self.initial_size = len(initial.buffer)
Expand Down Expand Up @@ -479,7 +480,7 @@ def s(n):
self.debug("Useless passes:")
self.debug("")
for p in sorted(
self.passes_by_name,
self.passes_by_name.values(),
key=lambda t: (-t.calls, t.deletions, t.shrinks),
):
if p.calls == 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import inspect
import math
from random import Random
from typing import Dict
from typing import Any, Dict

import attr

Expand Down Expand Up @@ -153,7 +153,7 @@ def implementation(self, **kwargs):
@attr.s(slots=True)
class RandomState:
next_states: dict = attr.ib(factory=dict)
state_id = attr.ib(default=None)
state_id: Any = attr.ib(default=None)


def state_for_seed(data, seed):
Expand Down
12 changes: 1 addition & 11 deletions hypothesis-python/src/hypothesis/strategies/_internal/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,7 @@
from functools import partial
from pathlib import PurePath
from types import FunctionType
from typing import (
TYPE_CHECKING,
Any,
Callable,
Collection,
Iterator,
List,
Tuple,
get_args,
get_origin,
)
from typing import TYPE_CHECKING, Any, Collection, Iterator, Tuple, get_args, get_origin

from hypothesis import strategies as st
from hypothesis.errors import HypothesisWarning, InvalidArgument, ResolutionFailed
Expand Down
4 changes: 2 additions & 2 deletions hypothesis-python/tests/cover/test_attrs_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ class Inferrables:
typing_union = attr.ib(type=typing.Union[str, int])

has_default = attr.ib(default=0)
has_default_factory = attr.ib(factory=list)
has_default_factory = attr.ib(default=attr.Factory(list))
has_default_factory_takes_self = attr.ib( # uninferrable but has default
factory=lambda _: [], takes_self=True
default=attr.Factory(lambda _: [], takes_self=True)
)


Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tests/test_annotated_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import annotated_types as at
except ImportError:
pytest.skip()
pytest.skip(allow_module_level=True)


def test_strategy_priority_over_constraints():
Expand Down

0 comments on commit 49784cd

Please sign in to comment.