Gets FeatureType as a python dict.

        Transforms feature_name info into python dict.
344125
def get_feature_type_info(self):
        
        caps = self.get_capabilities()
        if caps is None:
            return None

        el = caps.find('{http://www.opengis.net/wfs}FeatureTypeList')
        for e in el.findall('{http://www.opengis.net/wfs}FeatureType'):
            if e.find('{http://www.opengis.net/wfs}Name').text == self._feature_name:
                # transform into python dict
                # <Name>sample</Name>
                # <Abstract/>
                # <LatLongBoundingBox maxx="1" maxy="5" ... />
                #
                # becomes:
                #
                # {'Name'               :'sample',
                #  'Abtract'            : None,
                #  'LatLongBoundingBox' : {'maxx':1, 'maxy':5 ... }}
                #
                d = {sube.tag[28:]:sube.text or sube.attrib or None for sube in e.getchildren()}

                # transform LatLongBoundingBox into a Shapely box
                llbb = {k:round(float(v), 4) for k,v in d['LatLongBoundingBox'].iteritems()}
                d['LatLongBoundingBox'] = box(llbb['minx'], llbb['miny'], llbb['maxx'], llbb['maxy'])
                return d

        return None
446661
def _maybe_pandas_data(data, feature_names, feature_types):
    

    if not isinstance(data, DataFrame):
        return data, feature_names, feature_types

    data_dtypes = data.dtypes
    if not all(dtype.name in PANDAS_DTYPE_MAPPER for dtype in data_dtypes):
        bad_fields = [data.columns[i] for i, dtype in
                      enumerate(data_dtypes) if dtype.name not in PANDAS_DTYPE_MAPPER]

        msg = """DataFrame.dtypes for data must be int, float or bool.
                Did not expect the data types in fields """
        raise ValueError(msg + ', '.join(bad_fields))

    if feature_names is None:
        if isinstance(data.columns, MultiIndex):
            feature_names = [
                ' '.join([str(x) for x in i])
                for i in data.columns
            ]
        else:
            feature_names = data.columns.format()

    if feature_types is None:
        feature_types = [PANDAS_DTYPE_MAPPER[dtype.name] for dtype in data_dtypes]

    data = data.values.astype('float')

    return data, feature_names, feature_types
660269
def as_dictionary(self):
        
        return {
            "name": self.name,
            "type": self.type,
            "value": remove_0x_prefix(self.value) if self.type == 'bytes32' else self.value
        }
117777
def _pprint_features_dict(features_dict, indent=0, add_prefix=True):
  """"""
  first_last_indent_str = " " * indent
  indent_str = " " * (indent + 4)
  first_line = "%s%s({" % (
      first_last_indent_str if add_prefix else "",
      type(features_dict).__name__,
  )
  lines = [first_line]
  for k in sorted(list(features_dict.keys())):
    v = features_dict[k]
    if isinstance(v, tfds.features.FeaturesDict):
      v_str = _pprint_features_dict(v, indent + 4, False)
    else:
      v_str = str(v)
    lines.append("%s'%s': %s," % (indent_str, k, v_str))
  lines.append("%s})" % first_last_indent_str)
  return "\n".join(lines)
530077
def _maybe_from_pandas(data, feature_names, feature_types):
    
    try:
        import pandas as pd
    except ImportError:
        return data, feature_names, feature_types

    if not isinstance(data, pd.DataFrame):
        return data, feature_names, feature_types

    dtypes = data.dtypes
    if not all(dtype.name in ('int64', 'float64', 'bool') for dtype in dtypes):
        raise ValueError('DataFrame.dtypes must be int, float or bool')

    if feature_names is None:
        feature_names = data.columns.format()
    if feature_types is None:
        mapper = {'int64': 'int', 'float64': 'q', 'bool': 'i'}
        feature_types = [mapper[dtype.name] for dtype in dtypes]
    data = data.values.astype('float')
    return data, feature_names, feature_types
27976
def normalize_geojson_featurecollection(obj):
    
    if not isinstance(obj, Sequence):
        obj = [obj]

    features = []
    for x in obj:
        if not isinstance(x, Mapping) or 'type' not in x:
            raise ValueError(
                "Expecting a geojson-like mapping or sequence of them")

        if 'features' in x:
            features.extend(x['features'])
        elif 'geometry' in x:
            features.append(x)
        elif 'coordinates' in x:
            feat = {'type': 'Feature',
                    'properties': {},
                    'geometry': x}
            features.append(feat)
        else:
            raise ValueError(
                "Expecting a geojson-like mapping or sequence of them")

    return {'type': 'FeatureCollection', 'features': features}
