fix unicode decode bug (#19) in sample data model

This commit is contained in:
Sina Atalay 2024-02-26 19:42:34 +01:00
parent 25ded71f02
commit b678226fdc
2 changed files with 14 additions and 12 deletions

View File

@ -488,6 +488,7 @@ def cli_command_new(
data_model_as_dictionary = json.loads(data_model_as_json) data_model_as_dictionary = json.loads(data_model_as_json)
yaml_object = ruamel.yaml.YAML() yaml_object = ruamel.yaml.YAML()
yaml_object.encoding = "utf-8"
yaml_object.indent(mapping=2, sequence=4, offset=2) yaml_object.indent(mapping=2, sequence=4, offset=2)
yaml_object.dump(data_model_as_dictionary, file_path) yaml_object.dump(data_model_as_dictionary, file_path)

View File

@ -1109,6 +1109,7 @@ def get_a_sample_data_model(
Returns: Returns:
RenderCVDataModel: A sample data model. RenderCVDataModel: A sample data model.
""" """
name = name.encode().decode("unicode-escape")
sections = { sections = {
"summary": [ "summary": [
( (
@ -1169,12 +1170,12 @@ def get_a_sample_data_model(
location="WA, USA", location="WA, USA",
highlights=[ highlights=[
( (
"Promoted to Lead Student Ambassador in the Fall of 2004, supervised" "Promoted to Lead Student Ambassador in the Fall of 2004,"
" 10 - 15 Student Ambassadors." " supervised 10 - 15 Student Ambassadors."
), ),
( (
"Created and taught a computer science course, CSE 099: Software" "Created and taught a computer science course, CSE 099:"
" Design and Development." " Software Design and Development."
), ),
], ],
), ),
@ -1190,14 +1191,14 @@ def get_a_sample_data_model(
" (ctrl-tab) and extended it to tool windows." " (ctrl-tab) and extended it to tool windows."
), ),
( (
"Created a service to provide gradient across VS and VS add-ins." "Created a service to provide gradient across VS and VS"
" Optimized service via caching." " add-ins. Optimized service via caching."
), ),
"Programmer Productivity Research Center (Summers 2001, 2002)", "Programmer Productivity Research Center (Summers 2001, 2002)",
( (
"Built app to compute the similarity of all methods in a code base," "Built app to compute the similarity of all methods in a code"
" reduced time from $\\mathcal{O}(n^2)$ to $\\mathcal{O}(n" " base, reduced time from $\\mathcal{O}(n^2)$ to"
" \\log n)$. " " $\\mathcal{O}(n \\log n)$. "
), ),
( (
"Created a test case generation tool that creates random XML" "Created a test case generation tool that creates random XML"
@ -1213,8 +1214,8 @@ def get_a_sample_data_model(
location="WA, USA", location="WA, USA",
highlights=[ highlights=[
( (
"Promoted to Lead Student Ambassador in the Fall of 2004, supervised" "Promoted to Lead Student Ambassador in the Fall of 2004,"
" 10 - 15 Student Ambassadors." " supervised 10 - 15 Student Ambassadors."
), ),
], ],
), ),
@ -1324,7 +1325,7 @@ def get_a_sample_data_model(
if theme == "classic": if theme == "classic":
design = ClassicThemeOptions(theme="classic", show_timespan_in=["Experience"]) design = ClassicThemeOptions(theme="classic", show_timespan_in=["Experience"])
else: else:
design = rendercv_design_validator.validate_python({"theme": theme}) # type: ignore design = rendercv_design_validator.validate_python({"theme": theme}) # type: ignore
return RenderCVDataModel(cv=cv, design=design) return RenderCVDataModel(cv=cv, design=design)