Code Monkey home page Code Monkey logo

Comments (2)

mski-iksm avatar mski-iksm commented on August 23, 2024 1

@naokimaejima @nersonu

Thank you for raising interesting issue.

Is it conceivable to eliminate the L235-236 and L265-266 process?

I agree with your idea.

As @naokimaejima mentioned, this behavior is caused because of following code.

if target is None and isinstance(data, dict) and len(data) == 1: 
     return list(data.values())[0] 

This is implemented to make loading easier when using default requires().

class A(gokart.TaskOnKart):
    task = gokart.TaskInstanceParameter()

    def run(self):
        a = self.load()

In the above example, self.load() is possible because of the default requires() inherited from TaskOnKart.
https://github.com/m3dev/gokart/blob/master/gokart/task.py#L92

The default requires() will return a dict of gokart.TaskInstanceParameter().
Therefore, when single task is declared, loading it should be done as list(self.load())[0].
When single task is declared, the mentioned code snippet will work and return single task instead the dict which will allow loading with self.load().

However, I think the benefit of this implementation is very limited and disadvantage caused by confusion is more significant.
So I think removing this implementation is good idea.

PR is welcome!

from gokart.

nersonu avatar nersonu commented on August 23, 2024

@hirosassa @Hi-king
When parsing JSON, it is often the case that the dict root key has a length of 1.
It seems to me that if you want to include a process to distinguish between a dict that is the result of a task and a dict specified in requires, you would have to change luigi.
Is it conceivable to eliminate the L235-236 and L265-266 process?

from gokart.

Related Issues (20)

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.