Prepares array of GeneratorField from table columns.
353243
public function prepareFieldsFromTable()
    {
        foreach ($this->columns as $column) {
            $type = $column->getType()->getName();

            switch ($type) {
                case 'integer':
                    $field = $this->generateIntFieldInput($column, 'integer');
                    break;
                case 'smallint':
                    $field = $this->generateIntFieldInput($column, 'smallInteger');
                    break;
                case 'bigint':
                    $field = $this->generateIntFieldInput($column, 'bigInteger');
                    break;
                case 'boolean':
                    $name = title_case(str_replace('_', ' ', $column->getName()));
                    $field = $this->generateField($column, 'boolean', 'checkbox,1');
                    break;
                case 'datetime':
                    $field = $this->generateField($column, 'datetime', 'date');
                    break;
                case 'datetimetz':
                    $field = $this->generateField($column, 'dateTimeTz', 'date');
                    break;
                case 'date':
                    $field = $this->generateField($column, 'date', 'date');
                    break;
                case 'time':
                    $field = $this->generateField($column, 'time', 'text');
                    break;
                case 'decimal':
                    $field = $this->generateNumberInput($column, 'decimal');
                    break;
                case 'float':
                    $field = $this->generateNumberInput($column, 'float');
                    break;
                case 'string':
                    $field = $this->generateField($column, 'string', 'text');
                    break;
                case 'text':
                    $field = $this->generateField($column, 'text', 'textarea');
                    break;
                default:
                    $field = $this->generateField($column, 'string', 'text');
                    break;
            }

            if (strtolower($field->name) == 'password') {
                $field->htmlType = 'password';
            } elseif (strtolower($field->name) == 'email') {
                $field->htmlType = 'email';
            } elseif (in_array($field->name, $this->timestamps)) {
                $field->isSearchable = false;
                $field->isFillable = false;
                $field->inForm = false;
                $field->inIndex = false;
            }
            $field->isNotNull = (bool) $column->getNotNull();
            $field->description = $column->getComment(); // get comments from table

            $this->fields[] = $field;
        }
    }
409760
function prepareSelectionData (fields, i) {
    const resp = {};
    for (let field of fields) {
        resp[field.name()] = new Value(field.partialField.data[i], field);
    }
    return resp;
}
64928
private Put preparePut(String columnFamily, Object rowKey, Map<String, Attribute> columns, Map<String, Object> values)
            throws IOException
    {
        Put p = new Put(HBaseUtils.getBytes(rowKey));
        for (String columnName : columns.keySet())
        {
            Attribute column = columns.get(columnName);
            if (!column.isCollection() && !((SingularAttribute) column).isId())
            {
                String qualifier = columnName;
                try
                {
                    Object o = values.get(columnName);
                    byte[] value = HBaseUtils.getBytes(o);
                    if (value != null && columnFamily != null)
                    {
                        p.add(Bytes.toBytes(columnFamily), Bytes.toBytes(qualifier), value);
                    }
                }
                catch (PropertyAccessException e1)
                {
                    throw new IOException(e1);
                }
            }
        }
        return p;
    }
1170272
def prepare_table(table):
    
    n = len(table)
    for i, row in enumerate(table):
        assert len(row) == n
        for j, el in enumerate(row):
            if i == j:
                table[i][i] = 0.0
            elif i > j:
                table[i][j] = 1-table[j][i]
    return table
996554
def _find_field_generator_templates(self):
        
        field_gen_templates = {}

        # Extract field generators from class dict
        for name, g in self.__class__.__dict__.items():
            if isinstance(g, TohuBaseGenerator):
                field_gen_templates[name] = g.set_tohu_name(f'{name} (TPL)')

        # Extract field generators from instance dict
        for name, g in self.__dict__.items():
            if isinstance(g, TohuBaseGenerator):
                field_gen_templates[name] = g.set_tohu_name(f'{name} (TPL)')

        return field_gen_templates
1360080
def genfirstvalues(cursor: Cursor, arraysize: int = 1000) \
        -> Generator[Any, None, None]:
    
    return (row[0] for row in genrows(cursor, arraysize))
926048
public function generateFixtures($table, $amount, $generator = null, $baseIndex = 0)
    {
        $loading = $this->currentSession->into($table);
        if ($generator) {
            $loading = $loading->with($generator);
        }
        return $loading->generate($amount, $baseIndex);
    }
826765
def iterate_over_fields(cls):
        """"""
        for attr in dir(cls):
            clsattr = getattr(cls, attr)
            if isinstance(clsattr, BaseField):
                yield attr, clsattr
972156
def generate_table(self, rows):
        
        table = PrettyTable(**self.kwargs)
        for row in self.rows:
            if len(row[0]) < self.max_row_width:
                appends = self.max_row_width - len(row[0])
                for i in range(1, appends):
                    row[0].append("-")

            if row[1] is True:
                self.make_fields_unique(row[0])
                table.field_names = row[0]
            else:
                table.add_row(row[0])
        return table
