Python lib2to3.fixer_util.String() Examples

The following are 30 code examples of lib2to3.fixer_util.String(). 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: fix_callable.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def transform(self, node, results):
        func = results['func']

        touch_import(None, u'collections', node=node)

        args = [func.clone(), String(u', ')]
        args.extend(Attr(Name(u'collections'), Name(u'Callable')))
        return Call(Name(u'isinstance'), args, prefix=node.prefix) 
Example #2
Source File: fix_operator.py    From Carnets with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(", " + ".".join([module, abc]))]
        return Call(Name("isinstance"), args, prefix=node.prefix) 
Example #3
Source File: fix_operator.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #4
Source File: fix_callable.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def transform(self, node, results):
        func = results['func']

        touch_import(None, u'collections', node=node)

        args = [func.clone(), String(u', ')]
        args.extend(Attr(Name(u'collections'), Name(u'Callable')))
        return Call(Name(u'isinstance'), args, prefix=node.prefix) 
Example #5
Source File: fix_operator.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #6
Source File: fix_operator.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(u", " + u".".join([module, abc]))]
        return Call(Name(u"isinstance"), args, prefix=node.prefix) 
Example #7
Source File: fix_callable.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def transform(self, node, results):
        func = results['func']

        touch_import(None, u'collections', node=node)

        args = [func.clone(), String(u', ')]
        args.extend(Attr(Name(u'collections'), Name(u'Callable')))
        return Call(Name(u'isinstance'), args, prefix=node.prefix) 
Example #8
Source File: fix_operator.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #9
Source File: fix_operator.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(u", " + u".".join([module, abc]))]
        return Call(Name(u"isinstance"), args, prefix=node.prefix) 
Example #10
Source File: fix_callable.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def transform(self, node, results):
        func = results['func']

        touch_import(None, u'collections', node=node)

        args = [func.clone(), String(u', ')]
        args.extend(Attr(Name(u'collections'), Name(u'Callable')))
        return Call(Name(u'isinstance'), args, prefix=node.prefix) 
Example #11
Source File: fix_operator.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #12
Source File: fix_operator.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(u", " + u".".join([module, abc]))]
        return Call(Name(u"isinstance"), args, prefix=node.prefix) 
Example #13
Source File: fix_operator.py    From android_universal with MIT License 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(", " + ".".join([module, abc]))]
        return Call(Name("isinstance"), args, prefix=node.prefix) 
Example #14
Source File: fix_operator.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(u", " + u".".join([module, abc]))]
        return Call(Name(u"isinstance"), args, prefix=node.prefix) 
Example #15
Source File: fix_operator.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #16
Source File: fix_operator.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #17
Source File: fix_operator.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(u", " + u".".join([module, abc]))]
        return Call(Name(u"isinstance"), args, prefix=node.prefix) 
Example #18
Source File: fix_operator.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #19
Source File: fix_callable.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
def transform(self, node, results):
        func = results['func']

        touch_import(None, u'collections', node=node)

        args = [func.clone(), String(u', ')]
        args.extend(Attr(Name(u'collections'), Name(u'Callable')))
        return Call(Name(u'isinstance'), args, prefix=node.prefix) 
Example #20
Source File: fix_operator.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(u", " + u".".join([module, abc]))]
        return Call(Name(u"isinstance"), args, prefix=node.prefix) 
Example #21
Source File: fix_operator.py    From filmkodi with Apache License 2.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #22
Source File: fix_operator.py    From odoo13-x64 with GNU General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(", " + ".".join([module, abc]))]
        return Call(Name("isinstance"), args, prefix=node.prefix) 
Example #23
Source File: fix_operator.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(", " + ".".join([module, abc]))]
        return Call(Name("isinstance"), args, prefix=node.prefix) 
Example #24
Source File: fix_operator.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(", "), String("'__call__'")]
        return Call(Name("hasattr"), args, prefix=node.prefix) 
Example #25
Source File: fix_callable.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def transform(self, node, results):
        func = results['func']

        touch_import(None, u'collections', node=node)

        args = [func.clone(), String(u', ')]
        args.extend(Attr(Name(u'collections'), Name(u'Callable')))
        return Call(Name(u'isinstance'), args, prefix=node.prefix) 
Example #26
Source File: fix_operator.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(u", " + u".".join([module, abc]))]
        return Call(Name(u"isinstance"), args, prefix=node.prefix) 
Example #27
Source File: fix_operator.py    From Splunking-Crime with GNU Affero General Public License v3.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix) 
Example #28
Source File: fix_operator.py    From misp42splunk with GNU Lesser General Public License v3.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(", " + ".".join([module, abc]))]
        return Call(Name("isinstance"), args, prefix=node.prefix) 
Example #29
Source File: fix_operator.py    From datafari with Apache License 2.0 5 votes vote down vote up
def _handle_type2abc(self, node, results, module, abc):
        touch_import(None, module, node)
        obj = results["obj"]
        args = [obj.clone(), String(u", " + u".".join([module, abc]))]
        return Call(Name(u"isinstance"), args, prefix=node.prefix) 
Example #30
Source File: fix_operator.py    From datafari with Apache License 2.0 5 votes vote down vote up
def _isCallable(self, node, results):
        obj = results["obj"]
        args = [obj.clone(), String(u", "), String(u"'__call__'")]
        return Call(Name(u"hasattr"), args, prefix=node.prefix)