Skip to main content

Library to handle Elifoot equipas

Project description

libelifoot

CI License: LGPL v3 pypi

Overview

Library to handle Elifoot 98 equipas. The main functionalities of the library are:

  • Get the equipa data from an equipa file;
  • Generate patch files with upstream data from an equipa file;
  • Generate patches in batch from a directory of equipa files.

Usage

Get the content of an equipa file:

from sys import argv

from libelifoot import get_equipa_data


def main(equipa: str) -> None:
    print(get_equipa_data(equipa))


if __name__ == "__main__":
    main(argv[1])

Generate a patch file with upstream data from an equipa file:

from sys import argv
from typing import Optional

from libelifoot import (
    update_equipa,
    Equipa,
    EquipaFileHandler,
    UpdateEquipaListener
)


class EventHandler(UpdateEquipaListener):

    def on_update_equipa(
        self,
        equipa_name: str,
        equipa_data: Optional[Equipa]
    ) -> None:
        print(f'{equipa_name}\n{equipa_data}')

        if equipa_data:
            EquipaFileHandler.write(f'{equipa_name}.patch', equipa_data)

    def on_update_equipa_error(self, error: str) -> None:
        print(f'ERROR: {error}')


def main(equipa: str, provider: str, season: int) -> None:
    ev = EventHandler()

    update_equipa(equipa, provider, season, ev)


if __name__ == "__main__":
    main(argv[1], argv[2], int(argv[3]))

Generate patches in batch based on a directory of equipa files:

from sys import argv
from typing import Optional

from libelifoot import (
    bulk_update,
    Equipa,
    EquipaFileHandler,
    UpdateEquipaListener,
)


class EventHandler(UpdateEquipaListener):

    def on_update_equipa(
        self,
        equipa_name: str,
        equipa_data: Optional[Equipa]
    ) -> None:
        print(f'{equipa_name}\n{equipa_data}')

        if equipa_data:
            EquipaFileHandler.write(f'{equipa_name}.patch', equipa_data)

    def on_update_equipa_error(self, error: str) -> None:
        print(f'ERROR: {error}')


def main(equipa_dir: str, provider: str, season: int) -> None:
    ev = EventHandler()

    bulk_update(equipa_dir, provider, season, ev)


if __name__ == "__main__":
    main(argv[1], argv[2], int(argv[3]))

Supported providers

To generate patches, the library fetches data from public football data providers. Currently, the library supports the following providers:

  • ESPN;
  • Transfermarkt.

Documentation

See docs.

Project details


Download files

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

Source Distribution

libelifoot-0.1.3.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

libelifoot-0.1.3-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file libelifoot-0.1.3.tar.gz.

File metadata

  • Download URL: libelifoot-0.1.3.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for libelifoot-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d4bd87529b774c2779b4230e07b34289b6c09712e4cf636e3bffe1ec0ad979dc
MD5 8bb9b44f2863ff2b01f8d638e9967699
BLAKE2b-256 8d5aa6ec2253866674c04ea53c3f582a31ca8472db274d490288bb23761ebb29

See more details on using hashes here.

File details

Details for the file libelifoot-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: libelifoot-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for libelifoot-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bde41b9a9d2cff11c2f849b5a56e983b33f2f60ca1c6d0048d14e6fd7e95ee85
MD5 ecd9a24c20992fb09531307c91ad3c8d
BLAKE2b-256 d98301c85d5e285cf7b8adec7b6d0e460951c481316b7b12cbf27b37818a9ba4

See more details on using hashes here.

Supported by

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