nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: aws/aws-sdk-js
Pull request #2820 (2019-08-23 22:20:08)

 chore: update environment variable names in TokenFileWebIdentityCredentials
##### Checklist

- [x] `npm run test` passes
- [x] changelog is added, `npm run add-change`



Patch:
diff --git a/.changes/next-release/bugfix-Credentials-422b0a91.json b/.changes/next-release/bugfix-Credentials-422b0a91.json
new file mode 100644
index 000000000..65bbef880
--- /dev/null
+++ b/.changes/next-release/bugfix-Credentials-422b0a91.json
@@ -0,0 +1,5 @@
+{
+  "type": "bugfix",
+  "category": "Credentials",
+  "description": "Update environment variable names in TokenFileWebIdentityCredentials"
+}
\ No newline at end of file
diff --git a/lib/credentials/token_file_web_identity_credentials.js b/lib/credentials/token_file_web_identity_credentials.js
index f12141e63..c792afbe3 100644
--- a/lib/credentials/token_file_web_identity_credentials.js
+++ b/lib/credentials/token_file_web_identity_credentials.js
@@ -57,12 +57,12 @@ AWS.TokenFileWebIdentityCredentials = AWS.util.inherit(AWS.Credentials, {
    */
   getParamsFromEnv: function getParamsFromEnv() {
     var ENV_TOKEN_FILE = 'AWS_WEB_IDENTITY_TOKEN_FILE',
-        ENV_ROLE_ARN = 'AWS_IAM_ROLE_ARN';
+        ENV_ROLE_ARN = 'AWS_ROLE_ARN';
     if (process.env[ENV_TOKEN_FILE] && process.env[ENV_ROLE_ARN]) {
       return {
         envTokenFile: process.env[ENV_TOKEN_FILE],
         roleArn: process.env[ENV_ROLE_ARN],
-        roleSessionName: process.env['AWS_IAM_ROLE_SESSION_NAME']
+        roleSessionName: process.env['AWS_ROLE_SESSION_NAME']
       };
     }
   },


Test patch:
diff --git a/test/credentials.spec.js b/test/credentials.spec.js
index 426d03b41..b8bb9f9e1 100644
--- a/test/credentials.spec.js
+++ b/test/credentials.spec.js
@@ -1387,8 +1387,8 @@
         origEnv = process.env;
         process.env = {
           AWS_WEB_IDENTITY_TOKEN_FILE: 'envTokenFile',
-          AWS_IAM_ROLE_ARN: 'envRoleArn',
-          ENV_ROLE_SESSION_NAME: 'envSessionName'
+          AWS_ROLE_ARN: 'envRoleArn',
+          AWS_ROLE_SESSION_NAME: 'envSessionName'
         };
         helpers.spyOn(AWS.util, 'getProfilesFromSharedConfig').andReturn(
           {
@@ -1432,7 +1432,7 @@
         });
 
         it('when AWS_IAM_ROLE_ARN is not available', function(done) {
-          delete process.env.AWS_IAM_ROLE_ARN;
+          delete process.env.AWS_ROLE_ARN;
           new AWS.TokenFileWebIdentityCredentials().refresh(function() {
             expect(fs.readFileSync.calls[0]['arguments'][0]).to.equal('cfgTokenFile');
             done();
Repository: brettcannon/gidgethub
Pull request #14 (2017-03-24 17:58:22)

Fix signature verification


Patch:
diff --git a/README.rst b/README.rst
index 618b477..e03e824 100644
--- a/README.rst
+++ b/README.rst
@@ -68,6 +68,7 @@ Changelog
   (i.e. if the ``content-type`` doesn't specify ``charset``, assume ``UTF-8``).
 - Changed the signature of ``gidgethub.sansio.Event`` to accept ``Any`` for
   the *data* argment.
+- Fixed signature verification
 
 
 1.1.0
diff --git a/gidgethub/sansio.py b/gidgethub/sansio.py
index 8378b50..e48112d 100644
--- a/gidgethub/sansio.py
+++ b/gidgethub/sansio.py
@@ -43,10 +43,8 @@ def validate_event(payload: bytes, *, signature: str, secret: str) -> None:
     if not signature.startswith(signature_prefix):
         raise ValidationFailure("signature does not start with "
                                            f"{repr(signature_prefix)}")
-    hash_ = hashlib.sha1()
-    hash_.update(secret.encode("UTF-8"))
-    hash_.update(payload)
-    calculated_sig = signature_prefix + hash_.hexdigest()
+    hmac_ = hmac.new(secret.encode("UTF-8"), msg=payload, digestmod="sha1")
+    calculated_sig = signature_prefix + hmac_.hexdigest()
     if not hmac.compare_digest(signature, calculated_sig):
         raise ValidationFailure("payload's signature does not align "
                                            "with the secret")


Test patch:
diff --git a/gidgethub/test/test_sansio.py b/gidgethub/test/test_sansio.py
index 894797e..41d55e4 100644
--- a/gidgethub/test/test_sansio.py
+++ b/gidgethub/test/test_sansio.py
@@ -16,7 +16,7 @@ class TestValidateEvent:
 
     secret = "123456"
     payload = "gidget".encode("UTF-8")
-    hash_signature = "6ea124f8bfc2e6f5a0a40687201c351716110bec"
+    hash_signature = "8acc2ae97633ec018f118577f4872e103f24ef58"
     signature = "sha1=" + hash_signature
 
     def test_malformed_signature(self):
@@ -46,7 +46,7 @@ class TestEvent:
     headers = {"content-type": "application/json",
                "x-github-event": "pull_request",
                "x-github-delivery": "72d3162e-cc78-11e3-81ab-4c9367dc0958",
-               "x-hub-signature": "sha1=13ed44049d52492cab0f3aa22215091d35be4d58"}
+               "x-hub-signature": "sha1=c28e33b2e56e548956c446e890929a6cbec3ac89"}
 
     def check_event(self, event):
         """Check that an event matches the test data provided by the class."""
Repository: gorakhargosh/watchdog
Pull request #655 (2020-04-02 04:57:14)

Allow to monitor single file
Currently on Linux using watchdog we can only monitor directories... But for many cases it is necessary to enable the users to monitor files (not directory)

BoboTiG: Hello @brant-ruan ,

Thanks for tackling that, would you mind adding a test?
brant-ruan: hello, I added one test funciton :)
BoboTiG: Ah super! Could you apply those changes to the changelog as well? :pray: (in the 0.10.3 section, you are the first contributor :muscle:)
```
- [inotify] Allow to monitor single file (`#655 <https://github.com/gorakhargosh/watchdog/pull/655>`__)
- Thanks to our beloved contributors: @brant-ruan
```
brant-ruan: Sure, thx :)
frispete: Hi guys, I like this tone :wink: 

Patch:
diff --git a/changelog.rst b/changelog.rst
index adb3d7b..5a23523 100644
--- a/changelog.rst
+++ b/changelog.rst
@@ -8,7 +8,8 @@ Changelog
 
 2020-0x-xx • `full history <https://github.com/gorakhargosh/watchdog/compare/v0.10.2...master>`__
 
-- Thanks to our beloved contributors: @
+- [inotify] Allow to monitor single file (`#655 <https://github.com/gorakhargosh/watchdog/pull/655>`__)
+- Thanks to our beloved contributors: @brant-ruan
 
 
 0.10.2
diff --git a/src/watchdog/observers/inotify_c.py b/src/watchdog/observers/inotify_c.py
index 1eae327..f70f8da 100644
--- a/src/watchdog/observers/inotify_c.py
+++ b/src/watchdog/observers/inotify_c.py
@@ -197,7 +197,10 @@ def __init__(self, path, recursive=False, event_mask=WATCHDOG_ALL_EVENTS):
         self._path = path
         self._event_mask = event_mask
         self._is_recursive = recursive
-        self._add_dir_watch(path, recursive, event_mask)
+        if os.path.isdir(path):
+            self._add_dir_watch(path, recursive, event_mask)
+        else:
+            self._add_watch(path, event_mask)
         self._moved_from_events = dict()
 
     @property


Test patch:
diff --git a/tests/test_inotify_c.py b/tests/test_inotify_c.py
index 3de1853..b4d9f9f 100644
--- a/tests/test_inotify_c.py
+++ b/tests/test_inotify_c.py
@@ -168,3 +168,13 @@ def test_non_ascii_path():
         assert event.src_path == path
         # Just make sure it doesn't raise an exception.
         assert repr(event)
+
+
+def test_watch_file():
+    path = p("this_is_a_file")
+    with open(path, "a"):
+        pass
+    with watching(path):
+        os.remove(path)
+        event, _ = event_queue.get(timeout=5)
+        assert repr(event)