line_is_executable() returns True iff the line can start an
       executable statement in a program.
547306
def line_is_executable(line: str) -> bool:
    """"""

    if line_is_comment(line):
        return False

    if re.match(RE_TYPE_NAMES, line):
        return False

    for exp in EXECUTABLE_CODE_START:
        if re.match(exp, line) != None:
            return True

    return False
937640
private static boolean executesAsSimpleDirective(String line) throws Exception {

        // SHOW or LIST <blah> statement
        String subcommand = SQLParser.parseShowStatementSubcommand(line);
        if (subcommand != null) {
            if (subcommand.equals("proc") || subcommand.equals("procedures")) {
                execListProcedures();
            }
            else if (subcommand.equals("functions")) {
                execListFunctions();
            }
            else if (subcommand.equals("tables")) {
                execListTables();
            }
            else if (subcommand.equals("classes")) {
                execListClasses();
            }
            else if (subcommand.equals("config") || subcommand.equals("configuration")) {
                execListConfigurations();
            }
            else {
                String errorCase = (subcommand.equals("") || subcommand.equals(";")) ?
                        ("Incomplete SHOW command.\n") :
                        ("Invalid SHOW command completion: '" + subcommand + "'.\n");
                System.out.println(errorCase +
                        "The valid SHOW command completions are proc, procedures, tables, or classes.");
            }
            // Consider it handled here, whether or not it was a good SHOW statement.
            return true;
        }

        // HELP commands - ONLY in interactive mode, close batch and parse for execution
        // Parser returns null if it isn't a HELP command. If no arguments are specified
        // the returned string will be empty.
        String helpSubcommand = SQLParser.parseHelpStatement(line);
        if (helpSubcommand != null) {
            // Ignore the arguments for now.
            if (!helpSubcommand.isEmpty()) {
                System.out.printf("Ignoring extra HELP argument(s): %s\n", helpSubcommand);
            }
            printHelp(System.out); // Print readme to the screen
            return true;
        }

        String echoArgs = SQLParser.parseEchoStatement(line);
        if (echoArgs != null) {
            System.out.println(echoArgs);
            return true;
        }

        String echoErrorArgs = SQLParser.parseEchoErrorStatement(line);
        if (echoErrorArgs != null) {
            System.err.println(echoErrorArgs);
            return true;
        }

        // DESCRIBE table
        String describeArgs = SQLParser.parseDescribeStatement(line);
        if (describeArgs != null) {

            // Check if table exists
            String tableName = "";
            String type = "";
            VoltTable tableData = m_client.callProcedure("@SystemCatalog", "TABLES").getResults()[0];
            while (tableData.advanceRow()) {
                String t = tableData.getString(2);
                if (t.equalsIgnoreCase(describeArgs)) {
                    tableName = t;
                    type = tableData.getString(3);
                    break;
                }
            }
            if (tableName.equals("")) {
                System.err.println("Table does not exist");
                return true;
            }

            // Class to temporarily store and sort column attributes
            class Column implements Comparable {
                String name;
                String type;
                long size;
                String remarks;
                long position;
                String notNull;

                @Override
                public String toString() {return "";}

                @Override
                public int compareTo(Object obj) {
                    Column col = (Column) obj;
                    return (int)(this.position - col.position);
                }
            }

            // sort the columns as they are inserted
            SortedSet set = new TreeSet();

            // Retrieve Column attributes
            VoltTable columnData = m_client.callProcedure("@SystemCatalog", "COLUMNS").getResults()[0];
            int maxNameWidth = 10;
            while (columnData.advanceRow()) {
                if (tableName.equalsIgnoreCase(columnData.getString(2))) {

                    Column c = new Column();
                    c.name = columnData.getString(3);
                    if (c.name.length() > maxNameWidth) {
                        maxNameWidth = c.name.length();
                    }

                    c.type = columnData.getString(5);

                    c.size = columnData.getLong(6);
                    if (columnData.wasNull()) {
                        if (c.type.equals("GEOGRAPHY")) {
                            c.size = 32768;
                        }
                        if (c.type.equals("GEOGRAPHY_POINT")) {
                            c.size = 16;
                        }
                    } else if (c.type.equals("TINYINT")) {
                        c.size = 1;
                    } else if (c.type.equals("SMALLINT")) {
                        c.size = 2;
                    } else if (c.type.equals("INTEGER")) {
                        c.size = 4;
                    } else if (c.type.equals("BIGINT")) {
                        c.size = 8;
                    } else if (c.type.equals("FLOAT")) {
                        c.size = 8;
                    } else if (c.type.equals("DECIMAL")) {
                        c.size = 16;
                    } else if (c.type.equals("TIMESTAMP")) {
                        c.size = 8;
                    }

                    c.remarks = columnData.getString(11);
                    if (columnData.wasNull()) {
                        c.remarks = "";
                    }

                    c.position = columnData.getLong(16);

                    String nullableYesNo = columnData.getString(17);
                    c.notNull = "";
                    if (nullableYesNo.equals("NO")) {
                        c.notNull = "NOT NULL";
                    }

                    set.add(c);
                }
            }

            // print output
            String headerFormat = "%-" + maxNameWidth + "s|%-16s|%-11s|%-9s|%-16s\n";
            String rowFormat = "%-" + maxNameWidth + "s|%-16s|%11d|%-9s|%-16s\n";
            System.out.printf(headerFormat,"COLUMN","DATATYPE","SIZE","NULLABLE","REMARKS");
            String DASHES = new String(new char[56+maxNameWidth]).replace("\0", "-");
            System.out.println(DASHES);

            Iterator it = set.iterator();
            while (it.hasNext()) {
                Column c = (Column)it.next();
                System.out.printf(rowFormat,c.name,c.type,c.size,c.notNull,c.remarks);
            }
            System.out.println(DASHES);

            // primary key
            String primaryKey = "";
            VoltTable keyData = m_client.callProcedure("@SystemCatalog", "PRIMARYKEYS").getResults()[0];
            while (keyData.advanceRow()) {
                if (tableName.equalsIgnoreCase(keyData.getString(2))) {
                    String colName = keyData.getString(3);
                    if (!primaryKey.equals("")) {
                        primaryKey += ",";
                    }
                    primaryKey += colName;
                }
            }
            if (!primaryKey.equals("")) {
                System.out.println("Type: " + type + ", Primary Key (" + primaryKey + ")");
            } else {
                System.out.println("Type: " + type);
            }
            return true;
        }

        // It wasn't a locally-interpreted directive.
        return false;
    }
