diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-23 16:16:51 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-23 16:26:57 +0300 |
commit | 37301b6734a60d826aedac5b317544c9fa12c4aa (patch) | |
tree | aca8e8c26cf87da2c2c148dcf96bba349c5021a5 | |
parent | 15f9f66ba02967d573fff43c7b7622c5f5f4bc3e (diff) | |
download | ydb-37301b6734a60d826aedac5b317544c9fa12c4aa.tar.gz |
Intermediate changes
18 files changed, 68 insertions, 43 deletions
diff --git a/contrib/python/argcomplete/py3/.dist-info/METADATA b/contrib/python/argcomplete/py3/.dist-info/METADATA index 4fe1c2bb9e..acf27c40a4 100644 --- a/contrib/python/argcomplete/py3/.dist-info/METADATA +++ b/contrib/python/argcomplete/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: argcomplete -Version: 3.2.2 +Version: 3.2.3 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk diff --git a/contrib/python/argcomplete/py3/argcomplete/_check_console_script.py b/contrib/python/argcomplete/py3/argcomplete/_check_console_script.py index 63eac73f6f..ab31a5b1be 100644 --- a/contrib/python/argcomplete/py3/argcomplete/_check_console_script.py +++ b/contrib/python/argcomplete/py3/argcomplete/_check_console_script.py @@ -11,6 +11,7 @@ https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-cre Intended to be invoked by argcomplete's global completion function. """ + import os import sys from importlib.metadata import EntryPoint diff --git a/contrib/python/argcomplete/py3/argcomplete/_check_module.py b/contrib/python/argcomplete/py3/argcomplete/_check_module.py index 0d9fb8f444..7fd6a5caa4 100644 --- a/contrib/python/argcomplete/py3/argcomplete/_check_module.py +++ b/contrib/python/argcomplete/py3/argcomplete/_check_module.py @@ -6,6 +6,7 @@ The module name should be specified in a form usable with `python -m`. Intended to be invoked by argcomplete's global completion function. """ + import os import sys import tokenize diff --git a/contrib/python/argcomplete/py3/argcomplete/finders.py b/contrib/python/argcomplete/py3/argcomplete/finders.py index 95af973b1a..fb0f31cefd 100644 --- a/contrib/python/argcomplete/py3/argcomplete/finders.py +++ b/contrib/python/argcomplete/py3/argcomplete/finders.py @@ -117,11 +117,7 @@ class CompletionFinder(object): # not an argument completion invocation return - try: - _io.debug_stream = os.fdopen(9, "w") - except Exception: - _io.debug_stream = sys.stderr - debug() + self._init_debug_stream() if output_stream is None: filename = os.environ.get("_ARGCOMPLETE_STDOUT_FILENAME") @@ -190,6 +186,19 @@ class CompletionFinder(object): _io.debug_stream.flush() exit_method(0) + def _init_debug_stream(self): + """Initialize debug output stream + + By default, writes to file descriptor 9, or stderr if that fails. + This can be overridden by derived classes, for example to avoid + clashes with file descriptors being used elsewhere (such as in pytest). + """ + try: + _io.debug_stream = os.fdopen(9, "w") + except Exception: + _io.debug_stream = sys.stderr + debug() + def _get_completions(self, comp_words, cword_prefix, cword_prequote, last_wordbreak_pos): active_parsers = self._patch_argument_parser() diff --git a/contrib/python/argcomplete/py3/argcomplete/shell_integration.py b/contrib/python/argcomplete/py3/argcomplete/shell_integration.py index 73214bb651..e84f507de4 100644 --- a/contrib/python/argcomplete/py3/argcomplete/shell_integration.py +++ b/contrib/python/argcomplete/py3/argcomplete/shell_integration.py @@ -5,7 +5,7 @@ from shlex import quote -bashcode = r""" +bashcode = r"""#compdef %(executables)s # Run something, muting output or redirecting it to the debug stream # depending on the value of _ARC_DEBUG. # If ARGCOMPLETE_USE_TEMPFILES is set, use tempfiles for IPC. @@ -75,8 +75,16 @@ _python_argcomplete%(function_suffix)s() { if [[ -z "${ZSH_VERSION-}" ]]; then complete %(complete_opts)s -F _python_argcomplete%(function_suffix)s %(executables)s else + # When called by the Zsh completion system, this will end with + # "loadautofunc" when initially autoloaded and "shfunc" later on, otherwise, + # the script was "eval"-ed so use "compdef" to register it with the + # completion system autoload is-at-least - compdef _python_argcomplete%(function_suffix)s %(executables)s + if [[ $zsh_eval_context == *func ]]; then + _python_argcomplete%(function_suffix)s "$@" + else + compdef _python_argcomplete%(function_suffix)s %(executables)s + fi fi """ diff --git a/contrib/python/argcomplete/py3/ya.make b/contrib/python/argcomplete/py3/ya.make index 4f82b20e4e..02e0bd87f8 100644 --- a/contrib/python/argcomplete/py3/ya.make +++ b/contrib/python/argcomplete/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(3.2.2) +VERSION(3.2.3) LICENSE(Apache-2.0) diff --git a/contrib/python/clickhouse-connect/.dist-info/METADATA b/contrib/python/clickhouse-connect/.dist-info/METADATA index bb7d4b45cd..9564d0f52c 100644 --- a/contrib/python/clickhouse-connect/.dist-info/METADATA +++ b/contrib/python/clickhouse-connect/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: clickhouse-connect -Version: 0.7.1 +Version: 0.7.2 Summary: ClickHouse Database Core Driver for Python, Pandas, and Superset Home-page: https://github.com/ClickHouse/clickhouse-connect Author: ClickHouse Inc. diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py index 104c9df52f..9e69f101cf 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/__version__.py @@ -1 +1 @@ -version = '0.7.1' +version = '0.7.2' diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py index e91e0baf53..ae6d9b7a8e 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/client.py @@ -19,7 +19,7 @@ from clickhouse_connect.driver.external import ExternalData from clickhouse_connect.driver.insert import InsertContext from clickhouse_connect.driver.summary import QuerySummary from clickhouse_connect.driver.models import ColumnDef, SettingDef, SettingStatus -from clickhouse_connect.driver.query import QueryResult, to_arrow, QueryContext, arrow_buffer +from clickhouse_connect.driver.query import QueryResult, to_arrow, QueryContext, arrow_buffer, quote_identifier io.DEFAULT_BUFFER_SIZE = 1024 * 256 logger = logging.getLogger(__name__) @@ -629,7 +629,12 @@ class Client(ABC): :param data: Initial dataset for insert :return Reusable insert context """ - full_table = table if '.' in table or not database else f'{database}.{table}' + full_table = table + if '.' not in table: + if database: + full_table = f'{quote_identifier(database)}.{quote_identifier(table)}' + else: + full_table = quote_identifier(table) column_defs = [] if column_types is None and column_type_names is None: describe_result = self.query(f'DESCRIBE TABLE {full_table}') diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/npquery.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/npquery.py index b037749566..513c81a572 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/npquery.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/npquery.py @@ -1,4 +1,5 @@ import logging +import itertools from typing import Generator, Sequence, Tuple from clickhouse_connect.driver.common import empty_gen, StreamContext @@ -93,14 +94,13 @@ class NumpyResult(Closable): return self def close_df(self): - pieces = list(self._df_stream()) - pieces = [piece for piece in pieces if not piece.empty] - if len(pieces) > 1: - self._df_result = pd.concat(pieces, ignore_index=True) - elif len(pieces) == 1: - self._df_result = pieces[0] - else: - self._df_result = pd.DataFrame() + if self._block_gen is None: + raise StreamClosedError + chains = [itertools.chain(b) for b in zip(*self._block_gen)] + new_df_series = [] + for c in chains: + new_df_series.append(pd.concat([pd.Series(piece, copy=False) for piece in c], copy=False)) + self._df_result = pd.DataFrame(dict(zip(self.column_names, new_df_series))) self.close() return self diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/query.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/query.py index a7c06ec619..2483d61222 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/query.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/query.py @@ -170,9 +170,7 @@ class QueryContext(BaseQueryContext): active_tz = self.server_tz else: active_tz = self.local_tz - # Special case where if everything is UTC, including the local timezone, we use naive timezones - # for performance reasons - if active_tz == pytz.UTC and active_tz.utcoffset(datetime.now()) == self.local_tz.utcoffset(datetime.now()): + if active_tz == pytz.UTC: return None return active_tz @@ -304,8 +302,7 @@ class QueryResult(Closable): def rows_stream(self) -> StreamContext: def stream(): for block in self._row_block_stream(): - for row in block: - yield row + yield from block return StreamContext(self, stream()) @@ -354,6 +351,8 @@ def quote_identifier(identifier: str): def finalize_query(query: str, parameters: Optional[Union[Sequence, Dict[str, Any]]], server_tz: Optional[tzinfo] = None) -> str: + while query.endswith(';'): + query = query[:-1] if not parameters: return query if hasattr(parameters, 'items'): @@ -363,6 +362,8 @@ def finalize_query(query: str, parameters: Optional[Union[Sequence, Dict[str, An def bind_query(query: str, parameters: Optional[Union[Sequence, Dict[str, Any]]], server_tz: Optional[tzinfo] = None) -> Tuple[str, Dict[str, str]]: + while query.endswith(';'): + query = query[:-1] if not parameters: return query, {} if external_bind_re.search(query) is None: diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/driver/transform.py b/contrib/python/clickhouse-connect/clickhouse_connect/driver/transform.py index 3181b9e5e4..03206d0c85 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/driver/transform.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/driver/transform.py @@ -93,10 +93,12 @@ class NativeTransform: write_leb128(block.column_count, output) write_leb128(block.row_count, output) for col_name, col_type, data in zip(block.column_names, block.column_types, block.column_data): - write_leb128(len(col_name), output) - output += col_name.encode() - write_leb128(len(col_type.name), output) - output += col_type.name.encode() + col_enc = col_name.encode() + write_leb128(len(col_enc), output) + output += col_enc + col_enc = col_type.name.encode() + write_leb128(len(col_enc), output) + output += col_enc context.start_column(col_name) try: col_type.write_column(data, output, context) diff --git a/contrib/python/clickhouse-connect/clickhouse_connect/tools/testing.py b/contrib/python/clickhouse-connect/clickhouse_connect/tools/testing.py index 4351709610..ef3f835e18 100644 --- a/contrib/python/clickhouse-connect/clickhouse_connect/tools/testing.py +++ b/contrib/python/clickhouse-connect/clickhouse_connect/tools/testing.py @@ -13,7 +13,10 @@ class TableContext: order_by: str = None, settings: Optional[Dict[str, Any]] = None): self.client = client - self.table = table + if '.' in table: + self.table = table + else: + self.table = quote_identifier(table) self.settings = settings if isinstance(columns, str): columns = columns.split(',') @@ -24,12 +27,12 @@ class TableContext: col = col.strip() ix = col.find(' ') self.column_types.append(col[ix + 1:].strip()) - self.column_names.append(col[:ix].strip()) + self.column_names.append(quote_identifier(col[:ix].strip())) else: - self.column_names = columns + self.column_names = [quote_identifier(name) for name in columns] self.column_types = column_types self.engine = engine - self.order_by = quote_identifier(self.column_names[0]) if order_by is None else order_by + self.order_by = self.column_names[0] if order_by is None else order_by def __enter__(self): if self.client.min_version('19'): diff --git a/contrib/python/clickhouse-connect/ya.make b/contrib/python/clickhouse-connect/ya.make index 1bb663cb9b..40daa9fa20 100644 --- a/contrib/python/clickhouse-connect/ya.make +++ b/contrib/python/clickhouse-connect/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(0.7.1) +VERSION(0.7.2) LICENSE(Apache-2.0) diff --git a/contrib/python/google-auth/py3/.dist-info/METADATA b/contrib/python/google-auth/py3/.dist-info/METADATA index 898701cac8..b4012b87e3 100644 --- a/contrib/python/google-auth/py3/.dist-info/METADATA +++ b/contrib/python/google-auth/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: google-auth -Version: 2.28.1 +Version: 2.28.2 Summary: Google Authentication Library Home-page: https://github.com/googleapis/google-auth-library-python Author: Google Cloud Platform diff --git a/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py b/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py index 108cbfe932..e597365851 100644 --- a/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py +++ b/contrib/python/google-auth/py3/google/auth/compute_engine/_metadata.py @@ -222,11 +222,6 @@ def get( content = _helpers.from_bytes(response.data) if response.status == http_client.NOT_FOUND and return_none_for_not_found_error: - _LOGGER.debug( - "Compute Engine Metadata server call to %s returned 404, reason: %s", - path, - content, - ) return None if response.status == http_client.OK: diff --git a/contrib/python/google-auth/py3/google/auth/version.py b/contrib/python/google-auth/py3/google/auth/version.py index 7580efbee5..0959c75419 100644 --- a/contrib/python/google-auth/py3/google/auth/version.py +++ b/contrib/python/google-auth/py3/google/auth/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2.28.1" +__version__ = "2.28.2" diff --git a/contrib/python/google-auth/py3/ya.make b/contrib/python/google-auth/py3/ya.make index 83e92e22ff..6b3decfc4e 100644 --- a/contrib/python/google-auth/py3/ya.make +++ b/contrib/python/google-auth/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(2.28.1) +VERSION(2.28.2) LICENSE(Apache-2.0) |