Skip to content

Commit 83a5c1f

Browse files
authored
[EG] Pylint-next Jan (#33137)
* do we want to disable unused argument? * add default * pylint format * mypy * update * pylint * remove kwargs * remove urllib2
1 parent 623cec0 commit 83a5c1f

File tree

1 file changed

+9
-7
lines changed
  • sdk/eventgrid/azure-eventgrid/azure/eventgrid

1 file changed

+9
-7
lines changed

sdk/eventgrid/azure-eventgrid/azure/eventgrid/_helpers.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
import hmac
99
import base64
1010

11-
try:
12-
from urllib.parse import quote
13-
except ImportError:
14-
from urllib2 import quote # type: ignore
11+
from urllib.parse import quote
1512

1613
from azure.core.pipeline.transport import HttpRequest
1714
from azure.core.pipeline.policies import AzureKeyCredentialPolicy, BearerTokenCredentialPolicy
@@ -27,8 +24,13 @@
2724
if TYPE_CHECKING:
2825
from datetime import datetime
2926

30-
def generate_sas(endpoint, shared_access_key, expiration_date_utc, **kwargs):
31-
# type: (str, str, datetime, Any) -> str
27+
def generate_sas(
28+
endpoint: str,
29+
shared_access_key: str,
30+
expiration_date_utc: "datetime",
31+
*,
32+
api_version: str = constants.DEFAULT_API_VERSION,
33+
) -> str:
3234
"""Helper method to generate shared access signature given hostname, key, and expiration date.
3335
:param str endpoint: The topic endpoint to send the events to.
3436
Similar to <YOUR-TOPIC-NAME>.<YOUR-REGION-NAME>-1.eventgrid.azure.net
@@ -50,7 +52,7 @@ def generate_sas(endpoint, shared_access_key, expiration_date_utc, **kwargs):
5052
:caption: Generate a shared access signature.
5153
"""
5254
full_endpoint = "{}?apiVersion={}".format(
53-
endpoint, kwargs.get("api_version", constants.DEFAULT_API_VERSION)
55+
endpoint, api_version
5456
)
5557
encoded_resource = quote(full_endpoint, safe=constants.SAFE_ENCODE)
5658
encoded_expiration_utc = quote(str(expiration_date_utc), safe=constants.SAFE_ENCODE)

0 commit comments

Comments
 (0)