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)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

defineif-0.1.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

defineif-0.1.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file defineif-0.1.0.tar.gz.

File metadata

  • Download URL: defineif-0.1.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for defineif-0.1.0.tar.gz
Algorithm Hash digest
SHA256 355849550c5c06c2fdd24c584de4050109efd048638edb66d8c35072d6d92027
MD5 6a88ca4a91e2ec375868e5c380a88f29
BLAKE2b-256 2b650f8a467d4639d021caeb2a7513fc2d71685f815d853ff0b20b8fdd0b67f0

See more details on using hashes here.

File details

Details for the file defineif-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: defineif-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for defineif-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dadc7fc3fefe01f17c5ed66668a8e7d92fdd5f4994e2dbdb09a314e5b8a84676
MD5 12a22b42c74babfe3bfb3174e4820ecd
BLAKE2b-256 eb2a618043243c8f6198e198f436d6f585cae70bdb9bba7474fafa054af786bf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page