text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> create_dir(OUTPUT_DIR) soup = get_soup(SOURCE, session) link = soup.find('div', {'id': 'divid'}).find('div')['ng-include'].replace('\'', '') link = PARENT_SOURCES[1] + link soup = get_soup(link, session) file_url = PARENT_SOURCES[0] + soup.find_all('a')[0]['href'][2:] zip_filen...
code_fim
medium
{ "lang": "python", "repo": "themousepotato/unscrapulous", "path": "/unscrapulous/scrapers/sebi_debarred_bse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> alias = { 'PAN': 'PAN No.', 'Name': 'Scrip Name /Entity', 'AddedDate': 'Date of Order ' } write_to_db(conn, os.path.join(OUTPUT_DIR, OUTPUT_FILE), SOURCE, alias)<|fim_prefix|># repo: themousepotato/unscrapulous path: /unscrapulous/scrapers/sebi_debarred_bse.py #!/usr/b...
code_fim
hard
{ "lang": "python", "repo": "themousepotato/unscrapulous", "path": "/unscrapulous/scrapers/sebi_debarred_bse.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: estebango/coding-skills-sample-code path: /coding202-parsing-json/get-cmx-json.py from urllib.request import Request, urlopen import json <|fim_suffix|>jsonObject = json.loads(responseString) print(json.dumps(jsonObject, sort_keys=True, indent=4)) response.close()<|fim_middle|>req = Request('h...
code_fim
hard
{ "lang": "python", "repo": "estebango/coding-skills-sample-code", "path": "/coding202-parsing-json/get-cmx-json.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print(json.dumps(jsonObject, sort_keys=True, indent=4)) response.close()<|fim_prefix|># repo: estebango/coding-skills-sample-code path: /coding202-parsing-json/get-cmx-json.py from urllib.request import Request, urlopen import json req = Request('https://devnetapi.cisco.com/sandbox/mse/api/config/v1/ma...
code_fim
medium
{ "lang": "python", "repo": "estebango/coding-skills-sample-code", "path": "/coding202-parsing-json/get-cmx-json.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.linkedlist.isempty() def display(self): self.linkedlist.display()<|fim_prefix|># repo: aashishogale/DataStructurePrograms-Python- path: /com/bridgelabz/utility/queue.py from com.bridgelabz.utility.linkedlist import LinkedList class Queue: linkedlist=LinkedList...
code_fim
hard
{ "lang": "python", "repo": "aashishogale/DataStructurePrograms-Python-", "path": "/com/bridgelabz/utility/queue.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aashishogale/DataStructurePrograms-Python- path: /com/bridgelabz/utility/queue.py from com.bridgelabz.utility.linkedlist import LinkedList class Queue: linkedlist=LinkedList() def enqueue(self,item): self.linkedlist.addatEnd(item) return def dequeue(se...
code_fim
medium
{ "lang": "python", "repo": "aashishogale/DataStructurePrograms-Python-", "path": "/com/bridgelabz/utility/queue.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = 'name' users_repo = mock.Mock() users_repo.update.return_value = User(id=id, name=name, roles=mock.Mock()) request = UpdateUserRequest(id=None) action = UpdateUserAction(repo=users_repo) response = action.execute(request) assert bool(response) is False assert not ...
code_fim
hard
{ "lang": "python", "repo": "Himon-SYNCRAFT/taskplus", "path": "/tests/core/actions/update_user/test_update_user_action.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Himon-SYNCRAFT/taskplus path: /tests/core/actions/update_user/test_update_user_action.py from unittest import mock from taskplus.core.actions import UpdateUserAction, UpdateUserRequest from taskplus.core.domain import User from taskplus.core.shared.response import ResponseFailure def test_upda...
code_fim
hard
{ "lang": "python", "repo": "Himon-SYNCRAFT/taskplus", "path": "/tests/core/actions/update_user/test_update_user_action.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> action = UpdateUserAction(repo=users_repo) response = action.execute(request) assert bool(response) is False assert users_repo.update.called assert response.value == { 'type': ResponseFailure.SYSTEM_ERROR, 'message': 'Exception: {}'.format(error_message) }<|fim_pre...
code_fim
hard
{ "lang": "python", "repo": "Himon-SYNCRAFT/taskplus", "path": "/tests/core/actions/update_user/test_update_user_action.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @bottle.post("/pobrisi-udelezenca/") def pobrisi_udelezenca(): print(dict(bottle.request.forms)) indeks = bottle.request.forms.getunicode("indeks") skupina = moj_model.aktualna_skupina udelezenec = skupina.udelezenci[int(indeks)] Skupina.zbrisi_udelezenca(skupina, udelezenec) moj_...
code_fim
hard
{ "lang": "python", "repo": "nikapavlic/razdelitev-stroskov", "path": "/spletni_vmesnik2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nikapavlic/razdelitev-stroskov path: /spletni_vmesnik2.py import bottle from model import Model, Skupina, Udelezenec IME_DATOTEKE = "stanje.json" try: moj_model = Model.preberi_iz_datoteke(IME_DATOTEKE) except FileNotFoundError: moj_model = Model() @bottle.get("/") def osnovna_stran():...
code_fim
hard
{ "lang": "python", "repo": "nikapavlic/razdelitev-stroskov", "path": "/spletni_vmesnik2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @bottle.post("/pobrisi-placilo/") def pobrisi_placilo(): print(dict(bottle.request.forms)) indeks = bottle.request.forms.getunicode("indeks") skupina = moj_model.aktualna_skupina udelezenec = skupina.udelezenci[int(indeks)] print(dict(bottle.request.forms)) st = bottle.request.for...
code_fim
hard
{ "lang": "python", "repo": "nikapavlic/razdelitev-stroskov", "path": "/spletni_vmesnik2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rho2/alpyro_msgs path: /alpyro_msgs/actionlib/testrequestresult.py from alpyro_msgs import RosMessage, boolean, int32 <|fim_suffix|> __msg_typ__ = "actionlib/TestRequestResult" __msg_def__ = "aW50MzIgdGhlX3Jlc3VsdApib29sIGlzX3NpbXBsZV9zZXJ2ZXIKCg==" __md5_sum__ = "61c2364524499c7c5017e2f3fc...
code_fim
easy
{ "lang": "python", "repo": "rho2/alpyro_msgs", "path": "/alpyro_msgs/actionlib/testrequestresult.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> the_result: int32 is_simple_server: boolean<|fim_prefix|># repo: rho2/alpyro_msgs path: /alpyro_msgs/actionlib/testrequestresult.py from alpyro_msgs import RosMessage, boolean, int32 class TestRequestResult(RosMessage): <|fim_middle|> __msg_typ__ = "actionlib/TestRequestResult" __msg_def__ = "aW...
code_fim
medium
{ "lang": "python", "repo": "rho2/alpyro_msgs", "path": "/alpyro_msgs/actionlib/testrequestresult.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kidkid168/yarppg path: /test/processors/test_processor.py import numpy as np import pytest from yarppg.rppg.processors import Processor def test_spatial_pooling(): frame = np.ones((10, 10, 3)) proc = Processor() for i in range(10): proc.spatial_pooling(i*frame, append_rgb=T...
code_fim
medium
{ "lang": "python", "repo": "kidkid168/yarppg", "path": "/test/processors/test_processor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert np.isnan(proc.calculate(None)) @pytest.mark.filterwarnings("ignore") def test_moving_average(): assert np.isnan(Processor.moving_average_update(None, [], 1)) assert np.isnan(Processor.moving_average_update(None, [np.nan]*3, 2)) assert Processor.moving_average_update(None, range(5)...
code_fim
hard
{ "lang": "python", "repo": "kidkid168/yarppg", "path": "/test/processors/test_processor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.c = nn.Conv3d( in_channels = self.num_filters//self.expansion_ratio, out_channels = self.num_filters, kernel_size = 1, stride = 1, padding = 0, bias = False ) ...
code_fim
hard
{ "lang": "python", "repo": "hrb518/EssentialMC2", "path": "/papers/pytorch-video-understanding/models/module_zoo/branches/r2d3d_branch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hrb518/EssentialMC2 path: /papers/pytorch-video-understanding/models/module_zoo/branches/r2d3d_branch.py #!/usr/bin/env python3 # Copyright (C) Alibaba Group Holding Limited. """ R2D3D branch. """ import torch import torch.nn as nn from models.base.base_blocks import BaseBranch, Base...
code_fim
hard
{ "lang": "python", "repo": "hrb518/EssentialMC2", "path": "/papers/pytorch-video-understanding/models/module_zoo/branches/r2d3d_branch.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, x): if self.transformation == 'simple_block': x = self.a(x) x = self.a_bn(x) x = self.a_relu(x) x = self.b(x) x = self.b_bn(x) return x elif self.transformation == 'bottleneck': ...
code_fim
hard
{ "lang": "python", "repo": "hrb518/EssentialMC2", "path": "/papers/pytorch-video-understanding/models/module_zoo/branches/r2d3d_branch.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shruti1421/scona path: /scona/__init__.py """ scona ===== scona is a Python package for the analysis of structural covariance brain networks. Website (including documentation):: http://whitakerlab.github.io/scona Source:: https://github.com/WhitakerLab/scona Bug reports:: https://git...
code_fim
medium
{ "lang": "python", "repo": "shruti1421/scona", "path": "/scona/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from scona.wrappers import * from scona.visualisations_helpers import * import scona.datasets from scona import *<|fim_prefix|># repo: shruti1421/scona path: /scona/__init__.py """ scona ===== scona is a Python package for the analysis of structural covariance brain networks. Website (including docume...
code_fim
medium
{ "lang": "python", "repo": "shruti1421/scona", "path": "/scona/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pricem14pc/eq-questionnaire-runner path: /app/routes/session.py from datetime import datetime, timezone from flask import Blueprint, g, jsonify, redirect, request from flask import session as cookie_session from flask import url_for from flask_login import login_required, logout_user from marshm...
code_fim
hard
{ "lang": "python", "repo": "pricem14pc/eq-questionnaire-runner", "path": "/app/routes/session.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @session_blueprint.route("/sign-out", methods=["GET"]) def get_sign_out(): """ Signs the user out of eQ and redirects to the log out url. """ log_out_url = get_survey_config().account_service_log_out_url # Check for GET as we don't want to log out for HEAD requests if request.met...
code_fim
hard
{ "lang": "python", "repo": "pricem14pc/eq-questionnaire-runner", "path": "/app/routes/session.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: silky/Geothon path: /Create Spatial File/Vector/create_wkt_multiline.py #!/usr/bin/env python ''' Project: Geothon (https://github.com/MBoustani/Geothon) File: Vector/create_wkt_multiline.py Description: This code creates a wkt multi lines from some points Author: Maziyar...
code_fim
hard
{ "lang": "python", "repo": "silky/Geothon", "path": "/Create Spatial File/Vector/create_wkt_multiline.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>latitudes = [50, 51, 52, 53] longitudes = [100, 110, 120, 130] elevation = 0 #Create multilines multi_lines = ogr.Geometry(ogr.wkbMultiLineString) #Create first line #define first line geometry line_1 = ogr.Geometry(ogr.wkbLineString) #add points into first line geometry line_1.AddPoint(longitudes[0], l...
code_fim
medium
{ "lang": "python", "repo": "silky/Geothon", "path": "/Create Spatial File/Vector/create_wkt_multiline.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#Create multilines multi_lines = ogr.Geometry(ogr.wkbMultiLineString) #Create first line #define first line geometry line_1 = ogr.Geometry(ogr.wkbLineString) #add points into first line geometry line_1.AddPoint(longitudes[0], latitudes[0], elevation) line_1.AddPoint(longitudes[1], latitudes[1], elevation...
code_fim
medium
{ "lang": "python", "repo": "silky/Geothon", "path": "/Create Spatial File/Vector/create_wkt_multiline.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: andydevs/todo-flask path: /models.py """ To-Do list application Author: Anshul Kharbanda Created: 11 - 10 - 2017 """ from bson.objectid import ObjectId from flask_wtf import FlaskForm from wtforms import StringField class TodoForm(FlaskForm): """ Form for updating To-Do's Author: ...
code_fim
hard
{ "lang": "python", "repo": "andydevs/todo-flask", "path": "/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def save(self, db): """ Saves to mongo database :param db: the mongo database to save to """ # Create new if no id is given if self._id is None: self.collection(db).insert_one( document={'text': self.text}) # Else up...
code_fim
hard
{ "lang": "python", "repo": "andydevs/todo-flask", "path": "/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Else update old else: self.collection(db).update_one( filter={'_id': ObjectId(self._id)}, update={'$set': {'text': self.text}}) def delete(self, db): """ Deletes the todo from the database :param db: the database t...
code_fim
hard
{ "lang": "python", "repo": "andydevs/todo-flask", "path": "/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sniner/rp-recorder path: /rprecorder/recorder.py import logging import pathlib import re import threading from datetime import datetime, timedelta, time from typing import Union import urllib3 from rprecorder import cuesheet log = logging.getLogger(__name__) def _parse_meta(metastr:str): ...
code_fim
hard
{ "lang": "python", "repo": "sniner/rp-recorder", "path": "/rprecorder/recorder.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def record( station:str, streamurl:str, streamtype:str, target_dir:pathlib.Path, end_time:datetime=None, cue_sheet:bool=False, track_list:bool=True, ): def read_block(conn, blocksize): data = b"" while len(data)<blocksize:...
code_fim
hard
{ "lang": "python", "repo": "sniner/rp-recorder", "path": "/rprecorder/recorder.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Calculating the feature tensor. :param args: Arguments object. :param graph: NetworkX graph. :return target_matrices: Target tensor. """ index_1 = [edge[0] for edge in graph.edges()] index_2 = [edge[1] for edge in graph.edges()] values = [1 for edge in graph.edges()...
code_fim
medium
{ "lang": "python", "repo": "kexinxin/Defect", "path": "/GraphEmbedding/attentionWalk/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kexinxin/Defect path: /GraphEmbedding/attentionWalk/utils.py import json import numpy as np import pandas as pd import networkx as nx from tqdm import tqdm from scipy import sparse from texttable import Texttable def read_graph(graph_path): """ Method to read graph and create a target ma...
code_fim
hard
{ "lang": "python", "repo": "kexinxin/Defect", "path": "/GraphEmbedding/attentionWalk/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: plotdevice/plotdevice path: /tests/module.py import os import unittest from . import PlotDeviceTestCase, reference from subprocess import check_output, STDOUT from plotdevice import * sdist_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) class ModuleTests(PlotDeviceTestCase):...
code_fim
hard
{ "lang": "python", "repo": "plotdevice/plotdevice", "path": "/tests/module.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self._image = 'module/cli.png' plod_bin = '%s/app/plotdevice'%sdist_path script = '%s/tests/_in/cli.pv'%sdist_path output = '%s/tests/_out/%s'%(sdist_path, self._image) check_output([plod_bin, script, '--export', output], stderr=STDOUT, cwd=sdist_path) self....
code_fim
hard
{ "lang": "python", "repo": "plotdevice/plotdevice", "path": "/tests/module.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> else: # this is a recovered parser self.particle_class = HydODclRecoveredDataParticle # no config for this parser, pass in empty dict super(HydODclParser, self).__init__({}, stream_handle, ...
code_fim
hard
{ "lang": "python", "repo": "oceanobservatories/mi-instrument", "path": "/mi/dataset/parser/hyd_o_dcl.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: oceanobservatories/mi-instrument path: /mi/dataset/parser/hyd_o_dcl.py """ @package mi.dataset.parser @file mi-dataset/mi/dataset/parser/hyd_o_dcl.py @author Emily Hahn @brief Parser for the hydrogen series o instrument through a dcl """ __author__ = 'Emily Hahn' __license__ = 'Apache 2.0' impor...
code_fim
hard
{ "lang": "python", "repo": "oceanobservatories/mi-instrument", "path": "/mi/dataset/parser/hyd_o_dcl.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> particle = self._extract_sample(self.particle_class, None, data_match, port_timestamp=port_timestamp, ...
code_fim
hard
{ "lang": "python", "repo": "oceanobservatories/mi-instrument", "path": "/mi/dataset/parser/hyd_o_dcl.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if len(answer_word) ==0 or len(masked_word)==0: raise InvalidWordException('Those words are invalid!') if len(answer_word) is not len(masked_word): raise InvalidWordException('Those words are invalid!') if len(character) > 1: raise InvalidGuessedLetterException('also w...
code_fim
hard
{ "lang": "python", "repo": "joetynan/itp-u4-c2-hangman-game", "path": "/hangman/game.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joetynan/itp-u4-c2-hangman-game path: /hangman/game.py from .exceptions import * import random # Complete with your own, just for fun :) LIST_OF_WORDS = ['book','view','quill','interrupt','macabre','marked','snakes','zephyr','behave','drum','blood','plucky'] def _get_random_word(list): if ...
code_fim
hard
{ "lang": "python", "repo": "joetynan/itp-u4-c2-hangman-game", "path": "/hangman/game.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>params=json.loads(data) #type = kind of command ctype = params['type'] jpurl = params['p1']#for ctype 'access' jpurl = ip enurl = params['p2']#for ctype 'access' enurl = country produceid = params['p3'] version = params['p4'] modeid = params['p5'] submodeid = params['p6'] menuid = params['p7'] mac=params...
code_fim
medium
{ "lang": "python", "repo": "iamundeathbird/Apache-cgi-for-qr-reader", "path": "/qrcodeprocess.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iamundeathbird/Apache-cgi-for-qr-reader path: /qrcodeprocess.py #!/usr/bin/python3 import json import sys from databaseprolib import databaseProcess from geolite2 import geolite2 as geo# geolite2 is the lib to get location of ip address print ("Content-Type: text/html\n\n") # connect to the data...
code_fim
medium
{ "lang": "python", "repo": "iamundeathbird/Apache-cgi-for-qr-reader", "path": "/qrcodeprocess.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_dau_filtering(self): sign_up_action, person = self._create_events() with freeze_time('2020-01-02'): Event.objects.create(team=self.team, event='sign up', distinct_id='someone_else') with freeze_time('2020-01-04'): action_response = self.client....
code_fim
hard
{ "lang": "python", "repo": "pulmonesxavier/posthog", "path": "/posthog/api/test/test_action.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulmonesxavier/posthog path: /posthog/api/test/test_action.py r": "div > button", "url": "/signup", "isNew": 'asdf' }] }, content_type='application/json', HTTP_ORIGIN='http://testserver').json() action = Action.objects.get() self...
code_fim
hard
{ "lang": "python", "repo": "pulmonesxavier/posthog", "path": "/posthog/api/test/test_action.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._create_events() # automatically sets first day as first day of any events with freeze_time('2020-01-04'): action_response = self.client.get('/api/action/trends/?date_from=all').json() event_response = self.client.get('/api/action/trends/?date_from=all&...
code_fim
hard
{ "lang": "python", "repo": "pulmonesxavier/posthog", "path": "/posthog/api/test/test_action.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>string = input() ans = permutations(string) for s in ans: print(s)<|fim_prefix|># repo: jarvis-1805/DSAwithPYTHON path: /Recursions/Recursions 3/Return_Permutations_of_a_String.py ''' Return Permutations of a String Given a string, find and return all the possible permutations of the input string. ...
code_fim
hard
{ "lang": "python", "repo": "jarvis-1805/DSAwithPYTHON", "path": "/Recursions/Recursions 3/Return_Permutations_of_a_String.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jarvis-1805/DSAwithPYTHON path: /Recursions/Recursions 3/Return_Permutations_of_a_String.py ''' Return Permutations of a String Given a string, find and return all the possible permutations of the input string. Note : The order of permutations are not important. Sample Input : abc Sample Outp...
code_fim
medium
{ "lang": "python", "repo": "jarvis-1805/DSAwithPYTHON", "path": "/Recursions/Recursions 3/Return_Permutations_of_a_String.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> output = [] for i in temp: for j in range(len(i)+1): smallString = i[:j] + string[0] + i[j:] output.append(smallString) return output string = input() ans = permutations(string) for s in ans: print(s)<|fim_prefix|># repo: jarvis-1805/DSAwithPYTHON pa...
code_fim
hard
{ "lang": "python", "repo": "jarvis-1805/DSAwithPYTHON", "path": "/Recursions/Recursions 3/Return_Permutations_of_a_String.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: module = __import__('courant.core.assets.filter.%s' % name, {}, {}, ['']) except ImportError: raise ValueError('Filter "%s" is not valid' % name) return module<|fim_prefix|># repo: din982/Courant-News path: /courant/core/assets/filter/__in...
code_fim
easy
{ "lang": "python", "repo": "din982/Courant-News", "path": "/courant/core/assets/filter/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: din982/Courant-News path: /courant/core/assets/filter/__init__.py # Assets can be filtered through one or multiple filters, modifying their # contents (think minification, compression). <|fim_suffix|> try: module = __import__('courant.core.assets.filter.%s' % name, ...
code_fim
easy
{ "lang": "python", "repo": "din982/Courant-News", "path": "/courant/core/assets/filter/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def run_spamp(request_json): """ The base formulation for "pamp". Typically used for unconstrained facility location or job assignment. This creates a light weight way to solve the p-median problem. The same input requirements hold as for "run_pamp" #TODO: consolidate formulatio...
code_fim
hard
{ "lang": "python", "repo": "fhk/link_src", "path": "/link/solve/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fhk/link_src path: /link/solve/main.py """ Run the main solver interface """ import os from link.solve.util import ( geojson_to_graph, make_prox_graph, make_assi_graph, make_tb_objects, match_solution, create_geojson, make_o_graph, ...
code_fim
hard
{ "lang": "python", "repo": "fhk/link_src", "path": "/link/solve/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Task fields = ['name']<|fim_prefix|># repo: djworth/pugip-todo path: /todo/forms.py from django.forms import Form, CharField, ModelForm from todo.models import Task <|fim_middle|>class TodoForm(ModelForm): class Meta:
code_fim
easy
{ "lang": "python", "repo": "djworth/pugip-todo", "path": "/todo/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: djworth/pugip-todo path: /todo/forms.py from django.forms import Form, CharField, ModelForm from todo.models import Task <|fim_suffix|> class Meta: model = Task fields = ['name']<|fim_middle|>class TodoForm(ModelForm):
code_fim
easy
{ "lang": "python", "repo": "djworth/pugip-todo", "path": "/todo/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kenpkz/gcp-continuous-compliance-demo path: /continuous-compliance-demo-scc/cloudfunction_remedy.py import json import base64 import google.auth import google.auth.transport.requests from google.cloud import compute_v1 def ssh_remedy(event, context): <|fim_suffix|> """ Copy and paste these modul...
code_fim
hard
{ "lang": "python", "repo": "kenpkz/gcp-continuous-compliance-demo", "path": "/continuous-compliance-demo-scc/cloudfunction_remedy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>""" Copy and paste these modules for the requirements.txt google-auth google-cloud-compute """<|fim_prefix|># repo: kenpkz/gcp-continuous-compliance-demo path: /continuous-compliance-demo-scc/cloudfunction_remedy.py import json import base64 import google.auth import google.auth.transport.requests from...
code_fim
hard
{ "lang": "python", "repo": "kenpkz/gcp-continuous-compliance-demo", "path": "/continuous-compliance-demo-scc/cloudfunction_remedy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> _inherit = "mail.thread" @api.model def mailgun_fetch_message(self, message_url): api_key = self.env["ir.config_parameter"].sudo().get_param("mailgun.apikey") res = requests.get( message_url, headers={"Accept": "message/rfc2822"}, auth=("api...
code_fim
medium
{ "lang": "python", "repo": "SDIsl/mail-addons", "path": "/mailgun/models/mail_thread.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SDIsl/mail-addons path: /mailgun/models/mail_thread.py import logging import requests from odoo import api, models _logger = logging.getLogger(__name__) <|fim_suffix|> @api.model def mailgun_fetch_message(self, message_url): api_key = self.env["ir.config_parameter"].sudo().get...
code_fim
medium
{ "lang": "python", "repo": "SDIsl/mail-addons", "path": "/mailgun/models/mail_thread.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> api_key = self.env["ir.config_parameter"].sudo().get_param("mailgun.apikey") res = requests.get( message_url, headers={"Accept": "message/rfc2822"}, auth=("api", api_key), verify=False, ) self.message_process(False, res.json()...
code_fim
medium
{ "lang": "python", "repo": "SDIsl/mail-addons", "path": "/mailgun/models/mail_thread.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rakshith291/ResNet_Tensorflow path: /main.py from model import ResNet from data import DataGenerator from tensorflow.keras.layers import Layer <|fim_suffix|> data = DataGenerator() train_gen = data.train_data('path') valid_gen = data.test_data('/path') model = ResNet(3) print(...
code_fim
easy
{ "lang": "python", "repo": "rakshith291/ResNet_Tensorflow", "path": "/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> data = DataGenerator() train_gen = data.train_data('path') valid_gen = data.test_data('/path') model = ResNet(3) print(ResNet(3).model().summary()) model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=["accuracy"]) model.fit_generator(train_gen, validation_d...
code_fim
easy
{ "lang": "python", "repo": "rakshith291/ResNet_Tensorflow", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Validate that the provided email is not considered a "burner" domain, e.g. someone not interested in committing and contributing to the community or the ability to recover their account.""" if '@' not in email: return email, domain = email.split('@') try: BurnerD...
code_fim
medium
{ "lang": "python", "repo": "NDevox/website", "path": "/app/marketing/validators.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NDevox/website path: /app/marketing/validators.py from django.forms import ValidationError from django.utils.translation import gettext as _ <|fim_suffix|>def validate_not_burner_domain(email: str): """Validate that the provided email is not considered a "burner" domain, e.g. someone not...
code_fim
medium
{ "lang": "python", "repo": "NDevox/website", "path": "/app/marketing/validators.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Create rules file build_config_cmake(cmake_opts=["-DBUILD_PYTHON=ON"]) install_usr_dir_to_package("usr/include", "dev") install_usr_dir_to_package("usr/CMake", "dev") install_usr_dir_to_package("usr/lib/python2.7", "python") build_config["configure"].append( "echo 'add_definitions(\"-std=gnu++11\")'...
code_fim
hard
{ "lang": "python", "repo": "ulikoehler/deb-buildscripts", "path": "/deb-opengv.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>#Create the changelog (no messages - dummy) create_dummy_changelog() # Create rules file build_config_cmake(cmake_opts=["-DBUILD_PYTHON=ON"]) install_usr_dir_to_package("usr/include", "dev") install_usr_dir_to_package("usr/CMake", "dev") install_usr_dir_to_package("usr/lib/python2.7", "python") build_con...
code_fim
medium
{ "lang": "python", "repo": "ulikoehler/deb-buildscripts", "path": "/deb-opengv.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ulikoehler/deb-buildscripts path: /deb-opengv.py #!/usr/bin/env python3 from deblib import * # General config set_name("libopengv") set_homepage("https://github.com/laurentkneip/opengv") #Download it git_clone("https://github.com/laurentkneip/opengv.git") set_version("1.0", gitcount=True) add_ver...
code_fim
hard
{ "lang": "python", "repo": "ulikoehler/deb-buildscripts", "path": "/deb-opengv.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ascend/ModelZoo-PyTorch path: /PyTorch/dev/cv/image_classification/DeepLab-CRF_ID1873_for_PyTorch/hubconf.py #!/usr/bin/env python # coding: utf-8 # # BSD 3-Clause License # # Copyright (c) 2017 xxxx # All rights reserved. # Copyright 2021 Huawei Technologies Co., Ltd # # Redistribution and use i...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/dev/cv/image_classification/DeepLab-CRF_ID1873_for_PyTorch/hubconf.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert pretrained in model_dict, list(model_dict.keys()) expected = model_dict[pretrained][1] error_message = "Expected: n_classes={}".format(expected) assert n_classes == expected, error_message model_url = model_url_root + model_dict[pretrained][0] state_...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/dev/cv/image_classification/DeepLab-CRF_ID1873_for_PyTorch/hubconf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from torch.hub import load_state_dict_from_url import torch.npu import os NPU_CALCULATE_DEVICE = 0 if os.getenv('NPU_CALCULATE_DEVICE') and str.isdigit(os.getenv('NPU_CALCULATE_DEVICE')): NPU_CALCULATE_DEVICE = int(os.getenv('NPU_CALCULATE_DEVICE')) if torch.npu.current_device() != NPU_CALCULATE_DEVIC...
code_fim
hard
{ "lang": "python", "repo": "Ascend/ModelZoo-PyTorch", "path": "/PyTorch/dev/cv/image_classification/DeepLab-CRF_ID1873_for_PyTorch/hubconf.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self, to_ckpt, index, is_latest = False): ckpt_str = 'latest_' if is_latest else '' ckpt_loc = os.path.join(self.checkpoint_dir, '{}{}.pth'.format(ckpt_str, index)) # remove the previous if it is the latest if is_latest: for fnam...
code_fim
hard
{ "lang": "python", "repo": "kshen6/byol-pytorch", "path": "/research_tools/store/writer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kshen6/byol-pytorch path: /research_tools/store/writer.py ''' Class for writing experimental logs. ''' import pandas as pd import os import pickle from datetime import datetime from ..utils.metric import create_metric import torch from .dir_utils import get_latest_run_id class ExperimentLogWr...
code_fim
hard
{ "lang": "python", "repo": "kshen6/byol-pytorch", "path": "/research_tools/store/writer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # remove the previous if it is the latest if is_latest: for fname in os.listdir(self.checkpoint_dir): if 'latest_' in fname: os.remove(os.path.join(self.checkpoint_dir, fname)) torch.save(to_ckpt, ckpt_loc) def save_tensor(self,...
code_fim
hard
{ "lang": "python", "repo": "kshen6/byol-pytorch", "path": "/research_tools/store/writer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # In[6]: # Lets further clean up the list to seperate Usernames from age # Use list comprehension to replace the last brace ")" with empty "" in member_found above member_found_replaced = [x.replace(")", "") for x in member_found] # replaces ")" by "" print (member_found_replaced) # In[...
code_fim
hard
{ "lang": "python", "repo": "forum2k9/Nairaland-Christmas-Birthday", "path": "/Nairaland_Xmas_Birthdays.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: forum2k9/Nairaland-Christmas-Birthday path: /Nairaland_Xmas_Birthdays.py # coding: utf-8 # The original blog post for this notebook is at: https://umar-yusuf.blogspot.com.ng/2016/12/nairaland-christmas-birthday-analyzed.html # In[1]: # import the libraries we are going to use # libraries for S...
code_fim
hard
{ "lang": "python", "repo": "forum2k9/Nairaland-Christmas-Birthday", "path": "/Nairaland_Xmas_Birthdays.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> member_found_replaced = [x.replace(")", "") for x in member_found] # replaces ")" by "" print (member_found_replaced) # In[7]: # Now split "member_found_replaced" based on '(' between the usernames and age # we use for loop to loop through each item of the "member_found_replaced" list abov...
code_fim
hard
{ "lang": "python", "repo": "forum2k9/Nairaland-Christmas-Birthday", "path": "/Nairaland_Xmas_Birthdays.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: virtuNat/aoc-12020 path: /src-python/day17.py #!/usr/bin/env python import numpy as np from scipy.signal import correlate from aoc import get_input def automata(grid, dims): grid = np.pad(np.expand_dims(grid, tuple(range(2, dims))), 6) mask = np.ones((3,) * dims, dtype=int) mask[(1,)...
code_fim
medium
{ "lang": "python", "repo": "virtuNat/aoc-12020", "path": "/src-python/day17.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(automata(grid, 3)) # 1 print(automata(grid, 4)) # 2 if __name__ == '__main__': main()<|fim_prefix|># repo: virtuNat/aoc-12020 path: /src-python/day17.py #!/usr/bin/env python import numpy as np from scipy.signal import correlate from aoc import get_input def automata(grid, dims): <|fi...
code_fim
hard
{ "lang": "python", "repo": "virtuNat/aoc-12020", "path": "/src-python/day17.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> grid = np.pad(np.expand_dims(grid, tuple(range(2, dims))), 6) mask = np.ones((3,) * dims, dtype=int) mask[(1,)*dims] = 0 for _ in range(6): conv = correlate(grid, mask, 'same') grid[(conv < 2) | (conv > 3)] = 0 grid[conv == 3] = 1 return grid.sum() def main(): ...
code_fim
medium
{ "lang": "python", "repo": "virtuNat/aoc-12020", "path": "/src-python/day17.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> buttons = [ Color.button_secondary(cancel, focus_map='button_secondary focus') ] return Pile(buttons) def build_menuable_items(self): """ Builds a list of bundles available to install """ cols = [] for bundle in app.bundles: ...
code_fim
hard
{ "lang": "python", "repo": "conjure-up/conjure-up", "path": "/conjureup/ui/views/variant.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self._w.body.focus_position == 2: self._w.body.focus_position = 4 else: self._w.body.focus_position = 2 def keypress(self, size, key): if key in ['tab', 'shift tab']: self._swap_focus() return super().keypress(size, key) def ...
code_fim
hard
{ "lang": "python", "repo": "conjure-up/conjure-up", "path": "/conjureup/ui/views/variant.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: conjure-up/conjure-up path: /conjureup/ui/views/variant.py from __future__ import unicode_literals from ubuntui.ev import EventLoop from ubuntui.utils import Color, Padding from ubuntui.widgets.buttons import menu_btn, quit_btn from urwid import Columns, Filler, Pile, Text, WidgetWrap from conj...
code_fim
hard
{ "lang": "python", "repo": "conjure-up/conjure-up", "path": "/conjureup/ui/views/variant.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SamueleMeta/optimal_is path: /examples/util.py """Running utilities.""" import importlib import yaml from gym.envs import registry from rllib.environment import GymEnvironment from rllib.util.training.agent_training import evaluate_agent, train_agent from rllib.util.utilities import RewardTrans...
code_fim
hard
{ "lang": "python", "repo": "SamueleMeta/optimal_is", "path": "/examples/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Train agent.""" train_agent( agent=agent, environment=environment, num_episodes=args.num_train, max_steps=args.max_steps, eval_frequency=args.eval_frequency, print_frequency=args.print_frequency, render=args.render_train, ) def evalu...
code_fim
hard
{ "lang": "python", "repo": "SamueleMeta/optimal_is", "path": "/examples/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LucaMalavolta/PyORBIT path: /pyorbit/pyorbit_results.py import pyorbit import argparse import sys def pyorbit_results(): # print 'This program is being run by itself' parser = argparse.ArgumentParser(prog='PyORBIT_GetResults.py', description='PyDE+emcee runner') parser.add_argument...
code_fim
hard
{ "lang": "python", "repo": "LucaMalavolta/PyORBIT", "path": "/pyorbit/pyorbit_results.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if args.all_corners is not False: plot_dictionary['full_correlation'] = True plot_dictionary['common_corner'] = True plot_dictionary['dataset_corner'] = True if args.noacf is not False: plot_dictionary['print_acf'] = False plot_dictionary['plot_acf'] = Fals...
code_fim
hard
{ "lang": "python", "repo": "LucaMalavolta/PyORBIT", "path": "/pyorbit/pyorbit_results.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- x_tst: features of testing data model: trained learning model """ predictions = model.predict(x_tst) return predictions def write_output(predictions): order = np.arange(1, 81) order.shape = (80, 1) predictions.shape = (80, 1) pred = np...
code_fim
hard
{ "lang": "python", "repo": "aycagokdag/BrainNet-ML-ToolBox", "path": "/Team 11/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ The method predicts labels for testing data samples by using trained learning model. Parameters ---------- x_tst: features of testing data model: trained learning model """ predictions = model.predict(x_tst) return predictions def write_output(predictions): ...
code_fim
hard
{ "lang": "python", "repo": "aycagokdag/BrainNet-ML-ToolBox", "path": "/Team 11/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aycagokdag/BrainNet-ML-ToolBox path: /Team 11/main.py """ Target Problem: --------------- * A classifier for the diagnosis of Autism Spectrum Disorder (ASD) Proposed Solution (Machine Learning Pipeline): ---------------------------------------------- * SelectKBest Algorithm -> Adaptive Boosting ...
code_fim
hard
{ "lang": "python", "repo": "aycagokdag/BrainNet-ML-ToolBox", "path": "/Team 11/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tejasmanohar/viper path: /viper/optimizer.py from viper.parser.parser_utils import LLLnode from viper.utils import LOADED_LIMIT_MAP def get_int_at(args, pos, signed=False): value = args[pos].value if isinstance(value, int): o = value elif value == "mload" and args[pos].args...
code_fim
hard
{ "lang": "python", "repo": "tejasmanohar/viper", "path": "/viper/optimizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def optimize(node): argz = [optimize(arg) for arg in node.args] if node.value in arith and int_at(argz, 0) and int_at(argz, 1): left, right = get_int_at(argz, 0), get_int_at(argz, 1) calcer, symb = arith[node.value] new_value = calcer(left, right) if argz[0].annota...
code_fim
hard
{ "lang": "python", "repo": "tejasmanohar/viper", "path": "/viper/optimizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> clusteredBars.xTickLabels = ["A", "B", "C", "D", "E"] plot = Plot() plot.add(clusteredBars) plot.hasLegend() plot.save(self.imageName) ImageComparisonTestCase.register(ClusteredBarsTest) if __name__ == "__main__": test = ClusteredBarsTest("testImageCompariso...
code_fim
hard
{ "lang": "python", "repo": "alexras/boomslang", "path": "/tests/test_clusteredbars.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexras/boomslang path: /tests/test_clusteredbars.py #!/usr/bin/env python from boomslang import Bar, ClusteredBars, Plot import unittest from ImageComparisonTestCase import ImageComparisonTestCase class ClusteredBarsTest(ImageComparisonTestCase, unittest.TestCase): def __init__(self, testCa...
code_fim
hard
{ "lang": "python", "repo": "alexras/boomslang", "path": "/tests/test_clusteredbars.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> bar1 = Bar() bar1.xValues = range(5) bar1.yValues = [2, 4, 6, 8, 10] bar1.color = "red" bar1.label = "Red Cluster" bar2 = Bar() bar2.xValues = range(5) bar2.yValues = [3, 12, 4, 8, 14] bar2.color = "blue" bar2.label = "Blue C...
code_fim
medium
{ "lang": "python", "repo": "alexras/boomslang", "path": "/tests/test_clusteredbars.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Royelrani/OVOS-local-backend path: /ovos_local_backend/backend/device.py # 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.apache.org/licenses/LICENSE-2.0...
code_fim
hard
{ "lang": "python", "repo": "Royelrani/OVOS-local-backend", "path": "/ovos_local_backend/backend/device.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> token = request.json["state"] device = {"uuid": "AnonDevice", "expires_at": time.time() + 72000, "accessToken": token, "refreshToken": token} return nice_json(device) @app.route("/" + API_VERSION + "/device/<uuid>/message",...
code_fim
hard
{ "lang": "python", "repo": "Royelrani/OVOS-local-backend", "path": "/ovos_local_backend/backend/device.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gkskillz/karenanderic path: /web/app/models.py from google.appengine.ext import ndb class Invitation(ndb.Model): code = ndb.StringProperty() @classmethod def query_code(cls, code): return cls.query(cls.code == code).get() class Guest(ndb.Model): first_name = ndb.Strin...
code_fim
hard
{ "lang": "python", "repo": "gkskillz/karenanderic", "path": "/web/app/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for rsvp in self.guest_rsvps: if rsvp.rsvp == NO_RSVP: continue if rsvp.is_extra and not rsvp.name: continue if rsvp.meal_choice is None: return False return True def add_empty_extras(self, location): ...
code_fim
hard
{ "lang": "python", "repo": "gkskillz/karenanderic", "path": "/web/app/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: afmsaif/Exploiting-Cascaded-Ensemble-of-Features-for-the-Detection-of-Tuberculosis-from-Chest-Radiographs path: /inceptionv3.py #from keras.preprocessing import image from tensorflow.keras.models import Model #from keras.layers import Dense, GlobalAveragePooling2D #from keras import backend as K...
code_fim
hard
{ "lang": "python", "repo": "afmsaif/Exploiting-Cascaded-Ensemble-of-Features-for-the-Detection-of-Tuberculosis-from-Chest-Radiographs", "path": "/inceptionv3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>model.compile(loss='binary_crossentropy', optimizer=opt, metrics= METRICS, ) datagen.fit(X_train) datagen_val.fit(X_val) #model.fit(X_train, y_train, batch_size= 50, epochs=200, validation_...
code_fim
hard
{ "lang": "python", "repo": "afmsaif/Exploiting-Cascaded-Ensemble-of-Features-for-the-Detection-of-Tuberculosis-from-Chest-Radiographs", "path": "/inceptionv3.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def main(argv): parser = argparse.ArgumentParser(description='Xpath Eval Function') parser.add_argument('-f','--file', help='XML file', required=True) parser.add_argument('-x','--xpath', help='Xpath Query', required=True) args = vars(parser.parse_args()) res = xpath_eval(args['file'], ...
code_fim
hard
{ "lang": "python", "repo": "dadhichmohit/notes", "path": "/scripts/xpath.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }