Skip to content

Commit d2fa2bc

Browse files
committed
rename util to utils
1 parent 5e76ce6 commit d2fa2bc

40 files changed

Lines changed: 53 additions & 49 deletions

src/markdown_environments/captioned_figure.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from markdown.blockprocessors import BlockProcessor
55
from markdown.extensions import Extension
66

7-
from . import util
7+
from . import utils
88

99

1010
class CaptionedFigureProcessor(BlockProcessor):
@@ -157,10 +157,12 @@ def __init__(self, **kwargs):
157157
"HTML `class` attribute to add to captioned figure's caption (default: `\"\"`)."
158158
]
159159
}
160-
util.init_extension_with_configs(self, **kwargs)
160+
utils.init_extension_with_configs(self, **kwargs)
161161

162162
def extendMarkdown(self, md):
163-
md.parser.blockprocessors.register(CaptionedFigureProcessor(md.parser, **self.getConfigs()), "captioned_figure", 105)
163+
md.parser.blockprocessors.register(
164+
CaptionedFigureProcessor(md.parser, **self.getConfigs()), "captioned_figure", 105
165+
)
164166

165167

166168
def makeExtension(**kwargs):

src/markdown_environments/cited_blockquote.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from markdown.blockprocessors import BlockProcessor
55
from markdown.extensions import Extension
66

7-
from . import util
7+
from . import utils
88

99

1010
class CitedBlockquoteProcessor(BlockProcessor):
@@ -155,10 +155,12 @@ def __init__(self, **kwargs):
155155
"HTML `class` attribute to add to cited blockquote's citation. Defaults to `\"\"`."
156156
]
157157
}
158-
util.init_extension_with_configs(self, **kwargs)
158+
utils.init_extension_with_configs(self, **kwargs)
159159

160160
def extendMarkdown(self, md):
161-
md.parser.blockprocessors.register(CitedBlockquoteProcessor(md.parser, **self.getConfigs()), "cited_blockquote", 105)
161+
md.parser.blockprocessors.register(
162+
CitedBlockquoteProcessor(md.parser, **self.getConfigs()), "cited_blockquote", 105
163+
)
162164

163165

164166
def makeExtension(**kwargs):

src/markdown_environments/div.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from markdown.blockprocessors import BlockProcessor
55
from markdown.extensions import Extension
66

7-
from . import util
7+
from . import utils
88

99

1010
class DivProcessor(BlockProcessor):
@@ -13,12 +13,12 @@ def __init__(self, *args, types: dict, html_class: str, is_thm: bool, **kwargs):
1313
super().__init__(*args, **kwargs)
1414
self.html_class = html_class
1515
self.is_thm = is_thm
16-
self.types, self.start_pattern_choices, self.end_pattern_choices = util.init_env_types(types, self.is_thm)
16+
self.types, self.start_pattern_choices, self.end_pattern_choices = utils.init_env_types(types, self.is_thm)
1717
self.start_pattern = None
1818
self.end_pattern = None
1919

2020
def test(self, parent, block):
21-
typ = util.test_for_env_types(self.start_pattern_choices, parent, block)
21+
typ = utils.test_for_env_types(self.start_pattern_choices, parent, block)
2222
if typ is None:
2323
return False
2424
self.type_opts = self.types[typ]
@@ -31,7 +31,7 @@ def run(self, parent, blocks):
3131
# generate default thm heading if applicable
3232
thm_heading_md = ""
3333
if self.is_thm:
34-
thm_heading_md = util.gen_thm_heading_md(self.type_opts, self.start_pattern, blocks[0])
34+
thm_heading_md = utils.gen_thm_heading_md(self.type_opts, self.start_pattern, blocks[0])
3535
# remove starting delim (after generating thm heading from it, if applicable)
3636
blocks[0] = self.start_pattern.sub("", blocks[0])
3737

@@ -52,7 +52,7 @@ def run(self, parent, blocks):
5252
for _ in range(0, i + 1):
5353
blocks.pop(0)
5454
# add thm heading if applicable
55-
util.prepend_thm_heading_md(self.type_opts, elem, thm_heading_md)
55+
utils.prepend_thm_heading_md(self.type_opts, elem, thm_heading_md)
5656
break
5757
# if no ending delim, restore and do nothing
5858
if not delim_found:
@@ -126,7 +126,7 @@ def __init__(self, **kwargs):
126126
)
127127
]
128128
}
129-
util.init_extension_with_configs(self, **kwargs)
129+
utils.init_extension_with_configs(self, **kwargs)
130130

