Find usage statistics (imports, function calls, attribute access) for Python code-bases

Overview

Python Library stats

This is a small library that allows you to query some useful statistics for Python code-bases. We currently report library imports, function calls and attributes.

Usage

In order to find all uses (imports / function calls / attribute queries) from library over codebase , run the following command:

python main.py --local_dir 
   
     --library_name 
    

    
   

Example

Looking for all torchvision occurrences on the DETR codebase yields:

===========================================================================
                                  Imports
===========================================================================
                                                                    | Count
---------------------------------------------------------------------------
    torchvision                                                     : 4
    torchvision.ops._new_empty_tensor                               : 1
    torchvision.ops.misc._output_size                               : 1
    torchvision.ops.boxes.box_area                                  : 1
    torchvision.transforms                                          : 1
    torchvision.transforms.functional                               : 1
    torchvision.models._utils.IntermediateLayerGetter               : 1
===========================================================================
                                   Calls
===========================================================================
                                                                    | Count
---------------------------------------------------------------------------
    torchvision.__version__.split                                   : 2
    torchvision.ops.boxes.box_area                                  : 2
    torchvision.transforms.RandomCrop.get_params                    : 2
    torchvision._is_tracing                                         : 1
    torchvision.ops.misc._output_size                               : 1
    torchvision.ops._new_empty_tensor                               : 1
    torchvision.ops.misc.interpolate                                : 1
    torchvision.transforms.functional.crop                          : 1
    torchvision.transforms.functional.hflip                         : 1
    torchvision.transforms.functional.resize                        : 1
    torchvision.transforms.functional.pad                           : 1
    torchvision.transforms.functional.to_tensor                     : 1
    torchvision.transforms.RandomErasing                            : 1
    torchvision.transforms.functional.normalize                     : 1
    torchvision.models._utils.IntermediateLayerGetter               : 1
    torchvision.models.{?}                                          : 1
===========================================================================
                                   Attrs
===========================================================================
                                                                    | Count
---------------------------------------------------------------------------
    torchvision.__version__.split                                   : 2
    torchvision.ops.boxes.box_area                                  : 2
    torchvision.datasets.CocoDetection                              : 2
    torchvision.transforms.RandomCrop.get_params                    : 2
    torchvision._is_tracing                                         : 1
    torchvision.ops.misc._output_size                               : 1
    torchvision.ops._new_empty_tensor                               : 1
    torchvision.ops.misc.interpolate                                : 1
    torchvision.transforms.functional.crop                          : 1
    torchvision.transforms.functional.hflip                         : 1
    torchvision.transforms.functional.resize                        : 1
    torchvision.transforms.functional.pad                           : 1
    torchvision.transforms.functional.to_tensor                     : 1
    torchvision.transforms.RandomErasing                            : 1
    torchvision.transforms.functional.normalize                     : 1
    torchvision.models._utils.IntermediateLayerGetter               : 1
    torchvision.models                                              : 1
Owner
Francisco Massa
Francisco Massa
Static type checker for Python

Static type checker for Python Speed Pyright is a fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fas

Microsoft 9.4k Jan 07, 2023
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. — The Jungle Book.

1.4k Dec 29, 2022
A static type analyzer for Python code

pytype - ? ✔ Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
Guesslang detects the programming language of a given source code

Detect the programming language of a source code

Y. SOMDA 618 Dec 29, 2022
An interpreter for the X1 bytecode.

X1 Bytecode Interpreter The X1 Bytecode is bytecode designed for simplicity in programming design and compilation. Bytecode Instructions push

Thanasis Tzimas 1 Jan 15, 2022
Learning source code review, spot vulnerability, find some ways how to fix it.

Learn Source Code Review Learning source code review, spot vulnerability, find some ways how to fix it. WordPress Plugin Authenticated Stored XSS on C

Shan 24 Dec 31, 2022
Turn your Python and Javascript code into DOT flowcharts

Notes from 2017 This is an older project which I am no longer working on. It was built before ES6 existed and before Python 3 had much usage. While it

Scott Rogowski 3k Jan 09, 2023
Calculator Python Package

Calculator Python Package This is a Calculator Package of Python. How To Install The Package? Install packagearinjoyn with pip (Package Installer Of P

Arinjoy_Programmer 1 Nov 21, 2021
Run-time type checker for Python

This library provides run-time type checking for functions defined with PEP 484 argument (and return) type annotations. Four principal ways to do type

Alex Grönholm 1.1k Dec 19, 2022
fixup: Automatically add and remove python import statements

fixup: Automatically add and remove python import statements The goal is that running fixup my_file.py will automatically add or remove import stateme

2 May 08, 2022
Optional static typing for Python 3 and 2 (PEP 484)

Mypy: Optional Static Typing for Python Got a question? Join us on Gitter! We don't have a mailing list; but we are always happy to answer questions o

Python 14.4k Jan 05, 2023
An app to show the total number of lines of code written by an user.

Lines of code Have you ever wondered how many lines of code you wrote in github? This tool will calculate it for you! To calculate the total number of

B.Jothin kumar 10 Jan 26, 2022
A Python utility / library to sort imports.

Read Latest Documentation - Browse GitHub Code Repository isort your imports, so you don't have to. isort is a Python utility / library to sort import

Python Code Quality Authority 5.5k Jan 06, 2023
Typical: Fast, simple, & correct data-validation using Python 3 typing.

typical: Python's Typing Toolkit Introduction Typical is a library devoted to runtime analysis, inference, validation, and enforcement of Python types

Sean 170 Dec 26, 2022
A simple stopwatch for measuring code performance with static typing.

A simple stopwatch for measuring code performance. This is a fork from python-stopwatch, which adds static typing and a few other things.

Rafael 2 Feb 18, 2022
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 966 Dec 29, 2022
The strictest and most opinionated python linter ever!

wemake-python-styleguide Welcome to the strictest and most opinionated python linter ever. wemake-python-styleguide is actually a flake8 plugin with s

wemake.services 2.1k Jan 05, 2023
Checkov is a static code analysis tool for infrastructure-as-code.

Checkov - Prevent cloud misconfigurations during build-time for Terraform, Cloudformation, Kubernetes, Serverless framework and other infrastructure-as-code-languages with Checkov by Bridgecrew.

Bridgecrew 5.1k Jan 03, 2023
The uncompromising Python code formatter

The Uncompromising Code Formatter “Any color you like.” Black is the uncompromising Python code formatter. By using it, you agree to cede control over

Python Software Foundation 30.7k Dec 28, 2022
A static analysis tool for Python

pyanalyze Pyanalyze is a tool for programmatically detecting common mistakes in Python code, such as references to undefined variables and some catego

Quora 212 Jan 07, 2023