text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: GoogleCloudPlatform/python-docs-samples path: /appengine/standard/ndb/projection_queries/snippets_test.py # Copyright 2016 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/python-docs-samples", "path": "/appengine/standard/ndb/projection_queries/snippets_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ManuGar/CLoDSA path: /clodsa/clodsa/techniques/technique.py from abc import ABCMeta, abstractmethod class Technique: __metaclass__ = ABCMeta def __init__(self, parameters = None): self.parameters = parameters @abstractmethod def apply(self, image): <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "ManuGar/CLoDSA", "path": "/clodsa/clodsa/techniques/technique.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abstractmethod def apply(self, image): raise NotImplementedError<|fim_prefix|># repo: ManuGar/CLoDSA path: /clodsa/clodsa/techniques/technique.py from abc import ABCMeta, abstractmethod class Technique: __metaclass__ = ABCMeta def __init__(self, parameters = None): self...
code_fim
hard
{ "lang": "python", "repo": "ManuGar/CLoDSA", "path": "/clodsa/clodsa/techniques/technique.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HuyaneMatsu/hata path: /hata/discord/channel/channel_metadata/private_base.py __all__ = ('ChannelMetadataPrivateBase',) from scarletio import copy_docs from .fields import parse_users, put_users_into, validate_users from .base import ChannelMetadataBase class ChannelMetadataPrivateBase(Chann...
code_fim
hard
{ "lang": "python", "repo": "HuyaneMatsu/hata", "path": "/hata/discord/channel/channel_metadata/private_base.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> # users users = self.users hash_value ^= len(users) << 13 for user in users: hash_value ^= hash(user) return hash_value @classmethod @copy_docs(ChannelMetadataBase.from_data) def from_data(cls, data): self ...
code_fim
hard
{ "lang": "python", "repo": "HuyaneMatsu/hata", "path": "/hata/discord/channel/channel_metadata/private_base.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: onaio/onadata path: /onadata/libs/serializers/fields/json_field.py # -*- coding: utf-8 -*- """ A string is represented as valid JSON and is accessible as a dictionary and vis-a-vis. """ import json from rest_framework import serializers class JsonField(serializers.Field): <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "onaio/onadata", "path": "/onadata/libs/serializers/fields/json_field.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def to_json(cls, data): """Returns the JSON string as a dictionary.""" if isinstance(data, str): return json.loads(data) return data<|fim_prefix|># repo: onaio/onadata path: /onadata/libs/serializers/fields/json_field.py # -*- coding: utf-8 -*- """...
code_fim
hard
{ "lang": "python", "repo": "onaio/onadata", "path": "/onadata/libs/serializers/fields/json_field.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print("Analyse et conversion de la ligne :", ligne_en_cours + 1, "\n") for lettre in markdown[compteur]: if lettre != "\n": alphabet.append(lettre) else: alphabet.append(" ") compteur_elements(lettre, hashtags, etoiles, tirets, apostrophe_chelou...
code_fim
hard
{ "lang": "python", "repo": "ThibaultFeugere/md2html", "path": "/converter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> hashtags = [] etoiles = [] tirets = [] apostrophe_chelou = [] plus = [] print("Analyse et conversion de la ligne :", ligne_en_cours + 1, "\n") for lettre in markdown[compteur]: if lettre != "\n": alphabet.append(lettre) else: al...
code_fim
hard
{ "lang": "python", "repo": "ThibaultFeugere/md2html", "path": "/converter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThibaultFeugere/md2html path: /converter.py import codecs import argparse from library import initialisation ,compteur_elements, ecriture_head, ecriture_list, ecriture_hr, ecriture_italic, ecriture_bold, ecriture_url, finalistation parser = argparse.ArgumentParser() parser.add_argument("-i", "-...
code_fim
hard
{ "lang": "python", "repo": "ThibaultFeugere/md2html", "path": "/converter.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def reset(): logging.shutdown() reload(logging) state.initialized = False state.silenced.clear() def init(*, debug=False, verbosity=None, **kwargs): if debug: settings.DEFAULT_LEVEL = logging.DEBUG elif verbosity is not None: try: settings.DEFAULT_LEV...
code_fim
medium
{ "lang": "python", "repo": "jacebrowning/minilog", "path": "/log/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not state.initialized: if "pytest" in sys.modules: filters.install(logging.root) else: init() if allow_info: level = logging.INFO elif allow_warning: level = logging.WARNING elif allow_error: level = logging.ERROR else...
code_fim
hard
{ "lang": "python", "repo": "jacebrowning/minilog", "path": "/log/helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jacebrowning/minilog path: /log/helpers.py """Wrappers to eliminate boilerplate `logging` activities.""" import logging import sys from importlib import reload from . import filters, settings, state __all__ = ["reset", "init", "silence"] VERBOSITY_TO_LEVEL = { 0: logging.ERROR, 1: log...
code_fim
hard
{ "lang": "python", "repo": "jacebrowning/minilog", "path": "/log/helpers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #: the endpoint for the delete view URL rule delete_endpoint = 'delete' #: the message to be flashed for the next request when done delete_flash_message = None #: the form class for deletion confirmation, should validate if confirmed #: this attribute is **mandatory** if delete v...
code_fim
hard
{ "lang": "python", "repo": "pyx/flask-diced", "path": "/flask_diced.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """register edit view to blueprint :param blueprint: the Flask Blueprint or Application object to which the edit view will be registered. """ view = apply_decorators(self.edit_view, self.edit_decorators) blueprint.add_url_rule( s...
code_fim
hard
{ "lang": "python", "repo": "pyx/flask-diced", "path": "/flask_diced.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyx/flask-diced path: /flask_diced.py # -*- coding: utf-8 -*- """Flask-Diced - CRUD views generator for Flask""" from flask import flash, redirect, render_template, url_for __version__ = '0.4.dev0' __all__ = [ 'Detail', 'Index', 'Create', 'Edit', 'Delete', 'Base', 'Diced', 'persis...
code_fim
hard
{ "lang": "python", "repo": "pyx/flask-diced", "path": "/flask_diced.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: petemihaylov/ObjectDetection path: /test_connection.py #!/usr/bin/python import serial import time ard = serial.Serial('COM6',115200,timeout=0.5) time.sleep(2) # wait for Arduino <|fim_suffix|> # Serial read section msg = ard.readline() print("Message from arduino: ") print (msg...
code_fim
hard
{ "lang": "python", "repo": "petemihaylov/ObjectDetection", "path": "/test_connection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Serial read section msg = ard.readline() print("Message from arduino: ") print (msg.decode('utf-8'))<|fim_prefix|># repo: petemihaylov/ObjectDetection path: /test_connection.py #!/usr/bin/python import serial import time ard = serial.Serial('COM6',115200,timeout=0.5) time.sleep(2) # w...
code_fim
hard
{ "lang": "python", "repo": "petemihaylov/ObjectDetection", "path": "/test_connection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmem/pmdk path: /src/tools/pmreorder/statemachine.py # SPDX-License-Identifier: BSD-3-Clause # Copyright 2018-2022, Intel Corporation import memoryoperations as memops import reorderengines from reorderexceptions import InconsistentFileException from reorderexceptions import NotSupportedOperatio...
code_fim
hard
{ "lang": "python", "repo": "pmem/pmdk", "path": "/src/tools/pmreorder/statemachine.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> The replaying state performs reordering and if necessary checks the consistency of the registered files. The decisions and type of reordering to be used is defined by the context. :param in_op: The operation to be performed in this state. :type in_op: subclass of :...
code_fim
hard
{ "lang": "python", "repo": "pmem/pmdk", "path": "/src/tools/pmreorder/statemachine.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: angr/angr path: /tests/test_variablerecovery.py , "..", "binaries", "tests") # # Utility methods # class TestVariableRecovery(unittest.TestCase): def _compare_memory_variable(self, variable, variable_info): if variable_info["location"] == "stack": if not isinstance(var...
code_fim
hard
{ "lang": "python", "repo": "angr/angr", "path": "/tests/test_variablerecovery.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self._run_variable_recovery_analysis( "main", { "variables_by_instruction": { 0x400725: [ { "sort": VariableType.MEMORY, "location": "stack", ...
code_fim
hard
{ "lang": "python", "repo": "angr/angr", "path": "/tests/test_variablerecovery.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for insn_addr, variables in groundtruth["variables_by_instruction"].items(): for var_info in variables: var_sort = var_info["sort"] vars_and_offset = variable_manager.find_variables_by_insn(insn_addr, var_sort) # enumerate vars and find ...
code_fim
hard
{ "lang": "python", "repo": "angr/angr", "path": "/tests/test_variablerecovery.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the...
code_fim
medium
{ "lang": "python", "repo": "Jefferson-S-Rodrigues-UFMG/FaceGuard", "path": "/facenetmaster/src/photoserver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jefferson-S-Rodrigues-UFMG/FaceGuard path: /facenetmaster/src/photoserver.py # Copyright 2018 Cleuton Sampaio # 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...
code_fim
medium
{ "lang": "python", "repo": "Jefferson-S-Rodrigues-UFMG/FaceGuard", "path": "/facenetmaster/src/photoserver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return '.' in filename and \ filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS @app.route('/', methods=['POST']) def upload_file(): if 'file' not in request.files: print('No file part!', file=sys.stderr) return 'No File Part', 422 file = request.files['file']...
code_fim
hard
{ "lang": "python", "repo": "Jefferson-S-Rodrigues-UFMG/FaceGuard", "path": "/facenetmaster/src/photoserver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() lidar.stop() lidar.stop_motor() lidar.disconnect() quit() ############################ if event.type == pygame.KEYDOWN: ...
code_fim
hard
{ "lang": "python", "repo": "kfcmax/PySLAM", "path": "/examples/create_map.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kfcmax/PySLAM path: /examples/create_map.py import pygame from rplidar import RPLidar import time import random import math pygame.init() lidar = RPLidar('/dev/ttyUSB0') display_width = 1080 display_height = 720 gameDisplay = pygame.display.set_mode((display_width, display_height)) pygame.dis...
code_fim
medium
{ "lang": "python", "repo": "kfcmax/PySLAM", "path": "/examples/create_map.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x = (display_width * 0.5) y = (display_height * 0.5) x_change = 0 y_change = 0 car_speed = 0 black = (0, 0, 0) white = (255, 255, 255) clock = pygame.time.Clock() crashed = False carImg = pygame.image.load('robot.jpg') while True: for event in pygame.event.get(): if event.type == pygame.Q...
code_fim
medium
{ "lang": "python", "repo": "kfcmax/PySLAM", "path": "/examples/create_map.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __call__(self, r: requests.Request): r.headers['Authorization'] = "Bearer {}".format(self._bearer) def apply_auth(self): return tweepy.auth.OAuth2Bearer(self._bearer)<|fim_prefix|># repo: bhavintandel/streamlit-data-explorer path: /stdata_explorer/data_sources/twitter.py impo...
code_fim
medium
{ "lang": "python", "repo": "bhavintandel/streamlit-data-explorer", "path": "/stdata_explorer/data_sources/twitter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhavintandel/streamlit-data-explorer path: /stdata_explorer/data_sources/twitter.py import requests import tweepy class Auth(requests.auth.AuthBase): <|fim_suffix|> def __call__(self, r: requests.Request): r.headers['Authorization'] = "Bearer {}".format(self._bearer) def apply_...
code_fim
medium
{ "lang": "python", "repo": "bhavintandel/streamlit-data-explorer", "path": "/stdata_explorer/data_sources/twitter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def apply_auth(self): return tweepy.auth.OAuth2Bearer(self._bearer)<|fim_prefix|># repo: bhavintandel/streamlit-data-explorer path: /stdata_explorer/data_sources/twitter.py import requests import tweepy class Auth(requests.auth.AuthBase): <|fim_middle|> def __init__(self, bearer): ...
code_fim
medium
{ "lang": "python", "repo": "bhavintandel/streamlit-data-explorer", "path": "/stdata_explorer/data_sources/twitter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # In[ ]: # embedlist = _embed_imgset(learner, imgset) # In[105]: # bbox_search = BBoxSimilaritySearch(learner) # In[120]: def get_proposals(bbox_search, imgpath, targetpath): img = tfms(PImage.open(imgpath)) target = tfms(PImage.open(targetpath)) with torch.no_grad(): retur...
code_fim
hard
{ "lang": "python", "repo": "ntoxeg/siamese-triplet", "path": "/grpc/semantic_search.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ntoxeg/siamese-triplet path: /grpc/semantic_search.py #!/usr/bin/env python # coding: utf-8 # In[91]: # get_ipython().run_line_magic('load_ext', 'autoreload') # get_ipython().run_line_magic('autoreload', '2') # In[92]: from embedder import * import numpy as np # In[104]: class BBoxSi...
code_fim
hard
{ "lang": "python", "repo": "ntoxeg/siamese-triplet", "path": "/grpc/semantic_search.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: trebuh/online-server-watcher path: /online_watcher/__main__.py #! /usr/bin/env python3 # coding: utf-8 from online_watcher import OnlineWatcher <|fim_suffix|> watcher = OnlineWatcher() watcher.start() if __name__ == '__main__': main()<|fim_middle|>def main():
code_fim
easy
{ "lang": "python", "repo": "trebuh/online-server-watcher", "path": "/online_watcher/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): watcher = OnlineWatcher() watcher.start() if __name__ == '__main__': main()<|fim_prefix|># repo: trebuh/online-server-watcher path: /online_watcher/__main__.py #! /usr/bin/env python3 # coding: utf-8 <|fim_middle|>from online_watcher import OnlineWatcher
code_fim
easy
{ "lang": "python", "repo": "trebuh/online-server-watcher", "path": "/online_watcher/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> resp = io.recvline().decode().strip() raw_given_x, raw_given_k = resp.split(' with key ') given_x = b64decode(raw_given_x).decode() given_k = b64decode(raw_given_k).decode() for maybe_seed in range(start_time - 100, start_time + 100): random.seed(maybe_seed) if try_sam...
code_fim
medium
{ "lang": "python", "repo": "welchbj/ctf", "path": "/writeups/2020/angstrom-ctf/one-time-bad/solve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: welchbj/ctf path: /writeups/2020/angstrom-ctf/one-time-bad/solve.py #!/usr/bin/env python3 import string import time from base64 import b64decode from pwn import * ALPHABET = string.ascii_letters def gen_sample(): <|fim_suffix|> x, p, k = gen_sample() return x == given_x and k == giv...
code_fim
hard
{ "lang": "python", "repo": "welchbj/ctf", "path": "/writeups/2020/angstrom-ctf/one-time-bad/solve.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_flag(io, seed): random.seed(seed) gen_sample() x, p, k = gen_sample() io.recvuntil(b'> ') io.sendline(b'2') io.recvuntil(b'Your answer: ') io.sendline(p.encode()) return io.recvline().decode() def main(): io = remote('misc.2020.chall.actf.co', 20301) s...
code_fim
medium
{ "lang": "python", "repo": "welchbj/ctf", "path": "/writeups/2020/angstrom-ctf/one-time-bad/solve.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(args): tpu_cluster_resolver = tf.contrib.cluster_resolver.TPUClusterResolver(args.tpu) tpu_config = tf.contrib.tpu.TPUConfig( num_shards=8, # using Cloud TPU v2-8 iterations_per_loop=args.save_checkpoints_steps) config = tf.contrib.tpu.RunConfig( cluster=tpu_c...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/cloudml-samples", "path": "/tpu/utils/input_fn_tuning/trainer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GoogleCloudPlatform/cloudml-samples path: /tpu/utils/input_fn_tuning/trainer.py # Copyright 2018 Google LLC # # 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...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/cloudml-samples", "path": "/tpu/utils/input_fn_tuning/trainer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Extract input_fn_params from args. input_fn_params = {input_fn_param_name: getattr(args, input_fn_param_name) for input_fn_param_name in input_fn_param_names} # Build the input_fn. train_input_fn = partial(_train_input_fn, input_fn_params=input_fn_params) estimator.train(train_inpu...
code_fim
hard
{ "lang": "python", "repo": "GoogleCloudPlatform/cloudml-samples", "path": "/tpu/utils/input_fn_tuning/trainer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: UnnamedMoose/DIYROV path: /Software/controlInterface/throttleDial.py #!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Fri Jun 19 20:18:07 2015 @author: alek """ import wx class Throttle(wx.Panel): " A panel with a throttle display and a manual selector. " def __init__(self, pare...
code_fim
hard
{ "lang": "python", "repo": "UnnamedMoose/DIYROV", "path": "/Software/controlInterface/throttleDial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> " A frame that holds a throttle display and manual selection slider. " def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(190, 280)) self.sel = 0 # Current selection of the throttle. panel = wx.Panel(self, -1) # ...
code_fim
hard
{ "lang": "python", "repo": "UnnamedMoose/DIYROV", "path": "/Software/controlInterface/throttleDial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># TODO(edgar): move to a separated file __version__ = '0.1.2rc1' # the current version of the lib<|fim_prefix|># repo: kajal-puri/torchgeometry path: /torchgeometry/__init__.py from torchgeometry import core from torchgeometry import image from torchgeometry import losses from torchgeometry import contr...
code_fim
hard
{ "lang": "python", "repo": "kajal-puri/torchgeometry", "path": "/torchgeometry/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # TODO(edgar): move to a separated file __version__ = '0.1.2rc1' # the current version of the lib<|fim_prefix|># repo: kajal-puri/torchgeometry path: /torchgeometry/__init__.py from torchgeometry import core from torchgeometry import image from torchgeometry import losses from torchgeometry import cont...
code_fim
hard
{ "lang": "python", "repo": "kajal-puri/torchgeometry", "path": "/torchgeometry/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kajal-puri/torchgeometry path: /torchgeometry/__init__.py from torchgeometry import core from torchgeometry import image from torchgeometry import losses from torchgeometry import contrib from torchgeometry import utils <|fim_suffix|># TODO(edgar): move to a separated file __version__ = '0.1.2rc...
code_fim
hard
{ "lang": "python", "repo": "kajal-puri/torchgeometry", "path": "/torchgeometry/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class sharkSec: def __init__(self, rcce, waf, xxs, sqli, ckdir): self.rcce = rcce self.waf = waf self.xxs = xxs self.sqli = sqli self.ckdir = ckdir varSec = sharkSec('raf_sec_rcce', 'raf_sec_waf', 'rafy_sec_xxs', 'raf_sec_sqli', 'raf_sec_ckdir') varChecker = sh...
code_fim
hard
{ "lang": "python", "repo": "rob-giuliano/Raf.Shark.Pin", "path": "/libs/rFull_Fodera.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rob-giuliano/Raf.Shark.Pin path: /libs/rFull_Fodera.py #################################################################### # Python 3.6.8 # Project Name: RAF SHARK PIN # ver 1.0 # Developer: ROB GIULIANO -a.k.a- PG # Etherium: 0x14996EE0113C46A34b14e4F30197768b174c9486 # Bitcoin: ...
code_fim
hard
{ "lang": "python", "repo": "rob-giuliano/Raf.Shark.Pin", "path": "/libs/rFull_Fodera.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> headers_reader(target) print(" ") print("\t", srkColor.bold(1), ("[RSP - Info:] Target: " + target), srkColor.end()) print(" ") print(" ") print(srkColor.bold(1), "[RSP - Info]: >>> [Modx PenTester] >>> Xss Vulnerability") time.sleep(3) varSec.xxs = open("libs/rSec/xxs.txt"...
code_fim
hard
{ "lang": "python", "repo": "rob-giuliano/Raf.Shark.Pin", "path": "/libs/rFull_Fodera.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UpOut/objectify path: /objectify/model/base.py # coding: utf-8 #In order of performance try: import ujson as json except ImportError: try: import simplejson as json except ImportError: import json from ..base import ObjectifyObject class ObjectifyModel(ObjectifyObje...
code_fim
hard
{ "lang": "python", "repo": "UpOut/objectify", "path": "/objectify/model/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def serialize(self): return self.__serializer__(self.to_collection()) def deserialize(self,val): return self.from_collection( self.__deserializer__(val) ) def copy_inited(self,keep_name=True): if keep_name: self.__init_kwargs__['name'] ...
code_fim
hard
{ "lang": "python", "repo": "UpOut/objectify", "path": "/objectify/model/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if serializer is not None: self.__serializer__ = serializer if deserializer is not None: self.__deserializer__ = deserializer default = kwargs.get("default",None) if default: self.from_collection(default) def fetch_key_val...
code_fim
hard
{ "lang": "python", "repo": "UpOut/objectify", "path": "/objectify/model/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: a-paxton/oss-community-health path: /scripts/visualizations/figure_newcomer_retention.py import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec from utils_vis import add_letter_and_title from utils_vis import plot_newcomer_retention_2W from...
code_fim
hard
{ "lang": "python", "repo": "a-paxton/oss-community-health", "path": "/scripts/visualizations/figure_newcomer_retention.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>add_letter_and_title(ax_G, "G", "") ############################################################################### # Legend legend_patches = ( lines.Line2D([0, 1], [1, 1], color=colors["issue_post"]), lines.Line2D([0, 1], [1, 1], color=colors["pr_post"])) ax = fig.add_subplot(gs[60:85, :15]) ax...
code_fim
hard
{ "lang": "python", "repo": "a-paxton/oss-community-health", "path": "/scripts/visualizations/figure_newcomer_retention.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jimmy-INL/google-research path: /yoto/main.py t functools import os.path from absl import app from absl import flags from absl import logging import gin import gin.tf.external_configurables import tensorflow.compat.v1 as tf from tensorflow.compat.v1 import estimator as tf_estimator # We need t...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/yoto/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: problem: An instance of the Problem class, defining the learning problem. optimizer_class: MultiLossOptimizer class (gin-injected), used to generate an instance used to optimize the problem. This optimizer handles problems with parametrized loss functions. base_optimizer_cl...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/yoto/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jimmy-INL/google-research path: /yoto/main.py import enum import functools import os.path from absl import app from absl import flags from absl import logging import gin import gin.tf.external_configurables import tensorflow.compat.v1 as tf from tensorflow.compat.v1 import estimator as tf_estim...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/yoto/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Controller provides validation for POSTed data exposed endpoints: POST base_url/ GET base_url/<item uid> GET base_url/schema """ __validator__ = None def __init__(self): # pragma: no cover if self.__validator__: self.validator = self.__valida...
code_fim
hard
{ "lang": "python", "repo": "russell/refstack", "path": "/refstack/api/controllers/v1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: russell/refstack path: /refstack/api/controllers/v1.py # Copyright (c) 2015 Mirantis, Inc. # All Rights Reserved. # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "russell/refstack", "path": "/refstack/api/controllers/v1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: City-Bureau/city-scrapers path: /city_scrapers/spiders/chi_il_medical_district.py import re from collections import defaultdict from datetime import datetime, time from city_scrapers_core.constants import COMMISSION, FORUM from city_scrapers_core.items import Meeting from city_scrapers_core.spid...
code_fim
hard
{ "lang": "python", "repo": "City-Bureau/city-scrapers", "path": "/city_scrapers/spiders/chi_il_medical_district.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _parse_start(self, start_str, year=None): """Parse start datetime as a naive datetime object.""" # Allow for overriding year where not provided date_re = r"\w+\s+\d{1,2}" if year else r"\w+\s+\d{1,2},\s+\d{4}" date_match = re.search(date_re, start_str) if no...
code_fim
hard
{ "lang": "python", "repo": "City-Bureau/city-scrapers", "path": "/city_scrapers/spiders/chi_il_medical_district.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p = '\n' + "#" * 40 + "\n" for i in range(len(s.tabel_names) - 1): t = math.floor(((largest_tabel * 3) - len(s.tabel_names[i])) / 2 + 1) p += ('-' * t * 2) + s.tabel_names[i] + ('-' * t * 2) + "\n" c.execute('SELECT * FROM ' + s.tabel_names[i]) ...
code_fim
hard
{ "lang": "python", "repo": "HrOrange/Supermarkede", "path": "/1. Iteration/database.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HrOrange/Supermarkede path: /1. Iteration/database.py import math import random import time import sqlite3 import os class Data: def __init__(self, navn, columns = None, randoms = None): database_exist = os.path.exists(os.getcwd() + '\\' + navn + ".db") self.navn = navn ...
code_fim
hard
{ "lang": "python", "repo": "HrOrange/Supermarkede", "path": "/1. Iteration/database.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def mset(self, kv={}): for key, value in kv.iteritems(): self._DATA[key] = value return len(kv) def set(self, key, value): self._DATA[key] = value return 1<|fim_prefix|># repo: reAsOn2010/webnodeEx path: /webnodeex/dummy.py #!/usr/bin/env python # -*- ...
code_fim
hard
{ "lang": "python", "repo": "reAsOn2010/webnodeEx", "path": "/webnodeex/dummy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: reAsOn2010/webnodeEx path: /webnodeex/dummy.py #!/usr/bin/env python # -*- coding: utf-8 -*- class DummyRPC(object): def __init__(self): self._CALL_TIME_MAP = {} def call_by_id(self, i=0): check = self._CALL_TIME_MAP.get(i) assert(check is None) self._C...
code_fim
hard
{ "lang": "python", "repo": "reAsOn2010/webnodeEx", "path": "/webnodeex/dummy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chema-mengibar/voice-of-germany-2018-report path: /tasks/011_lang-songs_counter/011.00_main.py import os import sys DIR_TASK = os.path.basename(os.getcwd()) DIR_LIB = os.path.abspath(os.path.join(os.path.dirname(__file__),"../")) DIR_TASK = os.path.dirname(os.path.abspath(__file__)) import json...
code_fim
hard
{ "lang": "python", "repo": "chema-mengibar/voice-of-germany-2018-report", "path": "/tasks/011_lang-songs_counter/011.00_main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #TEST: print ( 0 if math.isnan( float(df_deezerRow['year']) ) else int(df_deezerRow['year']) ), if( df_deezerRow['lang'] not in LANGUAGES ): LANGUAGES.append( df_deezerRow['lang'] ) return { 'artist': df_deezerRow['artist'], 'title': df_deezerRow['song'], # _songTitle, 'year':...
code_fim
hard
{ "lang": "python", "repo": "chema-mengibar/voice-of-germany-2018-report", "path": "/tasks/011_lang-songs_counter/011.00_main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if participant_name not in CANDIDATES_AGES: CANDIDATES_AGES[ participant_name ] = -1 SONG_ITEM = { 'candidate': participant_name, 'show': 'blinds', 'song_infos': findSongInDeezer( song_title ) } SONGS.append( SONG_ITEM ) #STEP: Battles lines_sourceBattles = [] lines_sourceBattl...
code_fim
hard
{ "lang": "python", "repo": "chema-mengibar/voice-of-germany-2018-report", "path": "/tasks/011_lang-songs_counter/011.00_main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dustinpianalto/geeksbot_v2 path: /geeksbot/exts/rcon.py s sent.""" if message is not None: resp = await self.bot.aio_session.get( f'{self.bot.api_base}/rcon/{ctx.guild.id}/', headers=self.bot.auth_header ) if resp.status ...
code_fim
hard
{ "lang": "python", "repo": "dustinpianalto/geeksbot_v2", "path": "/geeksbot/exts/rcon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # @commands.command() # @commands.guild_only() # async def add_rcon_server(self, ctx, server, ip, port, password): # """Adds the specified server to the current guild\'s rcon config. # All multi-word strings (<server>, <ip>, <password>) must be contained inside double quotes.""...
code_fim
hard
{ "lang": "python", "repo": "dustinpianalto/geeksbot_v2", "path": "/geeksbot/exts/rcon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # noinspection PyShadowingNames async def _listplayers(server_name: str, msg: discord.Message): resp = await self.bot.aio_session.get( f'{self.bot.api_base}/rcon/{ctx.guild.id}/{server_name}/listplayers/', ...
code_fim
hard
{ "lang": "python", "repo": "dustinpianalto/geeksbot_v2", "path": "/geeksbot/exts/rcon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def get_app(): app = web.Application() app.add_routes(routes) return app @sync async def serve(host: str = '0.0.0.0', port: int = 9090): runner = web.AppRunner(await get_app()) await runner.setup() site = web.TCPSite(runner, host, port) await site.start() logger.in...
code_fim
medium
{ "lang": "python", "repo": "smarthou/dnlp", "path": "/src/dnlp/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smarthou/dnlp path: /src/dnlp/app.py import asyncio import logging from aiohttp import web from dnlp.helpers import sync from dnlp.routes import routes <|fim_suffix|> async def get_app(): app = web.Application() app.add_routes(routes) return app @sync async def serve(host: str = ...
code_fim
medium
{ "lang": "python", "repo": "smarthou/dnlp", "path": "/src/dnlp/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tungstenfabric/tf-controller path: /src/config/utils/setup.py # # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # import re from setuptools import setup, find_packages import sys <|fim_suffix|> with open(filename) as f: lines = f.read().splitlines() c = re.compi...
code_fim
medium
{ "lang": "python", "repo": "tungstenfabric/tf-controller", "path": "/src/config/utils/setup.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> setup( name='contrail_config_utils', version='0.1dev', packages=find_packages(), package_data={'': ['*.xml']}, zip_safe=False, description="Contrail VNC Configuration Utils", long_description="Contrail VNC Configuration Utils", install_requires=requirements('requirements.t...
code_fim
hard
{ "lang": "python", "repo": "tungstenfabric/tf-controller", "path": "/src/config/utils/setup.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyarmory/aumbry path: /aumbry/formats/js.py from alchemize.transmute import JsonTransmuter from aumbry.contract import AbstractHandler, AumbryConfig class JsonHandler(AbstractHandler): extras_name = 'json' @property def imports(self): return ['json'] def serialize(sel...
code_fim
medium
{ "lang": "python", "repo": "pyarmory/aumbry", "path": "/aumbry/formats/js.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return JsonTransmuter.transmute_from( raw_config.decode('utf-8'), config_cls ) def parse(self, raw_config): import json return json.loads(raw_config) class JsonConfig(AumbryConfig): """ A type of AumbryConfig for JSON Configurations.""" ...
code_fim
hard
{ "lang": "python", "repo": "pyarmory/aumbry", "path": "/aumbry/formats/js.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.name = self.model_dir / (str(name) + '.pkl') dump(self.stop_words, str(self.name)) def load(self, name): """Retrive stop words specified by a name """ self.name = self.model_dir / (str(name) + '.pkl') self.stop_words = load(str(self.name)) ...
code_fim
medium
{ "lang": "python", "repo": "FreeDiscovery/FreeDiscovery", "path": "/freediscovery/engine/stop_words.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: FreeDiscovery/FreeDiscovery path: /freediscovery/engine/stop_words.py # -*- coding: utf-8 -*- import os import os.path from sklearn.externals.joblib import dump, load from freediscovery.engine.pipeline import PipelineFinder class _StopWordsWrapper(object): """A mechanism for adding / man...
code_fim
hard
{ "lang": "python", "repo": "FreeDiscovery/FreeDiscovery", "path": "/freediscovery/engine/stop_words.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return cv.resize( img, None, fx=x_scale, fy=y_scale, interpolation=interpolation, )<|fim_prefix|># repo: sthysel/rakali path: /src/rakali/transforms.py import cv2 as cv def scale(img, scale): """scale preserving aspect ratio""" return resize(img, ...
code_fim
medium
{ "lang": "python", "repo": "sthysel/rakali", "path": "/src/rakali/transforms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sthysel/rakali path: /src/rakali/transforms.py import cv2 as cv def scale(img, scale): """scale preserving aspect ratio""" return resize(img, x_scale=scale, y_scale=scale) <|fim_suffix|> """resize image by scaling using provided factors""" interpolation = cv.INTER_LINEAR #...
code_fim
medium
{ "lang": "python", "repo": "sthysel/rakali", "path": "/src/rakali/transforms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # pick an optimized scaler if asked to if optimize: if x_scale > 1 and y_scale > 1: interpolation = cv.INTER_CUBIC else: interpolation = cv.INTER_AREA return cv.resize( img, None, fx=x_scale, fy=y_scale, interpola...
code_fim
medium
{ "lang": "python", "repo": "sthysel/rakali", "path": "/src/rakali/transforms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: texastribune/wjordpress path: /wjordpress/views.py import logging from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.views.generic import View from . import models from .api import UserCannotReadException <|fim_suffix|> return super(Ho...
code_fim
hard
{ "lang": "python", "repo": "texastribune/wjordpress", "path": "/wjordpress/views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class HookPressEndpoint(View): @csrf_exempt def dispatch(self, *args, **kwargs): return super(HookPressEndpoint, self).dispatch(*args, **kwargs) def post(self, request, pk, **kwargs): hook_used = request.POST.get('hook') site = models.WPSite.objects.get(pk=pk) ...
code_fim
hard
{ "lang": "python", "repo": "texastribune/wjordpress", "path": "/wjordpress/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> hook_used = request.POST.get('hook') site = models.WPSite.objects.get(pk=pk) logger.info(u'Hook Triggered: {}'.format(hook_used), extra={ 'request': request, }) # TODO clean up request.POST body so it's more useful models.WPLog.objects.push(site,...
code_fim
hard
{ "lang": "python", "repo": "texastribune/wjordpress", "path": "/wjordpress/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> list_tags = [t.strip() for t in all_tags.split("\n") if t.strip()] return list_tags[-1] if list_tags else None async def _git_get_current_matching_tag(directory: Path, regexp: str) -> List[str]: # NOTE: there might be several tags on the same commit reg = regexp if regexp.startswith...
code_fim
hard
{ "lang": "python", "repo": "mrnicegyu11/osparc-ops", "path": "/services/deployment-agent/src/simcore_service_deployment_agent/git_url_watcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrnicegyu11/osparc-ops path: /services/deployment-agent/src/simcore_service_deployment_agent/git_url_watcher.py import logging import shutil import tempfile from pathlib import Path from typing import Dict, List, Optional import attr from tenacity import after_log, retry, stop_after_attempt, wai...
code_fim
hard
{ "lang": "python", "repo": "mrnicegyu11/osparc-ops", "path": "/services/deployment-agent/src/simcore_service_deployment_agent/git_url_watcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>async def _git_get_logs_tags(directory: Path, tag1: str, tag2: str) -> Optional[str]: cmd = f"cd {directory} && git --no-pager log --oneline {tag1}{'..' + tag2 if tag1 else tag2}" logs = await run_cmd_line(cmd) return logs watched_repos = list() @attr.s(auto_attribs=True) class GitRepo: #...
code_fim
hard
{ "lang": "python", "repo": "mrnicegyu11/osparc-ops", "path": "/services/deployment-agent/src/simcore_service_deployment_agent/git_url_watcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: detrojones/packtools path: /packtools/__init__.py """Packtools is a Python library and set of command line utilities which can be used to handle SciELO Publishing Schema packages and XML files. """ import logging <|fim_suffix|># Setting up a do-nothing handler. We expect the application to defin...
code_fim
medium
{ "lang": "python", "repo": "detrojones/packtools", "path": "/packtools/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Setting up a do-nothing handler. We expect the application to define # the handler for `packtools`. logging.getLogger(__name__).addHandler(logging.NullHandler())<|fim_prefix|># repo: detrojones/packtools path: /packtools/__init__.py """Packtools is a Python library and set of command line utilities whi...
code_fim
medium
{ "lang": "python", "repo": "detrojones/packtools", "path": "/packtools/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> scan.header.stamp = rospy.Time.now() scan_pub.publish(scan) # convert the message of type LaserScan to a PointCloud2 pc2_msg = lp.projectLaser(scan) # publish it pc2_pub.publish(pc2_msg) seq += 1 if __name__ == '__main__': rospy.init_node('publish_point', anonymous=F...
code_fim
hard
{ "lang": "python", "repo": "wydmynd/crazyflie_tom", "path": "/crazyflie_demo/scripts/publish_scan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wydmynd/crazyflie_tom path: /crazyflie_demo/scripts/publish_scan.py #!/usr/bin/env python import rospy import tf from geometry_msgs.msg import PointStamped from crazyflie_driver.msg import GenericLogData import tf_conversions import tf2_ros import tf2_geometry_msgs from sensor_msgs.msg import Po...
code_fim
hard
{ "lang": "python", "repo": "wydmynd/crazyflie_tom", "path": "/crazyflie_demo/scripts/publish_scan.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>onrpc_enabled = "no" module_mbedtls_enabled = "no" module_mobile_vr_enabled = "no" module_opus_enabled = "no" module_regex_enabled = "no" module_tga_enabled = "no" module_theora_enabled = "no" module_tinyexr_enabled = "no" module_upnp_enabled = "no" module_visual_script_enabled = "no" module_vorbis_enable...
code_fim
medium
{ "lang": "python", "repo": "TerryCavanagh/triangle-run", "path": "/custom.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TerryCavanagh/triangle-run path: /custom.py # Generated using https://godot-build-options-generator.github.io disable_advanced_gui = "yes" minizip = "no" module_arkit_enabled = "no" module_bmp_enabled = "no" module_bullet_enab<|fim_suffix|>d = "no" module_tinyexr_enabled = "no" module_upnp_enabl...
code_fim
hard
{ "lang": "python", "repo": "TerryCavanagh/triangle-run", "path": "/custom.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: USFCEN4020/CEN4020F21TeamAlaska path: /src/Course.py from src.database_access import database_access class Course: def __init__(): pass # Returns the status a user has on a course or None @staticmethod def getCourseStatus(username: str, title: str, db: database_access) ...
code_fim
medium
{ "lang": "python", "repo": "USFCEN4020/CEN4020F21TeamAlaska", "path": "/src/Course.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sql = "SELECT title FROM courses;" return db.execute(sql) @staticmethod def setCourseStatus(username: str, title: str, completed: bool, db: database_access) -> None: courseRegistedSQL = "SELECT * FROM student_courses WHERE username = ? AND title = ?" result = db.ex...
code_fim
medium
{ "lang": "python", "repo": "USFCEN4020/CEN4020F21TeamAlaska", "path": "/src/Course.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def getAllCourseTitles(db: database_access) -> list: sql = "SELECT title FROM courses;" return db.execute(sql) @staticmethod def setCourseStatus(username: str, title: str, completed: bool, db: database_access) -> None: courseRegistedSQL = "SELECT * FR...
code_fim
medium
{ "lang": "python", "repo": "USFCEN4020/CEN4020F21TeamAlaska", "path": "/src/Course.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> form = super(PersonAdmin, self).get_form(request, obj, **kwargs) try: form.base_fields['page'].initial = People.objects.first() except IndexError: pass return form<|fim_prefix|># repo: onespacemedia/cms-people path: /apps/people/admin.py from cms....
code_fim
hard
{ "lang": "python", "repo": "onespacemedia/cms-people", "path": "/apps/people/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> prepopulated_fields = { 'slug': ('title',) } @admin.register(Person) class PersonAdmin(SortableModelAdmin, PageBaseAdmin): prepopulated_fields = {'slug': ['first_name', 'last_name']} list_display = ['__str__', 'is_online', 'order'] list_editable = ['is_online', 'order'] ...
code_fim
medium
{ "lang": "python", "repo": "onespacemedia/cms-people", "path": "/apps/people/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }