Checking OS/2 fsSelection value.
488377
def com_google_fonts_check_fsselection(ttFont, style):
  """"""
  from fontbakery.utils import check_bit_entry
  from fontbakery.constants import (STATIC_STYLE_NAMES,
                                    RIBBI_STYLE_NAMES,
                                    FsSelection)

  # Checking fsSelection REGULAR bit:
  expected = "Regular" in style or \
             (style in STATIC_STYLE_NAMES and
              style not in RIBBI_STYLE_NAMES and
              "Italic" not in style)
  yield check_bit_entry(ttFont, "OS/2", "fsSelection",
                        expected,
                        bitmask=FsSelection.REGULAR,
                        bitname="REGULAR")

  # Checking fsSelection ITALIC bit:
  expected = "Italic" in style
  yield check_bit_entry(ttFont, "OS/2", "fsSelection",
                        expected,
                        bitmask=FsSelection.ITALIC,
                        bitname="ITALIC")

  # Checking fsSelection BOLD bit:
  expected = style in ["Bold", "BoldItalic"]
  yield check_bit_entry(ttFont, "OS/2", "fsSelection",
                        expected,
                        bitmask=FsSelection.BOLD,
                        bitname="BOLD")
761100
def check_output_command(file_path, head=None, tail=None):
    ''''''
    if os.path.exists(file_path):
        if sys.platform == 'win32':
            cmds = ['powershell.exe', 'type', file_path]
            if head:
                cmds += ['|', 'select', '-first', str(head)]
            elif tail:
                cmds += ['|', 'select', '-last', str(tail)]
            return check_output(cmds, shell=True).decode('utf-8')
        else:
            cmds = ['cat', file_path]
            if head:
                cmds = ['head', '-' + str(head), file_path]
            elif tail:
                cmds = ['tail', '-' + str(tail), file_path]
            return check_output(cmds, shell=False).decode('utf-8')
    else:
        print_error('{0} does not exist!'.format(file_path))
        exit(1)
1151385
def check_rst(code, ignore):
    """"""
    filename = '<string>'

    for result in check(code,
                        filename=filename,
                        ignore=ignore):
        yield result
377888
function isFileOrDir(filePath) {
	let fsStat;
	try {
		fsStat = fs.statSync(filePath);
	} catch (error) {
		return error;
	}

	let r = 'file';
	if (fsStat.isDirectory()) {
		r = 'directory';
	}

	return r;
}
1029186
def disk_check_size(ctx, param, value):
    
    if value:
        # if we've got a prefix
        if isinstance(value, tuple):
            val = value[1]
        else:
            val = value
        if val % 1024:
            raise click.ClickException('Size must be a multiple of 1024.')
    return value
878247
def _fssys(name, value=None, log_lvl=None, log_msg=None):
    '''
    
    '''
    fspath = _fspath()
    if not fspath:
        return False
    else:
        return _sysfs_attr([fspath, name], value, log_lvl, log_msg)
1326710
function parse_Window2(blob, length, opts) {
	if(opts && opts.biff >= 2 && opts.biff < 8) return {};
	var f = blob.read_shift(2);
	return { RTL: f & 0x40 };
}
926808
def check_version(ctx, param, value):
    """"""
    if ctx.resilient_parsing:
        return

    if not value and ctx.invoked_subcommand != 'run':
        ctx.call_on_close(_check_version)
526837
def count_open_fds():
    

    pid = os.getpid()
    procs = subprocess.check_output(
        ['lsof', '-w', '-Ff', '-p', str(pid)])

    nprocs = len(
        [s for s in procs.split('\n') if s and s[0] == 'f' and s[1:].isdigit()]
    )
    return nprocs
247119
def check(self):
    
    errors = []
    results = []
    for fn in self._files:
      if not os.path.isdir(fn):
        try:
          with open(fn, 'r') as f:
            line_ct = 1
            for line in f:
              for word in split_words(line):
                if (word in self._misspelling_dict or
                    word.lower() in self._misspelling_dict):
                  results.append([fn, line_ct, word])
              line_ct += 1
        except UnicodeDecodeError:
          pass
        except IOError:
          errors.append('%s' % sys.exc_info()[1])
    return errors, results
