Giter VIP home page Giter VIP logo

Comments (9)

ecederstrand avatar ecederstrand commented on September 25, 2024

I think this is just Pyright not being able to understand the code properly. I don't see anything wrong.

from exchangelib.

DeflateAwning avatar DeflateAwning commented on September 25, 2024

Just opened an issue at Pyright: microsoft/pyright#7378

from exchangelib.

DeflateAwning avatar DeflateAwning commented on September 25, 2024

Welp, pyright is blaming this repo for the error. Looking myself, it looks like it is perhaps an issue here. I think maybe we just need to export the list of attributes in an __all__ = [...] list. I'd have to look at it harder though.

from exchangelib.

hmc-cs-mdrissi avatar hmc-cs-mdrissi commented on September 25, 2024

pydanny/cached-property#172 is probably real issue. threaded_cached_property doesn't play well with static analysis tools in general.

The easiest trick,

if TYPE_CHECKING:
  my_prop = property
else:
  my_prop = threaded_cached_property

from exchangelib.

ecederstrand avatar ecederstrand commented on September 25, 2024

Most of exchangelib was written long before type annotations became a Python feature. Adding full annotations is a huge effort that I will not undertake myself, at least.

from exchangelib.

DeflateAwning avatar DeflateAwning commented on September 25, 2024

I wasn't suggesting that we need full annotations; I do however thing that it makes sense to add hints on parts that are being labelled as errors

from exchangelib.

ecederstrand avatar ecederstrand commented on September 25, 2024

In this case, it looks like the real issue lies in the cached-property package. I think the issue should be solved there.

There are other places where static type checkers have a hard time reasoning about exchangelib code. I haven't seen any cases where there were actual errors, and refactoring turned out to be a lot of work for very little gain.

I'm closing this issue because exchangelib doesn't use Pyright. I'm not generally opposed to doing so, but please work on adding support in a PR instead.

from exchangelib.

DeflateAwning avatar DeflateAwning commented on September 25, 2024

@ecederstrand, would you be willing to help me write an issue for this in the cached-property package? Or at least point me to the part where that issue needs to be referenced as an example of the issue?

from exchangelib.

hmc-cs-mdrissi avatar hmc-cs-mdrissi commented on September 25, 2024

The issue already exists. pydanny/cached-property#172 is the correct issue. Fixing that will fix the problem here.

from exchangelib.

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.