If wl_dir is given, there may be a file called "<lang>.txt". If this is
        the case, this should be the wordlist we are looking for.
186917
def get_wordlist(lang, wl_dir, po_path):
        #print("Looking for Wordlist in:\nlang {}\nwl_dir {}\npo_path {}".format(lang, wl_dir, po_path))
        po_path = os.path.abspath(po_path)

        
        if wl_dir is not None:
            wl_path = os.path.join(wl_dir, lang + '.txt')
            if os.path.isfile(wl_path):
                return wl_path

        """
        If wl_dir is not given, the wordlist should live in a file named
        "wordlist.txt" either in the locales_dir for the default language or in
        the same directory as the .po-files
        """
        if po_path.endswith("po"):
            # translated language
            po_dir = os.path.dirname(po_path)
            for f in os.scandir(po_dir):
                if f.name == "wordlist.txt":
                    #print("found wordlist in", f.path)
                    return f.path
            #print("Checked po-dir, None Found")

            """
            If no file was found so far, the po-files seem to lie in
            <lang>/LC_MESSAGES, and the wordlist should be in the directory
            above.
            """
            if os.path.basename(po_dir) == "LC_MESSAGES":
                for f in os.scandir(os.path.join(po_dir, "..")):
                    if f.name == "wordlist.txt":
                        #print("found wordlist in", f.path)
                        return f.path
            #print("Checked LC_MESSAGES-dir. none found")
        #print("Checked lang-specific files")

        if os.path.isdir(po_path):
            # default language
            for f in os.scandir(po_path):
                if f.name == "wordlist.txt":
                    #print("found wordlist in", f.path)
                    return f.path
        #print("If this shows up, no wordlist was found")
        return None
1299267
def main(*args):
    """"""
    options, args, parser = parse_options(args)

    if options.regex and options.write_changes:
        print('ERROR: --write-changes cannot be used together with '
              '--regex')
        parser.print_help()
        return 1
    word_regex = options.regex or word_regex_def
    try:
        word_regex = re.compile(word_regex)
    except re.error as err:
        print('ERROR: invalid regular expression "%s" (%s)' %
              (word_regex, err), file=sys.stderr)
        parser.print_help()
        return 1

    ignore_words_files = options.ignore_words or []
    ignore_words = set()
    for ignore_words_file in ignore_words_files:
        if not os.path.exists(ignore_words_file):
            print('ERROR: cannot find ignore-words file: %s' %
                  ignore_words_file, file=sys.stderr)
            parser.print_help()
            return 1
        build_ignore_words(ignore_words_file, ignore_words)

    ignore_words_list = options.ignore_words_list or []
    for comma_separated_words in ignore_words_list:
        for word in comma_separated_words.split(','):
            ignore_words.add(word.strip())

    dictionaries = options.dictionary or [default_dictionary]
    misspellings = dict()
    for dictionary in dictionaries:
        if dictionary == "-":
            dictionary = default_dictionary
        if not os.path.exists(dictionary):
            print('ERROR: cannot find dictionary file: %s' % dictionary,
                  file=sys.stderr)
            parser.print_help()
            return 1
        build_dict(dictionary, misspellings, ignore_words)
    colors = TermColors()
    if not options.colors or sys.platform == 'win32':
        colors.disable()

    if options.summary:
        summary = Summary()
    else:
        summary = None

    context = None
    if options.context is not None:
        if (options.before_context is not None) or \
                (options.after_context is not None):
            print('ERROR: --context/-C cannot be used together with '
                  '--context-before/-B or --context-after/-A')
            parser.print_help()
            return 1
        context_both = max(0, options.context)
        context = (context_both, context_both)
    elif (options.before_context is not None) or \
            (options.after_context is not None):
        context_before = 0
        context_after = 0
        if options.before_context is not None:
            context_before = max(0, options.before_context)
        if options.after_context is not None:
            context_after = max(0, options.after_context)
        context = (context_before, context_after)

    exclude_lines = set()
    if options.exclude_file:
        build_exclude_hashes(options.exclude_file, exclude_lines)

    file_opener = FileOpener(options.hard_encoding_detection,
                             options.quiet_level)
    glob_match = GlobMatch(options.skip)

    bad_count = 0
    for filename in args:
        # ignore hidden files
        if is_hidden(filename, options.check_hidden):
            continue

        if os.path.isdir(filename):
            for root, dirs, files in os.walk(filename):
                if glob_match.match(root):  # skip (absolute) directories
                    del dirs[:]
                    continue
                for file_ in files:
                    if glob_match.match(file_):  # skip files
                        continue
                    fname = os.path.join(root, file_)
                    if glob_match.match(fname):  # skip paths
                        continue
                    if not os.path.isfile(fname) or not os.path.getsize(fname):
                        continue
                    bad_count += parse_file(
                        fname, colors, summary, misspellings, exclude_lines,
                        file_opener, word_regex, context, options)

                # skip (relative) directories
                dirs[:] = [dir_ for dir_ in dirs if not glob_match.match(dir_)]

        else:
            bad_count += parse_file(
                filename, colors, summary, misspellings, exclude_lines,
                file_opener, word_regex, context, options)

    if summary:
        print("\n-------8<-------\nSUMMARY:")
        print(summary)
    return bad_count
