function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def for_user(cls, user):
assert user.is_authenticated(), "user must be authenticated"
user_state, _ = cls.objects.get_or_create(user=user)
return user_state | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def set(self, key, value):
self.data[key] = value
self.save() | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def activity_class(self):
return load_path_attr(self.activity_class_path) | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def in_progress(self):
return next(iter(self.sessions.filter(completed=None)), None) | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def latest(self):
session, _ = self.sessions.get_or_create(completed=None)
return session | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def last_completed(self):
return self.sessions.filter(completed__isnull=False).order_by("-started").first() | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def all_sessions(self):
return self.sessions.order_by("started") | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def state_for_user(cls, user, activity_key):
assert user.is_authenticated(), "user must be authenticated"
return cls.objects.filter(user=user, activity_key=activity_key).first() | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def progression(self):
if self.in_progress:
return "continue"
elif self.activity_class.repeatable:
return "repeat"
else:
return "completed" | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def mark_completed(self):
self.completed = timezone.now()
self.save()
self.activity_state.completed_count = models.F("completed_count") + 1
self.activity_state.save() | pinax/pinax-lms-activities | [
7,
3,
7,
14,
1423412548
] |
def __init__(self, alt_abbrevs=tuple(), structures=tuple(), figures=None, artiris=tuple()):
self.alt_abbrevs = alt_abbrevs
self.structures = structures
self.artiris = artiris | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def loadData(cls):
with open(cls.source, 'rt') as f:
lines = [l.rsplit('#')[0].strip() for l in f.readlines() if not l.startswith('#')]
return [l.rsplit(' ', 1) for l in lines] | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def processData(cls):
structRecs = []
out = {}
for structure, abrv in cls.raw:
structRecs.append((abrv, structure))
if abrv in out:
out[abrv][0].append(structure)
else:
out[abrv] = ([structure], ())
return structRecs, ou... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def validate(cls, structRecs, out):
print(Counter(_[0] for _ in structRecs).most_common()[:5])
print(Counter(_[1] for _ in structRecs).most_common()[:5])
assert len(structRecs) == len([s for sl, _ in out.values() for s in sl]), 'There are non-unique abbreviations'
errata = {}
ret... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def parseData(cls):
a, b = cls.raw.split('List of Structures')
if not a:
los, loa = b.split('List of Abbreviations')
else:
los = b
_, loa = a.split('List of Abbreviations')
sr = []
for l in los.split('\n'):
if l and not l[0] == ';'... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def processData(cls):
sr, ar = cls.parseData()
out = {}
achild = {}
for a, s, f in ar:
if ', layer 1' in s or s.endswith(' layer 1'): # DTT1 ends in ' layer 1' without a comma
achild[a[:-1]] = a
continue # remove the precomposed, we will deal... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def validate(cls, sr, ar, out, achild, schild):
def missing(a, b):
am = a - b
bm = b - a
return am, bm
sabs = set(_[0] for _ in sr)
aabs = set(_[0] for _ in ar)
ssts = set(_[1] for _ in sr)
asts = set(_[1] for _ in ar)
ar2 = set(_[:2] f... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def loadData(cls):
with open(os.path.expanduser(cls.source), 'rt') as f:
return [l for l in f.read().split('\n') if l] | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def processData(cls):
out = {}
recs = []
parent_stack = [None]
old_depth = 0
layers = {}
for l in cls.raw:
depth, abbrev, _, name = l.split(' ', 3)
depth = len(depth)
if old_depth < depth: # don't change
parent = paren... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def validate(cls, trecs, tr, errata):
print(Counter(_[1] for _ in trecs).most_common()[:5])
('CxA1', 2), ('Tu1', 2), ('LOT1', 2), ('ECIC3', 2)
assert len(tr) == len(trecs), 'Abbreviations in tr are not unique!'
return tr, errata | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def fixes_abbrevs(self):
fixes_abbrevs = set()
for f in self._fixes:
fixes_abbrevs.add(f[0])
for dupe in self._dupes.values():
fixes_abbrevs.add(dupe.alt_abbrevs[0])
return fixes_abbrevs | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def fixes_prov(self):
_fixes_prov = {}
for f in self._fixes:
for l in f[1][0]:
_fixes_prov[l] = [ParcOnt.wasGeneratedBy.format(line=getSourceLine(self.__class__))] # FIXME per file
return _fixes_prov | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def dupes_structs(self):
ds = {'cerebellar lobules', 'cerebellar lobule'}
for dupe in self._dupes.values():
for struct in dupe.structures:
ds.add(struct)
return ds | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def fixes(self):
_, _, collisions, _ = self.records()
for a, (ss, f, arts) in self._fixes:
if (a, ss[0]) in collisions:
f.update(collisions[a, ss[1]]) # have to use 1 since we want "layer n" as the pref
yield a, ([], ss, f, arts) | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def _makeIriLookup(self):
# FIXME need to validate that we didn't write the graph first...
g = Graph().parse(self._graph.filename, format='turtle')
ids = [s for s in g.subjects(rdf.type, owl.Class) if self.namespace in s]
index0 = Label.propertyMapping['abbrevs'],
index1 = Label.... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def validate(self):
# check for duplicate labels
labels = list(self.graph.objects(None, rdfs.label))
assert len(labels) == len(set(labels)), f'There are classes with duplicate labels! {Counter(labels).most_common()[:5]}'
# check for unexpected duplicate abbreviations
abrevs = li... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def do_struct_prov(structure, source=None, artiri=None):
if artiri is None:
artiri = source.artifact.iri
if structure not in struct_prov:
struct_prov[structure] = [artiri]
elif artiri not in struct_prov[structure]:
struct_prov[structure... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def curate(self):
fr, err4 = PaxSrAr_4()
sx, err6 = PaxSrAr_6()
sx2, _ = PaxSr_6()
tr, err6t = PaxTree_6()
sfr = set(fr)
ssx = set(sx)
ssx2 = set(sx2)
str_ = set(tr)
in_four_not_in_six = sfr - ssx
in_six_not_in_four = ssx - sfr
in_... | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def __init__(self, source, abbreviation, structure, artifacts,
figures=tuple(),
synonyms=tuple(),
altAbbrevs=tuple()):
self.source = source
self.abbreviation = abbreviation
self.structure = structure
self.artifacts = artifacts | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def __hash__(self):
return hash(self.abbreviation) | tgbugs/pyontutils | [
15,
123,
15,
42,
1455242132
] |
def define(word, word_eol, userdata):
if len(word) >= 2:
_word = xchat.strip(word[1])
_number = 1
if len(word) >= 3:
_number = int(xchat.strip(word[2]))
else:
xchat.prnt('Define Usage: /define word [number]')
xchat.prnt(' number being alternate definition')
return xchat.EAT_ALL
url="http://www.googl... | TingPing/plugins | [
101,
42,
101,
2,
1335040714
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadat... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def set_buffer(ctx, buf):
global _keepalive # See note in JsonRpcProtocol
_keepalive = ctx.buf = _ffi.from_buffer(buf)
ctx.buflen = len(buf)
ctx.offset = 0 | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_simple(self):
r = b'{ "foo": "bar" }'
ctx = split_string(r)
self.assertEqual(ctx.error, 0)
self.assertEqual(ctx.offset, len(r)) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_trailing_whitespace(self):
r = b'{ "foo": "bar" } '
ctx = split_string(r)
self.assertEqual(ctx.error, 0)
self.assertEqual(ctx.offset, len(r)-1)
error = _lib.json_split(ctx)
self.assertEqual(error, ctx.error) == _lib.INCOMPLETE
self.assertEqual(ctx.offset,... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_string_escape(self):
r = b'{ "foo": "b\\"}" }'
ctx = split_string(r)
self.assertEqual(ctx.error, 0)
self.assertEqual(ctx.offset, len(r)) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_multiple(self):
r = b'{ "foo": "bar" } { "baz": "qux" }'
ctx = split_string(r)
self.assertEqual(ctx.error, 0)
self.assertEqual(ctx.offset, 16)
error = _lib.json_split(ctx)
self.assertEqual(error, ctx.error) == 0
self.assertEqual(ctx.offset, len(r)) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def setUp(self):
super(TestJsonRpcV1, self).setUp()
self.version = JsonRpcVersion.create('1.0') | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_request_missing_id(self):
v = self.version
msg = {'method': 'foo', 'params': []}
self.assertRaises(ValueError, v.check_message, msg) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_request_illegal_method(self):
v = self.version
msg = {'id': 1, 'method': None, 'params': []}
self.assertRaises(ValueError, v.check_message, msg)
msg = {'id': 1, 'method': 1, 'params': []}
self.assertRaises(ValueError, v.check_message, msg)
msg = {'id': 1, '... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_request_illegal_params(self):
v = self.version
msg = {'id': 1, 'method': 'foo', 'params': None}
self.assertRaises(ValueError, v.check_message, msg)
msg = {'id': 1, 'method': 'foo', 'params': 1}
self.assertRaises(ValueError, v.check_message, msg)
msg = {'id'... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response(self):
v = self.version
msg = {'id': 1, 'result': 'foo', 'error': None}
self.assertEqual(v.check_message(msg), jsonrpc.RESPONSE) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_error(self):
v = self.version
msg = {'id': 1, 'result': None, 'error': {'code': 1}}
self.assertEqual(v.check_message(msg), jsonrpc.RESPONSE) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_missing_result(self):
v = self.version
msg = {'id': 1, 'error': None}
self.assertRaises(ValueError, v.check_message, msg) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_illegal_error(self):
v = self.version
msg = {'id': 1, 'result': None, 'error': 1}
self.assertRaises(ValueError, v.check_message, msg)
msg = {'id': 1, 'result': None, 'error': 'foo'}
self.assertRaises(ValueError, v.check_message, msg)
msg = {'id': 1... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_extraneous_fields(self):
v = self.version
msg = {'id': 1, 'result': 1, 'error': None, 'bar': 'baz'}
self.assertRaises(ValueError, v.check_message, msg) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_create_request_notification(self):
v = self.version
msg = v.create_request('foo', [], notification=True)
self.assertIsNone(msg['id'])
self.assertEqual(msg['method'], 'foo')
self.assertEqual(msg['params'], [])
self.assertEqual(len(msg), 3) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_create_response_null_result(self):
v = self.version
req = {'id': 'gruvi.0'}
msg = v.create_response(req, None)
self.assertEqual(msg['id'], req['id'])
self.assertIsNone(msg['result'])
self.assertIsNone(msg['error'])
self.assertEqual(len(msg), 3) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def setUp(self):
super(TestJsonRpcV2, self).setUp()
self.version = JsonRpcVersion.create('2.0') | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_request_notification(self):
v = self.version
msg = {'jsonrpc': '2.0', 'method': 'foo', 'params': []}
self.assertEqual(v.check_message(msg), jsonrpc.REQUEST)
msg = {'jsonrpc': '2.0', 'method': 'foo', 'params': {}}
self.assertEqual(v.check_message(msg), jsonrpc.REQUE... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_request_missing_method(self):
v = self.version
msg = {'jsonrpc': '2.0', 'id': 1, 'params': []}
self.assertRaises(ValueError, v.check_message, msg) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_request_missing_params(self):
v = self.version
msg = {'jsonrpc': '2.0', 'id': 1, 'method': 'foo'}
self.assertEqual(v.check_message(msg), jsonrpc.REQUEST) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_request_extraneous_fields(self):
v = self.version
msg = {'jsonrpc': '2.0', 'id': 1, 'method': 'foo', 'params': [], 'bar': 'baz'}
self.assertRaises(ValueError, v.check_message, msg) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_null_result(self):
v = self.version
msg = {'jsonrpc': '2.0', 'id': 1, 'result': None}
self.assertEqual(v.check_message(msg), jsonrpc.RESPONSE) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_missing_id(self):
v = self.version
msg = {'jsonrpc': '2.0', 'result': 'foo'}
self.assertRaises(ValueError, v.check_message, msg) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_error_missing_id(self):
v = self.version
msg = {'jsonrpc': '2.0', 'error': {'code': 10}}
self.assertRaises(ValueError, v.check_message, msg) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_missing_result_and_error(self):
v = self.version
msg = {'jsonrpc': '2.0', 'id': 1}
self.assertRaises(ValueError, v.check_message, msg) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_check_response_result_error_both_present(self):
v = self.version
msg = {'jsonrpc': '2.0', 'id': 1, 'result': None, 'error': None}
self.assertRaises(ValueError, v.check_message, msg)
msg = {'jsonrpc': '2.0', 'id': 1, 'result': 1, 'error': None}
self.assertRaises(ValueErro... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_create_request(self):
v = self.version
msg = v.create_request('foo', [])
self.assertEqual(msg['jsonrpc'], '2.0')
self.assertIsInstance(msg['id'], six.string_types)
self.assertEqual(msg['method'], 'foo')
self.assertEqual(msg['params'], [])
self.assertEqual... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_create_response(self):
v = self.version
req = {'id': 'gruvi.0'}
msg = v.create_response(req, 1)
self.assertEqual(msg['jsonrpc'], '2.0')
self.assertEqual(msg['id'], req['id'])
self.assertEqual(msg['result'], 1)
self.assertNotIn('error', msg)
self.a... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_create_response_error(self):
v = self.version
req = {'id': 'gruvi.0'}
msg = v.create_response(req, error={'code': 1})
self.assertEqual(msg['jsonrpc'], '2.0')
self.assertEqual(msg['id'], req['id'])
self.assertNotIn('result', msg)
self.assertEqual(msg['erro... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def setUp(self):
super(TestJsonRpcProtocol, self).setUp()
self.transport = MockTransport()
self.protocol = JsonRpcProtocol(self.message_handler)
self.transport.start(self.protocol)
self.messages = []
self.protocols = [] | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def get_messages(self):
# run dispatcher thread so that it calls our message handler
gruvi.sleep(0)
return self.messages | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_multiple(self):
m = b'{ "id": "1", "method": "foo", "params": [] }' \
b'{ "id": "2", "method": "bar", "params": [] }'
proto = self.protocol
proto.data_received(m)
mm = self.get_messages()
self.assertEqual(len(mm), 2)
self.assertEqual(mm[0], {'id': '1'... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_incremental(self):
m = b'{ "id": "1", "method": "foo", "params": [] }'
proto = self.protocol
for i in range(len(m)-1):
proto.data_received(m[i:i+1])
self.assertEqual(self.get_messages(), [])
proto.data_received(m[-1:])
mm = self.get_messages()
... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_encoding_error(self):
m = b'{ xxx\xff }'
proto = self.protocol
proto.data_received(m)
self.assertEqual(self.get_messages(), [])
self.assertIsInstance(proto._error, JsonRpcError) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_illegal_jsonrpc(self):
m = b'{ "xxxx": "yyyy" }'
proto = self.protocol
proto.data_received(m)
self.assertEqual(self.get_messages(), [])
self.assertIsInstance(proto._error, JsonRpcError) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_flow_control(self):
# Write more messages than the protocol is willing to pipeline. Flow
# control should kick in and alternate scheduling of the producer and
# the consumer.
proto, trans = self.protocol, self.transport
self.assertTrue(trans._reading)
proto.max_p... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def reflect_app(message, transport, protocol):
if message.get('method') != 'echo':
return
value = protocol.call_method('echo', *message['params'])
protocol.send_response(message, value) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def application(message, transport, protocol):
if message.get('id') is None:
notifications.append((message['method'], message['params']))
elif message['method'] == 'get_notifications':
protocol.send_response(message, notifications) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_errno(self):
code = jsonrpc.SERVER_ERROR
self.assertIsInstance(code, int)
name = jsonrpc.errorcode[code]
self.assertIsInstance(name, str)
self.assertEqual(getattr(jsonrpc, name), code)
desc = jsonrpc.strerror(code)
self.assertIsInstance(desc, str) | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_call_method_pipe(self):
server = JsonRpcServer(echo_app)
server.listen(self.pipename(abstract=True))
addr = server.addresses[0]
client = JsonRpcClient()
client.connect(addr)
result = client.call_method('echo', 'foo')
self.assertEqual(result, ['foo'])
... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_call_method_no_args(self):
server = JsonRpcServer(echo_app)
server.listen(('127.0.0.1', 0))
addr = server.addresses[0]
client = JsonRpcClient()
client.connect(addr)
result = client.call_method('echo')
self.assertEqual(result, [])
server.close()
... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_call_method_error(self):
server = JsonRpcServer(echo_app)
server.listen(('127.0.0.1', 0))
addr = server.addresses[0]
client = JsonRpcClient()
client.connect(addr)
exc = self.assertRaises(JsonRpcError, client.call_method, 'echo2')
self.assertIsInstance(exc... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_call_method_ping_pong(self):
server = JsonRpcServer(reflect_app)
server.listen(('127.0.0.1', 0))
addr = server.addresses[0]
client = JsonRpcClient(echo_app)
client.connect(addr)
result = client.call_method('echo', 'foo')
self.assertEqual(result, ['foo'])
... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_send_whitespace(self):
server = JsonRpcServer(echo_app)
server.listen(('127.0.0.1', 0))
addr = server.addresses[0]
client = JsonRpcClient()
client.connect(addr)
exc = None
try:
chunk = b' ' * 1024
while True:
client... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def test_connection_limit(self):
server = JsonRpcServer(echo_app)
server.listen(('127.0.0.1', 0))
addr = server.addresses[0]
server.max_connections = 2
clients = []
exc = None
try:
for i in range(3):
client = JsonRpcClient(timeout=2)
... | geertj/gruvi | [
95,
11,
95,
2,
1355003397
] |
def time_zone(t):
if t.tm_isdst == 1 and time.daylight == 1:
tz_sec = time.altzone
tz_name = time.tzname[1]
else:
tz_sec = time.timezone
tz_name = time.tzname[0]
if tz_sec > 0:
tz_sign = '-'
else:
tz_sign = '+'
tz_offset = '%s%02d%02d' % (tz_sign, ab... | jsubpy/jsub | [
2,
2,
2,
1,
1416218010
] |
def formatTime(self, record, datefmt=None):
ct = time.localtime(record.created)
if datefmt:
s = time.strftime(datefmt, ct)
else:
t = time.strftime('%Y-%m-%d %H:%M:%S', ct)
ms = '%03d' % record.msecs
tz_offset, tz_name = time_zone(ct)
... | jsubpy/jsub | [
2,
2,
2,
1,
1416218010
] |
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {}) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('ExpressRouteCircuitPeering', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list(
self,
resource_group_name: str,
circuit_name: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadat... | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def setUp(self):
self.base = CircleCIException('fake')
self.key = BadKeyError('fake')
self.verb = BadVerbError('fake')
self.filter = InvalidFilterError('fake', 'status')
self.afilter = InvalidFilterError('fake', 'artifacts') | levlaz/circleci.py | [
47,
28,
47,
9,
1508720288
] |
def test_verb_message(self):
self.assertIn('DELETE', self.verb.message) | levlaz/circleci.py | [
47,
28,
47,
9,
1508720288
] |
def __init__(self, *args, **kwargs):
self.modules_cbbox = QtWidgets.QComboBox()
self.outputs_cbbox = QtWidgets.QComboBox()
self.refresh_btn = QtWidgets.QPushButton("Refresh")
self.prebuild_btn = QtWidgets.QPushButton("Prebuild")
super(View, self).__init__(*args, **kwargs) | Sookhaal/auri_maya_rigging_scripts | [
10,
3,
10,
10,
1502370963
] |
def set_model(self):
self.model = Model() | Sookhaal/auri_maya_rigging_scripts | [
10,
3,
10,
10,
1502370963
] |
def setup_ui(self):
self.modules_cbbox.setModel(self.ctrl.modules_with_output)
self.modules_cbbox.currentTextChanged.connect(self.ctrl.on_modules_cbbox_changed)
self.outputs_cbbox.setModel(self.ctrl.outputs_model)
self.outputs_cbbox.currentTextChanged.connect(self.ctrl.on_outputs_cbbox_... | Sookhaal/auri_maya_rigging_scripts | [
10,
3,
10,
10,
1502370963
] |
def __init__(self, model, view):
"""
Args:
model (Model):
view (View):
"""
self.guides_grp = None
self.guide = None
self.guide_name = "None"
RigController.__init__(self, model, view) | Sookhaal/auri_maya_rigging_scripts | [
10,
3,
10,
10,
1502370963
] |
def execute(self):
self.prebuild()
self.delete_existing_objects()
self.connect_to_parent()
cog_shape = rig_lib.large_box_curve("{0}_CTRL_shape".format(self.model.module_name))
cog_ctrl = rig_lib.create_jnttype_ctrl(name="{0}_CTRL".format(self.model.module_name), shape=cog_shape... | Sookhaal/auri_maya_rigging_scripts | [
10,
3,
10,
10,
1502370963
] |
def setUp(self):
"""
Create an instance each time for testing.
"""
self.instance = ListHostsHandler() | RHInception/talook | [
14,
5,
14,
4,
1383311815
] |
def start_response(code, headers):
buffer['code'] = code
buffer['headers'] = headers | RHInception/talook | [
14,
5,
14,
4,
1383311815
] |
def build_list_request(
subscription_id: str,
location: str,
*,
shared_to: Optional[Union[str, "_models.SharedToValues"]] = None,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def build_get_request(
subscription_id: str,
location: str,
gallery_unique_name: str,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def list(
self,
location: str,
shared_to: Optional[Union[str, "_models.SharedToValues"]] = None,
**kwargs: Any | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def prepare_request(next_link=None):
if not next_link: | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
def extract_data(pipeline_response):
deserialized = self._deserialize("SharedGalleryList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, iter(list_of_elem) | Azure/azure-sdk-for-python | [
3526,
2256,
3526,
986,
1335285972
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.