nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: boto/botocore
Pull request #578 (2015-06-19 13:16:35)

Shorten naming when listing client methods
This shortens the names when the client methods are listed. Instead of writing out the full name of the method (e.g. showing the class name as well), it just lists the method name.

Here is what it looked before:
![screen shot 2015-06-19 at 6 14 31 am](https://cloud.githubusercontent.com/assets/4605355/8254096/5c579d12-164a-11e5-8e0c-e822ea8b82dd.png)


Here is what it looks like now:
![screen shot 2015-06-19 at 6 16 48 am](https://cloud.githubusercontent.com/assets/4605355/8254119/a633c4f6-164a-11e5-95e6-eae10510e2dd.png)


cc @jamesls @mtdowling 


Patch:
diff --git a/botocore/docs/client.py b/botocore/docs/client.py
index 773f38d4e..e435a9f2d 100644
--- a/botocore/docs/client.py
+++ b/botocore/docs/client.py
@@ -59,8 +59,7 @@ class ClientDocumenter(object):
         section.write('These are the available methods:')
         section.style.new_line()
         for method_name in sorted(client_methods):
-            section.style.li(':py:meth:`%s.Client.%s`' % (
-                self._client.__class__.__name__, method_name))
+            section.style.li(':py:meth:`%s`' % (method_name))
 
     def _add_class_signature(self, section):
         section.style.start_sphinx_py_class(


Test patch:
diff --git a/tests/unit/docs/test_client.py b/tests/unit/docs/test_client.py
index 8b0fc23d7..f041a3cff 100644
--- a/tests/unit/docs/test_client.py
+++ b/tests/unit/docs/test_client.py
@@ -31,10 +31,10 @@ class TestClientDocumenter(BaseDocsTest):
             '  A low-level client representing AWS MyService::',
             '    client = session.create_client(\'myservice\')',
             '  These are the available methods:',
-            '  *   :py:meth:`MyService.Client.can_paginate`',
-            '  *   :py:meth:`MyService.Client.get_paginator`',
-            '  *   :py:meth:`MyService.Client.get_waiter`',
-            '  *   :py:meth:`MyService.Client.sample_operation`',
+            '  *   :py:meth:`can_paginate`',
+            '  *   :py:meth:`get_paginator`',
+            '  *   :py:meth:`get_waiter`',
+            '  *   :py:meth:`sample_operation`',
             '  .. py:method:: can_paginate(operation_name)',
             '  .. py:method:: get_paginator(operation_name)',
             '  .. py:method:: get_waiter(waiter_name)',
diff --git a/tests/unit/docs/test_service.py b/tests/unit/docs/test_service.py
index f9b0a99ee..ff59301c8 100644
--- a/tests/unit/docs/test_service.py
+++ b/tests/unit/docs/test_service.py
@@ -44,7 +44,7 @@ class TestServiceDocumenter(BaseDocsTest):
             '  A low-level client representing AWS MyService::',
             '    client = session.create_client(\'myservice\')',
             '  These are the available methods:',
-            '  *   :py:meth:`MyService.Client.sample_operation`',
+            '  *   :py:meth:`sample_operation`',
             '  .. py:method:: sample_operation(**kwargs)',
             '==========',
             'Paginators',
Repository: boto/botocore
Pull request #584 (2015-06-19 22:51:24)

Fall back to get_config_variable() in profile property
So we can continue to keep boto3 code simple such as: https://github.com/boto/boto3/blob/develop/boto3/session.py#L84-L89

cc @kyleknap @mtdowling 


Patch:
diff --git a/botocore/session.py b/botocore/session.py
index a3304ed3c..03b46598c 100644
--- a/botocore/session.py
+++ b/botocore/session.py
@@ -202,6 +202,9 @@ class Session(object):
 
     @property
     def profile(self):
+        if self._profile is None:
+            profile = self.get_config_variable('profile')
+            self._profile = profile
         return self._profile
 
     def get_config_variable(self, logical_name,


Test patch:
diff --git a/tests/unit/test_session.py b/tests/unit/test_session.py
index f650eb968..457892916 100644
--- a/tests/unit/test_session.py
+++ b/tests/unit/test_session.py
@@ -84,6 +84,16 @@ class SessionTest(BaseSessionTest):
         self.environ['BAR_PROFILE'] = 'second'
         self.assertEqual(session.get_config_variable('profile'), 'first')
 
+    def test_profile_when_set_explicitly(self):
+        session = create_session(session_vars=self.env_vars, profile='asdf')
+        self.assertEqual(session.profile, 'asdf')
+
+    def test_profile_when_pulled_from_env(self):
+        self.environ['FOO_PROFILE'] = 'bar'
+        # Even though we didn't explicitly pass in a profile, the
+        # profile property will still look this up for us.
+        self.assertEqual(self.session.profile, 'bar')
+
     def test_multiple_env_vars_uses_second_var(self):
         env_vars = {
             'profile': (None, ['BAR_DEFAULT_PROFILE', 'BAR_PROFILE'],
Repository: boto/botocore
Pull request #608 (2015-07-20 20:21:26)

Adding a StringShape and enum attribute
This commit updates the shape builders to utilize a new concrete shape
type, StringShape. StringShape exposes a property that makes it easier
to inspect the enum attribute of a string shape. StringShape is the only
concrete shape type to expose this property because, at present, the only
shapes that have the `enum` property are string shapes.

In addition to this feature, the unused `SHAPE_CLASSES` constant has been
deleted from ServiceModel. If removing this constant is not acceptable, I can
put it back and rebase.


Patch:
diff --git a/botocore/model.py b/botocore/model.py
index 0fc1913b8..beac43e9b 100644
--- a/botocore/model.py
+++ b/botocore/model.py
@@ -191,18 +191,18 @@ class MapShape(Shape):
         return self._resolve_shape_ref(self._shape_model['value'])
 
 
+class StringShape(Shape):
+    @CachedProperty
+    def enum(self):
+        return self.metadata.get('enum', [])
+
+
 class ServiceModel(object):
     """
 
     :ivar service_description: The parsed service description dictionary.
 
     """
-    # Any type not in this mapping will default to the Shape class.
-    SHAPE_CLASSES = {
-        'structure': StructureShape,
-        'list': ListShape,
-        'map': MapShape,
-    }
 
     def __init__(self, service_description, service_name=None):
         """
@@ -428,6 +428,7 @@ class ShapeResolver(object):
         'structure': StructureShape,
         'list': ListShape,
         'map': MapShape,
+        'string': StringShape
     }
 
     def __init__(self, shape_map):


Test patch:
diff --git a/tests/unit/test_model.py b/tests/unit/test_model.py
index eae0a6745..ab0bbd40e 100644
--- a/tests/unit/test_model.py
+++ b/tests/unit/test_model.py
@@ -588,17 +588,20 @@ class TestBuilders(unittest.TestCase):
         self.assertEqual(
             shape.members['A'].members['B'].members['C'].type_name, 'string')
 
-    def test_enum_values_on_scalar_used(self):
+    def test_enum_values_on_string_used(self):
         b = model.DenormalizedStructureBuilder()
+        enum_values = ['foo', 'bar', 'baz']
         shape = b.with_members({
             'A': {
                 'type': 'string',
-                'enum': ['foo', 'bar', 'baz'],
+                'enum': enum_values,
             },
         }).build_model()
         self.assertIsInstance(shape, model.StructureShape)
-        self.assertEqual(shape.members['A'].metadata['enum'],
-                         ['foo', 'bar', 'baz'])
+        string_shape = shape.members['A']
+        self.assertIsInstance(string_shape, model.StringShape)
+        self.assertEqual(string_shape.metadata['enum'], enum_values)
+        self.assertEqual(string_shape.enum, enum_values)
 
     def test_documentation_on_shape_used(self):
         b = model.DenormalizedStructureBuilder()
Repository: boto/botocore
Pull request #646 (2015-09-10 12:19:08)

Make the StreamingBody wrapper more file-like with a close() method
This will solve pypa/warehouse#676 which is essentially caused by trying to treat the StreamingBody like a file-like object.

rayluo: Sounds good. Can you also provide test case for it? Thanks!

Patch:
diff --git a/botocore/response.py b/botocore/response.py
index 505214957..9943ffecc 100644
--- a/botocore/response.py
+++ b/botocore/response.py
@@ -83,6 +83,9 @@ class StreamingBody(object):
                 actual_bytes=self._amount_read,
                 expected_bytes=int(self._content_length))
 
+    def close(self):
+        self._raw_stream.close()
+
 
 def _validate_content_length(expected_content_length, body_length):
     # See: https://github.com/kennethreitz/requests/issues/1855


Test patch:
diff --git a/tests/unit/test_response.py b/tests/unit/test_response.py
index a5bce704c..0d9375d2b 100644
--- a/tests/unit/test_response.py
+++ b/tests/unit/test_response.py
@@ -61,6 +61,14 @@ class TestStreamWrapper(unittest.TestCase):
         with self.assertRaises(IncompleteReadError):
             stream.read()
 
+    def test_streaming_body_closes(self):
+        body = six.BytesIO(b'1234567890')
+        stream = response.StreamingBody(body, content_length=10)
+        self.assertFalse(body.closed)
+        stream.close()
+        self.assertTrue(body.closed)
+
+
 class TestGetResponse(unittest.TestCase):
     maxDiff = None