prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add a standard way to "reset" a Configuration object for testing
  It is a common occurrence in tests that the global `Configuration` object needs to be "reset" between tests. This means that its attributes need to be set back to their original values. Since the `Configuration` object is immutable by design, some additional, non-production available mechanism is needed to perform this action.
  
  The need for this feature was mentioned in a [conversation](https://github.com/open-telemetry/opentelemetry-python/pull/630#discussion_r418343720) in #630.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `opentelemetry-api/src/opentelemetry/configuration/__init__.py`
  Content:
  ```
  1 # Copyright The OpenTelemetry Authors
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #     http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 # FIXME find a better way to avoid all those "Expression has type "Any"" errors
  16 # type: ignore
  17 
  18 """
  19 Simple configuration manager
  20 
  21 This is a configuration manager for OpenTelemetry. It reads configuration
  22 values from environment variables prefixed with ``OPENTELEMETRY_PYTHON_`` whose
  23 characters are only alphanumeric characters and unserscores, except for the
  24 first character after ``OPENTELEMETRY_PYTHON_`` which must not be a number.
  25 
  26 For example, these environment variables will be read:
  27 
  28 1. ``OPENTELEMETRY_PYTHON_SOMETHING``
  29 2. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_``
  30 3. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND__ELSE``
  31 4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else``
  32 4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else2``
  33 
  34 These won't:
  35 
  36 1. ``OPENTELEMETRY_PYTH_SOMETHING``
  37 2. ``OPENTELEMETRY_PYTHON_2_SOMETHING_AND__ELSE``
  38 3. ``OPENTELEMETRY_PYTHON_SOMETHING_%_ELSE``
  39 
  40 The values stored in the environment variables can be found in an instance of
  41 ``opentelemetry.configuration.Configuration``. This class can be instantiated
  42 freely because instantiating it returns always the same object.
  43 
  44 For example, if the environment variable
  45 ``OPENTELEMETRY_PYTHON_METER_PROVIDER`` value is ``my_meter_provider``, then
  46 ``Configuration().meter_provider == "my_meter_provider"`` would be ``True``.
  47 
  48 Non defined attributes will always return ``None``. This is intended to make it
  49 easier to use the ``Configuration`` object in actual code, because it won't be
  50 necessary to check for the attribute to be defined first.
  51 
  52 Environment variables used by OpenTelemetry
  53 -------------------------------------------
  54 
  55 1. OPENTELEMETRY_PYTHON_METER_PROVIDER
  56 2. OPENTELEMETRY_PYTHON_TRACER_PROVIDER
  57 
  58 The value of these environment variables should be the name of the entry point
  59 that points to the class that implements either provider. This OpenTelemetry
  60 API package provides one entry point for each, which can be found in the
  61 setup.py file::
  62 
  63     entry_points={
  64         ...
  65         "opentelemetry_meter_provider": [
  66             "default_meter_provider = "
  67             "opentelemetry.metrics:DefaultMeterProvider"
  68         ],
  69         "opentelemetry_tracer_provider": [
  70             "default_tracer_provider = "
  71             "opentelemetry.trace:DefaultTracerProvider"
  72         ],
  73     }
  74 
  75 To use the meter provider above, then the
  76 ``OPENTELEMETRY_PYTHON_METER_PROVIDER`` should be set to
  77 "default_meter_provider" (this is not actually necessary since the
  78 OpenTelemetry API provided providers are the default ones used if no
  79 configuration is found in the environment variables).
  80 """
  81 
  82 from os import environ
  83 from re import fullmatch
  84 
  85 
  86 class Configuration:
  87     _instance = None
  88 
  89     __slots__ = []
  90 
  91     def __new__(cls) -> "Configuration":
  92         if Configuration._instance is None:
  93 
  94             for key, value in environ.items():
  95 
  96                 match = fullmatch(
  97                     r"OPENTELEMETRY_PYTHON_([A-Za-z_][\w_]*)", key
  98                 )
  99 
  100                 if match is not None:
  101 
  102                     key = match.group(1)
  103 
  104                     setattr(Configuration, "_{}".format(key), value)
  105                     setattr(
  106                         Configuration,
  107                         key,
  108                         property(
  109                             fget=lambda cls, key=key: getattr(
  110                                 cls, "_{}".format(key)
  111                             )
  112                         ),
  113                     )
  114 
  115                 Configuration.__slots__.append(key)
  116 
  117             Configuration.__slots__ = tuple(Configuration.__slots__)
  118 
  119             Configuration._instance = object.__new__(cls)
  120 
  121         return cls._instance
  122 
  123     def __getattr__(self, name):
  124         return None
  125
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/opentelemetry-api/src/opentelemetry/configuration/__init__.py b/opentelemetry-api/src/opentelemetry/configuration/__init__.py
  --- a/opentelemetry-api/src/opentelemetry/configuration/__init__.py
  +++ b/opentelemetry-api/src/opentelemetry/configuration/__init__.py
  @@ -122,3 +122,20 @@
   
       def __getattr__(self, name):
           return None
  +
  +    @classmethod
  +    def _reset(cls):
  +        """
  +        This method "resets" the global configuration attributes
  +
  +        It is not intended to be used by production code but by testing code
  +        only.
  +        """
  +
  +        for slot in cls.__slots__:
  +            if slot in cls.__dict__.keys():
  +                delattr(cls, slot)
  +                delattr(cls, "_{}".format(slot))
  +
  +        cls.__slots__ = []
  +        cls._instance = None
  
verification_info: {"golden_diff": "diff --git a/opentelemetry-api/src/opentelemetry/configuration/__init__.py b/opentelemetry-api/src/opentelemetry/configuration/__init__.py\n--- a/opentelemetry-api/src/opentelemetry/configuration/__init__.py\n+++ b/opentelemetry-api/src/opentelemetry/configuration/__init__.py\n@@ -122,3 +122,20 @@\n \n     def __getattr__(self, name):\n         return None\n+\n+    @classmethod\n+    def _reset(cls):\n+        \"\"\"\n+        This method \"resets\" the global configuration attributes\n+\n+        It is not intended to be used by production code but by testing code\n+        only.\n+        \"\"\"\n+\n+        for slot in cls.__slots__:\n+            if slot in cls.__dict__.keys():\n+                delattr(cls, slot)\n+                delattr(cls, \"_{}\".format(slot))\n+\n+        cls.__slots__ = []\n+        cls._instance = None\n", "issue": "Add a standard way to \"reset\" a Configuration object for testing\nIt is a common occurrence in tests that the global `Configuration` object needs to be \"reset\" between tests. This means that its attributes need to be set back to their original values. Since the `Configuration` object is immutable by design, some additional, non-production available mechanism is needed to perform this action.\r\n\r\nThe need for this feature was mentioned in a [conversation](https://github.com/open-telemetry/opentelemetry-python/pull/630#discussion_r418343720) in #630.\n", "before_files": [{"content": "# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# FIXME find a better way to avoid all those \"Expression has type \"Any\"\" errors\n# type: ignore\n\n\"\"\"\nSimple configuration manager\n\nThis is a configuration manager for OpenTelemetry. It reads configuration\nvalues from environment variables prefixed with ``OPENTELEMETRY_PYTHON_`` whose\ncharacters are only alphanumeric characters and unserscores, except for the\nfirst character after ``OPENTELEMETRY_PYTHON_`` which must not be a number.\n\nFor example, these environment variables will be read:\n\n1. ``OPENTELEMETRY_PYTHON_SOMETHING``\n2. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_``\n3. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND__ELSE``\n4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else``\n4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else2``\n\nThese won't:\n\n1. ``OPENTELEMETRY_PYTH_SOMETHING``\n2. ``OPENTELEMETRY_PYTHON_2_SOMETHING_AND__ELSE``\n3. ``OPENTELEMETRY_PYTHON_SOMETHING_%_ELSE``\n\nThe values stored in the environment variables can be found in an instance of\n``opentelemetry.configuration.Configuration``. This class can be instantiated\nfreely because instantiating it returns always the same object.\n\nFor example, if the environment variable\n``OPENTELEMETRY_PYTHON_METER_PROVIDER`` value is ``my_meter_provider``, then\n``Configuration().meter_provider == \"my_meter_provider\"`` would be ``True``.\n\nNon defined attributes will always return ``None``. This is intended to make it\neasier to use the ``Configuration`` object in actual code, because it won't be\nnecessary to check for the attribute to be defined first.\n\nEnvironment variables used by OpenTelemetry\n-------------------------------------------\n\n1. OPENTELEMETRY_PYTHON_METER_PROVIDER\n2. OPENTELEMETRY_PYTHON_TRACER_PROVIDER\n\nThe value of these environment variables should be the name of the entry point\nthat points to the class that implements either provider. This OpenTelemetry\nAPI package provides one entry point for each, which can be found in the\nsetup.py file::\n\n    entry_points={\n        ...\n        \"opentelemetry_meter_provider\": [\n            \"default_meter_provider = \"\n            \"opentelemetry.metrics:DefaultMeterProvider\"\n        ],\n        \"opentelemetry_tracer_provider\": [\n            \"default_tracer_provider = \"\n            \"opentelemetry.trace:DefaultTracerProvider\"\n        ],\n    }\n\nTo use the meter provider above, then the\n``OPENTELEMETRY_PYTHON_METER_PROVIDER`` should be set to\n\"default_meter_provider\" (this is not actually necessary since the\nOpenTelemetry API provided providers are the default ones used if no\nconfiguration is found in the environment variables).\n\"\"\"\n\nfrom os import environ\nfrom re import fullmatch\n\n\nclass Configuration:\n    _instance = None\n\n    __slots__ = []\n\n    def __new__(cls) -> \"Configuration\":\n        if Configuration._instance is None:\n\n            for key, value in environ.items():\n\n                match = fullmatch(\n                    r\"OPENTELEMETRY_PYTHON_([A-Za-z_][\\w_]*)\", key\n                )\n\n                if match is not None:\n\n                    key = match.group(1)\n\n                    setattr(Configuration, \"_{}\".format(key), value)\n                    setattr(\n                        Configuration,\n                        key,\n                        property(\n                            fget=lambda cls, key=key: getattr(\n                                cls, \"_{}\".format(key)\n                            )\n                        ),\n                    )\n\n                Configuration.__slots__.append(key)\n\n            Configuration.__slots__ = tuple(Configuration.__slots__)\n\n            Configuration._instance = object.__new__(cls)\n\n        return cls._instance\n\n    def __getattr__(self, name):\n        return None\n", "path": "opentelemetry-api/src/opentelemetry/configuration/__init__.py"}], "after_files": [{"content": "# Copyright The OpenTelemetry Authors\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n# FIXME find a better way to avoid all those \"Expression has type \"Any\"\" errors\n# type: ignore\n\n\"\"\"\nSimple configuration manager\n\nThis is a configuration manager for OpenTelemetry. It reads configuration\nvalues from environment variables prefixed with ``OPENTELEMETRY_PYTHON_`` whose\ncharacters are only alphanumeric characters and unserscores, except for the\nfirst character after ``OPENTELEMETRY_PYTHON_`` which must not be a number.\n\nFor example, these environment variables will be read:\n\n1. ``OPENTELEMETRY_PYTHON_SOMETHING``\n2. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_``\n3. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND__ELSE``\n4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else``\n4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else2``\n\nThese won't:\n\n1. ``OPENTELEMETRY_PYTH_SOMETHING``\n2. ``OPENTELEMETRY_PYTHON_2_SOMETHING_AND__ELSE``\n3. ``OPENTELEMETRY_PYTHON_SOMETHING_%_ELSE``\n\nThe values stored in the environment variables can be found in an instance of\n``opentelemetry.configuration.Configuration``. This class can be instantiated\nfreely because instantiating it returns always the same object.\n\nFor example, if the environment variable\n``OPENTELEMETRY_PYTHON_METER_PROVIDER`` value is ``my_meter_provider``, then\n``Configuration().meter_provider == \"my_meter_provider\"`` would be ``True``.\n\nNon defined attributes will always return ``None``. This is intended to make it\neasier to use the ``Configuration`` object in actual code, because it won't be\nnecessary to check for the attribute to be defined first.\n\nEnvironment variables used by OpenTelemetry\n-------------------------------------------\n\n1. OPENTELEMETRY_PYTHON_METER_PROVIDER\n2. OPENTELEMETRY_PYTHON_TRACER_PROVIDER\n\nThe value of these environment variables should be the name of the entry point\nthat points to the class that implements either provider. This OpenTelemetry\nAPI package provides one entry point for each, which can be found in the\nsetup.py file::\n\n    entry_points={\n        ...\n        \"opentelemetry_meter_provider\": [\n            \"default_meter_provider = \"\n            \"opentelemetry.metrics:DefaultMeterProvider\"\n        ],\n        \"opentelemetry_tracer_provider\": [\n            \"default_tracer_provider = \"\n            \"opentelemetry.trace:DefaultTracerProvider\"\n        ],\n    }\n\nTo use the meter provider above, then the\n``OPENTELEMETRY_PYTHON_METER_PROVIDER`` should be set to\n\"default_meter_provider\" (this is not actually necessary since the\nOpenTelemetry API provided providers are the default ones used if no\nconfiguration is found in the environment variables).\n\"\"\"\n\nfrom os import environ\nfrom re import fullmatch\n\n\nclass Configuration:\n    _instance = None\n\n    __slots__ = []\n\n    def __new__(cls) -> \"Configuration\":\n        if Configuration._instance is None:\n\n            for key, value in environ.items():\n\n                match = fullmatch(\n                    r\"OPENTELEMETRY_PYTHON_([A-Za-z_][\\w_]*)\", key\n                )\n\n                if match is not None:\n\n                    key = match.group(1)\n\n                    setattr(Configuration, \"_{}\".format(key), value)\n                    setattr(\n                        Configuration,\n                        key,\n                        property(\n                            fget=lambda cls, key=key: getattr(\n                                cls, \"_{}\".format(key)\n                            )\n                        ),\n                    )\n\n                Configuration.__slots__.append(key)\n\n            Configuration.__slots__ = tuple(Configuration.__slots__)\n\n            Configuration._instance = object.__new__(cls)\n\n        return cls._instance\n\n    def __getattr__(self, name):\n        return None\n\n    @classmethod\n    def _reset(cls):\n        \"\"\"\n        This method \"resets\" the global configuration attributes\n\n        It is not intended to be used by production code but by testing code\n        only.\n        \"\"\"\n\n        for slot in cls.__slots__:\n            if slot in cls.__dict__.keys():\n                delattr(cls, slot)\n                delattr(cls, \"_{}\".format(slot))\n\n        cls.__slots__ = []\n        cls._instance = None\n", "path": "opentelemetry-api/src/opentelemetry/configuration/__init__.py"}]}