Skip to main content

An id tool for League of Legends with fuzzy string matching, nicknames, multiple locales, automatic updates, and translation.

Project description

lol_id_tools

An id tool for League of Legends with fuzzy string matching, nicknames, multiple locales, automatic updates, and translation.

The package relies on rapidfuzz for string matching.

This documentation pertains to v1.0.0, and future releases should stay compatible with its syntax.

Installation

Get lit with pip install lol-id-tools

Demo

Demo

Usage

Import

import lol_id_tools as lit

Get id from name

When the name is typed properly, matching takes about 0.4ms.

lit.get_id('Miss Fortune')
> 21

Fuzzy string and nicknames matching takes about 9ms.

lit.get_id('MF')
> 21

If the source locale for the name is not loaded, you can force load it with

lit.get_id('미스 포츈', locale='ko_KR')
> 21

The minimum_score parameter can be used to alter behaviour.

lit.get_id('misfo')
lit.NoMatchingNameFound: No object name close enough to the input string found.

lit.get_id('misfo', minimum_score = 50)
> 21

All types of object can be matched by default.

lit.get_id('Maw of Malmortius')
> 3156

Get name from ID

On patch 10.10 no champion, item, or rune shares an ID. If they do in the future, the package will need to be updated accordingly.

lit.get_name(11)
> 'Master Yi'

If a locale needed for output is not loaded, it will automatically add it to the package.

lit.get_name(11, 'fr_FR')
> 'Maître Yi'

Get translation

Default output is 'en_US'

lit.get_translation('미스 포츈')
> 'Miss Fortune'

If you haven’t loaded the input locale yet, you can supply it as a parameter

lit.get_translation('ミス・フォーチュン', 'zh_CN', input_locale='ja_JP')
> '赏金猎人'

If get_translation() is called on an existing locale, it returns the "clean" object name

lit.get_translation('Misfo', minimum_score = 50)
> 'Miss Fortune'

Tests

You can take a look at the tests suit for more code examples.

Notes

Data is saved in ~/.config/lol_id_tools for offline usage and faster startup after first use. It uses sqlite3 and sqlalchemy to query the data.

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

lol_id_tools-1.0.0.tar.gz (12.0 kB view details)

Uploaded Source

File details

Details for the file lol_id_tools-1.0.0.tar.gz.

File metadata

  • Download URL: lol_id_tools-1.0.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for lol_id_tools-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d3fd253c77e781f63c07a1fb845b9175f95a02893466eddaca56f308d4586f3a
MD5 ebb036ed58fc8bca3af25dc01fc40d6d
BLAKE2b-256 3488a6c54301f796ba5a5d1a252164ba010285fc03e7b95d8eebd0230beb54d8

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