Skip to main content

xy_singleton

说明

单例工具

源码仓库

安装

pip install xy_singleton

使用

python脚本
from xy_singleton.Decorators import singleton, Singleton

@singleton
class Cls_0(object):
    count = 0
    def __init__(self):
        pass

@Singleton
class Cls_1(object):
    count = 0
    def __init__(self):
        pass

Cls_0().count = 10
Cls_0().count
# 10
Cls_0().count = 11
# 11
Cls_1().count = 10
# 10
Cls_1().count = 11
Cls_1().count
# 11

from xy_singleton.Singleton import CallSingleton, NewSingleton

class Foo_0(metaclass=CallSingleton):
    count = 0

Foo_0().count = 10
Foo_0().count
# 10
Foo_0().count = 11
Foo_0().count
# 11

class Foo_1(Singleton):
    count = 0
Foo_1().count = 10
Foo_1().count
# 10
Foo_1().count = 11
Foo_1().count
# 11

许可证

xy_singleton 根据 <木兰宽松许可证, 第2版> 获得许可。有关详细信息,请参阅 LICENSE 文件。

捐赠

如果小伙伴们觉得这些工具还不错的话,能否请咱喝一杯咖啡呢?

Pay-Total

联系方式

微信: yuyangiit
邮箱: yuyangit.0515@qq.com

Release files for xy-singleton 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xy-singleton 1.0.2
File Size Uploaded
xy_singleton-1.0.2.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xy-singleton 1.0.2
File Interpreter ABI Platform
xy_singleton-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / xy_singleton-1.0.2.tar.gz

Download URL xy_singleton-1.0.2.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f45370cb79904e0f5e60011714ed348d595f25844e153e36df4339d5771b1a75
BLAKE2b-256 checksum
How to use checksums
e7c46691d52f8ff217008caf010e56a8aa25ffecd12a6f02b82f1eec4dba2b1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release files / xy_singleton-1.0.2-py3-none-any.whl

Download URL xy_singleton-1.0.2-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b847fe4879c4440db95d4c21fb6c732dd5975202260bcc8ad389113ac1cdcda
BLAKE2b-256 checksum
How to use checksums
bf471eb969f5639643c797454961d29e7d25af1db077a5c0556bd78e4ac8d700
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page