Skip to content

Commit

Permalink
fix(python): incorrect escaped characters cause warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizencc committed Jun 7, 2024
1 parent bbf6430 commit 4e03888
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/@jsii/python-runtime/tests/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Python jsii runtime tests
## Development Iteration

When iterating on the jsii runtime for Python, the develomer must run
When iterating on the jsii runtime for Python, the developer must run
`yarn build` before making a subsequent attempt at running `pytest` (e.g: via
`yarn test`). This is because the tests run on the code installed in `.env` and
this is updated only by `yarn build`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ abstract class Validation {
t.startsWith('"')
? t.slice(1, t.length - 1)
: t.startsWith('$"')
? t.slice(2, t.length - 1)
: `{${t}}`,
? t.slice(2, t.length - 1)
: `{${t}}`,
)
.join(', ');
if (allowNull) {
Expand Down
3 changes: 2 additions & 1 deletion packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const requirementsFile = path.resolve(
// we use single-quotes for multi-line strings to allow examples within the
// docstrings themselves to include double-quotes (see https://github.com/aws/jsii/issues/2569)
const DOCSTRING_QUOTES = "'''";
const RAW_DOCSTRING_QUOTES = `r${DOCSTRING_QUOTES}`;

export default class Python extends Target {
protected readonly generator: PythonGenerator;
Expand Down Expand Up @@ -1902,7 +1903,7 @@ class PythonModule implements PythonType {
*/
private emitModuleDocumentation(code: CodeMaker) {
if (this.moduleDocumentation) {
code.line(DOCSTRING_QUOTES);
code.line(RAW_DOCSTRING_QUOTES); // raw string
code.line(this.moduleDocumentation);
code.line(DOCSTRING_QUOTES);
}
Expand Down

0 comments on commit 4e03888

Please sign in to comment.