function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def write_to_tensorboard(self, tb_writer, tb_tag, step):
for key in self._num_top_i_successes:
for i in range(self._k):
top_i_success_rate = (self._num_top_i_successes[key][i] /
(self._num_accesses[key] + 1e-8))
utils.log_scalar(
tb_writer, "{}/{}_top_... | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def __init__(self):
self._weighted_taus = []
self._masks = [] | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def write_to_tensorboard(self, tb_writer, tb_tag, step):
weighted_taus = np.array(self._weighted_taus)
eviction_masks = np.array(self._masks)
eviction_mean_weighted_tau = np.sum(
weighted_taus * eviction_masks) / (np.sum(eviction_masks) + 1e-8)
utils.log_scalar(
tb_writer, "{}/eviction_... | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def __init__(self):
self._optimal_scores = []
self._evicted_scores = []
self._masks = [] | google-research/google-research | [
27788,
6881,
27788,
944,
1538678568
] |
def sample_list_annotations():
# Create a client
client = aiplatform_v1.DatasetServiceClient()
# Initialize request argument(s)
request = aiplatform_v1.ListAnnotationsRequest(
parent="parent_value",
)
# Make the request
page_result = client.list_annotations(request=request)
# ... | googleapis/python-aiplatform | [
306,
205,
306,
52,
1600875819
] |
def resource_lexical_syntactic_featurizer() -> Resource:
return Resource("LexicalSyntacticFeaturizer") | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def create_lexical_syntactic_featurizer(
default_model_storage: ModelStorage,
default_execution_context: ExecutionContext,
resource_lexical_syntactic_featurizer: Resource, | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def inner(config: Dict[Text, Any]):
return LexicalSyntacticFeaturizer.create(
config={**LexicalSyntacticFeaturizer.get_default_config(), **config,},
model_storage=default_model_storage,
execution_context=default_execution_context,
resource=resource_lexical_syntact... | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def test_feature_computation(
create_lexical_syntactic_featurizer: Callable[
[Dict[Text, Any]], LexicalSyntacticFeaturizer
],
sentence: Text,
part_of_speech: Optional[List[Text]],
feature_config: List[List[Text]],
expected_features: List[Union[int, List[int]]], | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def test_features_for_messages_with_missing_part_of_speech_tags(
create_lexical_syntactic_featurizer: Callable[
[Dict[Text, Any]], LexicalSyntacticFeaturizer
], | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def test_only_featurizes_text_attribute(
create_lexical_syntactic_featurizer: Callable[
[Dict[Text, Any]], LexicalSyntacticFeaturizer
], | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def test_process_multiple_messages(
create_lexical_syntactic_featurizer: Callable[
[Dict[Text, Any]], LexicalSyntacticFeaturizer
], | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def test_create_train_load_and_process(
create_lexical_syntactic_featurizer: Callable[
[Dict[Text, Any]], LexicalSyntacticFeaturizer
],
default_model_storage: ModelStorage,
default_execution_context: ExecutionContext,
resource_lexical_syntactic_featurizer: Resource,
feature_config: List[... | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def test_validate_config(config: Dict[Text, Any], raises: bool):
if not raises:
LexicalSyntacticFeaturizer.validate_config(config)
else:
with pytest.raises(InvalidConfigException):
LexicalSyntacticFeaturizer.validate_config(config) | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def test_warn_if_part_of_speech_features_cannot_be_computed(
create_lexical_syntactic_featurizer: Callable[
[Dict[Text, Any]], LexicalSyntacticFeaturizer
],
sentence: Text,
feature_config: Dict[Text, Any],
expected_features: np.ndarray, | RasaHQ/rasa_nlu | [
15758,
4259,
15758,
111,
1476448069
] |
def sample_suggest_trials():
# Create a client
client = aiplatform_v1beta1.VizierServiceClient()
# Initialize request argument(s)
request = aiplatform_v1beta1.SuggestTrialsRequest(
parent="parent_value",
suggestion_count=1744,
client_id="client_id_value",
)
# Make the r... | googleapis/python-aiplatform | [
306,
205,
306,
52,
1600875819
] |
def mock_timeout(hass, monkeypatch):
"""Mock async_timeout.timeout."""
class MockTimeout:
def __init__(self, timeout):
self._timeout = timeout
self._loop = asyncio.get_event_loop()
self._task = None
self._cancelled = False
self._unsub = None
... | pschmitt/home-assistant | [
1,
1,
1,
6,
1485261624
] |
def check_action():
if script_obj.last_action and message in script_obj.last_action:
flag.set() | pschmitt/home-assistant | [
1,
1,
1,
6,
1485261624
] |
def service_done_cb(event):
logger.debug("simulated service (%s:%s) done", fire, listen)
service_done.set() | pschmitt/home-assistant | [
1,
1,
1,
6,
1485261624
] |
def heard_event_cb(event):
logger.debug("heard: %s", event)
heard_event.set() | pschmitt/home-assistant | [
1,
1,
1,
6,
1485261624
] |
def record_call(service):
"""Add recorded event to set."""
raise ValueError("BROKEN") | pschmitt/home-assistant | [
1,
1,
1,
6,
1485261624
] |
def does_not_raise():
"""Indicate no exception is expected."""
yield | pschmitt/home-assistant | [
1,
1,
1,
6,
1485261624
] |
def _leaky_relu(x):
return tf.nn.leaky_relu(x, alpha=0.2) | tensorflow/tpu | [
5035,
1773,
5035,
290,
1499817279
] |
def _dense(x, channels, name):
return tf.layers.dense(
x, channels,
kernel_initializer=tf.truncated_normal_initializer(stddev=0.02),
name=name) | tensorflow/tpu | [
5035,
1773,
5035,
290,
1499817279
] |
def _deconv2d(x, filters, kernel_size, stride, name):
return tf.layers.conv2d_transpose(
x, filters, [kernel_size, kernel_size],
strides=[stride, stride], padding='same',
kernel_initializer=tf.truncated_normal_initializer(stddev=0.02),
name=name) | tensorflow/tpu | [
5035,
1773,
5035,
290,
1499817279
] |
def generator(x, is_training=True, scope='Generator'):
# fc1024-bn-relu + fc6272-bn-relu + deconv64-bn-relu + deconv1-tanh
with tf.variable_scope(scope, reuse=tf.AUTO_REUSE):
x = _dense(x, 1024, name='g_fc1')
x = tf.nn.relu(_batch_norm(x, is_training, name='g_bn1'))
x = _dense(x, 7 * 7 * 128, name='g_f... | tensorflow/tpu | [
5035,
1773,
5035,
290,
1499817279
] |
def __enter__(self):
return self | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def _subscriber_default(self):
return salt.transport.ipc.IPCMessageSubscriber(
self.socket_path,
io_loop=self.io_loop,
) | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def _publisher_default(self):
return salt.transport.ipc.IPCMessagePublisher(
{"ipc_write_buffer": 0},
self.socket_path,
io_loop=self.io_loop,
) | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def new_client(self):
return IPCTester(
io_loop=self.io_loop,
socket_path=self.socket_path,
server=self.server,
payloads=self.payloads,
payload_ack=self.payload_ack,
) | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def __enter__(self):
self.publisher.start()
self.io_loop.add_callback(self.subscriber.connect)
return self | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def ipc_socket_path(tmp_path):
if salt.utils.platform.is_darwin():
# A shorter path so that we don't hit the AF_UNIX path too long
tmp_path = pathlib.Path("/tmp").resolve()
_socket_path = tmp_path / "ipc-test.ipc"
try:
yield _socket_path
finally:
if _socket_path.exists():... | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def channel(io_loop, ipc_socket_path):
_ipc_tester = IPCTester(io_loop=io_loop, socket_path=str(ipc_socket_path))
with _ipc_tester:
yield _ipc_tester | saltstack/salt | [
13089,
5388,
13089,
3074,
1298233016
] |
def test_100_update(self):
command = ["update", "network", "--network", "excx-net",
"--network_environment", "excx",
"--building", "ut", "--type", "dmz-net",
"--side", "b", "--comments", "New network comments"]
self.noouttest(command) | quattor/aquilon | [
12,
16,
12,
38,
1361797498
] |
def test_120_update_rename(self):
command = ["update", "network", "--network", "netsvcmap",
"--rename_to", "rename-test", "--comments", "New comment"]
self.noouttest(command) | quattor/aquilon | [
12,
16,
12,
38,
1361797498
] |
def test_122_update_rename_existing(self):
net = self.net["np06bals03_v103"]
command = ["update", "network", "--network", "rename-test",
"--rename_to", "np06bals03_v103"]
out,err = self.successtest(command)
self.matchoutput(err, "WARNING: Network name {} is already use... | quattor/aquilon | [
12,
16,
12,
38,
1361797498
] |
def test_201_verify_utdmz1(self):
command = ["search", "network", "--network_compartment", "perimeter.ut"]
self.noouttest(command) | quattor/aquilon | [
12,
16,
12,
38,
1361797498
] |
def test_900_delinuse(self):
net = self.net["unknown0"]
command = ["del", "network", "--ip", net.ip]
out = self.badrequesttest(command)
self.matchoutput(out, "Network %s [%s] is still in use" %
(net.name, net), command) | quattor/aquilon | [
12,
16,
12,
38,
1361797498
] |
def setUp(self):
self.set_filename('textbox15.xlsx') | jmcnamara/XlsxWriter | [
3172,
594,
3172,
18,
1357261626
] |
def __init__(self, *args: Any) -> None:
super(ProgressiveTest, self).__init__(*args)
self._output: bool = False
self._scheduler: Optional[Scheduler] = None
self._temp_dir_flag: bool = False
level: Any = getenv("LOGLEVEL")
if level in ProgressiveTest.levels:
le... | jdfekete/progressivis | [
47,
4,
47,
6,
1440882684
] |
def terse(x: Any) -> None:
_ = x
print(".", end="", file=sys.stderr) | jdfekete/progressivis | [
47,
4,
47,
6,
1440882684
] |
def setUp(self) -> None:
np.random.seed(42) | jdfekete/progressivis | [
47,
4,
47,
6,
1440882684
] |
def cleanup(self) -> None:
cleanup_temp_dir() | jdfekete/progressivis | [
47,
4,
47,
6,
1440882684
] |
def setUpClass(cls: Type[ProgressiveTest]) -> None:
cleanup_temp_dir()
init_temp_dir_if() | jdfekete/progressivis | [
47,
4,
47,
6,
1440882684
] |
def tearDownClass(cls: Type[ProgressiveTest]) -> None:
cleanup_temp_dir() | jdfekete/progressivis | [
47,
4,
47,
6,
1440882684
] |
def log(level: int = logging.NOTSET, package: str = "progressivis") -> None:
log_level(level, package=package) | jdfekete/progressivis | [
47,
4,
47,
6,
1440882684
] |
def extractDlscanlationsCom(item):
'''
Parser for 'dlscanlations.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loit... | fake-name/ReadableWebProxy | [
191,
16,
191,
3,
1437712243
] |
def _get_manager(cls, model_class):
return model_class.private_objects | DemocracyClub/EveryElection | [
12,
13,
12,
126,
1475835740
] |
def __init__(self, node, parent, result):
""" DagError Init """
Exception.__init__(self)
self.node = node
self.parent = parent
self.result = result | aldebaran/qibuild | [
67,
45,
67,
42,
1297185497
] |
def assert_dag(data):
"""
Check if data is a dag
>>> assert_dag({
... 'a' : ( 'g', 'b', 'c', 'd' ),
... 'b' : ( 'e', 'c' ),
... 'e' : ( 'g', 'c' )})
>>> assert_dag({
... 'a' : ( 'g', 'b', 'c', 'd' ),
... 'b' : ( 'e', 'c' ),
... 'e' : ( 'e', 'c' )})
Traceback (most... | aldebaran/qibuild | [
67,
45,
67,
42,
1297185497
] |
def _topological_sort(data, head, top_node, raise_exception=False, result=None, visited=None):
""" Internal function """
if not result:
result = []
if not visited:
visited = []
deps = data.get(head, list())
if head in visited:
if head == top_node and raise_exception:
... | aldebaran/qibuild | [
67,
45,
67,
42,
1297185497
] |
def testPolicyWithoutItems(self):
# Test an example policy without items.
policy = {
'name': '_policy_name',
'caption': '_policy_caption',
'desc': 'This is a long policy caption. More than one sentence '
'in a single line because it is very important.\n'
'... | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def test_quarterly_dont_normalize():
date = datetime(2012, 3, 31, 5, 30)
offsets = (BQuarterEnd, BQuarterBegin)
for klass in offsets:
result = date + klass()
assert result.time() == date.time() | pandas-dev/pandas | [
37157,
15883,
37157,
3678,
1282613853
] |
def test_on_offset(offset):
dates = [
datetime(2016, m, d)
for m in [10, 11, 12]
for d in [1, 2, 3, 28, 29, 30, 31]
if not (m == 11 and d == 31)
]
for date in dates:
res = offset.is_on_offset(date)
slow_version = date == (date + offset) - offset
assert... | pandas-dev/pandas | [
37157,
15883,
37157,
3678,
1282613853
] |
def test_repr(self):
expected = "<BusinessQuarterBegin: startingMonth=3>"
assert repr(BQuarterBegin()) == expected
expected = "<BusinessQuarterBegin: startingMonth=3>"
assert repr(BQuarterBegin(startingMonth=3)) == expected
expected = "<BusinessQuarterBegin: startingMonth=1>"
... | pandas-dev/pandas | [
37157,
15883,
37157,
3678,
1282613853
] |
def test_offset_corner_case(self):
# corner
offset = BQuarterBegin(n=-1, startingMonth=1)
assert datetime(2007, 4, 3) + offset == datetime(2007, 4, 2) | pandas-dev/pandas | [
37157,
15883,
37157,
3678,
1282613853
] |
def test_offset(self, case):
offset, cases = case
for base, expected in cases.items():
assert_offset_equal(offset, base, expected) | pandas-dev/pandas | [
37157,
15883,
37157,
3678,
1282613853
] |
def test_repr(self):
expected = "<BusinessQuarterEnd: startingMonth=3>"
assert repr(BQuarterEnd()) == expected
expected = "<BusinessQuarterEnd: startingMonth=3>"
assert repr(BQuarterEnd(startingMonth=3)) == expected
expected = "<BusinessQuarterEnd: startingMonth=1>"
asser... | pandas-dev/pandas | [
37157,
15883,
37157,
3678,
1282613853
] |
def test_offset_corner_case(self):
# corner
offset = BQuarterEnd(n=-1, startingMonth=1)
assert datetime(2010, 1, 31) + offset == datetime(2010, 1, 29) | pandas-dev/pandas | [
37157,
15883,
37157,
3678,
1282613853
] |
def test_offset(self, case):
offset, cases = case
for base, expected in cases.items():
assert_offset_equal(offset, base, expected) | pandas-dev/pandas | [
37157,
15883,
37157,
3678,
1282613853
] |
def is_windows():
return os.name == 'nt' | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def main_compile_targets(args):
json.dump(['all'], args.output) | endlessm/chromium-browser | [
21,
16,
21,
3,
1435959644
] |
def test_attributes():
trajs = data.brownian_trajs_df()
trajs = Trajectories(trajs)
assert_array_equal(trajs.t_stamps, np.array([0, 1, 2, 3, 4]))
assert_array_equal(trajs.labels, np.array([0, 1, 2, 3, 4]))
segments = {0: [(0, 0), (1, 0), (2, 0), (3, 0), (4, 0)],
1: [(0, 1), (1, 1... | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_copy():
trajs = data.brownian_trajs_df()
trajs = Trajectories(trajs)
assert isinstance(trajs.copy(), Trajectories) | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_reverse():
trajs = data.brownian_trajs_df()
trajs = Trajectories(trajs)
assert trajs.reverse().shape == (25, 5)
trajs = data.brownian_trajs_df()
trajs = Trajectories(trajs)
trajs.reverse(inplace=True)
assert trajs.shape == (25, 5) | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_interpolate():
trajs = Trajectories(data.with_gaps_df())
trajs.set_index('true_label', inplace=True, append=True)
trajs.reset_index(level='label', drop=True, inplace=True)
trajs.index.set_names(['t_stamp', 'label'], inplace=True)
interpolated = trajs.time_interpolate(sampling=3, time_step=... | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_get_speeds():
trajs = Trajectories(data.brownian_trajs_df())
speeds = trajs.get_speeds().tolist()
real_speeds = [np.nan,
np.nan,
np.nan,
np.nan,
np.nan,
857.99153458573994,
1596.95307... | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_project():
trajs = Trajectories(data.directed_motion_trajs_df())
trajs.rename(columns={'true_label': 'new_label'}, inplace=True)
trajs.relabel()
trajs.project([0, 1],
coords=['x', 'y'],
keep_first_time=False,
reference=None,
... | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_get_longest_segments():
"""
"""
trajs = data.brownian_trajs_df()
trajs = Trajectories(trajs)
assert trajs.get_longest_segments(1) == [4] | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_remove_segments():
"""
"""
trajs = data.brownian_trajs_df()
trajs = Trajectories(trajs)
trajs.remove_segments(1, inplace=True)
assert np.all(trajs.labels == [0, 2, 3, 4]) | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_relabel():
"""
"""
trajs = Trajectories(data.brownian_trajs_df())
trajs.columns = ['x', 'y', 'z', 'new_label', 't']
trajs.relabel(inplace=True)
new_values = [[1.933058243735795, -14.581064591435775, 11.603556633147544, 0.0],
[-12.862215173899491, -2.8611502446443238, ... | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_remove_spots():
"""
"""
trajs = Trajectories(data.brownian_trajs_df())
new_trajs = trajs.remove_spots([(3, 2), (0, 0)], inplace=False)
new_indexes = [(0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 1), (1, 2),
(1, 3), (1, 4), (2, 0), (2, 1), (2, 2), (2, 3), (2, 4),
... | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_cut_segments():
"""
"""
trajs = Trajectories(data.brownian_trajs_df())
trajs.cut_segments((2, 3), inplace=True)
new_indexes = [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (1, 0), (1, 1),
(1, 2), (1, 3), (1, 4), (2, 0), (2, 1), (2, 2), (2, 3),
(2, 4), (3, ... | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def test_get_bounds():
"""
"""
trajs = Trajectories(data.brownian_trajs_df())
trajs['t'] *= 10
t_stamp_bounds = {0: (0, 4), 1: (0, 4), 2: (0, 4), 3: (0, 4), 4: (0, 4)}
t_bounds = {0: (0.0, 40.0), 1: (0.0, 40.0), 2: (0.0, 40.0), 3: (0.0, 40.0), 4: (0.0, 40.0)}
assert trajs.get_bounds() == t... | bnoi/scikit-tracker | [
9,
3,
9,
6,
1392198505
] |
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_lost_aqualish_soldier_female_01.iff"
result.attribute_template_id = 9
result.stfName("npc_name","aqualish_base_female") | anhstudios/swganh | [
62,
37,
62,
37,
1297996365
] |
def create(kernel):
result = Creature()
result.template = "object/creature/npc/droid/shared_wed_treadwell_base.iff"
result.attribute_template_id = 3
result.stfName("droid_name","wed_treadwell_base") | anhstudios/swganh | [
62,
37,
62,
37,
1297996365
] |
def create(kernel):
result = Mission()
result.template = "object/mission/base/shared_base_mission.iff"
result.attribute_template_id = -1
result.stfName("string_id_table","") | anhstudios/swganh | [
62,
37,
62,
37,
1297996365
] |
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/attachment/weapon/shared_blacksun_heavy_weapon2_s02.iff"
result.attribute_template_id = 8
result.stfName("item_n","ship_attachment") | anhstudios/swganh | [
62,
37,
62,
37,
1297996365
] |
def setUp(self):
"""Instantiate a KytosEventBuffer."""
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(self.loop)
self.kytos_event_buffer = KytosEventBuffer('name', loop=self.loop) | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def create_event_mock(name='any'):
"""Create a new event mock."""
event = MagicMock()
event.name = name
return event | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def test_put__shutdown(self):
"""Test put method to shutdown event."""
event = self.create_event_mock('kytos/core.shutdown')
self.kytos_event_buffer.put(event)
self.assertTrue(self.kytos_event_buffer._reject_new_events) | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def test_aget(self):
"""Test aget async method."""
event = self.create_event_mock()
self.kytos_event_buffer._queue.sync_q.put(event)
expected = self.loop.run_until_complete(self.kytos_event_buffer.aget())
self.assertEqual(event, expected) | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def test_task_done(self, mock_task_done):
"""Test task_done method."""
self.kytos_event_buffer.task_done()
mock_task_done.assert_called() | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def test_join(self, mock_join):
"""Test join method."""
self.kytos_event_buffer.join()
mock_join.assert_called() | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def test_empty(self):
"""Test empty method to empty and with one event in query."""
empty_1 = self.kytos_event_buffer.empty()
event = self.create_event_mock()
self.kytos_event_buffer._queue.sync_q.put(event)
empty_2 = self.kytos_event_buffer.empty()
self.assertTrue(emp... | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def test_full(self, mock_full):
"""Test full method to full and not full query."""
mock_full.side_effect = [False, True]
full_1 = self.kytos_event_buffer.full()
full_2 = self.kytos_event_buffer.full()
self.assertFalse(full_1)
self.assertTrue(full_2) | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def setUp(self):
"""Instantiate a KytosBuffers."""
self.loop = asyncio.new_event_loop()
asyncio.set_event_loop(None)
self.kytos_buffers = KytosBuffers(loop=self.loop) | kytos/kytos | [
43,
46,
43,
125,
1465587463
] |
def get_display(self):
top = DivWdg()
top.add_color("background", "background")
top.add_color("color", "color")
top.add_style("min-width: 600px")
os_name = os.name
top.set_unique_id()
top.add_smart_style("spt_info_title", "background", self.top.get_color("backg... | Southpaw-TACTIC/TACTIC | [
473,
170,
473,
29,
1378771601
] |
def handle_directories(self, top):
# deal with asset directories
top.add(DivWdg('Asset Folders', css='spt_info_title'))
mailserver = Config.get_value("services", "mailserver")
table = Table()
table.add_color("color", "color")
table.add_style("margin: 10px")
top.ad... | Southpaw-TACTIC/TACTIC | [
473,
170,
473,
29,
1378771601
] |
def handle_python_script_test(self, top):
top.add(DivWdg('Python Script Test', css='spt_info_title'))
table = Table(css='script')
table.add_color("color", "color")
table.add_style("margin: 10px")
table.add_style("width: 100%")
top.add(table)
table.add_row()
... | Southpaw-TACTIC/TACTIC | [
473,
170,
473,
29,
1378771601
] |
def handle_load_balancing(self, top):
# deal with asset directories
top.add(DivWdg('Load Balancing', css='spt_info_title'))
table = Table()
table.add_class("spt_loadbalance")
table.add_color("color", "color")
table.add_style("margin: 10px")
top.add(table)
... | Southpaw-TACTIC/TACTIC | [
473,
170,
473,
29,
1378771601
] |
def execute(self):
tmp_dir = Environment.get_tmp_dir()
# remove the sidebar cache
sidebar_cache_dir = "%s/cache/side_bar" % tmp_dir
if os.path.exists(sidebar_cache_dir):
import shutil
shutil.rmtree(sidebar_cache_dir) | Southpaw-TACTIC/TACTIC | [
473,
170,
473,
29,
1378771601
] |
def get_display(self):
config_search_type = "config/widget_config" | Southpaw-TACTIC/TACTIC | [
473,
170,
473,
29,
1378771601
] |
def get_display(self):
top = self.top
top.add("<br/>")
top.add_style("margin-left: 10px")
try:
import multiprocessing
cpu_count = multiprocessing.cpu_count()
except (ImportError, NotImplementedError):
cpu_count = 'n/a'
title = DivWdg(... | Southpaw-TACTIC/TACTIC | [
473,
170,
473,
29,
1378771601
] |
def load_dataset(incl_test=False, incl_foldc=False):
fr = h2o.import_file(pu.locate("smalldata/titanic/titanic_expanded.csv"), header=1)
target = "survived"
train = fr
test = None
if incl_test:
fr = fr.split_frame(ratios=[.8], destination_frames=["titanic_train", "titanic_test"], seed=seed)
... | h2oai/h2o-3 | [
6169,
1943,
6169,
208,
1393862887
] |
def test_deprecated_f_param_is_alias_for_smoothing():
ds = load_dataset(incl_test=True)
te = H2OTargetEncoderEstimator(noise=0)
te.train(y=ds.target, training_frame=ds.train)
encoded = te.predict(ds.test)
# print(encoded)
with warnings.catch_warnings(record=True) as w:
warnings.simplefil... | h2oai/h2o-3 | [
6169,
1943,
6169,
208,
1393862887
] |
def test_deprecated_noise_level_param_is_alias_for_noise():
ds = load_dataset(incl_test=True)
te = H2OTargetEncoderEstimator()
te.train(y=ds.target, training_frame=ds.train)
encoded = te.predict(ds.test)
# print(encoded)
with warnings.catch_warnings(record=True) as w:
warnings.simplefilt... | h2oai/h2o-3 | [
6169,
1943,
6169,
208,
1393862887
] |
def test_transform_data_leakage_handling_param_raise_warning():
ds = load_dataset(incl_test=True)
te = H2OTargetEncoderEstimator(data_leakage_handling="leave_one_out", seed=42)
te.train(y=ds.target, training_frame=ds.train)
encoded = te.predict(ds.test)
encoded_as_training = te.transform(ds.test, as... | h2oai/h2o-3 | [
6169,
1943,
6169,
208,
1393862887
] |
def __init__(self):
super().__init__("Machine feature is disabled") | dmpetrov/dataversioncontrol | [
11197,
1036,
11197,
597,
1488615393
] |
def __init__(self, args):
super().__init__(args)
if not self.config["feature"].get("machine", False):
raise MachineDisabledError
if getattr(self.args, "name", None):
self.args.name = self.args.name.lower() | dmpetrov/dataversioncontrol | [
11197,
1036,
11197,
597,
1488615393
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.