Return an XMLSchema instance loaded from the given file.
           filename -- name of file to open
428170
def loadFromFile(self, filename):
        
        if self.__base_url:
            filename = basejoin(self.__base_url,filename)
        file = open(filename, 'rb')
        try:
            schema = self.loadFromStream(file, filename)
        finally:
            file.close()

        return schema
916688
def from_file(filename, serverEndpoint=ServerEndpoint):
    '''
    
    '''
    tarOutput = parse1('unpack', filename, serverEndpoint,
                       responseMimeType='application/x-tar',
                       services={'meta': '/meta', 'text': '/tika',
                                 'all': '/rmeta/xml', 'unpack': '/unpack/all'},
                       rawResponse=True)
    return _parse(tarOutput)
592417
def from_file(cls, xml_path):
    """"""
    try:
      parsed_xml = cls._parse(xml_path)
    except OSError as e:
      raise XmlParser.XmlError("Problem reading xml file at {}: {}".format(xml_path, e))
    return cls(xml_path, parsed_xml)
1271368
def from_file(cls, filename):
        
        with open(filename) as f:
            string = f.read()
        return cls.from_string(string)
538389
def open(filename):
        """"""
        if isinstance(filename, six.string_types):
            try:
                fdesc = gzip.open(filename, "rb")
                magic = fdesc.read(4)
            except IOError:
                fdesc = open(filename, "rb")
                magic = fdesc.read(4)
        else:
            fdesc = filename
            filename = getattr(fdesc, "name", "No name")
            magic = fdesc.read(4)
        return filename, fdesc, magic
587967
def _getSyntaxByXmlFileName(self, xmlFileName):
        
        import qutepart.syntax.loader  # delayed import for avoid cross-imports problem

        with self._loadedSyntaxesLock:
            if not xmlFileName in self._loadedSyntaxes:
                xmlFilePath = os.path.join(os.path.dirname(__file__), "data", "xml", xmlFileName)
                syntax = Syntax(self)
                self._loadedSyntaxes[xmlFileName] = syntax
                qutepart.syntax.loader.loadSyntax(syntax, xmlFilePath)

            return self._loadedSyntaxes[xmlFileName]
437550
def _load_schema(self, location, xml=None):
        
        cachedir = self._cachedir
        # wsdl2py: deal with XML Schema
        if not os.path.isdir(cachedir): os.mkdir(cachedir)
    
        file = os.path.join(cachedir, '.cache')
        section = 'TYPES'
        cp = ConfigParser()
        try:
            cp.readfp(open(file, 'r'))
        except IOError:
            del cp;  cp = None
            
        option = location.replace(':', '-') # colons seem to screw up option
        if (cp is not None and cp.has_section(section) and 
            cp.has_option(section, option)):
            types = cp.get(section, option)
        else:
            # dont do anything to anames
            if not self._pyclass:
                containers.ContainerBase.func_aname = lambda instnc,n: str(n)
                
            from pyremotevbox.ZSI.wstools import XMLSchema
            reader = XMLSchema.SchemaReader(base_url=location)
            if xml is not None and isinstance(xml, basestring):
                schema = reader.loadFromString(xml)
            elif xml is not None:
                raise RuntimeError, 'Unsupported: XML must be string'
            elif not os.path.isfile(location):
                schema = reader.loadFromURL(location)
            else:
                schema = reader.reader.loadFromFile(location)
                
            # TODO: change this to keyword list
            class options:
                output_dir = cachedir
                schema = True
                simple_naming = False
                address = False
                lazy = self._lazy
                complexType = self._pyclass

            schema.location = location
            files = commands._wsdl2py(options, schema)
            if cp is None: cp = ConfigParser()
            if not cp.has_section(section): cp.add_section(section)
            types = filter(lambda f: f.endswith('_types.py'), files)[0]
            cp.set(section, option, types)
            cp.write(open(file, 'w'))
            
        if os.path.abspath(cachedir) not in sys.path:
            sys.path.append(os.path.abspath(cachedir))
            
        mod = os.path.split(types)[-1].rstrip('.py')
        return __import__(mod)
814377
def load_xslt(filename=None, xsl=None):
    '''
    '''
    parser = _get_xmlparser()
    if filename is not None:
        xslt_doc = etree.parse(filename, parser=parser)
    if xsl is not None:
        xslt_doc = etree.fromstring(xsl, parser=parser)

    return etree.XSLT(xslt_doc)
859944
def load(self, filename):
        """"""
        f = io.open(filename,'r',encoding='utf-8')
        for line in f:
            data = line.strip().split("\t")
            type, count = data[:2]
            self.count(type,count)
        f.close()
191680
def loadFromFile(fileName):
        
        assert os.path.exists(fileName), "File " + fileName + " does not exist"
        conf = json.load(open(fileName))
        return ReturnInfo(
            articleInfo=ArticleInfoFlags(**conf.get("articleInfo", {})),
            eventInfo=EventInfoFlags(**conf.get("eventInfo", {})),
            sourceInfo=SourceInfoFlags(**conf.get("sourceInfo", {})),
            categoryInfo=CategoryInfoFlags(**conf.get("categoryInfo", {})),
            conceptInfo=ConceptInfoFlags(**conf.get("conceptInfo", {})),
            locationInfo=LocationInfoFlags(**conf.get("locationInfo", {})),
            storyInfo=StoryInfoFlags(**conf.get("storyInfo", {})),
            conceptClassInfo=ConceptClassInfoFlags(**conf.get("conceptClassInfo", {})),
            conceptFolderInfo=ConceptFolderInfoFlags(**conf.get("conceptFolderInfo", {}))
        )
166763
def from_schemafile(cls, schemafile):
        
        with open(schemafile) as f:
            return cls(json.load(f))
455659
def from_filename(self, filename):
        '''
        
        '''
        if os.path.exists(filename):
            with open(filename) as fp:
                return IntentSchema(json.load(fp, object_pairs_hook=OrderedDict))
        else:
            print ('File does not exist')
            return IntentSchema()
841562
def load(cls, filename, name=None):
        
        if not os.path.exists(filename):
            return {}
        name = name or filename

        if name not in cls._conffiles:
            with open(filename) as fdesc:
                content = yaml.load(fdesc, YAMLLoader)
                # in case the file is empty
                if content is None:
                    content = {}
                cls._conffiles[name] = content

        return cls._conffiles[name]
1211599
def readerForFile(filename, encoding, options):
    
    ret = libxml2mod.xmlReaderForFile(filename, encoding, options)
    if ret is None:raise treeError('xmlReaderForFile() failed')
    return xmlTextReader(_obj=ret)
516090
def read_xml(filename):
    
    parser = et.XMLParser(remove_blank_text=True)
    isfile=False
    try:
        isfile = os.path.exists(filename)
    except ValueError as e:
        if 'path too long for Windows' in str(e):
            pass
        else:
            raise
    try:
        if isfile:
            return et.parse(filename, parser)
        else:
            r = et.fromstring(filename, parser)
            return r.getroottree()
    except IOError:
        log.exception('unable to open file [[}]'.format(filename))
    except et.XMLSyntaxError:
        log.exception('unable to parse XML [{}]'.format(filename))
        return None
    return None
1091614
def load(filename)
      ns = Clojure::Namespace.new(self)
      source = open(filename).read
      ast = Clojure::Reader.new(source).ast
      ast.each { |form| ns.evaluate form }
      ns_name = ns["*ns*"]
      @namespaces[ns_name.to_sym] = namespace(ns_name).merge(ns)
    end
106145
def _readfile(self, filename):
        
        f = open(filename)
        self.content = f.readlines()
        f.close()