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.0a, the current alpha release. All future releases will follow its syntax and not the one from v0.x releases.

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.0b0.tar.gz (12.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: lol_id_tools-1.0.0b0.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.0b0.tar.gz
Algorithm Hash digest
SHA256 da0405b125c6097a8fee8c0bde99b40647d8af0748ec504fd17e48a0145f077c
MD5 8445a0d7b772c9acd7e55006efca6a90
BLAKE2b-256 1c12dcad9840eda189e4545272dd3eb030daab4f616818678ea4f4a2aaea4c54

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