Skip to content
Myr

Drop unneccessary __hash__ methods

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by Tom Christie · parent 06f6d50 · Browse files · 2 files+0 added−38 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+0 added−38 removed

  • tests:+0 added−21 removed
  • other:+0 added−17 removed

2 files+0 added−38 removed

modified:httpcore/config.py-17 removed
25 unmodified lines
26 and self.cert == other.cert27 and self.verify == other.verify28 )2930 def __hash__(self) -> int:31 as_tuple = (self.cert, self.verify)32 return hash(as_tuple)3330 def __repr__(self) -> str:31 class_name = self.__class__.__name__32 return f"{class_name}(cert={self.cert}, verify={self.verify})"33
105 unmodified lines
139 and self.write_timeout == other.write_timeout140 and self.pool_timeout == other.pool_timeout141 )142147 def __hash__(self) -> int:148 as_tuple = (149 self.connect_timeout,150 self.read_timeout,151 self.write_timeout,152 self.pool_timeout,153 )154 return hash(as_tuple)155143 def __repr__(self) -> str:144 class_name = self.__class__.__name__145 if self.timeout is not None:146 return f"{class_name}(timeout={self.timeout})"
20 unmodified lines
167 and self.soft_limit == other.soft_limit168 and self.hard_limit == other.hard_limit169 )170184 def __hash__(self) -> int:185 as_tuple = (self.soft_limit, self.hard_limit)186 return hash(as_tuple)187171 def __repr__(self) -> str:172 class_name = self.__class__.__name__173 return (174 f"{class_name}(soft_limit={self.soft_limit}, hard_limit={self.hard_limit})"
7 unmodified lines
modified:tests/test_config.py-21 removed
33 unmodified lines
3435def test_limits_eq():36 limits = httpcore.PoolLimits(hard_limit=100)37 assert limits == httpcore.PoolLimits(hard_limit=100)383940def test_ssl_hash():41 cache = {}42 ssl = httpcore.SSLConfig(verify=False)43 cache[ssl] = "example"44 assert cache[httpcore.SSLConfig(verify=False)] == "example"454647def test_timeout_hash():48 cache = {}49 timeout = httpcore.TimeoutConfig(timeout=5.0)50 cache[timeout] = "example"51 assert cache[httpcore.TimeoutConfig(timeout=5.0)] == "example"525354def test_limits_hash():55 cache = {}56 limits = httpcore.PoolLimits(hard_limit=100)57 cache[limits] = "example"58 assert cache[httpcore.PoolLimits(hard_limit=100)] == "example"