849311
def features(self):
        """"""

        r = []
        for _, inter in self.props.items():
            if isinstance(inter, tuple):
                if (inter[0] and inter[1] and inter[0].getValue() == inter[1].getValue() and
                        inter[0].operator == "=" and inter[1].operator == "="):
                    r.append(inter[0])
                else:
                    r.extend([f for f in inter if f])
            elif isinstance(inter, dict):
                r.extend(inter.values())
            elif isinstance(inter, list):
                r.extend(inter)
            else:
                r.append(inter)
        return r
518608
def get_info(self, version):
        
        ret = super(PandasStore, self).get_info(version)
        ret['col_names'] = version['dtype_metadata']
        ret['handler'] = self.__class__.__name__
        ret['dtype'] = ast.literal_eval(version['dtype'])
        return ret
385934
def as_dict(self):
        
        my_info = {}
        if self.platform:
            my_info["model"] = self.platform
        if self.resource_id:
            my_info["sn"] = self.resource_id
        if self.vendor:
            my_info["vendor"] = self.vendor
        if self.provider:
            my_info["provider"] = self.provider
        return my_info
1032650
def to_dict(self):
        
        rv = {'code': self.code}
        if not self.is_native():
            rv['issuer'] = self.issuer
            rv['type'] = self.type
        else:
            rv['type'] = 'native'
        return rv
868061
def to_dict(self):
        
        return {
            'type': self.__class__.__name__,
            'element_id': self.element_id,
            'style_class': self.style_class,
            'icon': self.icon,
            'attributes': self.attributes
        }
339764
def get (self, feature):
        
        if type(feature) == type([]):
            feature = feature[0]
        if not isinstance(feature, b2.build.feature.Feature):
            feature = b2.build.feature.get(feature)
        assert isinstance(feature, b2.build.feature.Feature)

        if self.feature_map_ is None:
            self.feature_map_ = {}

            for v in self.all_:
                if v.feature not in self.feature_map_:
                    self.feature_map_[v.feature] = []
                self.feature_map_[v.feature].append(v.value)

        return self.feature_map_.get(feature, [])
