-
Notifications
You must be signed in to change notification settings - Fork 18
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
🗑️ [TEST-PR] Wip/projects against d2b297 (Sourcery refactored) #830
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,6 @@ def __post_init__(self): | |
self.folder = self.file.parent | ||
if isinstance(self.folder, str): | ||
self.folder = Path(self.folder) | ||
pass | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
@classmethod | ||
def create(cls, name: str | None = None, folder: str | Path | None = None) -> Project: | ||
|
@@ -78,7 +77,7 @@ def create(cls, name: str | None = None, folder: str | Path | None = None) -> Pr | |
if folder is None: | ||
folder = getcwd() | ||
project_folder = Path(folder) | ||
name = name if name else project_folder.name | ||
name = name or project_folder.name | ||
Comment on lines
-81
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
project_file = project_folder / PROJECT_FILE_NAME | ||
with open(project_file, "w") as f: | ||
f.write(TEMPLATE.format(gta_version=gta_version, name=name)) | ||
|
@@ -297,12 +296,13 @@ def generate_parameters( | |
groups = parameter.split(".") | ||
label = groups.pop() | ||
if len(groups) == 0: | ||
if isinstance(parameters, dict) and len(parameters) != 0: | ||
raise ModelError( | ||
"The root parameter group cannot contain both groups and parameters." | ||
) | ||
elif isinstance(parameters, dict): | ||
parameters = [] | ||
if isinstance(parameters, dict): | ||
if len(parameters) != 0: | ||
raise ModelError( | ||
"The root parameter group cannot contain both groups and parameters." | ||
) | ||
else: | ||
parameters = [] | ||
Comment on lines
-300
to
+305
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
parameters.append( | ||
[ | ||
label, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,8 +138,7 @@ def get_scheme(self) -> Scheme: | |
if "weight" in dataset: | ||
data[label]["weight"] = dataset.weight | ||
|
||
new_scheme = replace(self.scheme, parameters=self.optimized_parameters) | ||
return new_scheme | ||
return replace(self.scheme, parameters=self.optimized_parameters) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def markdown(self, with_model: bool = True, base_heading_level: int = 1) -> MarkdownStr: | ||
"""Format the model as a markdown text. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
Model.as_dict
refactored with the following changes:merge-dict-assign
)