Giter Club home page Giter Club logo

Comments (11)

geoffreyp avatar geoffreyp commented on June 26, 2024

Can you give me the command line to get this error list ?

from framework.

chkoar avatar chkoar commented on June 26, 2024

mypy

from framework.

geoffreyp avatar geoffreyp commented on June 26, 2024

it is fixed with the PR #46

from framework.

chkoar avatar chkoar commented on June 26, 2024

It is not fixed.

moead_framework/solution/one_dimension_solution.py:9: error: Need type annotation for 'decision_vector' (hint: "decision_vector: List[<type>] = ...")
moead_framework/solution/one_dimension_solution.py:10: error: Need type annotation for 'F' (hint: "F: List[<type>] = ...")
moead_framework/tool/result.py:67: error: Bracketed expression "[...]" is not valid as a type
moead_framework/tool/result.py:67: note: Did you mean "List[...]"?
moead_framework/tool/result.py:69: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "MultiList")
moead_framework/tool/result.py:71: error: Function "numpy.array" is not valid as a type
moead_framework/tool/result.py:71: note: Perhaps you need "Callable[...]" or a callback protocol?
moead_framework/tool/result.py:86: error: np.array? has no attribute "__iter__" (not iterable)
moead_framework/problem/combinatorial/rmnk.py:13: error: Incompatible types in assignment (expression has type "Type[int]", base class "Problem" defined the type as "Type[float]")
moead_framework/problem/combinatorial/mubqp.py:13: error: Incompatible types in assignment (expression has type "Type[int]", base class "Problem" defined the type as "Type[float]")

I propose to avoid the use of types if you are not familiar. Provide enough docstrings and it will be enough currently.

from framework.

chkoar avatar chkoar commented on June 26, 2024

Although, in general, the use of types could reduce the need of docstrings for the API docs.

from framework.

geoffreyp avatar geoffreyp commented on June 26, 2024

I propose to avoid the use of types if you are not familiar. Provide enough docstrings and it will be enough currently.

what do I need to add in the docstring ? Can you give me an example here ?

from framework.

chkoar avatar chkoar commented on June 26, 2024

Check this function.

from framework.

geoffreyp avatar geoffreyp commented on June 26, 2024

Thank you for the example, but what do I need to add in my documentation ?
Currently, I have in my docstrings the type of each parameter and the return of the functions. I had examples in another PR

from framework.

chkoar avatar chkoar commented on June 26, 2024

Thank you for the example, but what do I need to add in my documentation ?

As long as you keep your documentation in good coverage probably you will be ok without annotations.
Although, having annotations is a good thing for several reasons.

The following problems remain.

moead_framework/solution/one_dimension_solution.py:9: error: Need type annotation for 'decision_vector' (hint: "decision_vector: List[<type>] = ...")
moead_framework/solution/one_dimension_solution.py:10: error: Need type annotation for 'F' (hint: "F: List[<type>] = ...")
moead_framework/tool/result.py:82: error: Bracketed expression "[...]" is not valid as a type
moead_framework/tool/result.py:82: note: Did you mean "List[...]"?
moead_framework/tool/result.py:84: error: Incompatible types in assignment (expression has type "List[<nothing>]", variable has type "MultiList")
moead_framework/tool/result.py:86: error: Function "numpy.array" is not valid as a type
moead_framework/tool/result.py:86: note: Perhaps you need "Callable[...]" or a callback protocol?
moead_framework/tool/result.py:101: error: np.array? has no attribute "__iter__" (not iterable)
moead_framework/problem/problem.py:44: error: Argument 1 to "array" has incompatible type "Union[Solution, Sequence[Any]]"; expected "Union[List[Any], List[List[Any]], List[List[List[Any]]], List[List[List[List[Any]]]], Iterable[ndarray[Any]], ndarray[Any]]"
moead_framework/problem/combinatorial/rmnk.py:13: error: Incompatible types in assignment (expression has type "Type[int]", base class "Problem" defined the type as "Type[float]")
moead_framework/problem/combinatorial/mubqp.py:13: error: Incompatible types in assignment (expression has type "Type[int]", base class "Problem" defined the type as "Type[float]")
Found 9 errors in 5 files (checked 71 source files)

from framework.

geoffreyp avatar geoffreyp commented on June 26, 2024

It seems to be solved in #75.
I only have errors on my side with numpy stubs

(framework-dev) ➜  framework git:(issue-45-error-annotation) ✗ mypy moead_framework
moead_framework/tool/mop.py:2: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/core/genetic_operator/combinatorial/crossover.py:2: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/problem/problem.py:4: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/core/genetic_operator/numerical/moead_de_operators.py:2: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/algorithm/abstract_moead.py:3: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/problem/numerical/zdt.py:1: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/problem/combinatorial/rmnk.py:1: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/problem/combinatorial/mubqp.py:1: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/problem/combinatorial/knapsack.py:1: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/tool/result.py:3: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/algorithm/combinatorial/moead_dra.py:1: error: Skipping analyzing 'numpy': found module but no type hints or library stubs
moead_framework/algorithm/combinatorial/moead_dra.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 11 errors in 11 files (checked 71 source files)

from framework.

chkoar avatar chkoar commented on June 26, 2024

It seems to be solved in #75.

Yes, it does.

from framework.

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.