get form class according form class path or form class object
181031
def get_form(formcls):
    
    from uliweb.form import Form
    import inspect
    
    if inspect.isclass(formcls) and issubclass(formcls, Form):
        return formcls
    elif isinstance(formcls, (str, unicode)):
        path = settings.FORMS.get(formcls)
        if path:
            _cls = import_attr(path)
            return _cls
        else:
            raise UliwebError("Can't find formcls name %s in settings.FORMS" % formcls)
    else:
        raise UliwebError("formcls should be Form class object or string path format, but %r found!" % formcls)
449660
def get_class(cls, name_or_sl):
        """"""
        try:
            return cls.sl_map[int(name_or_sl)]

        except TypeError as e:
            raise TypeError("Bad name or sl: {} : {}".format(name_or_sl, e))
        except ValueError:
            try:
                return cls.class_map[name_or_sl.lower()]
            except (KeyError, ValueError):
                raise NotASummaryName("Value '{}' is not a valid summary level".format(name_or_sl))
1022236
def get_class_by_path(class_path: str, is_module: Optional[bool] = False) -> type:
    

    if is_module:
        try:
            backend_module = importlib.import_module(class_path)
        except ImportError:
            logger.warning("Can't import backend with name `%s`", class_path)
            raise
        else:
            return backend_module

    module_name, class_name = class_path.rsplit('.', 1)

    try:
        backend_module = importlib.import_module(module_name)
    except ImportError:
        logger.error("Can't import backend with name `%s`", module_name)
        raise

    try:
        backend_class = getattr(backend_module, class_name)
    except AttributeError:
        logger.error("Can't get backend class `%s` from `%s`", class_name, module_name)
        raise

    return backend_class
159506
def get_class(class_string):
    
    split_string = class_string.encode('ascii').split('.')
    import_path = '.'.join(split_string[:-1])
    class_name = split_string[-1]

    if class_name:
        try:
            if import_path:
                mod = __import__(import_path, globals(), {}, [class_name])
                cls = getattr(mod, class_name)
            else:
                cls = __import__(class_name, globals(), {})
            if cls:
                return cls
        except (ImportError, AttributeError):
            pass

    return None
284941
public static function findDataClass($formType)
    {
        if ($dataClass = $formType->getConfig()->getDataClass()) {
            return $dataClass;
        } else {
            if ($parent = $formType->getParent()) {
                return self::findDataClass($parent);
            } else {
                return null;
            }
        }
    }
1250673
def form_node(cls):
    """"""
    assert issubclass(cls, FormNode)
    res = attrs(init=False, slots=True)(cls)
    res._args = []
    res._required_args = 0
    res._rest_arg = None
    state = _FormArgMode.REQUIRED
    for field in fields(res):
        if 'arg_mode' in field.metadata:
            if state is _FormArgMode.REST:
                raise RuntimeError('rest argument must be last')
            if field.metadata['arg_mode'] is _FormArgMode.REQUIRED:
                if state is _FormArgMode.OPTIONAL:
                    raise RuntimeError('required arg after optional arg')
                res._args.append(field)
                res._required_args += 1
            elif field.metadata['arg_mode'] is _FormArgMode.OPTIONAL:
                state = _FormArgMode.OPTIONAL
                res._args.append(field)
            elif field.metadata['arg_mode'] is _FormArgMode.REST:
                state = _FormArgMode.REST
                res._rest_arg = field
            else:
                assert 0
    return res
426163
def get_widget_css_class(self, field_name, field):
        
        # If we render CheckboxInputs, Bootstrap requires a different
        # widget css class for checkboxes.
        if isinstance(field.widget, forms.CheckboxInput):
            return 'form-check-input'

        # Idem for fileinput.
        if isinstance(field.widget, forms.FileInput):
            return 'form-control-file'

        return super().get_widget_css_class(field_name, field)
1059353
def get(self, request, *args, **kwargs):
        
        form_class = self.get_form_class()
        form = self.get_form(form_class)
        if form.is_valid():
            return self.form_valid(form)

        else:
            return self.form_invalid(form)
179173
def get_module_class(class_path):
    
    mod_name, cls_name = class_path.rsplit('.', 1)

    try:
        mod = import_module(mod_name)
    except ImportError as e:
        raise ImproperlyConfigured(('Error importing module %s: "%s"' % (mod_name, e)))

    return getattr(mod, cls_name)
