Skip to content

Commit 928d1c6

Browse files
committed
chore; update python deps
1 parent ff9caaa commit 928d1c6

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

kotlin-website.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88
from os import path
99
from urllib.parse import urlparse, urljoin, ParseResult
1010

11-
import yaml
11+
from ruamel.yaml import YAML, YAMLError
1212
from bs4 import BeautifulSoup
1313
from flask import Flask, render_template, Response, send_from_directory, request
1414
from flask.helpers import url_for, send_file, make_response
1515
from flask.views import View
1616
from flask_frozen import Freezer, walk_directory
17-
from yaml import FullLoader
1817

1918
from src.Feature import Feature
2019
from src.api import get_api_page
@@ -30,6 +29,8 @@
3029
from src.processors.processors import process_code_blocks
3130
from src.processors.processors import set_replace_simple_code
3231

32+
yaml = YAML(typ='rt')
33+
3334
app = Flask(__name__, static_folder='_assets')
3435
app.config.from_pyfile('mysettings.py')
3536
app.jinja_env.trim_blocks = True
@@ -88,8 +89,8 @@ def get_site_data():
8889
with open(data_file_path, encoding="UTF-8") as stream:
8990
try:
9091
file_name_without_extension = data_file[:-4] if data_file.endswith(".yml") else data_file
91-
data[file_name_without_extension] = yaml.load(stream, Loader=FullLoader)
92-
except yaml.YAMLError as exc:
92+
data[file_name_without_extension] = yaml.load(stream)
93+
except YAMLError as exc:
9394
sys.stderr.write('Cant parse data file ' + data_file + ': ')
9495
sys.stderr.write(str(exc))
9596
sys.exit(-1)
@@ -98,7 +99,7 @@ def get_site_data():
9899
sys.stderr.write(str(exc))
99100
sys.exit(-1)
100101
data["core"] = redirect_to_map(
101-
yaml.load(open("redirects/stdlib-redirects.yml", encoding="UTF-8"), Loader=FullLoader))
102+
yaml.load(open("redirects/stdlib-redirects.yml", encoding="UTF-8")))
102103
return data
103104

104105

@@ -143,15 +144,15 @@ def get_education_courses():
143144

144145
def get_nav_impl():
145146
with open(path.join(data_folder, "_nav.yml")) as stream:
146-
nav = yaml.load(stream, Loader=FullLoader)
147+
nav = yaml.load(stream)
147148
nav = process_nav_includes(build_mode, nav)
148149
return nav
149150

150151

151152
def get_kotlin_features():
152153
features_dir = path.join(os.path.dirname(__file__), "kotlin-features")
153154
features = []
154-
for feature_meta in yaml.load(open(path.join(features_dir, "kotlin-features.yml")), Loader=FullLoader):
155+
for feature_meta in yaml.load(open(path.join(features_dir, "kotlin-features.yml"))):
155156
file_path = path.join(features_dir, feature_meta['content_file'])
156157
with open(file_path, encoding='utf-8') as f:
157158
content = f.read()
@@ -436,7 +437,7 @@ def generate_redirect_pages():
436437

437438
with open(redirects_file_path, encoding="UTF-8") as stream:
438439
try:
439-
redirects = yaml.load(stream, Loader=FullLoader)
440+
redirects = yaml.load(stream)
440441

441442
for entry in redirects:
442443
url_to = entry["to"]
@@ -449,7 +450,7 @@ def generate_redirect_pages():
449450
else:
450451
app.add_url_rule(url, view_func=RedirectTemplateView.as_view(url, url=url_to))
451452

452-
except yaml.YAMLError as exc:
453+
except YAMLError as exc:
453454
sys.stderr.write('Cant parse data file ' + file + ': ')
454455
sys.stderr.write(str(exc))
455456
sys.exit(-1)

requirements.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
flask==2.0.3
1+
flask==2.3.3
22
flask-flatpages==0.7.3
33
frozen-flask==0.18
44
Pygments==2.12.0
55
python-frontmatter==1.0.0
66
beautifulsoup4==4.11.1
77
xmltodict==0.13.0
8-
9-
# temporary dependencies for waiting fix:
10-
# https://yandex.ru/blog/mapsapi/prekraschaem-podderzhku-anonimnykh-servisov
11-
# https://github.com/DenisCarriere/geocoder/pull/404
12-
git+https://github.com/pik-software/geocoder.git@yandex-api-key#egg=geocoder
13-
8+
geocoder==1.38
149
ruamel.yaml==0.17.21
15-
PyYAML==5.4.1
1610
algoliasearch==1.20.0
1711
Werkzeug==2.3.8

src/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from os import path
22

3-
import yaml
3+
import ruamel.yaml as yaml
44
from bs4 import BeautifulSoup
55

66
from src.processors.processors import process_code_blocks, process_header_ids

src/externals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import re
33
from os import path
4-
import yaml
4+
import ruamel.yaml as yaml
55
import shutil
66

77
from src.github import assert_valid_git_hub_url

0 commit comments

Comments
 (0)