IRC-SPHERE/HyperStream

View on GitHub

Showing 171 of 2,627 total issues

Function parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(self, intervals):
        parsed = []
        if intervals:
            for v in intervals:
                if isinstance(v, (tuple, list)):
Severity: Minor
Found in hyperstream/time_interval.py - About 1 hr to fix

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 _execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, source, splitting_stream, interval, meta_data_id, output_plate_values):
        if splitting_stream is None:
            raise ValueError("Splitting stream required for this tool")

        if isinstance(splitting_stream, AssetStream):

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 _execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, sources, alignment_stream, interval):
        for time, data in sources[0].window(interval, force_calculation=True):
            dict_mean = dict()
            if len(data)==0:
                yield StreamInstance(time, dict_mean)
Severity: Minor
Found in hyperstream/tools/list_dict_mean/2016-12-15_v0.0.1.py - About 1 hr to fix

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 execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def execute(self, sources, sink, interval, alignment_stream=None):
        """
        Execute the tool over the given time interval.
        If an alignment stream is given, the output instances will be aligned to this stream

Severity: Minor
Found in hyperstream/tool/tool.py - About 1 hr to fix

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

Consider simplifying this complex logical expression.
Open

                if (counts == [1, 1] and is_sub_plate) or \
                    (len(self.sink.plates)==1 and counts == [1, 0] and is_sub_plate) or \
                    (next(p.is_root for p in self.sources[-1].plates)
                     and len(self.sink.plates) == 1
                     and self.sink.plates[0] in self.sources[-1].plates):
Severity: Critical
Found in hyperstream/factor/factor.py - About 1 hr to fix

Function _Tree__print_backend has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _Tree__print_backend(self, nid=None, level=ROOT, idhidden=True, queue_filter=None,
Severity: Major
Found in hyperstream/utils/containers.py - About 1 hr to fix

Function file_filter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def file_filter(self, sorted_file_names):
        for file_long_name in sorted_file_names:
            if file_long_name == '__init__.py':
                continue

Severity: Minor
Found in hyperstream/channels/assets_file_channel.py - About 1 hr to fix

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 __add__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def __add__(self, other):
        if isinstance(other, TimeInterval):
            if self.is_empty:
                return TimeIntervals([other])
            if other.start > self.end:
Severity: Minor
Found in hyperstream/time_interval.py - About 1 hr to fix

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 get_sources has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def get_sources(self, plate, plate_value, sources=None):
        """
        Gets the source streams for a given plate value on a plate.
        Also populates with source streams that are valid for the parent plates of this plate,
        with the appropriate meta-data for the parent plate.
Severity: Minor
Found in hyperstream/factor/factor.py - About 1 hr to fix

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 _execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, sources, alignment_stream, interval):
        for time, data in sources[0].window(interval, force_calculation=True):
            if self.complement:
                if data[self.key] not in self.values:
                    yield StreamInstance(time, data)
Severity: Minor
Found in hyperstream/tools/component_filter/2016-07-13T1058Z_v0.0.1.py - About 1 hr to fix

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 _execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, source, splitting_stream, interval, meta_data_id, output_plate_values):
        if splitting_stream is None:
            raise ValueError("Splitting stream required for this tool")

        if isinstance(splitting_stream, AssetStream):

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 print_head has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def print_head(self, parent_plate_value, plate_values, interval, n=10, print_func=logging.info):
        """
        Print the first n values from the streams in the given time interval.
        The parent plate value is the value of the parent plate,
        and then the plate values are the values for the plate that are to be printed.
Severity: Minor
Found in hyperstream/node/node.py - About 1 hr to fix

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 _execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, source, interval):
        source_last_doc = source.window(interval, force_calculation=True).last()
        if not source_last_doc:
            return
        timestamp, data = source_last_doc
Severity: Minor
Found in hyperstream/tools/asset_plate_generator/2016-12-09_v0.1.1.py - About 1 hr to fix

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 _execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, sources, alignment_stream, interval):
        for tt, rows in sources[0].window(interval, force_calculation=True):
            vals = defaultdict(list)
            
            for row in rows:
Severity: Minor
Found in hyperstream/tools/relative_apply/2016-09-09_v0.0.1.py - About 1 hr to fix

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 check_multi_output_plate_compatibility has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def check_multi_output_plate_compatibility(source_plates, sink_plate):
        """
        Check multi-output plate compatibility. This ensures that the source plates and sink plates match for a multi-
        output plate

Severity: Minor
Found in hyperstream/workflow/workflow.py - About 1 hr to fix

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 _execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, source, splitting_stream, interval, meta_data_id, output_plate_values):
        for timestamp, data in source.window(interval, force_calculation=True):
            if self.element is None:
                data_element = data
            else:
Severity: Minor
Found in hyperstream/tools/asset_splitter/2016-11-24_v0.1.1.py - About 1 hr to fix

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 window has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def window(self, time_interval=None, force_calculation=False):
        """
        Gets a view on this stream for the time interval given

        :param time_interval: either a TimeInterval object or (start, end) tuple of type str or datetime
Severity: Minor
Found in hyperstream/stream/stream.py - About 1 hr to fix

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 _execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, sources, interval):
        if self.categorical:
            for t, d in sources[0].window(interval, force_calculation=True):
                yield StreamInstance(t, dict(map(safe_key, Counter(d).items())))
        else:
Severity: Minor
Found in hyperstream/tools/histograms_to_csv/2017-07-03_v0.0.1.py - About 55 mins to fix

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 get_stream_writer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_stream_writer(self, stream):
        def writer(document_collection):
            if stream.stream_id not in self:
                raise RuntimeError("Data slot does not exist for {}, perhaps create_stream was not used?"
                                   .format(stream))
Severity: Minor
Found in hyperstream/channels/assets_file_channel.py - About 55 mins to fix

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 _execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _execute(self, sources, interval):
        if self.categorical:
            for t, d in sources[0].window(interval, force_calculation=True):
                yield StreamInstance(t, dict(map(safe_key, Counter(d).items())))
        else:
Severity: Minor
Found in hyperstream/tools/percentiles_to_csv/2017-07-18_v0.0.1.py - About 55 mins to fix

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

Severity
Category
Status
Source
Language