Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypeError in vcs.py which affects only python3 #325

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hyde/ext/plugins/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def update(self, data):
Updates the metadata with new stuff
"""
if isinstance(data, basestring):
super(Metadata, self).update(yaml.load(data))
super(Metadata, self).update(yaml.load(data, Loader=yaml.FullLoader))
else:
super(Metadata, self).update(data)

Expand Down
2 changes: 1 addition & 1 deletion hyde/ext/plugins/vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def get_dates(self, resource):
"log",
"--pretty=%ai",
resource.path
]).split("\n")
]).split(b"\n")
commits = commits[:-1]
except subprocess.CalledProcessError:
self.logger.warning(
Expand Down
2 changes: 1 addition & 1 deletion hyde/ext/templates/jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def _set_yaml(self, var, caller=None):
return ''

out = caller().strip()
var.update(yaml.load(out))
var.update(yaml.load(out, Loader=yaml.FullLoader))
return ''


Expand Down
6 changes: 3 additions & 3 deletions hyde/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def load(sitepath, ctx):
for provider_name, resource_name in providers.items():
res = File(Folder(sitepath).child(resource_name))
if res.exists:
data = make_expando(yaml.load(res.read_all()))
data = make_expando(yaml.load(res.read_all(), Loader=yaml.FullLoader))
context[provider_name] = data

return context
Expand All @@ -140,7 +140,7 @@ def __init__(self, sitepath, depends_file_name='.hyde_deps'):
self.deps_file = File(self.sitepath.child(depends_file_name))
self.data = {}
if self.deps_file.exists:
self.data = yaml.load(self.deps_file.read_all())
self.data = yaml.load(self.deps_file.read_all(), Loader=yaml.FullLoader)
import atexit
atexit.register(self.save)

Expand Down Expand Up @@ -223,7 +223,7 @@ def read_config(self, config_file):
self.config_files.append(File(conf_file))
logger.info("Reading site configuration from [%s]", conf_file)
with codecs.open(conf_file, 'r', 'utf-8') as stream:
conf = yaml.load(stream)
conf = yaml.load(stream, Loader=yaml.FullLoader)
if 'extends' in conf:
parent = self.read_config(conf['extends'])
parent.update(conf)
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fswrap>=1.0.0, <2.0
commando>=1.0.0, <2.0
PyYAML>=3.11, <4.0
Markdown>=2.6.2, <3.0
MarkupSafe>=0.23, <1.0
PyYAML>=5.2
Markdown>=2.6.2, <=3.1.1
MarkupSafe>=0.23, <=1.1.1
Pygments>=2.0.2, <3.0
typogrify>=2.0.7, <3.0
smartypants>=1.8.6, <2.0
smartypants>=1.8.6, <=2.0.1
Jinja2>=2.7.3, <3.0
4 changes: 2 additions & 2 deletions tests/ext/test_drafts.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_drafts_are_skipped_in_production(self):
- hyde.ext.plugins.blog.DraftsPlugin
"""
import yaml
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg))
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg, Loader=yaml.FullLoader))
s.load()
gen = Generator(s)
gen.generate_all()
Expand All @@ -62,7 +62,7 @@ def test_drafts_are_published_in_development(self):
- hyde.ext.plugins.blog.DraftsPlugin
"""
import yaml
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg))
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg, Loader=yaml.FullLoader))
s.load()
gen = Generator(s)
gen.generate_all()
Expand Down
4 changes: 2 additions & 2 deletions tests/ext/test_flattener.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_can_flatten(self):
target: ''
"""
import yaml
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg))
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg, Loader=yaml.FullLoader))
s.load()
gen = Generator(s)
gen.generate_all()
Expand All @@ -57,7 +57,7 @@ def test_flattener_fixes_nodes(self):
target: ''
"""
import yaml
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg))
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg, Loader=yaml.FullLoader))
s.load()
gen = Generator(s)
gen.generate_all()
Expand Down
4 changes: 2 additions & 2 deletions tests/ext/test_grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def setUp(self):
description: Plugins

"""
self.s.config = Config(TEST_SITE, config_dict=yaml.load(cfg))
self.s.config = Config(TEST_SITE, config_dict=yaml.load(cfg, Loader=yaml.FullLoader))
self.s.load()
MetaPlugin(self.s).begin_site()
SorterPlugin(self.s).begin_site()
Expand Down Expand Up @@ -268,7 +268,7 @@ def test_nav_with_grouper_sorted(self):
description: Plugins

"""
self.s.config = Config(TEST_SITE, config_dict=yaml.load(cfg))
self.s.config = Config(TEST_SITE, config_dict=yaml.load(cfg, Loader=yaml.FullLoader))
self.s.load()
MetaPlugin(self.s).begin_site()
SorterPlugin(self.s).begin_site()
Expand Down
2 changes: 1 addition & 1 deletion tests/ext/test_urlcleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_url_cleaner(self):
- html
append_slash: true
"""
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg))
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg, Loader=yaml.FullLoader))
text = """
{% extends "base.html" %}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def test_context_providers_equivalence(self):
title: "one event"
location: "a city"
"""
events_dict = yaml.load(events)
events_dict = yaml.load(events, Loader=yaml.FullLoader)
config_dict = dict(context=dict(
data=dict(events1=events_dict),
providers=dict(events2="events.yaml")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jinja2template.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def test_line_statements_with_config():
"""
t = Jinja2Template(JINJA2.path)
s = Site(JINJA2.path)
s.config = Config(JINJA2.path, config_dict=yaml.load(config))
s.config = Config(JINJA2.path, config_dict=yaml.load(config, Loader=yaml.FullLoader))
t.configure(s)
t.env.filters['dateformat'] = dateformat
html = t.render(source, {}).strip()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ def test_default_configuration(self):
assert c.meta.nodemeta == 'meta.yaml'

def test_conf1(self):
c = Config(sitepath=TEST_SITE, config_dict=yaml.load(self.conf1))
c = Config(sitepath=TEST_SITE, config_dict=yaml.load(self.conf1, Loader=yaml.FullLoader))
assert c.content_root_path == TEST_SITE.child_folder('stuff')

def test_conf2(self):
c = Config(sitepath=TEST_SITE, config_dict=yaml.load(self.conf2))
c = Config(sitepath=TEST_SITE, config_dict=yaml.load(self.conf2, Loader=yaml.FullLoader))
assert c.content_root_path == TEST_SITE.child_folder('site/stuff')
assert c.media_root_path == c.content_root_path.child_folder('mmm')
assert c.media_url == TEST_SITE.child_folder('/media')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_simple_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def teardown_class(cls):
def setup_config(self, passthru):
self.config_file = File(self.SITE_PATH.child('site.yaml'))
with open(self.config_file.path) as config:
conf = yaml.load(config)
conf = yaml.load(config, Loader=yaml.FullLoader)
conf['simple_copy'] = passthru
self.config = Config(sitepath=self.SITE_PATH, config_dict=conf)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def setup_class(cls):
cls.config_file = File(cls.SITE_PATH.child('alternate.yaml'))
with open(cls.config_file.path) as config:
cls.config = Config(
sitepath=cls.SITE_PATH, config_dict=yaml.load(config))
sitepath=cls.SITE_PATH, config_dict=yaml.load(config, Loader=yaml.FullLoader))
cls.SITE_PATH.child_folder('content').rename_to(
cls.config.content_root)

Expand Down