Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ extend-ignore = E203, W503

exclude = test_*.py

# Python3.12環境だとなぜか警告が出るので、一時的に無視する。将来的にflake8は捨ててruffに移行する予定なので、この設定はそのままにしておく。
ignore = W604, E231
15 changes: 14 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,29 @@ python:
- "3.9"
- "3.10"
- "3.11"
- "3.12"

install:
- pip install pip --upgrade
- pip install "poetry<1.5"
- travis_retry poetry install --only main,linter,test --all-extras

script:
- make lint
- pytest tests/test_local*.py


jobs:
include:
- python: 3.8
- python: 3.9
- python: 3.10
script:
# 開発環境と同じPythonバージョンのみlintを実行する
- make lint
- python: 3.11
- python: 3.12


branches:
only:
- main
Expand Down
2 changes: 1 addition & 1 deletion annofabapi/dataclass/annotation_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class InternationalizationMessageMessages(DataClassJsonMixin):
""" """

lang: str
"""言語コード。`en-US` (英語) または `ja-JP` (日本語) のみサポートしています。"""
"""言語コード。`en-US` (英語) `ja-JP` (日本語)、 `vi-VN`(ベトナム語)のみサポートしています。"""

message: str
"""lang で指定された言語でのメッセージ"""
Expand Down
5 changes: 3 additions & 2 deletions annofabapi/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3224,7 +3224,7 @@ class InspectionSummary(Enum):
Kyes of Dict

* lang: str
言語コード。`en-US` (英語) または `ja-JP` (日本語) のみサポートしています。
言語コード。`en-US` (英語) `ja-JP` (日本語)、 `vi-VN`(ベトナム語)のみサポートしています。
* message: str
lang で指定された言語でのメッセージ

Expand Down Expand Up @@ -3480,11 +3480,12 @@ class KeyLayout(Enum):

class Lang(Enum):
"""
表示言語 * `ja-JP` - 日本語 * `en-US` - 英語
表示言語 * `ja-JP` - 日本語 * `en-US` - 英語 * `vi-VN` - ベトナム語
"""

EN_US = "en-US"
JA_JP = "ja-JP"
VI_VN = "vi-VN"


LoginNeedChallengeResponse = Dict[str, Any]
Expand Down
5 changes: 4 additions & 1 deletion generate/swagger/swagger-api-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ components:
properties:
lang:
type: string
description: 言語コード。`en-US` (英語) または `ja-JP` (日本語) のみサポートしています。
description: 言語コード。`en-US` (英語) `ja-JP` (日本語)、 `vi-VN`(ベトナム語)のみサポートしています。
example: en-US
message:
type: string
Expand Down Expand Up @@ -664,6 +664,7 @@ components:
enum:
- en-US
- ja-JP
- vi-VN
description: ゲストユーザーのUIの表示言語です
key_layout:
$ref: "#/components/schemas/KeyLayout"
Expand Down Expand Up @@ -793,10 +794,12 @@ components:
enum:
- en-US
- ja-JP
- vi-VN
description: |
表示言語
* `ja-JP` - 日本語
* `en-US` - 英語
* `vi-VN` - ベトナム語
KeyLayout:
type: string
enum:
Expand Down
2 changes: 1 addition & 1 deletion generate/swagger/swagger.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ info:

上記例 `account_id_count` は、タスクのフィールド `account_id` でタスクを分類したところ「`account_id` が `c5eee002` であるタスクが9件、`9f110e48` であるタスクが5件、`b25dfeb3` であるタスクが1件」だったという結果を表しています。

version: 0.180.0
version: 0.183.0
title: Annofab Web API
x-logo:
url: "https://annofab.com/resource/images/logo_landscape.png"
Expand Down
2 changes: 1 addition & 1 deletion generate/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ info:
上記例 `account_id_count` は、タスクのフィールド `account_id` でタスクを分類したところ「`account_id` が `c5eee002` であるタスクが9件、`9f110e48` であるタスクが5件、`b25dfeb3` であるタスクが1件」だったという結果を表しています。
また、AggregationResultの集約の件数は、合計で10000件以下に制限されており、それを超える件数がある場合は上位10000件が取得されます。もし、省略された部分を取得したい場合は、検索条件を縛って結果に上る集約の数を減らしてください。

version: 0.180.0
version: 0.183.0
title: Annofab Web API
x-logo:
url: "https://annofab.com/resource/images/logo_landscape.png"
Expand Down
1,342 changes: 627 additions & 715 deletions poetry.lock

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ backoff="*"
dataclasses-json="*"
more-itertools = "*"

numpy={version="*", optional=true }
numpy = [
{version = ">=1.26", python = ">=3.12", optional=true },
{version = "<1.25", python = "=3.8", optional=true },
{version="*", optional=true }
]

pillow={version="*", optional=true }


Expand All @@ -43,9 +48,10 @@ autoflake = "*"
black = "^23"

[tool.poetry.group.linter.dependencies]
flake8 = "^5"
mypy = "^1"
pylint = "^2"
# pythonバージョンを指定している理由:lintは開発環境と同じPythonバージョンで実行するため。また古いPythonバージョンにサポートしていないライブラリのバージョンがあるため
mypy = {version="^1", python = ">=3.10"}
flake8 = {version="^7", python = ">=3.10"}
pylint = {version="^3", python = ">=3.10"}

# type stub package
types-requests = "*"
Expand Down
12 changes: 6 additions & 6 deletions tests/tests_local_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def test_assert_retry(self):
assert self.requestexception_connectionerror_then_true(log) is True
assert 2 == len(log)
print(log)
assert type(log[0]) == requests.exceptions.RequestException
assert type(log[1]) == ConnectionError
assert isinstance(type((log[0])), requests.exceptions.RequestException)
assert isinstance(type(log[1]), ConnectionError)

@my_backoff
def chunkedencodingerror_requestsconnectionerror_then_true(self, log: list[Any]):
Expand All @@ -50,8 +50,8 @@ def test_assert_retry2(self):
assert self.chunkedencodingerror_requestsconnectionerror_then_true(log) is True
assert 2 == len(log)
print(log)
assert type(log[0]) == requests.exceptions.ChunkedEncodingError
assert type(log[1]) == requests.exceptions.ConnectionError
assert isinstance(type(log[0]), requests.exceptions.ChunkedEncodingError)
assert isinstance(type(log[1]), requests.exceptions.ConnectionError)

@my_backoff
def httperror_then_true(self, log: list[Any]):
Expand All @@ -72,9 +72,9 @@ def test_assert_retry_with_httperror(self):
assert self.httperror_then_true(log) is True
assert 2 == len(log)
print(log)
assert type(log[0]) == requests.exceptions.HTTPError
assert isinstance(type(log[0]), requests.exceptions.HTTPError)
assert log[0].response.status_code == 429
assert type(log[1]) == requests.exceptions.HTTPError
assert isinstance(type(log[1]), requests.exceptions.HTTPError)
assert log[1].response.status_code == 500

@my_backoff
Expand Down