prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Fix several configuration issues
  Fix the pending issues in #563 as pointed out by @mauriciovasquezbernal. 
  
  </issue>
  <code>
  [start of opentelemetry-api/src/opentelemetry/configuration/__init__.py]
  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
  23 ``OPENTELEMETRY_PYTHON_`` whose characters are only all caps and underscores.
  24 The first character after ``OPENTELEMETRY_PYTHON_`` must be an uppercase
  25 character.
  26 
  27 For example, these environment variables will be read:
  28 
  29 1. ``OPENTELEMETRY_PYTHON_SOMETHING``
  30 2. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_``
  31 3. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND__ELSE``
  32 
  33 These won't:
  34 
  35 1. ``OPENTELEMETRY_PYTH_SOMETHING``
  36 2. ``OPENTELEMETRY_PYTHON_something``
  37 3. ``OPENTELEMETRY_PYTHON_SOMETHING_2_AND__ELSE``
  38 4. ``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 a singleton.
  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("OPENTELEMETRY_PYTHON_([A-Z][A-Z_]*)", key)
  97 
  98                 if match is not None:
  99 
  100                     key = match.group(1).lower()
  101 
  102                     setattr(Configuration, "_{}".format(key), value)
  103                     setattr(
  104                         Configuration,
  105                         key,
  106                         property(
  107                             fget=lambda cls, key=key: getattr(
  108                                 cls, "_{}".format(key)
  109                             )
  110                         ),
  111                     )
  112 
  113                 Configuration.__slots__.append(key)
  114 
  115             Configuration.__slots__ = tuple(Configuration.__slots__)
  116 
  117             Configuration._instance = object.__new__(cls)
  118 
  119         return cls._instance
  120 
  121     def __getattr__(self, name):
  122         return None
  123
  [end of opentelemetry-api/src/opentelemetry/configuration/__init__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
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
  @@ -19,27 +19,27 @@
   Simple configuration manager
   
   This is a configuration manager for OpenTelemetry. It reads configuration
  -values from environment variables prefixed with
  -``OPENTELEMETRY_PYTHON_`` whose characters are only all caps and underscores.
  -The first character after ``OPENTELEMETRY_PYTHON_`` must be an uppercase
  -character.
  +values from environment variables prefixed with ``OPENTELEMETRY_PYTHON_`` whose
  +characters are only alphanumeric characters and unserscores, except for the
  +first character after ``OPENTELEMETRY_PYTHON_`` which must not be a number.
   
   For example, these environment variables will be read:
   
   1. ``OPENTELEMETRY_PYTHON_SOMETHING``
   2. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_``
   3. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND__ELSE``
  +4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else``
  +4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else2``
   
   These won't:
   
   1. ``OPENTELEMETRY_PYTH_SOMETHING``
  -2. ``OPENTELEMETRY_PYTHON_something``
  -3. ``OPENTELEMETRY_PYTHON_SOMETHING_2_AND__ELSE``
  -4. ``OPENTELEMETRY_PYTHON_SOMETHING_%_ELSE``
  +2. ``OPENTELEMETRY_PYTHON_2_SOMETHING_AND__ELSE``
  +3. ``OPENTELEMETRY_PYTHON_SOMETHING_%_ELSE``
   
   The values stored in the environment variables can be found in an instance of
   ``opentelemetry.configuration.Configuration``. This class can be instantiated
  -freely because instantiating it returns a singleton.
  +freely because instantiating it returns always the same object.
   
   For example, if the environment variable
   ``OPENTELEMETRY_PYTHON_METER_PROVIDER`` value is ``my_meter_provider``, then
  @@ -93,11 +93,13 @@
   
               for key, value in environ.items():
   
  -                match = fullmatch("OPENTELEMETRY_PYTHON_([A-Z][A-Z_]*)", key)
  +                match = fullmatch(
  +                    r"OPENTELEMETRY_PYTHON_([A-Za-z_][\w_]*)", key
  +                )
   
                   if match is not None:
   
  -                    key = match.group(1).lower()
  +                    key = match.group(1)
   
                       setattr(Configuration, "_{}".format(key), value)
                       setattr(
  
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@@ -19,27 +19,27 @@\n Simple configuration manager\n \n This is a configuration manager for OpenTelemetry. It reads configuration\n-values from environment variables prefixed with\n-``OPENTELEMETRY_PYTHON_`` whose characters are only all caps and underscores.\n-The first character after ``OPENTELEMETRY_PYTHON_`` must be an uppercase\n-character.\n+values from environment variables prefixed with ``OPENTELEMETRY_PYTHON_`` whose\n+characters are only alphanumeric characters and unserscores, except for the\n+first character after ``OPENTELEMETRY_PYTHON_`` which must not be a number.\n \n For example, these environment variables will be read:\n \n 1. ``OPENTELEMETRY_PYTHON_SOMETHING``\n 2. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_``\n 3. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND__ELSE``\n+4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else``\n+4. ``OPENTELEMETRY_PYTHON_SOMETHING_ELSE_AND_else2``\n \n These won't:\n \n 1. ``OPENTELEMETRY_PYTH_SOMETHING``\n-2. ``OPENTELEMETRY_PYTHON_something``\n-3. ``OPENTELEMETRY_PYTHON_SOMETHING_2_AND__ELSE``\n-4. ``OPENTELEMETRY_PYTHON_SOMETHING_%_ELSE``\n+2. ``OPENTELEMETRY_PYTHON_2_SOMETHING_AND__ELSE``\n+3. ``OPENTELEMETRY_PYTHON_SOMETHING_%_ELSE``\n \n The values stored in the environment variables can be found in an instance of\n ``opentelemetry.configuration.Configuration``. This class can be instantiated\n-freely because instantiating it returns a singleton.\n+freely because instantiating it returns always the same object.\n \n For example, if the environment variable\n ``OPENTELEMETRY_PYTHON_METER_PROVIDER`` value is ``my_meter_provider``, then\n@@ -93,11 +93,13 @@\n \n             for key, value in environ.items():\n \n-                match = fullmatch(\"OPENTELEMETRY_PYTHON_([A-Z][A-Z_]*)\", key)\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).lower()\n+                    key = match.group(1)\n \n                     setattr(Configuration, \"_{}\".format(key), value)\n                     setattr(\n", "issue": "Fix several configuration issues\nFix the pending issues in #563 as pointed out by @mauriciovasquezbernal. \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\n``OPENTELEMETRY_PYTHON_`` whose characters are only all caps and underscores.\nThe first character after ``OPENTELEMETRY_PYTHON_`` must be an uppercase\ncharacter.\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``\n\nThese won't:\n\n1. ``OPENTELEMETRY_PYTH_SOMETHING``\n2. ``OPENTELEMETRY_PYTHON_something``\n3. ``OPENTELEMETRY_PYTHON_SOMETHING_2_AND__ELSE``\n4. ``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 a singleton.\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(\"OPENTELEMETRY_PYTHON_([A-Z][A-Z_]*)\", key)\n\n                if match is not None:\n\n                    key = match.group(1).lower()\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"}]}