summaryrefslogtreecommitdiff
path: root/upstream-layers/meta-openembedded/meta-python/recipes-devtools/python/python3-jsonpath-rw/0001-drop-the-six-dependency.patch
blob: 735fe26140f3ef7f69b213474bc47a9d46156ac3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From a12efc7d5ede4fb2404ea1e4edeba03c9225ab4e Mon Sep 17 00:00:00 2001
From: Markus Volk <f_l_k@t-online.de>
Date: Mon, 21 Sep 2026 13:22:53 +0200
Subject: [PATCH] drop the six dependency

six is a Python 2 compatibility shim and jsonpath-rw does not need it on
Python 3: six.integer_types and six.string_types are int and str, and
six.moves.xrange is range.

Upstream-Status: Pending

AI-Generated: Uses Claude Code (Claude Opus 5)
---
 jsonpath_rw/jsonpath.py | 6 ++----
 setup.py                | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/jsonpath_rw/jsonpath.py b/jsonpath_rw/jsonpath.py
index 3c491d0..4703fae 100644
--- a/jsonpath_rw/jsonpath.py
+++ b/jsonpath_rw/jsonpath.py
@@ -1,7 +1,5 @@
 from __future__ import unicode_literals, print_function, absolute_import, division, generators, nested_scopes
 import logging
-import six
-from six.moves import xrange
 from itertools import *
 
 logger = logging.getLogger(__name__)
@@ -485,13 +483,13 @@ class Slice(JSONPath):
         
         # Here's the hack. If it is a dictionary or some kind of constant,
         # put it in a single-element list
-        if (isinstance(datum.value, dict) or isinstance(datum.value, six.integer_types) or isinstance(datum.value, six.string_types)):
+        if (isinstance(datum.value, dict) or isinstance(datum.value, int) or isinstance(datum.value, str)):
             return self.find(DatumInContext([datum.value], path=datum.path, context=datum.context))
 
         # Some iterators do not support slicing but we can still
         # at least work for '*'
         if self.start == None and self.end == None and self.step == None:
-            return [DatumInContext(datum.value[i], path=Index(i), context=datum) for i in xrange(0, len(datum.value))]
+            return [DatumInContext(datum.value[i], path=Index(i), context=datum) for i in range(0, len(datum.value))]
         else:
             return [DatumInContext(datum.value[i], path=Index(i), context=datum) for i in range(0, len(datum.value))[self.start:self.end:self.step]]
 
diff --git a/setup.py b/setup.py
index 8108124..4b2dfb9 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@ setuptools.setup(
         'console_scripts':  ['jsonpath.py = jsonpath_rw.bin.jsonpath:entry_point'],
     },
     test_suite = 'tests',
-    install_requires = [ 'ply', 'decorator', 'six' ],
+    install_requires = [ 'ply', 'decorator' ],
     classifiers = [
         'Development Status :: 5 - Production/Stable',
         'Intended Audience :: Developers',