From: Gregory Chanan Date: Wed, 13 Mar 2019 20:28:08 +0000 (-0700) Subject: Remove unused BoolOption. X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~827 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42acae5406a024a7eca67bb119bab09222fd2fe6;p=platform%2Fupstream%2Fpytorch.git Remove unused BoolOption. Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17979 Reviewed By: zou3519 Differential Revision: D14438876 Pulled By: gchanan fbshipit-source-id: a6aeab0261ce6926ed82a81edee4564a8dd341ed --- diff --git a/tools/cwrap/plugins/BoolOption.py b/tools/cwrap/plugins/BoolOption.py deleted file mode 100644 index 7809796..0000000 --- a/tools/cwrap/plugins/BoolOption.py +++ /dev/null @@ -1,35 +0,0 @@ -from . import CWrapPlugin -from string import Template - -import sys -if sys.version_info[0] == 3: - string_type = str -else: - string_type = basestring - - -class BoolOption(CWrapPlugin): - - UNPACK_TEMPLATE = Template('$arg == Py_True ? $if_true : $if_false') - - def is_bool_option(self, arg): - return arg['type'] == 'bool' and 'if_true' in arg and 'if_false' in arg - - def process_declarations(self, declarations): - for declaration in declarations: - for option in declaration['options']: - for arg in option['arguments']: - if self.is_bool_option(arg): - arg['is_bool_option'] = True - if isinstance(arg['if_true'], string_type): - arg['type'] = 'const char*' - return declarations - - def get_type_check(self, arg, option): - if arg.get('is_bool_option', False): - return Template('PyBool_Check($arg)') - - def get_type_unpack(self, arg, option): - if arg.get('is_bool_option', False): - return Template(self.UNPACK_TEMPLATE.safe_substitute( - if_true=arg['if_true'], if_false=arg['if_false']))