Extracts the designation type of the stored routine.
168203
private function extractDesignationType(): void
  {
    $found = true;
    $key   = array_search('begin', $this->routineSourceCodeLines);

    if ($key!==false)
    {
      for ($i = 1; $i<$key; $i++)
      {
        $n = preg_match('/^\s*--\s+type:\s*(\w+)\s*(.+)?\s*$/',
                        $this->routineSourceCodeLines[$key - $i],
                        $matches);
        if ($n==1)
        {
          $this->designationType = $matches[1];
          switch ($this->designationType)
          {
            case 'bulk_insert':
              $m = preg_match('/^([a-zA-Z0-9_]+)\s+([a-zA-Z0-9_,]+)$/',
                              $matches[2],
                              $info);
              if ($m==0)
              {
                throw new RoutineLoaderException('Error: Expected: -- type: bulk_insert <table_name> <columns>');
              }
              $this->bulkInsertTableName = $info[1];
              $this->bulkInsertKeys      = explode(',', $info[2]);
              break;

            case 'rows_with_key':
            case 'rows_with_index':
              $this->indexColumns = explode(',', $matches[2]);
              break;

            default:
              if (isset($matches[2])) $found = false;
          }
          break;
        }
        if ($i==($key - 1)) $found = false;
      }
    }
    else
    {
      $found = false;
    }

    if ($found===false)
    {
      throw new RoutineLoaderException('Unable to find the designation type of the stored routine');
    }
  }
72587
def __get_doc_block_lines(self):
        
        line1 = None
        line2 = None

        i = 0
        for line in self._routine_source_code_lines:
            if re.match(r'\s*/\*\*', line):
                line1 = i

            if re.match(r'\s*\*/', line):
                line2 = i

            if self._is_start_of_stored_routine(line):
                break

            i += 1

        return line1, line2
26258
def formatted_param_type(ptype):
    """"""
    pt_name = ptype["name"]
    if pt_name.startswith("<byname>"):
        pt_name = pt_name.replace("<byname>[", "=> ")[:-1]
    elif pt_name.startswith("<repeated>"):
        pt_name = pt_name.replace("<repeated>[", "")[:-1] + "*"
    return pt_name
551651
def get_register_expr(self, register_name, mode="post"):
        
        reg_info = self._arch_info.alias_mapper.get(register_name, None)

        if reg_info:
            var_base_name, offset = reg_info
        else:
            var_base_name = register_name

        var_name = self._get_var_name(var_base_name, mode)
        var_size = self._arch_info.registers_size[var_base_name]

        ret_val = self._translator.make_bitvec(var_size, var_name)

        if reg_info:
            ret_val = smtfunction.extract(ret_val, offset, self._arch_info.registers_size[register_name])

        return ret_val
454736
private function extractRoutineParametersInfo(): void
  {
    $routine_parameters = MetaDataLayer::getRoutineParameters($this->routineName);
    foreach ($routine_parameters as $key => $routine_parameter)
    {
      if ($routine_parameter['parameter_name'])
      {
        $data_type_descriptor = $routine_parameter['dtd_identifier'];
        if (isset($routine_parameter['character_set_name']))
        {
          $data_type_descriptor .= ' character set '.$routine_parameter['character_set_name'];
        }
        if (isset($routine_parameter['collation_name']))
        {
          $data_type_descriptor .= ' collation '.$routine_parameter['collation_name'];
        }

        $routine_parameter['data_type_descriptor'] = $data_type_descriptor;

        $this->parameters[$key] = $routine_parameter;
      }
    }

    $this->updateParametersInfo();
  }
474145
def _get_specification_positions(self):
        
        start = -1
        for (i, line) in enumerate(self._routine_source_code_lines):
            if self._is_start_of_stored_routine(line):
                start = i

        end = -1
        for (i, line) in enumerate(self._routine_source_code_lines):
            if self._is_start_of_stored_routine_body(line):
                end = i - 1

        return start, end
1201220
def type_name(value):
    """"""
    return type(value).__name__ if isinstance(value, EncapsulatedNode) else \
           "struct" if isinstance(value, dict) else \
           "sequence" if isinstance(value, (tuple, list)) else \
           type(value).__name__
436118
def getTypeInfo(self, sql_type):  # nopep8
        
        fut = self._run_operation(self._impl.getTypeInfo, sql_type)
        return fut
1328065
private function getOldStoredRoutinesInfo(): void
  {
    $this->rdbmsOldMetadata = [];

    $routines = DataLayer::getRoutines();
    foreach ($routines as $routine)
    {
      $this->rdbmsOldMetadata[$routine['routine_name']] = $routine;
    }
  }
