Skip to content

Commit 81c16de

Browse files
committed
Fix version issue #2.
1 parent a8e2a93 commit 81c16de

File tree

7 files changed

+60
-32
lines changed

7 files changed

+60
-32
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
repos:
12
- repo: https://github.com/ambv/black
2-
rev: stable
3+
rev: 21.5b1
34
hooks:
45
- id: black
56
name: Format Python Code
@@ -12,7 +13,7 @@
1213
- .
1314

1415
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v2.2.3
16+
rev: v4.0.1
1617
hooks:
1718
- id: requirements-txt-fixer
1819
name: Requirements file fixer
@@ -22,7 +23,7 @@
2223
- requirements-dev.txt
2324

2425
- repo: https://gitlab.com/pycqa/flake8
25-
rev: 3.8.3
26+
rev: 3.9.2
2627
hooks:
2728
- id: flake8
2829
name: Flake8 Check
@@ -32,7 +33,7 @@
3233
- paperswithcode
3334

3435
- repo: https://github.com/pycqa/pydocstyle
35-
rev: master
36+
rev: 6.1.1
3637
hooks:
3738
- id: pydocstyle
3839
name: Python Documentation Style Check

paperswithcode/client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from urllib import parse
2-
from datetime import datetime
32
from typing import Dict, List, Optional
43

54

@@ -155,7 +154,10 @@ def paper_task_list(self, paper_id: str) -> List[Task]:
155154
Returns:
156155
List[Task]: List of task objects.
157156
"""
158-
return [Task(**t) for t in self.http.get(f"/papers/{paper_id}/tasks/")['results']]
157+
return [
158+
Task(**t)
159+
for t in self.http.get(f"/papers/{paper_id}/tasks/")["results"]
160+
]
159161

160162
@handler
161163
def paper_method_list(self, paper_id: str) -> List[Method]:
@@ -263,7 +265,11 @@ def proceeding_get(
263265

264266
@handler
265267
def proceeding_paper_list(
266-
self, conference_id: str, proceeding_id: str, page: int = 1, items_per_page: int = 50
268+
self,
269+
conference_id: str,
270+
proceeding_id: str,
271+
page: int = 1,
272+
items_per_page: int = 50,
267273
) -> Papers:
268274
"""Return a list of papers published in a confernce proceeding.
269275
@@ -284,7 +290,7 @@ def proceeding_paper_list(
284290
f"/papers/",
285291
params=params,
286292
),
287-
Papers
293+
Papers,
288294
)
289295

290296
@handler

paperswithcode/models/evaluation/result.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ class Result(TeaClientModel):
1616
not provided in the dataset used for other evaluations.
1717
paper (str, optional): Paper describing the evaluation.
1818
best_metric (str, optional): Name of the best metric.
19-
evaluated_on (str, optional): Date of the result evaluation in YYYY-MM-DD format.
20-
external_source_url (str, option): The URL to the external source (eg competition)
19+
evaluated_on (str, optional): Date of the result evaluation in
20+
YYYY-MM-DD format.
21+
external_source_url (str, option): The URL to the external source (eg
22+
competition).
2123
"""
2224

2325
id: str
@@ -64,11 +66,14 @@ class ResultCreateRequest(_ResultRequest):
6466
Attributes:
6567
metrics (dict): Dictionary of metrics and metric values.
6668
methodology (str): Methodology used for this implementation.
67-
uses_additional_data (bool, optional): Does this evaluation uses additional data
68-
not provided in the dataset used for other evaluations.
69+
uses_additional_data (bool, optional): Does this evaluation uses
70+
additional data not provided in the dataset used for other
71+
valuations.
6972
paper (str, optional): Paper describing the evaluation.
70-
evaluated_on (str, optional): Date of the result evaluation: YYYY-MM-DD format
71-
external_source_url (str, option): The URL to the external source (eg competition)
73+
evaluated_on (str, optional): Date of the result evaluation: YYYY-MM-DD
74+
format.
75+
external_source_url (str, option): The URL to the external source (eg
76+
competition).
7277
"""
7378

