Skip to content

Commit

Permalink
Fixed issues: grammatical in service_metadata.md and logical in calcu…
Browse files Browse the repository at this point in the history
…lator.py
  • Loading branch information
Arondondon committed Sep 26, 2024
1 parent 4418f91 commit ea97b5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/metadata_provider/service_metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ This class represents the service metadata.

#### `__init__`

Initializes a new instance of the class. Initializes the `m` dict with empty of default values.
Initializes a new instance of the class. Initializes the `m` dict with empty or default values.

###### returns:

Expand Down Expand Up @@ -272,7 +272,7 @@ If the asset type is not supported, an exception is raised.
#### `add_endpoint_to_group`

Checks the endpoint is valid and adds it to the `endpoints` field of the specified payment group in the `m` dict.
If the endpoint is not valid of if the group does not exist or if the endpoint is already present, an exception is
If the endpoint is not valid or if the group does not exist or if the endpoint is already present, an exception is
raised.

###### args:
Expand Down
9 changes: 5 additions & 4 deletions examples/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ def parse_expression(expression):
if len(elements) != 3:
raise Exception(f"Invalid expression '{expression}'. Three items required.")

a = int(elements[0])
b = int(elements[2])
if elements[1] not in ["+", "-", "*", "/"]:
raise Exception(f"Invalid expression '{expression}'. Operation must be '+' or '-' or '*' or '/'")
elif not isinstance(a, (float, int)) or not isinstance(b, (float, int)):
raise Exception(f"Invalid expression '{expression}'. Operation must be '+' or '-' or '*' or '/'.")
try:
a = float(elements[0])
b = float(elements[2])
except ValueError:
raise Exception(f"Invalid expression '{expression}'. Operands must be integers or floating point numbers.")
op = elements[1]

Expand Down

0 comments on commit ea97b5f

Please sign in to comment.