text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: stefan-falk/tensor2tensor path: /tensor2tensor/bin/test.py import os import sys from tensor2tensor.bin import t2t_trainer def problem_args(problem_name): <|fim_suffix|> return args def main(): sys.argv += problem_args('librispeech_clean_small') # sys.argv += problem_args('common_voice...
code_fim
hard
{ "lang": "python", "repo": "stefan-falk/tensor2tensor", "path": "/tensor2tensor/bin/test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>net = resnet18(num_classes = 10, norm_layer=norm_layer).to(device) net = torch.nn.DataParallel(net) print('Resuming from %s...' %(args.resume)) ckpt = torch.load('%s/best.pth' %(args.resume)) net.load_state_dict(ckpt['net']) print("Starting Test Error: %.3f" % ckpt['err_cls']) criterion = nn.CrossEntrop...
code_fim
hard
{ "lang": "python", "repo": "eyalperry88/lethean", "path": "/adversarial_lethean.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>criterion = nn.CrossEntropyLoss().to(device) optimizer = optim.SGD(net.parameters(), lr=args.lr) trset, trloader = prepare_train_data(args) teset, teloader = prepare_test_data(args) print("Lethean Attack") for i in range(args.epochs): idx = random.randint(0, len(trset) - 1) img, lbl = trset[idx]...
code_fim
hard
{ "lang": "python", "repo": "eyalperry88/lethean", "path": "/adversarial_lethean.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: eyalperry88/lethean path: /adversarial_lethean.py from __future__ import print_function import argparse import torch import torch.nn as nn import torch.optim as optim import random from utils.misc import * from utils.adapt_helpers import * from utils.rotation import rotate_batch, rotate_single_w...
code_fim
hard
{ "lang": "python", "repo": "eyalperry88/lethean", "path": "/adversarial_lethean.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mehulsbhatt/openag path: /models/old/records.py import cgi from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext import db from models.nutrient import * class SoilRecord(db.Model): year=...
code_fim
medium
{ "lang": "python", "repo": "mehulsbhatt/openag", "path": "/models/old/records.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.year=year class CropRecord(db.Model): year=db.DateProperty(auto_now_add=True) crops=db.ListProperty(db.Key) notes=db.StringProperty() @property def plot(self): Plot.gql("Where croprecord=:1",self.key()) def create(self, year): self.year=year def addCrop(self, crop): ...
code_fim
medium
{ "lang": "python", "repo": "mehulsbhatt/openag", "path": "/models/old/records.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def plot(self): Plot.gql("Where croprecord=:1",self.key()) def create(self, year): self.year=year def addCrop(self, crop): if addByKey(crop, self.crops): self.put()<|fim_prefix|># repo: mehulsbhatt/openag path: /models/old/records.py import cgi from google.appengine...
code_fim
hard
{ "lang": "python", "repo": "mehulsbhatt/openag", "path": "/models/old/records.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_addition_input_value(self): self.assertRaises(TypeError, add, 'ank', 6) if __name__ == '__main__': main()<|fim_prefix|># repo: ankitbharti1994/Python path: /UnitTestInPython/UnitTest/test_volume_cuboid.py """ Created on Fri Jan 07 20:53:58 2022 @author: Ankit Bharti """ from...
code_fim
hard
{ "lang": "python", "repo": "ankitbharti1994/Python", "path": "/UnitTestInPython/UnitTest/test_volume_cuboid.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #print 'IP=' + IP latency = '' try: # Use Scamper to determine the latency of the Requesting Client identified by the IP scamperCommand = "scamper -c 'ping -c 1' -i "+IP # Get the output of the system command output = commands.get...
code_fim
medium
{ "lang": "python", "repo": "soumyaramesh/Computer-Networking", "path": "/Projects/CDN/ActiveMeasurement.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: soumyaramesh/Computer-Networking path: /Projects/CDN/ActiveMeasurement.py # This file is used to run a program to perform Active measuremnts import commands import SocketServer import sys #Class to handle Socket request class Handler(SocketServer.BaseRequestHandler): <|fim_suffix|> port =...
code_fim
hard
{ "lang": "python", "repo": "soumyaramesh/Computer-Networking", "path": "/Projects/CDN/ActiveMeasurement.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def main(argv): port = int(argv[1]) addr = ('', port) # Start an active measurement system which listenes to a given port server = SocketServer.TCPServer(addr, Handler); print 'Active Measurement Server Listening at ' + str(port) + "..." server.serve_forever() if __name__ ==...
code_fim
medium
{ "lang": "python", "repo": "soumyaramesh/Computer-Networking", "path": "/Projects/CDN/ActiveMeasurement.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mathworks/sato path: /utils.py import os from os.path import join import json import pandas as pd import time import numpy as np import torch def str2bool(v): # convert string to boolean type for argparser input if isinstance(v, bool): return v if v.lower() in ('yes', 'true',...
code_fim
hard
{ "lang": "python", "repo": "mathworks/sato", "path": "/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return '_'.join(["{}-{}".format(k, dic[k]) for k in sorted(dic)]) def name2dic(s): return {x.split('-')[0]:x.split('-')[1] for x in s.split('_')} def get_valid_types(TYPENAME): with open(join(os.environ['BASEPATH'], 'configs', 'types.json'), 'r') as typefile: valid_types = json.l...
code_fim
hard
{ "lang": "python", "repo": "mathworks/sato", "path": "/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NishpaVanapalli/python path: /oop1.py ##class Human: ## pass ##hb1-HB("Sudhir") ##hb2=HB("Sreenu") <|fim_suffix|> def __init__(self,name,rollno): self.name=name self.rollno=rollno std1=Student("Siva",123)<|fim_middle|> class Student:
code_fim
easy
{ "lang": "python", "repo": "NishpaVanapalli/python", "path": "/oop1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.name=name self.rollno=rollno std1=Student("Siva",123)<|fim_prefix|># repo: NishpaVanapalli/python path: /oop1.py ##class Human: ## pass ##hb1-HB("Sudhir") ##hb2=HB("Sreenu") <|fim_middle|> class Student: def __init__(self,name,rollno):
code_fim
easy
{ "lang": "python", "repo": "NishpaVanapalli/python", "path": "/oop1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mcszorongat/PyTrnng path: /mf_iterTools.py from itertools import count, islice from math import sqrt def is_prime(x): if x<2: return False for i in range(2, int(sqrt(x)) + 1): if x%i == 0: return False return True def primes(x): return islice((p for p...
code_fim
hard
{ "lang": "python", "repo": "Mcszorongat/PyTrnng", "path": "/mf_iterTools.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(any([True, True])) print(any([True, False])) print(any([False, False])) # is there a TRUE print(all([True, True])) # are all of them TRUE print(all([True, False])) print(all([False, False])) print("Is there a prime between 1328 and 1361:", any(is_prime(x) for x in range(1328, 1361))) monday = ...
code_fim
medium
{ "lang": "python", "repo": "Mcszorongat/PyTrnng", "path": "/mf_iterTools.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Fufuhu/python_basic_leaning path: /ch7_practiceB.py class Circle(): def __init__(self, radius, color="white"): <|fim_suffix|>c1 = Circle(10, "black") print("半径:{}, 色: {}".format(c1.radius, c1.color))<|fim_middle|> self.radius = radius self.color = color
code_fim
medium
{ "lang": "python", "repo": "Fufuhu/python_basic_leaning", "path": "/ch7_practiceB.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>c1 = Circle(10, "black") print("半径:{}, 色: {}".format(c1.radius, c1.color))<|fim_prefix|># repo: Fufuhu/python_basic_leaning path: /ch7_practiceB.py class Circle(): def __init__(self, radius, color="white"): <|fim_middle|> self.radius = radius self.color = color
code_fim
medium
{ "lang": "python", "repo": "Fufuhu/python_basic_leaning", "path": "/ch7_practiceB.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>update_config(config_default, config) config = config_default<|fim_prefix|># repo: ukaraoz/snakemake-rules path: /snakemake_rules/rules/centipede/centipede.settings.smk # -*- snakemake -*- # # CENTIPEDE: Transcription factor footprinting and binding site prediction # install.packages("CENTIPEDE", repos="...
code_fim
medium
{ "lang": "python", "repo": "ukaraoz/snakemake-rules", "path": "/snakemake_rules/rules/centipede/centipede.settings.smk", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ukaraoz/snakemake-rules path: /snakemake_rules/rules/centipede/centipede.settings.smk # -*- snakemake -*- # # CENTIPEDE: Transcription factor footprinting and binding site prediction # install.packages("CENTIPEDE", repos="http://R-Forge.R-project.org") # # http://centipede.uchicago.edu/ # incl...
code_fim
medium
{ "lang": "python", "repo": "ukaraoz/snakemake-rules", "path": "/snakemake_rules/rules/centipede/centipede.settings.smk", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HectorTa1989/802.15.4-wireless-MAC-level-performance path: /code/TestModel.py import subprocess import logging import time import argparse import threading import os import matplotlib.pyplot as plt import numpy as np import argparse def runWeka(wekapath, modelpath, datapath): os.chdir(wekapa...
code_fim
hard
{ "lang": "python", "repo": "HectorTa1989/802.15.4-wireless-MAC-level-performance", "path": "/code/TestModel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if k<6: k=k+1 continue else: if row=='': continue instance, actual, predicted, error=row.split() matrix.append([int(instance), float(actual), float(predicted)]) matrix=np.array(matrix) matr...
code_fim
medium
{ "lang": "python", "repo": "HectorTa1989/802.15.4-wireless-MAC-level-performance", "path": "/code/TestModel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: datacake/python-datacake-http-example path: /main.py import requests if __name__ == "__main__": # individual datacake webhook url # Change this to the webhook url of your datacake device/product datacake_url = "https://api.datacake.co/integrations/api/ae6dd531-4cf6-4966-b5c9-6c43939...
code_fim
medium
{ "lang": "python", "repo": "datacake/python-datacake-http-example", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # create api call r = requests.post(datacake_url, json={ "number_of_persons_a": number_of_persons_a, "number_of_persons_b": number_of_persons_b, "additional_payload": additional_payload, "some_data": some_data, "a_boolean": a_boolean, "serial": seria...
code_fim
medium
{ "lang": "python", "repo": "datacake/python-datacake-http-example", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># In[38]: for i in range(len(y_pred)): print(y_pred[i]) # In[3]: # run SVR for the AXP-...DD stocks axp = pd.DataFrame(columns=aapl.columns) # In[3]: #stocks = ['AAPL','AXP','BA','CAT','CSCO','CVX','DIS','DD','GS'] stocks = ['MCD'] # In[4]: # read indicators 09-18 ADXR = pd.read_csv('data/dj...
code_fim
hard
{ "lang": "python", "repo": "kakaxi2/A-Hybrid-Approach-for-Generating-Investor-Views-in-Black-Litterman-Model", "path": "/code/return_forecast.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># In[72]: cov # In[73]: cov.to_csv('cov.csv') # In[10]: # store return prediction result = pd.DataFrame(columns=stocks) # In[21]: # indicators forecast ADXR_f = pd.read_csv('data/tesingadxr740.csv') ATR_f = pd.read_csv('data/tesingatr740.csv') SMA_f = pd.read_csv('data/sma_forecast.csv') Hurst_f...
code_fim
hard
{ "lang": "python", "repo": "kakaxi2/A-Hybrid-Approach-for-Generating-Investor-Views-in-Black-Litterman-Model", "path": "/code/return_forecast.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kakaxi2/A-Hybrid-Approach-for-Generating-Investor-Views-in-Black-Litterman-Model path: /code/return_forecast.py # coding: utf-8 # In[1]: import numpy as np import pandas as pd from sklearn.svm import SVR # In[2]: from sklearn.preprocessing import StandardScaler # In[3]: #import matplotl...
code_fim
hard
{ "lang": "python", "repo": "kakaxi2/A-Hybrid-Approach-for-Generating-Investor-Views-in-Black-Litterman-Model", "path": "/code/return_forecast.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class LocationNotSet(Exception): pass<|fim_prefix|># repo: cdunklau/seleniumclean path: /seleniumclean.py def clear_firefox_driver_session(firefox_driver): <|fim_middle|> firefox_driver.delete_all_cookies() # Note this only works if the browser is set to a location. firefox_driver.execute...
code_fim
hard
{ "lang": "python", "repo": "cdunklau/seleniumclean", "path": "/seleniumclean.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cdunklau/seleniumclean path: /seleniumclean.py def clear_firefox_driver_session(firefox_driver): <|fim_suffix|> class LocationNotSet(Exception): pass<|fim_middle|> firefox_driver.delete_all_cookies() # Note this only works if the browser is set to a location. firefox_driver.execute...
code_fim
hard
{ "lang": "python", "repo": "cdunklau/seleniumclean", "path": "/seleniumclean.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class LocationNotSet(Exception): pass<|fim_prefix|># repo: cdunklau/seleniumclean path: /seleniumclean.py def clear_firefox_driver_session(firefox_driver): <|fim_middle|> firefox_driver.delete_all_cookies() # Note this only works if the browser is set to a location. firefox_driver.execute_...
code_fim
hard
{ "lang": "python", "repo": "cdunklau/seleniumclean", "path": "/seleniumclean.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ade25/ade25.assetmanager path: /ade25/assetmanager/browser/repository.py # -*- coding: utf-8 -*- """Module providing views for asset storage folder""" from Products.Five.browser import BrowserView from plone import api from plone.app.contenttypes.interfaces import IImage class AssetRepositoryVie...
code_fim
medium
{ "lang": "python", "repo": "ade25/ade25.assetmanager", "path": "/ade25/assetmanager/browser/repository.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def item_index(self, uid): return len(self.contained_items(uid)) def preview_image(self, uid): images = self.contained_items(uid) preview = None if len(images): first_item = images[0].getObject() if IImage.providedBy(first_item): ...
code_fim
hard
{ "lang": "python", "repo": "ade25/ade25.assetmanager", "path": "/ade25/assetmanager/browser/repository.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> images = self.contained_items(uid) preview = None if len(images): first_item = images[0].getObject() if IImage.providedBy(first_item): preview = first_item return preview<|fim_prefix|># repo: ade25/ade25.assetmanager path: /ade25/ass...
code_fim
hard
{ "lang": "python", "repo": "ade25/ade25.assetmanager", "path": "/ade25/assetmanager/browser/repository.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print "Jeffrey K Skilling exercised stock:", enron_data["SKILLING JEFFREY K"]["exercised_stock_options"] print "money for Lay:", enron_data["LAY KENNETH L"]["total_payments"], ", Skilling:", enron_data["SKILLING JEFFREY K"]["total_payments"], " & Fastow:", enron_data["FASTOW ANDREW S"]["total_payments"] ...
code_fim
hard
{ "lang": "python", "repo": "Lundgren/ud120-intro-ml", "path": "/datasets_questions/explore_enron_data.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lundgren/ud120-intro-ml path: /datasets_questions/explore_enron_data.py #!/usr/bin/python """ Starter code for exploring the Enron dataset (emails + finances); loads up the dataset (pickled dict of dicts). The dataset has the form: enron_data["LASTNAME FIRSTNAME MIDDLEINITIAL"]...
code_fim
hard
{ "lang": "python", "repo": "Lundgren/ud120-intro-ml", "path": "/datasets_questions/explore_enron_data.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> bs_year, bs_month, bs_day = _ad_to_bs(year, month, day) formatted_date = "{}-{:02}-{:02}".format(bs_year, bs_month, bs_day) return formatted_date<|fim_prefix|># repo: e911/pyBSDate path: /pyBSDate/BSDate.py __author__ = 'sushil' from .utilities import decompose_date from .DateConverter import...
code_fim
hard
{ "lang": "python", "repo": "e911/pyBSDate", "path": "/pyBSDate/BSDate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>. ''' x, y = 2.4, 6.4 perimeter = (x*2)+(y*2) area = x*y print("Perimeter is "+str(perimeter) + ", Area is " + str(area))<|fim_prefix|># repo: TankFairy/python_fundamentals path: /01_07_area_perimeter.py ''' Write the necessary code to display the area and perimet<|fim_middle|>er of a rectangle that ha...
code_fim
medium
{ "lang": "python", "repo": "TankFairy/python_fundamentals", "path": "/01_07_area_perimeter.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TankFairy/python_fundamentals path: /01_07_area_perimeter.py ''' Write the necessary code to display the area and perimeter of a rectangle that has a width of 2.4 and a height of 6.4<|fim_suffix|>nt("Perimeter is "+str(perimeter) + ", Area is " + str(area))<|fim_middle|>. ''' x, y = 2.4, 6.4 pe...
code_fim
medium
{ "lang": "python", "repo": "TankFairy/python_fundamentals", "path": "/01_07_area_perimeter.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DRMPN/PythonCode path: /CodeWars/6kyu/multi_tap_keypad.py def presses(phrase): keyboard = [ '1', 'ABC2', 'DEF3', 'GHI4', 'JKL5', <|fim_suffix|>= 0 for lttr in phrase.upper(): for key in keyboard: try: i = key.i...
code_fim
hard
{ "lang": "python", "repo": "DRMPN/PythonCode", "path": "/CodeWars/6kyu/multi_tap_keypad.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> i += 1 amount += i except ValueError: pass return amount<|fim_prefix|># repo: DRMPN/PythonCode path: /CodeWars/6kyu/multi_tap_keypad.py def presses(phrase): keyboard = [ '1', 'ABC2', 'DEF3', 'GHI4', ...
code_fim
hard
{ "lang": "python", "repo": "DRMPN/PythonCode", "path": "/CodeWars/6kyu/multi_tap_keypad.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zlodiak/lessons path: /python/EXAMPLES/projects/parse_html/5_forum_new/quantity.py import shelve def quantity_posts(): <|fim_suffix|>if __name__ == "__main__": print('begin') quantity_posts() print('end')<|fim_middle|> try: data = shelve.open('data') except Exc...
code_fim
hard
{ "lang": "python", "repo": "zlodiak/lessons", "path": "/python/EXAMPLES/projects/parse_html/5_forum_new/quantity.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": print('begin') quantity_posts() print('end')<|fim_prefix|># repo: zlodiak/lessons path: /python/EXAMPLES/projects/parse_html/5_forum_new/quantity.py import shelve def quantity_posts(): <|fim_middle|> try: data = shelve.open('data') except E...
code_fim
hard
{ "lang": "python", "repo": "zlodiak/lessons", "path": "/python/EXAMPLES/projects/parse_html/5_forum_new/quantity.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mohsenmalmir/NoEmuRL path: /noemurl/app.py # ============================================================================= # Created By : Mohsen Malmir # Created Date: Fri Nov 09 8:10 PM EST 2018 # Purpose : this file implements the gui handling to interact with emulators # =================...
code_fim
hard
{ "lang": "python", "repo": "mohsenmalmir/NoEmuRL", "path": "/noemurl/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ This function scans all the open windows and returns a handle to the first known and supported emulator-game pair. Args: None Returns: """ # get a list of all open windows windows = CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly&kCGWindowLis...
code_fim
medium
{ "lang": "python", "repo": "mohsenmalmir/NoEmuRL", "path": "/noemurl/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while i > 0: print(i,end='') i -= 1 print()<|fim_prefix|># repo: chris-r-harwell/HackerRankPython path: /triangleQuest2-3.py #!/bin/env python3 """ https://www.hackerrank.com/challenges/triangle-quest-2 INPUT: integer N where 0 < N < 10 OUTPUT: print palindromic triangle of s...
code_fim
medium
{ "lang": "python", "repo": "chris-r-harwell/HackerRankPython", "path": "/triangleQuest2-3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chris-r-harwell/HackerRankPython path: /triangleQuest2-3.py #!/bin/env python3 """ https://www.hackerrank.com/challenges/triangle-quest-2 INPUT: integer N where 0 < N < 10 <|fim_suffix|> e.g.for N=5 1 121 12321 1234321 123454321 """ for i in range(1, int(input()) + 1): j = 1 while j ...
code_fim
easy
{ "lang": "python", "repo": "chris-r-harwell/HackerRankPython", "path": "/triangleQuest2-3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nukevoid/dgus_hass_connection path: /dgus/sensor.py import logging from .const import ( DOMAIN, CONF_SCREENS ) from typing import Any, Callable, Dict, Optional from homeassistant.helpers.entity import Entity from homeassistant.helpers.typing import ( ConfigType, DiscoveryInfoType,...
code_fim
hard
{ "lang": "python", "repo": "nukevoid/dgus_hass_connection", "path": "/dgus/sensor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def state_listener(self, entity, old_state, new_state): settings = self._state_track_settings[entity] if settings['type'] == 'int': StateConverters.send_int( new_state, settings, self._protocol.protocol) elif settings['type'] == 'map': St...
code_fim
hard
{ "lang": "python", "repo": "nukevoid/dgus_hass_connection", "path": "/dgus/sensor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def seam_carve(image, mode, mask): if mode == 'horizontal shrink': return cut(image, mask) elif mode == 'vertical shrink': transposed_image, transposed_mask, transposed_seam_mask = cut( np.transpose(image, (1, 0, 2)), mask.T if mask is not None else None ) ...
code_fim
hard
{ "lang": "python", "repo": "asntr/DAS", "path": "/CV/hw3/seam_carve.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: asntr/DAS path: /CV/hw3/seam_carve.py import numpy as np def get_mask(mask): r = mask[:, :, 0] g = mask[:, :, 1] return r // (r.max() or 1) * -1 + g // (g.max() or 1) def calculate_brightness(image): weights = np.array([0.299, 0.587, 0.114]) brightness_matrix = (image*weig...
code_fim
hard
{ "lang": "python", "repo": "asntr/DAS", "path": "/CV/hw3/seam_carve.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>e.register(Profile) # Register your models here.<|fim_prefix|># repo: ohyoungjooung2/jango_blog path: /users/admin.py from django.contrib import admin from .models i<|fim_middle|>mport Profile from django.contrib.admin.templatetags.admin_list import admin_actions admin.sit
code_fim
medium
{ "lang": "python", "repo": "ohyoungjooung2/jango_blog", "path": "/users/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ohyoungjooung2/jango_blog path: /users/admin.py from django.contrib import admin from .models import Profile from django.contrib.admin.template<|fim_suffix|>e.register(Profile) # Register your models here.<|fim_middle|>tags.admin_list import admin_actions admin.sit
code_fim
easy
{ "lang": "python", "repo": "ohyoungjooung2/jango_blog", "path": "/users/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> csvwriter = csv.writer(csv_file, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) csvwriter.writerow(['reflective', 'transitive']) for trial_id in trial_sets.top_ids: wrist_oxygen, fingertip_oxygen, transitive_oxygen = dl.load_all_oxygen(trial_id) for oF, oT in zip(f...
code_fim
hard
{ "lang": "python", "repo": "jipson7/PPGDataAnalysis", "path": "/examine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jipson7/PPGDataAnalysis path: /examine.py import data import numpy as np import matplotlib.pyplot as plt import xgboost as xgb import pandas as pd import csv from matplotlib2tikz import save as tikz_save import trial_sets def print_stats(trial_id, dl): wrist_device, _, true_device = dl.lo...
code_fim
hard
{ "lang": "python", "repo": "jipson7/PPGDataAnalysis", "path": "/examine.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> trial_ids = trial_sets.top_ids dl = data.DataLoader(window_size=100, threshold=2.0, algo_name='enhanced', features='comprehensive') for trial_id in trial_ids: print("Trial {}".format(trial_id)) training_ids = trial_ids.copy() training_ids.remove(trial_id) vi...
code_fim
hard
{ "lang": "python", "repo": "jipson7/PPGDataAnalysis", "path": "/examine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def gamewon(self,board): global grid,winner val=0 for row in range(0,3): if((grid[row][0]==grid[row][1]==grid[row][2]) and grid[row][0] is not None): logging.info("ROW no. {0} wins".format(row)) winner=grid[row...
code_fim
hard
{ "lang": "python", "repo": "nirvik/pygame-bomberman-streaming", "path": "/game.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> grid[col][row]=piece def clickboard(self,board): global grid,XO,OX d=TTTError(1,"SPACE OCCUPIED ALREADY") (mouseX,mouseY)=pygame.mouse.get_pos() (self.col,self.row)=self.boardpos(mouseY,mouseX) try: if (grid[self.row][self.col]=='X' or grid[self.row][sel...
code_fim
hard
{ "lang": "python", "repo": "nirvik/pygame-bomberman-streaming", "path": "/game.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nirvik/pygame-bomberman-streaming path: /game.py import pygame from pygame.locals import * import threading from load import * import time import socket as sck import sys port=8767 grid=[[None,None,None],[None,None,None],[None,None,None]] XO='X' OX='X' winner=None coordinate1=600 coordinate2=20...
code_fim
hard
{ "lang": "python", "repo": "nirvik/pygame-bomberman-streaming", "path": "/game.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class_bag = self.calc_cost(Y_out, Y) corr = class_bag['problem_cor']+class_bag['test_cor']+class_bag['treatment_cor'] tot = class_bag['total'] loss_list += [loss.item()] seq_length += [Y.shape[0]] if (batch_...
code_fim
hard
{ "lang": "python", "repo": "shahakshay11/medical-entity-extraction-nlp", "path": "/code/dnc_code/tasks/ner_task_bio.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shahakshay11/medical-entity-extraction-nlp path: /code/dnc_code/tasks/ner_task_bio.py f the file: " + file + " ************\n") for x in file_lines: print("------------------------------------------------------------") print("File Lines No: " + str(counter)) ...
code_fim
hard
{ "lang": "python", "repo": "shahakshay11/medical-entity-extraction-nlp", "path": "/code/dnc_code/tasks/ner_task_bio.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shahakshay11/medical-entity-extraction-nlp path: /code/dnc_code/tasks/ner_task_bio.py lf.labelDict['i-test'] = 3 # Test - Inside self.labelDict['b-treatment'] = 4 # Treatment - Beginning self.labelDict['i-treatment'] = 5 # Treatment - Inside self.labelDict['o'] ...
code_fim
hard
{ "lang": "python", "repo": "shahakshay11/medical-entity-extraction-nlp", "path": "/code/dnc_code/tasks/ner_task_bio.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return np.zeros(self.get_n_dimensions(), dtype=np.uint32) def iterate_indices(self, indices): """ iterate given indices [i1, i2, ...] by one. For easier iteration. The convention here is arbitrary, but its the order the arrays would be traversed in a series of nested ...
code_fim
hard
{ "lang": "python", "repo": "wisecg/pygama", "path": "/pygama/dsp/dsp_optimize.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ iterate given indices [i1, i2, ...] by one. For easier iteration. The convention here is arbitrary, but its the order the arrays would be traversed in a series of nested for loops in the order appearin in dims (first dimension is first for loop, etc): Return F...
code_fim
hard
{ "lang": "python", "repo": "wisecg/pygama", "path": "/pygama/dsp/dsp_optimize.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> a_plot.addSimple(plot.PlotCell( calc.sma((sd.Vs,sd.dates),20 ))) arr_obv = calc.obv((sd.Cs,sd.Vs,sd.dates) ) a_plot.addSimple(plot.PlotCell( arr_obv)) a_plot.addSimple(plot.PlotCell( calc.sma(arr_obv, 20),overlay=True)) a_plot.addSimple(plo...
code_fim
hard
{ "lang": "python", "repo": "rcshadman/workspace_python", "path": "/port_loader.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rcshadman/workspace_python path: /port_loader.py import stock as stk import portfolio as portf import plot import sys import cmd import os import decision as des class CLI(cmd.Cmd): def __init__(self): cmd.Cmd.__init__(self) self.prompt = '$> ' self.stk_data_c...
code_fim
hard
{ "lang": "python", "repo": "rcshadman/workspace_python", "path": "/port_loader.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>## ------------- Simple Gradients ------------- ## print("# ------------- Simple Gradients ------------- #") # out.backward() is equivalent to doing out.backward(torch.Tensor([1.0])) out.backward() print("dout/dx \n", x.grad) # gradient of z = 3(x+2)^2, dout/dx = 3/2(x+2), x=1 ## ------------- Crazy Grad...
code_fim
medium
{ "lang": "python", "repo": "youngguncho/pytorch-studies", "path": "/pytorch_basic/main_autograd.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: youngguncho/pytorch-studies path: /pytorch_basic/main_autograd.py from __future__ import print_function # Should comes first than torch import torch from torch.autograd import Variable ## ## Autograd.Variable is the central class of the package. It wraps a Tensor, and supports nearly all of oper...
code_fim
medium
{ "lang": "python", "repo": "youngguncho/pytorch-studies", "path": "/pytorch_basic/main_autograd.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 520In7/as-tool path: /as_perf_logcat_count/logcat_time.py # -*- coding: utf-8 -*- # !/usr/bin/python import re import sys import xlwt import os ''' python logcat_time.py config_file logcat_file ''' config_file = sys.argv[1] logcat_file = sys.argv[2] turns_time = 0 turn_compelete_flag = 0 def ...
code_fim
hard
{ "lang": "python", "repo": "520In7/as-tool", "path": "/as_perf_logcat_count/logcat_time.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def caculate_tag_distance(str1, str2): f = open(logcat_file) finish_time = '' start_time = '' turn_times = 0 for line in f: turn_compelete_flag = False if str1 in line: turn_compelete_flag = False start_time = line.split()[1] if str2 in l...
code_fim
hard
{ "lang": "python", "repo": "520In7/as-tool", "path": "/as_perf_logcat_count/logcat_time.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: johannakarras/Deep-Neural-Networks-for-Black-Hole-Imaging path: /RML/data_term_functions.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Jun 14 20:35:10 2020 @author: Johanna """ import numpy as np ############################################################################...
code_fim
hard
{ "lang": "python", "repo": "johannakarras/Deep-Neural-Networks-for-Black-Hole-Imaging", "path": "/RML/data_term_functions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>############################################################################### # Log Closure Amplitude Functions ############################################################################### def compute_lgcamp(X, Amatrices): ''' Compute log closure amplitude of image vector X ''' a1 = np.ab...
code_fim
hard
{ "lang": "python", "repo": "johannakarras/Deep-Neural-Networks-for-Black-Hole-Imaging", "path": "/RML/data_term_functions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: milospjanic/FibonacciDictionary path: /FibonacciDictionary.py Dict={0:0, 1:1} def fibo(n): if n not in Dict: val=fibo(n-1)+fibo(n-2) Dict[n]=val return Dict[n] n=int(input("Enter the value of n:")) print("Fibonacci(", n,")= ", fibo(n)) <|fim_suffix|># check if the number ...
code_fim
medium
{ "lang": "python", "repo": "milospjanic/FibonacciDictionary", "path": "/FibonacciDictionary.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># check if the number of terms is valid if nterms <= 0: print("Plese enter a positive integer") else: print("Fibonacci sequence:") for i in range(nterms):``` print(fibo(i), end=" , ")<|fim_prefix|># repo: milospjanic/FibonacciDictionary path: /FibonacciDictionary.py Dict={0:0, 1:1} def fi...
code_fim
medium
{ "lang": "python", "repo": "milospjanic/FibonacciDictionary", "path": "/FibonacciDictionary.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class THROW: # Raise an exception of given type with given arguments # Example: # THROW( # 'org/python/exceptions/AttributeError', # ['Ljava/lang/String;', JavaOpcodes.LDC_W("Invalid attribute")], # ) def __init__(self, exception_class, *exception_args): ...
code_fim
hard
{ "lang": "python", "repo": "dibyadas/voc", "path": "/voc/python/types/java.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: davidmeunier79/neuropype_ephy path: /neuropype_ephy/interfaces/mne/Inverse_solution.py # -*- coding: utf-8 -*- """ Created on Mon May 2 17:24:00 2016 @author: pasca """ # -*- coding: utf-8 -*- import os.path as op from nipype.utils.filemanip import split_filename as split_f from nipype.inter...
code_fim
hard
{ "lang": "python", "repo": "davidmeunier79/neuropype_ephy", "path": "/neuropype_ephy/interfaces/mne/Inverse_solution.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> events_id = traits.Dict(None, desc='the id of all events to consider.', mandatory=False) t_min = traits.Float(None, desc='start time before event', mandatory=False) t_max = traits.Float(None, desc='end time after event', mandatory=False) class NoiseCovarianceConnOutputSpec(TraitedSpec): ...
code_fim
hard
{ "lang": "python", "repo": "davidmeunier79/neuropype_ephy", "path": "/neuropype_ephy/interfaces/mne/Inverse_solution.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: varunbelgaonkar/Beginner-Python-projects path: /calculator.py from tkinter import * root = Tk() root.title("Calculator") e = Entry(root, width = 50, borderwidth = 5) e.grid(row = 0, column = 0, columnspan = 4, padx = 10, pady = 20) def button_click(number): digit = e.get() e.delete...
code_fim
hard
{ "lang": "python", "repo": "varunbelgaonkar/Beginner-Python-projects", "path": "/calculator.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def clear(): e.delete(0, END) #creating buttons button_1 = Button(root, text = "1", height = 5, width = 10,command = lambda:button_click(1)) button_2 = Button(root, text = "2", height = 5, width = 10, command = lambda:button_click(2)) button_3 = Button(root, text = "3", height = 5, width = 10, ...
code_fim
hard
{ "lang": "python", "repo": "varunbelgaonkar/Beginner-Python-projects", "path": "/calculator.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: haakensonb/advent_2017 path: /day_5/twisty_maze.py # maze = [0, 3, 0, 1, -3] with open('./day_5/input.txt') as f: maze = f.readlines() f.close maze = [int(line.strip()) for line in maze] # I think I will just expand on the original functions # from now on rather than separating part one from...
code_fim
medium
{ "lang": "python", "repo": "haakensonb/advent_2017", "path": "/day_5/twisty_maze.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> end = len(maze) - 1 step_counter = 0 offset = 0 while True: cur_index = offset offset = offset + maze[cur_index] if maze[cur_index] >= 3: maze[cur_index] = maze[cur_index] - 1 else: maze[cur_index] = maze[cur_index] + 1 step_...
code_fim
medium
{ "lang": "python", "repo": "haakensonb/advent_2017", "path": "/day_5/twisty_maze.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: llyuer/Tigress_protection path: /symbolic_expressions/sample20-virt-random-opcodes-false.py #!/usr/bin/env python2 ## -*- coding: utf-8 -*- import sys def sx(bits, value): sign_bit = 1 << (bits - 1) return (value & (sign_bit - 1)) - (value & sign_bit) SymVar_0 = int(sys.argv[1]) ref_26...
code_fim
hard
{ "lang": "python", "repo": "llyuer/Tigress_protection", "path": "/symbolic_expressions/sample20-virt-random-opcodes-false.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ref_62587 # MOV operation ref_72083 = ref_72007 # MOV operation ref_72095 = ref_71084 # MOV operation ref_72097 = (ref_72083 >> ((ref_72095 & 0xFF) & 0x3F)) # SHR operation ref_72198 = ref_72097 # MOV operation ref_72210 = ref_69493 # MOV operation ref_72212 = (ref_72210 | ref_72198) # OR operation ref_7...
code_fim
hard
{ "lang": "python", "repo": "llyuer/Tigress_protection", "path": "/symbolic_expressions/sample20-virt-random-opcodes-false.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: clintreyes/num_model path: /ch3/integrate_sine.py from trapezoidal import trapezoidal from midpoint import midpoint from math import pi, sin <|fim_suffix|> I_t = trapezoidal(f, a, b, n) I_m = midpoint() return None a = 0.0; b = pi f = lambda x: sin(x)<|fim_middle|>def integrate_sine(...
code_fim
easy
{ "lang": "python", "repo": "clintreyes/num_model", "path": "/ch3/integrate_sine.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> I_t = trapezoidal(f, a, b, n) I_m = midpoint() return None a = 0.0; b = pi f = lambda x: sin(x)<|fim_prefix|># repo: clintreyes/num_model path: /ch3/integrate_sine.py from trapezoidal import trapezoidal from midpoint import midpoint from math import pi, sin <|fim_middle|>def integrate_sine(...
code_fim
easy
{ "lang": "python", "repo": "clintreyes/num_model", "path": "/ch3/integrate_sine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>a = 0.0; b = pi f = lambda x: sin(x)<|fim_prefix|># repo: clintreyes/num_model path: /ch3/integrate_sine.py from trapezoidal import trapezoidal from midpoint import midpoint from math import pi, sin <|fim_middle|>def integrate_sine(f, a, b, n = 2): I_t = trapezoidal(f, a, b, n) I_m = midpoint()...
code_fim
medium
{ "lang": "python", "repo": "clintreyes/num_model", "path": "/ch3/integrate_sine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pvredev/Sentiment-Analysis-for-Trading path: /stop_words.py from nltk.corpus import stopwords from nltk.tokenize import word_tokenize #Print Stop words stop_words = set(stopwords.words("english")) print(stop_words) example_text = "This is general sentence to just clarify if stop words ar...
code_fim
medium
{ "lang": "python", "repo": "Pvredev/Sentiment-Analysis-for-Trading", "path": "/stop_words.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>words = word_tokenize(example_text) filtered_sentence = [] for w in words: for w not in stop_words: filtered_sentence.append(w) #print filtered sentences print(filtered_sentence) #print in a line filtered_sentence1 = [w for w in words if not w in stop_words] #print filtered se...
code_fim
hard
{ "lang": "python", "repo": "Pvredev/Sentiment-Analysis-for-Trading", "path": "/stop_words.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #if divisible by 400, definitely a leap year if date % 400 == 0: return True #if divisible by 100 (and not 400), not a leap year elif date % 100 == 0: return False #divisible by 4 and not by 100? leap year elif date % 4 == 0: return True #otherwise not a leap year else : return False<|fim_prefi...
code_fim
easy
{ "lang": "python", "repo": "itsolutionscorp/AutoStyle-Clustering", "path": "/all_data/exercism_data/python/leap/1a0bb11019da44c5815327d64bbc04a6.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: itsolutionscorp/AutoStyle-Clustering path: /all_data/exercism_data/python/leap/1a0bb11019da44c5815327d64bbc04a6.py #returns true if given date is a leap year, false otherwise <|fim_suffix|> #if divisible by 400, definitely a leap year if date % 400 == 0: return True #if divisible by 100 (and ...
code_fim
easy
{ "lang": "python", "repo": "itsolutionscorp/AutoStyle-Clustering", "path": "/all_data/exercism_data/python/leap/1a0bb11019da44c5815327d64bbc04a6.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def fix_line_endings(fname, eol=b'\n'): """Change all line endings to ``eol``. """ lines = [chomp(line) for line in open(fname, 'rb').readlines()] with open(fname, 'wb') as fp: for line in lines: fp.write(line + eol) def copy(ctx, source, dest, force=False): """Co...
code_fim
hard
{ "lang": "python", "repo": "datakortet/dk-tasklib", "path": "/dktasklib/concat.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: datakortet/dk-tasklib path: /dktasklib/concat.py # -*- coding: utf-8 -*- from __future__ import print_function import os import sys from dkfileutils.path import Path def line_endings(fname): """Return all line endings in the file. """ _endings = {line[-2:] for line in open(fname, '...
code_fim
hard
{ "lang": "python", "repo": "datakortet/dk-tasklib", "path": "/dktasklib/concat.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Buradaki Try Except istisna blokları datalar kaydedilirken varsa oluşan hataları ayıklayarak bizlere mesaj olarak döner try: session.add(ım_db) session.commit() except: session.rollback() raise finally: ...
code_fim
hard
{ "lang": "python", "repo": "yusufhandogan/IMDB-TOP-250-DATA-CRAWLING-PROJECT-WITH-PYTHON-SCRAPY", "path": "/IMDB/IMDB/pipelines.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ım_db.IMDB_RATING = item["IMDB_RATING"] # Buradaki Try Except istisna blokları datalar kaydedilirken varsa oluşan hataları ayıklayarak bizlere mesaj olarak döner try: session.add(ım_db) session.commit() except: session.rollbac...
code_fim
hard
{ "lang": "python", "repo": "yusufhandogan/IMDB-TOP-250-DATA-CRAWLING-PROJECT-WITH-PYTHON-SCRAPY", "path": "/IMDB/IMDB/pipelines.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yusufhandogan/IMDB-TOP-250-DATA-CRAWLING-PROJECT-WITH-PYTHON-SCRAPY path: /IMDB/IMDB/pipelines.py from sqlalchemy.orm import sessionmaker from IMDB.spiders.models import IMDB_DATABASE, db_connect, create_table class ScrapySpiderPipeline(object): # Bu Fonksiyon Veritabanı bağlantısını v...
code_fim
hard
{ "lang": "python", "repo": "yusufhandogan/IMDB-TOP-250-DATA-CRAWLING-PROJECT-WITH-PYTHON-SCRAPY", "path": "/IMDB/IMDB/pipelines.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#the angle of rotation around the axis float32 angle ================================================================================ MSG: geometry_msgs/Point32 # This contains the position of a point in free space(with 32 bits of precision). # It is recommeded to use Point wherever possible instead of P...
code_fim
hard
{ "lang": "python", "repo": "brennand/ics_bioloid_fuerte", "path": "/KDL/arm_navigation_msgs/src/arm_navigation_msgs/srv/_GetPlanningScene.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: brennand/ics_bioloid_fuerte path: /KDL/arm_navigation_msgs/src/arm_navigation_msgs/srv/_GetPlanningScene.py diff.allowed_collision_matrix.entries: length = len(val1.enabled) buff.write(_struct_I.pack(length)) pattern = '<%sB'%length buff.write(val1.enabled.tostring...
code_fim
hard
{ "lang": "python", "repo": "brennand/ics_bioloid_fuerte", "path": "/KDL/arm_navigation_msgs/src/arm_navigation_msgs/srv/_GetPlanningScene.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>out))-deleted_length_after] # real_result=str(stdout.decode("utf-8")).replace("Microsoft Windows [Version 10.0.10586]\r\n(c) 2015 Microsoft Corporation. All rights reserved.\r\n\r\n","") # real_result=real_result.replace(">More?","") # print(real_result) # return real_resul...
code_fim
hard
{ "lang": "python", "repo": "AlBannaTechno/AbtTerminal", "path": "/Depricated_.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlBannaTechno/AbtTerminal path: /Depricated_.py # "" # "deb_char_cont_x9875" # # def watch_edit_text(self): # execute when test edited # # logging.info("TQ : " + str(len(self.te_sql_cmd.toPlainText()))) # # logging.info("TE : " + str(len(self.cmd_last_text))) # # logging.info("LEN : ...
code_fim
hard
{ "lang": "python", "repo": "AlBannaTechno/AbtTerminal", "path": "/Depricated_.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def check(data): global ss global s for line in data: s += int(line) if ss.get(s, False): return s ss[s] = True return None v = check(data) print('after first pass:', s) while v is None: v = check(data) print('first duplicate:', v)<|fim_prefix|>#...
code_fim
easy
{ "lang": "python", "repo": "jtrinklein/advent-of-code", "path": "/2018/01-main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }