Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

hdrpy

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hdrpy - npm Package Compare versions

Comparing version
0.1.1.dev2
to
0.2.0
.coveragerc

Sorry, the diff of this file is not supported yet

+31
sudo: false
language: python
cache: pip
branches:
only:
- master
os: linux
python:
- "2.7"
- "3.6"
env:
- PIPENV_SHELL_COMPAT=true PIPENV_COLORBLIND=true PIPENV_NOSPIN=true
install:
- pip install --upgrade setuptools pip wheel pipenv
- pipenv install --dev --system
script:
- python -m pytest --cov=./
after_success:
- codecov
notifications:
email:
on_success: never
on_failure: change
# Do not build feature branch with open Pull Requests
skip_branch_with_pr: true
environment:
SHELL: "windows"
matrix:
- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"
platform:
- x64
install:
- "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- "set PYTHONIOENCODING=utf-8"
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
- "pip install --upgrade pip wheel pipenv"
- "pipenv install --dev"
build: off
test_script:
- "pipenv run pytest"
# enable one day when pipenv works
# after_test:
# - "codecov"
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## [Unreleased]
## 0.2 — 2018-02-09
### Added
- Unit tests for HDR Histogram
## 0.1 — 2018-02-08
### Added
- Initial fork of HDRHistogram_py
- C code is replaced with `numpy` dependency
import sys
from os.path import dirname as d
from os.path import abspath, join
root_dir = d(d(abspath(__file__)))
sys.path.append(root_dir)
{
"_meta": {
"hash": {
"sha256": "c773f0a900b3f8c17d6c296fc415c4189a66fe2adfa98cb65d9cee1b05a27893"
},
"host-environment-markers": {
"implementation_name": "cpython",
"implementation_version": "3.5.2",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "4.4.0-109-generic",
"platform_system": "Linux",
"platform_version": "#132-Ubuntu SMP Tue Jan 9 19:52:39 UTC 2018",
"python_full_version": "3.5.2",
"python_version": "3.5",
"sys_platform": "linux"
},
"pipfile-spec": 6,
"requires": {},
"sources": [
{
"name": "pypi",
"url": "https://pypi.python.org/simple",
"verify_ssl": true
}
]
},
"default": {
"numpy": {
"hashes": [
"sha256:428cd3c0b197cf857671353d8c85833193921af9fafcc169a1f29c7185833d50",
"sha256:a476e437d73e5754aa66e1e75840d0163119c3911b7361f4cd06985212a3c3fb",
"sha256:289ff717138cd9aa133adcbd3c3e284458b9c8230db4d42b39083a3407370317",
"sha256:c5eccb4bf96dbb2436c61bb3c2658139e779679b6ae0d04c5e268e6608b58053",
"sha256:75471acf298d455b035226cc609a92aee42c4bb6aa71def85f77fa2c2b646b61",
"sha256:5c54fb98ecf42da59ed93736d1c071842482b18657eb16ba6e466bd873e1b923",
"sha256:9ddf384ac3aacb72e122a8207775cc29727cbd9c531ee1a4b95754f24f42f7f3",
"sha256:781d3197da49c421a07f250750de70a52c42af08ca02a2f7bdb571c0625ae7eb",
"sha256:93b26d6c06a22e64d56aaca32aaaffd27a4143db0ac2f21a048f0b571f2bfc55",
"sha256:b2547f57d05ba59df4289493254f29f4c9082d255f1f97b7e286f40f453e33a1",
"sha256:eef6af1c752eef538a96018ef9bdf8e37bbf28aab50a1436501a4aa47a6467df",
"sha256:ff8a4b2c3ac831964f529a2da506c28d002562b230261ae5c16885f5f53d2e75",
"sha256:194074058c22a4066e1b6a4ea432486ee468d24ab16f13630c1030409e6b8666",
"sha256:4e13f1a848fde960dea33702770265837c72b796a6a3eaac7528cfe75ddefadd",
"sha256:91101216d72749df63968d86611b549438fb18af2c63849c01f9a897516133c7",
"sha256:97507349abb7d1f6b76b877258defe8720833881dc7e7fd052bac90c88587387",
"sha256:1479b46b6040b5c689831496354c8859c456b152d37315673a0c18720b41223b",
"sha256:98b1ac79c160e36093d7914244e40ee1e7164223e795aa2c71dcce367554e646",
"sha256:24bbec9a199f938eab75de8390f410969bc33c218e5430fa1ae9401b00865255",
"sha256:7880f412543e96548374a4bb1d75e4cdb8cad80f3a101ed0f8d0e0428f719c1c",
"sha256:6112f152b76a28c450bbf665da11757078a724a90330112f5b7ea2d6b6cefd67",
"sha256:7c5276763646480143d5f3a6c2acb2885460c765051a1baf4d5070f63d05010f",
"sha256:3de643935b212307b420248018323a44ec51987a336d1d747c1322afc3c099fb"
],
"version": "==1.14.0"
}
},
"develop": {
"attrs": {
"hashes": [
"sha256:a17a9573a6f475c99b551c0e0a812707ddda1ec9653bed04c13841404ed6f450",
"sha256:1c7960ccfd6a005cd9f7ba884e6316b5e430a3f1a6c37c5f87d8b43f83b54ec9"
],
"version": "==17.4.0"
},
"certifi": {
"hashes": [
"sha256:14131608ad2fd56836d33a71ee60fa1c82bc9d2c8d98b7bdbc631fe1b3cd1296",
"sha256:edbc3f203427eef571f79a7692bb160a2b0f7ccaa31953e99bd17e307cf63f7d"
],
"version": "==2018.1.18"
},
"chardet": {
"hashes": [
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691",
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"
],
"version": "==3.0.4"
},
"codecov": {
"hashes": [
"sha256:ae00d68e18d8a20e9c3288ba3875ae03db3a8e892115bf9b83ef20507732bed4",
"sha256:8ed8b7c6791010d359baed66f84f061bba5bd41174bf324c31311e8737602788"
],
"version": "==2.0.15"
},
"coverage": {
"hashes": [
"sha256:464d85d6959497cc4adfa9f0d36fca809e2ca7ec5f4625f548317892cac6ed7c",
"sha256:e958ab5b6a7f3b88289a25c95d031f2b62bc73219141c09d261fd97f244c124c",
"sha256:67288f8834a0a64c1af66286b22fd325b5524ceaa153a51c3e2e30f7e8b3f826",
"sha256:cfb6b7035c6605e2a87abe7d84ea35a107e6c432014a3f1ca243ab57a558fbcd",
"sha256:c86a12b3dc004bcbe97a3849354bd1f93eb6fb69b0e4eb58831fd7adba7740ec",
"sha256:8ddcf308f894d01a1a0ae01283d19b613751815b7190113266a0b7f9d076e86d",
"sha256:adab01e4c63a01bdf036f57f0114497994aa2195d8659d12a3d69673c3f27939",
"sha256:54d73fe68a7ac9c847af69a234a7461bbaf3cad95f258317d4584d14dd53f679",
"sha256:a0d98c71d026c1757c7393a99d24c6e42091ff41e20e68238b17e145252c2d0a",
"sha256:464e0eda175c7fe2dc730d9d02acde5b8a8518d9417413dee6ca187d1f65ef89",
"sha256:2890cb40464686c0c1dccc1223664bbc34d85af053bc5dbcd71ea13959e264f2",
"sha256:0f2315c793b1360f80a9119fff76efb7b4e5ab5062651dff515e681719f29689",
"sha256:85c028e959312285225040cdac5ad3db6189e958a234f09ae6b4ba5f539c842d",
"sha256:da6585339fc8a25086003a2b2c0167438b8ab0cd0ccae468d22ed603e414bba1",
"sha256:e837865a7b20c01a8a2f904c05fba36e8406b146649ff9174cbddf32e217b777",
"sha256:b718efb33097c7651a60a03b4b38b14776f92194bc0e9e598ce05ddaef7c70e7",
"sha256:7413f078fbba267de44814584593a729f88fc37f2d938263844b7f4daf1e36ec",
"sha256:47ad00a0c025f87a7528cc13d013c54e4691ae8730430e49ec9c7ace7e0e1fba",
"sha256:95f9f5072afeb2204401401cbd0ab978a9f86ef1ebc5cd267ba431cfa581cc4d",
"sha256:ca8827a5dad1176a8da6bf5396fd07e66549d1bc842047b76cdf69e196597a80",
"sha256:c68164c4f49cfc2e66ca1ded62e4a1092a6bd4b2c65222059b867700ad19151c",
"sha256:61e0bcf15aa0385e15d1fe4a86022a6b813d08c785855e3fab56ba6d7ac3dd21",
"sha256:981a64063242a2c6c88dda33ccafe3583026847961fe56636b6a00c47674e258",
"sha256:21e47d2ff9c75e25880dd12b316db11379e9afc98b39e9516149d189c15c564b",
"sha256:f6b822c68f68f48d480d23fcfcd1d4df7d42ff03cf5d7b574d09e662c0b95b43",
"sha256:53fa7aa7643a22eeadcf8b781b97a51f37d43ba1d897a05238aa7e4d11bc0667",
"sha256:95ce1a70323d47c0f6b8d6cfd3c14c38cb30d51fd1ab4f6414734fa33a78b17e",
"sha256:b7a06a523dfeaf417da630d46ad4f4e11ca1bae6202c9312c4cb987dde5792fc",
"sha256:585e8db44b8f3af2a4152b00dd8a7a36bc1d2aba7de5e50fc17a54178428f0d6",
"sha256:102933e14b726bd4fdfafb541e122ad36c150732aee36db409d8c8766e11537e",
"sha256:15f92238487d93f7f34a3ba03be3bd4615c69cffc88388b4dd1ea99af74fc1bf",
"sha256:319190dd7fa08c23332215782b563a9ef12b76fb15e4a325915592b825eca9ed",
"sha256:af14e9628c0a3152b6a1fbba4471e6a3e5f5567ecae614f84b84ff3441c58692",
"sha256:72bc3f91a25a87fd87eb57983c8cefbb8aa5bacd50d73516ade398271d652d77",
"sha256:c3905f10786dcf386f3f6cebe0ae4a36f47e5e256471161fb944ca537e97e928",
"sha256:3344079d73a4849341aaaecd9b391141824b8c9a96732fbd6ef95ba9566895d3"
],
"version": "==4.5"
},
"funcsigs": {
"hashes": [
"sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca",
"sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"
],
"markers": "python_version < '3.0'",
"version": "==1.0.2"
},
"idna": {
"hashes": [
"sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4",
"sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f"
],
"version": "==2.6"
},
"pluggy": {
"hashes": [
"sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff"
],
"version": "==0.6.0"
},
"py": {
"hashes": [
"sha256:8cca5c229d225f8c1e3085be4fcf306090b00850fefad892f9d96c7b6e2f310f",
"sha256:ca18943e28235417756316bfada6cd96b23ce60dd532642690dcfdaba988a76d"
],
"version": "==1.5.2"
},
"pytest": {
"hashes": [
"sha256:95fa025cd6deb5d937e04e368a00552332b58cae23f63b76c8c540ff1733ab6d",
"sha256:6074ea3b9c999bd6d0df5fa9d12dd95ccd23550df2a582f5f5b848331d2e82ca"
],
"version": "==3.4.0"
},
"pytest-cov": {
"hashes": [
"sha256:890fe5565400902b0c78b5357004aab1c814115894f4f21370e2433256a3eeec",
"sha256:03aa752cf11db41d281ea1d807d954c4eda35cfa1b21d6971966cc041bbf6e2d"
],
"version": "==2.5.1"
},
"requests": {
"hashes": [
"sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b",
"sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e"
],
"version": "==2.18.4"
},
"six": {
"hashes": [
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb",
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9"
],
"version": "==1.11.0"
},
"urllib3": {
"hashes": [
"sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b",
"sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"
],
"version": "==1.22"
}
}
}
from hdrpy import HdrHistogram
from unittest import TestCase
class TestHdrHistogram(TestCase):
def test_empty(self):
hdr = HdrHistogram(1, 1 * 60 * 60 * 1000, 3)
self.assertEqual(hdr.get_min_value(), 0)
self.assertEqual(hdr.get_max_value(), 0)
self.assertEqual(hdr.get_mean_value(), 0)
self.assertEqual(hdr.get_stddev(), 0)
def test_large_numbers(self):
histogram = HdrHistogram(20000000, 100000000, 5)
histogram.record_value(100000000)
histogram.record_value(20000000)
histogram.record_value(30000000)
self.assertTrue(histogram.values_are_equivalent(20000000, histogram.get_value_at_percentile(50.0)))
self.assertTrue(histogram.values_are_equivalent(30000000, histogram.get_value_at_percentile(83.33)))
self.assertTrue(histogram.values_are_equivalent(100000000, histogram.get_value_at_percentile(83.34)))
self.assertTrue(histogram.values_are_equivalent(100000000, histogram.get_value_at_percentile(99.0)))
def test_record_value(self):
histogram = HdrHistogram(1, 3600 * 1000 * 1000, 3)
histogram.record_value(4)
self.assertEqual(histogram.get_count_at_value(4), 1)
self.assertEqual(histogram.get_total_count(), 1)
def test_highest_equavalent_value(self):
histogram = HdrHistogram(1, 3600 * 1000 * 1000, 3)
self.assertEqual(8183 * 1024 + 1023, histogram.get_highest_equivalent_value(8180 * 1024))
self.assertEqual(8191 * 1024 + 1023, histogram.get_highest_equivalent_value(8191 * 1024))
self.assertEqual(8199 * 1024 + 1023, histogram.get_highest_equivalent_value(8193 * 1024))
self.assertEqual(9999 * 1024 + 1023, histogram.get_highest_equivalent_value(9995 * 1024))
self.assertEqual(10007 * 1024 + 1023, histogram.get_highest_equivalent_value(10007 * 1024))
self.assertEqual(10015 * 1024 + 1023, histogram.get_highest_equivalent_value(10008 * 1024))
def test_scaled_highest_equiv_value(self):
histogram = HdrHistogram(1, 3600 * 1000 * 1000, 3)
self.assertEqual(histogram.get_highest_equivalent_value(8180), 8183)
self.assertEqual(histogram.get_highest_equivalent_value(8191), 8191)
self.assertEqual(histogram.get_highest_equivalent_value(8193), 8199)
self.assertEqual(histogram.get_highest_equivalent_value(9995), 9999)
self.assertEqual(histogram.get_highest_equivalent_value(10007), 10007)
self.assertEqual(histogram.get_highest_equivalent_value(10008), 10015)
def load_histogram(self):
histogram = HdrHistogram(1, 3600 * 1000 * 1000, 3)
# record this value with a count of 10,000
histogram.record_value(1000, 10000)
histogram.record_value(100000000)
return histogram
def load_corrected_histogram(self):
histogram = HdrHistogram(1, 3600 * 1000 * 1000, 3)
# record this value with a count of 10,000
histogram.record_corrected_value(1000, 10000, 10000)
histogram.record_corrected_value(100000000, 10000)
return histogram
def check_percentile(self, hist, percentile, value, variation):
value_at = hist.get_value_at_percentile(percentile)
self.assertLess(abs(value_at - value), value * variation)
def check_hist_percentiles(self, hist, total_count, perc_value_list):
for pair in perc_value_list:
self.check_percentile(hist, pair[0], pair[1], 0.001)
self.assertEqual(hist.get_total_count(), total_count)
self.assertTrue(hist.values_are_equivalent(hist.get_min_value(), 1000.0))
self.assertTrue(hist.values_are_equivalent(hist.get_max_value(), 100000000.0))
def test_percentiles(self):
self.check_hist_percentiles(self.load_histogram(),
10001,
((30.0, 1000.0),
(99.0, 1000.0),
(99.99, 1000.0),
(99.999, 100000000.0),
(100.0, 100000000.0)))
self.check_hist_percentiles(self.load_corrected_histogram(),
20000,
((30.0, 1000.0),
(50.0, 1000.0),
(75.0, 50000000.0),
(90.0, 80000000.0),
(99.0, 98000000.0),
(99.999, 100000000.0),
(100.0, 100000000.0)))
def test_recorded_iterator(self):
hist = self.load_histogram()
index = 0
for item in hist.get_recorded_iterator():
count_added_in_this_bucket = item.count_added_in_this_iter_step
if index == 0:
self.assertEqual(count_added_in_this_bucket, 10000)
else:
self.assertEqual(count_added_in_this_bucket, 1)
index += 1
self.assertEqual(index, 2)
hist = self.load_corrected_histogram()
index = 0
total_added_count = 0
for item in hist.get_recorded_iterator():
count_added_in_this_bucket = item.count_added_in_this_iter_step
if index == 0:
self.assertEqual(count_added_in_this_bucket, 10000)
self.assertNotEqual(item.count_at_value_iterated_to, 0)
total_added_count += count_added_in_this_bucket
index += 1
self.assertEqual(total_added_count, 20000)
self.assertEqual(total_added_count, hist.get_total_count())
def test_reset(self):
histogram = self.load_histogram()
histogram.reset()
self.assertEqual(histogram.get_total_count(), 0)
self.assertEqual(histogram.get_value_at_percentile(99.99), 0)
def test_invalid_significant_figures(self):
self.assertRaises(ValueError, lambda: HdrHistogram(1, 100, -1))
self.assertRaises(ValueError, lambda: HdrHistogram(1, 100, 6))
def test_out_of_range_values(self):
histogram = HdrHistogram(1, 1000, 4)
self.assertTrue(histogram.record_value(32767))
self.assertFalse(histogram.record_value(32768))
def test_mean_stddev(self):
# fill up a histogram with the values in the list
histogram = HdrHistogram(1, 3600 * 1000 * 1000, 3)
for value in [1000, 1000, 3000, 3000]:
histogram.record_value(value)
self.assertEqual(histogram.get_mean_value(), 2000.5)
self.assertEqual(histogram.get_stddev(), 1000.5)
def test_get_value_at_percentile(self):
histogram = HdrHistogram(1, 3600 * 1000 * 1000, 3)
histogram.record_value(1)
histogram.record_value(2)
self.assertEqual(histogram.get_value_at_percentile(50.0), 1)
histogram.record_value(2)
histogram.record_value(2)
histogram.record_value(2)
self.assertEqual(histogram.get_value_at_percentile(30), 2)
def test_add(self):
hist1 = HdrHistogram(1, 3600 * 1000 * 1000, 3)
hist1.record_value(1, count=100)
hist1.record_value(2, count=100)
hist2 = HdrHistogram(1, 3600 * 1000 * 1000, 3)
hist2.record_value(1, count=100)
hist2.record_value(2, count=200)
self.assertEqual(hist1.get_value_at_percentile(50.0), 1)
self.assertEqual(hist2.get_value_at_percentile(50.0), 2)
hist1.add(hist2)
self.assertEqual(hist1.get_value_at_percentile(50.0), 2)
def test_percentile_dict(self):
hist = HdrHistogram(1, 3600 * 1000 * 1000, 3)
for i in range(1, 10000):
hist.record_value(i, 10000 - i)
percentiles = [0.0, 50.0, 90.0, 95.0, 99.0, 100.0]
values = hist.get_percentile_to_value_dict(percentiles)
expected = {0.0: 1, 50.0: 2929, 99.0: 9007, 100.0: 9999, 90.0: 6839, 95.0: 7767}
self.assertEqual(values, expected)
+1
-1

@@ -1,1 +0,1 @@

{"is_release": false, "git_version": "80998f8"}
{"is_release": false, "git_version": "0863331"}
Metadata-Version: 1.1
Name: hdrpy
Version: 0.1.1.dev2
Version: 0.2.0
Summary: HDR histogram implementation based on numpy

@@ -5,0 +5,0 @@ Home-page: https://github.com/dmand/hdrpy

@@ -0,7 +1,13 @@

.coveragerc
.travis.yml
AUTHORS
CHANGELOG.md
ChangeLog
LICENSE
Pipfile
Pipfile.lock
README.md
README.rst
appveyor.yml
conftest.py
setup.cfg

@@ -15,2 +21,3 @@ setup.py

hdrpy.egg-info/pbr.json
hdrpy.egg-info/top_level.txt
hdrpy.egg-info/top_level.txt
tests/test_hdrpy.py

@@ -10,2 +10,6 @@ [[source]]

pytest = ">=3.4.0"
codecov = ">=2.0.15"
pytest-cov = ">=2.5.1"
coverage = ">=4.5"

@@ -12,0 +16,0 @@

Metadata-Version: 1.1
Name: hdrpy
Version: 0.1.1.dev2
Version: 0.2.0
Summary: HDR histogram implementation based on numpy

@@ -5,0 +5,0 @@ Home-page: https://github.com/dmand/hdrpy

@@ -9,3 +9,3 @@ from setuptools import setup

name="hdrpy",
version="0.1",
version="0.2",
description="HDR histogram implementation based on numpy",

@@ -12,0 +12,0 @@ author="Dmitri Pribysh",

Sorry, the diff of this file is not supported yet