Commit graph

12 commits

Author SHA1 Message Date
Chenguang Zhu
7cb229d175
Implement lazy loading mechanism for QualifiedNameProvider (#720)
* Implement lazy loading mechanism for expensive metadata providers
* Add support for lazy values in metadata matchers
* Fix type issues and implement lazy value support in base metadata provider too
* Add unit tests for BaseMetadataProvider

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
2022-07-09 08:34:29 +01:00
Zsolt Dollenstein
c44ff0500b
Fix license headers (#560)
* Facebook -> Meta

* remove year from doc copyright
2021-12-28 11:55:18 +00:00
John Reese
10c3aa09a7
Upgrade to µsort 1.0.0rc1, and apply formatting changes (#565)
* Upgrade to usort==1.0.0rc1

* Apply sorting changes from usort 1.0.0rc1

* reapply codegen

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
2021-12-21 14:55:04 -08:00
Steven Troxler
5e1e3fe970
The ufmt tool combines usort and black with a consistent wrapper, (#515)
which ensures we won't have inconsistent black-vs-isort errors
going forward. We can always format by running `ufmt format .`
at the root, and check with `ufmt check .` in our CI actions.
2021-08-25 20:39:29 -04:00
jimmylai
c023fa7c4c
[typing] enable Pyre strict mode by default (#313)
Co-authored-by: Jimmy Lai <jimmylai@fb.com>
2020-06-12 18:24:18 -07:00
Tim Hatch
11b98551c7 Improve KeyError on missing metadata.
Fixes #250
2020-03-05 06:57:48 -08:00
Jimmy Lai
b3fd4cf268 [metadata] fix typo and improve error message 2019-11-18 16:56:17 -08:00
Benjamin Woodruff
194a930f64 Make BaseMetadataProvider[T] covariant over T
Because we'd consider `BaseMetadataProvider[int]` to be a subtype of
`BaseMetadataProvider[object]`, it should be covariant over its
typevar, rather than invariant.

This isn't entirely correct because we have a mutable data structure
(`_computed`) that depends on the typevar, and pyre points this out
(though with a really confusing error message). However, it's not
correct to say that `BaseMetadataProvider` is invariant either, so I
think this is the lesser evil.

I don't think it's practical to redesign this API to avoid the variance
issue, so I'm ignoring the new type error that results from this change.

I think this may resolve some of the issues we've seen internally with
D17820032.
2019-10-10 18:08:44 -07:00
Jennifer Taylor
8a8ea4b27b Upgrade Pyre to 0.32.
This fixes a TODO, removes several ignore statements and most importantly, addresses a massive speed regression triggered by importing matchers.
2019-10-04 11:05:37 -07:00
Jennifer Taylor
fb4785cfa1 Bump pyre version to 0.0.30.
This introduces a few new gotchas (namely attribute access and a bug with
Union[Callable]), but it also removes a whole host of pyre-fixmes and gets us
updated to a release of pyre that came out after May.
2019-09-25 12:04:33 -07:00
Jennifer Taylor
fc430343b5 Fix internal underscore convention.
Standardize on the convention that private modules (those we don't expect people to directly import) are prefixed with an underscore. Everything under a directory/module that has an underscore is considered private, unless it is re-exported from a non-underscored module. Most things are exported from libcst directly, but there are a few things in libcst.tool, libcst.codegen and libcst.metadata that are namedspaced as such.
2019-09-17 13:52:42 -07:00
Jimmy Lai
213b335cd5 move metadata providers its data structures to libcst.metadata 2019-09-16 19:53:22 -07:00
Renamed from libcst/metadata/dependent.py (Browse further)