Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
host=host_obj.hostname,
port=host_obj.port,
granularity=granularity,
period=period,
measurement=measurement
)
# Build the request
return_val = self.atlas.network.get(Settings.BASE_URL + uri)
measurement_obj = None
if iterable:
measurements = return_val.get('measurements')
measurements_count = len(measurements)
self.logger.info('There are {} measurements.'.format(measurements_count))
for each in measurements:
measurement_obj = AtlasMeasurement(name=each.get('name'),
period=period,
granularity=granularity)
for each_and_every in each.get('dataPoints'):
measurement_obj.measurements = AtlasMeasurementValue(each_and_every)
yield measurement_obj
else:
return return_val
period=self.period, granularity=self.granularity, measurements_count=self.measurements_count
)
def __hash__(self):
return hash(self.name+'-'+self.period)
def __eq__(self, other):
"""
Measurements are considered duplicate of name and period are the same
:param other:
:return:
"""
if isinstance(other, AtlasMeasurement):
return ((self.name == other.name) and (self.period == other.period))
OptionalAtlasMeasurement = NewType('OptionalAtlasMeasurement', Optional[AtlasMeasurement])
def __eq__(self, other):
"""
Measurements are considered duplicate of name and period are the same
:param other:
:return:
"""
if isinstance(other, AtlasMeasurement):
return ((self.name == other.name) and (self.period == other.period))
host=host_obj.hostname,
port=host_obj.port,
granularity=granularity,
period=period,
measurement=measurement
)
# Build the request
return_val = self.atlas.network.get(Settings.BASE_URL + uri)
if iterable:
measurements = return_val.get('measurements')
measurements_count = len(measurements)
self.logger.info('There are {} measurements.'.format(measurements_count))
for each in measurements:
measurement_obj = AtlasMeasurement(name=each.get('name'),
period=period,
granularity=granularity)
for each_and_every in each.get('dataPoints'):
measurement_obj.measurements = AtlasMeasurementValue(each_and_every)
yield measurement_obj
else:
return return_val