Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2e88cd4

Browse files
wip: trying to find code that doesn't return a dict
1 parentbadc916 commit2e88cd4

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

‎.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
-name:Run tests
7474
env:
7575
TOXENV:${{ matrix.toxenv }}
76-
run:tox -- --override-ini='log_cli=True'
76+
run:tox -- -vv --override-ini='log_cli=True'
7777
-name:Upload codecov coverage
7878
uses:codecov/codecov-action@v3
7979
with:

‎gitlab/exceptions.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717

1818
importfunctools
19+
importinspect
1920
fromtypingimportAny,Callable,cast,Optional,Type,TYPE_CHECKING,TypeVar,Union
2021

2122

@@ -331,10 +332,23 @@ def wrap(f: __F) -> __F:
331332
@functools.wraps(f)
332333
defwrapped_f(*args:Any,**kwargs:Any)->Any:
333334
try:
334-
returnf(*args,**kwargs)
335+
result=f(*args,**kwargs)
335336
exceptGitlabHttpErrorase:
336337
raiseerror(e.error_message,e.response_code,e.response_body)frome
337338

339+
annotations=inspect.get_annotations(f)
340+
return_type=annotations.get("return","")
341+
if (
342+
"typing.Union[typing.Dict[str, typing.Any], "
343+
"typing.List[typing.Any], requests.models.Response]"
344+
)instr(return_type):
345+
ifnotisinstance(result,dict):
346+
print(f,annotations)
347+
print(f"str:{str(return_type)!r}")
348+
print(f"{type(result)}{result!r}")
349+
assert0
350+
returnresult
351+
338352
returncast(__F,wrapped_f)
339353

340354
returnwrap

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp