@@ -45,16 +45,16 @@ class GitHubPublisherBase(wtforms.Form):
45
45
# https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
46
46
environment = wtforms .StringField (validators = [wtforms .validators .Optional ()])
47
47
48
- def __init__ (self , * args , api_token , ** kwargs ):
48
+ def __init__ (self , * args , api_token : str , ** kwargs ):
49
49
super ().__init__ (* args , ** kwargs )
50
50
self ._api_token = api_token
51
51
52
- def _headers_auth (self ):
52
+ def _headers_auth (self ) -> dict [ str , str ] :
53
53
if not self ._api_token :
54
54
return {}
55
55
return {"Authorization" : f"token { self ._api_token } " }
56
56
57
- def _lookup_owner (self , owner ) :
57
+ def _lookup_owner (self , owner : str ) -> dict [ str , str | int ] :
58
58
# To actually validate the owner, we ask GitHub's API about them.
59
59
# We can't do this for the repository, since it might be private.
60
60
try :
@@ -113,7 +113,7 @@ def _lookup_owner(self, owner):
113
113
114
114
return response .json ()
115
115
116
- def validate_owner (self , field ) :
116
+ def validate_owner (self , field : wtforms . Field ) -> None :
117
117
owner = field .data
118
118
119
119
# We pre-filter owners with a regex, to avoid loading GitHub's API
@@ -129,7 +129,7 @@ def validate_owner(self, field):
129
129
self .normalized_owner = owner_info ["login" ]
130
130
self .owner_id = owner_info ["id" ]
131
131
132
- def validate_workflow_filename (self , field ) :
132
+ def validate_workflow_filename (self , field : wtforms . Field ) -> None :
133
133
workflow_filename = field .data
134
134
135
135
if not (
@@ -144,7 +144,7 @@ def validate_workflow_filename(self, field):
144
144
_ ("Workflow filename must be a filename only, without directories" )
145
145
)
146
146
147
- def validate_environment (self , field ) :
147
+ def validate_environment (self , field : wtforms . Field ) -> None :
148
148
environment = field .data
149
149
150
150
if not environment :
@@ -174,7 +174,7 @@ def validate_environment(self, field):
174
174
)
175
175
176
176
@property
177
- def normalized_environment (self ):
177
+ def normalized_environment (self ) -> str :
178
178
# The only normalization is due to case-insensitivity.
179
179
#
180
180
# NOTE: We explicitly do not compare `self.environment.data` to None,
0 commit comments