Parse a title from a file name
969609
def _parse_title(file_path):
    
    title = file_path
    title = title.split('/')[-1]
    title = '.'.join(title.split('.')[:-1])
    title = ' '.join(title.split('-'))
    title = ' '.join([
        word.capitalize()
        for word in title.split(' ')
    ])
    return title
769661
def _get_title(self):
        """"""
        #TODO: unicode support
        strbuffer = self.ctypes.create_string_buffer(1024)
        size = self.ctypes.c_short(1024)
        #unicode versions are (Get|Set)ConsolTitleW
        self.ctypes.windll.kernel32.GetConsoleTitleA(strbuffer, size)
        return strbuffer.value
1343886
def _find_title(html_file):
    """"""
    # TODO Is it necessary to read files like this?
    with html_file.open() as f:
        for line in f:
            if '<title>' in line:
                # + 7 to skip len('<title>')
                return line[line.index('<title>') + 7:line.index('</title>')]

    return '(Unknown)'
871938
def parseFile( self, file_or_filename, parseAll=False ):
        
        try:
            file_contents = file_or_filename.read()
        except AttributeError:
            with open(file_or_filename, "r") as f:
                file_contents = f.read()
        try:
            return self.parseString(file_contents, parseAll)
        except ParseBaseException as exc:
            if ParserElement.verbose_stacktrace:
                raise
            else:
                # catch and re-raise exception from here, clears out pyparsing internal stack trace
                raise exc
662435
function dumpFiles(title, fn) {
            var matches = fn();
            if (matches.length) {
                log.info("");
                log.info((title + ":")['green']);
                for (var i = 0; i < matches.length; i++) {
                    if (matches[i].src === matches[i].dst) {
                        log.info(matches[i].dst);
                    } else {
                        log.info(matches[i].dst + ' (from ' + matches[i].src + ')');
                    }
                }
            }
        }
507308
def parse(self, file_name):
        
        root = ET.parse(file_name).getroot()
        return self._parse(root)
958041
function getTitle(content, tag) {
  if (!content) {
    return;
  }
  var ts = content.indexOf(tag);
  if (ts < 0) {
    return;
  }
  var te = content.indexOf('>', ts);
  var cs = content.indexOf('<', te + 1);
  var title = content.substring(te + 1, cs);
  return title.trim();
}
188444
def do_title(s):
    
    return ''.join(
        [item[0].upper() + item[1:].lower()
         for item in _word_beginning_split_re.split(soft_unicode(s))
         if item])
915876
function parseFile(dir, filename) {
  const filePath = path.join(dir, filename);
  const fileStat = fs.statSync(filePath);
  const fileExt = path.extname(filename);

  return {
    path: filePath,
    stat: fileStat,
    ext: fileExt
  };
}
64918
def parseFile(self, filename):
        """"""
        modname = self.filenameToModname(filename)
        module = Module(modname, filename)
        self.modules[modname] = module
        if self.trackUnusedNames:
            module.imported_names, module.unused_names = \
                find_imports_and_track_names(filename,
                                             self.warn_about_duplicates,
                                             self.verbose)
        else:
            module.imported_names = find_imports(filename)
            module.unused_names = None
        dir = os.path.dirname(filename)
        module.imports = set(
            [self.findModuleOfName(imp.name, imp.level, filename, dir)
             for imp in module.imported_names])
1115827
def parse(self,fileName,offset):
        '''
        '''
        p = Parser()
        p.file = open(fileName, 'rb')
        a = p.parse_synset(offset=offset)
        p.file.close()
        self.__dict__.update(a.__dict__)
637743
def _parse(self, source, name, filename):
        """"""
        return Parser(self, source, name, _encode_filename(filename)).parse()
752877
async function getSubtitles (file) {
  const filename = path.parse(file).name
  return getSubtitlesByFilename(filename)
}
10761
def parse(cls, filename, root=None):
    
    if root is not None:
      if os.path.isabs(filename):
        raise ValueError("filename must be a relative path if root is specified")
      full_filename = os.path.join(root, filename)
    else:
      full_filename = filename

    with io.open(full_filename, 'rb') as fp:
      blob = fp.read()

    tree = cls._parse(blob, filename)
    return cls(blob=blob, tree=tree, root=root, filename=filename)
1242512
def get_titles():
    ''''''
    if os.name == 'posix':
        for proc in get_processes():
            cmd = ['xdotool','search','--name', proc]
            proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
            window_ids = proc.communicate()[0].decode('utf-8')
            if window_ids:
                for window_id in window_ids.split('\n'):
                    cmd = ['xdotool','getwindowname',window_id]
                    proc = subprocess.Popen(cmd,
                                        stdout=subprocess.PIPE,
                                        stderr=subprocess.PIPE)
                    title = proc.communicate()[0].decode('utf-8')
                    try:
                        if title[-1] == '\n':
                            title = title[:-1]
                        yield title
                    except IndexError:
                        pass
    else:
        raise NotImplementedError
1217498
def parse_file(self, filename):
        

        with open(filename, "rb", _BUFFERING) as stream:
            self.parse(stream.read())
1308488
def read(filename):
    """"""
    path = join(here, filename)
    with open(path, "r") as fin:
        return fin.read().strip()