common_id stringlengths 1 5 | image stringlengths 15 19 | code stringlengths 26 239 |
|---|---|---|
167 | Train/png/167.png | def UndoTransaction(self):
from Ucs import ConfigMap
self._transactionInProgress = False
self._configMap = ConfigMap()
|
73 | Train/png/73.png | def addnot(self, action=None, subject=None, **conditions):
self.add_rule(Rule(False, action, subject, **conditions))
|
1876 | Train/png/1876.png | def getCursor(self):
if self.connection is None:
self.Connect()
return self.connection.cursor(MySQLdb.cursors.DictCursor)
|
6674 | Train/png/6674.png | def silence(self):
sys.stdout = open(os.devnull, 'w')
sys.stderr = open(os.devnull, 'w')
|
1023 | Train/png/1023.png | def punct(self, text):
cls = self.PUNCTUATION[text]
self.push_token(cls(text, self.lineno, self.offset))
|
6310 | Train/png/6310.png | def done(self):
return [mm.name for mm in self.model.select().order_by(self.model.id)]
|
1392 | Train/png/1392.png | def md5(text):
h = hashlib.md5()
h.update(_unicode(text).encode("utf-8"))
return h.hexdigest()
|
9794 | Train/png/9794.png | def propagateClk(obj):
clk = obj.clk
for u in obj._units:
_tryConnect(clk, u, 'clk')
|
1942 | Train/png/1942.png | def reader(stream):
for line in stream:
item = Item()
item.json = line
yield item
|
4293 | Train/png/4293.png | def info(self, msg=None, *args, **kwargs):
return self._log(logging.INFO, msg, args, kwargs)
|
8030 | Train/png/8030.png | def delete_char(event):
" Delete character before the cursor. "
deleted = event.current_buffer.delete(count=event.arg)
if not deleted:
event.cli.output.bell()
|
6004 | Train/png/6004.png | def add_child(self, obj):
self.children.append(obj)
obj.parents.append(self)
|
1391 | Train/png/1391.png | def debug(version=False):
if version:
print(__version__)
return
print(json.dumps(MANAGE_DICT, indent=2))
|
1065 | Train/png/1065.png | def deactivate(self):
self.rubber_band.reset(QgsWkbTypes.PolygonGeometry)
QgsMapTool.deactivate(self)
self.deactivated.emit()
|
4842 | Train/png/4842.png | def get_header(self, name, default=None):
return self._handler.headers.get(name, default)
|
4348 | Train/png/4348.png | def wherenotin(self, fieldname, value):
return self.wherein(fieldname, value, negate=True)
|
8633 | Train/png/8633.png | def _open_ftp(self):
# type: () -> FTP
ftp = self.fs._open_ftp()
ftp.voidcmd(str("TYPE I"))
return ftp
|
772 | Train/png/772.png | def print_statements(self):
for i, stmt in enumerate(self.statements):
print("%s: %s" % (i, stmt))
|
2259 | Train/png/2259.png | def chunks(cls, iterable, n, fill=None):
return cls(itertools.zip_longest(*[iter(iterable)] * n, fillvalue=fill))
|
8491 | Train/png/8491.png | def isEmpty(self):
return self.x0 == self.x1 or self.y0 == self.y1
|
8925 | Train/png/8925.png | def name(self):
return str(conf.lib.clang_getCString(conf.lib.clang_getFileName(self)))
|
5083 | Train/png/5083.png | def _on_client_name_changed(self, data):
self._clients.get(data.get('id')).update_name(data)
|
6119 | Train/png/6119.png | def unregister_transform(self, node_class, transform, predicate=None):
self.transforms[node_class].remove((transform, predicate))
|
806 | Train/png/806.png | def get_code(node, coder=Coder()):
return cgi.escape(str(coder.code(node)), quote=True)
|
6672 | Train/png/6672.png | def PrintIndented(self, file, ident, code):
for entry in code:
print >>file, '%s%s' % (ident, entry)
|
2135 | Train/png/2135.png | def safe(self, x):
x[np.isinf(x)] = 1
x[np.isnan(x)] = 1
return x
|
3598 | Train/png/3598.png | def guesser(types=GUESS_TYPES, strict=False):
return TypeGuesser(types=types, strict=strict)
|
8595 | Train/png/8595.png | def _crc32(self, ch, crc):
return ((crc >> 8) & 0xffffff) ^ self.crctable[(crc ^ ord(ch)) & 0xff]
|
1649 | Train/png/1649.png | def get_remove_security_group_commands(self, sg_id, profile):
return self._get_interface_commands(sg_id, profile, delete=True)
|
2343 | Train/png/2343.png | def file_lines(bblfile: str) -> iter:
with open(bblfile) as fd:
yield from (line.rstrip() for line in fd if line.rstrip())
|
5598 | Train/png/5598.png | def any2mb(s):
if is_string(s):
return int(Memory.from_string(s).to("Mb"))
else:
return int(s)
|
6698 | Train/png/6698.png | def _column_resized(self, col, old_width, new_width):
self.dataTable.setColumnWidth(col, new_width)
self._update_layout()
|
657 | Train/png/657.png | def theme(self, text):
return self.theme_color + self.BRIGHT + text + self.RESET
|
4987 | Train/png/4987.png | def get(self, key, subcommand="config:get"):
cmd = ["heroku", subcommand, key, "--app", self.name]
return self._result(cmd)
|
5328 | Train/png/5328.png | def _remove(self, obj):
for idx, item in enumerate(self._queue):
if item == obj:
del self._queue[idx]
break
|
9270 | Train/png/9270.png | def start_blocking(self):
self._cav_started.clear()
self.start()
self._cav_started.wait()
|
8362 | Train/png/8362.png | def EncodeForCSV(x):
"Encodes one value for CSV."
k = x.encode('utf-8')
if ',' in k or '"' in k:
return '"%s"' % k.replace('"', '""')
else:
return k
|
9025 | Train/png/9025.png | def created_on(self):
timestamp = self._info.get('creationTime')
return _parser.Parser.parse_timestamp(timestamp)
|
3613 | Train/png/3613.png | def _validate_series_dtype(self, series: pd.Series) -> pd.Series:
return series.apply(lambda i: isinstance(i, self.dtype))
|
3200 | Train/png/3200.png | def right_to_left(self):
self._entry_mode &= ~Command.MODE_INCREMENT
self.command(self._entry_mode)
|
8045 | Train/png/8045.png | def set_blocked(self, name):
self.unregister(name=name)
self._name2plugin[name] = None
|
8533 | Train/png/8533.png | def addFilter(self, filterclass):
if filterclass not in self.filters:
self.filters.append(filterclass)
|
7608 | Train/png/7608.png | def get_args(self, kwargs):
args = dict(self.LoggerArgs)
args.update(kwargs)
return args
|
5318 | Train/png/5318.png | def base64_bytes(x):
if six.PY2:
return base64.decodestring(x)
return base64.decodebytes(bytes_encode(x))
|
2663 | Train/png/2663.png | def native_conn(self):
if self.__native is None:
self.__native = self._get_connection()
return self.__native
|
1173 | Train/png/1173.png | def add_line(self, line, source, *lineno):
self.result.append(line, source, *lineno)
|
8913 | Train/png/8913.png | def n_neurites(neurites, neurite_type=NeuriteType.all):
return sum(1 for _ in iter_neurites(neurites, filt=is_type(neurite_type)))
|
9401 | Train/png/9401.png | def get_agent(self, agent_id):
url = 'agents/%s' % agent_id
return Agent(**self._api._get(url))
|
3268 | Train/png/3268.png | def echo_vacation_rc():
contents = rc.read()
print('.vacationrc\n===========')
for line in contents:
print(line.rstrip())
|
5854 | Train/png/5854.png | def bitop_xor(self, dest, key, *keys):
return self.execute(b'BITOP', b'XOR', dest, key, *keys)
|
557 | Train/png/557.png | def load_private_key(self, priv_key):
with open(priv_key) as fd:
self._private_key = paramiko.RSAKey.from_private_key(fd)
|
92 | Train/png/92.png | def variablename(var):
s = [tpl[0] for tpl in itertools.ifilter(
lambda x: var is x[1], globals().items())]
s = s[0].upper()
return s
|
6680 | Train/png/6680.png | def _color(self, msg, color):
kwargs = {'fg': color}
return click.style(msg, **kwargs) if self.colorize else msg
|
4766 | Train/png/4766.png | def clean(self):
return Text(self.__text_cleaner.clean(self[TEXT]), **self.__kwargs)
|
3965 | Train/png/3965.png | def enable() -> None:
if not isinstance(sys.stdout, DebugPrint):
sys.stdout = DebugPrint(sys.stdout)
|
4420 | Train/png/4420.png | def num_columns(self):
if self.term.is_a_tty:
return self.term.width // self.hint_width
return 1
|
9312 | Train/png/9312.png | def _home_del(self):
text = self.edit_text[self.edit_pos:]
self.set_edit_text(text)
self._home()
|
5590 | Train/png/5590.png | def can_execute(self):
return not self._disabled and all(dep.status == dep.node.S_OK for dep in self.deps)
|
5274 | Train/png/5274.png | def unmount(self, path):
del self._mountpoints[self._join_chunks(self._normalize_path(path))]
|
9829 | Train/png/9829.png | def api_genes():
query = request.args.get('query')
json_out = controllers.genes_to_json(store, query)
return jsonify(json_out)
|
8020 | Train/png/8020.png | def add_reader(self, fd, callback):
" Add read file descriptor to the event loop. "
fd = fd_to_int(fd)
self._read_fds[fd] = callback
self.selector.register(fd)
|
1587 | Train/png/1587.png | def _tile_image(self, data):
image = Image.open(BytesIO(data))
return image.convert('RGBA')
|
1651 | Train/png/1651.png | def calc_mean(c0, c1=[]):
if c1 != []:
return (numpy.mean(c0, 0) + numpy.mean(c1, 0)) / 2.
else:
return numpy.mean(c0, 0)
|
9721 | Train/png/9721.png | def _str_to_list(s):
_list = s.split(",")
return list(map(lambda i: i.lstrip(), _list))
|
2865 | Train/png/2865.png | def get_lang_array(self):
r = self.yandex_translate_request("getLangs", "")
self.handle_errors(r)
return r.json()["dirs"]
|
952 | Train/png/952.png | def remove_property(self, prop):
self._properties.remove(prop)
self._pairs.difference_update((o, prop) for o in self._objects)
|
8957 | Train/png/8957.png | def ruleName(self):
return _('%s at %s' % (self.room.name, self.room.location.name))
|
5400 | Train/png/5400.png | def findfirst(f, coll):
result = list(dropwhile(f, coll))
return result[0] if result else None
|
7807 | Train/png/7807.png | def get_number(s, cast=int):
import string
d = "".join(x for x in str(s) if x in string.digits)
return cast(d)
|
2984 | Train/png/2984.png | def sync_objects_in(self):
self.dstate = self.STATES.BUILDING
self.build_source_files.record_to_objects()
|
4660 | Train/png/4660.png | def close(self):
if self.is_worker():
return
for worker in self.workers:
self.comm.send(None, worker, 0)
|
9605 | Train/png/9605.png | def as_numpy_dtype(dtype):
dtype = tf.as_dtype(dtype)
if hasattr(dtype, 'as_numpy_dtype'):
return dtype.as_numpy_dtype
return dtype
|
763 | Train/png/763.png | def _clean(cls, value, invalid):
cls._deprecation_warning()
return BlockUsageLocator._clean(value, invalid)
|
8320 | Train/png/8320.png | def scale_axes_dialog(self, show=True):
return ScaleAxesDialog(self.app_window, self, show=show)
|
7724 | Train/png/7724.png | def remove_lock(self):
key = '%s_lock' % self.scheduler_key
if self._lock_acquired:
self.connection.delete(key)
|
6200 | Train/png/6200.png | def right(self):
if self._has_real():
return self._data.real_right
return self._data.right
|
4457 | Train/png/4457.png | def flow_ramp(self):
return np.linspace(1 / self.n_rows, 1, self.n_rows)*self.q
|
7433 | Train/png/7433.png | def _cpu(self):
value = int(psutil.cpu_percent())
set_metric("cpu", value, category=self.category)
gauge("cpu", value)
|
9715 | Train/png/9715.png | def _reqs(self, tag):
return [
(tag, i) for i in
self.client.get_pulls(*tag.split('/'))
]
|
2978 | Train/png/2978.png | def promote(self, name):
return PartitionName(**dict(list(name.dict.items()) + list(self.dict.items())))
|
5344 | Train/png/5344.png | def path_join(*args):
'Joins ShellQuoted and raw pieces of paths to make a shell-quoted path'
return ShellQuoted(os.path.join(*[
raw_shell(shell_quote(s)) for s in args
]))
|
6223 | Train/png/6223.png | def logout(self):
self._master_token = None
self._auth_token = None
self._email = None
self._android_id = None
|
1369 | Train/png/1369.png | def set_executable(filename):
st = os.stat(filename)
os.chmod(filename, st.st_mode | stat.S_IEXEC)
|
6423 | Train/png/6423.png | def on_train_begin(self, **kwargs: Any) -> None:
"Initializes the best value."
self.best = float('inf') if self.operator == np.less else -float('inf')
|
1785 | Train/png/1785.png | def signals(self, signals=('QUIT', 'USR1', 'USR2')):
for sig in signals:
signal.signal(getattr(signal, 'SIG' + sig), self.handler)
|
6724 | Train/png/6724.png | def value_to_position(self, y):
vsb = self.editor.verticalScrollBar()
return (y-vsb.minimum())*self.get_scale_factor()+self.offset
|
5738 | Train/png/5738.png | def turn_left():
motors.left_motor(150) # spin CCW
motors.right_motor(150) # spin CCW
board.sleep(0.5)
motors.brake()
board.sleep(0.1)
|
9028 | Train/png/9028.png | def _render_list(data):
return IPython.core.display.HTML(google.datalab.utils.commands.HtmlBuilder.render_list(data))
|
46 | Train/png/46.png | def lock(self):
if isinstance(self._session, manager.Manager):
self._session.lock()
|
8542 | Train/png/8542.png | def paddedInt(i):
i_str = str(i)
pad = PAD_LEN - len(i_str)
return (pad * "0") + i_str
|
3356 | Train/png/3356.png | def delete(self):
response = self.session.request("delete:Message", [self.message_id])
self.data = response
return self
|
8943 | Train/png/8943.png | def invert(interval):
interval.reverse()
res = list(interval)
interval.reverse()
return res
|
9973 | Train/png/9973.png | def compilers(self):
return [self.environment.compilers.get(e) for e in self.compiler_extensions]
|
2782 | Train/png/2782.png | def rollback(self):
with self.native(writeAccess=True) as conn:
return self._rollback(conn)
|
6858 | Train/png/6858.png | def set_window_urgency(self, window, urgency):
_libxdo.xdo_set_window_urgency(self._xdo, window, urgency)
|
955 | Train/png/955.png | def validlines(self):
return [ln for ln in self.lines() if (not ln.isBroken() and not ln.ignoreMe)]
|
5099 | Train/png/5099.png | def draw_graph(G: nx.DiGraph, filename: str):
A = to_agraph(G)
A.graph_attr["rankdir"] = "LR"
A.draw(filename, prog="dot")
|
5182 | Train/png/5182.png | def as_minimized(values: List[float], maximized: List[bool]) -> List[float]:
return [v * -1. if m else v for v, m in zip(values, maximized)]
|
4475 | Train/png/4475.png | def StreamWrite(stream, *obj):
stream.Write(base64.encodestring(pickle.dumps(obj)))
|
2906 | Train/png/2906.png | def assignment(self, node, children):
'assignment = lvalue "=" expr'
lvalue, _, expr = children
self.env[lvalue] = expr
return expr
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.