582562
public function generate(string $tableName, array $fieldValues): array
    {
        $tca = $GLOBALS['TCA'][$tableName];
        /** @var FieldGeneratorResolver $resolver */
        $resolver = GeneralUtility::makeInstance(FieldGeneratorResolver::class);
        foreach ($tca['columns'] as $fieldName => $fieldConfig) {
            // Generate only if there is no value set, yet
            if (isset($fieldValues[$fieldName])) {
                continue;
            }
            $data = [
                'tableName' => $tableName,
                'fieldName' => $fieldName,
                'fieldConfig' => $fieldConfig,
                'fieldValues' => $fieldValues,
            ];
            try {
                $generator = $resolver->resolve($data);
                $fieldValues[$fieldName] = $generator->generate($data);
            } catch (GeneratorNotFoundException $e) {
                // No op if no matching generator was found
            }
        }
        return $fieldValues;
    }
857180
def iter_fields(self):
        
        def generator(path, values):
            for name,value in sorted(values.items()):
                if isinstance(value, ValueTree):
                    for inner in generator(path + name, value._values):
                        yield inner
                else:
                    yield (path, name, value)
        return generator(Path([]), self._values)
3058
private void forEachFieldDo(FieldCallBack fieldCallBack) {
		Class<?> clazz = this.getClass();
		
		while (true) {
			
			Field[] fields = clazz.getDeclaredFields();
			try {
				for (Field field : fields) {
					// FIXME: test skipped cases
					// skip Logger object
					if (field.getType() == Logger.class)
						continue;
					// skip fields annotated with @Transient
					if (field.getAnnotation(Transient.class) != null)
						continue;
					// skip serialVersionUID
					if ("serialVersionUID".equals(field.getName()))
						continue;
					field.setAccessible(true);
					fieldCallBack.doForField(field);
				} 
			} catch (IllegalArgumentException e) {
				throw new RuntimeException(e);
			} catch (IllegalAccessException e) {
				throw new RuntimeException(e);
			}
			
			if (clazz.getName().equals(DataObject.class.getName()))
				break;
			
			clazz = clazz.getSuperclass();
		}
	}
23464
def get_fields(config):
    
    for data in config['scraping']['data']:
        if data['field'] != '': 
            yield data['field']
    if 'next' in config['scraping']:
        for n in config['scraping']['next']:
            for f in get_fields(n): 
                yield f
1084617
protected function _generateFormFields($model)
    {
        $model = TableRegistry::get($model);
        $columns = ConnectionManager::get('default')->schemaCollection()->describe($model->table())->columns();

        $ignoredFields = [
            'created',
            'modified',
            'created_by',
            'modified_by',
            'password'
        ];

        $result = [];

        foreach ($columns as $column) {
            if (!in_array($column, $ignoredFields)) {
                $result[$column] = [];
            }
        }
        return $result;
    }
124442
private function prepareGettersAndSetters()
    {
        $table_descriptor = $this->getStorageDescriptor();

        foreach ($table_descriptor->getFieldNames() as $name) {
            $field = $table_descriptor->getField($name);
            if (array_key_exists('name', $field) &&
                array_key_exists('data_type', $field) &&
                array_key_exists('type', $field)
            ) {
                $field_name = $field['name'];
                if (nb_strStartsWith($field_name, $this->table_name)) {
                    $field_name = preg_replace('/^' . $this->table_name . '_*/', '', $field_name);
                }
                $name = nb_underscore2StudlyCaps($field_name, true, $this->dictionary);
                $entity = nb_underscore2EntityName($field['name'], true, $this->dictionary);
                $this->buildGetter($field, $name, $entity);
                $this->buildSetter($field, $field_name, $name, $entity);
            }
        }
    }
1162456
def prepare_fields(fields):
    
    def process_item(value):
        if not isinstance(value, NUMERIC_TYPES):
            if isinstance(value, six.string_types):
                # encode utf-8 to unicode, if necessary
                return force_text(value)
            else:
                if isinstance(value, dict):
                    return prepare_fields(value)
                elif isinstance(value, list):
                    return list(map(process_item, value))

                return six.text_type(value)
        return value

    return dict((key, process_item(value))
                for key, value
                in fields.items())
240983
def find_field_generators(obj):
    

    cls_dict = obj.__class__.__dict__
    obj_dict = obj.__dict__
    #debug_print_dict(cls_dict, 'cls_dict')
    #debug_print_dict(obj_dict, 'obj_dict')

    field_gens = {}
    add_field_generators(field_gens, cls_dict)
    add_field_generators(field_gens, obj_dict)

    return field_gens