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

[Chore] Fix typos, and organize functions for style #1087

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

miguelcsx
Copy link
Contributor

@miguelcsx miguelcsx commented Oct 23, 2024

Description

This PR addresses the following non-functional maintenance tasks:

  • Fixed various typos in the code and comments.
  • Reorganized some functions to improve style and readability, following code style guidelines.

No functional changes have been made in this PR. The main objective is to improve the maintainability and clarity of the code.

Closes #1086


Important

Cleaned up unused imports, fixed typos, and reorganized functions for improved code style and readability.

  • Imports:
    • Removed unused imports in to_baml_arg.rs, json_schema.rs, repr.rs, chat_message_part.rs, array_helper.rs, coerce_optional.rs, field_type.rs, coerce_class.rs, match_string.rs, types.rs, iterative_parser.rs, parse_state.rs, raw_value.rs, test_iterative_parser.rs, fixing_parser.rs, json_collection.rs, json_parse_state.rs, value.rs, lib.rs, api_interface.rs, core_types.rs, mod.rs, threaded_tracer.rs, harness.rs, test_runtime.rs, runtime_wasm.rs, generate_types.rs, mod.rs, parse_py_type.rs, runtime.rs, baml_example_app.py.
  • Typos:
    • Fixed typos in CHANGELOG.md, README.md, to_baml_arg.rs, json_schema.rs, repr.rs, types.rs, comments.rs, misspeled_boolean_literals.baml, valid_dictionary.baml, shorthand_clients.baml, failing_tests.baml, valid_tests.baml, valid.baml, baml_value_to_jinja_value.rs, chat_message_part.rs, lib.rs, api_interface.rs, core_types.rs, mod.rs, threaded_tracer.rs, harness.rs, test_runtime.rs, runtime_wasm.rs, generate_types.rs, mod.rs, parse_py_type.rs, runtime.rs, baml_example_app.py.
  • Reorganization:
    • Reorganized functions for better style and readability in to_baml_arg.rs, json_schema.rs, repr.rs, chat_message_part.rs, array_helper.rs, coerce_optional.rs, field_type.rs, coerce_class.rs, match_string.rs, types.rs, iterative_parser.rs, parse_state.rs, raw_value.rs, test_iterative_parser.rs, fixing_parser.rs, json_collection.rs, json_parse_state.rs, value.rs, lib.rs, api_interface.rs, core_types.rs, mod.rs, threaded_tracer.rs, harness.rs, test_runtime.rs, runtime_wasm.rs, generate_types.rs, mod.rs, parse_py_type.rs, runtime.rs, baml_example_app.py.

This description was created by Ellipsis for 825d39e. It will automatically update as commits are pushed.

Copy link

vercel bot commented Oct 23, 2024

@miguelcsx is attempting to deploy a commit to the Gloo Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 825d39e in 46 seconds

More details
  • Looked at 1960 lines of code in 86 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. integ-tests/python/baml_example_app.py:26
  • Draft comment:
    Typo in 'parsable'. It should be 'parsable'.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The PR description mentions fixing typos, and there is a typo in the word 'parsable' which should be 'parsable'.

Workflow ID: wflow_y9qTlou2pZadm1H8


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

- fixed typos in code and comments

- reorganized function for improved readability and style
@miguelcsx miguelcsx changed the title [Chore] Clean up unused imports, fix typos, and organize functions for style [Chore] Fix typos, and organize functions for style Oct 23, 2024
@hellovai
Copy link
Contributor

will pause this until #1006 is merged in

Copy link
Collaborator

@sxlijin sxlijin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miguelcsx if you're still interested in getting this PR in, you're welcome to pick it back up now! There's probably a whole bunch of merge conflicts that you'll need to address, you might need to redo this from scratch.

@@ -304,7 +304,7 @@ impl PredefinedTypes {
};

// Any vars that are in both branches are merged
// Any vars that are only in one branch, unioned with undefined
// Any vars that are only in one branch, united with undefined
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Any vars that are only in one branch, united with undefined
// Any vars that are only in one branch, unioned with undefined

