graphite-project / carbon

Bad indentation detected PYL-W0311
Style
Minor
18 occurrences in this check
Bad indentation. Found 6 spaces, expected 12
180    except FileNotFoundError:  # don't log full stack trace when the db does not exist.
181      log.msg("Error writing %s: File does not exist (yet). " % metric +
182              "Increase MAX_CREATES_PER_MINUTE")
183      instrumentation.increment('errors')184    except Exception as e:
185      log.err()
186      log.msg("Error writing to %s: %s" % (metric, e))
Bad indentation. Found 6 spaces, expected 12
178        tagQueue.update(metric)
179      updateTime = time.time() - t1
180    except FileNotFoundError:  # don't log full stack trace when the db does not exist.
181      log.msg("Error writing %s: File does not exist (yet). " % metric +182              "Increase MAX_CREATES_PER_MINUTE")
183      instrumentation.increment('errors')
184    except Exception as e:
Bad indentation. Found 4 spaces, expected 8
177      if settings.ENABLE_TAGS:
178        tagQueue.update(metric)
179      updateTime = time.time() - t1
180    except FileNotFoundError:  # don't log full stack trace when the db does not exist.181      log.msg("Error writing %s: File does not exist (yet). " % metric +
182              "Increase MAX_CREATES_PER_MINUTE")
183      instrumentation.increment('errors')
Bad indentation. Found 6 spaces, expected 12
158    (metric, datapoints) = cache.drain_metric()
159    if metric is None:
160      # end the loop
161      break162
163    # If we've got a rate limit configured lets makes sure we enforce it
164    waitTime = 0
Bad indentation. Found 4 spaces, expected 8
156        create_database(new_metric)
157
158    (metric, datapoints) = cache.drain_metric()
159    if metric is None:160      # end the loop
161      break
162
Bad indentation. Found 4 spaces, expected 8
155
156        create_database(new_metric)
157
158    (metric, datapoints) = cache.drain_metric()159    if metric is None:
160      # end the loop
161      break
Bad indentation. Found 8 spaces, expected 16
153          instrumentation.increment('droppedCreates')
154          break
155
156        create_database(new_metric)157
158    (metric, datapoints) = cache.drain_metric()
159    if metric is None:
Bad indentation. Found 10 spaces, expected 20
151          # when rate limiting unless our cache is too big or some other legit
152          # reason.
153          instrumentation.increment('droppedCreates')
154          break155
156        create_database(new_metric)
157
Bad indentation. Found 10 spaces, expected 20
150          # XXX This behavior should probably be configurable to not drop metrics
151          # when rate limiting unless our cache is too big or some other legit
152          # reason.
153          instrumentation.increment('droppedCreates')154          break
155
156        create_database(new_metric)
Bad indentation. Found 8 spaces, expected 16
143    # First check if there are new metrics
144    for new_metric in cache.new_metrics:
145      if not state.database.exists(new_metric):
146        if CREATE_BUCKET and not CREATE_BUCKET.drain(1):147          # If our tokenbucket doesn't have enough tokens available to create a new metric
148          # file then we'll just drop the metric on the ground and move on to the next
149          # metric.
Bad indentation. Found 6 spaces, expected 12
142
143    # First check if there are new metrics
144    for new_metric in cache.new_metrics:
145      if not state.database.exists(new_metric):146        if CREATE_BUCKET and not CREATE_BUCKET.drain(1):
147          # If our tokenbucket doesn't have enough tokens available to create a new metric
148          # file then we'll just drop the metric on the ground and move on to the next
Bad indentation. Found 4 spaces, expected 8
141  while cache:
142
143    # First check if there are new metrics
144    for new_metric in cache.new_metrics:145      if not state.database.exists(new_metric):
146        if CREATE_BUCKET and not CREATE_BUCKET.drain(1):
147          # If our tokenbucket doesn't have enough tokens available to create a new metric
Bad indentation. Found 2 spaces, expected 4
138  """Write datapoints until the MetricCache is completely empty"""
139
140  cache = MetricCache()
141  while cache:142
143    # First check if there are new metrics
144    for new_metric in cache.new_metrics:
Bad indentation. Found 2 spaces, expected 4
137def writeCachedDataPoints():
138  """Write datapoints until the MetricCache is completely empty"""
139
140  cache = MetricCache()141  while cache:
142
143    # First check if there are new metrics
Bad indentation. Found 2 spaces, expected 4
135
136
137def writeCachedDataPoints():
138  """Write datapoints until the MetricCache is completely empty"""139
140  cache = MetricCache()
141  while cache:
Bad indentation. Found 8 spaces, expected 16
251      # Metric not in cache yet, push to new_metrics list so it
252      # can be checked if the db already exists
253      if metric not in self:
254        self.new_metrics.append(metric)255
256      if timestamp not in self[metric]:
257        # Not a duplicate, hence process if cache is not full
Bad indentation. Found 6 spaces, expected 12
250    with self.lock:
251      # Metric not in cache yet, push to new_metrics list so it
252      # can be checked if the db already exists
253      if metric not in self:254        self.new_metrics.append(metric)
255
256      if timestamp not in self[metric]:
Bad indentation. Found 4 spaces, expected 8
190    self.lock = threading.Lock()
191    self.size = 0
192    self.strategy = None
193    self.new_metrics = []194    if strategy:
195      self.strategy = strategy(self)
196    super(_MetricCache, self).__init__(dict)