7479
metrics: dict
@@ -89,8 +94,10 @@ class ResultUpdateRequest(_ResultRequest):
8994
additional data not provided in the dataset used for other
9095
evaluations.
9196
paper (str, optional): Paper describing the evaluation.
92-
evaluated_on (datetime, optional): Date of the result evaluation: YYYY-MM-DD format
93-
external_source_url (str, option): The URL to the external source (eg competition)
97+
evaluated_on (datetime, optional): Date of the result evaluation:
98+
YYYY-MM-DD format.
99+
external_source_url (str, option): The URL to the external source (eg
100+
competition).
94101
"""
95102

96103
metrics: Optional[dict] = None

paperswithcode/models/evaluation/synchronize.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class ResultSyncRequest(_ResultRequest):
1919
external_id (str, optional): Optional external ID used to identify rows
2020
when doing sync.
2121
evaluated_on (str): Evaluation date in YYYY-MM-DD format
22-
external_source_url (str, option): The URL to the external source (eg competition)
22+
external_source_url (str, option): The URL to the external source (eg
23+
competition).
2324
"""
2425

2526
metrics: dict
@@ -58,7 +59,8 @@ class EvaluationTableSyncRequest(TeaClientModel):
5859
is a mirror of.
5960
external_id (str, optional): Optional external ID used to identify rows
6061
when doing sync.
61-
metric (list): List of MetricSyncRequest objects used in the evaluation.
62+
metric (list): List of MetricSyncRequest objects used in the
63+
evaluation.
6264
results (list): List of ResultSyncRequest objects - results of the
6365
evaluation.
6466
"""
@@ -85,7 +87,8 @@ class ResultSyncResponse(TeaClientModel):
8587
external_id (str, optional): Optional external ID used to identify rows
8688
when doing sync.
8789
evaluated_on (str, optional): Evaluation date in YYYY-MM-DD format
88-
external_source_url (str, option): The URL to the external source (eg competition)
90+
external_source_url (str, option): The URL to the external source (eg
91+
competition)
8992
"""
9093

9194
id: str

requirements-dev.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
-r requirements.txt
2-
black==19.10b0
3-
flake8==3.8.3
4-
pre-commit==2.6.0
5-
pydocstyle==5.0.2
6-
pytest==5.4.3
7-
pytest-cov==2.10.0
8-
recommonmark==0.6.0
9-
sphinx==3.1.2
10-
sphinx-rtd-theme==0.5.0
11-
twine==3.2.0
2+
black==21.5b1
3+
flake8~=3.9.2
4+
pre-commit~=2.12.1
5+
pydocstyle~=6.1.1
6+
pytest~=6.2.4
7+
pytest-cov~=2.12.0
8+
recommonmark~=0.7.1
9+
sphinx~=4.0.1
10+
sphinx-rtd-theme~=0.5.2
11+
twine==3.4.1

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
tea-client==0.0.7
2-
tea-console==0.0.5
2+
tea-console==0.0.6
33
typer==0.3.2

setup.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
11
import io
2+
import importlib
3+
from pathlib import Path
24
from setuptools import setup, find_packages
3-
from paperswithcode import __version__
5+
46

57
name = "paperswithcode-client"
68
author = "Viktor Kerkez"
79
author_email = "alefnula@gmail.com"
810
url = "https://github.com/paperswithcode/paperswithcode-client"
911

1012

13+
def get_version():
14+
"""Import the version module and get the project version from it."""
15+
version_py = Path(__file__).parent / "paperswithcode" / "version.py"
16+
spec = importlib.util.spec_from_file_location("version", version_py)
17+
version = importlib.util.module_from_spec(spec)
18+
spec.loader.exec_module(version)
19+
return version.__version__
20+
21+
1122
setup(
1223
name=name,
13-
version=__version__,
24+
version=get_version(),
1425
author=author,
1526
author_email=author_email,
1627
maintainer=author,

0 commit comments

Comments
 (0)