568795
def next_instruction_is_function_or_class(lines):
    """"""
    for i, line in enumerate(lines):
        if not line.strip():  # empty line
            if i > 0 and not lines[i - 1].strip():
                return False
            continue
        if line.startswith('def ') or line.startswith('class '):
            return True
        if line.startswith(('#', '@', ' ')):
            continue
        return False

    return False
1293016
def check_program(name):
    
    with open(os.devnull, "w") as null:
        try:
            subprocess.check_call(("which", name), stdout=null, stderr=null)
        except subprocess.CalledProcessError as e:
            return False
    return True
560405
def isexec(path):
    '''
    
    '''
    return os.path.isfile(path) and os.access(path, os.X_OK)
307056
def execline(scope, data):
    
    conn = scope.get('__connection__')
    response = []
    for line in data:
        conn.execute(line)
        response += conn.response.split('\n')[1:]
    scope.define(__response__=response)
    return True
930692
function (line) {
		line = line || "";
		line = line.trim();

		if (line.length === 0) {
			return true;
		}

		return false;
	}
197577
def type_of_line(line):
    """"""

    if line_is_comment(line):
        return "comment"
    elif line_is_executable(line):
        return "exec_stmt"
    elif line_is_pgm_unit_end(line):
        return "pgm_unit_end"
    else:
        if line_is_pgm_unit_start(line):
            return "pgm_unit_start"
        else:
            return "other"