367410
def build_data_list(lst):
    
    txt = '<H3>' + List + '<H3><UL>'
    for i in lst:
        txt += '<LI>' + i + '</LI>'
        
    txt += '<UL>'
    return txt
125923
def _cldf2wordlist(dataset, row='parameter_id', col='language_id'):
    """"""
    return lingpy.Wordlist(_cldf2wld(dataset), row=row, col=col)
1106000
def list_message_files (package, suffix=".mo"):
    """"""
    for fname in glob.glob("po/*" + suffix):
        # basename (without extension) is a locale name
        localename = os.path.splitext(os.path.basename(fname))[0]
        domainname = "%s.mo" % package.lower()
        yield (fname, os.path.join(
            "share", "locale", localename, "LC_MESSAGES", domainname))
407001
function readCodeFromFile()
  {
    $fp = @fopen($this->wordlist_file, 'rb');
    if (!$fp) return false;

    $fsize = filesize($this->wordlist_file);
    if ($fsize < 32) return false; // too small of a list to be effective

    if ($fsize < 128) {
      $max = $fsize; // still pretty small but changes the range of seeking
    } else {
      $max = 128;
    }

    fseek($fp, rand(0, $fsize - $max), SEEK_SET);
    $data = fread($fp, 128); // read a random 128 bytes from file
    fclose($fp);
    $data = preg_replace("/\r?\n/", "\n", $data);

    $start = strpos($data, "\n", rand(0, 100)) + 1; // random start position
    $end   = strpos($data, "\n", $start);           // find end of word

    return strtolower(substr($data, $start, $end - $start)); // return substring in 128 bytes
  }
378136
def load_common(self, wlist):
        """"""
        self.com_dict = os.path.join(self.base_dir, 'dicts', 'EN_vocab.txt')
        with open(self.com_dict) as words_file:
            data = words_file.read()
        self.common_words = set(data.splitlines())
        if wlist:
            new_words = ''
            for wl in wlist:
                with open(wl) as f:
                    new_words += f.read()
            if new_words:
                new_dict = set(data.splitlines())
                self.common_words.update(new_dict)
29253
private static List<Path> file_listing_(Path dir) throws IOException {
        try (Stream<Path> files = Files.list(dir)) {
            return files.collect(Collectors.toList());
        }
    }
370887
def findOODWords(isleDict, wordList):
    '''
    
    '''
    oodList = []
    for word in wordList:
        try:
            isleDict.lookup(word)
        except WordNotInISLE:
            oodList.append(word)
                
    oodList = list(set(oodList))
    oodList.sort()
    
    return oodList
