Skip to content

Commit 2b5801b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c5361d6 commit 2b5801b

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

bridges/blog/container.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,17 @@ def valid(path: Path) -> Result["Post._ValidSentinel", post.Fault]:
117117
return Err(post.PathFault(text_path))
118118

119119
try:
120-
content = open(text_path, "r").read()
121-
except IOError as e:
120+
content = open(text_path).read()
121+
except OSError as e:
122122
return Err(post.IoFault(e))
123123

124-
if not VALID_MARKDOWN.match(open(text_path, "r").readline()):
124+
if not VALID_MARKDOWN.match(open(text_path).readline()):
125125
return Err(post.MissingHeadingFault()) # [tag:ensure_heading]
126126

127127
if not metadata_path.exists():
128128
return Err(post.MetadataMissingFault(metadata_path))
129129

130-
metadata = PostMetadata.new(open(metadata_path, "r"))
130+
metadata = PostMetadata.new(open(metadata_path))
131131

132132
if isinstance(metadata, Ok):
133133
return Ok(Post._ValidSentinel(path, content, metadata.ok()))

bridges/blog/helper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ConfiguredBaseModel(BaseModel):
2020
def new(cls: Type[T], file_like: TextIO) -> Result[T, model.Fault]:
2121
try:
2222
raw = file_like.read()
23-
except IOError as e:
23+
except OSError as e:
2424
return Err(model.IoFault(e))
2525

2626
try:

bridges/github.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get(*args, **kwargs) -> Union[MockedResponse, Response]: # type: ignore
2727
return response
2828
else:
2929
return MockedResponse()
30-
except (gaierror, IOError):
30+
except (gaierror, OSError):
3131
return MockedResponse()
3232

3333

utils/github_css_postprocess.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
APPLY_REGEX = [SYNTAX_HIGHLIGHTING, FIRST_LAST_CHILDREN, OCTICONS]
1010

11-
gh_md_content = open("src/style/github-markdown-base.css", "r").read()
11+
gh_md_content = open("src/style/github-markdown-base.css").read()
1212

1313
for regex in APPLY_REGEX:
1414
gh_md_content = regex.sub("", gh_md_content)

0 commit comments

Comments
 (0)