-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
* feat: add code from python-analyzer repository * refactor: remove old counter * refactor: fix redeclaration (no block scope) * refactor: fix redeclaration (no block scope) * style: fix various linting errors * style: possible fix for another linting error * style: possible fix for another linting error * style: possible fix for another linting error * style: possible fix for another linting error * fix: build error * fix: possible fix for type error * style: apply automatic fixes of linters Co-authored-by: lars-reimann <lars-reimann@users.noreply.github.com>
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,84 @@ | ||
# Execution of Starter Code | ||
# library-analyzer | ||
|
||
A tool to analyzer client and API code written in Python. | ||
|
||
## Usage | ||
|
||
```text | ||
usage: parse-package [-h] {api,usages,improve} ... | ||
Analyze Python code. | ||
positional arguments: | ||
{api,usages,improve} | ||
api List the API of a package. | ||
usages Find usages of API elements. | ||
improve Suggest how to improve an existing API. | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
``` | ||
|
||
### api command | ||
|
||
```text | ||
usage: parse-package api [-h] -p PACKAGE -o OUT | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
-p PACKAGE, --package PACKAGE | ||
The name of the package. It must be installed in the current interpreter. | ||
-o OUT, --out OUT Output directory. | ||
``` | ||
|
||
### usages command | ||
|
||
```text | ||
usage: parse-package usages [-h] -p PACKAGE -s SRC -t TMP -o OUT | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
-p PACKAGE, --package PACKAGE | ||
The name of the package. It must be installed in the current interpreter. | ||
-s SRC, --src SRC Directory containing Python code. | ||
-t TMP, --tmp TMP Directory where temporary files can be stored (to save progress in case the program crashes). | ||
-o OUT, --out OUT Output directory. | ||
``` | ||
|
||
### improve command | ||
|
||
```text | ||
usage: parse-package improve [-h] -a API -u USAGES -o OUT [-m MIN] | ||
optional arguments: | ||
-h, --help show this help message and exit | ||
-a API, --api API File created by the 'api' command. | ||
-u USAGES, --usages USAGES | ||
File created by the 'usages' command. | ||
-o OUT, --out OUT Output directory. | ||
-m MIN, --min MIN Minimum number of usages required to keep an API element. | ||
``` | ||
|
||
### Example usage | ||
|
||
1. Install Python 3.9. | ||
2. Install [poetry](https://python-poetry.org/docs/master/#installation). | ||
3. **Only the first time**, install dependencies: | ||
1. Install [poetry](https://python-poetry.org/docs/master/#installation). | ||
1. **Only the first time**, install dependencies: | ||
```shell | ||
poetry install | ||
``` | ||
4. Run the tool: | ||
1. Create a shell with poetry: | ||
```shell | ||
poetry shell | ||
``` | ||
1. Run the commands described above: | ||
```shell | ||
# Step 1: | ||
parse-package api -p sklearn -o out | ||
# Step 2: | ||
parse-package usages -p sklearn -s "Kaggle Kernels" -t tmp -o out | ||
# Step 3: | ||
parse-package improve -a "out/scikit-learn__sklearn__1.0__api.json" -u "out/scikit-learn__sklearn__1.0__usages.json" -o out | ||
``` |