374351
def complete_filename(text):
    ''''''

    #ensure directories have trailing slashes:
    list = glob.glob(text+'*')
    for idx, val in enumerate(list):
        if os.path.isdir(val):
            list[idx] = (val + os.path.sep)

    return list
794259
def detect_lang(path):
	""""""
	blob = FileBlob(path, os.getcwd())
	if blob.is_text:
		print('Programming language of the file detected: {0}'.format(blob.language.name))
		return blob.language.name
	else:#images, binary and what-have-you won't be pasted
		print('File not a text file. Exiting...')
		sys.exit()
1134388
def _findSwiplDar():
    

    # If the exec is in path
    (path, swiHome) = _findSwiplFromExec()
    if path is not None:
        return (path, swiHome)

    # If it is not, use  find_library
    path = _findSwiplPathFromFindLib()
    if path is not None:
        return (path, swiHome)

    # Last guess, searching for the file
    paths = ['.', './lib', '/usr/lib/', '/usr/local/lib', '/opt/local/lib']
    names = ['libswipl.dylib', 'libpl.dylib']

    for name in names:
        for path in paths:
            path = os.path.join(path, name)
            if os.path.exists(path):
                return (path, None)

    return (None, None)
1127455
function list(context, err, items, paths) {
    if (err) return fail(context, err);
    
    var long = context.options["l"];
    
    if (typeof long === "undefined") long = (context.command.slice(-3) === "dir");
    
    items.forEach(function (item) {
        if (item.filename == "." || item.filename == "..") return;
        
        if (paths) {
            shell.write(item.path);
        } else if (long) {
            shell.write(item.longname);
        } else {
            shell.write(item.filename);
        }
    });
    
    context.end();
}
118885
def listing(self):
        ""
        return ['.'.join([f,ext]) if ext else f for (f,ext) in self._files.keys()]
1098216
def respond_list_directory(self, dir_path, query=None):
		
		del query
		try:
			dir_contents = os.listdir(dir_path)
		except os.error:
			self.respond_not_found()
			return
		if os.path.normpath(dir_path) != self.__config['serve_files_root']:
			dir_contents.append('..')
		dir_contents.sort(key=lambda a: a.lower())
		displaypath = html.escape(urllib.parse.unquote(self.path), quote=True)

		f = io.BytesIO()
		encoding = sys.getfilesystemencoding()
		f.write(b'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n')
		f.write(b'<html>\n<title>Directory listing for ' + displaypath.encode(encoding) + b'</title>\n')
		f.write(b'<body>\n<h2>Directory listing for ' + displaypath.encode(encoding) + b'</h2>\n')
		f.write(b'<hr>\n<ul>\n')
		for name in dir_contents:
			fullname = os.path.join(dir_path, name)
			displayname = linkname = name
			# Append / for directories or @ for symbolic links
			if os.path.isdir(fullname):
				displayname = name + "/"
				linkname = name + "/"
			if os.path.islink(fullname):
				displayname = name + "@"
				# Note: a link to a directory displays with @ and links with /
			f.write(('<li><a href="' + urllib.parse.quote(linkname) + '">' + html.escape(displayname, quote=True) + '</a>\n').encode(encoding))
		f.write(b'</ul>\n<hr>\n</body>\n</html>\n')
		length = f.tell()
		f.seek(0)

		self.send_response(200)
		self.send_header('Content-Type', 'text/html; charset=' + encoding)
		self.send_header('Content-Length', length)
		self.end_headers()
		shutil.copyfileobj(f, self.wfile)
		f.close()
		return
1110672
def text(files):
    ''''''
    sentences = convert_timestamps(files)
    out = []
    for s in sentences:
        out.append(' '.join([w[0] for w in s['words']]))
    return '\n'.join(out)
613097
def all_languages
      Dir.entries(metadata_path)
         .select { |f| File.directory?(File.join(metadata_path, f)) }
         .reject { |f| f.start_with?('.') }
         .sort { |x, y| x <=> y }
    end