You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

named

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

named - pypi Package Compare versions

Comparing version
1.4.1
to
1.4.2
+18
-7
named/__init__.py
"""Named types.
This library defines the [`Named`][named.typing.Named] protocol for types
This library defines the [`Named`][named.core.Named] protocol for types
that contain the `__name__` attribute, abstracting the attribute itself away.
It also provides the [`get_name`][named.typing.get_name] function to fetch
the name of the item provided, along with [`get_type_name`][named.typing.get_type_name], such that
It also provides the [`get_name`][named.core.get_name] function to fetch
the name of the item provided, along with [`get_type_name`][named.core.get_type_name], such that

@@ -15,5 +15,16 @@ ```python

Lastly, there is the type guard function called [`is_named`][named.typing.is_named], which checks
for the presence of `__name__` attribute
(which is exported in the [`NAME`][named.typing.NAME] constant).
Lastly, there is the type guard function called [`is_named`][named.core.is_named]
(aliased as [`has_name`][named.core.has_name]), which checks for the presence
of `__name__` attribute (which is exported in the [`NAME`][named.core.NAME] constant).
This library also provides the functionality for accessing and manipulating module names:
| `__name__` | `__module__` |
|---------------------------------------------|-------------------------------------------------|
| [`Named`][named.core.Named] | [`Moduled`][named.core.Moduled] |
| [`get_name`][named.core.get_name] | [`get_module`][named.core.get_module] |
| [`get_type_name`][named.core.get_type_name] | [`get_type_module`][named.core.get_type_module] |
| [`is_named`][named.core.is_named] | [`is_moduled`][named.core.is_moduled] |
| [`has_name`][named.core.has_name] | [`has_module`][named.core.has_module] |
| [`NAME`][named.core.NAME] | [`MODULE`][named.core.MODULE] |
"""

@@ -27,3 +38,3 @@

__license__ = "MIT"
__version__ = "1.4.1"
__version__ = "1.4.2"

@@ -30,0 +41,0 @@ from named.core import (

from builtins import hasattr as has_attribute
from typing import Any, Protocol, runtime_checkable
from typing_extensions import TypeGuard
from typing_extensions import TypeIs

@@ -40,3 +40,3 @@ __all__ = (

def get_name(item: Named) -> str:
"""Fetches the `__name__` of the [`Named`][named.typing.Named] `item`.
"""Fetches the `__name__` of the [`Named`][named.core.Named] `item`.

@@ -53,3 +53,3 @@ Arguments:

def set_name(item: Named, name: str) -> None:
"""Sets the `__name__` of the [`Named`][named.typing.Named] `item`.
"""Sets the `__name__` of the [`Named`][named.core.Named] `item`.

@@ -85,4 +85,4 @@ Arguments:

def is_named(item: Any) -> TypeGuard[Named]:
"""Checks if the `item` implements the [`Named`][named.typing.Named] protocol.
def is_named(item: Any) -> TypeIs[Named]:
"""Checks if the `item` implements the [`Named`][named.core.Named] protocol.

@@ -93,3 +93,3 @@ Arguments:

Returns:
Whether the item implements the [`Named`][named.typing.Named] protocol.
Whether the item implements the [`Named`][named.core.Named] protocol.
"""

@@ -100,3 +100,3 @@ return has_attribute(item, NAME)

has_name = is_named
"""An alias of [`is_named`][named.typing.is_named]."""
"""An alias of [`is_named`][named.core.is_named]."""

@@ -116,3 +116,3 @@

def get_module(item: Moduled) -> str:
"""Fetches the `__module__` of the [`Moduled`][named.typing.Moduled] `item`.
"""Fetches the `__module__` of the [`Moduled`][named.core.Moduled] `item`.

@@ -129,3 +129,3 @@ Arguments:

def set_module(item: Moduled, module: str) -> None:
"""Sets the `__module__` of the [`Moduled`][named.typing.Moduled] `item`.
"""Sets the `__module__` of the [`Moduled`][named.core.Moduled] `item`.

@@ -161,4 +161,4 @@ Arguments:

def is_moduled(item: Any) -> TypeGuard[Moduled]:
"""Checks if the `item` implements the [`Moduled`][named.typing.Moduled] protocol.
def is_moduled(item: Any) -> TypeIs[Moduled]:
"""Checks if the `item` implements the [`Moduled`][named.core.Moduled] protocol.

@@ -169,3 +169,3 @@ Arguments:

Returns:
Whether the item implements the [`Moduled`][named.typing.Moduled] protocol.
Whether the item implements the [`Moduled`][named.core.Moduled] protocol.
"""

@@ -176,2 +176,2 @@ return has_attribute(item, MODULE)

has_module = is_moduled
"""An alias of [`is_moduled`][named.typing.is_moduled]."""
"""An alias of [`is_moduled`][named.core.is_moduled]."""
Metadata-Version: 2.1
Name: named
Version: 1.4.1
Version: 1.4.2
Summary: Named types.

@@ -76,3 +76,3 @@ Home-page: https://github.com/nekitdev/named

[tool.poetry.dependencies]
named = "^1.4.1"
named = "^1.4.2"
```

@@ -79,0 +79,0 @@

[tool.poetry]
name = "named"
version = "1.4.1"
version = "1.4.2"
description = "Named types."

@@ -37,10 +37,10 @@ authors = ["nekitdev"]

[tool.poetry.group.format.dependencies]
ruff = "0.2.2"
ruff = "0.3.2"
[tool.poetry.group.check.dependencies]
mypy = "1.8.0"
mypy = "1.9.0"
[tool.poetry.group.test.dependencies]
coverage = "7.4.3"
pytest = "8.0.2"
coverage = "7.4.4"
pytest = "8.1.1"
pytest-cov = "4.1.0"

@@ -53,3 +53,3 @@

mkdocs = "1.5.3"
mkdocs-material = "9.5.11"
mkdocs-material = "9.5.13"

@@ -97,3 +97,3 @@ [tool.poetry.group.docs.dependencies.mkdocstrings]

name = "named"
version = "1.4.1"
version = "1.4.2"
url = "https://github.com/nekitdev/named"

@@ -100,0 +100,0 @@ directory = "changes"

@@ -47,3 +47,3 @@ # `named`

[tool.poetry.dependencies]
named = "^1.4.1"
named = "^1.4.2"
```

@@ -50,0 +50,0 @@