Metadata-Version: 2.1
Name: definitely-typed
Version: 0.2
Summary: Definitely typed. Type any object to any type as you wish.
Author-email: AWeirdDev <aweirdscratcher@gmail.com>
License: MIT License
        
        Copyright (c) 2024 AWeirdDev
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Source, https://github.com/AWeirdDev/definitely
Project-URL: Bug Tracker, https://github.com/AWeirdDev/definitely/issues
Keywords: typing,definitely,type-hints
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typing-extensions

# definitely
Typing tricks that make your type checker *a little* more quiet.

**Key features**:
- `definitely` – Type everything as you wish.
- `asyncily` – Run a function asynchronously.
- `asyncily_iterate` – Iterate through an iterator asynchronously.
- `reversely` – Reverse a dictionary.

```haskell
pip install definitely-typed
```

I should all be responsible about this, admittedly. Sorry guys.

## Methods
They just exist!

### <kbd>def</kbd> definitely
Definitely typed.

```python
person = "Charles"

# Transforms `person` into any type you desire
assert definitely(person, int)

reveal_type(person)
#           ^^^^^^
# runtime:     str
# typecheck:   int
```

The runtime type **WILL NOT** change, yet when `TYPE_CHECKING`, the variable acts just like the desired type (in this case, `int`).

### <kbd>def</kbd> asyncily
Asynchronously run a function.

```python
# You can use this as a decorator like so:
@asyncily
def buy_stuff(item: str):
    print("dad is going out!")
    time.sleep(2 << 40)
    print("came back with the %s!" % item)

await buy_stuff("milk")

# Or, you can use this as a "async function factory" like so:
def make(name: str):
    return f"Made product: {name!r}"

amake = asyncily(make)
await amake("milk")
```

### <kbd>def</kbd> asyncily_iterate
Asynchronously iterate through an iterator.

```python
def get_resources():
    yield from ["banana", "guava", "apple"]

async for resource in asyncily_iterate(get_resources()):
    print("-", resource)

# Output:
# - banana
# - guava
# - apple
```

### <kbd>def</kbd> reversely
Reverse a dictionary.

```python
metadata = {"password": 1234, "total_users": 100_000}
reversed_metadata = reversely(metadata)

assert reversed_metadata == {1234: "password", 100_000: "users"}

reveal_type(reversed_metadata)
#           ^^^^^^^^^^^^^^^^^
# runtime:     dict[int, str]
# typecheck:   dict[str, int]
```

***

(c) 2024 AWeirdDev, and other silly people
