Skip to main content

Define If

If the condition is true, define the method.

pre-commit.ci status test build-docs publish-package-on-pypi

Pypi PyPI - Python Version Downloads License

Forks Issues Stars

Codecov Contributors Last Commit

For more information see: https://defineif.hakancelik.dev/

How to install ?

pip install defineif

How to use it ?

import os

from defineif import DefineIf


class Klass(DefineIf):

    @staticmethod
    @DefineIf(os.name == 'nt')
    def get_platform():
        return 'Windows'

    @staticmethod
    @DefineIf(os.name == 'posix')
    def get_platform():
        return 'Linux'

platform = Klass.get_platform()

print(platform)

Release files for defineif 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 defineif 0.1.0
File Size Uploaded
defineif-0.1.0.tar.gz 18.0 kB Details

Built distribution (wheel)

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

Total release size: 34.0 kB

Release files / defineif-0.1.0.tar.gz

Download URL defineif-0.1.0.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
355849550c5c06c2fdd24c584de4050109efd048638edb66d8c35072d6d92027
BLAKE2b-256 checksum
How to use checksums
2b650f8a467d4639d021caeb2a7513fc2d71685f815d853ff0b20b8fdd0b67f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

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

Download URL defineif-0.1.0-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dadc7fc3fefe01f17c5ed66668a8e7d92fdd5f4994e2dbdb09a314e5b8a84676
BLAKE2b-256 checksum
How to use checksums
eb2a618043243c8f6198e198f436d6f585cae70bdb9bba7474fafa054af786bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release history Release notifications | RSS feed

This release

0.1.0 This release

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