text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: MTS-Strathclyde/python-mm-scripts path: /scripts_old/mikro_scripts/PythonScripts/fit_fix.py #!/usr/bin/python # -*- coding: utf-8 -*- """ Created on Fri Apr 12 16:38:15 2013 @author: a92549 Fixes lack of / between tzvp and tzvpfit """ <|fim_suffix|> for com in argv: with open(com,...
code_fim
medium
{ "lang": "python", "repo": "MTS-Strathclyde/python-mm-scripts", "path": "/scripts_old/mikro_scripts/PythonScripts/fit_fix.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for com in argv: with open(com, 'rb') as f: txt = f.read() if 'tzvp tzvpfit' in txt: parts = txt.split('tzvp tzvpfit',1) new_txt = parts[0] + 'tzvp/tzvpfit' + parts[1] with open(com, 'wb') as f: f.write(new_txt) el...
code_fim
medium
{ "lang": "python", "repo": "MTS-Strathclyde/python-mm-scripts", "path": "/scripts_old/mikro_scripts/PythonScripts/fit_fix.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexeyBond/old-python-game-fwk path: /util/test_rect.py # coding=UTF-8 from unittest import TestCase from fwk.util.rect import Rect class RectSizeTest(TestCase): def test_sizes_from_coords(self): rect = Rect(top=33,bottom=22,left=10,right=20) self.assertEqual(rect.width,10) self.assertEq...
code_fim
hard
{ "lang": "python", "repo": "AlexeyBond/old-python-game-fwk", "path": "/util/test_rect.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_inset_with_underflow(self): self.rect.inset(51) self.assertEqual(self.rect.bottom,150) self.assertEqual(self.rect.height,0) self.assertEqual(self.rect.left,15) self.assertEqual(self.rect.width,0) class RectCloneAndMagic(TestCase): def test_clone_and_compare(self): rect1 = Rect(left...
code_fim
hard
{ "lang": "python", "repo": "AlexeyBond/old-python-game-fwk", "path": "/util/test_rect.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @_Proveedor.route('/deleteP/<string:id>',methods=['GET','POST']) def deleteP(id=None): dlTP = Proveedor.query.filter_by(CI=id).first() db.session.delete(dlTP) db.session.commit() return redirect(url_for('Proveedor.listaP')) @_Proveedor.route("/modalP") def modalP(): frm = form.Fr_Pr...
code_fim
hard
{ "lang": "python", "repo": "bmiomi/Web", "path": "/App/Modulos/Proveedor/controllers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmiomi/Web path: /App/Modulos/Proveedor/controllers.py #Importacion de Dependencias Flask from flask import Blueprint,Flask, render_template, request,redirect,url_for,flash #modelado de basedato. from App import db # Importacion de modulo de ModeloCliente from App.Modulos.Proveedor.model import P...
code_fim
hard
{ "lang": "python", "repo": "bmiomi/Web", "path": "/App/Modulos/Proveedor/controllers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if client is None: client = memcache.Client() self.client = client self.prefix = prefix def open_session(self, app, request): sid = request.args.get("sessionid", None) or request.cookies.get(app.session_cookie_name) if not sid: sid = sel...
code_fim
hard
{ "lang": "python", "repo": "allan852/xiaoli", "path": "/xiaoli/extensions/memcache_session.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: allan852/xiaoli path: /xiaoli/extensions/memcache_session.py # encoding = utf-8 """ A flask session memcached store """ from datetime import timedelta, datetime from uuid import uuid4 __author__ = 'zou' import memcache import pickle from flask.sessions import SessionMixin, SessionInterface from ...
code_fim
hard
{ "lang": "python", "repo": "allan852/xiaoli", "path": "/xiaoli/extensions/memcache_session.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: snlnrush/python-basics-and-application path: /3.3-task-2.py """ Вам дана последовательность строк. В каждой строке замените все вхождения нескольких одинаковых букв на одну букву. Буквой считается символ из группы \w. Sample Input: attraction buzzzz Sample Output: <|fim_suffix|>for word in stdi...
code_fim
easy
{ "lang": "python", "repo": "snlnrush/python-basics-and-application", "path": "/3.3-task-2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>atraction buz """ from sys import stdin import re for word in stdin: lst_in = word match = re.finditer(r'(\w)\1+', lst_in) for item in match: lst_in = lst_in.replace(item[0], item[0][0]) print(lst_in, end='')<|fim_prefix|># repo: snlnrush/python-basics-and-application path: /3.3-...
code_fim
easy
{ "lang": "python", "repo": "snlnrush/python-basics-and-application", "path": "/3.3-task-2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for word in stdin: lst_in = word match = re.finditer(r'(\w)\1+', lst_in) for item in match: lst_in = lst_in.replace(item[0], item[0][0]) print(lst_in, end='')<|fim_prefix|># repo: snlnrush/python-basics-and-application path: /3.3-task-2.py """ Вам дана последовательность строк. В ...
code_fim
medium
{ "lang": "python", "repo": "snlnrush/python-basics-and-application", "path": "/3.3-task-2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: raj2sudha1/pentest_python_training path: /4/basic_sniffer.py import socket # Packet Sniffing # It's All Binary <|fim_suffix|># make sure that the IP header is included sniffer.setsockopt(socket.IPPROTO_IP,socket.IP_HDRINCL,1) print 'sniffer is listening for incomming connections' # get a sing...
code_fim
hard
{ "lang": "python", "repo": "raj2sudha1/pentest_python_training", "path": "/4/basic_sniffer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print 'sniffer is listening for incomming connections' # get a single packet print sniffer.recvfrom(65535)<|fim_prefix|># repo: raj2sudha1/pentest_python_training path: /4/basic_sniffer.py import socket # Packet Sniffing # It's All Binary # Usage: python basic_sniffer.py <|fim_middle|># create the s...
code_fim
hard
{ "lang": "python", "repo": "raj2sudha1/pentest_python_training", "path": "/4/basic_sniffer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># get a single packet print sniffer.recvfrom(65535)<|fim_prefix|># repo: raj2sudha1/pentest_python_training path: /4/basic_sniffer.py import socket # Packet Sniffing # It's All Binary # Usage: python basic_sniffer.py # create the sniffer raw socket object sniffer = socket.socket(socket.AF_INET,socket...
code_fim
medium
{ "lang": "python", "repo": "raj2sudha1/pentest_python_training", "path": "/4/basic_sniffer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> rows, columns = len(grid), len(grid[0]) queue = [((i, j), 0)] directions = [[0, 1], [0, -1], [1, 0], [-1, 0]] visited = [[-1 for _ in range(columns)] for _ in range(rows)] while queue: (x, y), step = queue.pop() visited[x][y] = step for direction in directions: ...
code_fim
hard
{ "lang": "python", "repo": "smartinsert/CodingProblem", "path": "/amazon/treasure_island_with_entry.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if not len(grid) or not len(grid[0]): return -1 minimum_steps = math.inf for i in range(len(grid)): for j in range(len(grid[i])): if grid[i][j] == 'S': minimum_steps = min(minimum_steps, find_treasure_util(grid, i, j)) return minimum_steps if _...
code_fim
hard
{ "lang": "python", "repo": "smartinsert/CodingProblem", "path": "/amazon/treasure_island_with_entry.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: smartinsert/CodingProblem path: /amazon/treasure_island_with_entry.py """ You have a map that marks the locations of treasure islands. Some of the map area has jagged rocks and dangerous reefs. Other areas are safe to sail in. There are other explorers trying to find the treasure. So you must fig...
code_fim
hard
{ "lang": "python", "repo": "smartinsert/CodingProblem", "path": "/amazon/treasure_island_with_entry.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for i in l: card[i-a]+=1 for j in v: if ((j>=a)&(j<=b)): print(card[j-a],end = " ") else: print(0, end = " ")<|fim_prefix|># repo: redlion0929/baekjoon---2020-winter path: /class2/10816.py import sys n = int(sys.stdin.readline().rstrip()) l = list(map(int,sys.stdin.readline()...
code_fim
medium
{ "lang": "python", "repo": "redlion0929/baekjoon---2020-winter", "path": "/class2/10816.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: redlion0929/baekjoon---2020-winter path: /class2/10816.py import sys n = int(sys.stdin.readline().rstrip()) l = list(map(int,sys.stdin.readline().rstrip().split())) m = int(sys.stdin.readline().rstrip()) v = list(map(int,sys.stdin.readline().rstrip().split())) card = [0] * (max(l)-min(l)+1) <|...
code_fim
easy
{ "lang": "python", "repo": "redlion0929/baekjoon---2020-winter", "path": "/class2/10816.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tdude92/Ocular-Aid path: /Digital-Wellbeing/Digital-Wellbeing/check_face.py import cv2 import sys # Load the Haar cascades face_cascade = cv2.CascadeClassifier('./haar_cascades/haarcascade_frontalface_default.xml') eyes_cascade = cv2.CascadeClassifier('./haar_cascades/haarcascade_eye.xml') <|fi...
code_fim
medium
{ "lang": "python", "repo": "tdude92/Ocular-Aid", "path": "/Digital-Wellbeing/Digital-Wellbeing/check_face.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>faces = face_cascade.detectMultiScale(gray, 1.3, 5) if len(faces) >= 1: sys.stdout.write("1") else: sys.stdout.write("0")<|fim_prefix|># repo: tdude92/Ocular-Aid path: /Digital-Wellbeing/Digital-Wellbeing/check_face.py import cv2 import sys # Load the Haar cascades face_cascade = cv2.CascadeClas...
code_fim
easy
{ "lang": "python", "repo": "tdude92/Ocular-Aid", "path": "/Digital-Wellbeing/Digital-Wellbeing/check_face.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: qiangzi11hao/MIT-Introduction-to-Algorithm path: /Lesson3 Insertion sort, merge sort/ps2/circuit/Query.py # import sys # class PriorityQueue: # """Array-based priority queue implementation.""" # # def __init__(self): # """Initially empty priority queue.""" # self.queue = [...
code_fim
hard
{ "lang": "python", "repo": "qiangzi11hao/MIT-Introduction-to-Algorithm", "path": "/Lesson3 Insertion sort, merge sort/ps2/circuit/Query.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def min(self): """Returns the smallest element in the queue.""" return self.heap[1] def pop(self): """Removes the minimum element in the queue. Returns: The value of the removed element. """ heap = self.heap popped_key = heap[1]...
code_fim
hard
{ "lang": "python", "repo": "qiangzi11hao/MIT-Introduction-to-Algorithm", "path": "/Lesson3 Insertion sort, merge sort/ps2/circuit/Query.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if not get_auth_manager().is_logged_in(): roles = user.roles else: if (permissions.ACTION_CAN_EDIT in user_actions and self.can_edit_all_dags(user)) or ( permissions.ACTION_CAN_READ in user_actions and self.can_read_all_dags(user) ): ...
code_fim
hard
{ "lang": "python", "repo": "apache/airflow", "path": "/airflow/www/security.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Checks if user has read or write access to some dags.""" if dag_id and dag_id != "~": root_dag_id = self._get_root_dag_id(dag_id) return self.has_access(action, permissions.resource_name_for_dag(root_dag_id)) user = g.user if action == permission...
code_fim
hard
{ "lang": "python", "repo": "apache/airflow", "path": "/airflow/www/security.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/airflow path: /airflow/www/security.py ermissions.RESOURCE_DAG_RUN), (permissions.ACTION_CAN_DELETE, permissions.RESOURCE_DAG_RUN), ] # [END security_user_perms] # [START security_op_perms] OP_PERMISSIONS = [ (permissions.ACTION_CAN_READ, permissions.RESOUR...
code_fim
hard
{ "lang": "python", "repo": "apache/airflow", "path": "/airflow/www/security.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: maugier/timelapse path: /sliders.py import datetime import logging import random import transform import timelapse # merge two iterators producing sorted values def merge(s1, s2): try: x1 = next(s1) except StopIteration: yield from s2 return try: x2 =...
code_fim
hard
{ "lang": "python", "repo": "maugier/timelapse", "path": "/sliders.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def on_lapsed_message(self, msg): if isinstance(msg, transform.Transform): self.sliders_transform = msg self.connection.privmsg(self.lapsed_channel, "\x01ACTION s'ouvre vers un monde parallèle peuplé de jumeaux " + msg.name + "\x01") ...
code_fim
hard
{ "lang": "python", "repo": "maugier/timelapse", "path": "/sliders.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#Clearly variables can be manipulated easily, #this can make them very useful<|fim_prefix|># repo: huezune2000/Learn-Python-Offline path: /PYTHON/Learn Python/Level_0/4) Variable 2.py #### #Some more on variables #### #Variables are easily redefined. <|fim_middle|>#Let's start simple. x=2 #x is going...
code_fim
hard
{ "lang": "python", "repo": "huezune2000/Learn-Python-Offline", "path": "/PYTHON/Learn Python/Level_0/4) Variable 2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: huezune2000/Learn-Python-Offline path: /PYTHON/Learn Python/Level_0/4) Variable 2.py #### #Some more on variables #### #Variables are easily redefined. <|fim_suffix|>#Clearly variables can be manipulated easily, #this can make them very useful<|fim_middle|>#Let's start simple. x=2 #x is going...
code_fim
hard
{ "lang": "python", "repo": "huezune2000/Learn-Python-Offline", "path": "/PYTHON/Learn Python/Level_0/4) Variable 2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fig1_result=self.fig1(lime_all,lime_n,ubiq,pheno,exp_data,cli,usa,save_path) # print(multiple[0]) # print(single[0],single[1]) def fig1(self,lime_all,lime_n,ubiq,pheno,exp_data,cli,save_path): lime_all=lime_all lime_n=lime_n ubiq=u...
code_fim
hard
{ "lang": "python", "repo": "Arszr/baiyinyun", "path": "/function/Ubiquitination.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # save_path=save_path+'Fig2/' # if not os.path.exists(save_path): # os.makedirs(save_path) r=robjects.r # 加载差异分析文件 r.source('./web_app/script/GeneSurvivalModel/Heatmap.r') result={ 'code':2, } return re...
code_fim
hard
{ "lang": "python", "repo": "Arszr/baiyinyun", "path": "/function/Ubiquitination.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Arszr/baiyinyun path: /function/Ubiquitination.py import rpy2.robjects as robjects from rpy2.robjects.packages import importr # print(robjects.__file__) import sys sys.path.append('./') import importlib import json import os from web_app.function.WordCould import word_img # importlib.reload(sys) ...
code_fim
hard
{ "lang": "python", "repo": "Arszr/baiyinyun", "path": "/function/Ubiquitination.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> from .main import main as main_blueprint app.register_blueprint(main_blueprint) db.init_app(app) return app<|fim_prefix|># repo: yanglinzhen/python-web path: /python-web/app/__init__.py from flask import Flask from flask_sqlalchemy import SQLAlchemy from config import config import os ...
code_fim
medium
{ "lang": "python", "repo": "yanglinzhen/python-web", "path": "/python-web/app/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> app = Flask(__name__, static_folder=static_file_dir) app.config.from_object(config[config_name]) config[config_name].init_app(app) from .main import main as main_blueprint app.register_blueprint(main_blueprint) db.init_app(app) return app<|fim_prefix|># repo: yanglinzhen/pyth...
code_fim
medium
{ "lang": "python", "repo": "yanglinzhen/python-web", "path": "/python-web/app/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yanglinzhen/python-web path: /python-web/app/__init__.py from flask import Flask from flask_sqlalchemy import SQLAlchemy from config import config import os db = SQLAlchemy() <|fim_suffix|>def create_app(config_name): app = Flask(__name__, static_folder=static_file_dir) app.config.from...
code_fim
medium
{ "lang": "python", "repo": "yanglinzhen/python-web", "path": "/python-web/app/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Revenue-Academy/Tax_Microsimulation path: /app_pit_charts.py """ app_dist_Tables00.py illustrates use of pitaxcalc-demo release 2.0.0 (India version). USAGE: python app_dist_Tables00.py """ import pandas as pd from taxcalc import * import numpy as np from babel.numbers import format_curre...
code_fim
hard
{ "lang": "python", "repo": "Revenue-Academy/Tax_Microsimulation", "path": "/app_pit_charts.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> year = 2020 df_pitax_tot = df['pitax_total_ref_'+str(year)] df_pitax_tot = df_pitax_tot[:-1] df_pitax_tot = df_pitax_tot[2:] df_pitax_tot = df_pitax_tot.reset_index() pitax_inc_brac_list = df_pitax_tot['Income_Bracket'].tolist() pitax_tot_list = df_pitax_tot['pitax_total_ref_'+str(year)].tolist(...
code_fim
hard
{ "lang": "python", "repo": "Revenue-Academy/Tax_Microsimulation", "path": "/app_pit_charts.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: BugsBuggy/KBC_Framework path: /evaluation/new_evaluation.py import torch.utils.data import torch import math from util.helpers import * from collections import defaultdict as ddict class _Collate: def __init__(self, ): pass def collate(self, batch): return torch.squeeze(...
code_fim
hard
{ "lang": "python", "repo": "BugsBuggy/KBC_Framework", "path": "/evaluation/new_evaluation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return ranks def metrics(self, ranks_by_relation, num_true_triples): total_precision = 0 normalization = 0 total_hits = 0 for r, ranks in ranks_by_relation.items(): total_hits += len(ranks[0]) normalization += min(num_true_triples[r], s...
code_fim
hard
{ "lang": "python", "repo": "BugsBuggy/KBC_Framework", "path": "/evaluation/new_evaluation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ymer/rosewarsgame path: /python/tests/speed_tester.py import json from gamestate.gamestate_module import Gamestate from time import time from gamestate import action_getter as action_getter <|fim_suffix|> path = "./../Version_1.0/Tests/General/Action_1.json" document = json.loads(open(pa...
code_fim
medium
{ "lang": "python", "repo": "ymer/rosewarsgame", "path": "/python/tests/speed_tester.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> nloops = 100 total_time = 0 for _ in range(nloops): t = time() action_getter.get_actions(gamestate) total_time += time() - t print("Time used to find all actions", str(nloops), "times:", str(round(total_time, 3)))<|fim_prefix|># repo: ymer/rosewarsgame path: /pyth...
code_fim
medium
{ "lang": "python", "repo": "ymer/rosewarsgame", "path": "/python/tests/speed_tester.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: j-alexander-acosta/AAGESuite-Antiguo path: /carga_horaria/viewsAlexis.py olegio from .models import Periodo from .models import Nivel class LevelFilterMixin(object): def get_context_data(self, *args, **kwargs): ctx = super().get_context_data(*args, **kwargs) ctx['levels'] = ...
code_fim
hard
{ "lang": "python", "repo": "j-alexander-acosta/AAGESuite-Antiguo", "path": "/carga_horaria/viewsAlexis.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: j-alexander-acosta/AAGESuite-Antiguo path: /carga_horaria/viewsAlexis.py d: colegios = [selected] # end kwargs = {"{}__in".format(self.lookup): colegios, "{}periode".format(self.lookup[:-2]): periodo} return qs...
code_fim
hard
{ "lang": "python", "repo": "j-alexander-acosta/AAGESuite-Antiguo", "path": "/carga_horaria/viewsAlexis.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class AsistenteDeleteView(LoginRequiredMixin, DeleteView): model = Asistente success_url = reverse_lazy('carga-horaria:asistentes') def get(self, request, *args, **kwargs): return self.post(request, *args, **kwargs) """ Comienzo Crud Asignatura Base """ class AsignaturaBaseLi...
code_fim
hard
{ "lang": "python", "repo": "j-alexander-acosta/AAGESuite-Antiguo", "path": "/carga_horaria/viewsAlexis.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for j in range(1, len(A), 2): if A[j] % 2 == 1: continue else: while i + 2 < len(A) and A[i] % 2 == 0: i += 2 A[i], A[j] = A[j], A[i] i += 2 return A<|fim_prefix|># repo: danwaterfie...
code_fim
hard
{ "lang": "python", "repo": "danwaterfield/LeetCode-Solution", "path": "/python/Array/Sort Array By Parity II/Sort Array By Parity II.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: danwaterfield/LeetCode-Solution path: /python/Array/Sort Array By Parity II/Sort Array By Parity II.py class Solution(object): def sortArrayByParityII(self, A): <|fim_suffix|> for j in range(1, len(A), 2): if A[j] % 2 == 1: continue else: ...
code_fim
hard
{ "lang": "python", "repo": "danwaterfield/LeetCode-Solution", "path": "/python/Array/Sort Array By Parity II/Sort Array By Parity II.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class NoteTestCase(TestCase): def setUp(self): call_command('migrate', verbosity=0) self.child = models.Child.objects.create( first_name='First', last_name='Last', birth_date=timezone.localdate() ) def test_note_create(self): not...
code_fim
hard
{ "lang": "python", "repo": "Alan01252/babybuddy", "path": "/core/tests/tests_models.py", "mode": "spm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_prefix|># repo: Alan01252/babybuddy path: /core/tests/tests_models.py # -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.core.management import call_command from django.test import TestCase from django.utils import timezone from core import models class ChildTestCase(TestCase): ...
code_fim
hard
{ "lang": "python", "repo": "Alan01252/babybuddy", "path": "/core/tests/tests_models.py", "mode": "psm", "license": "BSD-2-Clause-Views", "source": "the-stack-v2" }
<|fim_suffix|>@event_class() class InspectionEndEvent(EventBase): """ Inspection end (not deferrable) """ deferred = False<|fim_prefix|># repo: saeki-masaki/earthquake path: /pyearthquake/entity/event.py from .entity import EventBase, event_class from .. import LOG as _LOG LOG = _LOG.getChild('entity.e...
code_fim
medium
{ "lang": "python", "repo": "saeki-masaki/earthquake", "path": "/pyearthquake/entity/event.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # ==== main() cellType_labels= {'Vector':'Vector',\ 'WT':'WT',\ 'DEL':'$\Delta$cIDR',\ 'EIF':'UTX-eIF$_{IDR}$',\ 'TPR':'$\Delta$TPR',\ 'MT2':'MT2',\ 'FUS':'UTX-FUS$_{IDR}$'} outdir = 'f4_...
code_fim
hard
{ "lang": "python", "repo": "zanglab/utx_code", "path": "/f8_integrative_analysis/f1_gene_expr_cor_DCI_patterns/py4_promoter_DCI_scatter.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zanglab/utx_code path: /f8_integrative_analysis/f1_gene_expr_cor_DCI_patterns/py4_promoter_DCI_scatter.py import sys,argparse import os,glob import numpy as np import pandas as pd import re,bisect from scipy import stats import matplotlib # matplotlib.use('Agg') import matplotlib.pyplot as plt ma...
code_fim
hard
{ "lang": "python", "repo": "zanglab/utx_code", "path": "/f8_integrative_analysis/f1_gene_expr_cor_DCI_patterns/py4_promoter_DCI_scatter.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #print(box_vals) positions = np.arange(len(box_vals)) fig = plt.figure(figsize=(.46*len(box_vals),2.2)) g = plt.boxplot(box_vals,positions=positions,widths = .5,patch_artist=True,\ boxprops=dict(color='k',facecolor='w',fill=None,lw=1),\ ...
code_fim
hard
{ "lang": "python", "repo": "zanglab/utx_code", "path": "/f8_integrative_analysis/f1_gene_expr_cor_DCI_patterns/py4_promoter_DCI_scatter.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def run_tests(self): import pytest errcode = pytest.main(self.test_args) sys.exit(errcode) setup( name='We Have We Need', version=whwn.__version__, url='http://github.com/wehaveweneed/wehaveweneed', tests_require=['pytest'], cmdclass={'test': PyTest}, d...
code_fim
hard
{ "lang": "python", "repo": "wehaveweneed/whwn", "path": "/setup.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> import pytest errcode = pytest.main(self.test_args) sys.exit(errcode) setup( name='We Have We Need', version=whwn.__version__, url='http://github.com/wehaveweneed/wehaveweneed', tests_require=['pytest'], cmdclass={'test': PyTest}, description='Inventory Man...
code_fim
medium
{ "lang": "python", "repo": "wehaveweneed/whwn", "path": "/setup.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wehaveweneed/whwn path: /setup.py import io import os import sys import whwn from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand <|fim_suffix|> def run_tests(self): import pytest errcode = pytest.main(self.test_args) sys....
code_fim
hard
{ "lang": "python", "repo": "wehaveweneed/whwn", "path": "/setup.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MaxCreeger32/ConsoEdf path: /python/teleinfo2Mongo.py #!/usr/bin/env python from pymongo import MongoClient import serial import sys, os, datetime os.system('sudo stty -F /dev/ttyS0 1200 sane evenp parenb cs7 -crtscts') SERIAL = '/dev/ttyS0' try: ser = serial.Serial( port=SERIAL, ba...
code_fim
hard
{ "lang": "python", "repo": "MaxCreeger32/ConsoEdf", "path": "/python/teleinfo2Mongo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>dateDeMesure = datetime.datetime.utcnow() data['dateMesure'] = dateDeMesure clientMongo = MongoClient('mongodb://bber:cab32b79@nounours:27017/') db = clientMongo.teleinfo collec = db.conso print (data) un_id=collec.insert_one(data).inserted_id print (un_id) ser.close()<|fim_prefix|># repo: MaxCreeger32...
code_fim
hard
{ "lang": "python", "repo": "MaxCreeger32/ConsoEdf", "path": "/python/teleinfo2Mongo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('users', '0004_auto_20200720_0154'), ] operations = [ migrations.DeleteModel( name='Report', ), migrations.AlterField( model_name='registered', name='Email', field=models.EmailField(max_length=25...
code_fim
medium
{ "lang": "python", "repo": "opalpeltzman/projects", "path": "/WebProj2020/LOOK-final/users/migrations/0005_auto_20200720_0305.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.DeleteModel( name='Report', ), migrations.AlterField( model_name='registered', name='Email', field=models.EmailField(max_length=254, null=True), ), migrations.AlterField( model...
code_fim
medium
{ "lang": "python", "repo": "opalpeltzman/projects", "path": "/WebProj2020/LOOK-final/users/migrations/0005_auto_20200720_0305.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: opalpeltzman/projects path: /WebProj2020/LOOK-final/users/migrations/0005_auto_20200720_0305.py # Generated by Django 3.0.4 on 2020-07-20 00:05 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('users', '0004_auto_20200720_0154'), ] operations = [ ...
code_fim
medium
{ "lang": "python", "repo": "opalpeltzman/projects", "path": "/WebProj2020/LOOK-final/users/migrations/0005_auto_20200720_0305.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> register = register_path.DataDirRegister( namespace_to_data_dirs={'ns1': [epath.Path('/path/ns1')]}) assert {'ns1'} == register.namespaces<|fim_prefix|># repo: suvarnak/datasets path: /tensorflow_datasets/core/community/register_path_test.py # coding=utf-8 # Copyright 2022 The TensorFlow Datase...
code_fim
medium
{ "lang": "python", "repo": "suvarnak/datasets", "path": "/tensorflow_datasets/core/community/register_path_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: suvarnak/datasets path: /tensorflow_datasets/core/community/register_path_test.py # coding=utf-8 # Copyright 2022 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtai...
code_fim
medium
{ "lang": "python", "repo": "suvarnak/datasets", "path": "/tensorflow_datasets/core/community/register_path_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_data_dir_register(): register = register_path.DataDirRegister( namespace_to_data_dirs={'ns1': [epath.Path('/path/ns1')]}) assert {'ns1'} == register.namespaces<|fim_prefix|># repo: suvarnak/datasets path: /tensorflow_datasets/core/community/register_path_test.py # coding=utf-8 # Copyri...
code_fim
medium
{ "lang": "python", "repo": "suvarnak/datasets", "path": "/tensorflow_datasets/core/community/register_path_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ncgr/seqtools2 path: /sequencetools/tools/subset_fastq.py #!/usr/bin/env python import os import sys import click import logging from signal import signal, SIGPIPE, SIG_DFL from ..helpers.file_helpers import return_filehandle from ..helpers.sequence_helpers import get_seqio_fastq_record signal(...
code_fim
hard
{ "lang": "python", "repo": "ncgr/seqtools2", "path": "/sequencetools/tools/subset_fastq.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @click.command() @click.option('--fastq', help='''FASTQ file to subset, can be compressed''') @click.option('--subset', metavar = '<INT>', help='''Take every N reads (default:10)''', default=10) @click.option('--log_file', metavar = '<FILE>', default='./subset_fast...
code_fim
hard
{ "lang": "python", "repo": "ncgr/seqtools2", "path": "/sequencetools/tools/subset_fastq.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> subset_fastq.py --fastq input.fastq ''' log_level = getattr(logging, log_level.upper(), logging.INFO) msg_format = '%(asctime)s|%(name)s|[%(levelname)s]: %(message)s' logging.basicConfig(format=msg_format, datefmt='%m-%d %H:%M', level=log_level) log_hand...
code_fim
hard
{ "lang": "python", "repo": "ncgr/seqtools2", "path": "/sequencetools/tools/subset_fastq.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># X_train, y_train = X_data[:50000,:], y_data[:50000] # X_valid, y_valid = X_data[50000:,:], y_data[50000:] # print('Training: ', X_train.shape, y_train.shape) # print('Validation: ', X_valid.shape, y_valid.shape) # print('Test Set: ', X_test.shape, y_test.shape)<|fim_prefix|># repo: yohei1996/C...
code_fim
hard
{ "lang": "python", "repo": "yohei1996/CNN", "path": "/CNN_python/execute/9_12_DGIM_validation/9_12_file_load_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># X_data = dataset['train_img'] # y_data = dataset['train_label'] # print('Rows: %d, Columns: %d' % (X_data.shape[0], X_data.shape[1])) # X_test =dataset['test_img'] # y_test =dataset['test_label'] # print('Rows: %d, Columns: %d' % (X_test.shape[0], X_test.shape[1])) # X_train, y_train = X_data...
code_fim
medium
{ "lang": "python", "repo": "yohei1996/CNN", "path": "/CNN_python/execute/9_12_DGIM_validation/9_12_file_load_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yohei1996/CNN path: /CNN_python/execute/9_12_DGIM_validation/9_12_file_load_test.py # MINISTを読み込んでレイヤーAPIでCNNを構築するファイル import tensorflow as tf import numpy as np import os import tensorflow as tf import glob import numpy as np import config as cf from data_loader import DataLoader fr...
code_fim
hard
{ "lang": "python", "repo": "yohei1996/CNN", "path": "/CNN_python/execute/9_12_DGIM_validation/9_12_file_load_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>=True) s=0 for i in range(n): k=a[i]-i if k>=0: s+=k print(s%1000000007) t-=1<|fim_prefix|># repo: tejpk/APS_CodeLib path: /CC_CARSELL.py # cook your dish here t=int(input()) while t: n=int(inpu<|fim_middle|>t()) a=list(map(int,input().split())) a.s...
code_fim
medium
{ "lang": "python", "repo": "tejpk/APS_CodeLib", "path": "/CC_CARSELL.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tejpk/APS_CodeLib path: /CC_CARSELL.py # cook your dish here t=int(input()) while t: n=int(inpu<|fim_suffix|> if k>=0: s+=k print(s%1000000007) t-=1<|fim_middle|>t()) a=list(map(int,input().split())) a.sort(reverse=True) s=0 for i in range(n): k=a...
code_fim
medium
{ "lang": "python", "repo": "tejpk/APS_CodeLib", "path": "/CC_CARSELL.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if k>=0: s+=k print(s%1000000007) t-=1<|fim_prefix|># repo: tejpk/APS_CodeLib path: /CC_CARSELL.py # cook your dish here t=int(input()) while t: n=int(input()) a=list(map(int,input().split())) a.sort(reverse<|fim_middle|>=True) s=0 for i in range(n): k=a...
code_fim
medium
{ "lang": "python", "repo": "tejpk/APS_CodeLib", "path": "/CC_CARSELL.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 362902755/CTF-Tools path: /GUI/KEY.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'KEY.ui' # # Created by: PyQt5 UI code generator 5.11.3 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_KEY(object): ...
code_fim
hard
{ "lang": "python", "repo": "362902755/CTF-Tools", "path": "/GUI/KEY.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> _translate = QtCore.QCoreApplication.translate KEY.setWindowTitle(_translate("KEY", "KEY")) self.label.setText(_translate("KEY", "Keys 1")) self.label_2.setText(_translate("KEY", "Keys 2")) self.enter.setText(_translate("KEY", "确定")) self.quxiao.setText(_tra...
code_fim
hard
{ "lang": "python", "repo": "362902755/CTF-Tools", "path": "/GUI/KEY.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for move in pm: new_moves = moves[:] new_moves.append(move) newobstacles,newrobot = make_moves(obstacles,robot,graph,[move]) if t == newrobot: print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!") return ne...
code_fim
hard
{ "lang": "python", "repo": "SpaskeS/resavanje-problema-optimalnog-planiranja-kretanja-u-grafu", "path": "/src/ssolver.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SpaskeS/resavanje-problema-optimalnog-planiranja-kretanja-u-grafu path: /src/ssolver.py import heapq as heap import networkx as nx import copy import random def remove_jumps(moves): res = [] for move in moves: if move[2] > 1: move[3].reverse() res.extend(...
code_fim
hard
{ "lang": "python", "repo": "SpaskeS/resavanje-problema-optimalnog-planiranja-kretanja-u-grafu", "path": "/src/ssolver.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def solve_heap(o,r,graph,t): round = 0 visited = set([]) queue= [(-1000,[],o,r)] while queue: score,moves,obstacles,robot = heap.heappop(queue) obstacles.sort() st = ('#'.join(obstacles),robot) if ( st not in visited ): visited.add(st) ...
code_fim
hard
{ "lang": "python", "repo": "SpaskeS/resavanje-problema-optimalnog-planiranja-kretanja-u-grafu", "path": "/src/ssolver.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: otap63/PyCharmProjects path: /Cars/Sample.py from Cars import Bmw from Cars import Audi from Cars import Nissan <|fim_suffix|> # Create an object of Bmw class & call its method ModBMW = Bmw.Bmw() ModBMW.outModels() # Create an object of Audi class & call its method ModAudi ...
code_fim
medium
{ "lang": "python", "repo": "otap63/PyCharmProjects", "path": "/Cars/Sample.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Create an object of Bmw class & call its method ModBMW = Bmw.Bmw() ModBMW.outModels() # Create an object of Audi class & call its method ModAudi = Audi.Audi() ModAudi.outModels() # Create an object of Nissan class & call its method ModNissan = Nissan.Nissan() ModNis...
code_fim
medium
{ "lang": "python", "repo": "otap63/PyCharmProjects", "path": "/Cars/Sample.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> n = len(nums) i = 0 j = 0 while i < n: if nums[i] != 0: nums[j],nums[i] = nums[i],nums[j] j += 1 i += 1<|fim_prefix|># repo: c940606/leetcode path: /Move Zeroes.py class Solution(object): def moveZeroes(self, nums): """ 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 ...
code_fim
hard
{ "lang": "python", "repo": "c940606/leetcode", "path": "/Move Zeroes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: c940606/leetcode path: /Move Zeroes.py class Solution(object): def moveZeroes(self, nums): """ 给定一个数组 nums,编写一个函数将所有 0 移动到数组的末尾,同时保持非零元素的相对顺序。 --- 输入: [0,1,0,3,12] 输出: [1,3,12,0,0] --- 思路; <|fim_suffix|> n = len(nums) i = 0 j = 0 while i < n: if nums[i] != 0: n...
code_fim
hard
{ "lang": "python", "repo": "c940606/leetcode", "path": "/Move Zeroes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vrastil/CCD_testing path: /ccdanalyses/plot_handling.py label='noise') ax2.set_ylabel('stdev') lns3 = ax2.plot(nd[i], 'v', color='red', label='dnoise') lns = lns1 + lns2 + lns3 labs = [l.get_label() for l in lns] ax1.legend(lns, labs, bbox_to_anchor=(0., 1...
code_fim
hard
{ "lang": "python", "repo": "vrastil/CCD_testing", "path": "/ccdanalyses/plot_handling.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> gain_ref_np = np.array(gains[gain_ref].gain) ratios = [] for gain in gains: gain_np = np.array(gain.gain) dim = (min(gain_ref_np.shape[0], gain_np.shape[0]), min(gain_ref_np.shape[1], gain_np.shape[1]) ) # print 'dim = ', dim ratios.a...
code_fim
hard
{ "lang": "python", "repo": "vrastil/CCD_testing", "path": "/ccdanalyses/plot_handling.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vrastil/CCD_testing path: /ccdanalyses/plot_handling.py close(fig) def plot_histogram_mean(m, TITLE, OUT_DIR): fig = plt.figure(figsize=(15, 15)) m_all = m.ravel() for bin_num in np.arange(10, 100, 10): plt.subplot(3, 3, bin_num / 10) plt.hist(m_all, bin_num, faceco...
code_fim
hard
{ "lang": "python", "repo": "vrastil/CCD_testing", "path": "/ccdanalyses/plot_handling.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Personal', fields=[ ('post_apply', models.CharField(max_length=150)), ('department', models.CharField(max_length=50)), ('application_no', models.BigAutoField(db_column='APPLICAT...
code_fim
hard
{ "lang": "python", "repo": "shivankyGoyal/fyp", "path": "/calculator/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shivankyGoyal/fyp path: /calculator/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-01-15 17:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "shivankyGoyal/fyp", "path": "/calculator/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 2.百科内容获取 reptile = Reptile() page_content = reptile.get_page_content(url + '&'.join([key + '=' + parm[key] for key in parm]), timeout=3) content_list = json.loads(page_content)[1] # 3.百科内容格式化 data = [] prefix = 'https://zh.wikipedia.org/wiki/' for index, item in enumerate(content_list):...
code_fim
hard
{ "lang": "python", "repo": "makeplanetoheaven/everything", "path": "/src/dao/encyclopediaDao.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return data @staticmethod def get_faq_content(query: str, page: str) -> list: """ 获取指定query的faq检索内容 :param query: :param page: :return: """ # 1.参数设置 url = 'https://zhidao.baidu.com/search?' parm = { 'lm': '0', 'rn': '5', 'pn': page, 'fr': 'search', 'ie': 'gbk', 'wo...
code_fim
hard
{ "lang": "python", "repo": "makeplanetoheaven/everything", "path": "/src/dao/encyclopediaDao.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: makeplanetoheaven/everything path: /src/dao/encyclopediaDao.py # coding=utf-8 """ author: wlc function: 百科检索数据层 """ # 引入外部库 import json import re from bs4 import BeautifulSoup # 引入内部库 from src.util.reptile import * class EncyclopediaDao: @staticmethod def get_key_content (key: str) -> list...
code_fim
hard
{ "lang": "python", "repo": "makeplanetoheaven/everything", "path": "/src/dao/encyclopediaDao.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Draw some stuff glBegin(GL_TRIANGLES) glVertex3i(0, 0, 0) glVertex3i(300, 0, 0) glVertex3i(0, 300, 0) glEnd() pyglet.app.run()<|fim_prefix|># repo: coreline/sandbox path: /PyGame/test.py #!/usr/bin/python import pyglet from pyglet.gl import * win = pyglet.window.Window() <|fim_middle|>@win.ev...
code_fim
medium
{ "lang": "python", "repo": "coreline/sandbox", "path": "/PyGame/test.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tbobula/100daysofcode-with-python-course path: /codechalleng/Begining/1.py def sum_numbers(numbers=None): <|fim_suffix|> for number in numbers: sum += number return sum<|fim_middle|> sum = 0 if numbers == None: for number in range(1,101): sum += number ...
code_fim
medium
{ "lang": "python", "repo": "tbobula/100daysofcode-with-python-course", "path": "/codechalleng/Begining/1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for number in numbers: sum += number return sum<|fim_prefix|># repo: tbobula/100daysofcode-with-python-course path: /codechalleng/Begining/1.py def sum_numbers(numbers=None): <|fim_middle|> sum = 0 if numbers == None: for number in range(1,101): sum += number ...
code_fim
medium
{ "lang": "python", "repo": "tbobula/100daysofcode-with-python-course", "path": "/codechalleng/Begining/1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: itsjesseyo/enjigo_door path: /door_interface/helpers/sensor.py import sys, serial, time, signal, threading from MFRC522 import MFRC522 from event import Event class Sensor(threading.Thread): # main program for reading and processing tags def __init__(self, name): threading.Thread.__init__(s...
code_fim
medium
{ "lang": "python", "repo": "itsjesseyo/enjigo_door", "path": "/door_interface/helpers/sensor.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> def stop(self): self.continue_reading = False def run(self): print "sensor running" self.continue_reading = True #if RFID is working - start monitoring it while self.continue_reading: (status,TagType) = self.tag_reader.MFRC522_Request(self.tag_reader.PICC_REQIDL) if status == self.t...
code_fim
hard
{ "lang": "python", "repo": "itsjesseyo/enjigo_door", "path": "/door_interface/helpers/sensor.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p02879/s520355727.py a, b = map(int, input().split()) <|fim_suffix|> if a > 9 or b > 9 or a < 1 or b < 1: print(-1) else: print(a * b) mult(a,b)<|fim_middle|> def mult(a, b):
code_fim
easy
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p02879/s520355727.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if a > 9 or b > 9 or a < 1 or b < 1: print(-1) else: print(a * b) mult(a,b)<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p02879/s520355727.py a, b = map(int, input().split()) <|fim_middle|> def mult(a, b):
code_fim
easy
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p02879/s520355727.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #predictions train_loss, train_accuracy = model.evaluate(train_X, train_y,verbose=False ) test_loss, test_accuracy = model.evaluate(test_X, test_y, verbose = False ) # In[73]: print('trin_accuracy : {}'.format(train_accuracy)) print('test_accuracy : {}'.format(test_accuracy)) # In[74]: prediction...
code_fim
hard
{ "lang": "python", "repo": "sobanmalik/Tensorflow-2.0", "path": "/TF 2.0.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> with tf.device('GPU:0'): model = keras.Sequential([ #keras.layers.Conv2D(filters=32 ,kernel_size=3, activation='relu',input_shape=(28,28,1)), keras.layers.Flatten(input_shape=(28,28)), #keras.layers.Dense(128, activation='relu'), keras.layers.Dense(2560, activation='r...
code_fim
hard
{ "lang": "python", "repo": "sobanmalik/Tensorflow-2.0", "path": "/TF 2.0.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sobanmalik/Tensorflow-2.0 path: /TF 2.0.py #!/usr/bin/env python # coding: utf-8 # In[2]: from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU'))) # In[1...
code_fim
hard
{ "lang": "python", "repo": "sobanmalik/Tensorflow-2.0", "path": "/TF 2.0.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }