Showing 236 of 3,906 total issues
Function _wait_result
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _wait_result(future: "Future[T]", timeout: Optional[float] = None) -> T:
"""
Wait on a future with an optional timeout without side effects. This won't update
the status of the future for errors/timeouts.
"""
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function write
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def write(
self,
file: _Writable,
dest: Optional[str] = None,
**kwargs: Any,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _histogram_from_sketch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _histogram_from_sketch(
sketch: kll_doubles_sketch,
max_buckets: Optional[int] = None,
avg_per_bucket: Optional[float] = None,
min_n_buckets: Optional[int] = None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function relevant_counter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def relevant_counter(self, row: pd.core.series.Series, k: int) -> int:
if self.convert_non_numeric:
return sum(
[1 if pred_val in row[self.target_column] else 0 for pred_val in row[self.prediction_column][:k]]
)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function resolve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resolve(self, name: str, why_type: DataType, fi_disabled: bool = False) -> Dict[str, Metric]:
metrics: Dict[str, Metric] = {
"counts": StandardMetric.counts.zero(MetricConfig()),
"types": StandardMetric.types.zero(MetricConfig()),
"cardinality": StandardMetric.cardinality.zero(MetricConfig()),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _validate_timestamp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _validate_timestamp(timestamp: Union[date, datetime, pd.Timestamp, str]) -> datetime:
if isinstance(timestamp, pd.Timestamp):
return timestamp.to_pydatetime()
if isinstance(timestamp, str):
try:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function process_batch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_batch(self, batch: List[LoggerMessage], batch_type: Type[LoggerMessage]) -> None:
if batch_type == TrackMessage:
self._process_track_messages(cast(List[TrackMessage], batch))
elif batch_type == FlushMessage:
self._process_flush_messages(cast(List[FlushMessage], batch))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function truncate_time_ms
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def truncate_time_ms(t: int, granularity: TimeGranularity) -> int:
dt = datetime.fromtimestamp(t / 1000, tz=tz.tzutc()).replace(second=0, microsecond=0)
if granularity == TimeGranularity.Minute:
trunc = dt
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function to_protobuf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_protobuf(self) -> MetricMessage:
msg = {}
for sub_name, metrics in self.submetrics.items():
for namespace, metric in metrics.items():
sub_msg = metric.to_protobuf()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _do_write
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _do_write(self, out_f: BinaryIO, **kwargs: Any) -> Tuple[bool, str]:
if kwargs.get("use_v0") or self.profile_view.model_performance_metrics:
if self.profile_view.model_performance_metrics:
logger.info("Converting segmented profile with performance metrics to v0 format before writing.")
else:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _do_submetric_merge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _do_submetric_merge(lhs: Dict[str, Metric], rhs: Dict[str, Metric]) -> Dict[str, Metric]:
namespaces = set(lhs.keys())
namespaces.update(rhs.keys())
result: Dict[str, Metric] = {}
for namespace in namespaces:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function len
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def len(self) -> int:
length = 0
if self.ints is not None:
length += len(self.ints)
if self.floats is not None:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _merge_CM
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _merge_CM(old_conf_matrix: ConfusionMatrix, new_conf_matrix: ConfusionMatrix):
"""
Merges two confusion_matrix since distinc or overlaping labels
Args:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function to_protobuf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_protobuf(self) -> ColumnMessage:
res: Dict[str, MetricComponentMessage] = {}
for m_name, m in self._metrics.items():
for mc_name, mc in m.to_protobuf().metric_components.items():
if not m.exclude_from_serialization:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function column_has_non_zero_types
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def column_has_non_zero_types(column_name: str, types_list: List[str]) -> MetricConstraint:
def has_non_zero_types(x) -> bool:
types_dict = x.to_summary_dict()
for key in types_dict.keys():
if key in types_list and types_dict[key] == 0:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function apply
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply(self, profile: DatasetProfileView) -> List[Metric]:
if self.metrics_resolver is not None:
custom_result = self.metrics_resolver(profile)
if isinstance(custom_result, List):
return custom_result
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"