How to use the funcy.walk_keys function in funcy

To help you get started, we’ve selected a few funcy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Chandlercjy / OnePy / OnePy / feed.py View on Github external
def _update():
            bar = next(self.iteral_data)
            bar = fy.walk_keys(lambda x:x.lower(), bar)
            bar['date'] = self.set_dtformat(bar)

            for i in list(bar.keys()):
                try:bar[i] = float(bar[i])      # 将数值转化为float
                except ValueError:pass
            return bar
github Chandlercjy / OnePy / depreciated / feeds / feedbase.py View on Github external
def _update():
            bar = next(self.iteral_buffer)
            bar = fy.walk_keys(lambda x: x.lower(), bar)
            bar["date"] = self.__set_dtformat(bar)

            for i in bar:
                try:
                    bar[i] = float(bar[i])  # 将数值转化为float
                except ValueError:
                    pass
            return bar
github Chandlercjy / OnePy / OnePy / feed.py View on Github external
def _update():
            bar = next(self.iteral_data2)
            bar = fy.walk_keys(lambda x:x.lower(), bar)
            bar['date'] = self.set_dtformat(bar)

            for i in list(bar.keys()):
                try:bar[i] = float(bar[i])      # 将数值转化为float
                except ValueError:pass
            return bar
github idrdex / star-django / tags / models.py View on Github external
def _get_data(self):
        qs = SampleAnnotation.objects.values(*self.KEYS).prefetch_related(
            'sample',
            'sample__platform',
            'series_annotation__tag',
        ).filter(series_annotation_id__in=self.metadata.get('ids', []))
        return [walk_keys(self.KEYS, annotation) for annotation in qs.iterator()]
github idrdex / star-django / api / serializers.py View on Github external
missing_annotations = all_samples - tagged_samples
        if missing_annotations:
            raise serializers.ValidationError(
                ["There are samples with ids {0} which are missing their annotation"
                 .format(missing_annotations)
                 ])

        extra_annotations = tagged_samples - all_samples
        if extra_annotations:
            raise serializers.ValidationError(
                ["There is samples with id {0} which doesn't belongs to series {1}"
                 .format(extra_annotations, data['series'].id)
                 ])

        data['annotations'] = walk_keys(gsm_to_id, data['annotations'])
        return data
github idrdex / star-django / core / management / commands / initialize_historical_counters.py View on Github external
def distribute_series_and_sample_annotations(qs):
    series_annotations = distribute_by_created_on(qs)
    values = qs.values_list('created_on', 'samples')
    group = group_values(walk_keys(ceil_date, values.iterator()))
    return series_annotations, accumulate(walk_values(sum, group))
github idrdex / star-django / api / views.py View on Github external
# Remap sample annotations gsm -> id and check that they correspond to series/platform
        if data.get('annotations') and data.get('series') and data.get('platform'):
            samples_qs = Sample.objects.filter(series=data['series'], platform=data['platform'])
            gsm_to_id = dict(samples_qs.values_list('gsm_name', 'id'))
            all_samples = set(gsm_to_id)
            tagged_samples = set(data['annotations'])

            if all_samples - tagged_samples:
                self.add_error('annotations', "These samples are missing from annotations: %s"
                               % ', '.join(sorted(all_samples - tagged_samples)))
            if tagged_samples - all_samples:
                self.add_error('annotations', "These samples doesn't belong to series/platform: %s"
                               % ', '.join(sorted(tagged_samples - all_samples)))

            if data.get('annotations'):
                data['annotations'] = walk_keys(gsm_to_id, data['annotations'])

        return data