text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """ if isinstance(backend, type) and issubclass(backend, Backend): return backend elif isinstance(backend, str): try: backend = BUILTIN_BACKENDS[backend] except KeyError: raise ValueError(f'No such backend "{backend}"') p, m = backend.rsp...
code_fim
hard
{ "lang": "python", "repo": "luhn/limited", "path": "/limited/backend/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: soheeyang/cursorless-talon path: /src/csv_overrides.py from .conventions import get_cursorless_list_name from talon import Context, Module, actions, fs, app, settings from datetime import datetime from pathlib import Path mod = Module() ctx = Context() cursorless_settings_directory = mod.settin...
code_fim
hard
{ "lang": "python", "repo": "soheeyang/cursorless-talon", "path": "/src/csv_overrides.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def read_file( path: Path, default_identifiers: list[str], extra_acceptable_values: list[str] ): with open(path) as f: lines = list(f) result = {} used_identifiers = [] has_errors = False seen_header = False for i, raw_line in enumerate(lines): line = raw_line...
code_fim
hard
{ "lang": "python", "repo": "soheeyang/cursorless-talon", "path": "/src/csv_overrides.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: borgstrom/fujita path: /fujita/runner.py import logging import signal import time import uuid from tornado import ioloop, process class RunnerException(Exception): pass class Runner(object): """ This interface provides a mechanism for launching a process via a command line and ...
code_fim
hard
{ "lang": "python", "repo": "borgstrom/fujita", "path": "/fujita/runner.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def read_line(self, stream, callback): stream.read_until("\n", callback) def handle_stdout(self, line): self.send_line_to_waiters(0, line) self.read_line(self.process.stdout, self.handle_stdout) def handle_stderr(self, line): self.send_line_to_waiters(1, line)...
code_fim
hard
{ "lang": "python", "repo": "borgstrom/fujita", "path": "/fujita/runner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return smart_unicode(self.email) def was_updated_recently(self): now = timezone.now() return now - datetime.timedelta(days=1) <= self.updated < now was_updated_recently.admin_order_field = 'updated' was_updated_recently.boolean = True was_updated_recently.short_description = 'Published recentl...
code_fim
hard
{ "lang": "python", "repo": "Joseamica/Easily-written-Django", "path": "/day3/signups/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Joseamica/Easily-written-Django path: /day3/signups/models.py from django.db import models from django.utils import timezone from django.utils.encoding import smart_unicode import datetime class SignUp(models.Model): first_name = models.CharField(max_length=120, null=True, blank=True) last_na...
code_fim
medium
{ "lang": "python", "repo": "Joseamica/Easily-written-Django", "path": "/day3/signups/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linux-system-roles/auto-maintenance path: /report-modules-plugins.py nja2.nodes.Call, filectx.get_lineno(item.lineno), ) elif isinstance(args, list): for item in args: find_plugins(item, filectx) elif isinstance(args, dict): ...
code_fim
hard
{ "lang": "python", "repo": "linux-system-roles/auto-maintenance", "path": "/report-modules-plugins.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return (collection, "module") else: if plugintype in [jinja2.nodes.Filter, jinja2.nodes.Call]: if plugin in jinja2.defaults.DEFAULT_NAMESPACE: collection = "jinja2.defaults" elif plugin in jinja2.filters.FILTERS: ...
code_fim
hard
{ "lang": "python", "repo": "linux-system-roles/auto-maintenance", "path": "/report-modules-plugins.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linux-system-roles/auto-maintenance path: /report-modules-plugins.py ntinue filectx.add_plugin( item_name, item.__class__, filectx.get_lineno(item.lineno) ) if item_name in ["selectattr", "rejectattr"] and len(item.args) > 1: fil...
code_fim
hard
{ "lang": "python", "repo": "linux-system-roles/auto-maintenance", "path": "/report-modules-plugins.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_repeat.py #calss header class _REPEAT(): def __init__(self,): <|fim_suffix|> self.specie = 'verbs' def run(self, obj1 = [], obj2 = []): return self.jsondata<|fim_middle|> self.name = "REPEAT" self.definitions = [u'to say or tell people so...
code_fim
hard
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_repeat.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Remove a directory at the given location if does exist.""" if not exist(folder_name): print("The folder does not exist") return os.rmdir(folder_name)<|fim_prefix|># repo: Ardustri/klivi path: /klivi/utils/fs.py import os from typing import IO def write_file(filename:...
code_fim
hard
{ "lang": "python", "repo": "Ardustri/klivi", "path": "/klivi/utils/fs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def rmdir(folder_name: str) -> None: """Remove a directory at the given location if does exist.""" if not exist(folder_name): print("The folder does not exist") return os.rmdir(folder_name)<|fim_prefix|># repo: Ardustri/klivi path: /klivi/utils/fs.py import os from typing...
code_fim
medium
{ "lang": "python", "repo": "Ardustri/klivi", "path": "/klivi/utils/fs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ardustri/klivi path: /klivi/utils/fs.py import os from typing import IO def write_file(filename: str, content: str, mode: str = "w") -> IO: """Save content to a file, overwriting it by default.""" with open(filename, mode) as file: file.write(content) return file def read_...
code_fim
hard
{ "lang": "python", "repo": "Ardustri/klivi", "path": "/klivi/utils/fs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def update_S(self): r""" Updates schmidt values; returns the differencs from the old ones. """ S = svd_S(self.C) if self.S[self.pC].size != S.size: self.S[self.pC] = self._one_S(S.size) dS = (self.S[self.pC] - S) dS = np.sqrt(np.sum(d...
code_fim
hard
{ "lang": "python", "repo": "marekrams/tnac4o", "path": "/tnac4o/mps.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marekrams/tnac4o path: /tnac4o/mps.py : r""" Calculate expectation value: <psi|O_n|psi> for all n. O_n is 2-site operator and can be site dependent. """ if type(OO) == np.ndarray: OO = [OO] multiO = (self.L + len(OO) - 1) // len(OO) ...
code_fim
hard
{ "lang": "python", "repo": "marekrams/tnac4o", "path": "/tnac4o/mps.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> r"""C, A -> CA.""" return np.tensordot(C, A, axes=(1, 0)) def _mps_RAR(self, RL, A, RR): r"""RL, A, RR -> RL*A*RR.""" T1 = np.tensordot(RL, A, axes=(1, 0)) return np.tensordot(T1, RR, axes=(2, 0)) def _mps_HA(self, A, Hn, Hconj): r"""Applies MPO to...
code_fim
hard
{ "lang": "python", "repo": "marekrams/tnac4o", "path": "/tnac4o/mps.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: telegraphic/CMasher path: /cmasher/colormaps/eclipse/eclipse.py __author__ = "Ellert van der Velden (@1313e)" # Package declaration __package__ = 'cmasher' # %% GLOBALS AND DEFINITIONS # Type of this colormap (according to viscm) cm_type = "linear" # RGB-values of this colormap cm_data = [[0...
code_fim
hard
{ "lang": "python", "repo": "telegraphic/CMasher", "path": "/cmasher/colormaps/eclipse/eclipse.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: telegraphic/CMasher path: /cmasher/colormaps/eclipse/eclipse.py b.colors import ListedColormap # All declaration __all__ = ['cmap'] # Author declaration __author__ = "Ellert van der Velden (@1313e)" # Package declaration __package__ = 'cmasher' # %% GLOBALS AND DEFINITIONS # Type of this col...
code_fim
hard
{ "lang": "python", "repo": "telegraphic/CMasher", "path": "/cmasher/colormaps/eclipse/eclipse.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>-01, 4.07599257e-01], [3.33203276e-01, 4.45805694e-01, 4.08747819e-01], [3.38785749e-01, 4.48951058e-01, 4.09896437e-01], [3.44350231e-01, 4.52099830e-01, 4.11043086e-01], [3.49898778e-01, 4.55252117e-01, 4.12185145e-01], [3.55432984e-01, 4.58408074e-...
code_fim
hard
{ "lang": "python", "repo": "telegraphic/CMasher", "path": "/cmasher/colormaps/eclipse/eclipse.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: maximkulkin/lollipop path: /lollipop/errors.py from lollipop.compat import iteritems, string_types __all__ = [ 'SCHEMA', 'ValidationError', 'ValidationErrorBuilder', 'merge_errors', ] #: Name of an error key for cases when you have both errors for the object and #: for it's fi...
code_fim
hard
{ "lang": "python", "repo": "maximkulkin/lollipop", "path": "/lollipop/errors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def merge_errors(errors1, errors2): """Deeply merges two error messages. Error messages can be string, list of strings or dict of error messages (recursively). Format is the same as accepted by :exc:`ValidationError`. Returns new error messages. """ if errors1 is None: retu...
code_fim
hard
{ "lang": "python", "repo": "maximkulkin/lollipop", "path": "/lollipop/errors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> entity = entity_model.objects.filter( sts_id=validated_data['entity_id'], owner=user ).first() if not entity: raise ValidationError({ 'entity_id': [_('No such entity')] }) return service.client.create_perm(va...
code_fim
hard
{ "lang": "python", "repo": "VekotinVerstas/DataHubHel", "path": "/backend/service/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VekotinVerstas/DataHubHel path: /backend/service/serializers.py from collections import OrderedDict from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from rest_framework.exceptions import ValidationError from gatekeeper.models import Datastream from...
code_fim
hard
{ "lang": "python", "repo": "VekotinVerstas/DataHubHel", "path": "/backend/service/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fields = self.fields service = instance.client.service permission = instance.permission.codename entity_id = instance.object_pk model_name = str(instance.content_type.model) entity_type = model_name ret = OrderedDict() ret['url'] = fields['...
code_fim
hard
{ "lang": "python", "repo": "VekotinVerstas/DataHubHel", "path": "/backend/service/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BigRoy/arnold-usd path: /tools/utils/path.py # vim: filetype=python # Copyright 2019 Autodesk, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.a...
code_fim
medium
{ "lang": "python", "repo": "BigRoy/arnold-usd", "path": "/tools/utils/path.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def copy(src, target): ''' Copies a file or a symbolic link (creating a new link in the target dir) ''' if os.path.isdir(target): target = os.path.join(target, os.path.basename(src)) if os.path.islink(src): linked_path = os.readlink(src) os.symlink(linked_path, target) ...
code_fim
hard
{ "lang": "python", "repo": "BigRoy/arnold-usd", "path": "/tools/utils/path.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Copies a file or a symbolic link (creating a new link in the target dir) ''' if os.path.isdir(target): target = os.path.join(target, os.path.basename(src)) if os.path.islink(src): linked_path = os.readlink(src) os.symlink(linked_path, target) else: shutil.cop...
code_fim
hard
{ "lang": "python", "repo": "BigRoy/arnold-usd", "path": "/tools/utils/path.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Guymer/PyGuymer path: /hostname.py # -*- coding: utf-8 -*- ############################################################################################## # This file is deprecated because Python 2.x is deprecated # # A Python 3.x version of t...
code_fim
medium
{ "lang": "python", "repo": "Guymer/PyGuymer", "path": "/hostname.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Import standard modules ... import socket # Get (potentially fully-qualified) hostname and return the first part ... return socket.gethostname().split(".")[0]<|fim_prefix|># repo: Guymer/PyGuymer path: /hostname.py # -*- coding: utf-8 -*- ##############################################...
code_fim
medium
{ "lang": "python", "repo": "Guymer/PyGuymer", "path": "/hostname.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Get (potentially fully-qualified) hostname and return the first part ... return socket.gethostname().split(".")[0]<|fim_prefix|># repo: Guymer/PyGuymer path: /hostname.py # -*- coding: utf-8 -*- ############################################################################################## # ...
code_fim
medium
{ "lang": "python", "repo": "Guymer/PyGuymer", "path": "/hostname.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Get options from command line parser = OptionParser() parser.add_option("-f", "--force", dest="force", help="force overwrite of existing secret_keys file", action="store_true") parser.add_option("-r", "--randomness", dest="randomness", help="length (randomness) of generated key; default = 24"...
code_fim
medium
{ "lang": "python", "repo": "stochastic-technologies/flask-appengine-template", "path": "/src/application/generate_keys.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: stochastic-technologies/flask-appengine-template path: /src/application/generate_keys.py #!/usr/bin/env python # encoding: utf-8 """ generate_keys.py Generate CSRF and Session keys, output to secret_keys.py file Usage: generate_keys.py [-f] Outputs secret_keys.py file in current folder By...
code_fim
medium
{ "lang": "python", "repo": "stochastic-technologies/flask-appengine-template", "path": "/src/application/generate_keys.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ziemowit-s/neuronpp path: /neuronpp/core/hocwrappers/netcon.py from neuron import h from neuron.units import ms from neuronpp.core.cells.core_cell import CoreCell from neuronpp.core.decorators import non_removable_fields from neuronpp.core.hocwrappers.hoc_wrapper import HocWrapper from neuronpp....
code_fim
hard
{ "lang": "python", "repo": "ziemowit-s/neuronpp", "path": "/neuronpp/core/hocwrappers/netcon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def make_event(self, time, use_global_sim_time=True, use_delay=True): """ Make stimulation of NetCon. :param time: time in ms of the simulational event :param use_global_sim_time: If true it will use global time of hoc simulation (do...
code_fim
hard
{ "lang": "python", "repo": "ziemowit-s/neuronpp", "path": "/neuronpp/core/hocwrappers/netcon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mnajera/grid-game path: /aiplayer.py import random, time, sys from concurrent.futures import ThreadPoolExecutor from player import Player from enum import Enum class Direction(Enum): NONE = 0 UP = 1 DOWN = 2 LEFT = 3 RIGHT = 4 class AIPlayer(Player): def __init__(self, grid, screen_wid...
code_fim
hard
{ "lang": "python", "repo": "mnajera/grid-game", "path": "/aiplayer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def distance_to(self, target): ''' Determine the Manhattan distance between ourselves and the target position ''' return int(abs(self.x - target[0]) + abs(self.y - target[1])) def find_shortest_path_to(self, goal_pos): start_time = time.time() # locate our current grid position pos =...
code_fim
hard
{ "lang": "python", "repo": "mnajera/grid-game", "path": "/aiplayer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AnnaKudriasheva/vgs-satellite path: /satellite/tests/proxy/test_audit_logs.py import dataclasses from unittest.mock import Mock import pytest from satellite.proxy import ProxyMode from satellite.proxy.audit_logs import ( AuditLogRecord, AuditLogStore, emit, subscribe, Unkno...
code_fim
hard
{ "lang": "python", "repo": "AnnaKudriasheva/vgs-satellite", "path": "/satellite/tests/proxy/test_audit_logs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> store = AuditLogStore() record = AuditLogTestRecord( flow_id='flow-id', proxy_mode=ProxyMode.REVERSE, ) store.save(record) assert store.get('flow-id') == [record] def test_store_get_error(): store = AuditLogStore() with pytest.raises(UnknownFlowIdError) as exc...
code_fim
hard
{ "lang": "python", "repo": "AnnaKudriasheva/vgs-satellite", "path": "/satellite/tests/proxy/test_audit_logs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # # The 3-index density fitting tensor can be loaded from the _cderi file. # Using the 3-index tensor, the 4-center integrals can be constructed: # (pq|rs) = \sum_L A_lpq A_lrs # # The 3-index tensor for gamma point can be accessed with the code snippet # below. Assuming in the first pass, the GDF 3-...
code_fim
hard
{ "lang": "python", "repo": "sunqm/pyscf", "path": "/examples/pbc/35-gaussian_density_fit.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunqm/pyscf path: /examples/pbc/35-gaussian_density_fit.py #!/usr/bin/env python ''' Different ways to input density fitting auxiliary basis for PBC Gaussian density fitting. See also pyscf/examples/df/01-auxbasis.py for more auxiliary basis input methods. ''' import numpy as np from pyscf imp...
code_fim
hard
{ "lang": "python", "repo": "sunqm/pyscf", "path": "/examples/pbc/35-gaussian_density_fit.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # # Another straightforward way to input even-tempered Gaussian basis (for # better resolution of auxiliary basis) is the use of function gto.expand_etbs. # # Note the PBC Gaussian DF module will automatically remove diffused Gaussian # fitting functions. It is controlled by the parameter eta. The defau...
code_fim
hard
{ "lang": "python", "repo": "sunqm/pyscf", "path": "/examples/pbc/35-gaussian_density_fit.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sachinyar/The-Deep-Learning-Challenge path: /Section 4/source/solution3.py import conf import numpy as np from solution1 import get_all from solution2 import get_mnist def get_noise(n): return np.random.normal(0, 1, size=[n, 100]) def train_generator(gan, discriminator, batch_size): "...
code_fim
hard
{ "lang": "python", "repo": "sachinyar/The-Deep-Learning-Challenge", "path": "/Section 4/source/solution3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> batch_count = x_train.shape[0] / batch_size for e in range(1, epochs+1): for i in range(int(batch_count)): print('Epoch %d of %d [ batch %d of %d ]' % (e, epochs, i+1, batch_count), end='\r', flush=True) train_discriminator(gan, generator, discriminator, ...
code_fim
hard
{ "lang": "python", "repo": "sachinyar/The-Deep-Learning-Challenge", "path": "/Section 4/source/solution3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = self.client.delete('/tasks/%s' % key, follow_redirects=True) tasks = Task.all().fetch(100) self.assertEquals(0, len(tasks)) def test_put(self): key = Task(name="hoge").put() tasks = Task.all().fetch(100) self.assertEquals(1, len(tasks)) ...
code_fim
hard
{ "lang": "python", "repo": "tnakamura/SilverTask", "path": "/silvertask-web/core/tests/test_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> init_recording() app = get_application() self.client = Client(app, BaseResponse) def tearDown(self): disable_recording() def test_post(self): data = { "name": "foo", } response = self.client.post('/tasks', data=data, follow_redi...
code_fim
medium
{ "lang": "python", "repo": "tnakamura/SilverTask", "path": "/silvertask-web/core/tests/test_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tnakamura/SilverTask path: /silvertask-web/core/tests/test_views.py from StringIO import StringIO from google.appengine.ext import db from werkzeug import ( BaseResponse, Client, Request ) from kay.app import get_application from kay.utils.test import ( init_recording, get_last_context, g...
code_fim
hard
{ "lang": "python", "repo": "tnakamura/SilverTask", "path": "/silvertask-web/core/tests/test_views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return read_txt_particles(particles, refpart, real_particles, bucket_length, comm, extension == '.mxtxt', verbose) except TypeError: #TypeError, so it's not a file - so we should check if it's a numpy array #Had we checked the .txt read first, it would ...
code_fim
hard
{ "lang": "python", "repo": "eidelyur/synergia", "path": "/synergia/sources/base_diagnostics/read_bunch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Read an array of particles from a text file""" four_momentum = refpart.get_four_momentum() pmass = four_momentum.get_mass() E_0 = four_momentum.get_total_energy() p0c = four_momentum.get_momentum() myrank = comm.get_rank() mpisize = comm.get_size() i...
code_fim
hard
{ "lang": "python", "repo": "eidelyur/synergia", "path": "/synergia/sources/base_diagnostics/read_bunch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eidelyur/synergia path: /synergia/sources/base_diagnostics/read_bunch.py # load the particles that will be used for the simulation # The particles file is a text file with particle coordinates # defined with the MAD-X conventions: X PX Y PY T PT # Read this in using numpy's loadtxt command ...
code_fim
hard
{ "lang": "python", "repo": "eidelyur/synergia", "path": "/synergia/sources/base_diagnostics/read_bunch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>FullBodyCartesianCommand = _reflection.GeneratedProtocolMessageType('FullBodyCartesianCommand', (_message.Message,), { 'DESCRIPTOR' : _FULLBODYCARTESIANCOMMAND, '__module__' : 'cartesian_command_pb2' # @@protoc_insertion_point(class_scope:reachy.sdk.kinematics.FullBodyCartesianCommand) }) _sym_db....
code_fim
hard
{ "lang": "python", "repo": "marjoriePaillet/reachy-sdk-api", "path": "/python/reachy_sdk_api/cartesian_command_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>_FULLBODYCARTESIANCOMMANDSERVICE = _descriptor.ServiceDescriptor( name='FullBodyCartesianCommandService', full_name='reachy.sdk.kinematics.FullBodyCartesianCommandService', file=DESCRIPTOR, index=0, serialized_options=None, create_key=_descriptor._internal_create_key, serialized_start=423, ...
code_fim
hard
{ "lang": "python", "repo": "marjoriePaillet/reachy-sdk-api", "path": "/python/reachy_sdk_api/cartesian_command_pb2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marjoriePaillet/reachy-sdk-api path: /python/reachy_sdk_api/cartesian_command_pb2.py # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: cartesian_command.proto """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor fro...
code_fim
hard
{ "lang": "python", "repo": "marjoriePaillet/reachy-sdk-api", "path": "/python/reachy_sdk_api/cartesian_command_pb2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: superliuwanjia/DCGAN path: /ops.py import math import numpy as np import tensorflow as tf from tensorflow.python.framework import ops from utils import * try: image_summary = tf.image_summary scalar_summary = tf.scalar_summary histogram_summary = tf.histogram_summary merge_summ...
code_fim
hard
{ "lang": "python", "repo": "superliuwanjia/DCGAN", "path": "/ops.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bias = tf.get_variable("bias", [output_size], initializer=tf.constant_initializer(bias_start)) if with_w: return tf.matmul(input_, matrix) + bias, matrix, bias else: return tf.matmul(input_, matrix) + bias def orthogonal_ini...
code_fim
hard
{ "lang": "python", "repo": "superliuwanjia/DCGAN", "path": "/ops.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Download the image if we don't already have the latest version in cache.""" fetched = 0 info['version'] += 1 info['fetched_at'] = email.utils.formatdate() for field in VALIDATED_IMAGE_FIELDS: info[field] = resp.headers.get(field) last_lock_refresh = 0 with open(has...
code_fim
hard
{ "lang": "python", "repo": "mcarden/shakenfist", "path": "/shakenfist/images.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> out, _ = processutils.execute( 'qemu-img info %s' % path, shell=True) data = {} for line in out.split('\n'): line = line.lstrip().rstrip() elems = line.split(': ') if len(elems) > 1: key = elems[0] value = ': '.join(elems[1:]) ...
code_fim
hard
{ "lang": "python", "repo": "mcarden/shakenfist", "path": "/shakenfist/images.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcarden/shakenfist path: /shakenfist/images.py # Helpers to resolve images when we don't have an image service import email.utils import hashlib import json import logging from logging import handlers as logging_handlers import os import re import requests import shutil import time import urllib...
code_fim
hard
{ "lang": "python", "repo": "mcarden/shakenfist", "path": "/shakenfist/images.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def qotd(html_tree): raw_quote = html_tree.xpath('//p')[0].text_content().split('–') quote = raw_quote[0].strip() author = raw_quote[1].split('.,')[0] return quote, author<|fim_prefix|># repo: MhankBarBar/wikiquote path: /wikiquote/langs/id.py from .. import utils WORD_BLACKLIST = ['diku...
code_fim
medium
{ "lang": "python", "repo": "MhankBarBar/wikiquote", "path": "/wikiquote/langs/id.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MhankBarBar/wikiquote path: /wikiquote/langs/id.py from .. import utils WORD_BLACKLIST = ['dikutip', 'Varian:', 'Diambil', 'Catatan:', 'artikel:'] MAIN_PAGE = 'Halaman Utama' HEADINGS = ['pemeran', 'lihat juga', 'tautan eksternal', 'tentang'] <|fim_suffix|> q_list = utils.extract_quotes_li(t...
code_fim
medium
{ "lang": "python", "repo": "MhankBarBar/wikiquote", "path": "/wikiquote/langs/id.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>app = Flask('test') legacy.init_app(app) legacy.create_all()<|fim_prefix|># repo: arXiv/arxiv-auth path: /users/app.py """test app.""" import sys sys.path.append('./arxiv') <|fim_middle|>from flask import Flask from arxiv.users import auth, legacy
code_fim
medium
{ "lang": "python", "repo": "arXiv/arxiv-auth", "path": "/users/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arXiv/arxiv-auth path: /users/app.py """test app.""" import sys sys.path.append('./arxiv') <|fim_suffix|>app = Flask('test') legacy.init_app(app) legacy.create_all()<|fim_middle|>from flask import Flask from arxiv.users import auth, legacy
code_fim
medium
{ "lang": "python", "repo": "arXiv/arxiv-auth", "path": "/users/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adafruit/Adafruit_CircuitPython_MCP230xx path: /adafruit_mcp230xx/mcp23sxx.py # SPDX-FileCopyrightText: 2017 Tony DiCola for Adafruit Industries # SPDX-FileCopyrightText: 2019 Carter Nelson # SPDX-FileCopyrightText: 2021 Red_M # # SPDX-License-Identifier: MIT """ `mcp23sxx` =====================...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_MCP230xx", "path": "/adafruit_mcp230xx/mcp23sxx.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _write_u8(self, register: int, value: int) -> None: # Write an 8 bit value to the specified 8-bit register. _OUT_BUFFER[0] = self.cmd_write _OUT_BUFFER[1] = register & 0xFF _OUT_BUFFER[2] = value & 0xFF with self._device as bus_device: bus_device...
code_fim
hard
{ "lang": "python", "repo": "adafruit/Adafruit_CircuitPython_MCP230xx", "path": "/adafruit_mcp230xx/mcp23sxx.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryos36/polyphony path: /polyphony/compiler/block.py from .ir import * from .dominator import DominatorTreeBuilder from .utils import replace_item from logging import getLogger logger = getLogger(__name__) class Block: @classmethod def set_order(cls, block, order): order += 1 ...
code_fim
hard
{ "lang": "python", "repo": "ryos36/polyphony", "path": "/polyphony/compiler/block.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #deal with block links for succ in block.succs: succ.replace_pred(block, pred) succ.replace_pred_loop(block, pred) pred.succs = block.succs pred.succs_loop = block.succs_loop if block is...
code_fim
hard
{ "lang": "python", "repo": "ryos36/polyphony", "path": "/polyphony/compiler/block.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ponty/psidialogs path: /psidialogs/childproc.py import logging from psidialogs.err import FailedBackendError from psidialogs.util import run_mod_as_subproc log = logging.getLogger(__name__) def childprocess_backend_version(backend): p = run_mod_as_subproc("psidialogs.cli.print_backend_ver...
code_fim
hard
{ "lang": "python", "repo": "ponty/psidialogs", "path": "/psidialogs/childproc.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # with TemporaryDirectory(prefix="psidialogs") as tmpdirname: # filename = os.path.join(tmpdirname, "screenshot.png") # cmd = ["--filename", filename] cmd = [dialogtype] if title: cmd.append("--title") cmd.append(title) if message: cmd.append("--message") ...
code_fim
medium
{ "lang": "python", "repo": "ponty/psidialogs", "path": "/psidialogs/childproc.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> LIB_HOME = os.path.join(TEST_HOME, "lib") DEFAULT_TIMEOUT = 30<|fim_prefix|># repo: lagopus/lagopus-next-virtio path: /test/integration_test/tools/lib/const.py import os # global BUFSIZE = 4096 YAML_SUFFIXES = [".yml", ".y<|fim_middle|>aml"] TEST_HOME = os.path.dirname((os.path.abspath(os.path.dirnam...
code_fim
medium
{ "lang": "python", "repo": "lagopus/lagopus-next-virtio", "path": "/test/integration_test/tools/lib/const.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lagopus/lagopus-next-virtio path: /test/integration_test/tools/lib/const.py import os # global BUFSIZE = 4096 YAML_SUFFIXES = [".yml", ".y<|fim_suffix|> LIB_HOME = os.path.join(TEST_HOME, "lib") DEFAULT_TIMEOUT = 30<|fim_middle|>aml"] TEST_HOME = os.path.dirname((os.path.abspath(os.path.dirnam...
code_fim
medium
{ "lang": "python", "repo": "lagopus/lagopus-next-virtio", "path": "/test/integration_test/tools/lib/const.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('log', '0002_auto_20200610_0208'), ] operations = [ migrations.AlterField( model_name='logfile', name='log', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='log.Logger'), ...
code_fim
easy
{ "lang": "python", "repo": "ritvikmahajan17/scrum-2", "path": "/src/log/migrations/0003_auto_20200612_0435.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('log', '0002_auto_20200610_0208'), ] operations = [ migrations.AlterField( model_name='logfile', name='log', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='log.Logger'), ...
code_fim
medium
{ "lang": "python", "repo": "ritvikmahajan17/scrum-2", "path": "/src/log/migrations/0003_auto_20200612_0435.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ritvikmahajan17/scrum-2 path: /src/log/migrations/0003_auto_20200612_0435.py # Generated by Django 3.0.7 on 2020-06-11 23:05 from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> dependencies = [ ('log', '0002_auto_20200610_0208'), ] opera...
code_fim
easy
{ "lang": "python", "repo": "ritvikmahajan17/scrum-2", "path": "/src/log/migrations/0003_auto_20200612_0435.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.utils.log("Quitting") self.driver.quit() def testSample(self): self.utils.log(" Getting device screen size") self.utils.log(" " + str(self.driver.get_window_size())) self.utils.screenshot("app_launch") self.utils.log("Checking API level. This t...
code_fim
hard
{ "lang": "python", "repo": "jarnie/testdroid-samples", "path": "/appium/sample-scripts/python/testdroid_android_hybrid.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jarnie/testdroid-samples path: /appium/sample-scripts/python/testdroid_android_hybrid.py # # For help on setting up your machine and configuring this TestScript go to # http://docs.bitbar.com/testing/appium/ # import os import time import unittest import subprocess from appium import webdriver f...
code_fim
hard
{ "lang": "python", "repo": "jarnie/testdroid-samples", "path": "/appium/sample-scripts/python/testdroid_android_hybrid.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> desired_capabilities_cloud = {} desired_capabilities_cloud['testdroid_apiKey'] = testdroid_apiKey if self.api_level > 16: desired_capabilities_cloud['testdroid_target'] = 'android' desired_capabilities_cloud['automationName'] = 'Appium' else: ...
code_fim
hard
{ "lang": "python", "repo": "jarnie/testdroid-samples", "path": "/appium/sample-scripts/python/testdroid_android_hybrid.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> chatroom = data['chatroom'] username = data['username'] join_room(chatroom) emit('join', {'username': username, 'chatroom': chatroom}, room=chatroom, include_self=False) @socketio.on('leave') def on_leave(data): chatroom = data['chatroom'] username = data['username'] leave_roo...
code_fim
medium
{ "lang": "python", "repo": "PEIXingting/IMDemo", "path": "/Server/Python/final_project3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PEIXingting/IMDemo path: /Server/Python/final_project3.py from flask import Flask, request, jsonify from flask_socketio import SocketIO, emit, join_room, leave_room import mysql.connector app = Flask(__name__) app.config['SECRET_KEY'] = 'iems5722' socketio = SocketIO(app) @socketio.on('connect...
code_fim
medium
{ "lang": "python", "repo": "PEIXingting/IMDemo", "path": "/Server/Python/final_project3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jasonsbrooks/ARTIST path: /src/artist_generator/ga/__init__.py """ The ga package contains code for the genetic algorithms, including: <|fim_suffix|>from ga import run from ga_midi import create_midi_file from chords import create_chord_progression<|fim_middle|>- the main module `ga.py` for runn...
code_fim
hard
{ "lang": "python", "repo": "jasonsbrooks/ARTIST", "path": "/src/artist_generator/ga/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from ga import run from ga_midi import create_midi_file from chords import create_chord_progression<|fim_prefix|># repo: jasonsbrooks/ARTIST path: /src/artist_generator/ga/__init__.py """ The ga package contains code for the genetic algorithms, including: <|fim_middle|>- the main module `ga.py` for runn...
code_fim
hard
{ "lang": "python", "repo": "jasonsbrooks/ARTIST", "path": "/src/artist_generator/ga/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amituttam/Projects path: /Practice2/find_prime.py def find_prime(n): is_prime = [1 if i > 1 else 0 for i in range(n)] for i in range(2,n): if is_prime[i]: j = i while j < n: <|fim_suffix|>s_prime is_prime = find_prime(100) print([i for i in ra...
code_fim
medium
{ "lang": "python", "repo": "amituttam/Projects", "path": "/Practice2/find_prime.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>s_prime is_prime = find_prime(100) print([i for i in range(100) if is_prime[i] == True])<|fim_prefix|># repo: amituttam/Projects path: /Practice2/find_prime.py def find_prime(n): is_prime = [1 if i > 1 else 0 for i in range(n)] for i in ra<|fim_middle|>nge(2,n): if is_prime[i]: ...
code_fim
medium
{ "lang": "python", "repo": "amituttam/Projects", "path": "/Practice2/find_prime.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FilippoAleotti/MotionTest path: /monodepth2/prepare.py from __future__ import division, absolute_import import cv2 import os import tensorflow as tf import numpy as np import sys from flow_utils import read_intrinsics, read_pose, flow_to_color, compute_rigid_flow, write_flow import argparse pars...
code_fim
hard
{ "lang": "python", "repo": "FilippoAleotti/MotionTest", "path": "/monodepth2/prepare.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with tf.Session() as session: intrinsics = read_intrinsics(os.path.abspath(os.path.join('calib',"calib.txt"))) # scaling the intrinsics mask = tf.constant(np.asarray([[640/1226, 1, 640/1226], [192/370, 192/370 , 1], [1, 1, 1]], dtype=np.float32)) intrinsics = i...
code_fim
medium
{ "lang": "python", "repo": "FilippoAleotti/MotionTest", "path": "/monodepth2/prepare.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MTES-MCT/sparte path: /users/migrations/0003_auto_20210710_2236.py # Generated by Django 3.2.5 on 2021-07-10 22:36 import django.utils.timezone from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AddField( ...
code_fim
hard
{ "lang": "python", "repo": "MTES-MCT/sparte", "path": "/users/migrations/0003_auto_20210710_2236.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name="user", name="creation_date", field=models.DateTimeField( auto_now_add=True, default=django.utils.timezone.now, verbose_name="creation date", ), ...
code_fim
hard
{ "lang": "python", "repo": "MTES-MCT/sparte", "path": "/users/migrations/0003_auto_20210710_2236.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gistable/gistable path: /dockerized-gists/6850443/snippet.py #!/usr/bin/env python # Tkinter (Tk/Ttk) Progressbar widget example # # Written by Yu-Jie Lin # This code is placed in Public Domain # # Gist: https://gist.github.com/livibetter/6850443 # Clip: https://www.youtube.com/watch?v=rKr8wjKuhB...
code_fim
medium
{ "lang": "python", "repo": "gistable/gistable", "path": "/dockerized-gists/6850443/snippet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> root = Tkinter.Tk() ft = ttk.Frame() fb = ttk.Frame() ft.pack(expand=True, fill=Tkinter.BOTH, side=Tkinter.TOP) fb.pack(expand=True, fill=Tkinter.BOTH, side=Tkinter.TOP) pb_hd = ttk.Progressbar(ft, orient='horizontal', mode='determinate') pb_hD = ttk.Progressbar(ft, orient='horizontal', m...
code_fim
medium
{ "lang": "python", "repo": "gistable/gistable", "path": "/dockerized-gists/6850443/snippet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mjbhobe/dl-keras path: /kr_mnist.py """ kr_mnist.py: Multiclass classification of MNIST digits dataset using a ANN & then a CNN @author: Manish Bhobe My experiments with Python, Machine Learning & Deep Learning. This code is meant for education purposes only & is not intended for commercial/prod...
code_fim
hard
{ "lang": "python", "repo": "mjbhobe/dl-keras", "path": "/kr_mnist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return ( (X_train, y_train), (X_val, y_val), (X_test, y_test), (test_images, test_labels), ) def step_lr(epoch): global LEARNING_RATE initial_lr = LEARNING_RATE drop_rate = 0.5 epochs_drop = 10.0 new_lr = initial_lr * math.pow(drop_rate, math....
code_fim
hard
{ "lang": "python", "repo": "mjbhobe/dl-keras", "path": "/kr_mnist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Weber-JC/PythonEggs path: /cstp/cstp/TCmdStringSckP2PLayoutPipe.py #!/usr/local/bin/python # -*- coding:utf-8 -*- """ 2016/8/26 WeiYanfeng 实现了 TCmdPipeServer 和 P2PLayout模式下Peer端的对接。 """ import sys from weberFuncs import PrintTimeMsg from TCmdStringSckP2PLayout import TCmdStringSckP2PLa...
code_fim
hard
{ "lang": "python", "repo": "Weber-JC/PythonEggs", "path": "/cstp/cstp/TCmdStringSckP2PLayoutPipe.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def HandlePipePushData(self, oData,iDealCount): if self.bVerbose: PrintTimeMsg('TCmdStringSckP2PLayoutPipe.HandlePipePushData.%d#.oData=%s=' % (iDealCount,oData)) else: if iDealCount%self.iPrintIntervalNum==0: PrintTimeMsg('PipePushData#%d.oData=...
code_fim
hard
{ "lang": "python", "repo": "Weber-JC/PythonEggs", "path": "/cstp/cstp/TCmdStringSckP2PLayoutPipe.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bbhunter/waybackpack path: /waybackpack/asset.py import logging import re from .session import Session from .settings import DEFAULT_ROOT logger = logging.getLogger(__name__) ARCHIVE_TEMPLATE = "https://web.archive.org/web/{timestamp}{flag}/{url}" REMOVAL_PATTERNS = [ re.compile( ...
code_fim
hard
{ "lang": "python", "repo": "bbhunter/waybackpack", "path": "/waybackpack/asset.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> session = session or Session() url = self.get_archive_url(raw) res = session.get(url) if res is None: return None content = res.content if raw: return content else: rdp = REDIRECT_PATTERNS is_js_red...
code_fim
hard
{ "lang": "python", "repo": "bbhunter/waybackpack", "path": "/waybackpack/asset.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check non-cookie token for match. second_token = "" if request.line.method == "POST": if isinstance(request.body, dict): second_token = request.body.get('csrf_token', '') if second_token == "": # Fall back to X-CSRF-TOKEN, to make ...
code_fim
hard
{ "lang": "python", "repo": "danieldalonzo/gratipay.com", "path": "/gratipay/security/csrf.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: danieldalonzo/gratipay.com path: /gratipay/security/csrf.py """Cross Site Request Forgery middleware, borrowed from Django. See also: https://github.com/django/django/blob/master/django/middleware/csrf.py https://docs.djangoproject.com/en/dev/ref/contrib/csrf/ https://github.com/gra...
code_fim
hard
{ "lang": "python", "repo": "danieldalonzo/gratipay.com", "path": "/gratipay/security/csrf.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Data-Designer/Leetcode-Travel path: /leetcode/231.2-的幂.py ''' Description: version: Author: Data Designer Date: 2021-04-05 20:22:52 LastEditors: Data Designer LastEditTime: 2021-04-05 20:28:05 ''' # # @lc app=leetcode.cn id=231 lang=python3 # # [231] 2的幂 # # @lc code=start class Solution: <|fi...
code_fim
easy
{ "lang": "python", "repo": "Data-Designer/Leetcode-Travel", "path": "/leetcode/231.2-的幂.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def isPowerOfTwo(self, n: int) -> bool: if n== 0: return False while n%2 ==0 : n = n//2 if n==1: return True else: return False # @lc code=end<|fim_prefix|># repo: Data-Designer/Leetcode-Travel path: /leetcode/231.2-的幂.p...
code_fim
easy
{ "lang": "python", "repo": "Data-Designer/Leetcode-Travel", "path": "/leetcode/231.2-的幂.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if n== 0: return False while n%2 ==0 : n = n//2 if n==1: return True else: return False # @lc code=end<|fim_prefix|># repo: Data-Designer/Leetcode-Travel path: /leetcode/231.2-的幂.py ''' Description: version: Author: Data D...
code_fim
easy
{ "lang": "python", "repo": "Data-Designer/Leetcode-Travel", "path": "/leetcode/231.2-的幂.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> A repository folder should be written using a specific folder structure as shown below:: \b . ├── plugins │ ├── some-plugin-1.0.0.tgz │ ├── some-plugin-1.3.5.tgz │ └── another-plugin-1.2.3.tgz ├── recipes │ └── my-recipe-0.0....
code_fim
hard
{ "lang": "python", "repo": "mostaphaRoudsari/queenbee", "path": "/queenbee/cli/repository/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }