Gets and parses file
161419
def __parse_inchi():
    ''''''
    filename = get_file('chebiId_inchi.tsv')

    with io.open(filename, 'r', encoding='cp1252') as textfile:
        next(textfile)

        for line in textfile:
            tokens = line.strip().split('\t')
            __INCHIS[int(tokens[0])] = tokens[1]
579202
def parse(string, is_file=False, obj=False):
        
        try:
            if obj is False:
                if is_file:
                    return system_json.load(string)
                return system_json.loads(string, encoding='utf8')
            else:
                if is_file:
                    return system_json.load(
                        string,
                        object_hook=lambda d: namedtuple('j', d.keys())
                        (*d.values()), ensure_ascii=False, encoding='utf8')
                return system_json.loads(
                    string,
                    object_hook=lambda d: namedtuple('j', d.keys())
                    (*d.values()), encoding='utf8')
        except (Exception, BaseException) as error:
            try:
                if current_app.config['DEBUG']:
                    raise error
            except RuntimeError as flask_error:
                raise error
            return None
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)
139337
def read(cls, file):
        """"""
        parser = WebVTTParser().read(file)
        return cls(file=file, captions=parser.captions, styles=parser.styles)
259381
def _parse(self):
        
        with open(self.path, "rt") as reader:
            return ast.parse(reader.read(), filename=self.path)
135318
def _get_file_content(self, path):
        """"""
        with open(path, 'r') as file_:
            content = file_.read()
        return content
766476
def reads(s, filename, loader, implicit_tuple, allow_errors):
  """"""
  try:
    the_context.filename = filename
    the_context.loader = loader

    grammar = make_grammar(allow_errors=allow_errors)
    root = grammar.start_tuple if implicit_tuple else grammar.start

    return root.parseWithTabs().parseString(s, parseAll=True)[0]
  except (p.ParseException, p.ParseSyntaxException) as e:
    loc = SourceLocation(s, find_offset(s, e.lineno, e.col))
    raise exceptions.ParseError(the_context.filename, loc, e.msg)
272388
def read_file(fpath):
    """"""
    with io.open(os.path.join(PATH_BASE, fpath)) as f:
        return f.read()
365524
def _parse(self, line):
        """"""
        try:
            result = line.split(':', maxsplit=4)
            filename, line_num_txt, column_txt, message_type, text = result
        except ValueError:
            return

        try:
            self.line_num = int(line_num_txt.strip())
            self.column = int(column_txt.strip())
        except ValueError:
            return

        self.filename = filename
        self.message_type = message_type.strip()
        self.text = text.strip()
        self.valid = True
2865
def parse(self):
        
        try:
            if not os.path.getsize(self.ns.pathname):
                # Ignore 0-byte dummy files (Firefox creates these while downloading)
                self.job.LOG.warn("Ignoring 0-byte metafile '%s'" % (self.ns.pathname,))
                return
            self.metadata = metafile.checked_open(self.ns.pathname)
        except EnvironmentError as exc:
            self.job.LOG.error("Can't read metafile '%s' (%s)" % (
                self.ns.pathname, str(exc).replace(": '%s'" % self.ns.pathname, ""),
            ))
            return
        except ValueError as exc:
            self.job.LOG.error("Invalid metafile '%s': %s" % (self.ns.pathname, exc))
            return

        self.ns.info_hash = metafile.info_hash(self.metadata)
        self.ns.info_name = self.metadata["info"]["name"]
        self.job.LOG.info("Loaded '%s' from metafile '%s'" % (self.ns.info_name, self.ns.pathname))

        # Check whether item is already loaded
        try:
            name = self.job.proxy.d.name(self.ns.info_hash, fail_silently=True)
        except xmlrpc.HashNotFound:
            pass
        except xmlrpc.ERRORS as exc:
            if exc.faultString != "Could not find info-hash.":
                self.job.LOG.error("While checking for #%s: %s" % (self.ns.info_hash, exc))
                return
        else:
            self.job.LOG.warn("Item #%s '%s' already added to client" % (self.ns.info_hash, name))
            return

        return True
709170
def parseFile(self, srcFile, closeFile=False):
        """"""

        try:
            result = self.parse(srcFile.read())
        finally:
            if closeFile:
                srcFile.close()
        return result
65254
void parse(File file) throws ParseException {
        if (file == null) {
            Log.warn("parsing NULL file, so fallback on default configuration!");
            return;
        }
        if (!file.exists()) {
            Log.warn(String.format("parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath()));
            return;
        }
        try {
            FileReader reader = new FileReader(file);
            parse(reader);
        } catch (FileNotFoundException fex) {
            Log.warn(String.format("parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath()), fex);
            return;
        }
    }
507308
def parse(self, file_name):
        
        root = ET.parse(file_name).getroot()
        return self._parse(root)
1287275
def read_file(filename):
    """"""
    with open(join(abspath(dirname(__file__)), filename)) as file:
        return file.read()
1138165
def parse_file(file_or_path, encoding='utf-8', validate=False):
    
    try:
        is_string = isinstance(file_or_path, basestring)
    except NameError:
        is_string = isinstance(file_or_path, str)
    if is_string:
        with codecs.open(file_or_path, 'r', encoding) as file_:
            result = pattern.parseFile(file_)[0]
    else:
        result = pattern.parseFile(file_or_path)[0]
    if validate:
        result.validate()
    return result
178258
function getFile(filepath) {
	var fileObj = {
			path: filepath,
			content: null
	};
    try {
        fs.accessSync(filepath, fs.F_OK);
    } catch(e) {
			console.log(e.message);
        return fileObj;
    }
		fileObj.content = fs.readFileSync(filepath, 'utf-8').trim();
		return fileObj;
}
623966
public function parseFile($file)
    {
        $str = @\file_get_contents($file);
        if (false === $str) {
            throw new Exception('Can\'t read file.');
        }

        return $this->parse($str);
    }