157666
private boolean processLine(final CommandLine line, final Options options)
            throws Exception {
        if (line.hasOption(OPTION_VERSION)) {
            log.info(getVersion(true));
            return false;
        }
        if (line.hasOption(OPTION_HELP)) {
            produceHelp(options);
            return false;
        }
        if (line.hasOption(OPTION_INPUT)) {
            setXsdInput(line.getOptionValue(OPTION_INPUT).trim());
        }
        if (line.hasOption(OPTION_OUTPUT)) {
            setOutput(line.getOptionValue(OPTION_OUTPUT).trim());
        }
        if (line.hasOption(OPTION_AVRO_NAMESPACE_PREFIX)) {
            setAvroNamespacePrefix(line.getOptionValue(OPTION_AVRO_NAMESPACE_PREFIX).trim());
        }

        return true;
    }
390316
def cmdline(executable):
    

    args = [executable.executable]
    indexed_args = []

    for parameter in executable:

        optional = (parameter.type == 'boolean') or parameter.default
        has_value = parameter.type != 'boolean'


        if parameter.longflag:  # use longflag where possible
            flag = "--%s" % parameter.longflag
        elif parameter.flag:
            flag = "-%s VALUE" % parameter.flag
        elif parameter.index:
            flag = parameter.name
            optional = False


        if has_value:
            flag += " VALUE"

        if optional:
            flag = "[" + flag + "]"

        if parameter.index:
            indexed_args.insert(int(parameter.index), flag)
        else:
            args.append(flag)

    return args + indexed_args
981264
def _is_target_valid(self, cfg, target):  # pylint:disable=no-self-use
        

        if self.base_state is not None:
            try:
                if self.base_state.solver.is_true((self.base_state.memory.permissions(target) & 4) == 4):
                    return True
            except SimMemoryError:
                pass
            return False

        if cfg._addr_in_exec_memory_regions(target):
            # the jump target is executable
            return True
        if self.project.is_hooked(target):
            # the jump target is hooked
            return True
        return False
187875
function isExecutable(string $file): bool {
    $fileInfo = new \SplFileInfo($file);
    if (!$fileInfo->isFile()) return false;
    if ($fileInfo->isExecutable()) return true;
    return static::isWindows() ? $this->checkFileExtension($fileInfo) : $this->checkFilePermissions($fileInfo);
  }
399132
def set_is_executable(self, value):
        
        if value is None or not isinstance(value, bool):
            raise TypeError("IsExecutable must be set to a bool")
        else:
            self.__is_executable = value
784916
def is_code(filename):
    
    with open(filename, "r") as file:
        for line in file:
            # ignore comments and empty lines
            if not is_comment(line) \
                    and '{' in line: # <-- simple indicator for code
                if '${' not in line: # <-- ${abc} variable to substitute
                    return True
    return False
880728
@Exported
    public boolean isIdle() {
        lock.readLock().lock();
        try {
            return workUnit == null && executable == null;
        } finally {
            lock.readLock().unlock();
        }
    }
489596
def isCLIExecutable(filePath):
    
    # see qSlicerUtils::isCLIExecutable
    # e.g. https://github.com/Slicer/Slicer/blob/master/Base/QTCore/qSlicerUtils.cxx
    if not os.path.isfile(filePath):
        return False
    if sys.platform.startswith('win'):
        filePath = filePath.lower() # be case insensitive
        return filePath.endswith(".exe") or filePath.endswith(".bat")
    else:
        # differing from qSlicerUtils here, which does not check for executable bits
        # (this way we can differentiate between XML files saved with the same name
        # as the executables and the executables themselves)
        if not os.access(filePath, os.X_OK):
            return False
        return not '.' in os.path.basename(filePath)
329647
def is_executable(command):
    """"""

    paths = os.environ.get("PATH", "").split(os.path.pathsep)
    candidates = [command] + [os.path.join(p, command) for p in paths]
    return any(os.access(path, os.X_OK) for path in candidates)