Python lib2to3.fixer_util.does_tree_import() Examples
The following are 30
code examples of lib2to3.fixer_util.does_tree_import().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
lib2to3.fixer_util
, or try the search function
.
Example #1
Source File: test_util.py From datafari with Apache License 2.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #2
Source File: test_util.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #3
Source File: test_util.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #4
Source File: test_util.py From android_universal with MIT License | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #5
Source File: test_util.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #6
Source File: test_util.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #7
Source File: test_util.py From odoo13-x64 with GNU General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #8
Source File: test_util.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #9
Source File: test_util.py From ironpython3 with Apache License 2.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #10
Source File: test_util.py From Imogen with MIT License | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #11
Source File: test_util.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #12
Source File: test_util.py From misp42splunk with GNU Lesser General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #13
Source File: test_util.py From oss-ftp with MIT License | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #14
Source File: test_util.py From misp42splunk with GNU Lesser General Public License v3.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #15
Source File: test_util.py From Computable with MIT License | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #16
Source File: test_util.py From ironpython2 with Apache License 2.0 | 6 votes |
def try_with(self, string): failing_tests = (("a", "a", "from a import b"), ("a.d", "a", "from a.d import b"), ("d.a", "a", "from d.a import b"), (None, "a", "import b"), (None, "a", "import b, c, d")) for package, name, import_ in failing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertFalse(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertFalse(n) passing_tests = (("a", "a", "from a import a"), ("x", "a", "from x import a"), ("x", "a", "from x import b, c, a, d"), ("x.b", "a", "from x.b import a"), ("x.b", "a", "from x.b import b, c, a, d"), (None, "a", "import a"), (None, "a", "import b, c, a, d")) for package, name, import_ in passing_tests: n = self.does_tree_import(package, name, import_ + "\n" + string) self.assertTrue(n) n = self.does_tree_import(package, name, string + "\n" + import_) self.assertTrue(n)
Example #17
Source File: test_util.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #18
Source File: test_util.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #19
Source File: test_util.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #20
Source File: test_util.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #21
Source File: test_util.py From android_universal with MIT License | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #22
Source File: fix_input.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
def transform(self, node, results): if does_tree_import('builtins', 'input', node): return return super(FixInput, self).transform(node, results)
Example #23
Source File: fix_input.py From Tautulli with GNU General Public License v3.0 | 5 votes |
def transform(self, node, results): if does_tree_import('builtins', 'input', node): return return super(FixInput, self).transform(node, results)
Example #24
Source File: test_util.py From ironpython2 with Apache License 2.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #25
Source File: test_util.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #26
Source File: test_util.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #27
Source File: test_util.py From Computable with MIT License | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #28
Source File: test_util.py From odoo13-x64 with GNU General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #29
Source File: test_util.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)
Example #30
Source File: test_util.py From misp42splunk with GNU Lesser General Public License v3.0 | 5 votes |
def does_tree_import(self, package, name, string): node = parse(string) # Find the binding of start -- that's what we'll go from node = self._find_bind_rec('start', node) return fixer_util.does_tree_import(package, name, node)