994196
def get_object(self):
        

        if not self.force_add and self.kwargs.get(self.slug_url_kwarg, None):
            return super(FormView, self).get_object()
        else:
            self.queryset = self.get_queryset()

        return None
569089
def construct_form(self, request):
        
        if not hasattr(self, 'form_class'):
            return None

        if request.method == 'POST':
            form = self.form_class(self.model, request.POST, request.FILES)
        else:
            form = self.form_class(self.model)
        return form
157333
def get_form_class(self):
        
        if self.fieldsets:
            fields = flatten_fieldsets(self.get_fieldsets())
        else:
            if (self.form_class and
                    getattr(self.form_class, 'Meta', None) and
                    getattr(self.form_class.Meta, 'fields', None)):
                fields = self.form_class.Meta.fields
            else:
                fields = []

        exclude = None
        if self.parent_field:
            exclude = (self.parent_field,)

        readonly_fields = self.get_readonly_fields()
        if readonly_fields:
            if exclude:
                exclude = list(exclude)
            else:
                exclude = []

            for field in readonly_fields:
                try:
                    try:
                        f = self.model._meta.get_field(field)
                        if fields:
                            fields.remove(field)
                        else:
                            exclude.append(field)
                    except models.FieldDoesNotExist:
                        if fields:
                            fields.remove(field)
                except ValueError:
                    pass

        params = {'fields': fields or '__all__',
                  'exclude': exclude,
                  'formfield_callback': self.formfield_for_dbfield}

        if self.form_class:
            if issubclass(self.form_class, forms.ModelForm) and \
                    getattr(self.form_class._meta, 'model', None):
                model = self.form_class.Meta.model
            else:
                model = self.model
            fc = self.customize_form_widgets(self.form_class, fields=fields)
            params['form'] = fc
        else:
            if self.model is not None:
                # If a model has been explicitly provided, use it
                model = self.model
            elif hasattr(self, 'object') and self.object is not None:
                # If this view is operating on a single object, use
                # the class of that object
                model = self.object.__class__
            else:
                # Try to get a queryset and extract the model class
                # from that
                model = self.get_queryset().model

        return model_forms.modelform_factory(model, **params)
1287682
function getClass(value) {
      if (value == null) {
        return value === null ? 'Null' : 'Undefined';
      }
      try {
        var result = _.result(/^\[object (.*?)\]$/.exec(toString.call(value)), 1);
      } catch(e) {}

      return result || '';
    }
944105
def get_form(self, request, obj=None, **kwargs):
        
        form_class = super(TranslatableAdmin, self).get_form(request, obj, **kwargs)
        if self._has_translatable_model():
            form_class.language_code = self.get_form_language(request, obj)

        return form_class
1135791
protected function getFormClassNameFromControllerAction()
    {
        return $this->controllerService->getFormClassNameFromControllerAction(
            $this->getControllerName(),
            $this->getControllerActionName(),
            $this->getFormObjectName()
        );
    }
854156
public static function &getForm(Form &$form, $path)
    {
        $keys = array_filter(preg_split('#[\.\[\]]+#', $path), function ($val) {
            return $val;
        });

        $prefix = substr($path, 0, strlen($form->getName()) + 1);

        if (
            $form->getName().'[' === $prefix
        ||
            $form->getName().'.' === $prefix
        ) {
            array_shift($keys);
        }

        $val = $form;

        foreach ($keys as $k) {
            $val = static::_get($val, $k);
        }

        /* @var $val Form */
        return $val;
    }
1142013
def get_attributes(self):
        
        items = {}
        items['form_method'] = self.form_method.strip()
        items['form_tag'] = self.form_tag
        items['form_style'] = self.form_style.strip()
        
        if self.form_action:
            items['form_action'] = self.form_action.strip()
        if self.form_id:
            items['id'] = self.form_id.strip()
        if self.form_class:
            items['class'] = self.form_class.strip()
        if self.inputs:
            items['inputs'] = self.inputs
        if self.form_error_title:
            items['form_error_title'] = self.form_error_title.strip()
        if self.formset_error_title:
            items['formset_error_title'] = self.formset_error_title.strip()
        return items