Return a dict with default values for all properties declared on this class.
970635
def get_default_property_values(self, classname):
        """"""
        schema_element = self.get_element_by_class_name(classname)

        result = {
            property_name: property_descriptor.default
            for property_name, property_descriptor in six.iteritems(schema_element.properties)
        }

        if schema_element.is_edge:
            # Remove the source/destination properties for edges, if they exist.
            result.pop(EDGE_SOURCE_PROPERTY_NAME, None)
            result.pop(EDGE_DESTINATION_PROPERTY_NAME, None)

        return result
621554
def default(self, obj):
        """"""
        # pylint: disable=method-hidden, protected-access, arguments-differ
        if isinstance(obj, Sensor):
            return {
                'sensor_id': obj.sensor_id,
                'children': obj.children,
                'type': obj.type,
                'sketch_name': obj.sketch_name,
                'sketch_version': obj.sketch_version,
                'battery_level': obj.battery_level,
                'protocol_version': obj.protocol_version,
                'heartbeat': obj.heartbeat,
            }
        if isinstance(obj, ChildSensor):
            return {
                'id': obj.id,
                'type': obj.type,
                'description': obj.description,
                'values': obj.values,
            }
        return json.JSONEncoder.default(self, obj)
1322684
def properties(self):
        
        if 'properties' in self._values:
            return self._values['properties']
        self._values['properties'] = copy.deepcopy(self._defaults['properties'])
        return self._values['properties']
606455
def default(self, obj):
        """"""
        if hasattr(obj, '__dict__'):
            return obj.__dict__.copy()
        elif HAS_NUMPY and isinstance(obj, np.ndarray):
            return obj.copy().tolist()
        else:
            raise TypeError(("Object of type {:s} with value of {:s} is not "
                             "JSON serializable").format(type(obj), repr(obj)))
20772
def allProperties(self):
        
        rval = {}
        rval.update(self.coreProperties)
        rval.update(self.extendedProperties)
        rval.update(self.customProperties)
        return rval
250572
def propertyNames(self):
        
        """
        for k in self.data:
            yield k
        if self.defaults is not None:
            for k in self.defaults.propertyNames():
                if k not in self.data:
                    yield k
393850
def properties(self):
        """"""
        value = self._schema.get("properties", {})
        if not isinstance(value, dict):
            raise SchemaError(
                "properties value {0!r} is not an object".format(value))
        return value
957410
def get_default_values(self):
        """"""
        if not self.process_default_values:
            # Old, pre-Optik 1.5 behaviour.
            return optparse.Values(self.defaults)

        # Load the configuration, or error out in case of an error
        try:
            self.config.load()
        except ConfigurationError as err:
            self.exit(UNKNOWN_ERROR, str(err))

        defaults = self._update_defaults(self.defaults.copy())  # ours
        for option in self._get_all_options():
            default = defaults.get(option.dest)
            if isinstance(default, string_types):
                opt_str = option.get_opt_string()
                defaults[option.dest] = option.check_value(opt_str, default)
        return optparse.Values(defaults)
1294438
def to_dict(self, get_value=None):
        """"""
        self.trim()
        result = {}
        for key, value in iteritems(self.counters):
            if get_value is not None:
                value = getattr(value, get_value)
            r = result
            for _key in key[:-1]:
                r = r.setdefault(_key, {})
            r[key[-1]] = value
        return result
1055708
def as_dict(self):
        
        self.clean()
        d = OrderedDict()
        all_props = self.__class__.CONFIG_PROPERTIES
        for attr_name, attr_config in six.iteritems(all_props):
            value = self._config[attr_name]
            attr_type = attr_config.attr_type
            if attr_type:
                if value:
                    if issubclass(attr_type, list):
                        if issubclass(attr_type, NamedTupleList):
                            d[attr_name] = [i._asdict() for i in value]
                        else:
                            d[attr_name] = value[:]
                    elif attr_type is dict:
                        d[attr_name] = dict(value)
            elif value is not NotSet:
                d[attr_name] = value
        return d
1356239
def values(self, with_defaults=True):
        
        return dict(((k, str(v)) for k, v in self._inputs.items() if not v.is_empty(with_defaults)))
682836
def _fill_default_values(cls, cls_context, dict_):
        

        dict_with_default_values = dict(dict_)
        params = re.findall(cls._PATTERN_PARAM_NAME_TYPED_ANY,
                            cls_context.__doc__)

        for param in params:
            if param not in dict_with_default_values:
                dict_with_default_values[param] = None

        return dict_with_default_values
387661
def all_default_fields():
    
    default_fields = []
    for item in dir(fields):
        if not item.startswith("__"):
            var = getattr(definitions, item)
            if isinstance(var, dict):
                if var.get('replace_null', False):
                    default_fields.append(var)
    return default_fields
841147
def get_properties(self, obj):
        """"""
        properties = {}

        for field_name, field in sorted(obj.fields.items()):
            schema = self._get_schema_for_field(obj, field)
            properties[field.name] = schema

        return properties
366048
def simple_defaults(self, defaults_dic):
        

        defaults=[]
        for d in defaults_dic.keys():
            dic={}
            dic["visualProperty"]=d
            dic["value"]=defaults_dic[d]
            defaults.append(dic)
        return defaults
832463
def get_defaults(self):
        """"""
        # dont need 'required' to determine the default
        options = [copy.copy(opt) for opt in self._options]
        for opt in options:
            try:
                del opt.kwargs['required']
            except KeyError:
                pass
        parser = self.build_parser(options, permissive=True, add_help=False)
        parsed, _ = parser.parse_known_args([])
        return vars(parsed)
682817
def styleProperties(Class, style):
        
        properties = Dict()
        for property in style.getProperties(all=True):
            stylename = property.name + ':'
            properties[stylename] = property.value
            if property.priority != '':
                properties[stylename] = ' !'+property.priority
        return properties