Giter Club home page Giter Club logo

convtools-ita's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

convtools-ita's Issues

[BUG] Impossible to pass a string with "%" symbols to aggregate conversion

Describe the bug
Impossible to pass a string with "%" symbols to aggregate conversion

To Reproduce

from convtools import conversion as c
from datetime import datetime

c.aggregate(
    c.ReduceFuncs.Array(c.call_func(datetime.strptime, c.this(), "%Y-%m-%d"))
).gen_converter(debug=True)

Raises: TypeError: not enough arguments for format string

Desktop (please complete the following information):

  • Version 0.15.1

[BUG] Piping reducer result to aggregation fails

Describe the bug

from convtools import conversion as c

merger = c.aggregate(
    {
        "value1": c.ReduceFuncs.First(
            c.item("value1"), where=c("value1").in_(c.this())
        ),
        "value2": c.ReduceFuncs.First(
            c.item("value2"), where=c("value2").in_(c.this())
        ),
    }
)
c.group_by(c.item("first_id"), c.item("date")).aggregate(
    {
        "first_id": c.item("first_id"),
        "date": c.item("date"),
        "data": c.ReduceFuncs.Array(c.this()).pipe(merger),
    }
).gen_converter(debug=True)

Version 0.13.2

Expected behavior
This should work.

Workaround
It works if we gen_converter for merger first

Question on empty items

Let's say I have a conversion like:

c({
  'address1': c.item('address1'),
  'address2': c.item('address2'),
})

and my input can be like:

items = [
{ 'address1': '221B Baker Street' },
{ 'address1': '10 Downing Street', 'address2': 'Suite 100'}
]

I can use c.item('address2', default=None) to make address2 be None, but what if I don't want the key to be in the resulting conversion at all, i.e.:

{ 'address1': '10 Downing Street' }

This is a pretty regular occurrence in my data conversions, so having to pipe the output and use a bunch of c.if's ends up being quite verbose.

[BUG] aggregate results are incorrect because of invalid checksum/break code placing

Describe the bug

def test_aggregate_no_init_loops():
    converter = c.aggregate(
        {
            "first_a": c.ReduceFuncs.First(c.item("a"), where=c.item("b") > 0),
            "list_b": c.ReduceFuncs.Array(c.item("b"), where=c.item("a") > 0),
        }
    ).gen_converter(debug=True)
    assert converter(
        [
            {"a": 1, "b": 0},
            {"a": 2, "b": 1},
            {"a": 3, "b": 2},
            {"a": 4, "b": 3},
        ],
    ) == {
        "first_a": 2,
        "list_b": [0, 1, 2, 3],
    }

The above breaks because of invalid checksum/break code placing.

Desktop (please complete the following information):

  • Version 0.13.3

Adding imports to inlined expressions

If you want to inline an expression, is there a way to add imports to the generated code? Example:

c({
 "date": c.inline_expr("my_custom_date_formatter({dt})".pass_args(dt=c.item("date")),
}).gen_converter()

You cannot add an import directly inline because the value is being assigned. i.e.:

c({
 "date": c.inline_expr("from my_library import my_custom_date_formatter\n 
  my_custom_date_formatter({dt})".pass_args(dt=c.item("date")),
}).gen_converter()

Thanks.

[BUG] right join doesn’t work

Describe the bug
Right join causes the swap of left and right collections, while the conditions remain the same

To Reproduce
Steps to reproduce the behavior:

  1. ...

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.