Deprecated: use :meth:`setExtension`.

        Args:
            ext (str):
170180
def setExtention(self, ext):
        
        import warnings
        msg = "the setExtention method is deprecated, please use setExtension"
        warnings.warn(msg)
        self.setExtension(ext)
65562
def load_extensions_from_config(**config):
    
    extensions = []
    if 'EXTENSIONS' in config:
        for ext in config['EXTENSIONS']:
            try:
                extensions.append(locate(ext))
            except Exception as e:
                print(e)
    return extensions
915397
def setExpanded(self, index, expanded):
        
        if index.isValid():
            item = self.getItem(index)
            item.expanded = expanded
1063997
def add_extension(self, extension):
        
        if extension:
            extension_to_add = os.path.abspath(os.path.expanduser(extension))
            if os.path.exists(extension_to_add):
                self._extension_files.append(extension_to_add)
            else:
                raise IOError("Path to the extension doesn't exist")
        else:
            raise ValueError("argument can not be null")
26923
def get_ext(self, obj=None):
        
        if obj is None:
            obj = self._obj
        return self._extel.get_ext(obj)
5637
private void parseExtension(Extension ext) throws IOException {
        try {
            Class<?> extClass = OIDMap.getClass(ext.getExtensionId());
            if (extClass == null) {   // Unsupported extension
                if (ext.isCritical()) {
                    unsupportedCritExt = true;
                }
                if (map.put(ext.getExtensionId().toString(), ext) == null) {
                    return;
                } else {
                    throw new IOException("Duplicate extensions not allowed");
                }
            }
            Constructor<?> cons = extClass.getConstructor(PARAMS);

            Object[] passed = new Object[] {Boolean.valueOf(ext.isCritical()),
                    ext.getExtensionValue()};
                    CertAttrSet<?> certExt = (CertAttrSet<?>)
                            cons.newInstance(passed);
                    if (map.put(certExt.getName(), (Extension)certExt) != null) {
                        throw new IOException("Duplicate extensions not allowed");
                    }
        } catch (InvocationTargetException invk) {
            Throwable e = invk.getTargetException();
            if (ext.isCritical() == false) {
                // ignore errors parsing non-critical extensions
                if (unparseableExtensions == null) {
                    unparseableExtensions = new TreeMap<String,Extension>();
                }
                unparseableExtensions.put(ext.getExtensionId().toString(),
                        new UnparseableExtension(ext, e));
                if (debug != null) {
                    debug.println("Error parsing extension: " + ext);
                    e.printStackTrace();
                    HexDumpEncoder h = new HexDumpEncoder();
                    System.err.println(h.encodeBuffer(ext.getExtensionValue()));
                }
                return;
            }
            if (e instanceof IOException) {
                throw (IOException)e;
            } else {
                throw new IOException(e);
            }
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw new IOException(e);
        }
    }
917274
def get_extensions(extstr):
    """"""
    # Extension examples:
    #   has_direct_input(UniProtKB:P37840),occurs_in(GO:0005576)
    #   part_of(UBERON:0006618),part_of(UBERON:0002302)
    #   occurs_in(CL:0000988)|occurs_in(CL:0001021)
    if not extstr:
        return None
    exts = []
    for ext_lst in extstr.split('|'):
        grp = []
        for ext in ext_lst.split(','):
            idx = ext.find('(')
            if idx != -1 and ext[-1] == ')':
                grp.append(AnnotationExtension(ext[:idx], ext[idx+1:-1]))
            else:
                # Ignore improperly formatted Extensions
                sys.stdout.write('BAD Extension({E})\n'.format(E=ext))
        exts.append(grp)
    return AnnotationExtensions(exts)
421464
def build_extension(self, ext):
        
        if sys.platform == "win32":
            _clr_compiler = "C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\csc.exe"
        else:
            _clr_compiler = "mcs"
        cmd = [ 
            _clr_compiler,
            "/target:library",
            "clrmagic.cs"
        ]
        check_call(" ".join(cmd), shell=True)
1129593
def di(self, func):
        
        func_name = func.__name__
        if func_name in self.exts:
            raise DuplicatedExtension
        self.exts[func_name] = func
        return func
59383
def file_extension(path):
    
    if path is None:
        return None
    ext = os.path.splitext(os.path.basename(path))[1]
    if ext.startswith("."):
        ext = ext[1:]
    return ext
1207170
def strip_py(arg):
    # type: (str) -> Optional[str]
    
    for ext in PY_EXTENSIONS:
        if arg.endswith(ext):
            return arg[:-len(ext)]
    return None
232019
def initialize_extensions(shell, extensions):
    
    try:
        iter(extensions)
    except TypeError:
        pass  # no extensions found
    else:
        for ext in extensions:
            try:
                shell.extension_manager.load_extension(ext)
            except:
                ipy_utils.warn.warn(
                    "Error in loading extension: %s" % ext +
                    "\nCheck your config files in %s" % ipy_utils.path.get_ipython_dir())
                shell.showtraceback()
742908
def check_extensions(extensions: Set[str], allow_multifile: bool = False):
    
    check_var(extensions, var_types=set, var_name='extensions')

    # -- check them one by one
    for ext in extensions:
        check_extension(ext, allow_multifile=allow_multifile)
608006
def ext(self):
        
        # raw_ext is either empty string or starts with period, e.g. '.xml'
        raw_ext = posixpath.splitext(self)[1]
        return raw_ext[1:] if raw_ext.startswith('.') else raw_ext
446508
def run_ext(args):
    """"""
    try:
        subprocess.check_call(args)
    except subprocess.CalledProcessError as exc:
        print(exc)
        print(exc.cmd)
        print(exc.returncode)
        print(exc.output)
        raise
1298747
public function withAdditionalExtensions(Extension ...$exts): self
    {
        $obj = clone $this;
        $obj->_extensions = $obj->_extensions->withExtensions(...$exts);
        return $obj;
    }
648706
def build_extension(extensions: Sequence[ExtensionHeader]) -> str:
    
    return ", ".join(
        build_extension_item(name, parameters) for name, parameters in extensions
    )