1194905
private function extractDocBlockPartsWrapper(): void
  {
    // Get the DocBlock parts from the source of the stored routine.
    $this->extractDocBlockPartsSource();

    // Generate the parameters parts of the DocBlock to be used by the wrapper.
    $parameters = [];
    foreach ($this->parameters as $parameter_info)
    {
      $parameters[] = ['parameter_name'       => $parameter_info['parameter_name'],
                       'php_type'             => DataTypeHelper::columnTypeToPhpTypeHinting($parameter_info).'|null',
                       'data_type_descriptor' => $parameter_info['data_type_descriptor'],
                       'description'          => $this->getParameterDocDescription($parameter_info['parameter_name'])];
    }

    // Compose all the DocBlock parts to be used by the wrapper generator.
    $this->docBlockPartsWrapper = ['sort_description' => $this->docBlockPartsSource['sort_description'],
                                   'long_description' => $this->docBlockPartsSource['long_description'],
                                   'parameters'       => $parameters];
  }
224151
private function extractBulkInsertTableColumnsInfo(): void
  {
    // Return immediately if designation type is not appropriate for this method.
    if ($this->designationType!='bulk_insert') return;

    // Check if table is a temporary table or a non-temporary table.
    $table_is_non_temporary = MetaDataLayer::checkTableExists($this->bulkInsertTableName);

    // Create temporary table if table is non-temporary table.
    if (!$table_is_non_temporary)
    {
      MetaDataLayer::callProcedure($this->routineName);
    }

    // Get information about the columns of the table.
    $description = MetaDataLayer::describeTable($this->bulkInsertTableName);

    // Drop temporary table if table is non-temporary.
    if (!$table_is_non_temporary)
    {
      MetaDataLayer::dropTemporaryTable($this->bulkInsertTableName);
    }

    // Check number of columns in the table match the number of fields given in the designation type.
    $n1 = count($this->bulkInsertKeys);
    $n2 = count($description);
    if ($n1!=$n2)
    {
      throw new RoutineLoaderException("Number of fields %d and number of columns %d don't match.", $n1, $n2);
    }

    $this->bulkInsertColumns = self::extractColumnsFromTableDescription($description);
  }
145757
private static String getTypeString(IType t) {
        if(t==null)
            return "null";

        IPtrType pt = t.queryInterface(IPtrType.class);
        if(pt!=null)
            return getTypeString(pt.getPointedAtType())+"*";

        IPrimitiveType prim = t.queryInterface(IPrimitiveType.class);
        if(prim!=null)
            return prim.getName();

        ITypeDecl decl = t.queryInterface(ITypeDecl.class);
        if(decl!=null)
            return decl.getName();

        ISafeArrayType sa = t.queryInterface(ISafeArrayType.class);
        if (sa != null) {
          return "SAFEARRAY(" + getTypeString(sa.getComponentType()) + ")";
        }

        return "N/A";
    }
865230
def clean_ret_type(ret_type):
    """"""
    ret_type = get_printable(ret_type).strip()
    if ret_type == 'LRESULT LRESULT':
        ret_type = 'LRESULT'
    for bad in [
            'DECLSPEC_NORETURN', 'NTSYSCALLAPI', '__kernel_entry',
            '__analysis_noreturn', '_Post_equals_last_error_',
            '_Maybe_raises_SEH_exception_',
            '_CRT_STDIO_INLINE', '_ACRTIMP'
    ]:
        if bad in ret_type:
            ret_type = ret_type.replace(bad, '').strip()
            logging.debug(_('cleaned %s'), bad)
    return ret_type
879086
def extract_code_objects(pe):
    """"""
    script_res = _get_scripts_resource(pe)
    dump = _resource_dump(pe, script_res)
    return _get_co_from_dump(dump)
315063
def __read_stored_routine_metadata(self):
        
        if os.path.isfile(self._pystratum_metadata_filename):
            with open(self._pystratum_metadata_filename, 'r') as file:
                self._pystratum_metadata = json.load(file)
623003
def extract_bus_routine(page):
    '''
    '''
    if not isinstance(page, pq):
        page = pq(page)

    stations = extract_stations(page)
    return {
        # Routine name.
        'name': extract_routine_name(page),

        # Bus stations.
        'stations': stations,

        # Current routine.
        'current': extract_current_routine(page, stations)
    }
526558
private static <E> TypeInformation<?>[] extractTypeInfos(PojoTypeInfo<E> pojoTypeInfo, String[] fieldNames) {
		Preconditions.checkNotNull(pojoTypeInfo);
		Preconditions.checkNotNull(fieldNames);
		Preconditions.checkArgument(pojoTypeInfo.getArity() >= fieldNames.length);
		TypeInformation<?>[] fieldTypes = new TypeInformation<?>[fieldNames.length];
		for (int i = 0; i < fieldNames.length; ++i) {
			String fieldName = fieldNames[i];
			Preconditions.checkNotNull(fieldName, "The field can't be null");
			int fieldPos = pojoTypeInfo.getFieldIndex(fieldName);
			Preconditions.checkArgument(fieldPos >= 0,
				String.format("Field %s is not a member of POJO type %s",
					fieldName, pojoTypeInfo.getTypeClass().getName()));
			fieldTypes[i] = pojoTypeInfo.getTypeAt(fieldPos);
		}

		return fieldTypes;
	}