"unioned" is technically an invalid word but is deliberately used here to reference type unions

@@ -32,7 +32,7 @@ pub(super) fn coerce_optional(
Some(v) => match inner.coerce(ctx, optional_target, Some(v)) {
Ok(v) => Ok(v),
Err(e) => {
flags.add_flag(Flag::DefaultButHadUnparseableValue(e));
flags.add_flag(Flag::DefaultButHadUnparsableValue(e));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
flags.add_flag(Flag::DefaultButHadUnparsableValue(e));
flags.add_flag(Flag::DefaultButHadUnparseableValue(e));

both "parseable" and "parsable" are valid spellings, but the former will show up when grepping/searching for "parse"

Comment on lines +168 to +169
Flag::DefaultButHadUnparsableValue(value) => {
write!(f, "Null but had unparsable value")?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unparseable

@@ -320,7 +320,7 @@ test_deserializer!(

// This is un-changed
test_deserializer!(
test_prefixed_incompleted_string,
test_prefixed_incompletestring,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test_prefixed_incompletestring,
test_prefixed_incomplete_string,

@@ -156,7 +156,7 @@ pub fn parse_schema(
pest::error::ErrorVariant::ParsingError { positives, .. } => {
get_expected_from_error(&positives)
}
_ => panic!("Could not construct parsing error. This should never happend."),
_ => panic!("Could not construct parsing error. This should never happened."),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ => panic!("Could not construct parsing error. This should never happened."),
_ => panic!("Could not construct parsing error. This should never happen."),

println!("");
println!("Please install mise and direnv to build BAML (instructions: https://www.notion.so/gloochat/To-build-BAML-0e9e3e9b583e40fb8fb040505b24d65f )");
println!("");
println!("\nPlease install mise and direnv to build BAML (instructions: https://www.notion.so/gloochat/To-build-BAML-0e9e3e9b583e40fb8fb040505b24d65f )\n");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undo this change, separate println's are deliberate

Comment on lines -61 to -62
#[cfg(not(feature = "internal"))]
pub(crate) use internal_baml_jinja::{ChatMessagePart, RenderedPrompt};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restore this, i don't trust this change

@@ -382,7 +380,7 @@ impl BamlRuntime {
// generating code, run 'baml-cli dev' to generate code" because that's surprising
//
// We _could_ do something like "show that message the first time the user tries to
// codegen for rest/openapi", but that's overengineered, I think
// codegen for rest/openapi", but that's over engineered, I think
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// codegen for rest/openapi", but that's over engineered, I think
// codegen for rest/openapi", but that's overengineered, I think

@@ -22,7 +22,7 @@ node -e "const prismaSchema = require('@prisma/prisma-schema-wasm'); console.log
- It is triggered from the https://github.com/prisma/engines-wrapper publish action.
- The [Rust source code](https://github.com/prisma/prisma-engines/tree/main/prisma-schema-wasm/src) for the wasm module
- The [nix build definition](https://github.com/prisma/prisma-engines/blob/main/prisma-schema-wasm/default.nix)
- It gives us a fully reproducible, thoroughly described build process and environment. The alternative would be a bash script with installs through `rustup`, `cargo install` and `apt`, with underspecified system dependencies and best-effort version pinning.
- It gives us a fully reproducible, thoroughly described build process and environment. The alternative would be a bash script with installs through `rustup`, `cargo install` and `apt`, with under specified system dependencies and best-effort version pinning.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- It gives us a fully reproducible, thoroughly described build process and environment. The alternative would be a bash script with installs through `rustup`, `cargo install` and `apt`, with under specified system dependencies and best-effort version pinning.
- It gives us a fully reproducible, thoroughly described build process and environment. The alternative would be a bash script with installs through `rustup`, `cargo install` and `apt`, with underspecified system dependencies and best-effort version pinning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Chore] Clean up unused imports, fix typos, and organize functions
3 participants