Skip to main content

callonce

Usage

from callonce import callonce


@callonce
def _return_true() -> bool:
    return True


def _call_return_true():
    return _return_true()


def _call_return_true_3times():
    return _return_true(times=3)


def test_call_once():
    assert _call_return_true() == True
    assert _call_return_true() == None


def test_call_3times():
    assert _call_return_true_3times() == True
    assert _call_return_true_3times() == True
    assert _call_return_true_3times() == True
    assert _call_return_true_3times() == None

We offer a printonce function for easy debug in deep learning model, e.g., PyTorch. You don't have to remove the printonce when training the model in loop because the shape will be printed only once.

from callonce import printonce
from torch import nn

class Net(nn.Module):

    def __init__(self):
        self.linear = nn.Linear(4, 8)

    def forward(self, x):
        printonce('x:', x.shape)
        y = self.linear(x)
        printonce('y:', y.shape)
        return y

Metadata

Release files for callonce 0.1.0

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

Source distribution (sdist)

Source distribution for callonce 0.1.0
File Size Uploaded Provenance
callonce-0.1.0.tar.gz 2.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for callonce 0.1.0
File Interpreter ABI Platform
callonce-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 kB

Release files / callonce-0.1.0.tar.gz

Download URL callonce-0.1.0.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4342a0583b7fd8ad9f15cc0eca51b45b4e35bd33dfcbc626fa0e44fe1510dc0d
BLAKE2b-256 checksum
How to use checksums
bdf920334ed9da3ebfaa41d4ae00dc74395a8988295296ffc611b8d2932af700
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Release files / callonce-0.1.0-py3-none-any.whl

Download URL callonce-0.1.0-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
384b6aae856edd1a8597f54122bdcf36cd2b5a5e40192c1e8e0c7275b55435ed
BLAKE2b-256 checksum
How to use checksums
b5c4bb90d5c86ede754fcf9294a612c5d95d77feb4614987edcd7156b8d6316e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.6

Security for callonce 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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