Skip to content
This repository was archived by the owner on Oct 1, 2019. It is now read-only.
This repository was archived by the owner on Oct 1, 2019. It is now read-only.

How would you expect this to be formatted? #105

Open
@jondot

Description

@jondot

this is hand-tuned, yapf/pep8 don't really care about any of that (they pass-through, it seems):

def fetch(content, prefix):
    return {
        'parts': pipe(parse('$..layers').find(content), mapcat(lambda m: m.value),
                      filter(lambda v: v['exportOptions']['exportFormats']),
                      filter(lambda v: re.match(prefix, v['name'])),
                      map(lambda v: glom(v, {'key': 'name',
                                             'layout': ('frame', {'left': ('x', round),
                                                                  'top': ('y', round),
                                                                  'width': ('width', round),
                                                                  'height': ('height', round)}) })),
                      sorted(key=lambda p: p['key']),
                      list)
    }

with prettier

def fetch(content, prefix):
    return \
        {
            "parts":
                pipe(parse("$..layers").find(content), mapcat(lambda m: \
                        m.value), filter(lambda v: \
                        v["exportOptions"]["exportFormats"]), filter(lambda \
                        v \
                    : \
                        re.match(prefix, v["name"])), map(lambda v: \
                        glom(v, {
                            "key": "name",
                            "layout":
                                (
                                    "frame",
                                    {
                                        "left": ("x", round),
                                        "top": ("y", round),
                                        "width": ("width", round),
                                        "height": ("height", round)
                                    }
                                )
                        })), sorted(key=lambda p: p["key"]), list)
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions