-
Notifications
You must be signed in to change notification settings - Fork 80
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: pushing new manifest without metadata update #907
Changes from 2 commits
cc736d7
b605427
d5fa3b4
d995041
22f1772
ce0c8f4
248bb56
281043d
6e09e09
0b26e82
41bf6a4
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 |
---|---|---|
|
@@ -5036,7 +5036,7 @@ def create_prompt( | |
description: Optional[str] = None, | ||
readme: Optional[str] = None, | ||
tags: Optional[Sequence[str]] = None, | ||
is_public: bool = False, | ||
is_public: Optional[bool] = False, | ||
) -> ls_schemas.Prompt: | ||
"""Create a new prompt. | ||
|
||
|
@@ -5074,7 +5074,7 @@ def create_prompt( | |
"description": description or "", | ||
"readme": readme or "", | ||
"tags": tags or [], | ||
"is_public": is_public, | ||
"is_public": is_public or False, | ||
madams0013 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
response = self.request_with_retries("POST", "/repos/", json=json) | ||
|
@@ -5350,13 +5350,20 @@ def push_prompt( | |
""" | ||
# Create or update prompt metadata | ||
if self._prompt_exists(prompt_identifier): | ||
self.update_prompt( | ||
prompt_identifier, | ||
description=description, | ||
readme=readme, | ||
tags=tags, | ||
is_public=is_public, | ||
) | ||
if not ( | ||
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. nit: easier to read if we flip the conditions:
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. we still need to do this check after checking if prompt exists because if prompt doesnt' exist we just want to create it if prompt exists AND none of these things are set, skip the call to update prompt 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. I'm just saying it's hard to read a double negative (not x is None vs. if x); the logic is right. I find both of the following easier to read: if any(
parent_commit_hash is None
and is_public is None
and description is None
and readme is None
and tags is None
):
self.create_prompt(
prompt_identifier,
is_public=is_public,
description=description,
readme=readme,
tags=tags,
)
else:
self.update_prompt(
prompt_identifier,
description=description,
readme=readme,
tags=tags,
is_public=is_public,
) or if any (
parent_commit_hash is not None
and is_public is not None
and description is not None
and readme is not None
and tags is not None
):
self.update_prompt(
prompt_identifier,
description=description,
readme=readme,
tags=tags,
is_public=is_public,
)
else:
self.create_prompt(
prompt_identifier,
is_public=is_public,
description=description,
readme=readme,
tags=tags,
) |
||
parent_commit_hash is None | ||
and is_public is None | ||
and description is None | ||
and readme is None | ||
and tags is None | ||
): | ||
self.update_prompt( | ||
prompt_identifier, | ||
description=description, | ||
readme=readme, | ||
tags=tags, | ||
is_public=is_public, | ||
) | ||
else: | ||
self.create_prompt( | ||
prompt_identifier, | ||
|
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.
what's the need for this? / does "none" mean anything diff than false?