966115
def _get_prefixes(self):
        """"""
        prefixes = {
            "@": "o",
            "+": "v",
        }
        feature_prefixes = self.server.features.get('PREFIX')
        if feature_prefixes:
            modes = feature_prefixes[1:len(feature_prefixes)//2]
            symbols = feature_prefixes[len(feature_prefixes)//2+1:]
            prefixes = dict(zip(symbols, modes))
        return prefixes
623861
def feature_name(self):
        
        num_feature = self.num_feature()
        # Get name of features
        tmp_out_len = ctypes.c_int(0)
        string_buffers = [ctypes.create_string_buffer(255) for i in range_(num_feature)]
        ptr_string_buffers = (ctypes.c_char_p * num_feature)(*map(ctypes.addressof, string_buffers))
        _safe_call(_LIB.LGBM_BoosterGetFeatureNames(
            self.handle,
            ctypes.byref(tmp_out_len),
            ptr_string_buffers))
        if num_feature != tmp_out_len.value:
            raise ValueError("Length of feature names doesn't equal with num_feature")
        return [string_buffers[i].value.decode() for i in range_(num_feature)]
733471
def get_transformed_feature_info(features, schema):
  

  info = collections.defaultdict(dict)

  for name, transform in six.iteritems(features):
    transform_name = transform['transform']
    source_column = transform['source_column']

    if transform_name == IDENTITY_TRANSFORM:
      schema_type = next(col['type'].lower() for col in schema if col['name'] == source_column)
      if schema_type == FLOAT_SCHEMA:
        info[name]['dtype'] = tf.float32
      elif schema_type == INTEGER_SCHEMA:
        info[name]['dtype'] = tf.int64
      else:
        raise ValueError('itentity should only be applied to integer or float'
                         'columns, but was used on %s' % name)
      info[name]['size'] = 1
    elif transform_name == SCALE_TRANSFORM:
      info[name]['dtype'] = tf.float32
      info[name]['size'] = 1
    elif transform_name == ONE_HOT_TRANSFORM:
      info[name]['dtype'] = tf.int64
      info[name]['size'] = 1
    elif transform_name == EMBEDDING_TRANSFROM:
      info[name]['dtype'] = tf.int64
      info[name]['size'] = 1
    elif transform_name == MULTI_HOT_TRANSFORM:
      info[name]['dtype'] = tf.int64
      info[name]['size'] = None
    elif transform_name == BOW_TRANSFORM or transform_name == TFIDF_TRANSFORM:
      info[name + '_ids']['dtype'] = tf.int64
      info[name + '_weights']['dtype'] = tf.float32
      info[name + '_ids']['size'] = None
      info[name + '_weights']['size'] = None
    elif transform_name == KEY_TRANSFORM:
      schema_type = next(col['type'].lower() for col in schema if col['name'] == source_column)
      if schema_type == FLOAT_SCHEMA:
        info[name]['dtype'] = tf.float32
      elif schema_type == INTEGER_SCHEMA:
        info[name]['dtype'] = tf.int64
      else:
        info[name]['dtype'] = tf.string
      info[name]['size'] = 1
    elif transform_name == TARGET_TRANSFORM:
      # If the input is a string, it gets converted to an int (id)
      schema_type = next(col['type'].lower() for col in schema if col['name'] == source_column)
      if schema_type in NUMERIC_SCHEMA:
        info[name]['dtype'] = tf.float32
      else:
        info[name]['dtype'] = tf.int64
      info[name]['size'] = 1
    elif transform_name == IMAGE_TRANSFORM:
      info[name]['dtype'] = tf.float32
      info[name]['size'] = IMAGE_BOTTLENECK_TENSOR_SIZE
    else:
      raise ValueError('Unknown transfrom %s' % transform_name)

  return info
350573
def guess_feature_type(nc, variable):
    '''
    
    '''
    if is_point(nc, variable):
        return 'point'
    if is_timeseries(nc, variable):
        return 'timeseries'
    if is_multi_timeseries_orthogonal(nc, variable):
        return 'multi-timeseries-orthogonal'
    if is_multi_timeseries_incomplete(nc, variable):
        return 'multi-timeseries-incomplete'
    if is_cf_trajectory(nc, variable):
        return 'cf-trajectory'
    if is_single_trajectory(nc, variable):
        return 'single-trajectory'
    if is_profile_orthogonal(nc, variable):
        return 'profile-orthogonal'
    if is_profile_incomplete(nc, variable):
        return 'profile-incomplete'
    if is_timeseries_profile_single_station(nc, variable):
        return 'timeseries-profile-single-station'
    if is_timeseries_profile_multi_station(nc, variable):
        return 'timeseries-profile-multi-station'
    if is_timeseries_profile_single_ortho_time(nc, variable):
        return 'timeseries-profile-single-ortho-time'
    if is_timeseries_profile_multi_ortho_time(nc, variable):
        return 'timeseries-profile-multi-ortho-time'
    if is_timeseries_profile_ortho_depth(nc, variable):
        return 'timeseries-profile-ortho-depth'
    if is_timeseries_profile_incomplete(nc, variable):
        return 'timeseries-profile-incomplete'
    if is_trajectory_profile_orthogonal(nc, variable):
        return 'trajectory-profile-orthogonal'
    if is_trajectory_profile_incomplete(nc, variable):
        return 'trajectory-profile-incomplete'
    if is_2d_regular_grid(nc, variable):
        return '2d-regular-grid'
    if is_2d_static_grid(nc, variable):
        return '2d-static-grid'
    if is_3d_regular_grid(nc, variable):
        return '3d-regular-grid'
    if is_3d_static_grid(nc, variable):
        return '3d-static-grid'
    if is_mapped_grid(nc, variable):
        return 'mapped-grid'
    if is_reduced_grid(nc, variable):
        return 'reduced-grid'
792277
def explain_feature(featurename):
    '''
    '''

    import os
    import featuremonkey
    import importlib
    import subprocess

    def guess_version(feature_module):
        if hasattr(feature_module, '__version__'):
            return feature_module.__version__
        if hasattr(feature_module, 'get_version'):
            return feature_module.get_version()
        return ('unable to determine version:'
                ' please add __version__ or get_version()'
                ' to this feature module!')

    def git_rev(module):
        stdout, stderr = subprocess.Popen(
            ["git", "rev-parse", "HEAD"],
            cwd=os.path.dirname(module.__file__),
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        ).communicate()
        if 'Not a git repo' in stderr:
            return '-'
        else:
            return stdout.strip()

    def git_changes(module):
        stdout = subprocess.Popen(
            ["git", "diff", "--name-only"],
            cwd=os.path.dirname(module.__file__),
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE
        ).communicate()[0]
        return stdout.strip() or '-'

    if featurename in featuremonkey.get_features_from_equation_file(os.environ['PRODUCT_EQUATION_FILENAME']):
        print()
        print(featurename)
        print('-' * 60)
        print()
        is_subfeature = '.features.' in featurename
        try:
            feature_module = importlib.import_module(featurename)
        except ImportError:
            print('Error: unable to import feature "%s"' % featurename)

        print('Location: %s' % os.path.dirname(feature_module.__file__))
        print()
        if is_subfeature:
            print('Version: see parent feature')
            print()
        else:
            print('Version: %s' % str(guess_version(feature_module)))
            print()
            print('git: %s' % git_rev(feature_module))
            print()
            print('git changed: %s' % '\n\t\t'.join(git_changes(feature_module).split('\n')))
    else:
        print('No feature named ' + featurename)