diff --git a/_template/setup.py b/_template/setup.py index 423aa90a3e..e158a21c88 100644 --- a/_template/setup.py +++ b/_template/setup.py @@ -27,7 +27,7 @@ "version.py", ) PACKAGE_INFO = {} -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) setuptools.setup( diff --git a/exporter/opentelemetry-exporter-datadog/setup.py b/exporter/opentelemetry-exporter-datadog/setup.py index 0c3bdf453f..ba83e9c029 100644 --- a/exporter/opentelemetry-exporter-datadog/setup.py +++ b/exporter/opentelemetry-exporter-datadog/setup.py @@ -21,7 +21,7 @@ BASE_DIR, "src", "opentelemetry", "exporter", "datadog", "version.py" ) PACKAGE_INFO = {} -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) setuptools.setup(version=PACKAGE_INFO["__version__"]) diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-client/setup.py b/instrumentation/opentelemetry-instrumentation-aiohttp-client/setup.py index f8f9608d7c..048e145d6c 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-client/setup.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-client/setup.py @@ -46,7 +46,7 @@ "aiohttp_client", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "aiohttp_client", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/setup.py b/instrumentation/opentelemetry-instrumentation-aiopg/setup.py index d9167a767a..555f005832 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/setup.py +++ b/instrumentation/opentelemetry-instrumentation-aiopg/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "aiopg", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "aiopg", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-asgi/setup.py b/instrumentation/opentelemetry-instrumentation-asgi/setup.py index 41f0be0460..ce79c106ff 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/setup.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "asgi", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "asgi", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-asyncpg/setup.py b/instrumentation/opentelemetry-instrumentation-asyncpg/setup.py index 4efaf6c1db..5e7120c8a7 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncpg/setup.py +++ b/instrumentation/opentelemetry-instrumentation-asyncpg/setup.py @@ -46,7 +46,7 @@ "asyncpg", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "asyncpg", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-boto/setup.py b/instrumentation/opentelemetry-instrumentation-boto/setup.py index fadd304a5a..05cab9ce70 100644 --- a/instrumentation/opentelemetry-instrumentation-boto/setup.py +++ b/instrumentation/opentelemetry-instrumentation-boto/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "boto", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "boto", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-botocore/setup.py b/instrumentation/opentelemetry-instrumentation-botocore/setup.py index 77097caf4f..d99c702829 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/setup.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/setup.py @@ -46,7 +46,7 @@ "botocore", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "botocore", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-celery/setup.py b/instrumentation/opentelemetry-instrumentation-celery/setup.py index d1b39a290f..2c8b3507ac 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/setup.py +++ b/instrumentation/opentelemetry-instrumentation-celery/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "celery", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "celery", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py b/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py index bdd9a5944c..54cadedb90 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py +++ b/instrumentation/opentelemetry-instrumentation-celery/src/opentelemetry/instrumentation/celery/utils.py @@ -131,7 +131,7 @@ def attach_span(task, task_id, span, is_publish=False): """ span_dict = getattr(task, CTX_KEY, None) if span_dict is None: - span_dict = dict() + span_dict = {} setattr(task, CTX_KEY, span_dict) span_dict[(task_id, is_publish)] = span diff --git a/instrumentation/opentelemetry-instrumentation-celery/tests/test_utils.py b/instrumentation/opentelemetry-instrumentation-celery/tests/test_utils.py index b04521eb08..7e33be6b96 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/tests/test_utils.py +++ b/instrumentation/opentelemetry-instrumentation-celery/tests/test_utils.py @@ -199,35 +199,35 @@ def test_task_id_from_protocol_v2(self): ["user"], {"force_logout": True}, { - u"chord": None, - u"callbacks": None, - u"errbacks": None, - u"chain": None, + "chord": None, + "callbacks": None, + "errbacks": None, + "chain": None, }, ), - "sender": u"tests.contrib.celery.test_integration.fn_task_parameters", - "exchange": u"", - "routing_key": u"celery", + "sender": "tests.contrib.celery.test_integration.fn_task_parameters", + "exchange": "", + "routing_key": "celery", "retry_policy": None, "headers": { - u"origin": u"gen83744@hostname", - u"root_id": "7e917b83-4018-431d-9832-73a28e1fb6c0", - u"expires": None, - u"shadow": None, - u"id": "7e917b83-4018-431d-9832-73a28e1fb6c0", - u"kwargsrepr": u"{'force_logout': True}", - u"lang": u"py", - u"retries": 0, - u"task": u"tests.contrib.celery.test_integration.fn_task_parameters", - u"group": None, - u"timelimit": [None, None], - u"parent_id": None, - u"argsrepr": u"['user']", - u"eta": None, + "origin": "gen83744@hostname", + "root_id": "7e917b83-4018-431d-9832-73a28e1fb6c0", + "expires": None, + "shadow": None, + "id": "7e917b83-4018-431d-9832-73a28e1fb6c0", + "kwargsrepr": "{'force_logout': True}", + "lang": "py", + "retries": 0, + "task": "tests.contrib.celery.test_integration.fn_task_parameters", + "group": None, + "timelimit": [None, None], + "parent_id": None, + "argsrepr": "['user']", + "eta": None, }, "properties": { - u"reply_to": "c3054a07-5b28-3855-b18c-1623a24aaeca", - u"correlation_id": "7e917b83-4018-431d-9832-73a28e1fb6c0", + "reply_to": "c3054a07-5b28-3855-b18c-1623a24aaeca", + "correlation_id": "7e917b83-4018-431d-9832-73a28e1fb6c0", }, } diff --git a/instrumentation/opentelemetry-instrumentation-dbapi/setup.py b/instrumentation/opentelemetry-instrumentation-dbapi/setup.py index 0661f029ee..ff0f57a950 100644 --- a/instrumentation/opentelemetry-instrumentation-dbapi/setup.py +++ b/instrumentation/opentelemetry-instrumentation-dbapi/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "dbapi", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "dbapi", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-django/setup.py b/instrumentation/opentelemetry-instrumentation-django/setup.py index 6c29567154..48e934c354 100644 --- a/instrumentation/opentelemetry-instrumentation-django/setup.py +++ b/instrumentation/opentelemetry-instrumentation-django/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "django", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "django", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/setup.py b/instrumentation/opentelemetry-instrumentation-elasticsearch/setup.py index dad9fe91df..3a99f38e74 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/setup.py +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/setup.py @@ -46,7 +46,7 @@ "elasticsearch", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "elasticsearch", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-falcon/setup.py b/instrumentation/opentelemetry-instrumentation-falcon/setup.py index 71743e58eb..1079daacc6 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/setup.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "falcon", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "falcon", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-fastapi/setup.py b/instrumentation/opentelemetry-instrumentation-fastapi/setup.py index fb00c74451..48a804bb27 100644 --- a/instrumentation/opentelemetry-instrumentation-fastapi/setup.py +++ b/instrumentation/opentelemetry-instrumentation-fastapi/setup.py @@ -46,7 +46,7 @@ "fastapi", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "fastapi", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-flask/setup.py b/instrumentation/opentelemetry-instrumentation-flask/setup.py index bc88e30167..a484fca705 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/setup.py +++ b/instrumentation/opentelemetry-instrumentation-flask/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "flask", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "flask", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-grpc/setup.py b/instrumentation/opentelemetry-instrumentation-grpc/setup.py index 9af0788ed3..a6fb80cbdf 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/setup.py +++ b/instrumentation/opentelemetry-instrumentation-grpc/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "grpc", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "grpc", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-httpx/setup.py b/instrumentation/opentelemetry-instrumentation-httpx/setup.py index 26a48970fa..8287bf52e9 100644 --- a/instrumentation/opentelemetry-instrumentation-httpx/setup.py +++ b/instrumentation/opentelemetry-instrumentation-httpx/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "httpx", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "httpx", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-jinja2/setup.py b/instrumentation/opentelemetry-instrumentation-jinja2/setup.py index 1fe98ad245..0359c1f5bf 100644 --- a/instrumentation/opentelemetry-instrumentation-jinja2/setup.py +++ b/instrumentation/opentelemetry-instrumentation-jinja2/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "jinja2", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "jinja2", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-logging/setup.py b/instrumentation/opentelemetry-instrumentation-logging/setup.py index 8cf426ca96..8b419ca346 100644 --- a/instrumentation/opentelemetry-instrumentation-logging/setup.py +++ b/instrumentation/opentelemetry-instrumentation-logging/setup.py @@ -46,7 +46,7 @@ "logging", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "logging", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-mysql/setup.py b/instrumentation/opentelemetry-instrumentation-mysql/setup.py index fa343d5a3a..af6fd555ea 100644 --- a/instrumentation/opentelemetry-instrumentation-mysql/setup.py +++ b/instrumentation/opentelemetry-instrumentation-mysql/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "mysql", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "mysql", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/setup.py b/instrumentation/opentelemetry-instrumentation-psycopg2/setup.py index f68d32dfbe..9bd056fc02 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/setup.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/setup.py @@ -46,7 +46,7 @@ "psycopg2", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "psycopg2", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-pymemcache/setup.py b/instrumentation/opentelemetry-instrumentation-pymemcache/setup.py index 13f4499eb5..274046dc8c 100644 --- a/instrumentation/opentelemetry-instrumentation-pymemcache/setup.py +++ b/instrumentation/opentelemetry-instrumentation-pymemcache/setup.py @@ -46,7 +46,7 @@ "pymemcache", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "pymemcache", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-pymongo/setup.py b/instrumentation/opentelemetry-instrumentation-pymongo/setup.py index e545457b00..9b2f5b2893 100644 --- a/instrumentation/opentelemetry-instrumentation-pymongo/setup.py +++ b/instrumentation/opentelemetry-instrumentation-pymongo/setup.py @@ -46,7 +46,7 @@ "pymongo", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "pymongo", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-pymysql/setup.py b/instrumentation/opentelemetry-instrumentation-pymysql/setup.py index db998c97fd..6c7c8a43b4 100644 --- a/instrumentation/opentelemetry-instrumentation-pymysql/setup.py +++ b/instrumentation/opentelemetry-instrumentation-pymysql/setup.py @@ -46,7 +46,7 @@ "pymysql", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "pymysql", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/setup.py b/instrumentation/opentelemetry-instrumentation-pyramid/setup.py index 38afc9697d..b815ddb4bc 100644 --- a/instrumentation/opentelemetry-instrumentation-pyramid/setup.py +++ b/instrumentation/opentelemetry-instrumentation-pyramid/setup.py @@ -46,7 +46,7 @@ "pyramid", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "pyramid", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-redis/setup.py b/instrumentation/opentelemetry-instrumentation-redis/setup.py index fe9fc10d06..b494d81330 100644 --- a/instrumentation/opentelemetry-instrumentation-redis/setup.py +++ b/instrumentation/opentelemetry-instrumentation-redis/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "redis", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "redis", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-requests/setup.py b/instrumentation/opentelemetry-instrumentation-requests/setup.py index 3c21a3328f..ecdcadfc96 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/setup.py +++ b/instrumentation/opentelemetry-instrumentation-requests/setup.py @@ -46,7 +46,7 @@ "requests", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "requests", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-sklearn/setup.py b/instrumentation/opentelemetry-instrumentation-sklearn/setup.py index ec550e2f65..ec7e2b9578 100644 --- a/instrumentation/opentelemetry-instrumentation-sklearn/setup.py +++ b/instrumentation/opentelemetry-instrumentation-sklearn/setup.py @@ -46,7 +46,7 @@ "sklearn", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "sklearn", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/__init__.py b/instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/__init__.py index 7b7effe024..3fe00b57b0 100644 --- a/instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-sklearn/src/opentelemetry/instrumentation/sklearn/__init__.py @@ -194,7 +194,7 @@ def get_base_estimators(packages: List[str]) -> Dict[str, Type[BaseEstimator]]: A dictionary of qualnames and classes inheriting from ``BaseEstimator``. """ - klasses = dict() + klasses = {} for package_name in packages: lib = import_module(package_name) package_dir = os.path.dirname(lib.__file__) diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/setup.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/setup.py index 1d8e4d3961..81f2ee899d 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/setup.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/setup.py @@ -46,7 +46,7 @@ "sqlalchemy", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "sqlalchemy", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-sqlite3/setup.py b/instrumentation/opentelemetry-instrumentation-sqlite3/setup.py index ccbb6ba31a..15ab6abe39 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlite3/setup.py +++ b/instrumentation/opentelemetry-instrumentation-sqlite3/setup.py @@ -46,7 +46,7 @@ "sqlite3", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "sqlite3", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-starlette/setup.py b/instrumentation/opentelemetry-instrumentation-starlette/setup.py index 8bc87ae6e5..f363ce2047 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/setup.py +++ b/instrumentation/opentelemetry-instrumentation-starlette/setup.py @@ -46,7 +46,7 @@ "starlette", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "starlette", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-tornado/setup.py b/instrumentation/opentelemetry-instrumentation-tornado/setup.py index d6d7415ede..124943f35b 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/setup.py +++ b/instrumentation/opentelemetry-instrumentation-tornado/setup.py @@ -46,7 +46,7 @@ "tornado", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "tornado", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-urllib/setup.py b/instrumentation/opentelemetry-instrumentation-urllib/setup.py index eacc21733f..cb47ef170b 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/setup.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "urllib", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "urllib", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/setup.py b/instrumentation/opentelemetry-instrumentation-urllib3/setup.py index f301d4fad0..8b3f3f74de 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/setup.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/setup.py @@ -46,7 +46,7 @@ "urllib3", "version.py", ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( @@ -57,7 +57,7 @@ "urllib3", "package.py", ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/setup.py b/instrumentation/opentelemetry-instrumentation-wsgi/setup.py index 73e9f65430..d0b5f351fa 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/setup.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/setup.py @@ -41,13 +41,13 @@ VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "wsgi", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "wsgi", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/propagator/opentelemetry-propagator-ot-trace/setup.py b/propagator/opentelemetry-propagator-ot-trace/setup.py index a408e061c4..586496362e 100644 --- a/propagator/opentelemetry-propagator-ot-trace/setup.py +++ b/propagator/opentelemetry-propagator-ot-trace/setup.py @@ -21,7 +21,7 @@ BASE_DIR, "src", "opentelemetry", "propagators", "ot_trace", "version.py" ) PACKAGE_INFO = {} -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) setuptools.setup(version=PACKAGE_INFO["__version__"]) diff --git a/scripts/check_for_valid_readme.py b/scripts/check_for_valid_readme.py index d555b4fa2f..ea37c99205 100644 --- a/scripts/check_for_valid_readme.py +++ b/scripts/check_for_valid_readme.py @@ -8,7 +8,7 @@ def is_valid_rst(path): """Checks if RST can be rendered on PyPI.""" - with open(path) as readme_file: + with open(path, encoding="utf-8") as readme_file: markup = readme_file.read() return readme_renderer.rst.render(markup, stream=sys.stderr) is not None diff --git a/scripts/eachdist.py b/scripts/eachdist.py index eed31eb62d..22300e1b75 100755 --- a/scripts/eachdist.py +++ b/scripts/eachdist.py @@ -546,13 +546,13 @@ def lint_args(args): def update_changelog(path, version, new_entry): unreleased_changes = False try: - with open(path) as changelog: + with open(path, encoding="utf-8") as changelog: text = changelog.read() if "## [{}]".format(version) in text: raise AttributeError( "{} already contans version {}".format(path, version) ) - with open(path) as changelog: + with open(path, encoding="utf-8") as changelog: for line in changelog: if line.startswith("## [Unreleased]"): unreleased_changes = False @@ -568,7 +568,7 @@ def update_changelog(path, version, new_entry): if unreleased_changes: print("updating: {}".format(path)) text = re.sub(r"## \[Unreleased\].*", new_entry, text) - with open(path, "w") as changelog: + with open(path, "w", encoding="utf-8") as changelog: changelog.write(text) @@ -651,14 +651,14 @@ def update_files(targets, filename, search, replace): print("file missing: {}/{}".format(target, filename)) continue - with open(curr_file) as _file: + with open(curr_file, encoding="utf-8") as _file: text = _file.read() if replace in text: print("{} already contains {}".format(curr_file, replace)) continue - with open(curr_file, "w") as _file: + with open(curr_file, "w", encoding="utf-8") as _file: _file.write(re.sub(search, replace, text)) if errors: diff --git a/scripts/generate_instrumentation_bootstrap.py b/scripts/generate_instrumentation_bootstrap.py index 31dc0331b9..a1c2d69adc 100755 --- a/scripts/generate_instrumentation_bootstrap.py +++ b/scripts/generate_instrumentation_bootstrap.py @@ -85,12 +85,12 @@ def main(): source = astor.to_source(tree) with open( - os.path.join(scripts_path, "license_header.txt"), "r" + os.path.join(scripts_path, "license_header.txt"), "r", encoding="utf-8" ) as header_file: header = header_file.read() source = _template.format(header=header, source=source) - with open(gen_path, "w") as gen_file: + with open(gen_path, "w", encoding="utf-8") as gen_file: gen_file.write(source) subprocess.run( diff --git a/scripts/generate_setup.py b/scripts/generate_setup.py index 8d281bef37..af134f7a20 100755 --- a/scripts/generate_setup.py +++ b/scripts/generate_setup.py @@ -36,7 +36,9 @@ def main(): root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) with open( - os.path.join(root_path, _template_dir, _template_name), "r" + os.path.join(root_path, _template_dir, _template_name), + "r", + encoding="utf-8", ) as template: setuppy_tmpl = Template(template.read()) base_instrumentation_path = os.path.join(root_path, "instrumentation") @@ -69,7 +71,7 @@ def main(): generated_file = os.path.join(instrumentation_path, "setup.py") logger.info("generated %s", generated_file) - with open(generated_file, "w") as fh: + with open(generated_file, "w", encoding="utf-8") as fh: fh.write(generated) fh.flush() diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/setup.py b/sdk-extension/opentelemetry-sdk-extension-aws/setup.py index a5b0803743..edcbc99518 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/setup.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/setup.py @@ -20,7 +20,7 @@ BASE_DIR, "src", "opentelemetry", "sdk", "extension", "aws", "version.py" ) PACKAGE_INFO = {} -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) setuptools.setup(version=PACKAGE_INFO["__version__"]) diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/beanstalk.py b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/beanstalk.py index 8252ec0f17..7d6fcd96ce 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/beanstalk.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/resource/beanstalk.py @@ -42,7 +42,7 @@ def detect(self) -> "Resource": conf_file_path = "/var/elasticbeanstalk/xray/environment.conf" try: - with open(conf_file_path) as conf_file: + with open(conf_file_path, encoding="utf-8") as conf_file: parsed_data = json.load(conf_file) return Resource( diff --git a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py index 58cce81ce6..b11137f85c 100644 --- a/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py +++ b/sdk-extension/opentelemetry-sdk-extension-aws/src/opentelemetry/sdk/extension/aws/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "1.0.1" +__version__ = "1.1.0dev0" diff --git a/templates/instrumentation_setup.py.txt b/templates/instrumentation_setup.py.txt index 69fa7a1e4a..f19238bef2 100644 --- a/templates/instrumentation_setup.py.txt +++ b/templates/instrumentation_setup.py.txt @@ -40,13 +40,13 @@ PACKAGE_INFO = {} VERSION_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "{{ name }}", "version.py" ) -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) PACKAGE_FILENAME = os.path.join( BASE_DIR, "src", "opentelemetry", "instrumentation", "{{ name }}", "package.py" ) -with open(PACKAGE_FILENAME) as f: +with open(PACKAGE_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) # Mark any instruments/runtime dependencies as test dependencies as well. diff --git a/util/opentelemetry-util-http/setup.py b/util/opentelemetry-util-http/setup.py index 1202dd07e3..f0501f216a 100644 --- a/util/opentelemetry-util-http/setup.py +++ b/util/opentelemetry-util-http/setup.py @@ -20,7 +20,7 @@ BASE_DIR, "src", "opentelemetry", "util", "http", "version.py" ) PACKAGE_INFO = {} -with open(VERSION_FILENAME) as f: +with open(VERSION_FILENAME, encoding="utf-8") as f: exec(f.read(), PACKAGE_INFO) setuptools.setup(version=PACKAGE_INFO["__version__"])