131131
# set default options for individual types
132132
for type, opts in self.getConfig("types").items():

src/markdown_environments/dropdown.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from markdown.blockprocessors import BlockProcessor
55
from markdown.extensions import Extension
66

7-
from . import util
7+
from . import utils
88

99

1010
class DropdownProcessor(BlockProcessor):
@@ -21,12 +21,12 @@ def __init__(
2121
self.summary_html_class = summary_html_class
2222
self.content_html_class = content_html_class
2323
self.is_thm = is_thm
24-
self.types, self.start_pattern_choices, self.end_pattern_choices = util.init_env_types(types, self.is_thm)
24+
self.types, self.start_pattern_choices, self.end_pattern_choices = utils.init_env_types(types, self.is_thm)
2525
self.start_pattern = None
2626
self.end_pattern = None
2727

2828
def test(self, parent, block):
29-
typ = util.test_for_env_types(self.start_pattern_choices, parent, block)
29+
typ = utils.test_for_env_types(self.start_pattern_choices, parent, block)
3030
if typ is None:
3131
return False
3232
self.type_opts = self.types[typ]
@@ -55,7 +55,7 @@ def run(self, parent, blocks):
5555
# also first generate theorem heading from it to use as default summary if applicable
5656
thm_heading_md = ""
5757
if self.is_thm:
58-
thm_heading_md = util.gen_thm_heading_md(self.type_opts, self.start_pattern, blocks[0])
58+
thm_heading_md = utils.gen_thm_heading_md(self.type_opts, self.start_pattern, blocks[0])
5959
blocks[0] = self.start_pattern.sub("", blocks[0])
6060

6161
# find and remove summary ending delim if summary starting delim was present, and extract element
@@ -87,7 +87,7 @@ def run(self, parent, blocks):
8787
blocks.extend(org_blocks)
8888
return False
8989
# prepend thm heading (including default summary) to summary if applicable, again outside loop
90-
util.prepend_thm_heading_md(self.type_opts, summary_elem, thm_heading_md)
90+
utils.prepend_thm_heading_md(self.type_opts, summary_elem, thm_heading_md)
9191

9292
# find and remove dropdown ending delim, and extract element
9393
delim_found = False
@@ -208,7 +208,7 @@ def __init__(self, **kwargs):
208208
"Whether to use theorem logic (e.g. heading); used only by `ThmExtension`. Defaults to `False`."
209209
]
210210
}
211-
util.init_extension_with_configs(self, **kwargs)
211+
utils.init_extension_with_configs(self, **kwargs)
212212

213213
# set default options for individual types
214214
for type, opts in self.getConfig("types").items():

src/markdown_environments/thms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from markdown.postprocessors import Postprocessor
77
from markdown.treeprocessors import Treeprocessor
88

9-
from . import util
9+
from . import utils
1010

1111

1212
# the only reason this is a `Treeprocessor` and not a `Preprocessor`, `InlineProcessor`, or `Postprocessor`, all of
@@ -379,7 +379,7 @@ def __init__(self, **kwargs):
379379
"Config for theorem heading"
380380
]
381381
}
382-
util.init_extension_with_configs(self, **kwargs)
382+
utils.init_extension_with_configs(self, **kwargs)
383383

384384
# set default configs for each extension, since we no longer have the top-level `self.config` functionality
385385
# to set defaults for us

tests/captioned_figure/test_captioned_figure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from markdown_environments import CaptionedFigureExtension
4-
from ..tests_util import run_extension_test
4+
from ..tests_utils import run_extension_test
55

66

77
@pytest.mark.parametrize(

tests/cited_blockquote/test_cited_blockquote.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from markdown_environments import CitedBlockquoteExtension
4-
from ..tests_util import run_extension_test
4+
from ..tests_utils import run_extension_test
55

66

77
@pytest.mark.parametrize(

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
def pytest_collection_modifyitems(session, config, items):
2-
# don't interpret `test_for_env_types()` from actual package's `util.py` as a test!
2+
# don't interpret `test_for_env_types()` from actual package's `utils.py` as a test!
33
# otherwise it screams about fixture not found or something
44
items[:] = [item for item in items if item.name != "test_for_env_types"]

tests/div/test_div.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from markdown_environments import DivExtension
4-
from ..tests_util import run_extension_test
4+
from ..tests_utils import run_extension_test
55

66

77
TYPES = {

0 commit comments

Comments
 (0)