| 1 |
# This file is part of Hypothesis, which may be found at |
| 2 |
# https://github.com/HypothesisWorks/hypothesis/ |
| 3 |
# |
| 4 |
# Copyright the Hypothesis Authors. |
| 5 |
# Individual contributors are listed in AUTHORS.rst and the git log. |
| 6 |
# |
| 7 |
# This Source Code Form is subject to the terms of the Mozilla Public License, |
| 8 |
# v. 2.0. If a copy of the MPL was not distributed with this file, You can |
| 9 |
# obtain one at https://mozilla.org/MPL/2.0/. |
| 10 |
|
| 11 |
from __future__ import annotations |
| 12 |
|
| 13 |
import collections.abc |
| 14 |
|
| 15 |
|
| 16 |
class CustomClass: |
| 17 |
def __init__(self, number: int) -> None: |
| 18 |
self.number = number |
| 19 |
|
| 20 |
|
| 21 |
def add_custom_classes(c1: CustomClass, c2: CustomClass | None = None) -> CustomClass: |
| 22 |
if c2 is None: |
| 23 |
return CustomClass(c1.number) |
| 24 |
return CustomClass(c1.number + c2.number) |
| 25 |
|
| 26 |
|
| 27 |
def merge_dicts( |
| 28 |
map1: collections.abc.Mapping[str, int], map2: collections.abc.Mapping[str, int] |
| 29 |
) -> collections.abc.Mapping[str, int]: |
| 30 |
return {**map1, **map2} |
| 31 |
|
| 32 |
|
| 33 |
def invalid_types(attr1: int, attr2: UnknownClass, attr3: str) -> None: # noqa: F821 |
| 34 |
pass |