text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> #Check if there is more than 1 result for the given location locations = Nominatim().geocode(self.address, False) if len(locations) > 1: print 'Please enter a more specific location. ie: City and State' else: return Nominatim().geocode(self.address).longitude def time_zone(self): """F...
code_fim
medium
{ "lang": "python", "repo": "SoftwareDevEngResearch/SolarCalcs", "path": "/SolarCalcs/LocationComponents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> snake = active_contour(gaussian(img, 3),init, alpha=0.025, beta=10, gamma=0.001) fig, ax = plt.subplots(figsize=(7, 7)) ax.imshow(img, cmap=plt.cm.gray) ax.plot(init[:, 1], init[:, 0], '--r', lw=3) ax.plot(snake[:, 1], snake[:, 0], '-b', lw=3) ax.set_xticks([]), ax.set_ytick...
code_fim
medium
{ "lang": "python", "repo": "RumeysaRanaYILMAZ/SimplePhotoEditor", "path": "/SimplePhotoEditor/contour.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: RumeysaRanaYILMAZ/SimplePhotoEditor path: /SimplePhotoEditor/contour.py import numpy as np import matplotlib.pyplot as plt from skimage.color import rgb2gray from skimage import data from skimage.filters import gaussian from skimage.segmentation import active_contour def cntr(): ...
code_fim
hard
{ "lang": "python", "repo": "RumeysaRanaYILMAZ/SimplePhotoEditor", "path": "/SimplePhotoEditor/contour.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 注:socketserver详解 # SocketServer框架式一个基本的socket服务器框架,使用了threading来处理多个客户端的连接,使用seletor模块来处理高并发访问 # SocketServer内部使用IO多路复用以及"多进程"和"多线程",从而实现并发处理客户端请求 # SocketServer提供5个基本服务类: # -请求处理类 # - BaseServer 基类,不直接对外服务 # - TCPServer:派生类,针对TCP套接字流 # - UnixStreamServer针对UNIX域套接字,...
code_fim
hard
{ "lang": "python", "repo": "dujiaojiao/learnNotes", "path": "/learnPython.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dujiaojiao/learnNotes path: /learnPython.py :_^11}'.format('hello') # 二、 # print使用注意: # 1> 使用关键字输出: print('{name} wrote {book}'.format(name='Swaroop',book='A vyty of python')) # 2> print会换行,可以通过end指定其应以空白结尾(不换行) # eg: print('a',end='') print('b',end='') -> ab # print('a',end=' ') prin...
code_fim
hard
{ "lang": "python", "repo": "dujiaojiao/learnNotes", "path": "/learnPython.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Sprite_Image(pygame.sprite.Sprite): def __init__(self, x, y, pic): pygame.sprite.Sprite.__init__(self) self.image = pic #self.rect = self.image.get_rect() self.x = x self.y = y<|fim_prefix|># repo: fudgenuggets1/luck_free_pokemon path: /display.py impo...
code_fim
hard
{ "lang": "python", "repo": "fudgenuggets1/luck_free_pokemon", "path": "/display.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fudgenuggets1/luck_free_pokemon path: /display.py import pygame from colors import * from buttons import Button class Block(pygame.sprite.Sprite): def __init__(self, x, y, width, height, color=BLUE): """ Constructor function """ # Call the parent's constructor pyga...
code_fim
hard
{ "lang": "python", "repo": "fudgenuggets1/luck_free_pokemon", "path": "/display.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def string_features_v2(str): """ Version 2: combine the hexal distribution with the previous string statistics. """ N = float(len(str)) if N==0: return None cap = len(re.findall(r'[A-Z]', str))/N num = len(re.findall(r'[0-9]', str))/N return string_features_hex(hexalise(str...
code_fim
hard
{ "lang": "python", "repo": "pj201/cc-domain-graph", "path": "/pyspark/cc-functions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pj201/cc-domain-graph path: /pyspark/cc-functions.py import boto from boto.s3.key import Key from gzipstream import GzipStreamFile from pyspark.sql.types import * from math import log from collections import Counter import warc import ujson as json import urlparse import re def unpack(uri): ...
code_fim
hard
{ "lang": "python", "repo": "pj201/cc-domain-graph", "path": "/pyspark/cc-functions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>hexabet = [hx(x) for x in range(256)] def string_features_v1(str): """ Coarse first version of a feature vector for a string. A placeholder for stronger versions. """ N = float(len(str)) if N==0: return None a = len(re.findall(r'/', str))/N b = len(re.findall(r'\.', str))/...
code_fim
hard
{ "lang": "python", "repo": "pj201/cc-domain-graph", "path": "/pyspark/cc-functions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: snk4tr/sh-utils path: /find_rogue.py #!/usr/bin/python # ==================== Python 2 ===================== # Tracks current window focus. # Useful for finding commands, intercepting control. # =================================================== import time <|fim_suffix|>while True: time...
code_fim
easy
{ "lang": "python", "repo": "snk4tr/sh-utils", "path": "/find_rogue.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>while True: time.sleep(3) activeAppName = NSWorkspace.sharedWorkspace().activeApplication()['NSApplicationName'] print activeAppName<|fim_prefix|># repo: snk4tr/sh-utils path: /find_rogue.py #!/usr/bin/python # ==================== Python 2 ===================== # Tracks current window focus...
code_fim
easy
{ "lang": "python", "repo": "snk4tr/sh-utils", "path": "/find_rogue.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: billowen/MachineLearninginAction path: /ch04/bayes.py from numpy import * def loadDataSet(): postingList = [ ['my', 'dog', 'has', 'flea', 'problems', 'help', 'please'], ['maybe', 'not', 'take', 'him', 'to', 'dog', 'park', 'stupid'], ['my', 'dalmation', 'is', 'so', 'c...
code_fim
hard
{ "lang": "python", "repo": "billowen/MachineLearninginAction", "path": "/ch04/bayes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> p1 = sum(vec2Classify * p1vec) + log(pclass1) p0 = sum(vec2Classify * p0vec) + log(1.0 - pclass1) if p1 > p0: return 1 else: return 0 def testNB(): listOfPost, listClass = loadDataSet() vocabSet = createVocabList(listOfPost) trainMat = [] for doc in listOf...
code_fim
hard
{ "lang": "python", "repo": "billowen/MachineLearninginAction", "path": "/ch04/bayes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> them? Didn't have any #What Did I find difficult? figuring out my python math<|fim_prefix|># repo: tkapusniak/PPC---Book-1 path: /PPC-challanges/PPC challange 7\.py #PPC Challange 7 name = input('What is your name?' ) age = int(input("What is <|fim_middle|>your age? ")) birthday = age + 1 print("So your...
code_fim
medium
{ "lang": "python", "repo": "tkapusniak/PPC---Book-1", "path": "/PPC-challanges/PPC challange 7\\.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tkapusniak/PPC---Book-1 path: /PPC-challanges/PPC challange 7\.py #PPC Challange 7 name = input('What is your name?' ) age = int(input("What is your age? ")) birthday = age + 1 print("So your next birthday you are" birthda<|fim_suffix|> them? Didn't have any #What Did I find difficult? figuring o...
code_fim
medium
{ "lang": "python", "repo": "tkapusniak/PPC---Book-1", "path": "/PPC-challanges/PPC challange 7\\.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hexyo/web-crawler path: /webcrwl.py import argparse from bs4 import BeautifulSoup from memory_profiler import memory_usage import re import time import sqlite3 import sys from urllib.request import URLError, urlopen from urllib.error import HTTPError # Regex for protocol check regex = re.compile...
code_fim
hard
{ "lang": "python", "repo": "hexyo/web-crawler", "path": "/webcrwl.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Catching page try: page = urlopen(url) except (URLError, HTTPError, ValueError, AttributeError): return False # Page file parsing html = BeautifulSoup(page.read(), 'lxml') return html # Pages loader function @runtime def loader(url): html = get_page(url)...
code_fim
hard
{ "lang": "python", "repo": "hexyo/web-crawler", "path": "/webcrwl.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cursor.execute("SELECT s.url,s.title FROM suburls s LEFT JOIN urls u ON u.id = s.url_id WHERE u.url = ? LIMIT ?",(url,count)) result = cursor.fetchall() if not result: print("This url wasn't load yet or sublinks wasn't found. \nTry webcrwl.py load `url` ") for row in result: ...
code_fim
hard
{ "lang": "python", "repo": "hexyo/web-crawler", "path": "/webcrwl.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def setupUi(self, vmf2obj): vmf2obj.setObjectName("vmf2obj") vmf2obj.resize(401, 220) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap("icon.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) vmf2obj.setWindowIcon(icon) sizePolicy = QtWidgets.QSizePolicy(QtWid...
code_fim
hard
{ "lang": "python", "repo": "R60D/VMF2OBJ-UI", "path": "/VMF2OBJ_UI.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> _translate = QtCore.QCoreApplication.translate self.VMF2OBJ_Start.setText(_translate("vmf2obj", "VMF2OBJ")) self.vmf_button.setText(_translate("vmf2obj", "Vmf")) self.vmf_text.setPlaceholderText(_translate("vmf2obj", "Your vmf location")) self.tf2_text.setPlaceholde...
code_fim
hard
{ "lang": "python", "repo": "R60D/VMF2OBJ-UI", "path": "/VMF2OBJ_UI.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: R60D/VMF2OBJ-UI path: /VMF2OBJ_UI.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'vmf2obj.ui' # # Created by: PyQt5 UI code generator 5.13.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtWidgets, QtGui import subprocess ...
code_fim
hard
{ "lang": "python", "repo": "R60D/VMF2OBJ-UI", "path": "/VMF2OBJ_UI.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: devGauravTiwari/blog path: /blog/views.py from django.shortcuts import render from django.views.generic import ListView,DetailView from .models import Post # Create your views here. class PostListView(ListView): <|fim_suffix|> model = Post template_name = 'blog/detail.html' context_object_name ...
code_fim
medium
{ "lang": "python", "repo": "devGauravTiwari/blog", "path": "/blog/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model = Post template_name = 'blog/detail.html' context_object_name = 'post'<|fim_prefix|># repo: devGauravTiwari/blog path: /blog/views.py from django.shortcuts import render from django.views.generic import ListView,DetailView from .models import Post # Create your views here. class PostListView(Lis...
code_fim
medium
{ "lang": "python", "repo": "devGauravTiwari/blog", "path": "/blog/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> except ValueError: # If JSON from stdin is invalid sys.stdout.write('{"topic": "' + obj["NAMESPACE"] + '/log", "message": "http-request: error"}' + '\n') sys.stdout.flush()<|fim_prefix|># repo: flaneurtv/samm path: /examples/test-echo/processor.py #!/usr/bin/env python import...
code_fim
hard
{ "lang": "python", "repo": "flaneurtv/samm", "path": "/examples/test-echo/processor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: flaneurtv/samm path: /examples/test-echo/processor.py #!/usr/bin/env python import sys, json, datetime, string, os, pytz def time_format(dt): return "%s:%.3f%s" % ( dt.strftime('%Y-%m-%dT%H:%M'), float("%.3f" % (dt.second + dt.microsecond / 1e6)), dt.strftime('%z') ...
code_fim
hard
{ "lang": "python", "repo": "flaneurtv/samm", "path": "/examples/test-echo/processor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> clock.tick(REFRESH_RATE) player_sprite.update(key_pressed) for players in player_sprite: players.key_face(event) player_sprite.update(key_pressed) pygame.display.update() running = True # game over thread while running: ...
code_fim
hard
{ "lang": "python", "repo": "ViktorVektor/CPSC100Project", "path": "/UI/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ViktorVektor/CPSC100Project path: /UI/main.py # settings REFRESH_RATE = 60 MAP_ZOOM = 1 FONT = 32 # movement properties # maybe grab difficulty multiplier here? PLAYER_SPEED = 100 # * difficulty TRUE = 1 FALSE = 0 # load map branch pygame.init() # grab the map image from the main manu # from ...
code_fim
hard
{ "lang": "python", "repo": "ViktorVektor/CPSC100Project", "path": "/UI/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # text stuffs title = font.render('Welcome to Sneaky Beaky (the game)', True, BLACK, WHITE) how_to = font.render('\'P\'for procedural game, \'Enter\' for default game', True, RED, WHITE) how_to_2 = font.render('CPSC 100 Lab Section L1M', True, RED, WHITE) made_by = font.render('Made b...
code_fim
hard
{ "lang": "python", "repo": "ViktorVektor/CPSC100Project", "path": "/UI/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># buscando info por id file = XmlFilesIntegration.find_info_by_id('cidades', '1101492') print(file) # file = XmlFilesIntegration.read_file('cidades') # print(file)<|fim_prefix|># repo: BarbaraMoser/Ecommerce-MVC path: /app/models/integrations/xml_files_integration.py from typing import List from xml.etr...
code_fim
hard
{ "lang": "python", "repo": "BarbaraMoser/Ecommerce-MVC", "path": "/app/models/integrations/xml_files_integration.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # >>>>>>>>>>>>>>>>>>>>>>> EXCECUÇÃO PARA TESTE <<<<<<<<<<<<<<<<<<<<<<<<< # lendo arquivo xml # files = XmlFilesIntegration.read_file('cidades', 'cidades', ['Código', 'Nome', 'UF', 'Região', 'País']) # for file in files: # print(file) # buscando info por id file = XmlFilesIntegration.find_info_by_id(...
code_fim
medium
{ "lang": "python", "repo": "BarbaraMoser/Ecommerce-MVC", "path": "/app/models/integrations/xml_files_integration.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: BarbaraMoser/Ecommerce-MVC path: /app/models/integrations/xml_files_integration.py from typing import List from xml.etree import ElementTree as et class XmlFilesIntegration: _INFOS: List = [] @classmethod def read_file(cls, file_name: str, key_name: str, list_fields: List[str]): ...
code_fim
hard
{ "lang": "python", "repo": "BarbaraMoser/Ecommerce-MVC", "path": "/app/models/integrations/xml_files_integration.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: einalex/Neopixel-Controller path: /neopixelcontroller/lib/effects/effect_theater_chase_rainbow.py from __future__ import print_function from ..color import Color from ..effect import Effect import time class EffectTheaterChaseRainbow(Effect): <|fim_suffix|> for i in ...
code_fim
hard
{ "lang": "python", "repo": "einalex/Neopixel-Controller", "path": "/neopixelcontroller/lib/effects/effect_theater_chase_rainbow.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(0, self.controller.LEDS, 3): self.controller.pixel_color(i + j, Color(0, 0, 0)) except AttributeError: print("[EffectTheaterChaseRainbow][error] An error occurred setting theater chase rainbow to NeoPixel pixels...
code_fim
hard
{ "lang": "python", "repo": "einalex/Neopixel-Controller", "path": "/neopixelcontroller/lib/effects/effect_theater_chase_rainbow.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: while self.ITERATE: for l in range(iterations): for k in range(256): for j in range(3): for i in range(0, self.controller.LEDS, 3): self.controller.pixel_color(i...
code_fim
hard
{ "lang": "python", "repo": "einalex/Neopixel-Controller", "path": "/neopixelcontroller/lib/effects/effect_theater_chase_rainbow.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>din.read() n = int(input()) summands = optimal_summands(n) print(len(summands)) for x in summands: print(x, end=' ')<|fim_prefix|># repo: Desaiakshata/Algorithms-problems path: /greedy_algorithms/5_maximum_number_of_prizes/different_summands.py # Uses python3 import sys def optim...
code_fim
medium
{ "lang": "python", "repo": "Desaiakshata/Algorithms-problems", "path": "/greedy_algorithms/5_maximum_number_of_prizes/different_summands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Desaiakshata/Algorithms-problems path: /greedy_algorithms/5_maximum_number_of_prizes/different_summands.py # Uses python3 import sys def optimal_summands(n): summands = [] #write your code here if n==2: return [2] for i i<|fim_suffix|> summands.append(rem) ...
code_fim
medium
{ "lang": "python", "repo": "Desaiakshata/Algorithms-problems", "path": "/greedy_algorithms/5_maximum_number_of_prizes/different_summands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: duzx1/pylark path: /pylark/api_service_drive_wiki_node_create.py # Code generated by lark_sdk_gen. DO NOT EDIT. from pylark.lark_request import RawRequestReq, _new_method_option from pylark import lark_type, lark_type_sheet, lark_type_approval import attr import typing import io @attr.s class ...
code_fim
hard
{ "lang": "python", "repo": "duzx1/pylark", "path": "/pylark/api_service_drive_wiki_node_create.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return RawRequestReq( dataclass=CreateWikiNodeResp, scope="Drive", api="CreateWikiNode", method="POST", url="https://open.feishu.cn/open-apis/wiki/v2/spaces/:space_id/nodes", body=request, method_option=_new_method_option(options), need_t...
code_fim
hard
{ "lang": "python", "repo": "duzx1/pylark", "path": "/pylark/api_service_drive_wiki_node_create.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _gen_create_wiki_node_req(request, options) -> RawRequestReq: return RawRequestReq( dataclass=CreateWikiNodeResp, scope="Drive", api="CreateWikiNode", method="POST", url="https://open.feishu.cn/open-apis/wiki/v2/spaces/:space_id/nodes", body=request...
code_fim
hard
{ "lang": "python", "repo": "duzx1/pylark", "path": "/pylark/api_service_drive_wiki_node_create.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @accounts_bp.route('/remove/<account_id>', methods=['POST']) @login_required @savjetnik_required def erase_member(account_id): if request.method == 'POST': db = DatabaseController() if not db.entry_exists(DatabaseTables.KORISNICKI_RACUNI, account_id): error = 'Neuspješno b...
code_fim
hard
{ "lang": "python", "repo": "KSET/VolonterskiSati", "path": "/accounts.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == 'POST': db = DatabaseController() if not db.entry_exists(DatabaseTables.KORISNICKI_RACUNI, account_id): error = 'Neuspješno brisanje. Zapis ne postoji u bazi.' flash(error, 'danger') else: db.remove_entry(DatabaseTables.K...
code_fim
hard
{ "lang": "python", "repo": "KSET/VolonterskiSati", "path": "/accounts.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KSET/VolonterskiSati path: /accounts.py from flask import ( Blueprint, flash, g, redirect, render_template, request, session, url_for ) from werkzeug.security import generate_password_hash from werkzeug.exceptions import HTTPException from auth import login_required, savjetnik_required, admi...
code_fim
hard
{ "lang": "python", "repo": "KSET/VolonterskiSati", "path": "/accounts.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>h('view/', views.view), path('viewGrades/', views.viewGrades) ]<|fim_prefix|># repo: nevilparmar11/SDP_Online_Assessment_System path: /onlineassessmentsystem/lab/urls.py from django.urls import path from . import views urlpatterns = [ <|fim_middle|> path('', views.list), path('create/', views...
code_fim
medium
{ "lang": "python", "repo": "nevilparmar11/SDP_Online_Assessment_System", "path": "/onlineassessmentsystem/lab/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return [A[l] for l in labels],[clustersizes[l] for l in labels] if __name__ == "__main__": A = (random.randn(100,2)*.33+[1,1]).tolist() A.extend((random.randn(100,2)*.33+[-1,-1]).tolist()) A.extend((random.randn(100,2)*.33+[1,-1]).tolist()) A.extend((random.randn(100,2)*.33+[-1,1]).to...
code_fim
hard
{ "lang": "python", "repo": "wilseypa/dataAnalysis-scripts", "path": "/dataGeneration/GeneratorProject/agglomerative.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def agglomerate(A,k,clustersizes=None): ''' perform agglomerative clustering until label size = k ''' A = array(A) grid = affinityMatrix(A) labels = range(len(grid)) if clustersizes==None: clustersizes = [1.0]*len(grid) while len(labels) > k: keeplabel,removelab...
code_fim
hard
{ "lang": "python", "repo": "wilseypa/dataAnalysis-scripts", "path": "/dataGeneration/GeneratorProject/agglomerative.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wilseypa/dataAnalysis-scripts path: /dataGeneration/GeneratorProject/agglomerative.py from numpy import * def affinity(X,Y): return sum((X-Y)**2)**.5 def affinityMatrix(A): arr_len = len(A) ret = zeros([arr_len,arr_len]) for i in xrange(arr_len): for j in xrange(i+1,arr_l...
code_fim
hard
{ "lang": "python", "repo": "wilseypa/dataAnalysis-scripts", "path": "/dataGeneration/GeneratorProject/agglomerative.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Quickblink/rl-hpo path: /function_predictor.py import torch import torch.nn as nn import torch.nn.functional as F num_points = 50 mean = torch.zeros((1), device='cuda') epsilon = torch.eye(num_points, device='cuda') * 1e-6 def make_points(batch_size): x = torch.rand((batch_size, num_point...
code_fim
hard
{ "lang": "python", "repo": "Quickblink/rl-hpo", "path": "/function_predictor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(episodes): model.zero_grad() data = make_points(batch_size) out = model(data) loss = F.mse_loss(out, data[1:, :, 1:]) loss.backward() opt.step() if i%1000==0: with torch.no_grad(): print('Epsisode: ',i,'...
code_fim
hard
{ "lang": "python", "repo": "Quickblink/rl-hpo", "path": "/function_predictor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pytorch/pytorch path: /torch/testing/_internal/common_dist_composable.py # Owner(s): ["oncall: distributed"] from typing import Tuple import torch import torch.nn as nn class UnitModule(nn.Module): def __init__(self, device: torch.device): super().__init__() self.l1 = nn.L...
code_fim
hard
{ "lang": "python", "repo": "pytorch/pytorch", "path": "/torch/testing/_internal/common_dist_composable.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__() self.l = nn.Linear(100, 100, device=device) self.u1 = UnitModule(device) self.u2 = UnitModule(device) self.p = nn.Parameter(torch.randn((100, 100), device=device)) def forward(self, x): a = self.u2(self.u1(self.l(x))) b = self...
code_fim
hard
{ "lang": "python", "repo": "pytorch/pytorch", "path": "/torch/testing/_internal/common_dist_composable.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdnahas/carry_trade_paper path: /python_2.7/cull_bonds_Liao.py #!/usr/bin/python # division returns float always; use // for integer division from __future__ import division from __future__ import print_function import csv import sys import math import datetime import calendar import unittest f...
code_fim
hard
{ "lang": "python", "repo": "mdnahas/carry_trade_paper", "path": "/python_2.7/cull_bonds_Liao.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if issuer not in firms_to_currencies: firms_to_currencies[issuer] = Set() # set with just this currency firms_to_currencies[issuer].add( curr ) firms_used = Set() written_header = False with open(outfilename, 'wb') as f: writer = csv.writer(f) for infilen...
code_fim
hard
{ "lang": "python", "repo": "mdnahas/carry_trade_paper", "path": "/python_2.7/cull_bonds_Liao.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Katana-O/regex-learning path: /charcterSets.py import re if __name__ == '__main__': print('main') # [A-Z] '-' is a metacharacter when used in [] (custom character sets) charStr = 'Hello, There, How, Are, You 123...' print(re.findall('[A-Z]', charStr)) # output: ['H', 'T', 'H'...
code_fim
hard
{ "lang": "python", "repo": "Katana-O/regex-learning", "path": "/charcterSets.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # '^' means start of the line when use outside of custom bracket, means not when use inside a custom bracket charStr2 = 'HELLO, There, How, Are, You...' print(re.search('[^A-Za-z\s,]+', charStr2).group()) # output: ... we negate custom set only outputs "..." print(re.findall('[^A-Z]+...
code_fim
hard
{ "lang": "python", "repo": "Katana-O/regex-learning", "path": "/charcterSets.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('repairs', '0009_remove_repair_vehicle'), ] operations = [ migrations.AlterField( model_name='repair', name='price', field=models.IntegerField(), ), ]<|fim_prefix|># repo: markostojkov/VehicleInfo path: /proje...
code_fim
easy
{ "lang": "python", "repo": "markostojkov/VehicleInfo", "path": "/project/repairs/migrations/0010_auto_20200226_1748.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: markostojkov/VehicleInfo path: /project/repairs/migrations/0010_auto_20200226_1748.py # Generated by Django 3.0.2 on 2020-02-26 17:48 <|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('repairs', '0009_remove_repair_vehicle'), ] operations = [ m...
code_fim
easy
{ "lang": "python", "repo": "markostojkov/VehicleInfo", "path": "/project/repairs/migrations/0010_auto_20200226_1748.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: leb2/starcraft-rl path: /parts.py import tensorflow as tf def conv_body(state, filters=(32, 16), kernel_sizes=(5, 5), strides=(3, 3), output_size=64): """ Assumes the state shape is 3 dimensional. Applies some number of convolution layers, followed by a single dense layer. :par...
code_fim
hard
{ "lang": "python", "repo": "leb2/starcraft-rl", "path": "/parts.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def actor_spacial_head(features, sizes): """ Feed forward network to calculate the spacial action probabilities. :param features: Tensor of shape [batch_size, num_features] inputs to the spacial_head :param sizes: List of integer sizes for spacial dimension sizes. Even indices are x dimen...
code_fim
hard
{ "lang": "python", "repo": "leb2/starcraft-rl", "path": "/parts.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarkusvonStaden/blackboard2api path: /image_capturing/green_detection.py from typing import Optional from operator import itemgetter from dataclasses import dataclass import cv2 import numpy as np @dataclass class Blackboard: image: np.ndarray contour: Optional[np.ndarray] = None boa...
code_fim
hard
{ "lang": "python", "repo": "MarkusvonStaden/blackboard2api", "path": "/image_capturing/green_detection.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def _create_mask(img, h_min = 50, s_min = 40, v_min = 0, h_max = 100, s_max = 200, v_max = 255, kernel_size = (10,10)): green_MIN = np.array([h_min, s_min, v_min], np.uint8) green_MAX = np.array([h_max, s_max, v_max], np.uint8) mask = cv2.inRange(img, green_MI...
code_fim
hard
{ "lang": "python", "repo": "MarkusvonStaden/blackboard2api", "path": "/image_capturing/green_detection.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> contours, hirachy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) if len(contours) != 0: c = max(contours, key=cv2.contourArea) epsilon = 0.015*cv2.arcLength(c, True) approx = cv2.approxPolyDP(c, epsilon, True) if len(approx...
code_fim
hard
{ "lang": "python", "repo": "MarkusvonStaden/blackboard2api", "path": "/image_capturing/green_detection.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rogozin-high-school/sat_monitoring_system path: /Modules/Control/Control.py from ..Magnetometer import magnetometer_factory from ..Magnetorquer import magnetorquerMT from ..Gyro import gyro_factory from ..Control import Scale_Convert from ..Communications.comm2 import * from threading import Thre...
code_fim
hard
{ "lang": "python", "repo": "Rogozin-high-school/sat_monitoring_system", "path": "/Modules/Control/Control.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> global __circle_time return (time % __circle_time) / __circle_time ''' ''' def get_angle_vector(angle:int)->numpy.array: if((angle / 90) % 2 != 1): angle = math.radians(angle) x = 1 value = 1 / (math.cos(angle) ** 2) z = math.sqrt(value - x) return nump...
code_fim
hard
{ "lang": "python", "repo": "Rogozin-high-school/sat_monitoring_system", "path": "/Modules/Control/Control.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: minesvieira/PRC-TrabalhoFinal path: /scripts/SpellsFull.py # -*- coding: utf-8 -*- import json import re champions = [] champion = "" # Reading data from the file with open('../datasets/championFull.json', encoding='utf-8') as f: data = json.loads(f.read()) nome = "" dict = {} dict.update...
code_fim
hard
{ "lang": "python", "repo": "minesvieira/PRC-TrabalhoFinal", "path": "/scripts/SpellsFull.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ull'][0: -4]) print(':' + championsInfo[item]['passive']['image']['full'][0: -4] + ' rdf:type owl:NamedIndividual ,') print(' :Passive ;') print(' :hasImage :' + championsInfo[item]['passive']['i...
code_fim
hard
{ "lang": "python", "repo": "minesvieira/PRC-TrabalhoFinal", "path": "/scripts/SpellsFull.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>(x_train, y_train), (x_test, y_test) = cifar100.load_data(label_mode='fine')<|fim_prefix|># repo: yungbyun/myml path: /keras/cifar100_small_image.py # https://keras.io/datasets/ # Dataset of 50,000 32x32 color training images, labeled over 100 categories, and 10,000 test images. <|fim_middle|>from kera...
code_fim
easy
{ "lang": "python", "repo": "yungbyun/myml", "path": "/keras/cifar100_small_image.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yungbyun/myml path: /keras/cifar100_small_image.py # https://keras.io/datasets/ # Dataset of 50,000 32x32 color training images, labeled over 100 categories, and 10,000 test images. <|fim_suffix|>(x_train, y_train), (x_test, y_test) = cifar100.load_data(label_mode='fine')<|fim_middle|>from kera...
code_fim
easy
{ "lang": "python", "repo": "yungbyun/myml", "path": "/keras/cifar100_small_image.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dpdahal/python7amnew path: /ifstatement.py # x = 10 # y = 20 # # if x > y: # print('x') # # else: # print('y') <|fim_suffix|>else: if y > z: print('y') else: print('z') # if x > y and x > z: # print('x is large') # elif y > x and y > z: # ...
code_fim
medium
{ "lang": "python", "repo": "dpdahal/python7amnew", "path": "/ifstatement.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if x > y: if x > z: print('x') else: print('z') else: if y > z: print('y') else: print('z') # if x > y and x > z: # print('x is large') # elif y > x and y > z: # print('y is large') # else: # print('z')<|fim_prefix|># repo: dpd...
code_fim
easy
{ "lang": "python", "repo": "dpdahal/python7amnew", "path": "/ifstatement.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: amostalong/XlsToLua-Python path: /XlsToLua.py #!/usr/bin/python3 import xlrd import sys import os import re import datetime import time import getopt import argparse today = datetime.date.today now = time.strftime("%H:%M:%S") dirName = time.strftime("%Y%m%d-%H%M%S", time.localtime()) header = ...
code_fim
hard
{ "lang": "python", "repo": "amostalong/XlsToLua-Python", "path": "/XlsToLua.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if ok == True: if newfoloder == True: fileOutput = open('./' + dirName + '/' + fileName + 'Data.lua.txt', 'w', encoding='utf-8') else: fileOutput = open('./' + fileName + 'Data....
code_fim
hard
{ "lang": "python", "repo": "amostalong/XlsToLua-Python", "path": "/XlsToLua.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> portion = os.path.splitext(filename) ext = portion[1] if ext == '.xlsx': finddatasheet = False print ('找到文件 -> {target} <- ..'.format(target = filename)) workbook = xlrd.open_workbook(filename) fo...
code_fim
hard
{ "lang": "python", "repo": "amostalong/XlsToLua-Python", "path": "/XlsToLua.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # restart at lambda=0 os.rename(inpname_L, tar_i) qti = qtk.QMRun(tar_i, 'cpmd', inplace=True, save_restart=True, maxstep=1, restart=True, **kwargs) # os.rename(inpname , ref_i) # qri = qtk.QMRun(ref_i, 'cpmd', inplace=True, #...
code_fim
hard
{ "lang": "python", "repo": "SamKChang/qctoolkit", "path": "/qctoolkit/alchemy/back/aljob.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cwd = os.getcwd() qout = qtk.QMRun(inpname, 'cpmd', inplace=True, restart=True, maxstep=1, **kwargs) return qout # not working def SecondOrderRun(inp, program=qtk.setting.qmcode, **kwargs): if program == 'cpmd': inpdir, inpname, psinp, new_run, kwargs\ ...
code_fim
hard
{ "lang": "python", "repo": "SamKChang/qctoolkit", "path": "/qctoolkit/alchemy/back/aljob.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SamKChang/qctoolkit path: /qctoolkit/alchemy/back/aljob.py import qctoolkit as qtk import qctoolkit.QM.qmcode.cpmd as cpmd from qctoolkit.QM.qmdir import qmDir import subprocess as sp import os, re, shutil import alpath as alp def ReferenceRun(inp, program=qtk.setting.qmcode, **kwargs): if pro...
code_fim
hard
{ "lang": "python", "repo": "SamKChang/qctoolkit", "path": "/qctoolkit/alchemy/back/aljob.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: karina-klinkeviciute/pyconlt path: /proposals/forms.py from django import forms from django.utils.translation import ugettext_lazy as _ from .models.proposal import Proposal from .models.review import Review class CFPForm(forms.Form): title = forms.CharField( label=_('Title'), ...
code_fim
hard
{ "lang": "python", "repo": "karina-klinkeviciute/pyconlt", "path": "/proposals/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Review fields = ("text", "rating", "status") class TalksFilterForm(forms.Form): def __init__(self, *args, **kwargs): choices = kwargs.pop('choices') super().__init__(*args, **kwargs) self.fields['option'].choices = choices option ...
code_fim
hard
{ "lang": "python", "repo": "karina-klinkeviciute/pyconlt", "path": "/proposals/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: griimnak/WhoAlias path: /whoalias/whoalias.py import asyncio import sys from ._cli import build_aliases_array from .facebook import scrape as fb_scrape from .github import scrape as gb_scrape from .google import scrape as go_scrape from .instagram import scrape as ig_scrape from .league import s...
code_fim
hard
{ "lang": "python", "repo": "griimnak/WhoAlias", "path": "/whoalias/whoalias.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> self.all_aliases = all_aliases try: loop.run_until_complete(self.main()) except Exception as e: exit(str(e)) finally: loop.close() async def main(self): """ :def main(): Dispatch all tasks then :await: and :retur...
code_fim
hard
{ "lang": "python", "repo": "griimnak/WhoAlias", "path": "/whoalias/whoalias.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: pranavx8498/scaling_tech path: /scaling techniques .py #!/usr/bin/env python # coding: utf-8 # scaling required when we using concepts of eudiean distance or gradient desent # scaling in not used desion tree's # In[1]: import pandas as pd # In[2]: df=pd.read_csv('netflix.csv') # In[3]...
code_fim
hard
{ "lang": "python", "repo": "pranavx8498/scaling_tech", "path": "/scaling techniques .py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # In[26]: y=dff.iloc[:,-1:] # In[27]: from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split x_train,x_test,y_train,y_test=train_test_split(x,y,train_size=0.2,random_state=2) # In[28]: medv=LinearRegression() # In[29]: medv.fit(x_train,y_train...
code_fim
hard
{ "lang": "python", "repo": "pranavx8498/scaling_tech", "path": "/scaling techniques .py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: iqianxing/console.log.api path: /test/test_helloworld.py import unittest <|fim_suffix|> assert 'hello, world.' if __name__ == '__main__': unittest.main()<|fim_middle|>class TestHelloWorld(unittest.TestCase): def test_hello(self):
code_fim
medium
{ "lang": "python", "repo": "iqianxing/console.log.api", "path": "/test/test_helloworld.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: iqianxing/console.log.api path: /test/test_helloworld.py import unittest class TestHelloWorld(unittest.TestCase): def test_hello(self): <|fim_middle|> assert 'hello, world.'
code_fim
easy
{ "lang": "python", "repo": "iqianxing/console.log.api", "path": "/test/test_helloworld.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: iqianxing/console.log.api path: /test/test_helloworld.py import unittest class TestHelloWorld(unittest.TestCase): def test_hello(self): <|fim_suffix|>if __name__ == '__main__': unittest.main()<|fim_middle|> assert 'hello, world.'
code_fim
easy
{ "lang": "python", "repo": "iqianxing/console.log.api", "path": "/test/test_helloworld.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Badge fields = '__all__'<|fim_prefix|># repo: Hir0v0/SNS-API path: /project0001api/badge/serializers.py from rest_framework import serializers from .models import Badge <|fim_middle|> class BadgeSerializer(serializers.ModelSerializer): """Serializer for badges...
code_fim
medium
{ "lang": "python", "repo": "Hir0v0/SNS-API", "path": "/project0001api/badge/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Badge fields = '__all__'<|fim_prefix|># repo: Hir0v0/SNS-API path: /project0001api/badge/serializers.py from rest_framework import serializers from .models import Badge class BadgeSerializer(serializers.ModelSerializer): <|fim_middle|> """Serializer for badges""" class M...
code_fim
easy
{ "lang": "python", "repo": "Hir0v0/SNS-API", "path": "/project0001api/badge/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hir0v0/SNS-API path: /project0001api/badge/serializers.py from rest_framework import serializers from .models import Badge <|fim_suffix|> class Meta: model = Badge fields = '__all__'<|fim_middle|>class BadgeSerializer(serializers.ModelSerializer): """Serializer for badges...
code_fim
medium
{ "lang": "python", "repo": "Hir0v0/SNS-API", "path": "/project0001api/badge/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> income_daily = models.IntegerField(blank=True, null=True) #доходы за день date_of_day = models.DateField(blank=True, null=True) # текущая дата pillow_all = models.IntegerField(blank=True, null=True) # подушка безопасности debts_all = models.IntegerField(blank=True, null=True) # общий...
code_fim
medium
{ "lang": "python", "repo": "rakssoft/avatar", "path": "/Base/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> income = models.IntegerField(blank=True, null=True) #доходы costs = models.IntegerField(blank=True, null=True) #расходы debts = models.IntegerField(blank=True, null=True) #долги assets = models.IntegerField(blank=True, null=True) #активы capital = models.IntegerField(un...
code_fim
medium
{ "lang": "python", "repo": "rakssoft/avatar", "path": "/Base/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rakssoft/avatar path: /Base/models.py from django.db import models from django.conf import settings # Create your models here. class PointA(models.Model): income = models.IntegerField(blank=True, null=True) #доходы costs = models.IntegerField(blank=True, null=True) #расходы ...
code_fim
medium
{ "lang": "python", "repo": "rakssoft/avatar", "path": "/Base/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 1등 번호를 출력한다. print('1등 번호 : ', end = '') for i in range(0, 6): print('{0:02d} '.format(lotto[i]), end = '') # sleep() : 인수로 지정된 시간 만큼 프로그램을 잠깐 멈춘다. # 시간은 초 단위로 지정한다. time.sleep(1) # ============================================ print('뽀나스 : {0:02d}'.format(lotto[6]))<|fim_prefix|>...
code_fim
hard
{ "lang": "python", "repo": "Ryujongwoo/python1910", "path": "/1017/06_lottoNumber.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ryujongwoo/python1910 path: /1017/06_lottoNumber.py import random import time # 추첨기를 준비한다. # 로또 추첨기로 사용할 빈 리스트를 선언한다. lotto = [] # 추첨기에 1 ~ 45의 공을 넣는다. for i in range(1, 46): # print(i) lotto.append(i) # ============================================ # print(lotto) <|fim_su...
code_fim
hard
{ "lang": "python", "repo": "Ryujongwoo/python1910", "path": "/1017/06_lottoNumber.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def rename(self, newName): if not self._isInternal: raise RuntimeError("Can't rename non-internal child") if not self.isLoadedToNative(): raise RuntimeError("Entity is't loaded to native") if self._name == newName: return True for chi...
code_fim
hard
{ "lang": "python", "repo": "lastcolour/GamePractice", "path": "/Sources/Editor/App/native/EntityNative.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lastcolour/GamePractice path: /Sources/Editor/App/native/EntityNative.py from .Native import NativeObject from .LogicNative import CreateLogic import traceback def _getUniqueNameForNewChild(entity, entityName): childEntityName = entityName isNameUnique = False idx = 1 while not ...
code_fim
hard
{ "lang": "python", "repo": "lastcolour/GamePractice", "path": "/Sources/Editor/App/native/EntityNative.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if not self._isInternal: raise RuntimeError("Can't rename non-internal child") if not self.isLoadedToNative(): raise RuntimeError("Entity is't loaded to native") if self._name == newName: return True for child in self._parent._children: ...
code_fim
hard
{ "lang": "python", "repo": "lastcolour/GamePractice", "path": "/Sources/Editor/App/native/EntityNative.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: arthurnovello/linguagens2-2019 path: /flask/DECORATOR/deco.py import functools def meu_decorator(f): @functools.wraps(f) def processa_f(*args, **kwargs): print("antes de exec f") f(*args, **kwargs) print("depois de exec f") return processa_f @meu_decorator ...
code_fim
medium
{ "lang": "python", "repo": "arthurnovello/linguagens2-2019", "path": "/flask/DECORATOR/deco.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": minha_funcao() soma(10, 12)<|fim_prefix|># repo: arthurnovello/linguagens2-2019 path: /flask/DECORATOR/deco.py import functools def meu_decorator(f): @functools.wraps(f) def processa_f(*args, **kwargs): print("antes de exec f") f(*args, **kwar...
code_fim
medium
{ "lang": "python", "repo": "arthurnovello/linguagens2-2019", "path": "/flask/DECORATOR/deco.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KirillMysnik/sp-motd-issue-test path: /addons/source-python/plugins/motd_issue_test/motd_issue_test.py # ============================================================================= # >> IMPORTS # ============================================================================= # Python from http.se...
code_fim
hard
{ "lang": "python", "repo": "KirillMysnik/sp-motd-issue-test", "path": "/addons/source-python/plugins/motd_issue_test/motd_issue_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # ============================================================================= # >> LOAD / UNLOAD # ============================================================================= def load(): global httpd httpd = HTTPServer(('', HTTPD_PORT), MyHTTPRequestHandler) Thread(target=httpd.serve_fore...
code_fim
hard
{ "lang": "python", "repo": "KirillMysnik/sp-motd-issue-test", "path": "/addons/source-python/plugins/motd_issue_test/motd_issue_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }