-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remap some regions automatically; remove 3rd party code (#207)
- Loading branch information
1 parent
e4e7329
commit 3f8cf01
Showing
16 changed files
with
283 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__version__ = "3.2.1" | ||
__version__ = "3.2.2" | ||
__author__ = "pseudonym117" | ||
__title__ = "RiotWatcher" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from functools import wraps | ||
|
||
|
||
def remap_region_to_platform(argument_pos: int, argument_name="region"): | ||
def _remap_region_to_platform(api_call): | ||
remap = { | ||
"br1": "americas", | ||
"la1": "americas", | ||
"la2": "americas", | ||
"na1": "americas", | ||
"oc1": "americas", | ||
"eun1": "europe", | ||
"euw1": "europe", | ||
"ru": "europe", | ||
"tr1": "europe", | ||
"jp1": "asia", | ||
"kr": "asia", | ||
} | ||
|
||
@wraps(api_call) | ||
def remapper(*args, **kwargs): | ||
nargs = args | ||
if argument_name in kwargs: | ||
lower_region = kwargs[argument_name].lower() | ||
if lower_region in remap: | ||
kwargs[argument_name] = remap[lower_region] | ||
if len(args) > argument_pos and isinstance(args[argument_pos], str): | ||
region = args[1].lower() | ||
if region in remap: | ||
nargs = list(args) | ||
nargs[1] = remap[region] | ||
return api_call(*nargs, **kwargs) | ||
|
||
return remapper | ||
|
||
return _remap_region_to_platform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 0 additions & 38 deletions
38
src/riotwatcher/_apis/league_of_legends/ThirdPartyCodeApiV4.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.