common_id
stringlengths 1
5
| image
stringlengths 15
19
| code
stringlengths 26
239
|
|---|---|---|
9456
|
Train/png/9456.png
|
def command(cmd):
message = create(protobuf.SEND_COMMAND_MESSAGE)
send_command = message.inner()
send_command.command = cmd
return message
|
1531
|
Train/png/1531.png
|
def store_db_obj(cls, in_obj, out_obj):
cls.ip_db_obj['in'] = in_obj
cls.ip_db_obj['out'] = out_obj
|
3171
|
Train/png/3171.png
|
def set_param(self, param, value):
self.data[param] = value
self._object.configuration_data = utils.dict_to_nvlist(self.data)
|
4294
|
Train/png/4294.png
|
def log(self, level, msg=None, *args, **kwargs):
return self._log(level, msg, args, kwargs)
|
8203
|
Train/png/8203.png
|
def geom_wh(geom):
e = geom.GetEnvelope()
h = e[1] - e[0]
w = e[3] - e[2]
return w, h
|
3772
|
Train/png/3772.png
|
def _on_prop_changed(self, instance, meth_name, res, args, kwargs):
Adapter._on_prop_changed(self)
|
7756
|
Train/png/7756.png
|
def scale_dtype(arr, dtype):
max_int = np.iinfo(dtype).max
return (arr * max_int).astype(dtype)
|
8734
|
Train/png/8734.png
|
def adjustHeadingPointer(self):
self.headingText.set_text(str(self.heading))
self.headingText.set_size(self.fontSize)
|
4825
|
Train/png/4825.png
|
def get(self, service_name, **kwargs):
return self._send(requests.get, service_name, **kwargs)
|
5390
|
Train/png/5390.png
|
def contains_point(self, pt):
return (self.l < pt.x and self.r > pt.x and
self.t < pt.y and self.b > pt.y)
|
4821
|
Train/png/4821.png
|
def forward(self, seconds, vx=5):
self.vx = vx
self.sleep(seconds)
self.vx = 0
|
7455
|
Train/png/7455.png
|
def pack(cls, data):
return struct.pack('>ll', len(data) + 4, cls.FRAME_TYPE) + data
|
8150
|
Train/png/8150.png
|
def print_verbose(*args, **kwargs):
if kwargs.pop('verbose', False) is True:
gprint(*args, **kwargs)
|
7667
|
Train/png/7667.png
|
def read_string(self):
length = self._stream.read_var_uint32()
return self._stream.read_string(length)
|
7218
|
Train/png/7218.png
|
def message(self, msg='', level=1, tab=0):
if self.verbosity >= level:
self.stdout.write('{}{}'.format(' ' * tab, msg))
|
7708
|
Train/png/7708.png
|
def gen_mod(src1, src2, dst):
assert src1.size == src2.size
return ReilBuilder.build(ReilMnemonic.MOD, src1, src2, dst)
|
4928
|
Train/png/4928.png
|
def exclude_fields(obj, exclude=EXCLUDE):
return dict([(k, getattr(obj, k)) for k in obj.__slots__ if k not in exclude])
|
9716
|
Train/png/9716.png
|
def get_data(self, url):
return self.json_response(requests.get(url, **self.requests_kwargs))
|
1772
|
Train/png/1772.png
|
def stalled(self, offset=0, count=25):
return self.client('jobs', 'stalled', self.name, offset, count)
|
6623
|
Train/png/6623.png
|
def set_exception(self, exception):
self._exception = exception
self._result_set = True
self._invoke_callbacks(self)
|
8305
|
Train/png/8305.png
|
def tob(data, enc='utf8'):
return data.encode(enc) if isinstance(data, six.text_type) else bytes(data)
|
9673
|
Train/png/9673.png
|
def get_position(self, symbol):
resp = self.get('/positions/{}'.format(symbol))
return Position(resp)
|
2613
|
Train/png/2613.png
|
def us2mc(string):
return re.sub(r'_([a-z])', lambda m: (m.group(1).upper()), string)
|
2070
|
Train/png/2070.png
|
def reference_doi(self, index):
return self.reference_data(index).get("DOI", self.reference_extra_field("DOI", index))
|
727
|
Train/png/727.png
|
def set_genre(self, genre):
self._set_attr(TCON(encoding=3, text=str(genre)))
|
8169
|
Train/png/8169.png
|
def ratio(self):
return 2.0 * self.matches() / (len(self.seq1) + len(self.seq2))
|
1076
|
Train/png/1076.png
|
def action(self, relationship):
action_obj = FileAction(self.xid, relationship)
self._children.append(action_obj)
|
886
|
Train/png/886.png
|
def start_scan(self, active):
self._command_task.sync_command(['_start_scan', active])
self.scanning = True
|
8891
|
Train/png/8891.png
|
def cli(env, zone):
manager = SoftLayer.DNSManager(env.client)
manager.create_zone(zone)
|
8405
|
Train/png/8405.png
|
def downcaseTokens(s, l, t):
return [tt.lower() for tt in map(_ustr, t)]
|
8453
|
Train/png/8453.png
|
def get_index_node(self, idx):
idx = self.node_index.index(idx)
return self.nodes[idx]
|
4453
|
Train/png/4453.png
|
def remove_media(files):
for filename in files:
os.remove(os.path.join(settings.MEDIA_ROOT, filename))
|
1800
|
Train/png/1800.png
|
def load_wc(cls, stream):
wc = wcxf.WC.load(stream)
return cls.from_wc(wc)
|
3098
|
Train/png/3098.png
|
def topfnfile(self, fileobj):
for entry in self:
print >>fileobj, entry.path
fileobj.close()
|
1500
|
Train/png/1500.png
|
def pairwise_indices(self):
return np.array([sig.pairwise_indices for sig in self.values]).T
|
991
|
Train/png/991.png
|
def set_suffix(self):
self.suffix = self.w.suffix.get_text()
self.logger.debug('Output suffix set to {0}'.format(self.suffix))
|
441
|
Train/png/441.png
|
def seek_to_frame(self, index):
pointer_position = self.frame_positions[index]
self.blob_file.seek(pointer_position, 0)
|
9198
|
Train/png/9198.png
|
def noise_set_type(n: tcod.noise.Noise, typ: int) -> None:
n.algorithm = typ
|
6742
|
Train/png/6742.png
|
def set_sorting(self, flag):
self.sorting['status'] = flag
self.header().setSectionsClickable(flag == ON)
|
2572
|
Train/png/2572.png
|
def value(self):
if self._wrapped is not self.Null:
return self._wrapped
else:
return self.obj
|
5127
|
Train/png/5127.png
|
def destroy(self):
if self.widget:
self.set_active(False)
super(AndroidBarcodeView, self).destroy()
|
871
|
Train/png/871.png
|
def stop_workers_async(self):
self._started = False
for worker in self._workers:
worker.signal_stop()
|
1584
|
Train/png/1584.png
|
def close(self):
if self._is_open:
self._is_open = False
hidapi.hid_close(self._device)
|
1020
|
Train/png/1020.png
|
def append(self, entry):
if not self.is_appendable(entry):
raise ValueError('entry not appendable')
self.data += entry.data
|
5203
|
Train/png/5203.png
|
def _mark_updated(self):
timestamp = datetime.datetime.utcnow().isoformat()
DB.set_hash_value(self.key, 'updated', timestamp)
|
9405
|
Train/png/9405.png
|
def lstm_cell(hidden_size):
return tf.contrib.rnn.LSTMCell(
hidden_size, use_peepholes=True, state_is_tuple=True)
|
7502
|
Train/png/7502.png
|
def create_random_ind_full(self, depth=0):
"Random individual using full method"
lst = []
self._create_random_ind_full(depth=depth, output=lst)
return lst
|
814
|
Train/png/814.png
|
def delete_order(self, order_id):
request = self._delete("transactions/orders/" + str(order_id))
return self.responder(request)
|
1674
|
Train/png/1674.png
|
def yesno(prompt):
prompt += " [y/n]"
a = ""
while a not in ["y", "n"]:
a = input(prompt).lower()
return a == "y"
|
513
|
Train/png/513.png
|
def delete(context, sequence):
uri = '%s/%s/%s' % (context.dci_cs_api, RESOURCE, sequence)
return context.session.delete(uri)
|
3760
|
Train/png/3760.png
|
def connectionMade(self):
self._buffer = b''
self._queue = {}
self._stopped = None
self._tag = 0
|
1683
|
Train/png/1683.png
|
def advpng(ext_args):
args = _ADVPNG_ARGS + [ext_args.new_filename]
extern.run_ext(args)
return _PNG_FORMAT
|
8615
|
Train/png/8615.png
|
def move_backward(self, seconds=None):
self._move(speed=-SPEED_MAX, steering=0, seconds=seconds)
|
1257
|
Train/png/1257.png
|
def set_cookie(self, cookie=None):
if cookie:
self._cookie = cookie.encode()
else:
self._cookie = None
|
3913
|
Train/png/3913.png
|
def basename(self, suffix=''):
return os.path.basename(self._file, suffix) if self._file else None
|
5748
|
Train/png/5748.png
|
def addCmdClass(self, ctor, **opts):
item = ctor(self, **opts)
name = item.getCmdName()
self.cmds[name] = item
|
2877
|
Train/png/2877.png
|
def write(self):
if self.dirty:
with open(self._cache_path, "w") as output_file:
self._config.write(output_file)
|
3273
|
Train/png/3273.png
|
def resample(self, N):
return rand.random(size=N)*(self.maxval - self.minval) + self.minval
|
4361
|
Train/png/4361.png
|
def mkchange(text0, text1, version, mtime):
"return a Change diffing the two strings"
return Change(version, mtime, ucrc(text1), diff.word_diff(text0, text1))
|
5575
|
Train/png/5575.png
|
def as_status(cls, obj):
if obj is None:
return None
return obj if isinstance(obj, cls) else cls.from_string(obj)
|
8522
|
Train/png/8522.png
|
def Reset(self):
self._displayed = 0
self._currentpagelines = 0
self._lastscroll = 1
self._lines_to_show = self._cli_lines
|
8413
|
Train/png/8413.png
|
def apply(self, snapshot):
for name in snapshot:
setattr(self, name, snapshot[name])
|
5967
|
Train/png/5967.png
|
def save(self, fname: str):
mx.nd.save(fname, self.source + self.target + self.label)
|
706
|
Train/png/706.png
|
def main(search, query):
url = search.search(query)
print(url)
search.open_page(url)
|
4367
|
Train/png/4367.png
|
def debug(self, *args) -> "Err":
error = self._create_err("debug", *args)
print(self._errmsg(error))
return error
|
862
|
Train/png/862.png
|
def rsl_count_readings(self):
storage, output = self.sensor_log.count()
return [Error.NO_ERROR, storage, output]
|
8483
|
Train/png/8483.png
|
def dnld_gaf(species_txt, prt=sys.stdout, loading_bar=True):
return dnld_gafs([species_txt], prt, loading_bar)[0]
|
4094
|
Train/png/4094.png
|
def brightness(sequence_number, brightness):
return MessageWriter().string("brightness").uint64(sequence_number).uint8(int(brightness*255)).get()
|
8136
|
Train/png/8136.png
|
def df_all(self, phot):
df = pd.concat([self.to_df(f) for f in self.get_filenames(phot)])
return df
|
4711
|
Train/png/4711.png
|
def dumps(self):
with closing(StringIO()) as fileobj:
self.dump(fileobj)
return fileobj.getvalue()
|
1778
|
Train/png/1778.png
|
def id(self) -> typing.Union[str, None]:
return self._project.id if self._project else None
|
6212
|
Train/png/6212.png
|
def visibleRows(self): # onscreen rows
'List of rows onscreen. '
return self.rows[self.topRowIndex:self.topRowIndex+self.nVisibleRows]
|
2229
|
Train/png/2229.png
|
def extract_entity(found):
obj = dict()
for prop in found.entity.property:
obj[prop.name] = prop.value.string_value
return obj
|
7680
|
Train/png/7680.png
|
def add(self, word):
if not word or word.strip() == '':
return
self.words[word] = word
|
3498
|
Train/png/3498.png
|
def create_alias(self, userid, data):
return self.api_call(
ENDPOINTS['aliases']['new'],
dict(userid=userid),
body=data)
|
2786
|
Train/png/2786.png
|
def _handle_tag_removeobject2(self):
obj = _make_object("RemoveObject2")
obj.Depth = unpack_ui16(self._src)
return obj
|
9831
|
Train/png/9831.png
|
def closest(xarr, val):
idx_closest = np.argmin(np.abs(np.array(xarr) - val))
return idx_closest
|
3193
|
Train/png/3193.png
|
def do_mkdir(self, path):
path = path[0]
self.n.makeDirectory(self.current_path + path)
self.dirs = self.dir_complete()
|
8076
|
Train/png/8076.png
|
def move_to(self, xpos, ypos):
self.stream.write(self.move(ypos, xpos))
|
4151
|
Train/png/4151.png
|
def hash_producer(*args, **kwargs):
return hashlib.md5(six.text_type(uuid.uuid4()).encode('utf-8')).hexdigest()
|
5826
|
Train/png/5826.png
|
def setpos(self, location, text):
self.location = location
self.text = text
|
1940
|
Train/png/1940.png
|
def git_hash(blob):
head = str("blob " + str(len(blob)) + "\0").encode("utf-8")
return sha1(head + blob).hexdigest()
|
8202
|
Train/png/8202.png
|
def get_ds_srs(ds):
ds_srs = osr.SpatialReference()
ds_srs.ImportFromWkt(ds.GetProjectionRef())
return ds_srs
|
3686
|
Train/png/3686.png
|
def terminate(self, reason=None):
self.logger.info('terminating')
self.loop.unloop(pyev.EVUNLOOP_ALL)
|
6171
|
Train/png/6171.png
|
def get_rlbot_directory() -> str:
return os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
7593
|
Train/png/7593.png
|
def remove_loghandler(handler):
logging.getLogger(LOG_ROOT).removeHandler(handler)
logging.getLogger().removeHandler(handler)
|
1388
|
Train/png/1388.png
|
def from_srt(cls, file):
parser = SRTParser().read(file)
return cls(file=file, captions=parser.captions)
|
5418
|
Train/png/5418.png
|
def hashable(data, v):
try:
data[v]
except (TypeError, KeyError, IndexError):
return False
return True
|
9246
|
Train/png/9246.png
|
def seen_tasks(self):
print('\n'.join(self._stub.seen_tasks(clearly_pb2.Empty()).task_types))
|
4594
|
Train/png/4594.png
|
def state(anon, obj, field, val):
return anon.faker.state(field=field)
|
7178
|
Train/png/7178.png
|
def rehash(self, password):
self.hash = self._new(password, self.desired_rounds)
self.rounds = self.desired_rounds
|
2479
|
Train/png/2479.png
|
def nlmsg_seq(self, value):
self.bytearray[self._get_slicers(3)] = bytearray(c_uint32(value or 0))
|
1635
|
Train/png/1635.png
|
def as_length(self, value):
new_vec = self.copy()
new_vec.length = value
return new_vec
|
4114
|
Train/png/4114.png
|
def connect(self):
self.client = redis.Redis(
host=self.host, port=self.port, password=self.password)
|
912
|
Train/png/912.png
|
def Output(self):
self.Open()
self.Header()
self.Body()
self.Footer()
|
356
|
Train/png/356.png
|
def _sorted_keys_items(dobj):
keys = sorted(dobj.keys())
for key in keys:
yield key, dobj[key]
|
6038
|
Train/png/6038.png
|
def is_executable(path):
return os.path.isfile(path) and os.access(path, os.X_OK)
|
8737
|
Train/png/8737.png
|
def set_center(self, lat, lon):
self.object_queue.put(SlipCenter((lat, lon)))
|
8654
|
Train/png/8654.png
|
def tas2mach(Vtas, H):
a = vsound(H)
Mach = Vtas/a
return Mach
|
1394
|
Train/png/1394.png
|
def get_mbid(self):
doc = self._request(self.ws_prefix + ".getInfo", True)
return _extract(doc, "mbid")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.