From ad39b75c0f78c6b5a703b5c47af3c9618f8065e4 Mon Sep 17 00:00:00 2001 From: domx4q Date: Thu, 23 May 2024 13:00:55 +0200 Subject: [PATCH] grammar fixes --- .github/CONTRIBUTING.md | 2 +- .github/SECURITY.md | 8 ++++---- .github/workflows/codeql-analysis.yml | 2 +- docs/conf.py | 2 +- src/requests/adapters.py | 4 ++-- src/requests/auth.py | 2 +- src/requests/models.py | 8 ++++---- src/requests/sessions.py | 2 +- src/requests/structures.py | 2 +- src/requests/utils.py | 22 +++++++++++----------- tests/certs/README.md | 2 +- tests/test_requests.py | 12 ++++++------ 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3470dfee83..2f163060e9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -50,5 +50,5 @@ Please be aware of the following things when filing bug reports: ship patches on top of the code we supply. If you do not provide all of these things, it will take us much longer to - fix your problem. If we ask you to clarify these and you never respond, we + fix your problem. If we ask you to clarify these, and you never respond, we will close your issue without fixing it. diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 9021d429d8..d149b9d192 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -16,7 +16,7 @@ profiles above if desired. If English is not your first language, please try to describe the problem and its impact to the best of your ability. For greater detail, -please use your native language and we will try our best to translate it +please use your native language, and we will try our best to translate it using online services. Please also include the code you used to find the problem and the @@ -65,11 +65,11 @@ number if one is required, providing you with full credit for the discovery. We will also decide on a planned release date, and let you know when it is. This release date will *always* be on a weekday. -At this point we will reach out to our major downstream packagers to -notify them of an impending security-related patch so they can make +At this point, we will reach out to our major downstream packagers to +notify them of an impending security-related patch, so they can make arrangements. In addition, these packagers will be provided with the intended patch ahead of time, to ensure that they are able to promptly -release their downstream packages. Currently the list of people we +release their downstream packages. Currently, the list of people we actively contact *ahead of a public release* is: - Jeremy Cline, Red Hat (@jeremycline) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index b6d544640b..917180eaa3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -35,7 +35,7 @@ jobs: uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 with: # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. + # a pull request, then we can checkout the head. fetch-depth: 2 # If this run was triggered by a pull request event, then checkout diff --git a/docs/conf.py b/docs/conf.py index edbd72ba82..5e65d1f780 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -335,7 +335,7 @@ # The scheme of the identifier. Typical schemes are ISBN or URL. # epub_scheme = '' -# The unique identifier of the text. This can be a ISBN number +# The unique identifier of the text. This can be an ISBN # or the project homepage. # epub_identifier = '' diff --git a/src/requests/adapters.py b/src/requests/adapters.py index 42fabe527c..266982a91e 100644 --- a/src/requests/adapters.py +++ b/src/requests/adapters.py @@ -407,7 +407,7 @@ def get_connection_with_tls_context(self, request, verify, proxies=None, cert=No **host_params, pool_kwargs=pool_kwargs ) else: - # Only scheme should be lower case + # Only scheme should be lowercase conn = self.poolmanager.connection_from_host( **host_params, pool_kwargs=pool_kwargs ) @@ -448,7 +448,7 @@ def get_connection(self, url, proxies=None): proxy_manager = self.proxy_manager_for(proxy) conn = proxy_manager.connection_from_url(url) else: - # Only scheme should be lower case + # Only scheme should be lowercase parsed = urlparse(url) url = parsed.geturl() conn = self.poolmanager.connection_from_url(url) diff --git a/src/requests/auth.py b/src/requests/auth.py index 4a7ce6dc14..ba98e9fac4 100644 --- a/src/requests/auth.py +++ b/src/requests/auth.py @@ -26,7 +26,7 @@ def _basic_auth_str(username, password): """Returns a Basic Auth string.""" # "I want us to put a big-ol' comment on top of it that - # says that this behaviour is dumb but we need to preserve + # says that this behaviour is dumb, but we need to preserve # it because people are relying on it." # - Lukasa # diff --git a/src/requests/models.py b/src/requests/models.py index 8f56ca7d23..ee5bf6f42a 100644 --- a/src/requests/models.py +++ b/src/requests/models.py @@ -422,7 +422,7 @@ def prepare_url(self, url, params): url = url.lstrip() # Don't do any URL preparation for non-HTTP schemes like `mailto`, - # `data` etc to work around exceptions from `url_parse`, which + # `data` etc. to work around exceptions from `url_parse`, which # handles RFC 3986 only. if ":" in url and not url.lower().startswith("http"): self.url = url @@ -494,8 +494,8 @@ def prepare_headers(self, headers): def prepare_body(self, data, files, json=None): """Prepares the given HTTP body data.""" - # Check if file, fo, generator, iterator. - # If not, run through normal process. + # Check if it's a file, fo, generator, iterator. + # If not, run through the normal process. # Nottin' on you. body = None @@ -956,7 +956,7 @@ def json(self, **kwargs): # No encoding set. JSON RFC 4627 section 3 states we should expect # UTF-8, -16 or -32. Detect which one to use; If the detection or # decoding fails, fall back to `self.text` (using charset_normalizer to make - # a best guess). + # the best guess). encoding = guess_json_utf(self.content) if encoding is not None: try: diff --git a/src/requests/sessions.py b/src/requests/sessions.py index b387bc36df..230dd67e26 100644 --- a/src/requests/sessions.py +++ b/src/requests/sessions.py @@ -438,7 +438,7 @@ def __init__(self): self.trust_env = True #: A CookieJar containing all currently outstanding cookies set on this - #: session. By default it is a + #: session. By default, it is a #: :class:`RequestsCookieJar `, but #: may be any other ``cookielib.CookieJar`` compatible object. self.cookies = cookiejar_from_dict({}) diff --git a/src/requests/structures.py b/src/requests/structures.py index 188e13e482..9f6005587b 100644 --- a/src/requests/structures.py +++ b/src/requests/structures.py @@ -21,7 +21,7 @@ class CaseInsensitiveDict(MutableMapping): case of the last key to be set, and ``iter(instance)``, ``keys()``, ``items()``, ``iterkeys()``, and ``iteritems()`` will contain case-sensitive keys. However, querying and contains - testing is case insensitive:: + testing is case-insensitive:: cid = CaseInsensitiveDict() cid['Accept'] = 'application/json' diff --git a/src/requests/utils.py b/src/requests/utils.py index ae6c42f6cb..41b3a05498 100644 --- a/src/requests/utils.py +++ b/src/requests/utils.py @@ -449,16 +449,16 @@ def unquote_header_value(value, is_filename=False): """ if value and value[0] == value[-1] == '"': # this is not the real unquoting, but fixing this so that the - # RFC is met will result in bugs with internet explorer and - # probably some other browsers as well. IE for example is + # RFC is met will result in bugs with Internet Explorer and + # probably some other browsers as well. IE, for example, is # uploading files with "C:\foo\bar.txt" as filename value = value[1:-1] - # if this is a filename and the starting characters look like - # a UNC path, then just return the value without quotes. Using the + # If this is a filename and the starting characters look like + # a UNC path, then just return the value without quotes. Using the # replace sequence below on a UNC path has the effect of turning # the leading double slash into a single slash and then - # _fix_ie_filename() doesn't work correctly. See #458. + # _fix_ie_filename() doesn't work correctly. See #458. if not is_filename or value[:2] != "\\\\": return value.replace("\\\\", "\\").replace('\\"', '"') return value @@ -675,7 +675,7 @@ def requote_uri(uri): except InvalidURL: # We couldn't unquote the given URI, so let's try quoting it, but # there may be unquoted '%'s in the URI. We need to make sure they're - # properly quoted so they do not cause issues elsewhere. + # properly quoted, so they do not cause issues elsewhere. return quote(uri, safe=safe_without_percent) @@ -1004,7 +1004,7 @@ def prepend_scheme_if_needed(url, new_scheme): netloc, path = path, netloc if auth: - # parse_url doesn't provide the netloc with auth + # parse_url doesn't provide the netloc with auth, # so we'll add it ourselves. netloc = "@".join([auth, netloc]) if scheme is None: @@ -1016,8 +1016,8 @@ def prepend_scheme_if_needed(url, new_scheme): def get_auth_from_url(url): - """Given a url with authentication components, extract them into a tuple of - username,password. + """Given a URL with authentication components, extract them into a tuple of + (username, password). :rtype: (str,str) """ @@ -1063,7 +1063,7 @@ def _validate_header_part(header, header_part, header_validator_index): def urldefragauth(url): """ - Given a url remove the fragment and the authentication part. + Given a URL remove the fragment and the authentication part. :rtype: str """ @@ -1079,7 +1079,7 @@ def urldefragauth(url): def rewind_body(prepared_request): - """Move file pointer back to its recorded starting position + """Move file pointer back to its recorded starting position, so it can be read again on redirect. """ body_seek = getattr(prepared_request.body, "seek", None) diff --git a/tests/certs/README.md b/tests/certs/README.md index 4bf7002e0b..e947ec160d 100644 --- a/tests/certs/README.md +++ b/tests/certs/README.md @@ -6,5 +6,5 @@ behaviour. The certificates include: * [expired](./expired) server certificate with a valid certificate authority -* [mtls](./mtls) provides a valid client certificate with a 2 year validity +* [mtls](./mtls) provides a valid client certificate with 2-year validity * [valid](./valid) has a valid server certificate diff --git a/tests/test_requests.py b/tests/test_requests.py index b4e9fe92ae..9254e7a286 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -583,7 +583,7 @@ def test_errors(self, url, exception): requests.get(url, timeout=1) def test_proxy_error(self): - # any proxy related error (address resolution, no route to host, etc) should result in a ProxyError + # any proxy related error (address resolution, no route to host, etc.) should result in a ProxyError with pytest.raises(ProxyError): requests.get( "http://localhost:1", proxies={"http": "non-resolvable-address"} @@ -1470,7 +1470,7 @@ def test_response_chunk_size_type(self): def test_iter_content_wraps_exceptions(self, httpbin, exception, args, expected): r = requests.Response() r.raw = mock.Mock() - # ReadTimeoutError can't be initialized by mock + # ReadTimeoutError can't be initialized by mock, # so we'll manually create the instance with args r.raw.stream.side_effect = exception(*args) @@ -2216,7 +2216,7 @@ def get_redirect_target(self, resp): # default behavior if resp.is_redirect: return resp.headers["location"] - # edge case - check to see if 'location' is in headers anyways + # edge case - check to see if 'location' is in headers anyway location = resp.headers.get("location") if location and (location != resp.url): return location @@ -2431,7 +2431,7 @@ def test_max_age_valid_int(self): assert isinstance(cookie.expires, int) def test_max_age_invalid_str(self): - """Test case where a invalid max age is passed.""" + """Test case where an invalid max age is passed.""" morsel = Morsel() morsel["max-age"] = "woops" @@ -2465,7 +2465,7 @@ def test_none_timeout(self, httpbin, timeout): To actually test this behavior, we'd want to check that setting the timeout to None actually lets the request block past the system default timeout. However, this would make the test suite unbearably slow. - Instead we verify that setting the timeout to None does not prevent the + Instead, we verify that setting the timeout to None does not prevent the request from succeeding. """ r = requests.get(httpbin("get"), timeout=timeout) @@ -2887,7 +2887,7 @@ def response_handler(sock): r1 = s.get(url, verify=False) assert r1.status_code == 200 - # Has right trust bundle, but certificate expired + # Has the right trust bundle, but the certificate is expired with pytest.raises(requests.exceptions.SSLError): s.get(url, verify="tests/certs/expired/ca/ca.crt")