singlestoredb 1.5.0__cp38-abi3-win_amd64.whl → 1.6.0__cp38-abi3-win_amd64.whl

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.

Potentially problematic release.


This version of singlestoredb might be problematic. Click here for more details.

_singlestoredb_accel.pyd CHANGED
Binary file
singlestoredb/__init__.py CHANGED
@@ -13,7 +13,7 @@ Examples
13
13
 
14
14
  """
15
15
 
16
- __version__ = '1.5.0'
16
+ __version__ = '1.6.0'
17
17
 
18
18
  from typing import Any
19
19
 
@@ -2,6 +2,7 @@
2
2
  import abc
3
3
  import functools
4
4
  import re
5
+ import sys
5
6
  import textwrap
6
7
  from typing import Any
7
8
  from typing import Callable
@@ -102,7 +103,7 @@ def json_unescape(s: str) -> str:
102
103
 
103
104
  def get_keywords(grammar: str) -> Tuple[str, ...]:
104
105
  """Return all all-caps words from the beginning of the line."""
105
- m = re.match(r'^\s*((?:[A-Z0-9_]+)(\s+|$|;))+', grammar)
106
+ m = re.match(r'^\s*((?:[@A-Z0-9_]+)(\s+|$|;))+', grammar)
106
107
  if not m:
107
108
  return tuple()
108
109
  return tuple(re.split(r'\s+', m.group(0).replace(';', '').strip()))
@@ -110,7 +111,7 @@ def get_keywords(grammar: str) -> Tuple[str, ...]:
110
111
 
111
112
  def is_bool(grammar: str) -> bool:
112
113
  """Determine if the rule is a boolean."""
113
- return bool(re.match(r'^[A-Z0-9_\s*]+$', grammar))
114
+ return bool(re.match(r'^[@A-Z0-9_\s*]+$', grammar))
114
115
 
115
116
 
116
117
  def process_optional(m: Any) -> str:
@@ -137,8 +138,9 @@ def process_repeats(m: Any) -> str:
137
138
 
138
139
  def lower_and_regex(m: Any) -> str:
139
140
  """Lowercase and convert literal to regex."""
140
- sql = m.group(1)
141
- return f'~"{sql.lower()}"i'
141
+ start = m.group(1) or ''
142
+ sql = m.group(2)
143
+ return f'~"{start}{sql.lower()}"i'
142
144
 
143
145
 
144
146
  def split_unions(grammar: str) -> str:
@@ -415,7 +417,7 @@ def process_grammar(
415
417
  sql = re.sub(r'\]\s+\[', r' | ', sql)
416
418
 
417
419
  # Lower-case keywords and make them case-insensitive
418
- sql = re.sub(r'\b([A-Z0-9]+)\b', lower_and_regex, sql)
420
+ sql = re.sub(r'(\b|@+)([A-Z0-9]+)\b', lower_and_regex, sql)
419
421
 
420
422
  # Convert literal strings to 'qs'
421
423
  sql = re.sub(r"'[^']+'", r'qs', sql)
@@ -479,10 +481,16 @@ def process_grammar(
479
481
  cmds = ' / '.join(x for x in rules if x.endswith('_cmd'))
480
482
  cmds = f'init = ws* ( {cmds} ) ws* ";"? ws*\n'
481
483
 
482
- return (
483
- Grammar(cmds + CORE_GRAMMAR + '\n'.join(out)), command_key,
484
- rule_info, syntax_txt, help_txt,
485
- )
484
+ grammar = cmds + CORE_GRAMMAR + '\n'.join(out)
485
+
486
+ try:
487
+ return (
488
+ Grammar(grammar), command_key,
489
+ rule_info, syntax_txt, help_txt,
490
+ )
491
+ except ParseError:
492
+ print(grammar, file=sys.stderr)
493
+ raise
486
494
 
487
495
 
488
496
  def flatten(items: Iterable[Any]) -> List[Any]: