sqlnbfmt 0.1.6__tar.gz → 0.1.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlnbfmt
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: A tool to format SQL code in Jupyter notebooks.
5
5
  Author-email: Qing <qingye779@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sqlnbfmt"
3
- version = "0.1.6"
3
+ version = "0.1.7"
4
4
  description = "A tool to format SQL code in Jupyter notebooks."
5
5
  authors = [
6
6
  { name = "Qing", email = "qingye779@gmail.com" }
@@ -254,7 +254,7 @@ class SQLStringFormatter(ast.NodeTransformer):
254
254
  formatted_sql = '\n'.join(indented_lines)
255
255
 
256
256
  # Reconstruct the string with appropriate quotes
257
- formatted_str = f'"""\n{formatted_sql}\n"""'
257
+ formatted_str = f'"""\n{formatted_sql}\n{" " * 4}"""'
258
258
  else:
259
259
  # Ensure newlines are added around the formatted SQL
260
260
  formatted_str = f'"""\n{formatted_sql}\n"""'
@@ -328,11 +328,18 @@ class SQLStringFormatter(ast.NodeTransformer):
328
328
 
329
329
  new_node = ast.JoinedStr(values=new_values)
330
330
  if '\n' in formatted_sql:
331
- formatted_fstring = ast.JoinedStr(values=[
332
- ast.Constant(value='\n'),
333
- *new_node.values,
334
- ast.Constant(value='\n')
335
- ])
331
+ if in_function:
332
+ formatted_fstring = ast.JoinedStr(values=[
333
+ ast.Constant(value='\n'),
334
+ *new_node.values,
335
+ ast.Constant(value=f'\n{" " * 4}')
336
+ ])
337
+ else:
338
+ formatted_fstring = ast.JoinedStr(values=[
339
+ ast.Constant(value='\n'),
340
+ *new_node.values,
341
+ ast.Constant(value='\n')
342
+ ])
336
343
  else:
337
344
  formatted_fstring = new_node
338
345
  return formatted_fstring
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sqlnbfmt
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: A tool to format SQL code in Jupyter notebooks.
5
5
  Author-email: Qing <qingye779@gmail.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes