Skip to content

Fix doc warnings #287

Closed
Closed

Description

@oyamad
  • Unknown sections
    • Unknown section Return
    • Unknown section Parameters:
    • Unknown section Returns:

Example: https://github.com/QuantEcon/QuantEcon.py/blob/master/quantecon/cartesian.py#L16
Change Parameters: to Parameters

Activity

  1. oyamad commented on Feb 23, 2017

    @oyamad
    MemberAuthor
    • WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/game_theory/mclennan_tourky.py:docstring of quantecon.game_theory.mclennan_tourky.mclennan_tourky:18: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/game_theory/normal_form_game.py:docstring of quantecon.game_theory.normal_form_game.NormalFormGame:10: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/game_theory/normal_form_game.py:docstring of quantecon.game_theory.normal_form_game.Player.best_response:6: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/game_theory/normal_form_game.py:docstring of quantecon.game_theory.normal_form_game.Player.best_response:17: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/game_theory/normal_form_game.py:docstring of quantecon.game_theory.normal_form_game.Player.best_response:34: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/game_theory/normal_form_game.py:docstring of quantecon.game_theory.normal_form_game.Player.payoff_vector:12: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/game_theory/random.py:docstring of quantecon.game_theory.random.covariance_game:24: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/game_theory/random.py:docstring of quantecon.game_theory.random.random_game:17: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/core.py:docstring of quantecon.markov.core.MarkovChain.is_aperiodic:0: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/core.py:docstring of quantecon.markov.core.MarkovChain.num_recurrent_classes:3: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/core.py:docstring of quantecon.markov.core.MarkovChain.recurrent_classes:0: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/core.py:docstring of quantecon.markov.core.mc_sample_path:27: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/ddp.py:docstring of quantecon.markov.ddp.DiscreteDP.operator_iteration:12: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/ddp.py:docstring of quantecon.markov.ddp.DiscreteDP.operator_iteration:13: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/random.py:docstring of quantecon.markov.random.random_discrete_dp:45: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/random.py:docstring of quantecon.markov.random.random_markov_chain:27: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/random.py:docstring of quantecon.markov.random.random_stochastic_matrix:26: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/random.py:docstring of quantecon.markov.random.random_stochastic_matrix:31: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/random/utilities.py:docstring of quantecon.random.utilities.probvec:20: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/random/utilities.py:docstring of quantecon.random.utilities.sample_without_replacement:24: WARNING: Block quote ends without a blank line; unexpected unindent.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/compute_fp.py:docstring of quantecon.compute_fp.compute_fixed_point:57: WARNING: Block quote ends without a blank line; unexpected unindent.
  2. oyamad commented on Feb 23, 2017

    @oyamad
    MemberAuthor
    • WARNING: Inline * start-string without end-string.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/markov/ddp.py:docstring of quantecon.markov.ddp.DiscreteDP:85: WARNING: Inline substitution_reference start-string without end-string.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/quad.py:docstring of quantecon.quad.quadrect:13: WARNING: Inline emphasis start-string without end-string.
    /Applications/anaconda/lib/python3.6/site-packages/quantecon/quad.py:docstring of quantecon.quad.quadrect:13: WARNING: Inline strong start-string without end-string.
  3. mmcky commented on Feb 23, 2017

    @mmcky
    Contributor

    Thanks @oyamad. This is helpful. I will add a review of readthedocs to my list.

  4. self-assigned this
    on Feb 23, 2017
  5. oyamad commented on Feb 23, 2017

    @oyamad
    MemberAuthor
  6. oyamad commented on Feb 23, 2017

    @oyamad
    MemberAuthor

    These pages display the docstrings locally on my machine.

  7. oyamad commented on Feb 23, 2017

    @oyamad
    MemberAuthor

    I guess this line has to be updated.

    Does any process update this file rtd-environment.yml automatically?

  8. mmcky commented on Feb 23, 2017

    @mmcky
    Contributor

    This is looking better: http://quanteconpy.readthedocs.io/en/rtd-env-update/
    Once it passes tests I will merge to fix missing pages.

  9. oyamad commented on Feb 23, 2017

    @oyamad
    MemberAuthor

    Very good.

    What is the difference between "stable" and "latest"? I thought "stable" is from the released version and "latest" from master, but it seems not the case.

  10. mmcky commented on Feb 23, 2017

    @mmcky
    Contributor

    we just had the same thought :). I am looking into that now in the rtd setup. I agree. I think stable should be the latest release and latest should be master.

  11. 10 remaining items

  12. oyamad commented on Feb 26, 2017

    @oyamad
    MemberAuthor

    The problem is that the list of parameter types is too long that

    def random_game(nums_actions, random_state=None):
        """
        ...
    
        Parameters
        ----------
        ...
    
        random_state : scalar(int) or np.random.RandomState, optional(default=None)

    would exceed the maximum line length 72 for docstrings.

    One option is to shorten the description to

        random_state : int or np.random.RandomState, optional(default=None)

    or

        random_state : scalar(int) or np.random.RandomState, optional
  13. shizejin commented on Feb 26, 2017

    @shizejin
    Member

    It seems that docs of Numpy are using the latter one, and declare the default value in the detailed descriptions of parameters. Should I apply this modification to the files with warning messgaes?

  14. oyamad commented on Feb 26, 2017

    @oyamad
    MemberAuthor

    What are the other cases that yield the unexpected unindent warning?

  15. shizejin commented on Feb 26, 2017

    @shizejin
    Member

    I have checked all the Block quote ends without a blank line; unexpected unindent. warning message, and they are all in this case.

  16. shizejin commented on Feb 26, 2017

    @shizejin
    Member

    Other than these warnings, the only one left is /quantecon/markov/ddp.py:docstring of quantecon.markov.ddp.DiscreteDP:85: WARNING: Inline substitution_reference start-string without end-string.

    * Transition probabilities q(s'|s, a):
    
    q(0|0, 0) = 0.5, q(1|0, 0) = 0.5,
    q(0|0, 1) = 0,   q(1|0, 1) = 1,
    q(0|1, 0) = 0,   q(1|1, 0) = 1
    

    And this is caused by using s'. As it is not appropriate to bracket it with "`", maybe we could replace it with another expression?

  17. oyamad commented on Feb 26, 2017

    @oyamad
    MemberAuthor

    @shizejin Will you change all the s' in the docstring of DiscreteDP (lines 121-284) and in solve (line 651) to s_next (and keep the others)? Thanks!

  18. oyamad commented on Feb 26, 2017

    @oyamad
    MemberAuthor

    There is one more in compute_fp.py.

    Please change

        method : str in {'iteration', 'imitation_game'},
                 optional(default='iteration')
            Method of computing an approximate fixed point

    to

        method : str in {'iteration', 'imitation_game'}, optional
            Method of computing an approximate fixed point
            (default='iteration')
  19. oyamad commented on Feb 26, 2017

    @oyamad
    MemberAuthor

    Regarding random_state:

    Please change

        random_state : scalar(int) or np.random.RandomState,
                       optional(default=None)

    to

        random_state : int or np.random.RandomState, optional(default=None)

    (I think this looks better.)

  20. shizejin commented on Feb 26, 2017

    @shizejin
    Member

    Changes have been done.

    Other than cases that can be solved by changing scalar(int) to int and optional(default=None) to optional, there are two types of Block quote ends without a blank line; unexpected unindent. warning messgaes left.

    1. In ddp.py and random.py, with long sets, e.g.
    method : str in {'value_iteration', 'vi', 'policy_iteration',
                         'pi', 'modified_policy_iteration', 'mpi'},
                optinal(default='policy_iteration')
                Solution method.
    
    1. In normal_form_game.py,
        data : array_like(Player) or array_like(int, ndim=1) or
               array_like(float, ndim=2 or N+1)
    

    How to deal with these?

  21. mmcky commented on Feb 26, 2017

    @mmcky
    Contributor

    Hey @shizejin and @oyamad. Just letting you know I am running some setup workshops today for some new QuantEcon RA's. So I won't get to look into this issue until tomorrow (most likely). I wonder if there is a numpydoc linter that we can use? It might be a useful approach to catch these errors in the editor.

  22. oyamad commented on Mar 10, 2017

    @oyamad
    MemberAuthor

    @shizejin

    1. Please change
            method : str in {'value_iteration', 'vi', 'policy_iteration',
                             'pi', 'modified_policy_iteration', 'mpi'},
                     optinal(default='policy_iteration')
                Solution method.

    to

            method : str, optinal(default='policy_iteration')
                Solution method, str in {'value_iteration', 'vi',
                'policy_iteration', 'pi', 'modified_policy_iteration',
                'mpi'}.

    and

        format : str in {'bsr', 'csr', 'csc', 'coo', 'lil', 'dia', 'dok'},
                 optional(default='csr')
            Sparse matrix format. Relevant only when sparse=True.

    to

        format : str, optional(default='csr')
            Sparse matrix format, str in {'bsr', 'csr', 'csc', 'coo', 'lil',
            'dia', 'dok'}. Relevant only when sparse=True.
    1. Change
        data : array_like(Player) or array_like(int, ndim=1) or
               array_like(float, ndim=2 or N+1)

    to

        data : array_like of Player, int (ndim=1), or float (ndim=2 or N+1)

    Thanks!

  23. shizejin commented on Mar 12, 2017

    @shizejin
    Member

    Sure. I have done these changes.

    Also, in the normal_form_game.py, I change

            opponents_actions : array_like(int or array_like(float)) or
                                array_like(int, ndim=1) or scalar(int)

    to

            opponents_actions : array_like(int or array_like(float)) or int

    I omit "array_like(int, ndim=1)" as I think it is included in "array_like(int or array_like(float))", and otherwise I can not shorten the sentence to be under 79. Do you think this change is acceptable?

    Now that there is no any warning message, I will do PR if you think it's okay.

  24. oyamad commented on Mar 14, 2017

    @oyamad
    MemberAuthor

    "array_like(int, ndim=1)" should have been "array_like(float, ndim=1)".
    The maximum line length is 72 for docstrings, if we want to strictly follow PEP 8.

    What about just

            opponents_actions : scalar(int) or array_like
  25. shizejin commented on Mar 14, 2017

    @shizejin
    Member

    Looks concise and accurate. Should I do PR based on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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