Skip to content

Commit

Permalink
Improve Immaterial documenters (#85)
Browse files Browse the repository at this point in the history
* Improve Immaterial documenters

* Use concurrency groups
  • Loading branch information
josiah-wolf-oberholtzer authored Feb 19, 2023
1 parent 5c81159 commit 42b24f7
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 23 deletions.
15 changes: 4 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,14 @@ on:
schedule:
- cron: "0 0 * * 0"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cancel:
name: Cancel previous workflow
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

docs:
name: Build docs
needs: [cancel]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -40,7 +35,6 @@ jobs:

lint:
name: Lint
needs: [cancel]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -61,7 +55,6 @@ jobs:

test:
name: Test
needs: [cancel]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
1 change: 0 additions & 1 deletion tests/test_graphs_RecordField.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


def test_graphs_RecordField():

graph = Graph()
graph.node_attributes["shape"] = "record"

Expand Down
2 changes: 1 addition & 1 deletion uqbar/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version_info__ = (0, 6, 8)
__version_info__ = (0, 6, 9)
__version__ = ".".join(str(x) for x in __version_info__)
7 changes: 6 additions & 1 deletion uqbar/apis/documenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,13 @@ def __init__(
def __str__(self) -> str:
result = self._build_preamble()
result.extend(self._build_toc(self.module_documenters or []))
member_strings: List[str] = []
for documenter in self._member_documenters:
result.extend(["", str(documenter)])
member_strings.append(str(documenter))
member_strings.sort(key=lambda x: x.partition("\n")[0].split("::"))
for member_string in member_strings:
result.append("")
result.append(member_string)
return "\n".join(result)

### PRIVATE METHODS ###
Expand Down
14 changes: 10 additions & 4 deletions uqbar/apis/summarizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,7 @@ def __str__(self) -> str:
if issubclass(self.client, enum.Enum): # type: ignore
result.extend([" :members:", " :undoc-members:"])
result.append("")
attrs: List[str] = []
for attr in sorted(
inspect.classify_class_attrs(cast(type, self.client)), key=lambda x: x.name
):
Expand All @@ -730,10 +731,15 @@ def __str__(self) -> str:
continue
if attr.name.startswith("__") and attr.name in self.ignored_special_methods:
continue
if attr.kind in ("method", "class method", "static method"):
result.append(f" .. automethod:: {attr.name}")
elif attr.kind in ("property"):
result.append(f" .. autoproperty:: {attr.name}")
if attr.kind in ["method", "class method", "static method"]:
attrs.append(f" .. automethod:: {attr.name}")
elif attr.kind in ["property"]:
attrs.append(f" .. autoproperty:: {attr.name}")
elif attr.kind in ["data"] and isinstance(attr.object, type):
attrs.append(
f" .. autoclass:: {self.client.__module__}::{name}.{attr.name}"
)
result.extend(sorted(attrs))
return "\n".join(result)


Expand Down
1 change: 0 additions & 1 deletion uqbar/containers/unique_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ def root(self):


class UniqueTreeContainer(UniqueTreeNode):

### INITIALIZER ###

def __init__(self, children=None, name=None):
Expand Down
2 changes: 0 additions & 2 deletions uqbar/graphs/attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class Attributes(collections.abc.MutableMapping):
### CLASS VARIABLES ###

class Color(object):

__slots__ = ("color",)

def __init__(self, color) -> None:
Expand All @@ -54,7 +53,6 @@ class Mode(enum.Enum):
TABLE_CELL = 6

class Point(object):

__slots__ = ("x", "y")

def __init__(self, x, y) -> None:
Expand Down
1 change: 0 additions & 1 deletion uqbar/graphs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Attachable(UniqueTreeNode):

### CLASS VARIABLES ###

__documentation_section__ = "Mixins"
Expand Down
1 change: 0 additions & 1 deletion uqbar/graphs/graphers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


class Grapher:

### CLASS VARIABLES ###

_valid_formats = ("png", "pdf", "svg")
Expand Down

0 comments on commit 42b24f7

Please sign in to comment.