Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
fix: pre commit issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sbasan committed Apr 25, 2024
1 parent 6c9c546 commit fcced9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ repos:
# Code analysis (only checks staged files)

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
rev: v1.9.0
hooks:
- id: mypy
name: mypy
Expand Down
22 changes: 15 additions & 7 deletions endpoints-md.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from urllib.request import pathname2url

from packaging.specifiers import SpecifierSet # type: ignore
from typing_extensions import get_original_bases

from catalystwan import __package__
from catalystwan.endpoints import BASE_PATH, APIEndpointRequestMeta, TypeSpecifier, request, versions, view
Expand Down Expand Up @@ -110,13 +111,20 @@ def from_type_specifier(typespec: TypeSpecifier) -> CompositeTypeLink:
if payloadtype.__module__ == "builtins":
return CompositeTypeLink.text_only(payloadtype.__name__)
elif sourcefile := getsourcefile(payloadtype):
print(payloadtype)
return CompositeTypeLink(
link_text=payloadtype.__name__,
sourcefile=create_sourcefile_link(sourcefile),
lineno=getsourcelines(payloadtype)[1],
origin=generate_origin_string(typespec),
)
try:
lineno = getsourcelines(payloadtype)[1]
link_text = payloadtype.__name__
except OSError:
base, *_ = get_original_bases(payloadtype)
lineno = getsourcelines(base)[1]
link_text = base.__name__
finally:
return CompositeTypeLink(
link_text=link_text,
sourcefile=create_sourcefile_link(sourcefile),
lineno=lineno,
origin=generate_origin_string(typespec),
)
return CompositeTypeLink.text_only("")

def md(self) -> str:
Expand Down

0 comments on commit fcced9a

Please sign in to comment.