Skip to content

Commit f4c94b3

Browse files
Remove unneded nonlocal and global declarations
1 parent a224f49 commit f4c94b3

File tree

6 files changed

+1
-10
lines changed

6 files changed

+1
-10
lines changed

elasticsearch/_async/client/_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ async def _perform_request(
272272
def mimetype_header_to_compat(header: str) -> None:
273273
# Converts all parts of a Accept/Content-Type headers
274274
# from application/X -> application/vnd.elasticsearch+X
275-
nonlocal request_headers
276275
mimetype = request_headers.get(header, None)
277276
if mimetype:
278277
request_headers[header] = _COMPAT_MIMETYPE_RE.sub(

elasticsearch/_async/helpers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ def aiter(x: Union[Iterable[T], AsyncIterable[T]]) -> AsyncIterator[T]:
136136
return x.__aiter__()
137137

138138
async def f() -> AsyncIterable[T]:
139-
nonlocal x
140139
ix: Iterable[T] = x
141140
for item in ix:
142141
yield item

elasticsearch/_sync/client/_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ def _perform_request(
272272
def mimetype_header_to_compat(header: str) -> None:
273273
# Converts all parts of a Accept/Content-Type headers
274274
# from application/X -> application/vnd.elasticsearch+X
275-
nonlocal request_headers
276275
mimetype = request_headers.get(header, None)
277276
if mimetype:
278277
request_headers[header] = _COMPAT_MIMETYPE_RE.sub(

elasticsearch/_sync/client/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ def client_node_configs(
124124

125125
def apply_node_options(node_config: NodeConfig) -> NodeConfig:
126126
"""Needs special handling of headers since .replace() wipes out existing headers"""
127-
nonlocal node_options
128127
headers = node_config.headers.copy() # type: ignore[attr-defined]
129128

130129
headers_to_add = node_options.pop("headers", ())
@@ -296,8 +295,6 @@ def _rewrite_parameters(
296295
def wrapper(api: F) -> F:
297296
@wraps(api)
298297
def wrapped(*args: Any, **kwargs: Any) -> Any:
299-
nonlocal api, body_name, body_fields
300-
301298
# Let's give a nicer error message when users pass positional arguments.
302299
if len(args) >= 2:
303300
raise TypeError(

test_elasticsearch/test_server/test_rest_api_spec.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,6 @@ def run_catch(self, catch, exception):
280280
self.last_response = exception.body
281281

282282
def run_skip(self, skip):
283-
global IMPLEMENTED_FEATURES
284-
285283
if "features" in skip:
286284
features = skip["features"]
287285
if not isinstance(features, (tuple, list)):
@@ -437,7 +435,7 @@ def _lookup(self, path):
437435
return value
438436

439437
def _feature_enabled(self, name):
440-
global XPACK_FEATURES, IMPLEMENTED_FEATURES
438+
global XPACK_FEATURES
441439
if XPACK_FEATURES is None:
442440
try:
443441
xinfo = self.client.xpack.info()

utils/build-dists.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def set_tmp_dir():
4242

4343

4444
def run(*argv, expect_exit_code=0):
45-
global tmp_dir
4645
try:
4746
prev_dir = os.getcwd()
4847
if tmp_dir is None:

0 commit comments

Comments
 (0)