code stringlengths 12 2.05k | label_name stringclasses 5
values | label int64 0 4 |
|---|---|---|
def from_data(*, data: oai.Operation, path: str, method: str, tag: str) -> Union[Endpoint, ParseError]:
""" Construct an endpoint from the OpenAPI data """
if data.operationId is None:
return ParseError(data=data, detail="Path operations with operationId are not yet supported")
... | Base | 1 |
def test_can_read_token_from_query_parameters(self):
"""Tests that Sydent correct extracts an auth token from query parameters"""
self.sydent.run()
request, _ = make_request(
self.sydent.reactor, "GET",
"/_matrix/identity/v2/hash_details?access_token=" + self.test_to... | Class | 2 |
def edit_book_series_index(series_index, book):
# Add default series_index to book
modif_date = False
series_index = series_index or '1'
if not series_index.replace('.', '', 1).isdigit():
flash(_("%(seriesindex)s is not a valid number, skipping", seriesindex=series_index), category="warning")
... | Base | 1 |
def _dump(self, file=None, format=None):
import tempfile
if not file:
file = tempfile.mktemp()
self.load()
if not format or format == "PPM":
self.im.save_ppm(file)
else:
file = file + "." + format
self.save(file, format)
... | Base | 1 |
def check_xsrf_cookie(self):
"""Verifies that the ``_xsrf`` cookie matches the ``_xsrf`` argument.
To prevent cross-site request forgery, we set an ``_xsrf``
cookie and include the same value as a non-cookie
field with all ``POST`` requests. If the two do not match, we
rejec... | Base | 1 |
def test_notfilelike_nocl_http11(self):
to_send = "GET /notfilelike_nocl HTTP/1.1\n\n"
to_send = tobytes(to_send)
self.connect()
self.sock.send(to_send)
fp = self.sock.makefile("rb", 0)
line, headers, response_body = read_http(fp)
self.assertline(line, "200"... | Base | 1 |
def test_confirmation_key_of_wrong_type(self) -> None:
email = self.nonreg_email("alice")
realm = get_realm("zulip")
inviter = self.example_user("iago")
prereg_user = PreregistrationUser.objects.create(
email=email, referred_by=inviter, realm=realm
)
url =... | Base | 1 |
def vote(request, pk):
# TODO: check if user has access to this topic/poll
poll = get_object_or_404(
CommentPoll.objects.unremoved(),
pk=pk
)
if not request.user.is_authenticated:
return redirect_to_login(next=poll.get_absolute_url())
form = PollVoteManyForm(user=request.us... | Base | 1 |
def connectionMade(self):
method = getattr(self.factory, 'method', b'GET')
self.sendCommand(method, self.factory.path)
if self.factory.scheme == b'http' and self.factory.port != 80:
host = self.factory.host + b':' + intToBytes(self.factory.port)
elif self.factory.scheme =... | Class | 2 |
def edit_book_comments(comments, book):
modif_date = False
if len(book.comments):
if book.comments[0].text != comments:
book.comments[0].text = comments
modif_date = True
else:
if comments:
book.comments.append(db.Comments(text=comments, book=book.id))
... | Base | 1 |
def formatType(self):
format_type = self.type.lower()
if format_type == 'amazon':
return u"Amazon"
elif format_type.startswith("amazon_"):
return u"Amazon.{0}".format(format_type[7:])
elif format_type == "isbn":
return u"ISBN"
elif format_t... | Base | 1 |
def _wsse_username_token(cnonce, iso_now, password):
return base64.b64encode(
_sha("%s%s%s" % (cnonce, iso_now, password)).digest()
).strip() | Class | 2 |
inline void AveragePool(const float* input_data, const Dims<4>& input_dims,
int stride_width, int stride_height, int pad_width,
int pad_height, int kwidth, int kheight,
float output_activation_min,
float output_activation_ma... | Base | 1 |
def del_version(request, client_id, project, version):
if request.method == 'GET':
client = Client.objects.get(id=client_id)
try:
scrapyd = get_scrapyd(client)
result = scrapyd.delete_version(project=project, version=version)
return JsonResponse(result)
ex... | Base | 1 |
def test_unicode_encode_error(self, mocker):
url = QUrl('file:///tmp/foo')
req = QNetworkRequest(url)
err = UnicodeEncodeError('ascii', '', 0, 2, 'foo')
mocker.patch('os.path.isdir', side_effect=err)
reply = filescheme.handler(req)
assert reply is None | Compound | 4 |
def test_visitor(self):
class CustomVisitor(self.asdl.VisitorBase):
def __init__(self):
super().__init__()
self.names_with_seq = []
def visitModule(self, mod):
for dfn in mod.dfns:
self.visit(dfn)
def v... | Base | 1 |
async def customize_global(self, ctx, command: str.lower, *, response: str = None):
"""
Globally customize the response to an action.
You can use {0} or {user} to dynamically replace with the specified target of the action.
Formats like {0.name} or {0.mention} can also be used.... | Base | 1 |
def make_homeserver(self, reactor, clock):
# we mock out the keyring so as to skip the authentication check on the
# federation API call.
mock_keyring = Mock(spec=["verify_json_for_server"])
mock_keyring.verify_json_for_server.return_value = defer.succeed(True)
# we mock out... | Base | 1 |
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
result = super(TagFormWidget, self).create_option(
name=name, value=value, label=label, selected=selected,
index=index, subindex=subindex, attrs=attrs
)
result['attrs']['data-col... | Base | 1 |
def make_sydent(test_config={}):
"""Create a new sydent
Args:
test_config (dict): any configuration variables for overriding the default sydent
config
"""
# Use an in-memory SQLite database. Note that the database isn't cleaned up between
# tests, so by default the same database... | Class | 2 |
def table_get_locale():
locale = babel.list_translations() + [LC('en')]
ret = list()
current_locale = get_locale()
for loc in locale:
ret.append({'value': str(loc), 'text': loc.get_language_name(current_locale)})
return json.dumps(ret) | Base | 1 |
def post(self, request, *args, **kwargs): # doccov: ignore
command = request.POST.get("command")
if command:
dispatcher = getattr(self, "dispatch_%s" % command, None)
if not callable(dispatcher):
raise Problem(_("Unknown command: `%s`.") % command)
... | Base | 1 |
def __init__(self, protocol='http', hostname='localhost', port='8080',
subsystem=None, accept='application/json',
trust_env=None, verify=False): | Base | 1 |
def auth_username_ci(self):
return self.appbuilder.get_app.config.get("AUTH_USERNAME_CI", True) | Class | 2 |
def testFlushFunction(self):
logdir = self.get_temp_dir()
with context.eager_mode():
writer = summary_ops.create_file_writer_v2(
logdir, max_queue=999999, flush_millis=999999)
with writer.as_default():
get_total = lambda: len(events_from_logdir(logdir))
# Note: First tf.c... | Class | 2 |
def test_challenge_with_vhm(self):
rc, root, folder, object = self._makeTree()
response = FauxCookieResponse()
vhm = 'http://localhost/VirtualHostBase/http/test/VirtualHostRoot/xxx'
actualURL = 'http://test/xxx'
request = FauxRequest(RESPONSE=response, URL=vhm,
... | Base | 1 |
def _deny_hook(self, resource=None):
app = self.get_app()
if current_user.is_authenticated():
status = 403
else:
status = 401
#abort(status)
if app.config.get('FRONTED_BY_NGINX'):
url = "https://{}:{}{}".format(app.config.get('FQDN'), ... | Base | 1 |
def test_invalid_sum(self):
pos = dict(lineno=2, col_offset=3)
m = ast.Module([ast.Expr(ast.expr(**pos), **pos)])
with self.assertRaises(TypeError) as cm:
compile(m, "<test>", "exec")
self.assertIn("but got <_ast.expr", str(cm.exception)) | Base | 1 |
def rescore_entrance_exam(request, course_id):
"""
Starts a background process a students attempts counter for entrance exam.
Optionally deletes student state for a problem. Limited to instructor access.
Takes either of the following query parameters
- unique_student_identifier is an email or u... | Compound | 4 |
def category_list():
if current_user.check_visibility(constants.SIDEBAR_CATEGORY):
if current_user.get_view_property('category', 'dir') == 'desc':
order = db.Tags.name.desc()
order_no = 0
else:
order = db.Tags.name.asc()
order_no = 1
entries = ... | Base | 1 |
def test_modify_access_bad_action(self):
""" Test with an invalid action parameter. """
url = reverse('modify_access', kwargs={'course_id': self.course.id.to_deprecated_string()})
response = self.client.get(url, {
'unique_student_identifier': self.other_staff.email,
'... | Compound | 4 |
def __new__(cls, sourceName: str):
"""Dispatches to the right subclass."""
if cls != InputSource:
# Only take control of calls to InputSource(...) itself.
return super().__new__(cls)
if sourceName == "-":
return StdinInputSource(sourceName)
if sou... | Base | 1 |
def test_notfilelike_shortcl_http11(self):
to_send = "GET /notfilelike_shortcl HTTP/1.1\n\n"
to_send = tobytes(to_send)
self.connect()
for t in range(0, 2):
self.sock.send(to_send)
fp = self.sock.makefile("rb", 0)
line, headers, response_body = r... | Base | 1 |
def get_search_results(self, term, offset=None, order=None, limit=None, allow_show_archived=False,
config_read_column=False, *join): | Base | 1 |
def test_large_body(self):
# 1024 characters.
body = "This string has 32 characters.\r\n" * 32
s = tobytes(
"GET / HTTP/1.0\n" "Content-Length: %d\n" "\n" "%s" % (len(body), body)
)
self.connect()
self.sock.send(s)
fp = self.sock.makefile("rb", 0)
... | Base | 1 |
def ratings_list():
if current_user.check_visibility(constants.SIDEBAR_RATING):
if current_user.get_view_property('ratings', 'dir') == 'desc':
order = db.Ratings.rating.desc()
order_no = 0
else:
order = db.Ratings.rating.asc()
order_no = 1
entr... | Base | 1 |
def _get_index_absolute_path(index):
return os.path.join(INDEXDIR, index) | Base | 1 |
def sentences_victim(self, type, data = None, sRun = 1, column = 0):
if sRun == 2:
return self.sql_insert(self.prop_sentences_victim(type, data))
elif sRun == 3:
return self.sql_one_row(self.prop_sentences_victim(type, data), column)
else:
return self.sql_... | Base | 1 |
def _get_mw():
crawler = _get_crawler({})
return SplashMiddleware.from_crawler(crawler) | Class | 2 |
def post(self, request):
totp_secret = pyotp.random_base32()
request.user.totp_secret = totp_secret
request.user.totp_status = TOTPStatus.VERIFYING
request.user.save()
add_2fa.send(sender=self.__class__, user=request.user)
return FormattedResponse({"totp_secret": totp... | Class | 2 |
def rescore_problem(request, course_id):
"""
Starts a background process a students attempts counter. Optionally deletes student state for a problem.
Limited to instructor access.
Takes either of the following query paremeters
- problem_to_reset is a urlname of a problem
- unique_studen... | Compound | 4 |
def check_valid_read_column(column):
if column != "0":
if not calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.id == column) \
.filter(and_(db.Custom_Columns.datatype == 'bool', db.Custom_Columns.mark_for_delete == 0)).all():
return False
return True | Base | 1 |
def table_get_locale():
locale = babel.list_translations() + [LC('en')]
ret = list()
current_locale = get_locale()
for loc in locale:
ret.append({'value': str(loc), 'text': loc.get_language_name(current_locale)})
return json.dumps(ret) | Base | 1 |
def test_request_body_too_large_with_wrong_cl_http11(self):
body = "a" * self.toobig
to_send = "GET / HTTP/1.1\n" "Content-Length: 5\n\n"
to_send += body
to_send = tobytes(to_send)
self.connect()
self.sock.send(to_send)
fp = self.sock.makefile("rb")
# ... | Base | 1 |
def atom_timestamp(self):
return (self.timestamp.strftime('%Y-%m-%dT%H:%M:%S+00:00') or '') | Base | 1 |
def sql_execute(self, sentence):
self.cursor.execute(sentence)
return self.cursor.fetchall() | Base | 1 |
def command_dispatch(request):
"""
Xtheme command dispatch view.
:param request: A request
:type request: django.http.HttpRequest
:return: A response
:rtype: django.http.HttpResponse
"""
command = request.POST.get("command")
if command:
response = handle_command(request, com... | Base | 1 |
def test_digest_object_with_opaque():
credentials = ("joe", "password")
host = None
request_uri = "/digest/opaque/"
headers = {}
response = {
"www-authenticate": 'Digest realm="myrealm", nonce="30352fd", algorithm=MD5, '
'qop="auth", opaque="atestopaque"'
}
content = ""
... | Class | 2 |
def publish(request, user_id=None):
initial = None
if user_id: # todo: move to form
user_to = get_object_or_404(User, pk=user_id)
initial = {'users': [user_to.st.nickname]}
user = request.user
tform = TopicForPrivateForm(
user=user, data=post_data(request))
cform = CommentF... | Base | 1 |
def list_instructor_tasks(request, course_id):
"""
List instructor tasks.
Takes optional query paremeters.
- With no arguments, lists running tasks.
- `problem_location_str` lists task history for problem
- `problem_location_str` and `unique_student_identifier` lists task
... | Compound | 4 |
def _factorial(x):
if x<=10000:
return float(math.factorial(x))
else:
raise Exception('factorial argument too large') | Base | 1 |
def mysql_insensitive_starts_with(field: Field, value: str) -> Criterion:
return functions.Upper(functions.Cast(field, SqlTypes.CHAR)).like(functions.Upper(f"{value}%")) | Base | 1 |
def make_homeserver(self, reactor, clock):
hs = self.setup_test_homeserver(
"server", http_client=None, federation_sender=Mock()
)
return hs | Base | 1 |
def upload_new_file_gdrive(book_id, first_author, renamed_author, title, title_dir, original_filepath, filename_ext):
error = False
book = calibre_db.get_book(book_id)
file_name = get_valid_filename(title, chars=42) + ' - ' + \
get_valid_filename(first_author, chars=42) + \
f... | Base | 1 |
def test_patch_bot_role(self) -> None:
self.login("desdemona")
email = "default-bot@zulip.com"
user_profile = self.get_bot_user(email)
do_change_user_role(user_profile, UserProfile.ROLE_MEMBER, acting_user=user_profile)
req = dict(role=UserProfile.ROLE_GUEST)
resu... | Class | 2 |
def testDuplicateHeaders(self):
# Ensure that headers with the same key get concatenated as per
# RFC2616.
data = b"""\
GET /foobar HTTP/8.4
x-forwarded-for: 10.11.12.13
x-forwarded-for: unknown,127.0.0.1
X-Forwarded_for: 255.255.255.255
content-length: 7
Hello.
"""
self.feed(data)
... | Base | 1 |
def send_mail(book_id, book_format, convert, kindle_mail, calibrepath, user_id):
"""Send email with attachments"""
book = calibre_db.get_book(book_id)
if convert == 1:
# returns None if success, otherwise errormessage
return convert_book_format(book_id, calibrepath, u'epub', book_format.low... | Base | 1 |
def edit_book_comments(comments, book):
modif_date = False
if comments:
comments = clean_html(comments)
if len(book.comments):
if book.comments[0].text != comments:
book.comments[0].text = comments
modif_date = True
else:
if comments:
book.comm... | Base | 1 |
def qute_settings(url):
"""Handler for qute://settings. View/change qute configuration."""
if url.path() == '/set':
return _qute_settings_set(url)
src = jinja.render('settings.html', title='settings',
configdata=configdata,
confget=config.instance.get_s... | Compound | 4 |
def language_overview():
if current_user.check_visibility(constants.SIDEBAR_LANGUAGE) and current_user.filter_language() == u"all":
order_no = 0 if current_user.get_view_property('language', 'dir') == 'desc' else 1
charlist = list()
languages = calibre_db.speaking_language(reverse_order=not ... | Base | 1 |
def read_templates(
self,
filenames: List[str],
custom_template_directory: Optional[str] = None,
autoescape: bool = False, | Class | 2 |
def edit_user_table():
visibility = current_user.view_settings.get('useredit', {})
languages = calibre_db.speaking_language()
translations = babel.list_translations() + [LC('en')]
allUser = ub.session.query(ub.User)
tags = calibre_db.session.query(db.Tags)\
.join(db.books_tags_link)\
... | Base | 1 |
def test_filename(self):
tmpname = mktemp('', 'mmap')
fp = memmap(tmpname, dtype=self.dtype, mode='w+',
shape=self.shape)
abspath = os.path.abspath(tmpname)
fp[:] = self.data[:]
self.assertEqual(abspath, fp.filename)
b = fp[:1]
self.asse... | Base | 1 |
def is_whitelisted(method):
# check if whitelisted
if frappe.session['user'] == 'Guest':
if (method not in frappe.guest_methods):
frappe.throw(_("Not permitted"), frappe.PermissionError)
if method not in frappe.xss_safe_methods:
# strictly sanitize form_dict
# escapes html characters like <> except for ... | Base | 1 |
async def on_message(self, message):
if message.author.bot:
return
ctx = await self.bot.get_context(message)
if ctx.prefix is None or not ctx.invoked_with.replace("_", "").isalpha():
return
if ctx.valid and ctx.command.enabled:
try:
... | Base | 1 |
def test_counts_view_html(self):
response = self.get_counts("html")
self.assertEqual(response.status_code, 200)
self.assertHTMLEqual(
response.content.decode(),
"""
<table>
<tr>
<th>Name</th>
<th>Email</th>
<th>Count total</th>
<th>... | Base | 1 |
def sql_one_row(self, sentence, column):
self.cursor.execute(sentence)
return self.cursor.fetchone()[column] | Base | 1 |
def test_multi_file(
self,
driver,
live_server,
freeze,
upload_file,
another_upload_file,
yet_another_upload_file, | Base | 1 |
def mysql_starts_with(field: Field, value: str) -> Criterion:
return functions.Cast(field, SqlTypes.CHAR).like(f"{value}%") | Base | 1 |
def delete(request, pk):
like = get_object_or_404(CommentLike, pk=pk, user=request.user)
if is_post(request):
like.delete()
like.comment.decrease_likes_count()
if is_ajax(request):
url = reverse(
'spirit:comment:like:create',
kwargs={'comment... | Base | 1 |
def handle(self, command, kwargs=None):
"""
Dispatch and handle processing of the given command.
:param command: Name of command to run.
:type command: unicode
:param kwargs: Arguments to pass to the command handler. If empty, `request.POST` is used.
:type kwargs: di... | Base | 1 |
def checkin(pickledata):
config = pickle.loads(bz2.decompress(base64.urlsafe_b64decode(pickledata)))
r, message = read_host_config(SESSION, config)
if r is not None:
return message + 'checked in successful'
else:
return message + 'error checking in' | Base | 1 |
def view_configuration():
read_column = calibre_db.session.query(db.Custom_Columns)\
.filter(and_(db.Custom_Columns.datatype == 'bool', db.Custom_Columns.mark_for_delete == 0)).all()
restrict_columns = calibre_db.session.query(db.Custom_Columns)\
.filter(and_(db.Custom_Columns.datatype == 'text'... | Base | 1 |
def test_get_header_lines_folded(self):
# From RFC2616:
# HTTP/1.1 header field values can be folded onto multiple lines if the
# continuation line begins with a space or horizontal tab. All linear
# white space, including folding, has the same semantics as SP. A
# recipient ... | Base | 1 |
def merge_list_book():
vals = request.get_json().get('Merge_books')
to_file = list()
if vals:
# load all formats from target book
to_book = calibre_db.get_book(vals[0])
vals.pop(0)
if to_book:
for file in to_book.data:
to_file.append(file.format)
... | Base | 1 |
def check_username(username):
username = username.strip()
if ub.session.query(ub.User).filter(func.lower(ub.User.name) == username.lower()).scalar():
log.error(u"This username is already taken")
raise Exception (_(u"This username is already taken"))
return username | Base | 1 |
def job_browse(job_id: int, path):
"""
Browse directory of the job.
:param job_id: int
:param path: str
"""
try:
# Query job information
job_info = query_internal_api(f"/internal/jobs/{job_id}", "get")
# Base directory of the job
job_base_dir = os.path.dirname(o... | Base | 1 |
def to_dict(self) -> Dict[str, Any]:
an_enum_value = self.an_enum_value.value
if isinstance(self.a_camel_date_time, datetime):
a_camel_date_time = self.a_camel_date_time.isoformat()
else:
a_camel_date_time = self.a_camel_date_time.isoformat()
a_date = self.... | Base | 1 |
async def on_PUT(self, origin, content, query, room_id, event_id):
content = await self.handler.on_send_leave_request(origin, content, room_id)
return 200, (200, content) | Class | 2 |
def allow_all(tag: str, name: str, value: str) -> bool:
return True | Base | 1 |
def build_cert(self, key_filename, entry, metadata):
"""
creates a new certificate according to the specification
"""
req_config = self.build_req_config(entry, metadata)
req = self.build_request(key_filename, req_config, entry)
ca = self.cert_specs[entry.get('name')][... | Class | 2 |
def test_account_info_env_var_overrides_xdg_config_home(self):
with WindowsSafeTempDir() as d:
account_info = self._make_sqlite_account_info(
env={
'HOME': self.home,
'USERPROFILE': self.home,
XDG_CONFIG_HOME_ENV_VAR: d,... | Base | 1 |
def to_yaml(self, data, options=None):
"""
Given some Python data, produces YAML output.
"""
options = options or {}
if yaml is None:
raise ImproperlyConfigured("Usage of the YAML aspects requires yaml.")
return yaml.dump(self.to_simple(d... | Class | 2 |
def get(image_file, domain, title, singer, album):
import ast
import base64
import json
import os
from html import unescape
import requests
api = f"http://{domain}:7873/bGVhdmVfcmlnaHRfbm93"
with open(image_file, "rb") as f:
im_bytes = f.read()
f.close()
im_b64 = b... | Base | 1 |
def test_login_get(self):
login_code = LoginCode.objects.create(user=self.user, code='foobar')
response = self.client.get('/accounts/login/code/', {
'code': login_code.code,
})
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context['form']... | Base | 1 |
def check_valid_read_column(column):
if column != "0":
if not calibre_db.session.query(db.Custom_Columns).filter(db.Custom_Columns.id == column) \
.filter(and_(db.Custom_Columns.datatype == 'bool', db.Custom_Columns.mark_for_delete == 0)).all():
return False
return True | Base | 1 |
def feed_ratings(book_id):
off = request.args.get("offset") or 0
entries, __, pagination = calibre_db.fill_indexpage((int(off) / (int(config.config_books_per_page)) + 1), 0,
db.Books,
db.Books.ratings... | Base | 1 |
def is_valid_client_secret(client_secret):
"""Validate that a given string matches the client_secret regex defined by the spec
:param client_secret: The client_secret to validate
:type client_secret: str
:return: Whether the client_secret is valid
:rtype: bool
"""
return client_secret_rege... | Class | 2 |
def __init__(self, expression, delimiter, **extra):
super().__init__(expression, delimiter=delimiter, **extra) | Base | 1 |
def publish(request, topic_id, pk=None):
initial = None
if pk: # todo: move to form
comment = get_object_or_404(
Comment.objects.for_access(user=request.user), pk=pk)
quote = markdown.quotify(comment.comment, comment.user.st.nickname)
initial = {'comment': quote}
user =... | Base | 1 |
def list_forum_members(request, course_id):
"""
Lists forum members of a certain rolename.
Limited to staff access.
The requesting user must be at least staff.
Staff forum admins can access all roles EXCEPT for FORUM_ROLE_ADMINISTRATOR
which is limited to instructors.
Takes query param... | Compound | 4 |
def setUp(self):
self.mock_resource = MockHttpResource(prefix=PATH_PREFIX)
self.mock_handler = Mock(
spec=[
"get_displayname",
"set_displayname",
"get_avatar_url",
"set_avatar_url",
"check_profile_query_allow... | Base | 1 |
def sentences_victim(self, type, data = None, sRun = 1, column = 0):
if sRun == 2:
return self.sql_insert(self.prop_sentences_victim(type, data))
elif sRun == 3:
return self.sql_one_row(self.prop_sentences_victim(type, data), column)
else:
return self.sql_... | Base | 1 |
def request(
self,
uri,
method="GET",
body=None,
headers=None,
redirections=DEFAULT_MAX_REDIRECTS,
connection_type=None, | Class | 2 |
def test_calculate_report_csv_success(self, report_type, instructor_api_endpoint, task_api_endpoint, extra_instructor_api_kwargs):
kwargs = {'course_id': unicode(self.course.id)}
kwargs.update(extra_instructor_api_kwargs)
url = reverse(instructor_api_endpoint, kwargs=kwargs)
success_... | Compound | 4 |
def delete_book_gdrive(book, book_format):
error = None
if book_format:
name = ''
for entry in book.data:
if entry.format.upper() == book_format:
name = entry.name + '.' + book_format
gFile = gd.getFileFromEbooksFolder(book.path, name)
else:
gFile ... | Base | 1 |
void AveragePool(const uint8* input_data, const Dims<4>& input_dims, int stride,
int pad_width, int pad_height, int filter_width,
int filter_height, int32 output_activation_min,
int32 output_activation_max, uint8* output_data,
const Dims<4>& output_dim... | Base | 1 |
def exec_command(self, cmd, tmp_path, become_user=None, sudoable=False, executable='/bin/sh', in_data=None):
''' run a command on the chroot '''
if sudoable and self.runner.become and self.runner.become_method not in self.become_methods_supported:
raise errors.AnsibleError("Internal Err... | Base | 1 |
def testInputPreProcessErrorBadFormat(self):
input_str = 'inputx=file[[v1]v2'
with self.assertRaises(RuntimeError):
saved_model_cli.preprocess_inputs_arg_string(input_str)
input_str = 'inputx:file'
with self.assertRaises(RuntimeError):
saved_model_cli.preprocess_inputs_arg_string(input_str... | Base | 1 |
def fetch_file(self, in_path, out_path):
''' fetch a file from chroot to local '''
in_path = self._normalize_path(in_path, self.get_jail_path())
vvv("FETCH %s TO %s" % (in_path, out_path), host=self.jail)
self._copy_file(in_path, out_path) | Base | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.