diff --git a/README.md b/README.md index b7498161..5172d932 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![paroxython SLOC](https://img.shields.io/badge/main%20program-~1850%20SLOC-blue)](https://github.com/laowantong/paroxython/blob/master/paroxython) [![tests SLOC](https://img.shields.io/badge/tests-~2550%20SLOC-blue)](https://github.com/laowantong/paroxython/blob/master/tests) [![helpers SLOC](https://img.shields.io/badge/helpers-~950%20SLOC-blue)](https://github.com/laowantong/paroxython/blob/master/helpers) -[![spec features](https://img.shields.io/badge/spec-171%20features-blue)](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/spec.md) +[![spec features](https://img.shields.io/badge/spec-172%20features-blue)](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/spec.md) [![taxonomy mappings](https://img.shields.io/badge/taxonomy-280%20mappings-blue)](https://github.com/laowantong/paroxython/blob/master/paroxython/resources/taxonomy.tsv) ![GitHub commit activity](https://img.shields.io/github/commit-activity/y/laowantong/paroxython.svg?style=flat) [![Downloads](https://pepy.tech/badge/paroxython/week)](https://pepy.tech/project/paroxython/week) @@ -158,7 +158,7 @@ If you use Jupyter notebook/lab, you've also just installed a so-called magic co %load_ext paroxython ``` -This should print `"paroxython 0.6.2 loaded."`. Run it on a cell of Python code: +This should print `"paroxython 0.6.3 loaded."`. Run it on a cell of Python code: ```python %%paroxython # Lines @@ -180,7 +180,7 @@ def fibonacci(n): # 2 | `flow/loop/while` | 5-7 | | `meta/count/program/sloc/8` | 2-8 | | `meta/count/subroutine/sloc/7` | 2-8 | -| `meta/count/variety/***` | 2-8 | +| `meta/count/variety/3` | 2-8 | | `meta/program` | 2-8 | | `operator/arithmetic/addition` | 7 | | `style/procedural` | 2-8 | diff --git a/docs/cli_collect.html b/docs/cli_collect.html index 028d428f..0abe2336 100644 --- a/docs/cli_collect.html +++ b/docs/cli_collect.html @@ -55,7 +55,7 @@

Options

-t --taxonomy=PATH The path of a TSV file mapping labels onto taxa. If not specified, use the "taxonomy.tsv" present in DIRECTORY's parent. If absent, use the included default taxonomy: - <https://github.com/laowantong/paroxython/blob/0.6.2/paroxython/resources/taxonomy.tsv> + <https://github.com/laowantong/paroxython/blob/0.6.3/paroxython/resources/taxonomy.tsv>
diff --git a/docs/cli_recommend.html b/docs/cli_recommend.html index 4eb6464c..df2ded23 100644 --- a/docs/cli_recommend.html +++ b/docs/cli_recommend.html @@ -157,7 +157,7 @@

Example

return print("\n".join(sorted(rec.selected_programs - rec.hidden_programs))) output_path = Path(args["--output"] or parent_path / f"{prefix}recommendations.md") output_path.write_text(rec.get_markdown()) - print_success(f"Dumped: {output_path.resolve()}.\n") + print_success(f"Dumped: {output_path.resolve()}\n")
@@ -226,7 +226,7 @@

Functions

return print("\n".join(sorted(rec.selected_programs - rec.hidden_programs))) output_path = Path(args["--output"] or parent_path / f"{prefix}recommendations.md") output_path.write_text(rec.get_markdown()) - print_success(f"Dumped: {output_path.resolve()}.\n") + print_success(f"Dumped: {output_path.resolve()}\n") diff --git a/docs/cli_tag.html b/docs/cli_tag.html index 32173f4e..6bf6d9e4 100644 --- a/docs/cli_tag.html +++ b/docs/cli_tag.html @@ -37,7 +37,7 @@

Options

-l --labels Output the labels instead of the taxa. -t --taxonomy=PATH The path of a TSV file mapping labels onto taxa. If not specified, use the included default taxonomy: - <https://github.com/laowantong/paroxython/blob/0.6.2/paroxython/resources/taxonomy.tsv> + <https://github.com/laowantong/paroxython/blob/0.6.3/paroxython/resources/taxonomy.tsv>
diff --git a/docs/index.html b/docs/index.html index 758e36b7..cf1d451b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -134,7 +134,7 @@

IPython magic command

If you use Jupyter notebook/lab, you've also just installed a so-called magic command. Load it like this:

%load_ext paroxython
 
-

This should print "paroxython 0.6.2 loaded.". Run it on a cell of Python code:

+

This should print "paroxython 0.6.3 loaded.". Run it on a cell of Python code:

%%paroxython                          # Lines
 def fibonacci(n):                     # 2
     result = []                       # 3
@@ -181,7 +181,7 @@ 

IPython magic command

2-8 -meta/count/variety/*** +meta/count/variety/3 2-8 diff --git a/docs/label_programs.html b/docs/label_programs.html index 4586c978..ff72a59a 100644 --- a/docs/label_programs.html +++ b/docs/label_programs.html @@ -31,7 +31,7 @@

Module paroxython.label_programs

Expand source code -Browse GitHub +Browse GitHub
from pathlib import Path
 from typing import Callable, Iterator, List, Set
@@ -45,12 +45,13 @@ 

Module paroxython.label_programs

def labelled_programs( directory: Path, - search_imported_program_path: Callable = regex.compile(r"import(?:_module)?:([^:]+)").search, + search_imported_program_path: Callable = regex.compile(r"import(?:_module)?:([^:]*)").search, print_performances: bool = False, **kwargs, ) -> Programs: programs: Programs = list_programs(directory, **kwargs) internal_program_paths = {p.path.replace("/", ".") for p in programs} # path sep -> import sep + internal_program_paths.add(".py") # for `from . import foobar`, the module name will be "" parse = ProgramParser() print(f"Labelling {len(programs)} programs.") for program in iterate_and_print_programs(programs): @@ -126,16 +127,17 @@

Note

Expand source code -Browse GitHub +Browse GitHub
def labelled_programs(
     directory: Path,
-    search_imported_program_path: Callable = regex.compile(r"import(?:_module)?:([^:]+)").search,
+    search_imported_program_path: Callable = regex.compile(r"import(?:_module)?:([^:]*)").search,
     print_performances: bool = False,
     **kwargs,
 ) -> Programs:
     programs: Programs = list_programs(directory, **kwargs)
     internal_program_paths = {p.path.replace("/", ".") for p in programs}  # path sep -> import sep
+    internal_program_paths.add(".py")  # for `from . import foobar`, the module name will be ""
     parse = ProgramParser()
     print(f"Labelling {len(programs)} programs.")
     for program in iterate_and_print_programs(programs):
@@ -172,7 +174,7 @@ 

Note

Expand source code -Browse GitHub +Browse GitHub
def generate_labelled_sources(programs: Programs) -> Iterator:
     separator = "-" * 88
diff --git a/docs/make_db.html b/docs/make_db.html
index 273ef896..102e3656 100644
--- a/docs/make_db.html
+++ b/docs/make_db.html
@@ -107,7 +107,7 @@ 

Module paroxython.make_db

def write_json(self, db_path: Optional[Path] = None) -> None: db_path = db_path or self.directory.parent / f"{self.directory.name}_db.json" db_path.write_text(self.get_json()) - print_success(f"Dumped: {db_path.absolute()}.") + print_success(f"Dumped: {db_path.absolute()}") def write_sqlite(self, db_path: Optional[Path] = None) -> None: db_path = db_path or self.directory.parent / f"{self.directory.name}_db.sqlite" @@ -190,7 +190,7 @@

Module paroxython.make_db

connexion.commit() connexion.close() - print_success(f"Dumped: {db_path.absolute()}.") + print_success(f"Dumped: {db_path.absolute()}") def collect_labels(programs: Programs) -> LabelInfos: @@ -629,7 +629,7 @@

Classes

def write_json(self, db_path: Optional[Path] = None) -> None: db_path = db_path or self.directory.parent / f"{self.directory.name}_db.json" db_path.write_text(self.get_json()) - print_success(f"Dumped: {db_path.absolute()}.") + print_success(f"Dumped: {db_path.absolute()}") def write_sqlite(self, db_path: Optional[Path] = None) -> None: db_path = db_path or self.directory.parent / f"{self.directory.name}_db.sqlite" @@ -712,7 +712,7 @@

Classes

connexion.commit() connexion.close() - print_success(f"Dumped: {db_path.absolute()}.")
+ print_success(f"Dumped: {db_path.absolute()}")

Methods

@@ -857,7 +857,7 @@

Args

def write_json(self, db_path: Optional[Path] = None) -> None:
     db_path = db_path or self.directory.parent / f"{self.directory.name}_db.json"
     db_path.write_text(self.get_json())
-    print_success(f"Dumped: {db_path.absolute()}.")
+ print_success(f"Dumped: {db_path.absolute()}")
@@ -961,7 +961,7 @@

Description

connexion.commit() connexion.close() - print_success(f"Dumped: {db_path.absolute()}.")
+ print_success(f"Dumped: {db_path.absolute()}")
diff --git a/docs/map_taxonomy.html b/docs/map_taxonomy.html index 05f368bc..3dbb94d8 100644 --- a/docs/map_taxonomy.html +++ b/docs/map_taxonomy.html @@ -504,9 +504,9 @@

Description

  • self.compiled_labels is a list of couples, of which the first member is a compiled label pattern, and the second member is a replacement pattern which may contain backreferences to one or several capture groups of the label pattern. For -instance, it can include the couple (regex.compile(r"nested_index:(\d+)$"), +instance, it can include the couple (regex.compile(r"index_shape:(\d+)$"), r"subscript/index/shape/\1"), which will be used to β€œtranslate” any occurrence of -the label name "nested_index:3" into the taxon name "subscript/index/shape/3". +the label name "index_shape:3" into the taxon name "subscript/index/shape/3". As an associative list, it only allows O(n) lookups a given label pattern.
  • diff --git a/docs/recommend_programs.html b/docs/recommend_programs.html index 224bb8cf..a280abe6 100644 --- a/docs/recommend_programs.html +++ b/docs/recommend_programs.html @@ -283,7 +283,7 @@

    Description

    rec.run_pipeline(ast.literal_eval(Path(f"{path}_pipe.py").read_text())) output_path = Path(f"{path}_recommendations.md") output_path.write_text(rec.get_markdown()) - print(f"Dumped: {output_path.resolve()}.\n")
    + print(f"Dumped: {output_path.resolve()}\n")
    diff --git a/docs/resources/tree.js b/docs/resources/tree.js index d7973efb..96153120 100644 --- a/docs/resources/tree.js +++ b/docs/resources/tree.js @@ -459,11 +459,11 @@ var data = google.visualization.arrayToDataTable([['node', 'occurrences'], ['🐍 style unpythonic find_best_element_index.', 1], ['🐍 style unpythonic swap.', 13], ['🐍 style unpythonic yoda_comparison.', 6], -['🐍 subscript index.', 2364], +['🐍 subscript index.', 2370], ['🐍 subscript index arithmetic.', 299], ['🐍 subscript index backwards last.', 25], -['🐍 subscript index shape 2.', 392], -['🐍 subscript index shape 3.', 14], +['🐍 subscript index shape 2.', 396], +['🐍 subscript index shape 3.', 12], ['🐍 subscript slice copy.', 14], ['🐍 subscript slice start.', 94], ['🐍 subscript slice step backwards.', 15], diff --git a/docs/user_manual/index.html b/docs/user_manual/index.html index f9f1bf00..b70ed926 100644 --- a/docs/user_manual/index.html +++ b/docs/user_manual/index.html @@ -482,11 +482,11 @@ ['🐍 style unpythonic find_best_element_index.', 1], ['🐍 style unpythonic swap.', 13], ['🐍 style unpythonic yoda_comparison.', 6], -['🐍 subscript index.', 2364], +['🐍 subscript index.', 2370], ['🐍 subscript index arithmetic.', 299], ['🐍 subscript index backwards last.', 25], -['🐍 subscript index shape 2.', 392], -['🐍 subscript index shape 3.', 14], +['🐍 subscript index shape 2.', 396], +['🐍 subscript index shape 3.', 12], ['🐍 subscript slice copy.', 14], ['🐍 subscript slice start.', 94], ['🐍 subscript slice step backwards.', 15], diff --git a/paroxython/cli_collect.py b/paroxython/cli_collect.py index 630d4282..83a71dba 100644 --- a/paroxython/cli_collect.py +++ b/paroxython/cli_collect.py @@ -30,7 +30,7 @@ -t --taxonomy=PATH The path of a TSV file mapping labels onto taxa. If not specified, use the "taxonomy.tsv" present in DIRECTORY's parent. If absent, use the included default taxonomy: - https://github.com/laowantong/paroxython/blob/0.6.2/paroxython/resources/taxonomy.tsv + https://github.com/laowantong/paroxython/blob/0.6.3/paroxython/resources/taxonomy.tsv ``` """ diff --git a/paroxython/cli_tag.py b/paroxython/cli_tag.py index f18f752e..d57294b3 100644 --- a/paroxython/cli_tag.py +++ b/paroxython/cli_tag.py @@ -12,7 +12,7 @@ -l --labels Output the labels instead of the taxa. -t --taxonomy=PATH The path of a TSV file mapping labels onto taxa. If not specified, use the included default taxonomy: - https://github.com/laowantong/paroxython/blob/0.6.2/paroxython/resources/taxonomy.tsv + https://github.com/laowantong/paroxython/blob/0.6.3/paroxython/resources/taxonomy.tsv ``` """ diff --git a/pyproject.toml b/pyproject.toml index 82575ced..d73a8bcc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "paroxython" -version = "0.6.2" +version = "0.6.3" description = "Search Python code for algorithmic features" authors = ["Aristide Grange"] license = "MIT"