function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def idq_torque(id, iq, torque, ax=0):
"""creates a surface plot of torque vs id, iq"""
if ax == 0:
_create_3d_axis()
ax = plt.gca()
unit = 'Nm'
scale = 1
if np.min(torque) < -9.9e3 or np.max(torque) > 9.9e3:
scale = 1e-3
unit = 'kNm'
_plot_surface(ax, id, iq, scal... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def idq_psiq(id, iq, psiq, ax=0):
"""creates a surface plot of psiq vs id, iq"""
if ax == 0:
_create_3d_axis()
ax = plt.gca()
_plot_surface(ax, id, iq, psiq,
(u'Id/A', u'Iq/A', u'Psi q/Vs'),
azim=210) | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def idq_ld(id, iq, ld, ax=0):
"""creates a surface plot of ld vs. id, iq"""
if ax == 0:
_create_3d_axis()
ax = plt.gca()
_plot_surface(ax, id, iq, np.asarray(ld)*1e3,
(u'Id/A', u'Iq/A', u'L d/mH'),
azim=120) | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def ldlq(bch):
"""creates the surface plots of a BCH reader object
with a ld-lq identification"""
beta = bch.ldq['beta']
i1 = bch.ldq['i1']
torque = bch.ldq['torque']
ld = np.array(bch.ldq['ld'])
lq = np.array(bch.ldq['lq'])
psid = bch.ldq['psid']
psiq = bch.ldq['psiq']
rows = 3... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def felosses(losses, coeffs, title='', log=True, ax=0):
"""plot iron losses with steinmetz or jordan approximation
Args:
losses: dict with f, B, pfe values
coeffs: list with steinmetz (cw, alpha, beta) or
jordan (cw, alpha, ch, beta, gamma) coeffs
title: title string
log: l... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def mesh(isa, with_axis=False, ax=0):
"""plot mesh of I7/ISA7 model
Args:
isa: Isa7 object
"""
from matplotlib.lines import Line2D
if ax == 0:
ax = plt.gca()
ax.set_aspect('equal')
for el in isa.elements:
pts = [list(i) for i in zip(*[v.xy for v in el.vertices])]
... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def demag(isa, ax=0):
"""plot demag of NC/I7/ISA7 model
Args:
isa: Isa7/NC object
"""
emag = [e for e in isa.elements if e.is_magnet()]
demag = np.array([e.demagnetization(isa.MAGN_TEMPERATURE) for e in emag])
_contour(ax, f'Demagnetization at {isa.MAGN_TEMPERATURE} °C',
emag,... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def flux_density(isa, subreg=[], ax=0):
"""plot flux density of NC/I7/ISA7 model
Args:
isa: Isa7/NC object
"""
if subreg:
if isinstance(subreg, list):
sr = subreg
else:
sr = [subreg]
elements = [e for s in sr for se in isa.get_subregion(s).elements()... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def mmf(f, title='', ax=0):
"""plot magnetomotive force (mmf) of winding"""
if ax == 0:
ax = plt.gca()
if title:
ax.set_title(title)
ax.plot(np.array(f['pos'])/np.pi*180, f['mmf'])
ax.plot(np.array(f['pos_fft'])/np.pi*180, f['mmf_fft'])
ax.set_xlabel('Position / Deg')
phi = ... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def zoneplan(wdg, ax=0):
"""plot zone plan of winding wdg"""
from matplotlib.patches import Rectangle
upper, lower = wdg.zoneplan()
Qb = len([n for l in upper for n in l])
from femagtools.windings import coil_color
rh = 0.5
if lower:
yl = rh
ymax = 2*rh + 0.2
else:
... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def winding(wdg, ax=0):
"""plot coils of windings wdg"""
from matplotlib.patches import Rectangle
from matplotlib.lines import Line2D
from femagtools.windings import coil_color
coil_len = 25
coil_height = 4
dslot = 8
arrow_head_length = 2
arrow_head_width = 2
if ax == 0:
... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def characteristics(char, title=''):
fig, axs = plt.subplots(2, 2, figsize=(10, 8), sharex=True)
if title:
fig.suptitle(title)
n = np.array(char['n'])*60
pmech = np.array(char['pmech'])*1e-3
axs[0, 0].plot(n, np.array(char['T']), 'C0-', label='Torque')
axs[0, 0].set_ylabel("Torque / Nm... | SEMAFORInformatik/femagtools | [
17,
10,
17,
4,
1471511034
] |
def __init__(self, out='noise', realization=0, component=0, noise='noise',
rate=None, altFFT=False):
# We call the parent class constructor, which currently does nothing
super().__init__()
self._out = out
self._oversample = 2
self._realization = realization
... | tskisner/pytoast | [
29,
32,
29,
55,
1428597089
] |
def test_scaffold(self, mock_cookiecutter):
from molo.core.scripts import cli
package = pkg_resources.get_distribution('molo.core')
runner = CliRunner()
runner.invoke(cli.scaffold, ['foo'])
[call] = mock_cookiecutter.call_args_list
args, kwargs = call
self.assert... | praekelt/molo | [
26,
5,
26,
12,
1432888733
] |
def test_scaffold_with_custom_dir(self, mock_cookiecutter):
from molo.core.scripts import cli
package = pkg_resources.get_distribution('molo.core')
runner = CliRunner()
runner.invoke(cli.scaffold, ['foo', 'bar'])
[call] = mock_cookiecutter.call_args_list
args, kwargs = c... | praekelt/molo | [
26,
5,
26,
12,
1432888733
] |
def test_scaffold_with_requirements(self, mock_cookiecutter):
from molo.core.scripts import cli
package = pkg_resources.get_distribution('molo.core')
runner = CliRunner()
runner.invoke(cli.scaffold, ['foo', '--require', 'bar'])
[call] = mock_cookiecutter.call_args_list
a... | praekelt/molo | [
26,
5,
26,
12,
1432888733
] |
def test_scaffold_with_includes(self, mock_cookiecutter):
from molo.core.scripts import cli
package = pkg_resources.get_distribution('molo.core')
runner = CliRunner()
runner.invoke(cli.scaffold, ['foo', '--include', 'bar', 'baz'])
[call] = mock_cookiecutter.call_args_list
... | praekelt/molo | [
26,
5,
26,
12,
1432888733
] |
def test_unpack(self, mock_copytree, mock_get_template_dirs,
mock_get_package):
package = pkg_resources.get_distribution('molo.core')
mock_get_package.return_value = package
mock_get_template_dirs.return_value = ['foo']
mock_copytree.return_value = True
from ... | praekelt/molo | [
26,
5,
26,
12,
1432888733
] |
def test_version_constants(self, space):
w_res = space.execute("return Marshal::MAJOR_VERSION")
assert space.int_w(w_res) == 4
w_res = space.execute("return Marshal::MINOR_VERSION")
assert space.int_w(w_res) == 8
w_res = space.execute("return Marshal.dump('test')[0].ord")
... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_load_constants(self, space):
w_res = space.execute("return Marshal.load('\x04\b0')")
assert w_res == space.w_nil
w_res = space.execute("return Marshal.load('\x04\bT')")
assert w_res == space.w_true
w_res = space.execute("return Marshal.load('\x04\bF')")
assert ... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_dump_tiny_integer(self, space):
w_res = space.execute("return Marshal.dump(5)")
assert space.str_w(w_res) == "\x04\bi\n"
w_res = space.execute("return Marshal.dump(100)")
assert space.str_w(w_res) == "\x04\bii"
w_res = space.execute("return Marshal.dump(0)")
as... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_dump_array(self, space):
w_res = space.execute("return Marshal.dump([])")
assert space.str_w(w_res) == "\x04\b[\x00"
w_res = space.execute("return Marshal.dump([nil])")
assert space.str_w(w_res) == "\x04\b[\x060"
w_res = space.execute("return Marshal.dump([nil, true, f... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_dump_symbol(self, space):
w_res = space.execute("return Marshal.dump(:abc)")
assert space.str_w(w_res) == "\x04\b:\babc"
w_res = space.execute("return Marshal.dump(('hello' * 25).to_sym)")
assert space.str_w(w_res) == "\x04\b:\x01}" + "hello" * 25
w_res = space.execute... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_dump_hash(self, space):
w_res = space.execute("return Marshal.dump({})")
assert space.str_w(w_res) == "\x04\b{\x00"
w_res = space.execute("return Marshal.dump({1 => 2, 3 => 4})")
assert self.unwrap(space, w_res) == "\x04\b{\ai\x06i\ai\bi\t"
w_res = space.execute("retur... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_dump_integer(self, space):
w_res = space.execute("return Marshal.dump(123)")
assert space.str_w(w_res) == "\x04\bi\x01{"
w_res = space.execute("return Marshal.dump(255)")
assert space.str_w(w_res) == "\x04\bi\x01\xFF"
w_res = space.execute("return Marshal.dump(256)")
... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_dump_negative_integer(self, space):
w_res = space.execute("return Marshal.dump(-1)")
assert space.str_w(w_res) == "\x04\bi\xFA"
w_res = space.execute("return Marshal.dump(-123)")
assert space.str_w(w_res) == "\x04\bi\x80"
w_res = space.execute("return Marshal.dump(-124... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_dump_float(self, space):
w_res = space.execute("return Marshal.dump(0.0)")
assert space.str_w(w_res) == "\x04\bf\x060"
w_res = space.execute("return Marshal.dump(0.1)")
assert space.str_w(w_res) == "\x04\bf\b0.1"
w_res = space.execute("return Marshal.dump(1.0)")
... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_dump_string(self, space):
w_res = space.execute("return Marshal.dump('')")
assert space.str_w(w_res) == "\x04\bI\"\x00\x06:\x06ET"
w_res = space.execute("return Marshal.dump('abc')")
assert space.str_w(w_res) == "\x04\bI\"\babc\x06:\x06ET"
w_res = space.execute("return... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_array(self, space):
w_res = space.execute("return Marshal.load(Marshal.dump([1, 2, 3]))")
assert self.unwrap(space, w_res) == [1, 2, 3]
w_res = space.execute("return Marshal.load(Marshal.dump([1, [2, 3], 4]))")
assert self.unwrap(space, w_res) == [1, [2, 3], 4]
w_res =... | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def test_short_data(self, space):
with self.raises(space, "ArgumentError", "marshal data too short"):
space.execute("Marshal.load('')") | babelsberg/babelsberg-r | [
19,
2,
19,
1,
1346685898
] |
def md5(file_path):
"""Get md5 hash of a file.
Parameters
----------
file_path: str
File path.
Returns
-------
md5_hash: str
md5 hash of data in file_path
"""
hash_md5 = hashlib.md5()
with open(file_path, 'rb') as fhandle:
for chunk in iter(lambda: fhandle... | mir-dataset-loaders/mirdata | [
273,
52,
273,
69,
1550182293
] |
def make_irmas_index(irmas_data_path):
count = 0
irmas_dict = dict()
for root, dirs, files in os.walk(irmas_data_path):
for directory in dirs:
if 'Train' in directory:
for root_, dirs_, files_ in os.walk(
os.path.join(irmas_data_path, directory)
... | mir-dataset-loaders/mirdata | [
273,
52,
273,
69,
1550182293
] |
def main(args):
make_irmas_index(args.irmas_data_path)
# make_irmas_test_index(args.irmas_data_path) | mir-dataset-loaders/mirdata | [
273,
52,
273,
69,
1550182293
] |
def setUp(self):
self.app_helper = self.add_helper(AppWorkerHelper(StreamingHTTPWorker))
self.config = {
'health_path': '/health/',
'web_path': '/foo',
'web_port': 0,
'metrics_prefix': 'metrics_prefix.',
'conversation_cache_ttl': 0,
}
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def track_wrapper(*args, **kw):
self._req_state['expected'] += 1
return orig_track(*args, **kw) | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def _wait_for_requests(self):
while self._req_state['expected'] > 0:
yield self._req_state['queue'].get()
self._req_state['expected'] -= 1 | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def pull_message(self, count=1):
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
messages = DeferredQueue()
errors = DeferredQueue()
receiver = self.client.stream(
TransportUserMessage, messages.put, errors.put, url,
Headers(self.auth_headers))
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_proxy_buffering_headers_off(self):
# This is the default, but we patch it anyway to make sure we're
# testing the right thing should the default change.
self.patch(StreamResourceMixin, 'proxy_buffering', False)
receiver, received_messages = yield self.pull_message()
head... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_proxy_buffering_headers_on(self):
self.patch(StreamResourceMixin, 'proxy_buffering', True)
receiver, received_messages = yield self.pull_message()
headers = receiver._response.headers
self.assertEqual(headers.getRawHeaders('x-accel-buffering'), ['yes']) | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_content_type(self):
receiver, received_messages = yield self.pull_message()
headers = receiver._response.headers
self.assertEqual(
headers.getRawHeaders('content-type'),
['application/json; charset=utf-8']) | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_messages_stream(self):
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
messages = DeferredQueue()
errors = DeferredQueue()
receiver = self.client.stream(
TransportUserMessage, messages.put, errors.put, url,
Headers(self.auth_headers))
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_events_stream(self):
url = '%s/%s/events.json' % (self.url, self.conversation.key)
events = DeferredQueue()
errors = DeferredQueue()
receiver = yield self.client.stream(TransportEvent, events.put,
events.put, url,
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_missing_auth(self):
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
queue = DeferredQueue()
receiver = self.client.stream(
TransportUserMessage, queue.put, queue.put, url)
response = yield receiver.get_response()
self.assertEqual(response.cod... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_invalid_auth(self):
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
queue = DeferredQueue()
headers = Headers({
'Authorization': ['Basic %s' % (base64.b64encode('foo:bar'),)],
})
receiver = self.client.stream(
TransportUserMessa... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_send_to(self):
msg = {
'to_addr': '+2345',
'content': 'foo',
'message_id': 'evil_id',
}
# TaggingMiddleware.add_tag_to_msg(msg, self.tag)
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
response = yield http_request_f... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_send_to_within_content_length_limit(self):
self.conversation.config['http_api'].update({
'content_length_limit': 182,
})
yield self.conversation.save()
msg = {
'content': 'foo',
'to_addr': '+1234',
}
url = '%s/%s/messages.jso... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_send_to_content_too_long(self):
self.conversation.config['http_api'].update({
'content_length_limit': 10,
})
yield self.conversation.save()
msg = {
'content': "This message is longer than 10 characters.",
'to_addr': '+1234',
}
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_send_to_with_evil_content(self):
msg = {
'content': 0xBAD,
'to_addr': '+1234',
}
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
response = yield http_request_full(url, json.dumps(msg),
self.auth... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_send_to_with_evil_to_addr(self):
msg = {
'content': 'good',
'to_addr': 1234,
}
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
response = yield http_request_full(url, json.dumps(msg),
self.auth_h... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_in_reply_to(self):
inbound_msg = yield self.app_helper.make_stored_inbound(
self.conversation, 'in 1', message_id='1')
msg = {
'content': 'foo',
'in_reply_to': inbound_msg['message_id'],
}
url = '%s/%s/messages.json' % (self.url, self.conver... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_in_reply_to_within_content_length_limit(self):
self.conversation.config['http_api'].update({
'content_length_limit': 182,
})
yield self.conversation.save()
inbound_msg = yield self.app_helper.make_stored_inbound(
self.conversation, 'in 1', message_id='1'... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_in_reply_to_content_too_long(self):
self.conversation.config['http_api'].update({
'content_length_limit': 10,
})
yield self.conversation.save()
inbound_msg = yield self.app_helper.make_stored_inbound(
self.conversation, 'in 1', message_id='1')
m... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_in_reply_to_with_evil_content(self):
inbound_msg = yield self.app_helper.make_stored_inbound(
self.conversation, 'in 1', message_id='1')
msg = {
'content': 0xBAD,
'in_reply_to': inbound_msg['message_id'],
}
url = '%s/%s/messages.json' % (sel... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_invalid_in_reply_to(self):
msg = {
'content': 'foo',
'in_reply_to': '1', # this doesn't exist
}
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
response = yield http_request_full(url, json.dumps(msg),
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_invalid_in_reply_to_with_missing_conversation_key(self):
# create a message with no conversation
inbound_msg = self.app_helper.make_inbound('in 1', message_id='msg-1')
vumi_api = self.app_helper.vumi_helper.get_vumi_api()
yield vumi_api.mdb.add_inbound_message(inbound_msg)
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_in_reply_to_with_evil_session_event(self):
inbound_msg = yield self.app_helper.make_stored_inbound(
self.conversation, 'in 1', message_id='1')
msg = {
'content': 'foo',
'in_reply_to': inbound_msg['message_id'],
'session_event': 0xBAD5E55104,
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_in_reply_to_with_evil_message_id(self):
inbound_msg = yield self.app_helper.make_stored_inbound(
self.conversation, 'in 1', message_id='1')
msg = {
'content': 'foo',
'in_reply_to': inbound_msg['message_id'],
'message_id': 'evil_id'
}
... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_metric_publishing(self):
metric_data = [
("vumi.test.v1", 1234, 'SUM'),
("vumi.test.v2", 3456, 'AVG'),
]
url = '%s/%s/metrics.json' % (self.url, self.conversation.key)
response = yield http_request_full(
url, json.dumps(metric_data), self.au... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_concurrency_limits(self):
config = yield self.app.get_config(None)
concurrency = config.concurrency_limit
queue = DeferredQueue()
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
max_receivers = [self.client.stream(
TransportUserMessage, queue.... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_disabling_concurrency_limit(self):
conv_resource = StreamingConversationResource(
self.app, self.conversation.key)
# negative concurrency limit disables it
ctxt = ConfigContext(user_account=self.conversation.user_account.key,
concurrency_limit=-1... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_backlog_on_connect(self):
for i in range(10):
yield self.app_helper.make_dispatch_inbound(
'in %s' % (i,), message_id=str(i), conv=self.conversation)
queue = DeferredQueue()
url = '%s/%s/messages.json' % (self.url, self.conversation.key)
receiver = s... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_health_response(self):
health_url = 'http://%s:%s%s' % (
self.addr.host, self.addr.port, self.config['health_path'])
response = yield http_request_full(health_url, method='GET')
self.assertEqual(response.delivered_body, '0')
yield self.app_helper.make_dispatch_inbo... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_post_inbound_message(self):
# Set the URL so stuff is HTTP Posted instead of streamed.
self.conversation.config['http_api'].update({
'push_message_url': self.mock_push_server.url,
})
yield self.conversation.save()
msg_d = self.app_helper.make_dispatch_inboun... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_post_inbound_message_201_response(self):
# Set the URL so stuff is HTTP Posted instead of streamed.
self.conversation.config['http_api'].update({
'push_message_url': self.mock_push_server.url,
})
yield self.conversation.save()
with LogCatcher(message='Got un... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_post_inbound_message_500_response(self):
# Set the URL so stuff is HTTP Posted instead of streamed.
self.conversation.config['http_api'].update({
'push_message_url': self.mock_push_server.url,
})
yield self.conversation.save()
with LogCatcher(message='Got un... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_post_inbound_event(self):
# Set the URL so stuff is HTTP Posted instead of streamed.
self.conversation.config['http_api'].update({
'push_event_url': self.mock_push_server.url,
})
yield self.conversation.save()
msg = yield self.app_helper.make_stored_outbound... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_bad_urls(self):
def assert_not_found(url, headers={}):
d = http_request_full(self.url, method='GET', headers=headers)
d.addCallback(lambda r: self.assertEqual(r.code, http.NOT_FOUND))
return d
yield assert_not_found(self.url)
yield assert_not_found(s... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def test_send_message_command(self):
yield self.app_helper.dispatch_command(
'send_message',
user_account_key=self.conversation.user_account.key,
conversation_key=self.conversation.key,
command_data={
u'batch_id': u'batch-id',
u'con... | praekelt/vumi-go | [
15,
20,
15,
105,
1308905181
] |
def __init__(self):
super().__init__()
self.visited = [] | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def visit_BasicNodeReplacement(self, node):
self.visited.append("visited Copy!") | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def __init__(self):
super().__init__()
self.recorded_access_path = None | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def __init__(self):
super().__init__()
self.visited = [] | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def visit_BasicNodeReplacement(self, node):
self.visited.append("visited Copy!")
return node | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def __init__(self):
super().__init__()
self.recorded_access_path = None | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def visit_BasicNode(self, node):
return BasicNodeReplacement() | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def visit_BasicNodeReplacement(self, node):
return self.NONE_DEPUTY # Replace this node with None | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def test_visit_order(self, node, order):
to_visit = self.load(node)
# The main stuff
visitor = VisitOrderCheckingVisitor()
retval = visitor.visit(to_visit)
assert_equal(retval, None)
assert_equal(visitor.visited, order) | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def test_access_path(self, node, access):
to_visit = self.load(node)
access_path = self.load(access)
# The main stuff
visitor = AccessPathCheckingVisitor()
retval = visitor.visit(to_visit)
assert_equal(retval, None)
assert_equal(visitor.recorded_access_path, acc... | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def test_empty_transformer(self, node, order):
to_visit = self.load(node)
# The main stuff
visitor = EmptyTransformer()
retval = visitor.visit(to_visit)
assert_equal(to_visit, retval) | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def test_visit_order(self, node, order):
to_visit = self.load(node)
# The main stuff
visitor = VisitOrderCheckingTransformer()
retval = visitor.visit(to_visit)
assert_equal(to_visit, retval)
assert_equal(visitor.visited, order) | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def test_access_path(self, node, access):
to_visit = self.load(node)
access_path = self.load(access)
# The main stuff
visitor = AccessPathCheckingTransformer()
retval = visitor.visit(to_visit)
assert_equal(retval, to_visit)
assert_equal(visitor.recorded_access_p... | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def test_transformation(self, node, expected):
to_visit = self.load(node)
expected_node = self.load(expected)
# The main stuff
visitor = TransformationCheckingTransformer()
retval = visitor.visit(to_visit)
assert_equal(retval, expected_node) | pradyunsg/Py2C | [
243,
76,
243,
3,
1379849666
] |
def __init__(self, **kwargs):
""" Initializes a Avatar instance
Notes:
You can specify all parameters while calling this methods.
A special argument named `data` will enable you to load the
object from a Python dictionary
Examples:
... | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_updated_by(self):
""" Get last_updated_by value.
Notes:
ID of the user who last updated the object. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_updated_by(self, value):
""" Set last_updated_by value.
Notes:
ID of the user who last updated the object. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_updated_date(self):
""" Get last_updated_date value.
Notes:
Time stamp when this object was last updated. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def last_updated_date(self, value):
""" Set last_updated_date value.
Notes:
Time stamp when this object was last updated. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def embedded_metadata(self):
""" Get embedded_metadata value.
Notes:
Metadata objects associated with this entity. This will contain a list of Metadata objects if the API request is made using the special flag to enable the embedded Metadata feature. Only a maximum of Metadata objec... | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def embedded_metadata(self, value):
""" Set embedded_metadata value.
Notes:
Metadata objects associated with this entity. This will contain a list of Metadata objects if the API request is made using the special flag to enable the embedded Metadata feature. Only a maximum of Metadat... | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def entity_scope(self):
""" Get entity_scope value.
Notes:
Specify if scope of entity is Data center or Enterprise level | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def entity_scope(self, value):
""" Set entity_scope value.
Notes:
Specify if scope of entity is Data center or Enterprise level | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def creation_date(self):
""" Get creation_date value.
Notes:
Time stamp when this object was created. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def creation_date(self, value):
""" Set creation_date value.
Notes:
Time stamp when this object was created. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def owner(self):
""" Get owner value.
Notes:
Identifies the user that has created this object. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def owner(self, value):
""" Set owner value.
Notes:
Identifies the user that has created this object. | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def external_id(self):
""" Get external_id value.
Notes:
External object ID. Used for integration with third party systems | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def external_id(self, value):
""" Set external_id value.
Notes:
External object ID. Used for integration with third party systems | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def type(self):
""" Get type value.
Notes:
The image type | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def type(self, value):
""" Set type value.
Notes:
The image type | nuagenetworks/vspk-python | [
19,
18,
19,
7,
1457133058
] |
def setUp(self):
self.config_instance = roster_core.Config(file_name=CONFIG_FILE)
self.cred_instance = credentials.CredCache(self.config_instance,
u'sharrell')
db_instance = self.config_instance.GetDb()
db_instance.CreateRosterDatabase()
data = open(D... | stephenlienharrell/roster-dns-management | [
1,
1,
1,
4,
1426209952
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.