871272
def async_stmt_check(self, original, loc, tokens):
        """"""
        return self.check_py("35", "async for/with", original, loc, tokens)
1306415
def _run_check_onlyif(self, low_data, cmd_opts):
        '''
        
        '''
        ret = {'result': False}

        if not isinstance(low_data['onlyif'], list):
            low_data_onlyif = [low_data['onlyif']]
        else:
            low_data_onlyif = low_data['onlyif']

        def _check_cmd(cmd):
            if cmd != 0 and ret['result'] is False:
                ret.update({'comment': 'onlyif condition is false',
                            'skip_watch': True,
                            'result': True})
            elif cmd == 0:
                ret.update({'comment': 'onlyif condition is true', 'result': False})

        for entry in low_data_onlyif:
            if isinstance(entry, six.string_types):
                cmd = self.functions['cmd.retcode'](
                    entry, ignore_retcode=True, python_shell=True, **cmd_opts)
                log.debug('Last command return code: %s', cmd)
                _check_cmd(cmd)
            elif isinstance(entry, dict):
                if 'fun' not in entry:
                    ret['comment'] = 'no `fun` argument in onlyif: {0}'.format(entry)
                    log.warning(ret['comment'])
                    return ret
                result = self.functions[entry.pop('fun')](**entry)
                if self.state_con.get('retcode', 0):
                    _check_cmd(self.state_con['retcode'])
                elif not result:
                    ret.update({'comment': 'onlyif condition is false',
                                'skip_watch': True,
                                'result': True})
                else:
                    ret.update({'comment': 'onlyif condition is true',
                                'result': False})

            else:
                ret.update({'comment': 'onlyif execution failed, bad type passed', 'result': False})
        return ret
1355508
def _check_command_result(self):
        """"""
        if self.commandResult.startswith('/bin/bash'):
            raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
        if self.commandResult.startswith('/bin/mv'):
            raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
        if self.commandResult.startswith('/bin/ls'):
            raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
        if self.commandResult.startswith('/bin/rm'):
            raise UtilError('%s' % self.commandResult.split(' ', 1)[1])
        if 'invalid option' in self.commandResult:
            raise UtilError('%s' % self.commandResult)
        if 'Invalid option' in self.commandResult:
            raise UtilError('%s' % self.commandResult)
        if 'usage: /usr/bin/get_dossier' in self.commandResult:
            raise UtilError('%s' % self.commandResult)
1344144
def _check_status(self, ibsta):
        """"""
        if ibsta & 0x4000:
            raise LinuxGpib.Timeout()
        elif ibsta & 0x8000:
            raise LinuxGpib.Error(self.error_status)
920124
def is_file_ignored(opts, fname):
    '''
    
    '''
    if opts['file_ignore_regex']:
        for regex in opts['file_ignore_regex']:
            if re.search(regex, fname):
                log.debug(
                    'File matching file_ignore_regex. Skipping: %s',
                    fname
                )
                return True

    if opts['file_ignore_glob']:
        for glob in opts['file_ignore_glob']:
            if fnmatch.fnmatch(fname, glob):
                log.debug(
                    'File matching file_ignore_glob. Skipping: %s',
                    fname
                )
                return True
    return False
29658
def isfortran(env, source):
    """"""
    try:
        fsuffixes = env['FORTRANSUFFIXES']
    except KeyError:
        # If no FORTRANSUFFIXES, no fortran tool, so there is no need to look
        # for fortran sources.
        return 0

    if not source:
        # Source might be None for unusual cases like SConf.
        return 0
    for s in source:
        if s.sources:
            ext = os.path.splitext(str(s.sources[0]))[1]
            if ext in fsuffixes:
                return 1
    return 0
1048550
def isatty(self):
        ""
        try:
            return os.isatty(self._fileno)
        except OSError, e:
            raise IOError(*e.args)