Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language Servers complain 'Cannot access member "shape" for type "None"' #351

Open
kumkee opened this issue Feb 4, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@kumkee
Copy link
Contributor

kumkee commented Feb 4, 2023

Describe the bug

Language Servers, Pyright for example, complain Cannot access member "shape" for type "None"

Steps to reproduce the bug

are_table_rows: List[bool] = [True] * table.df.shape[0]

Pyright complains this line Cannot access member "shape" for type "None"

Expected behavior

The line above should pass all language server test.

Code

import camelot

@cache
def get_table_rows(table: Table) -> List[int]:
    """Get rows with table content."""
    are_table_rows: List[bool] = [True] * table.df.shape[0]
    for col_idx in (df := table.df):
        are_table_rows = [
            a and b for a, b in zip(are_table_rows, df[col_idx] != '')
        ]
    return [i for i in df.index if are_table_rows[I]]

Screenshots

Capture

Environment

  • OS: Ubuntu 22.04.1 LTS
  • Python version: Python 3.10.6
  • Numpy version: 1.24.1
  • OpenCV version: 4.7.0.68
  • Ghostscript version: 9.55.0~dfsg1-0ubuntu5.1
  • Camelot version: 0.10.1

Additional context

The pull request I proposed changing only one line of code should resolve this issue.

@kumkee kumkee added the bug Something isn't working label Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant