id
stringlengths
30
32
content
stringlengths
139
2.8k
codereview_new_python_data_10767
if pandas.__version__ != __pandas_version__: warnings.warn( - f"The pandas version installed {pandas.__version__} does not match the supported pandas version in" - + f" Modin {__pandas_version__}. This may cause undesired side effects!" ) with warnings.catch_warnings(): ```suggestion ...
codereview_new_python_data_10768
def pivot_table( margins_name="All", observed=False, sort=True, -): # noqa: PR01, RT01, D200 - """ - Create a spreadsheet-style pivot table as a DataFrame. - """ if not isinstance(data, DataFrame): raise ValueError( "can not create pivot table with instance of type {...
codereview_new_python_data_10769
_doc_default_io_method = """ {summary} using pandas. For parameters description please refer to pandas API. Returns ------- {returns} ? ```suggestion For parameters description please refer to pandas API. Returns ``` _doc_default_io_method = """ {summary} using pandas. For parameters description plea...
codereview_new_python_data_10770
def make_distribution(self): long_description=long_description, long_description_content_type="text/markdown", install_requires=[ - f"pandas==1.5.2", "packaging", "numpy>=1.18.5", "fsspec", ```suggestion "pandas==1.5.2", ``` def make_distribution(self): ...
codereview_new_python_data_10771
try: from dfsql import sql_query as dfsql_query import dfsql.extensions # noqa: F401 except ImportError: warnings.warn( ## Unused import Import of 'dfsql' is not used. [Show more details](https://github.com/modin-project/modin/security/code-scanning/432) try: from dfsql import sql_quer...
codereview_new_python_data_10772
try: from dfsql import sql_query as dfsql_query import dfsql.extensions # noqa: F401 except ImportError: warnings.warn( Can we put a comment here that this import adds sql method to DataFrame? try: from dfsql import sql_query as dfsql_query + + # This import is required to inject the ...
codereview_new_python_data_10773
def query(sql: str, *args, **kwargs) -> pd.DataFrame: """ - Execute SQL query using either hdk_query or dfsql. Parameters ---------- ```suggestion Execute SQL query using either HDK engine or dfsql. ``` def query(sql: str, *args, **kwargs) -> pd.DataFrame: """ + Execute SQL q...
codereview_new_python_data_10927
def ParseFileObject(self, parser_mediator, file_object, **kwargs): event_data = LocateDatabaseEvent() event_data.path = directory_header.path - event_data.contents = contents event_data.written_time = posix_time.PosixTimeInNanoseconds( timestamp=timestamp) `= contents or None`...
codereview_new_python_data_10928
class LocateDatabaseEvent(events.EventData): Attributes: entries (list[str]): contents of the locate database (updatedb) entry. - path: path of the locate database (updatedb) entry. written_time (dfdatetime.DateTimeValues): entry written date and time. """ `path:` => `path (str):` class Locat...
codereview_new_python_data_10929
from plaso.containers import events from plaso.containers import time_events -from plaso.lib import errors from plaso.lib import definitions from plaso.parsers import manager from plaso.parsers import text_parser style nit: make import order alphabetical from plaso.containers import events from plaso.c...
codereview_new_python_data_10930
from plaso.parsers import opera from plaso.parsers import pe from plaso.parsers import plist -from plaso.parsers import postgresql from plaso.parsers import pls_recall from plaso.parsers import recycler from plaso.parsers import safari_cookies from plaso.parsers import sccm move this below pls_recall so it's i...
codereview_new_python_data_10931
from plaso.parsers import opera from plaso.parsers import pe from plaso.parsers import plist - from plaso.parsers import pls_recall from plaso.parsers import postgresql from plaso.parsers import recycler i think you missed clearing this line. from plaso.parsers import opera from plaso.parsers import pe fro...
codereview_new_python_data_10932
def ParseRecord(self, parser_mediator, key, structure): event_data.log_line = log_line.lstrip().rstrip() time_zone_string = self._GetValueFromStructure(structure, 'time_zone') try: time_zone = pytz.timezone(time_zone_string) except pytz.UnknownTimeZoneError: - if time_zone_string ...
codereview_new_python_data_10933
def testProcess(self): expected_event_values = { 'date_time': '2020-04-12 13:55:51', - 'desc': 'com.apple.mobilecal' - } self.CheckEventValues(storage_writer, events[0], expected_event_values) style nit: put the closing bracket on the same line def testProcess(self): expected...
codereview_new_python_data_10937
def _process(self, element, key=None): cats = list(hvds.data.dtypes[column].categories) except TypeError: # Issue #5619, cudf.core.index.StringIndex is not iterable. - cats = list(hvds.data.dtypes[column].categories.values_host) if cats == ['__...
codereview_new_python_data_10938
def test_pickle(self): def test_dataset_transform_by_spatial_select_expr_index_not_0_based(): """Ensure 'spatial_select' expression works when index not zero-based. - Use 'spatial_select' defined by four nodes to select index 104, 105. Apply expression to dataset.transform to generate new 'flag' ...
codereview_new_python_data_10939
class Empty(Dimensioned, Composable): group = param.String(default='Empty') - def __init__(self, **params) -> None: super().__init__(None, **params) We have not started adding type hints to HoloViews. I'm in favor but that should be a project level decision. ```suggestion def __init__...
codereview_new_python_data_10940
def spatial_select_columnar(xvals, yvals, geometry): # Dask not compatible with above assignment statement. # To circumvent, create a Series, fill in geom_mask values, # and use mask() method to fill in values. geom_mask_expanded = pd.Series(False, index=mask.index) geom_ma...
codereview_new_python_data_10941
def help(obj, visualization=True, ansi=True, backend=None, pydoc.help(obj) -del io, os, rcfile, warnings ```suggestion del os, rcfile, warnings ``` def help(obj, visualization=True, ansi=True, backend=None, pydoc.help(obj) +del os, rcfile, warnings
codereview_new_python_data_10942
def __call__(self, *args, **opts): # noqa (dummy signature) if '_pyodide' in sys.modules: from .pyodide import pyodide_extension, in_jupyterlite if not in_jupyterlite(): extension = pyodide_extension del pyodide_extension, in_jupyterlite Maybe add a comment to say in jupyterlite the normal ...
codereview_new_python_data_10943
def test_colorbar_opts_title(self): y,x = np.mgrid[-5:5, -5:5] * 0.1 z=np.sin(x**2+y**2) scatter = Scatter3D((x.flat,y.flat,z.flat)).opts(colorbar=True, colorbar_opts={"title": "some-title"}) - plot = plotly_renderer.get_plot(scatter) state = self._get_plot_state(scatter) ...
codereview_new_python_data_10944
def _update_ranges(self, element, ranges): plot.width, plot.height = None, None else: plot.aspect_ratio = 1./aspect - elif not (fixed_height and fixed_width): # Bokeh 2.0 suport # Should mirror the previous if-statement ...
codereview_new_python_data_11039
def fini_expression( ir = setgen.scoped_set(ir, ctx=ctx) # Compile any triggers that were triggered by the query - ir_triggers = triggers.compile_triggers( - ast_visitor.find_children(ir, irast.MutatingStmt), ctx=ctx) # Collect all of the expressions stored in various side sets # ...
codereview_new_python_data_11040
class Ptr(Base): class Splat(Base): depth: int type: typing.Optional[TypeExpr] = None intersection: typing.Optional[TypeIntersection] = None ```suggestion class Splat(Base): # Path element referring to all properties and links of an object depth: int ``` class Ptr(Base): cla...
codereview_new_python_data_11041
"cast": ("CAST", RESERVED_KEYWORD), "catalog": ("CATALOG_P", UNRESERVED_KEYWORD), "chain": ("CHAIN", UNRESERVED_KEYWORD), - "char": ("CHAR_P", TYPE_FUNC_NAME_KEYWORD), "character": ("CHARACTER", COL_NAME_KEYWORD), "characteristics": ("CHARACTERISTICS", UNRESERVED_KEYWORD), "check": ("C...
codereview_new_python_data_11042
def parse_search_path(search_path_str: str) -> list[str]: options = pg_resolver.Options( current_user='edgedb', current_database='edgedb', **args ) resolved = pg_resolver.resolve(stmt, schema, options) @f...
codereview_new_python_data_11043
async def test_sql_static_eval(self): res = await self.squery_values('select current_schema;') self.assertEqual(res, [['public']]) - await self.scon.execute("set search_path to blah") - res = await self.squery_values("select current_schema") - self.assertEqual(res, [['blah']]) ...
codereview_new_python_data_11044
def _build_a_expr(n: Node, c: Context) -> pgast.BaseExpr: def _build_func_call(n: Node, c: Context) -> pgast.FuncCall: n = _unwrap(n, "FuncCall") - name = tuple(_list(n, c, "funcname", _build_str)) # type: tuple[str, ...] - if name == ('set_config',) or name == ('pg_catalog', 'set_config'): - rai...
codereview_new_python_data_11045
def contains_set_of_op(ir: irast.Base) -> bool: flt = (lambda n: any(x == ft.TypeModifier.SetOfType for x in n.params_typemods)) return bool(ast.find_children(ir, irast.Call, flt, terminate_early=True)) - - -class PointerCollectorVisitor(ast.NodeVisitor): - collected: List[irast....
codereview_new_python_data_11046
def node_visit(self, node: base.AST) -> None: return visitor(node) def visit_indented( - self, node: base.AST, indent: bool = False, nest: bool = False ) -> None: if nest: self.write("(") Should indent be true by default? def node_visit(self, node: base.AST) -> None...
codereview_new_python_data_11047
def copyfrom(self, other): self.type = other.type -class SubLinkType(enum.IntEnum): - pass - pass - pass - pass - - class SubLink(ImmutableBaseExpr): """Subselect appearing in an expression.""" Maybe just one `pass`. def copyfrom(self, other): self.type = other.type cl...
codereview_new_python_data_11048
def _cmd_tree_from_ast( if getattr(astnode, 'declared_overloaded', False): cmd.set_attribute_value('declared_overloaded', True) else: - # This is an abstract propery/link if cmd.get_attribute_value('default') is not None: typ = cls.get_sch...
codereview_new_python_data_11049
def compile_cast( ctx=ctx, ) if new_stype.is_enum(ctx.env.schema): objctx = ctx.env.options.schema_object_context if objctx in (s_constr.Constraint, s_indexes.Index): Add a comment why def compile_cast( ctx=ctx, ) + # Constrai...
codereview_new_python_data_11050
def _maybe( return None -def _ident(t: T) -> Any: return t I'd drop the `T` and just make it `object` or `Any`. Not much point in having a type param only used once. def _maybe( return None +def _ident(t: Any) -> Any: return t
codereview_new_python_data_11051
# List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['guides/deployment/heroku.rst'] # The reST default role (used for this markup: `text`) to use for all # documents. The correct way is to mark the rest file as `:or...
codereview_new_python_data_11052
def _reset_schema( current_tx = ctx.state.current_tx() schema = current_tx.get_schema(ctx.compiler_state.std_schema) - current_tx.start_migration() - empty_schema = s_schema.ChainedSchema( ctx.compiler_state.std_schema, s_schema.FlatSchema(), Hm, does this get cleaned up somewher...
codereview_new_python_data_11053
def _validate_default_auth_method( 'database. May be used with or without `--bootstrap-only`.'), click.option( '--bootstrap-script', type=PathPath(), metavar="PATH", - envvar="EDGEDB_SERVER_BOOTSTRAP_SCRIPT", help='run the script when initializing the database. ' ...
codereview_new_python_data_11054
def object_type_to_python_type( pytype = scalar_type_to_python_type(ptype, schema) ptr_card: qltypes.SchemaCardinality = p.get_cardinality(schema) - try: is_multi = ptr_card.is_multi() - except ValueError: raise UnsupportedExpressionError() if ...
codereview_new_python_data_11055
async def squery_values(self, query): res = await self.squery(query) return [list(r.values()) for r in res] - def assertShape(self, res, rows, cols, column_names=None): self.assertEqual(len(res), rows) if rows > 0: self.assertEqual(len(res[0]), cols) Add a docstri...
codereview_new_python_data_11056
def _lookup_column( elif len(name) == 2: # look for the column in the specific table - tab_name = name[0] - col_name = name[1] try: table = _lookup_table(cast(str, tab_name), ctx) `tab_name, col_name = name` def _lookup_column( elif len(name) == 2: ...
codereview_new_python_data_11057
def prepare_patch( # We need to delete all the support views and recreate them at the end support_view_commands = metaschema.get_support_views( reflschema, backend_params) - for cv in support_view_commands: dv = dbops.DropView( cv.view.name, - ...
codereview_new_python_data_11058
def reduce_CreateQualifiedComputableLink(self, *kids): # # Access Policies # -sdl_commands_block('CreateAccessPolicy', SetField, SetAnnotation) class AccessPolicyDeclarationBlock(Nonterm): nit: Probably better to keep this expanded def reduce_CreateQualifiedComputableLink(self, *kids): # # Access Policies...
codereview_new_python_data_11059
-from setuptools import setup, Extension -from Cython.Build import cythonize - -import os.path - -libpg_query = os.path.join('.', 'libpg_query') - -extensions = cythonize([ - Extension('pypg_query.parser', - ['pypg_query/parser.pyx'], - libraries=['pg_query'], - include_dirs=[...
codereview_new_python_data_11060
from typing import Optional Please add our standard copyright comment to all new .py files. +# +# This source file is part of the EdgeDB open source project. +# +# Copyright 2010-present MagicStack Inc. and the EdgeDB authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not...
codereview_new_python_data_11061
async def _bootstrap(ctx: BootstrapContext) -> None: schema = s_schema.FlatSchema() schema = await _init_defaults(schema, compiler, tpl_ctx.conn) - if backend_params.has_create_database: - await conn.sql_execute( - b"ANALYZE", - ) finally: ...
codereview_new_python_data_11062
def resolve_envvar_value(self, ctx: click.Context): _server_options = [ click.option( '-D', '--data-dir', type=PathPath(), - envvar="EDGEDB_SERVER_DATADIR", help='database cluster directory'), click.option( '--postgres-dsn', type=str, hidden=True, ```suggestion en...
codereview_new_python_data_11063
def prepare_patch( if kind == 'sql': return (patch, update), (), schema # EdgeQL patches need to be compiled. current_block = dbops.PLTopBlock() std_plans = [] `assert` here that `kind` is `edgeql`? def prepare_patch( if kind == 'sql': return (patch, update), (), schema ...
codereview_new_python_data_11064
def _compile_ql_query( options=self._get_compile_options(ctx), ) - if ir.cardinality.is_single(): - if ir.cardinality.can_be_zero(): - result_cardinality = enums.Cardinality.AT_MOST_ONE - else: - result_cardinality = enums.Cardinality.O...
codereview_new_python_data_11065
class Cardinality(enum.Enum): @classmethod def from_ir_value(cls, card: ir.Cardinality) -> Cardinality: - if card == ir.Cardinality.AT_MOST_ONE: return Cardinality.AT_MOST_ONE - elif card == ir.Cardinality.ONE: return Cardinality.ONE - elif card == ir.Cardinal...
codereview_new_python_data_11066
async def _start_servers( # Fail if none of the servers can be started, except when the admin # server on a UNIX domain socket will be started. - if not servers and not (admin and port): raise StartupError("could not create any listen sockets") addrs = [] ```suggesti...
codereview_new_python_data_11067
async def _start_servers( if fut.result() is not None }) - if not servers and not (admin and port): raise StartupError("could not create any listen sockets") addrs = [] Please add a short comment here. async def _start_servers( if fut.r...
codereview_new_python_data_11068
def _normalize_view_ptr_expr( else: msg = f'cannot assign to {ptrcls_sn.name}' if id_access and not ctx.env.options.allow_user_specified_id: - hint = 'config setting allow_user_specified_id must be enabled' else: hint = None ```suggestion ...
codereview_new_python_data_11069
# Increment this whenever the database layout or stdlib changes. -EDGEDB_CATALOG_VERSION = 2022_07_25_00_00 EDGEDB_MAJOR_VERSION = 3 ```suggestion EDGEDB_CATALOG_VERSION = 2022_07_26_00_00 ``` # Increment this whenever the database layout or stdlib changes. +EDGEDB_CATALOG_VERSION = 2022_07_26_00_0...
codereview_new_python_data_11070
def _parse_computable( and target.is_view(expression.irast.schema) ): raise errors.UnsupportedFeatureError( - f'including a shape on schema-defined computed pointers ' f'is not yet supported', context=self.source_context, ...
codereview_new_python_data_11071
def extend_path( orig_ptrcls = ptrcls - # For view ptrclses, find the place where the pointer is "really" - # defined that is, either its schema definition site or where it - # last had a expression defining it. - # # This makes it so that views don't change path ids unless they are # in...
codereview_new_python_data_11448
"""Approximate Kendall's Tau-b Metric.""" import tensorflow as tf -from keras.metrics import Metric from tensorflow_addons.utils.types import AcceptableDTypes from typeguard import typechecked We need to import Keras from TF """Approximate Kendall's Tau-b Metric.""" import tensorflow as tf +from tensor...
codereview_new_python_data_11488
from test_utils import compare_pipelines from sequences_test_utils import (ArgData, ArgDesc, ArgCb, ParamsProvider, get_video_input_cases, sequence_suite_helper) -from nose.plugins.attrib import attr test_data_root = os.environ['DALI_EXTRA_PATH'] ## Unused import Import of '...
codereview_new_python_data_11489
def _discover_autoserialize(module, visited): ret = [] try: module_members = inspect.getmembers(module) - except ModuleNotFoundError as e: # If any module can't be inspected, DALI will not be able to find the @autoserialize # anyway. We can just skip this module. return...
codereview_new_python_data_11490
def naive_hist_pipe(): img, _ = fn.readers.file(files=test_file_list) # The naive_histogram accepts single-channels image, thus we conert the image to Grayscale. - img = fn.decoders.image(img, n_bins=24, device='mixed', output_type=DALIImageType.GRAY) img = img.gpu() - img = fn.naive_histogram(im...
codereview_new_python_data_11491
def check_env_compatibility(): raise SkipTest() if cuda.runtime.get_version() > cuda.driver.driver.get_version(): raise SkipTest() - if '.'.join(str(i) for i in cuda.driver.driver.get_version()) >= LooseVersion('12.0') and \ LooseVersion(numba.__version__) < LooseVersion('0.56.4'...
codereview_new_python_data_11492
def __str__(self): __repr__ = __str__ - def __hash__(self) -> int: - return hash(str(self) + str(self.source)) - # Note: Regardless of whether we want the cpu or gpu version # of a tensor, we keep the source argument the same so that # the pipeline can backtrack through the user-defin...
codereview_new_python_data_11493
def conditional_split_merge_reinterpret_pipe(dtype, layout, shape): input = fn.external_source( source=[[np.full((10, 10, 3), 42, dtype=np.int32) for _ in range(batch_size)]], cycle=True) pred = fn.external_source( - source=[[np.array(i % 2 == 0, dtype=np.bool_) for i in range(batch_size)]], ...
codereview_new_python_data_11494
def filter_pipeline(max_batch_size, inputs, device): fill_value_bacthes = [list(fvs) for _, _, fvs in batches] @pipeline_def - def piepline(): samples = fn.external_source(source=sample_batches, layout="HWC") filters = fn.external_source(source=filter_batches) ...
codereview_new_python_data_11495
def decoder_pipe(data_path, device, use_fast_idct=False): test_data_root = get_dali_extra_path() good_path = 'db/single' misnamed_path = 'db/single/missnamed' -test_good_path = {'jpeg', 'mixed', 'png', 'pnm', 'bmp', 'jpeg2k', 'webp'} -test_misnamed_path = {'jpeg', 'png', 'pnm', 'bmp'} def run_decode(data_path,...
codereview_new_python_data_11496
def _measure_time(func, n_iterations=30): start = time.perf_counter() func() stop = time.perf_counter() - times.append(stop - start) return np.mean(np.array(times)) @staticmethod shouldn't you append *inside* the loop? Otherwise you are only counting the l...
codereview_new_python_data_11497
def test_fail_conditional_split_merge(): base = ( "Divergent data found in different branches of conditional operation. All paths in " "conditional operation are merged into one batch which must have consistent type, " - "dimensionality, layout and other metadata. Found distinct " ) ...
codereview_new_python_data_11498
def test_fail_conditional_split_merge(): base = ( "Divergent data found in different branches of conditional operation. All paths in " "conditional operation are merged into one batch which must have consistent type, " - "dimensionality, layout and other metadata. Found distinct " ) ...
codereview_new_python_data_11499
def deprecation_warning(what): deprecation_warning("DALI support for Python 3.10 is experimental and some functionalities " "may not work.") - if __cuda_version__ < 102: - deprecation_warning("DALI 1.3 is the last official release that supports CUDA 10.0. " - ...
codereview_new_python_data_11500
import random from functools import partial from nvidia.dali.pipeline import Pipeline -import nose_utils test_data_root = os.environ['DALI_EXTRA_PATH'] images_dir = os.path.join(test_data_root, 'db', 'single', 'jpeg') Is this needed? import random from functools import partial from nvidia.dali.pipeline im...
codereview_new_python_data_11501
def run_decode(data_path, batch, device, threads): pipe.build() iters = math.ceil(pipe.epoch_size("Reader") / batch) for iter in range(iters): - print("Iteration", iter + 1, "/", iters) pipe.run() remove this print? def run_decode(data_path, batch, device, threads): pipe.buil...
codereview_new_python_data_11502
def close(a, b): absdiff = a - b if b < a else b - a - return absdiff < 1e-5 or absdiff < abs(a) + abs(b) * 1e-6 def analyze_frame(image, channel_dim): ```suggestion if isinstance(a, np.float32): return np.isclose(a, b) absdiff = a - b if b < a else b - a return absdiff <= 1 ...
codereview_new_python_data_11503
def test_operator_coord_flip(): layout_shape_values.append(("xy", (0, 2))) for layout, shape in layout_shape_values: for center_x, center_y, center_z in [(0.5, 0.5, 0.5), (0.0, 1.0, -0.5)]: - yield check_operator_coord_flip, device, batch_size, layout, ...
codereview_new_python_data_11504
def test_operator_coord_flip(): layout_shape_values.append(("xy", (0, 2))) for layout, shape in layout_shape_values: for center_x, center_y, center_z in [(0.5, 0.5, 0.5), (0.0, 1.0, -0.5)]: - yield check_operator_coord_flip, device, batch_size, layout, ...
codereview_new_python_data_11505
def main(_): assert FLAGS.image_dir, "`image_dir` missing." assert (FLAGS.image_info_file or FLAGS.object_annotations_file or - FLAGS.caption_annotations_file, "All annotation files are " "missing.") if FLAGS.image_info_file: image_info_file = FLAGS.image_info_file ...
codereview_new_python_data_11506
def main(_): assert FLAGS.image_dir, "`image_dir` missing." assert (FLAGS.image_info_file or FLAGS.object_annotations_file or - FLAGS.caption_annotations_file, "All annotation files are " "missing.") if FLAGS.image_info_file: image_info_file = FLAGS.image_info_file ...
codereview_new_python_data_11507
class ShmMessageDesc(Structure): `num_bytes` : unsigned long long int Size in bytes of the serialized message """ - _fields = ("worker_id", "i"), ("shm_chunk_id", "i"), ("shm_capacity", "Q"), \ - ("offset", "Q"), ("num_bytes", "Q") class WorkerArgs: I think the following reads ...
codereview_new_python_data_11508
def _discover_autoserialize(module, visited): def invoke_autoserialize(head_module, filename): """ - Perform the autoserialization of a function marked by :meth:`nvidia.dali.plugin.triton.autoserialize`. Assuming, that user marked a function with ``@autoserialize`` decorator, the - ``invoke_autose...
codereview_new_python_data_11509
def autoserialize(dali_pipeline): """ Decorator, that marks a DALI pipeline (represented by :meth:`nvidia.dali.pipeline_def`) for - autoserialization in [DALI Backend's](https://github.com/triton-inference-server/dali_backend#dali-triton-backend) model repository. For details about the autoseriali...
codereview_new_python_data_11510
def get(self, num_samples=1, predicate=None) -> Optional[List[MSG_CLASS]]: was specified and it evaluated to False after waiting on empty queue. The call returns None iff the queue was closed. predicate : a parameterless callable - Used for double-checking if the item shou...
codereview_new_python_data_11511
def open_shm(self, handle): assert self._shm_chunk is None try: self._shm_chunk = shared_mem.SharedMem.open(handle, self.capacity) - except ValueError: if handle >= 0: os.close(handle) raise ```suggestion except: # noqa: E722 ...
codereview_new_python_data_11512
def name_to_sphinx(self): class OpReference: - def __init__(self, operator, docstring, order = None): self.operator = operator self.docstring = docstring self.order = 1000000 if order is None else order Unfortunately, Python has infinite integers and sorting by key (instead of compa...
codereview_new_python_data_11513
def name_to_sphinx(self): class OpReference: - def __init__(self, operator, docstring, order = None): self.operator = operator self.docstring = docstring self.order = 1000000 if order is None else order ```suggestion def __init__(self, operator, docstring, order=None): ``` d...
codereview_new_python_data_11514
def run_tf_with_dali_external_source(dev, es_args, ed_dev, dtype, *_): run_tf_dataset_graph( dev, get_pipeline_desc=get_external_source_pipe(es_args, dtype, ed_dev), - to_dataset=external_source_to_tf_dataset, to_stop_iter=True) @with_setup(skip_inputs_for_incompatible_tf) ```sugges...
codereview_new_python_data_11515
# See the License for the specific language governing permissions and # limitations under the License. from nvidia.dali.pipeline import Pipeline import nvidia.dali.ops as ops import nvidia.dali.fn as fn `# noqa` - this import has a side effect and is required for Python 3.10 # See the License for the specif...
codereview_new_python_data_11516
def _compare_to_cv_distortion(in_img, out_img, q, no): decoded_img = cv2.cvtColor(decoded_img_bgr, cv2.COLOR_BGR2RGB) diff = cv2.absdiff(out_img, decoded_img) - diff_in_range = np.average( - diff) < 5, f"Absolute difference with the reference is too big: {np.average(diff)}" if dump_images ...
codereview_new_python_data_11517
def test_operator_erase_with_out_of_bounds_roi_coords(): axis_names = "HW" anchor_arg = (4, 10, 10, 4) shape_arg = (40, 50, 50, 40) - anchor_norm_arg = ( - 4 / 60.0, 10 / 80.0, 2000, 2000, 10 / 60.0, 4 / 80.0 - ) # second region is completely out of bounds shape_norm_arg = (40 / 60.0,...
codereview_new_python_data_11518
from nose_utils import assert_raises from segmentation_test_utils import make_batch_select_masks -from test_dali_cpu_only_utils import pipeline_arithm_ops_cpu, setup_test_nemo_asr_reader_cpu, \ - setup_test_numpy_reader_cpu from test_detection_pipeline import coco_anchors from test_utils import get_dali_extra...
codereview_new_python_data_11519
def dali_type_to_np(dtype): def bricon_ref(input, brightness, brightness_shift, contrast, contrast_center, out_dtype): output_range = max_range(out_dtype) - output = brightness_shift * output_range + brightness * (contrast_center + contrast * - (in...
codereview_new_python_data_11520
def test_api_fw_check1(iter_type, data_definition): pipe.run]: try: method() - assert (False) except RuntimeError: - assert (True) # disable check pipe.enable_api_check(False) for method in [pipe.schedule_run, pipe.share_outputs, p...
codereview_new_python_data_11557
def get_normal_upgrade_frequency(conf=__conf__): return conf.get_int("Debug.AutoUpdateNormalFrequency", 24 * 60 * 60) def get_firewall_rules_log_period(conf=__conf__): """ Determine the frequency to perform the periodic operation of logging firewall rules. This is not needed as we have only reques...
codereview_new_python_data_11558
def load_conf_from_file(conf_file_path, conf=__conf__): "Debug.CgroupCheckPeriod": 300, "Debug.AgentCpuQuota": 50, "Debug.AgentCpuThrottledTimeThreshold": 120, - "Debug.AgentMemoryQuota": 31457280, "Debug.EtpCollectionPeriod": 300, "Debug.AutoUpdateHotfixFrequency": 14400, "Debug.AutoU...
codereview_new_python_data_11559
def _is_orphaned(self): def _load_agents(self): path = os.path.join(conf.get_lib_dir(), "{0}-*".format(AGENT_NAME)) - return [GuestAgent(is_fast_track_goal_state=self._goal_state.extensions_goal_state.source == GoalStateSource.FastTrack, path=agent_dir) for agent_dir in glob.igl...
codereview_new_python_data_11560
def get_used_and_available_system_memory(): """ used_mem = available_mem = 0 free_cmd = ["free", "-b"] - try: - memory = shellutil.run_command(free_cmd) - for line in memory.split("\n"): - if ALL_MEMS_REGEX.match(line): - mems = ...
codereview_new_python_data_11580
def invoke(self, invocation_context: ApiInvocationContext): try: object = s3.get_object(Bucket=bucket, Key=object_key) except s3.exceptions.NoSuchKey: - msg = "Object %s not found" % object_key LOG.debug(msg) return make_error_response(msg, 404) ni...
codereview_new_python_data_11581
def register(self, subclasses=False): def _pickle(self, pickler, obj: _T): state = self.get_state(obj) - # this is a builtin.Certificate which cannot be pickled, but can be restored from data inside the CertBundle self.prepare(obj, state) return pickler.save_reduce(self._unpick...
codereview_new_python_data_11582
def test_cfn_with_multiple_route_table_associations(ec2_client, deploy_cfn_templ assert subnet2["PrivateDnsNameOptionsOnLaunch"]["HostnameType"] == "ip-name" @pytest.mark.skip_snapshot_verify(paths=["$..DriftInformation", "$..Metadata"]) def test_internet_gateway_ref_and_attr(deploy_cfn_template, cfn_client...
codereview_new_python_data_11583
def start_lambda(port=None, asynchronous=False): endpoint=handle_lambda_url_invocation, ) - if not config.LAMBDA_EXECUTOR: - default_mode = get_default_executor_mode() - LOG.debug("No executor set. Lambda falling back to default executor mode: %s", default_mode) - log.event("lam...
codereview_new_python_data_11584
def fetch_state(self, stack_name, resources): # TODO: change the signature to pass in a Stack instance (instead of stack_name and resources) def update_resource(self, new_resource, stack_name, resources): """Update the deployment of this resource, using the updated properties (implemented by subclas...
codereview_new_python_data_11585
def create_launch_template( status_code=400, ) - result = call_moto(context) - return result @handler("ModifyLaunchTemplate", expand=False) def modify_launch_template( Please create a `InvalidLaunchTemplateNameError` exception. See my previous note. def crea...
codereview_new_python_data_11586
def test_modify_launch_template(self, ec2_client, create_launch_template, id_typ launch_template_result = create_launch_template(f"template-with-versions-{short_uid()}") template = launch_template_result["LaunchTemplate"] - # call the API identifying the template wither by `LaunchTemplateId`...