Skip to content

Commit

Permalink
remove deprecated get_submission_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
uuazed committed Feb 13, 2021
1 parent 2c49e42 commit 5c8a3f7
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 58 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Notable changes to this project.
## dev
- improve docstrings and signals example code
- remove deprecated `get_v1_leaderboard`
- remove deprecated `get_stakes`
- remove deprecated `get_stakes` & `get_submission_ids`
- Fix default file path for `download_latest_data` (#37)

## [2.4.0] - 2021-01-12
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ To get started with the cli interface, let's take a look at the help page:
stake-get Get stake value of a user.
stake-increase Increase your stake by `value` NMR.
submission-filenames Get filenames of your submissions
submission-ids Get dict with username->submission_id...
submission-status checks the submission status
submit Upload predictions from file.
tournament-name2number Translate tournament name to tournament...
Expand Down
8 changes: 0 additions & 8 deletions numerapi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ def current_round(tournament=8):
click.echo(napi.get_current_round(tournament=tournament))


@cli.command()
@click.option('--tournament', default=8,
help='The ID of the tournament, defaults to 8')
def submission_ids(tournament=8):
"""Get dict with username->submission_id mapping."""
click.echo(prettify(napi.get_submission_ids(tournament=tournament)))


@cli.command()
@click.option('--limit', default=20,
help='Number of items to return, defaults to 20')
Expand Down
35 changes: 0 additions & 35 deletions numerapi/numerapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,41 +495,6 @@ def get_submission_filenames(self, tournament=None, round_num=None,
filenames.sort(key=lambda f: (f['round_num'], f['tournament']))
return filenames

def get_submission_ids(self, tournament=8):
"""Get dict with username->submission_id mapping.
Args:
tournament (int): ID of the tournament (optional, defaults to 8)
Returns:
dict: username->submission_id mapping, string->string
Example:
>>> NumerAPI().get_submission_ids()
{'1337ai': '93c46857-fed9-4594-981e-82db2b358daf',
'1x0r': '108c7601-822c-4910-835d-241da93e2e24',
...
}
"""
query = """
query($tournament: Int!) {
rounds(tournament: $tournament
number: 0) {
leaderboard {
username
submissionId
}
}
}
"""
arguments = {'tournament': tournament}
data = self.raw_query(query, arguments)['data']['rounds'][0]
if data is None:
return None
mapping = {item['username']: item['submissionId']
for item in data['leaderboard']}
return mapping

def get_user(self, model_id: str = None) -> Dict:
"""Get all information about you! DEPRECATED
Expand Down
7 changes: 0 additions & 7 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ def test_current_round(mocked):
assert result.exit_code == 0


@patch('numerapi.NumerAPI.get_submission_ids')
def test_submission_ids(mocked):
result = CliRunner().invoke(cli.submission_ids, ['--tournament', 1])
# just testing if calling works fine
assert result.exit_code == 0


@patch('numerapi.NumerAPI.get_user_activities')
def test_user_activities(mocked, login):
result = CliRunner().invoke(cli.user_activities, 'username')
Expand Down
6 changes: 0 additions & 6 deletions tests/test_numerapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@ def test_unauthorized_requests(api, fun):
"Your session is invalid or has expired." in str(err.value)


def test_get_submission_ids(api):
ids = api.get_submission_ids()
assert len(ids) > 0
assert isinstance(ids, dict)


def test_error_handling(api):
# String instead of Int
with pytest.raises(ValueError):
Expand Down

0 comments on commit 5c8a3f7

Please sign in to comment.