Comments (11)
Can you give me the command line to get this error list ?
from framework.
mypy
from framework.
it is fixed with the PR #46
from framework.
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.
Although, in general, the use of types could reduce the need of docstrings for the API docs.
from framework.
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.
Check this function.
from framework.
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.
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.
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.
It seems to be solved in #75.
Yes, it does.
from framework.
Related Issues (20)
- [joss-reviews#2974] Paper: further clarify statement of need HOT 1
- [joss-reviews#2974] Paper: grammar/spelling HOT 3
- Confusing OneDimensionalSolution.__repr__ HOT 2
- [Documentation] Include example of how to use results HOT 1
- [Documentation] irrelevant __init__ instruction on documentation for e.g. aggregation functions HOT 4
- Add development requirements HOT 1
- Disambiguate usage of the word 'generate' for Problems HOT 4
- [Documentation] Problems considered 'main component' of MOEA/D algorithm? HOT 2
- Remove docs/html folder from master branch? HOT 2
- [joss-reviews#2974] Ztd1 unfriendly error message HOT 1
- [joss-reviews#2974] Empty initializer HOT 1
- [joss-reviews#2974] Naming confusion HOT 3
- __init__.py HOT 1
- [joss-reviews#2974] Improve documentation/README for support HOT 1
- [joss-reviews#2974] Many component combinations not possible? HOT 3
- [joss-reviews#2974] Checkpoints used inconsistently HOT 3
- [joss-reviews#2974] Functionality HOT 7
- [joss-reviews#2974] Software paper HOT 12
- [joss-reviews#2974] Documentation HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.