Skip to content
Permalink
Branch: master
Commits on Aug 14, 2019
  1. callgraph_test: also exclude typed_ast imports in lower versions.

    rchen152 committed Aug 14, 2019
    I forgot to do this the first time around ><
    
    PiperOrigin-RevId: 263446233
  2. Only run xref.callgraph_test in Python 3.5-6.

    rchen152 committed Aug 14, 2019
    This workaround is ugly, but I dug a bit more into how the opensource tests
    run, and the only alternative I can think of is to change
    https://github.com/google/pytype/blob/ae5e632bd85f57f73630bef9932e05a9d84fa98f/cmake/modules/PyTypeUtils.cmake#L40
    to add separate test_all_27, ..., test_all_37 targets that each omit certain
    tests, and that seems pretty terrible as well.
    
    PiperOrigin-RevId: 263433508
  3. Improve usability of pytype.io.

    rchen152 committed Aug 14, 2019
    * Makes the loader object optional for all public functions in io.py, since we
      don't expose the load_pytd module.
    * Reorders some parameters so the order is always options, then loader.
    * Makes the errorlog a returned value instead of a parameter that is passed in
      to be modified - this is just a better design =P
    * Makes the config object optional for check_py and generate_pyi, to make the
      default options easier to use.
    * Exposes the errors module as part of io_lib, since we have public functions
      that return errors.ErrorLog objects.
    
    PiperOrigin-RevId: 263417060
  4. Add missing BaseException.__suppress_context__ attribute.

    rchen152 committed Aug 14, 2019
    Fixes #367.
    
    PiperOrigin-RevId: 263410172
Commits on Aug 10, 2019
  1. Merge pull request #382 from google/google_sync

    rchen152 committed Aug 10, 2019
    Google sync
Commits on Aug 9, 2019
  1. Fix a parse error caused by typing.Literal.

    rchen152 committed Aug 9, 2019
    typeshed has started using typing.Literal, and our attempt to partially support
    it was causing a parse error.
    
    After this, I think the PyPI release is finally actually ready...
    
    PiperOrigin-RevId: 262661172
  2. Remove DESCRIPTION.rst.

    rchen152 committed Aug 9, 2019
    #381 updates pytype to directly use
    README.md for the PyPI description, so we no longer need this file.
    
    PiperOrigin-RevId: 262647283
  3. Update README to include all current pytype subtools.

    rchen152 committed Aug 9, 2019
    PiperOrigin-RevId: 262610790
  4. Make pytd_utils publicly available.

    rchen152 committed Aug 9, 2019
    The immediate motivation for making this public is that I want to use
    pytd_utils.JoinTypes in tyre, but I've been thinking for a while that it makes
    sense to make the pytd utilities public since the definitions already are.
    
    Untangling pytd_utils from :pytd_for_parser also allowed me to break the
    circular dependency between pytd and pytd_utils by removing pytd.Print.
    
    * Moves all uses of pytd.Print to pytd_utils.Print.
    * Creates new targets pytd_utils and parse_constants and adds pytd_utils to
      public target pytd_lib.
    * Turns the ASTeq and ASTdiff methods on pytd.TypeDeclUnit into functions in
      pytd_utils instead. ASTdiff needs to be moved because it depends on
      pytd_utils.Print, and I moved ASTeq as well for consistency.
    * Deletes pytd.Print.
    * Moves three visitors that pytd_utils depends on - CollectTypeParameters,
      ExtractSuperClasses, and PrintVisitor - into pytd_visitors, since pytd_utils
      can't depend on visitors.
    * Alphabetizes the visitors in pytd_visitors for easier future maintenance.
    * Corrects lint errors.
    
    #Squeegee
    
    PiperOrigin-RevId: 262607897
  5. Cleanup the pytype BUILD and CMake files.

    rchen152 committed Aug 9, 2019
    * Removes a stray srcs entry in :pytd.
    * Reorders CMakeLists.txt to follow the BUILD file.
    
    PiperOrigin-RevId: 262604270
  6. Merge pull request #381 from google/desc

    rchen152 committed Aug 9, 2019
    Use README.md for the PyPI description.
  7. Use README.md for the PyPI description.

    rchen152 committed Aug 9, 2019
    As it turns out, reStructuredText is not happy with unicode characters.
    But since March 2018, PyPI has allowed using markdown for the long
    description, which works: https://test.pypi.org/project/pytype/.
  8. Merge pull request #380 from google/annotate

    rchen152 committed Aug 9, 2019
    Add an entrypoint for annotate-ast to setup.py.
  9. Add an entrypoint for annotate-ast to setup.py.

    rchen152 committed Aug 9, 2019
  10. Merge pull request #378 from google/google_sync

    rchen152 committed Aug 9, 2019
    Google sync
  11. Fix a Python 3.7 bug in traces.

    rchen152 committed Aug 9, 2019
    This came up in the opensource tests - in 3.7, a new CALL_METHOD opcode was
    added. I thought about whether traces_test should use pytype.tests.test_base in
    order to test in every target Python version in every host version, but that
    seems like overkill for now.
    
    PiperOrigin-RevId: 262597779
