Skip to content

Commit

Permalink
Fix up some policheck issues
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Sep 28, 2021
1 parent ec0fc2d commit 1432b80
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 28 deletions.
1 change: 1 addition & 0 deletions eng/guardian-tools/policheck/PolicheckExclusions.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<PoliCheckExclusions>
<!-- All strings must be UPPER CASE -->
<!-- Each of these exclusions is a folder name - if \[name]\ exists in the file path, it will be skipped -->
<!--<Exclusion Type="FolderPathFull">ABC|XYZ</Exclusion>-->
<!-- Each of these exclusions is a folder name - if any folder or file starts with "\[name]", it will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def __init__(self, client, config, serializer, deserializer):

def screen_text(
self, text_content_type, text_content, language=None, autocorrect=False, pii=False, list_id=None, classify=False, custom_headers=None, raw=False, callback=None, **operation_config):
"""Detect profanity and match against custom and shared blacklists.
"""Detect profanity and match against custom and shared blocklists.
Detects profanity in more than 100 languages and match against custom
and shared blacklists.
and shared blocklists.
:param text_content_type: The content type. Possible values include:
'text/plain', 'text/html', 'text/xml', 'text/markdown'
Expand Down
12 changes: 6 additions & 6 deletions sdk/core/azure-core/azure/core/pipeline/policies/_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, **kwargs):
retry_codes = self._RETRY_CODES
status_codes = kwargs.pop('retry_on_status_codes', [])
self._retry_on_status_codes = set(status_codes) | retry_codes
self._method_whitelist = frozenset(['HEAD', 'GET', 'PUT', 'DELETE', 'OPTIONS', 'TRACE'])
self._method_allowlist = frozenset(['HEAD', 'GET', 'PUT', 'DELETE', 'OPTIONS', 'TRACE'])
self._respect_retry_after_header = True
super(RetryPolicyBase, self).__init__()

Expand All @@ -97,7 +97,7 @@ def configure_retries(self, options):
'status': options.pop("retry_status", self.status_retries),
'backoff': options.pop("retry_backoff_factor", self.backoff_factor),
'max_backoff': options.pop("retry_backoff_max", self.BACKOFF_MAX),
'methods': options.pop("retry_on_methods", self._method_whitelist),
'methods': options.pop("retry_on_methods", self._method_allowlist),
'timeout': options.pop("timeout", self.timeout),
'history': []
}
Expand Down Expand Up @@ -152,14 +152,14 @@ def _is_read_error(self, err):

def _is_method_retryable(self, settings, request, response=None):
"""Checks if a given HTTP method should be retried upon, depending if
it is included on the method whitelist.
it is included on the method allowlist.
:param dict settings: The retry settings.
:param request: The PipelineRequest object.
:type request: ~azure.core.pipeline.PipelineRequest
:param response: The PipelineResponse object.
:type response: ~azure.core.pipeline.PipelineResponse
:return: True if method should be retried upon. False if not in method whitelist.
:return: True if method should be retried upon. False if not in method allowlist.
:rtype: bool
"""
if response and request.method.upper() in ['POST', 'PATCH'] and \
Expand All @@ -173,7 +173,7 @@ def _is_method_retryable(self, settings, request, response=None):
def is_retry(self, settings, response):
"""Checks if method/status code is retryable.
Based on whitelists and control variables such as the number of
Based on allowlists and control variables such as the number of
total retries to allow, whether to respect the Retry-After header,
whether this header is present, and whether the returned status
code is on the list of status codes to be retried upon on the
Expand Down Expand Up @@ -244,7 +244,7 @@ def increment(self, settings, response=None, error=None):

else:
# Incrementing because of a server error like a 500 in
# status_forcelist and a the given method is in the whitelist
# status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
if hasattr(response, 'http_request') and hasattr(response, 'http_response'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):


def is_retry(response, mode):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down Expand Up @@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):

else:
# Incrementing because of a server error like a 500 in
# status_forcelist and a the given method is in the whitelist
# status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):


def is_retry(response, mode):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down Expand Up @@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):

else:
# Incrementing because of a server error like a 500 in
# status_forcelist and a the given method is in the whitelist
# status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(self, **kwargs):
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)

def is_retry(self, settings, response):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, **kwargs):
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)

def is_retry(self, settings, response):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down
2 changes: 1 addition & 1 deletion sdk/eventhub/test-resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"type": "string",
"defaultValue": "10",
"metadata": {
"description": "The maximum duration, in minutes, that a single test is permitted to run before it is considered at-risk for being hung."
"description": "The maximum duration, in minutes, that a single test is permitted to run before it is considered at-risk of not responding"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def get_document(self, key, selected_fields=None, **kwargs):
:param key: The primary key value for the document to retrieve
:type key: str
:param selected_fields: a whitelist of fields to include in the results
:param selected_fields: a allowlist of fields to include in the results
:type selected_fields: List[str]
:rtype: dict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async def get_document(self, key, selected_fields=None, **kwargs):
:param key: The primary key value for the document to retrieve
:type key: str
:param selected_fields: a whitelist of fields to include in the results
:param selected_fields: a allowlist of fields to include in the results
:type selected_fields: List[str]
:rtype: dict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):


def is_retry(response, mode):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down Expand Up @@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):

else:
# Incrementing because of a server error like a 500 in
# status_forcelist and a the given method is in the whitelist
# status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):


def is_retry(response, mode):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down Expand Up @@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):

else:
# Incrementing because of a server error like a 500 in
# status_forcelist and a the given method is in the whitelist
# status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):


def is_retry(response, mode):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down Expand Up @@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):

else:
# Incrementing because of a server error like a 500 in
# status_forcelist and a the given method is in the whitelist
# status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def retry_hook(settings, **kwargs):


def is_retry(response, mode):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down Expand Up @@ -456,7 +456,7 @@ def increment(self, settings, request, response=None, error=None):

else:
# Incrementing because of a server error like a 500 in
# status_forcelist and a the given method is in the whitelist
# status_forcelist and a the given method is in the allowlist
if response:
settings['status'] -= 1
settings['history'].append(RequestHistory(request, http_response=response))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def __init__(self, **kwargs):
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)

def is_retry(self, settings, response):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, **kwargs):
self.retry_to_secondary = kwargs.get('retry_to_secondary', False)

def is_retry(self, settings, response):
"""Is this method/status code retryable? (Based on whitelists and control
"""Is this method/status code retryable? (Based on allowlists and control
variables such as the number of total retries to allow, whether to
respect the Retry-After header, whether this header is present, and
whether the returned status code is on the list of status codes to
Expand Down
2 changes: 1 addition & 1 deletion tools/vcrpy/vcr/stubs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def settimeout(self, *args, **kwargs):

def fileno(self):
"""
This is kinda crappy. requests will watch
This is not very good. requests will watch
this descriptor and make sure it's not closed.
Return file descriptor 0 since that's stdin.
"""
Expand Down

0 comments on commit 1432b80

Please sign in to comment.