Commits on Aug 8, 2019
  1. Prepare pytype for the next PyPI release.

    rchen152 committed Aug 8, 2019
    * Updates the version and CHANGELOG.
    * Makes xref:indexer_test and xref:parse_args_test runnable on Travis. We
      should have some testing, since we offer the pyxref tool.
    * Adds a missing line to annotate_ast/CMakeLists.txt and removes an unnecessary
      dep and unused library from xref/BUILD.
    * Corrects lint warnings.
    
    Once this change is exported to GitHub, I'll follow up with a PR to add an
    entrypoint for annotate-ast to setup.py and install typed_ast for Travis tests.
    
    PiperOrigin-RevId: 262444374
  2. Implement MatchAstVisitor.match_Call.

    rchen152 committed Aug 8, 2019
    * Augments the call_function traces to include the return value.
    * Adds MatchAstVisitor.match_Call, including a _get_node_name method to get the
      function name from the node.
    * Adds tests, which involved splitting up MatchAstVisitorTest and replacing
      assertTraceEqual with assertTracesEqual to reduce boilerplate.
    
    PiperOrigin-RevId: 262425913
  3. Fix a bad function name in pytype error messages.

    rchen152 committed Aug 8, 2019
    For nested classes, we were repeating the class prefix in the function name.
    While adding a test, I also noticed that an old test wasn't actually running
    because the "test" prefix in the method name was missing, so I fixed that also.
    
    PiperOrigin-RevId: 262399833
  4. Revert tyre changes to the kythe indexer.

    rchen152 committed Aug 5, 2019
    tyre is now using the underlying traces library, so these changes to make
    xref.indexer track pytd types are no longer needed.
    
    I also added a traces test for converting unknowns to Any, which was covered by
    the xref.indexer tests that I'm removing.
    
    PiperOrigin-RevId: 261801244
  5. Partially support typing.Literal matching.

    rchen152 committed Aug 5, 2019
    * Removes the keep_literals test flag and converts literals to abstract values
      in a safe way in convert.py. Converting an instance of a literal works
      properly, but converting the literal type itself for now just returns the
      type of the value while throwing away the fact that we had a literal value.
    * Adds some tests with a lot of TODOs.
    * Tweaks some visitors to account for pytd.Literal natively representing a
      generic type and nested constants now being possible (Literal[True]).
    * Reports [not-supported-yet] for creating literals in source files.
    * Allows importing Literal from both typing and typing_extensions. This is
      easier to implement and also will make the pytype change easier when Literal
      makes the move from typing_extensions to typing.
    
    #Sqeegee
    
    PiperOrigin-RevId: 261792433
  6. Revert annotate_ast changes to the kythe indexer.

    rchen152 committed Aug 5, 2019
    This looks like it was an earlier iteration of pytype/tools/annotate_ast, so
    I'm guessing it's not needed anymore.
    
    PiperOrigin-RevId: 261773052
  7. Update annotate_ast to use the new traces library.

    rchen152 committed Aug 5, 2019
    * Uses traces.trace() and traces.MatchAstVisitor to simplify annotate_ast.
    * Also makes two small unrelated fixes that I happened to notice: the filename
      doesn't need to be a separate argument because it's a pytype option, and the
      Python version should be `python_version`, not `version`. (The Options object
      accepted the latter because there happens to be an unrelated option, the
      pytype version, called `version`...)
    
    PiperOrigin-RevId: 261763276
  8. Implement abstract.BuildClass.to_type().

    rchen152 committed Aug 5, 2019
    The __build_class__ builtin is a function that creates a new class. It needs a
    to_type() implementation because it appears in opcode traces.
    
    PiperOrigin-RevId: 261712600
  9. Merge pull request #377 from google/travis

    rchen152 committed Aug 8, 2019
    Install typed_ast before running Travis tests.
  10. Install typed_ast before running Travis tests.

    rchen152 committed Aug 8, 2019
Commits on Aug 7, 2019
  1. Merge pull request #373 from google/setup

    rchen152 committed Aug 7, 2019
    Add new pytype/tools/ subdirs to `packages` in setup.py.
Commits on Aug 5, 2019
  1. Add new pytype/tools/ subdirs to `packages` in setup.py.

    rchen152 committed Aug 5, 2019
    Fixes #372.
Commits on Aug 3, 2019
  1. Merge pull request #370 from google/google_sync

    rchen152 committed Aug 3, 2019
    Google sync
  2. Tweak traces to get the opensource tests passing.

    rchen152 committed Aug 3, 2019
    * Removes some google-isms from the tests.
    * Accommodates some changes to the ast module in 3.7.
    
    PiperOrigin-RevId: 261421809
  3. Remove deleted pytd files from CMakeLists.txt.

    rchen152 committed Aug 2, 2019
    PiperOrigin-RevId: 261416174
  4. Implement pytype.tools.traces.traces.MatchAstVisitor.

    rchen152 committed Aug 2, 2019
    * Adds match_Attribute, match_Import, and match_Name. These node types are the
      ones that generate references, so MatchAstVisitor will produce all the types
      that the indexer currently does, plus some types for definitions.
    * Uses the new match methods in xref/indexer.py.
    
    PiperOrigin-RevId: 261402829
  5. Add pytype.tools.traces.traces.trace().

    rchen152 committed Aug 2, 2019
    * Implements the traces.trace() method that generates pytd traces.
    * For now, the only place this method is used is in traces_test, but it'll make
      writing tests for traces.MatchAstVisitor easier.
    
    PiperOrigin-RevId: 261391277
  6. Add the skeleton for pytype.tools.traces.traces.MatchAstVisitor.

    rchen152 committed Aug 2, 2019
    * Adds an AbstractTrace class to wrap traces.
    * Adds a VmTrace subclass of AbstractTrace for use by xref/indexer.py.
    * Moves the assign lineno tracking to a new MatchAstVisitor, which will
      eventually use the information to implement match_Name.
    * Adds MatchAstVisitor.match, which for now raises NotImplementedError for
      every node type.
    
    PiperOrigin-RevId: 261388232
  7. Add tests for pytype.tools.traces.source.

    rchen152 committed Aug 1, 2019
    * Adds source_test.
    * Fixes off-by-one errors in get_closest_line_range, next_non_comment_line.
    * Renames find_text to find_first_text.
    * Adds and standardizes docstrings.
    
    PiperOrigin-RevId: 261148510
You can’t perform that action at this time.