text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: sfmc/mpi path: /helpers/utilities.py #!/usr/bin/python import math <|fim_suffix|> r = start while r < stop: yield r r += step<|fim_middle|>def clamp(v, min_value, max_value): return max(min_value, min(max_value, v)) def drange(start, stop, step):
code_fim
medium
{ "lang": "python", "repo": "sfmc/mpi", "path": "/helpers/utilities.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: reach950/hangzhoubanshi-uitest-iOS path: /test_case/index/hz_news_test.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """测试杭州发布""" __author__ = 'kejie' import unittest from test_case.base_case import BaseCase <|fim_suffix|> def setUp(self): super().setUp() def tearDown(self...
code_fim
medium
{ "lang": "python", "repo": "reach950/hangzhoubanshi-uitest-iOS", "path": "/test_case/index/hz_news_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def tearDown(self): super().tearDown() def test_01_click_more_button_open_news_page(self): """点击更多按钮打开资讯页面""" self.index_page.scroll_to_news() self.index_page.click_hz_news_more_button() self.assertTrue(self.news_page.is_displayed(), '打开资讯页面失败') def te...
code_fim
medium
{ "lang": "python", "repo": "reach950/hangzhoubanshi-uitest-iOS", "path": "/test_case/index/hz_news_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fpert041/ga_example path: /agent.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 14 14:37:23 2017 @author: pesa """ import numpy as np import random import numbers import copy as cop class Agent : """A simple agent class for a genetic algorithm""" # declar...
code_fim
hard
{ "lang": "python", "repo": "fpert041/ga_example", "path": "/agent.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def mutate(self, chance_as_n_between_0_and_1=0.05): for i in range(0, self.length): self.genotype[i] = int(random.uniform(0, 10)) if \ (random.uniform(0, 1) < chance_as_n_between_0_and_1) else self.genotype[i] ''' # let's define a w...
code_fim
hard
{ "lang": "python", "repo": "fpert041/ga_example", "path": "/agent.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.fitness = self.fitness_func(self.genotype) return self def mutate(self, chance_as_n_between_0_and_1=0.05): for i in range(0, self.length): self.genotype[i] = int(random.uniform(0, 10)) if \ (random.uniform(0, 1) < chance_as_n_between_0_...
code_fim
hard
{ "lang": "python", "repo": "fpert041/ga_example", "path": "/agent.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>totLum = 5050 data_Run2011A = cfg.DataComponent( name = 'data_Run2011A', files = [], intLumi = totLum / 2., # just sharing the total lumi arbitrarily triggers = [], json = None ) data_Run2011B = cfg.DataComponent( name = 'data_Run2011B', files = [], intLumi = totLum /...
code_fim
medium
{ "lang": "python", "repo": "perrozzi/cmg-cmssw", "path": "/CMGTools/H2TauTau/python/proto/samples/data_dimuon.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>data_Run2011A = cfg.DataComponent( name = 'data_Run2011A', files = [], intLumi = totLum / 2., # just sharing the total lumi arbitrarily triggers = [], json = None ) data_Run2011B = cfg.DataComponent( name = 'data_Run2011B', files = [], intLumi = totLum / 2., trigge...
code_fim
medium
{ "lang": "python", "repo": "perrozzi/cmg-cmssw", "path": "/CMGTools/H2TauTau/python/proto/samples/data_dimuon.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: perrozzi/cmg-cmssw path: /CMGTools/H2TauTau/python/proto/samples/data_dimuon.py import copy import os import CMGTools.RootTools.fwlite.Config as cfg <|fim_suffix|>data_Run2011A = cfg.DataComponent( name = 'data_Run2011A', files = [], intLumi = totLum / 2., # just sharing the total lu...
code_fim
medium
{ "lang": "python", "repo": "perrozzi/cmg-cmssw", "path": "/CMGTools/H2TauTau/python/proto/samples/data_dimuon.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ashjambhulkar/objectoriented path: /LeetCodePremium/689.maximum-sum-of-3-non-overlapping-subarrays.py # # @lc app=leetcode id=689 lang=python3 # # [689] Maximum Sum of 3 Non-Overlapping Subarrays # <|fim_suffix|> # @lc code=end<|fim_middle|># @lc code=start class Solution: def maxSum...
code_fim
medium
{ "lang": "python", "repo": "ashjambhulkar/objectoriented", "path": "/LeetCodePremium/689.maximum-sum-of-3-non-overlapping-subarrays.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # @lc code=end<|fim_prefix|># repo: ashjambhulkar/objectoriented path: /LeetCodePremium/689.maximum-sum-of-3-non-overlapping-subarrays.py # # @lc app=leetcode id=689 lang=python3 # # [689] Maximum Sum of 3 Non-Overlapping Subarrays # <|fim_middle|># @lc code=start class Solution: def maxSum...
code_fim
medium
{ "lang": "python", "repo": "ashjambhulkar/objectoriented", "path": "/LeetCodePremium/689.maximum-sum-of-3-non-overlapping-subarrays.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='menutag', name='color', field=models.CharField(default='', max_length=7), preserve_default=False, ), ]<|fim_prefix|># repo: Luis-Palacios/restaurant-demo path: /menu/migrations/0007_men...
code_fim
medium
{ "lang": "python", "repo": "Luis-Palacios/restaurant-demo", "path": "/menu/migrations/0007_menutag_color.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Luis-Palacios/restaurant-demo path: /menu/migrations/0007_menutag_color.py # Generated by Django 2.2.6 on 2019-10-08 16:22 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('menu', '0006_auto_20191004_1617'), ] operations = [ migrations.AddF...
code_fim
easy
{ "lang": "python", "repo": "Luis-Palacios/restaurant-demo", "path": "/menu/migrations/0007_menutag_color.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>maxnt=-1 for i in range(n): for j in range(m): tmp=str(a[i][j]) if(kt(tmp)==1 and a[i][j]>maxnt and len(tmp)>=2): maxnt=a[i][j] if(maxnt==-1):print("NOT FOUND") else: print(maxnt) for i in range(n): for j in range(m): if(a[i][j]==maxnt): ...
code_fim
medium
{ "lang": "python", "repo": "Keybinhoainam/Python", "path": "/sothuannghichlonnhattrongmatran.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Keybinhoainam/Python path: /sothuannghichlonnhattrongmatran.py def kt(s): n=len(s) for i in range(n): if(s[i]!=s[n-1-i]):return 0 return 1 <|fim_suffix|>maxnt=-1 for i in range(n): for j in range(m): tmp=str(a[i][j]) if(kt(tmp)==1 and a[i][j]>maxnt and len...
code_fim
medium
{ "lang": "python", "repo": "Keybinhoainam/Python", "path": "/sothuannghichlonnhattrongmatran.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomfox1/Sprint-Challenge--Data-Structures-Python path: /ring_buffer/ring_buffer.py from doubly_linked_list import DoublyLinkedList # def set(self, key, value): # pass # if self.record.length == self.limit: # old_key = self.record.remove_from_tail() # if key not in self.st...
code_fim
hard
{ "lang": "python", "repo": "tomfox1/Sprint-Challenge--Data-Structures-Python", "path": "/ring_buffer/ring_buffer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.storage.length == self.capacity: self.current.value = item if self.current is self.storage.tail: self.current = self.storage.head else: self.current = self.current.next def get(self): #get returns our eleme...
code_fim
hard
{ "lang": "python", "repo": "tomfox1/Sprint-Challenge--Data-Structures-Python", "path": "/ring_buffer/ring_buffer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexBabko/homework path: /test_main_page.py import time import pytest from selenium.common.exceptions import NoSuchElementException from .pages.main_page import MainPage from .pages.login_page import LoginPage from .pages.product_page import ProductPage from .pages.basket_page import BasePage <|...
code_fim
hard
{ "lang": "python", "repo": "AlexBabko/homework", "path": "/test_main_page.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_guest_cant_see_product_in_basket_opened_from_main_page(self,browser): link = "https://selenium1py.pythonanywhere.com/en-gb/" page = BasePage(browser, link) page.open() #page.should_be_login_link() page.go_to_basket() page.check_basket_is_empty() time.sleep(1) def tes...
code_fim
medium
{ "lang": "python", "repo": "AlexBabko/homework", "path": "/test_main_page.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> link = "https://selenium1py.pythonanywhere.com/en-gb/" page = BasePage(browser, link) page.open() #page.should_be_login_link() page.go_to_basket() page.check_basket_is_empty() time.sleep(1) def test_guest_should_see_login_link(self, browser): link = "https://selenium1py.py...
code_fim
medium
{ "lang": "python", "repo": "AlexBabko/homework", "path": "/test_main_page.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>app_name = 'citizens' urlpatterns = [ path("", views.index, name="index", ), path("<int:citizen_id>", views.citizen, name="citizen"), ]<|fim_prefix|># repo: hoangphi01/pythonDjangoDb01 path: /citizens/urls.py from django.urls import path <|fim_middle|>from . import views
code_fim
easy
{ "lang": "python", "repo": "hoangphi01/pythonDjangoDb01", "path": "/citizens/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hoangphi01/pythonDjangoDb01 path: /citizens/urls.py from django.urls import path <|fim_suffix|>app_name = 'citizens' urlpatterns = [ path("", views.index, name="index", ), path("<int:citizen_id>", views.citizen, name="citizen"), ]<|fim_middle|>from . import views
code_fim
easy
{ "lang": "python", "repo": "hoangphi01/pythonDjangoDb01", "path": "/citizens/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> foldername, _, filenames = next(os.walk(foldername)) filenames = sorted(filenames) data, info = [], {} slice_min, loc_min, slice_max, loc_max = None, None, None, None for filename in filenames: dataset = pydicom.dcmread('{0}/{1}'.format(foldername, filename)) data...
code_fim
hard
{ "lang": "python", "repo": "Jinwei1209/Bayesian_QSM", "path": "/utils/files.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jinwei1209/Bayesian_QSM path: /utils/files.py import os import scipy.io as sio import h5py import nibabel as nib import pydicom import numpy as np import datetime def recursiveFilesWithSuffix(rootDir = '.', suffix = ''): return [os.path.join(looproot, filename) for loop...
code_fim
hard
{ "lang": "python", "repo": "Jinwei1209/Bayesian_QSM", "path": "/utils/files.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if(not os.path.exists(self.rootName)): os.mkdir(self.rootName) self.logPath = os.path.join(self.rootName, self.folderName) print(self.logPath) self.t0 = datetime.datetime.now().strftime("%I:%M%p on %B %d, %Y") print(self.t0) self.fileName...
code_fim
hard
{ "lang": "python", "repo": "Jinwei1209/Bayesian_QSM", "path": "/utils/files.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>'''get specific element - 13 [ row, column]''' print(a[1, 5]) print(a[1, -2]) '''get specific row - 1''' print(a[0, :]) '''get specific column - 3''' print(a[:, 2]) '''getting fancy [start_index, stop_index, step] ''' print(a[0, 1:6: 2]) '''CHANGING element''' a[1, 5] = 20 print(a) '''changing colum...
code_fim
medium
{ "lang": "python", "repo": "maciejwrobel/numpy_tutorial", "path": "/2_accessing_changing_specific_elements.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: maciejwrobel/numpy_tutorial path: /2_accessing_changing_specific_elements.py import numpy as np a = np.array([[1, 2, 3, 4, 5, 6, 7], [8, 9, 10, 11, 12, 13, 14]]) print(a.shape) '''get specific element - 13 [ row, column]''' print(a[1, 5]) print(a[1, -2]) '''get specific row - 1''' print(a[0,...
code_fim
medium
{ "lang": "python", "repo": "maciejwrobel/numpy_tutorial", "path": "/2_accessing_changing_specific_elements.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(Image_evaluation.psnr2(re,raw2)) cv2.imwrite(outpath + "noise" + ".jpg", re) cv2.imwrite(outpath + "noisetag" + ".jpg", tag) np.savetxt(outpath + "noisetag.csv", tag, fmt="%d", delimiter=',') canny2 = cv2.Canny(re,th1,th2) cv2.imwrite(outpath + "canny2" + ".jpg", canny2) # print(pow(255,2))<|fim_...
code_fim
hard
{ "lang": "python", "repo": "majpyi/Pic_test", "path": "/add_noise.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: majpyi/Pic_test path: /add_noise.py import numpy as np import cv2 import parameter import Image_evaluation src_or = "135069" src_or = "1" src_or = "circle" src_or = "a0.001" src_or = "8068" src_or = "t1" inpath = "D:\\out\\" outpath = "D:\\out\\" raw_or = cv2.imread(inpath + src_or + ".jpg") ta...
code_fim
hard
{ "lang": "python", "repo": "majpyi/Pic_test", "path": "/add_noise.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # re = add_noise(raw_or, 0.995) # 添加高斯噪声,并判断是否 num = 5 # re = gasuss_noise(raw_or, 0, num*num / pow(255, 2)) re = gasuss_noise(raw2, 0, num*num / pow(255, 2)) # re = cv2.cvtColor(re, cv2.COLOR_BGR2GRAY) verify_gass_noise(re, num) print(Image_evaluation.psnr2(re,raw2)) cv2.imwrite(outpath + "noise" + "...
code_fim
hard
{ "lang": "python", "repo": "majpyi/Pic_test", "path": "/add_noise.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> targetSpeeds = pred['targetSpeeds'].data.numpy().astype('float') print(targetSpeeds) self.arm.update_arm_IK(targetSpeeds[0], targetSpeeds[1], targetSpeeds[2], targetSpeeds[3]) #self.arm.set_target_angles(targetAngles) #self.arm.update_arm() ...
code_fim
hard
{ "lang": "python", "repo": "jms44/2dSimulation", "path": "/arm_sim_auto.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jms44/2dSimulation path: /arm_sim_auto.py import math import Box2D from Box2D.examples.framework import (Framework, Keys, main) from Box2D import (b2Color, b2EdgeShape, b2FixtureDef, b2PolygonShape) from arm import Arm from door import Door from policy_net import Net from data_loader import DataL...
code_fim
medium
{ "lang": "python", "repo": "jms44/2dSimulation", "path": "/arm_sim_auto.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>axes[0].set_xlabel('Clone size') axes[1].set_xlabel('Normalized clone size\n(sampling depth)') axes[2].set_xlabel('Normalized clone size\n(sampling depth & memory fraction)') label_axes(axes, labels=('D', 'E', 'F'), xy=(-0.2, 0.95)) fig.tight_layout() fig.savefig(figure_directory+'csd-aging-emerson-step...
code_fim
hard
{ "lang": "python", "repo": "andim/paper-tcellimprint", "path": "/code/clonesizedistributions/plot-emerson-stepbystep.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andim/paper-tcellimprint path: /code/clonesizedistributions/plot-emerson-stepbystep.py import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib import sys sys.path.append('..') from lib import * from lib.fitting import * from common import * plt.style.use('../cu...
code_fim
hard
{ "lang": "python", "repo": "andim/paper-tcellimprint", "path": "/code/clonesizedistributions/plot-emerson-stepbystep.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for ax in axes: plot_insetcolorbar(agemin, agemax, cmap, ax=ax, label='Age') ax.locator_params(numticks=9) ax.set_ylabel('Rank') for ax in axes[1:]: ax.set_xlim(2e-7, 5e-1) ax.set_ylim(0.8, 1.5e6) axes[0].set_xlabel('Clone size') axes[1].set_xlabel('Normalized clone size\n(sampling d...
code_fim
hard
{ "lang": "python", "repo": "andim/paper-tcellimprint", "path": "/code/clonesizedistributions/plot-emerson-stepbystep.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EricYang5922/badminton path: /track/calc_track.py e[i] == time[j] or get_parent(i) == get_parent(j) or time[i] + 0.05 * (t-1) >= time[j]: continue if time[i] + 0.05 * t < time[j]: break dis_list.append([calc_dis(coordinar...
code_fim
hard
{ "lang": "python", "repo": "EricYang5922/badminton", "path": "/track/calc_track.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: EricYang5922/badminton path: /track/calc_track.py ans = 0 for i in range(len(coor0)): ans += (coor0[i] - coor1[i]) ** 2 return ans ** 0.5 def get_parent(no): global parent if parent[no] != no: parent[no] = get_parent(parent[no]) return parent[no] ...
code_fim
hard
{ "lang": "python", "repo": "EricYang5922/badminton", "path": "/track/calc_track.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x, y, z = self.coord tmp_params, _ = fitting(self.time[: 5], (x[: 5], y[: 5], z[: 5]), 1) start_time = optimize.fsolve(self.calc_poly, self.time[-1], args = (tmp_params[2]))[0] if start_time <= self.time[0]: x, y = self.calc_poly(start_time, tmp_params[0]), ...
code_fim
hard
{ "lang": "python", "repo": "EricYang5922/badminton", "path": "/track/calc_track.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> out = "\n" out += "It was one spooky day on main street with the dark clouds moving in " out += "my freind and I decided we were going to sneak out tonight and meet at the local cementary" out += "we got there at + time + and talked about the local haunted house" out += "" out += "...
code_fim
medium
{ "lang": "python", "repo": "KRHS-GameProgramming-2019/Madlins---Robert-Connor-and-Cam", "path": "/Story3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KRHS-GameProgramming-2019/Madlins---Robert-Connor-and-Cam path: /Story3.py from Getters import * def Story3(debug = False): if debug: print("Story1 Function") <|fim_suffix|> out = "\n" out += "It was one spooky day on main street with the dark clouds moving in " out += "my freind...
code_fim
medium
{ "lang": "python", "repo": "KRHS-GameProgramming-2019/Madlins---Robert-Connor-and-Cam", "path": "/Story3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Fed03/graph-ml path: /src/graphml/paper_nets/GraphSageNet.py from __future__ import annotations from functools import reduce from itertools import repeat from graphml.layers.sage_aggregators import Aggregator, ModelSize from time import perf_counter from typing import Callable, List, Optional, Tu...
code_fim
hard
{ "lang": "python", "repo": "Fed03/graph-ml", "path": "/src/graphml/paper_nets/GraphSageNet.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self._net.train() results = [] for train_graph in tqdm(self._train_data): self._optim.zero_grad() adjs = [sample_neighbors(train_graph.adj_coo_matrix,size) for size in [25,10]] output = self._net(train_graph.features_vectors, ...
code_fim
hard
{ "lang": "python", "repo": "Fed03/graph-ml", "path": "/src/graphml/paper_nets/GraphSageNet.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> results = [] for train_graph in tqdm(self._train_data): self._optim.zero_grad() adjs = [sample_neighbors(train_graph.adj_coo_matrix,size) for size in [25,10]] output = self._net(train_graph.features_vectors, *adjs) ...
code_fim
hard
{ "lang": "python", "repo": "Fed03/graph-ml", "path": "/src/graphml/paper_nets/GraphSageNet.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print('TRIANGULO: {:.3f}'.format(areatriangulo)) print('CIRCULO: {:.3f}'.format(circulo)) print('TRAPEZIO: {:.3f}'.format(trapezio)) print('QUADRADO: {:.3f}'.format(quadrado)) print('RETANGULO: {:.3f}'.format(retangulo))<|fim_prefix|># repo: pedroalpacheco/100DaysOfCode path: /040/uri1012.py leitura = in...
code_fim
medium
{ "lang": "python", "repo": "pedroalpacheco/100DaysOfCode", "path": "/040/uri1012.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pedroalpacheco/100DaysOfCode path: /040/uri1012.py leitura = input().split(' ') A,B,C = leitura <|fim_suffix|>print('TRIANGULO: {:.3f}'.format(areatriangulo)) print('CIRCULO: {:.3f}'.format(circulo)) print('TRAPEZIO: {:.3f}'.format(trapezio)) print('QUADRADO: {:.3f}'.format(quadrado)) print('RE...
code_fim
medium
{ "lang": "python", "repo": "pedroalpacheco/100DaysOfCode", "path": "/040/uri1012.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tarunraghav226/Bon-Appetite path: /helpers/food_helper.py def get_food_details(request): food_details = { "food_name": request.POST["food_name"], <|fim_suffix|>_price"], "food_image": request.FILES.get("food_image", None), } return food_details<|fim_middle|> "f...
code_fim
medium
{ "lang": "python", "repo": "tarunraghav226/Bon-Appetite", "path": "/helpers/food_helper.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_price"], "food_image": request.FILES.get("food_image", None), } return food_details<|fim_prefix|># repo: tarunraghav226/Bon-Appetite path: /helpers/food_helper.py def get_food_details(request): food_details = { "food_name": request.POST["food_name"], "food_desc": req...
code_fim
medium
{ "lang": "python", "repo": "tarunraghav226/Bon-Appetite", "path": "/helpers/food_helper.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def parse(self,response): page_count = re.search(r"[0-9]+",response.body_as_unicode()) if page_count: print page_count.group() yield Request(url=self.fund_urls%(page_count.group(),self.company_code), callback=self.parse_detail) def parse_detail(self,respons...
code_fim
medium
{ "lang": "python", "repo": "Franklyn1987/stock", "path": "/stock/stock/spiders/fund.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Franklyn1987/stock path: /stock/stock/spiders/fund.py # coding:utf-8 import json import re from scrapy.spider import Spider from scrapy.http import Request from stock.models.items import FundFlow class MainFund(Spider): name = "fund" fund_urls = 'http://vip.stock.finance.sina.com.cn/quot...
code_fim
hard
{ "lang": "python", "repo": "Franklyn1987/stock", "path": "/stock/stock/spiders/fund.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ilovexiong/requestflow path: /test/integration/ba.py import sys import requests def test_health_check_works(endpoint): resp = requests.get(endpoint + "/health_check") assert resp.status_code == 200 def test_vote_increment_and_clear_work(endpoint): <|fim_suffix|> resp = requests.get(e...
code_fim
medium
{ "lang": "python", "repo": "ilovexiong/requestflow", "path": "/test/integration/ba.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def test_ping_hulu_works(endpoint): resp = requests.get(endpoint + "/proxy_hulu") assert 200 == resp.status_code if __name__ == "__main__": endpoint_server = sys.argv[0] if not endpoint_server.startswith("http://"): endpoint_server = "http://127.0.0.1:5000" for test in [ ...
code_fim
hard
{ "lang": "python", "repo": "ilovexiong/requestflow", "path": "/test/integration/ba.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: stephanieherrera70/MIS3640 path: /variable_demo.py print('hello, world!') print('Hey Jude', 'don\'t mak<|fim_suffix|> in Rio 2016 is', 46 + 37 + 38) print('46 + 37 + 38 =', 46 + 37 + 38) username = input() print(username)<|fim_middle|>e it bad') print('The total number of overall medals
code_fim
easy
{ "lang": "python", "repo": "stephanieherrera70/MIS3640", "path": "/variable_demo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>=', 46 + 37 + 38) username = input() print(username)<|fim_prefix|># repo: stephanieherrera70/MIS3640 path: /variable_demo.py print('hello, world!') print('Hey Jude', 'don\'t mak<|fim_middle|>e it bad') print('The total number of overall medals in Rio 2016 is', 46 + 37 + 38) print('46 + 37 + 38
code_fim
medium
{ "lang": "python", "repo": "stephanieherrera70/MIS3640", "path": "/variable_demo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>IRE_DAYS = 5 #tempo em horas para expirar o token de login TOKEN_EXPIRE_HOURS = 1<|fim_prefix|># repo: Edresson/Flask-restful-API path: /config.py #!/usr/bin/env python # -*- coding: utf-8 -*- DEBUG = True #mongodb ip DB_HOST = '127.0.0.1' #mongodb port DB_PORT = 27017 #chave para geração de token KEY = ...
code_fim
medium
{ "lang": "python", "repo": "Edresson/Flask-restful-API", "path": "/config.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Edresson/Flask-restful-API path: /config.py #!/usr/bin/env python # -*- coding: utf-8 -*- DEBUG = True #mongodb ip DB_HOST =<|fim_suffix|>aveHS256' #tempo em dias para expirar o token de ativação da conta ACTIVATION_EXPIRE_DAYS = 5 #tempo em horas para expirar o token de login TOKEN_EXPIRE_HOURS ...
code_fim
medium
{ "lang": "python", "repo": "Edresson/Flask-restful-API", "path": "/config.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_detect.py',test_file,pic]) == 0: exit(0) exit(1)<|fim_prefix|># repo: Four-Stooges/Server path: /public/resources/scripts/check_image.py import glob from subprocess import call import sys <|fim_middle|> test_file = sys.argv[1] pics = glob.glob('../images/*.*') for pic in pics: if call(['python3','fa...
code_fim
medium
{ "lang": "python", "repo": "Four-Stooges/Server", "path": "/public/resources/scripts/check_image.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Cliente(): class Factura(): principal()<|fim_prefix|># repo: glo-fq/Taller-Progra-SII-2017-TP-3 path: /examen_POO.py def principal(): class Tienda(): def __init__(self): nombre = "Tienda de Computadoras" direccion = "Calle 12, Avenida 7" productos = Computadora() class Computadora(...
code_fim
medium
{ "lang": "python", "repo": "glo-fq/Taller-Progra-SII-2017-TP-3", "path": "/examen_POO.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: glo-fq/Taller-Progra-SII-2017-TP-3 path: /examen_POO.py def principal(): class Tienda(): def __init__(self): nombre = "Tienda de Computadoras" direccion = "Calle 12, Avenida 7" productos = Computadora() class Computadora(): def __init__(self, velocidad, RAM, precio, dueño = Tienda()):...
code_fim
medium
{ "lang": "python", "repo": "glo-fq/Taller-Progra-SII-2017-TP-3", "path": "/examen_POO.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.prefixesGroup = titledRow.create(parent, 'Influence Prefixes') self.influencePrefixes = StoredTextEdit(self.VAR_PREFIX+'inflPrefix', annotation='Specifies influence prefixes to be ignored when matching by name;\nUsually you would put your left/right influence prefixes here;\nseparate ...
code_fim
hard
{ "lang": "python", "repo": "Zombie-Studio/zs-maya-env", "path": "/scripts/ngSkinTools/ui/components/influencePrefixSuffixSelector.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> titledRow.create(parent, 'Ignore') cmds.radioCollection() self.ignorePrefixes = RadioButtonField(self.VAR_PREFIX+'ignoreMode_Prefixes',defaultValue=True,label="Prefixes") self.ignorePrefixes.changeCommand.addHandler(self.ignoreModeChanged,parent) se...
code_fim
medium
{ "lang": "python", "repo": "Zombie-Studio/zs-maya-env", "path": "/scripts/ngSkinTools/ui/components/influencePrefixSuffixSelector.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Zombie-Studio/zs-maya-env path: /scripts/ngSkinTools/ui/components/influencePrefixSuffixSelector.py # # ngSkinTools # Copyright (c) 2009-2017 Viktoras Makauskas. # All rights reserved. # # Get more information at # http://www.ngskintools.com # # --------------------...
code_fim
hard
{ "lang": "python", "repo": "Zombie-Studio/zs-maya-env", "path": "/scripts/ngSkinTools/ui/components/influencePrefixSuffixSelector.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Cursor = Connector.cursor() # Cursor.execute('SELECT * FROM tbl_device') # results = Cursor.fetchall() # print(results)<|fim_prefix|># repo: hayysoft/bluguardprod1 path: /apiapp/Database_Connector.py import mysql.connector as mysql config = { 'host': 'bgplatformdb1.mysql.database.azure.com', 'u...
code_fim
easy
{ "lang": "python", "repo": "hayysoft/bluguardprod1", "path": "/apiapp/Database_Connector.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hayysoft/bluguardprod1 path: /apiapp/Database_Connector.py import mysql.connector as mysql config = { 'host': 'bgplatformdb1.mysql.database.azure.com', 'user': 'bg37hayysoftadmin', 'password': 'DoNotHack2021', 'database': 'bluguarddb', # 'client_flags': [mysql.ClientFlag.SSL...
code_fim
easy
{ "lang": "python", "repo": "hayysoft/bluguardprod1", "path": "/apiapp/Database_Connector.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cesaralba/jimenezIntelligence path: /ReadMercadoFiles.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse from _collections import defaultdict from SMACB.MercadoPage import MercadoPageContent from Utils.Misc import ReadFile <|fim_suffix|> for x in args.files: files.ap...
code_fim
hard
{ "lang": "python", "repo": "cesaralba/jimenezIntelligence", "path": "/ReadMercadoFiles.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> orig = None currJornada = 0 for Mfile in files: mf = MercadoPageContent(Mfile) mf.setTimestampFromStr(mf.source) print(cuentaFuera(mf)) if orig is None: orig = mf print("J ", currJornada, Mfile['source']) # ,mf print("-j %i...
code_fim
hard
{ "lang": "python", "repo": "cesaralba/jimenezIntelligence", "path": "/ReadMercadoFiles.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> currJornada = 0 for Mfile in files: mf = MercadoPageContent(Mfile) mf.setTimestampFromStr(mf.source) print(cuentaFuera(mf)) if orig is None: orig = mf print("J ", currJornada, Mfile['source']) # ,mf print("-j %i:%s" % (currJorna...
code_fim
hard
{ "lang": "python", "repo": "cesaralba/jimenezIntelligence", "path": "/ReadMercadoFiles.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>input: 15 output: 6 9 input: 23 output: 8 15 input: 1000000 output: 4 999996 input: 454 output: 4 450 hint: One way to solve this is by bruteforce: there are O(n) different ways to decompose nnn as sum of two numbers. If we can check if a number is a prime in O(1) then th...
code_fim
medium
{ "lang": "python", "repo": "GuhanSGCIT/Trees-and-Graphs-problem", "path": "/Mathematical Tasks.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>output: 4 450 hint: One way to solve this is by bruteforce: there are O(n) different ways to decompose nnn as sum of two numbers. If we can check if a number is a prime in O(1) then the whole algorithm can run in O(n). You can use Sieve of Eratosthenes to do the pre-calculation. And another way is...
code_fim
medium
{ "lang": "python", "repo": "GuhanSGCIT/Trees-and-Graphs-problem", "path": "/Mathematical Tasks.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GuhanSGCIT/Trees-and-Graphs-problem path: /Mathematical Tasks.py """ You can create a new task by generating some random math statement or modifying some theorems to get something new and build a new task from that. For example, the conjecture’s statement says: "each even number no less than fo...
code_fim
hard
{ "lang": "python", "repo": "GuhanSGCIT/Trees-and-Graphs-problem", "path": "/Mathematical Tasks.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # ScanFile = sys.argv[2] ScanFile = args.psm spectrumTitleList = list(pd.read_csv(ScanFile, "\t")['Spectrum Title']) scanFileNumber = [[".".join(each.split(".")[:-3]), int(each.split(".")[-2:-1][0])] for each in spectrumTitleList] scanDict = {} for each...
code_fim
hard
{ "lang": "python", "repo": "bernt-matthias/tools-galaxyp", "path": "/tools/msms_extractor/msms_extractor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bernt-matthias/tools-galaxyp path: /tools/msms_extractor/msms_extractor.py # # Developed by Praveen Kumar # Galaxy-P Team (Griffin's Lab) # University of Minnesota # # # from pyteomics import mzml import os import sys import shutil import subprocess import re import pandas as pd...
code_fim
hard
{ "lang": "python", "repo": "bernt-matthias/tools-galaxyp", "path": "/tools/msms_extractor/msms_extractor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Identifying groups of continuous numbers in the scan2retain and creating scanString scanString = "" for a, b in groupby(enumerate(scan2retain), lambda x:x[1]-x[0]): x = list(map(itemgetter(1), b)) scanString = scanString + "["+str(x[0])+","+s...
code_fim
hard
{ "lang": "python", "repo": "bernt-matthias/tools-galaxyp", "path": "/tools/msms_extractor/msms_extractor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: easseptember/djweb path: /djwebs/views.py from django.shortcuts import render from django.http import HttpResponse from djwebs.models import Content # Create your views here. def init(request): <|fim_suffix|>def index(request): import time import datetime list = Content.objects.all();...
code_fim
easy
{ "lang": "python", "repo": "easseptember/djweb", "path": "/djwebs/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def index(request): import time import datetime list = Content.objects.all(); return render(request, "index.html",{"list": list}) #def zip(reques<|fim_prefix|># repo: easseptember/djweb path: /djwebs/views.py from django.shortcuts import render from django.http import HttpResponse from...
code_fim
easy
{ "lang": "python", "repo": "easseptember/djweb", "path": "/djwebs/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@bp.route("/", methods=["GET", "POST"]) def home(): return jsonify(message="Hello from api")<|fim_prefix|># repo: sudiptakarmakar/Heimdall path: /heimdall/routes/api.py from flask import Blueprint, jsonify <|fim_middle|> bp = Blueprint("api", __name__)
code_fim
easy
{ "lang": "python", "repo": "sudiptakarmakar/Heimdall", "path": "/heimdall/routes/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sudiptakarmakar/Heimdall path: /heimdall/routes/api.py from flask import Blueprint, jsonify <|fim_suffix|> return jsonify(message="Hello from api")<|fim_middle|> bp = Blueprint("api", __name__) @bp.route("/", methods=["GET", "POST"]) def home():
code_fim
medium
{ "lang": "python", "repo": "sudiptakarmakar/Heimdall", "path": "/heimdall/routes/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if chosen_card_type == "Creature": cardOutput = random.choice(titlestyle).format(random.choice(rarity),random.choice(colors),chosen_card_type,creature_type_output,random.randint(0,10)) else: cardOutput = random.choice(titlestyle).format(random.choice(rarity),random.choice(colors),c...
code_fim
hard
{ "lang": "python", "repo": "spikeof2010/Cyberodie", "path": "/birdfunctions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> attributes = open("./loot_gen/stats.txt").read().splitlines() attr_text = open("./loot_gen/attr.txt").read().splitlines() pos_or_neg = ["+", "-"] if random.randint(1,100)<25: attr_am = random.randint(1,5)*random.randint(2,5) else: attr_am = random.randint(1,5) if ra...
code_fim
medium
{ "lang": "python", "repo": "spikeof2010/Cyberodie", "path": "/birdfunctions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: spikeof2010/Cyberodie path: /birdfunctions.py import random def loot_gen(): adj = open("./loot_gen/adj.txt").read().splitlines() noun = open("./loot_gen/noun.txt").read().splitlines() qual = open("./loot_gen/qual.txt").read().splitlines() rarity = open("./loot_gen/rarity.txt").re...
code_fim
hard
{ "lang": "python", "repo": "spikeof2010/Cyberodie", "path": "/birdfunctions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wagnera/Projects path: /Useful Scripts/read_serial.py import serial import time ser = serial.Serial('/dev/ttyUSB0', 38400) #Tried with and without the last 3 parameters, and also at 1Mbps, same happens. #ser.rtscts=False #ser.dsrdtr=False ser.flushInput() ser.flushOutput() #ser.write("unlogall\r"...
code_fim
medium
{ "lang": "python", "repo": "wagnera/Projects", "path": "/Useful Scripts/read_serial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>) while True: #ser.write("log rxstatus once\n\n") #ser.write(ba) data_raw = ser.readline() print(data_raw) #ser.write("log rxstatus once\n\n") #time.sleep(0.1)<|fim_prefix|># repo: wagnera/Projects path: /Useful Scripts/read_serial.py import serial import time ser = serial.Serial('/dev/tty...
code_fim
medium
{ "lang": "python", "repo": "wagnera/Projects", "path": "/Useful Scripts/read_serial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: usegalaxy-eu/ena-upload-cli path: /var/xml_converter.py from lxml import etree from jinja2 import Environment, FileSystemLoader import requests from requests.adapters import HTTPAdapter from urllib3.util.retry import Retry import time def fetch_object(url): """ Fetch single BrAPI object ...
code_fim
hard
{ "lang": "python", "repo": "usegalaxy-eu/ena-upload-cli", "path": "/var/xml_converter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Parsing XML root = etree.fromstring(response.content) # Looping over all fields and storing their name and cardinality for attribute in root.iter('FIELD'): name = '' cardinality = '' units = '' for sub_attr in attribute: ...
code_fim
hard
{ "lang": "python", "repo": "usegalaxy-eu/ena-upload-cli", "path": "/var/xml_converter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mohit-Doshi/cs229_project path: /src/ph_pca.py 45, # koi_srho: Fitted Stellar Density [g/cm**3] - 49, # koi_prad: Planetary Radius [Earth radii] 52, # koi_sma: Orbit Semi-Major A...
code_fim
hard
{ "lang": "python", "repo": "Mohit-Doshi/cs229_project", "path": "/src/ph_pca.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> non_habitable_planets = np.genfromtxt('../data/non_habitable_planets_confirmed_detailed_list.csv', filling_values = 0, names = True, dtype=None, delimiter=",",usecols=planetary_stellar_parameter_indexes); np.random.shuffle(habitable_planets) np.random.shuffle(non_habitable_planets) ...
code_fim
hard
{ "lang": "python", "repo": "Mohit-Doshi/cs229_project", "path": "/src/ph_pca.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> X_data = np.ndarray(shape=(planets_from_kepler.shape[0],0)); X_data = select_features(planets_from_kepler, X_data, features); if DO_PCA == True: X_data = get_pca(X_data) y_predicated = clf.predict(X_data); X_distance_from_parent_star = [] Y_surface_tempr...
code_fim
hard
{ "lang": "python", "repo": "Mohit-Doshi/cs229_project", "path": "/src/ph_pca.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> result = lib.flip_things_around(Tuple(0, ApiTest.UINT_MAX)) self.assertEqual(0, result.x) self.assertEqual(ApiTest.UINT_MAX, result.y) def test_one_and_zero(self): result = lib.flip_things_around(Tuple(1, ApiTest.UINT_MAX)) self.assertEqual(0, result.x) ...
code_fim
hard
{ "lang": "python", "repo": "dmitri-mamrukov/rust-ffi-omnibus", "path": "/functions-that-accept-and-return-tuples/python/client.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> result = lib.flip_things_around(Tuple(1, 2)) self.assertEqual(3, result.x) self.assertEqual(0, result.y) def test_one_and_max(self): result = lib.flip_things_around(Tuple(1, ApiTest.UINT_MAX)) self.assertEqual(0, result.x) self.assertEqual(0, result.y...
code_fim
hard
{ "lang": "python", "repo": "dmitri-mamrukov/rust-ffi-omnibus", "path": "/functions-that-accept-and-return-tuples/python/client.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmitri-mamrukov/rust-ffi-omnibus path: /functions-that-accept-and-return-tuples/python/client.py #!/usr/bin/env python3 import ctypes from ctypes import c_uint32, Structure import sys import unittest LIB_PREFIXES = {'win32': ''} LIB_EXTENSIONS = {'darwin': '.dylib', 'win32': '.dll'} class Tupl...
code_fim
hard
{ "lang": "python", "repo": "dmitri-mamrukov/rust-ffi-omnibus", "path": "/functions-that-accept-and-return-tuples/python/client.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lalit97/WikiContrib path: /backend/Contraband/query/migrations/0002_auto_20190823_0431.py # Generated by Django 2.2.2 on 2019-08-23 04:31 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('query', '0001_initial'), ] operations = [ migrations....
code_fim
easy
{ "lang": "python", "repo": "lalit97/WikiContrib", "path": "/backend/Contraband/query/migrations/0002_auto_20190823_0431.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='query', name='hash_code', field=models.CharField(default='7vOkTPglVe5klNyBtrGS3N829hxmjIYr8zVYRfPMvBfzC9aiqJqeS1BkwrhfvYRD', max_length=64, unique=True), ), ]<|fim_prefix|># repo: lalit97/WikiCont...
code_fim
medium
{ "lang": "python", "repo": "lalit97/WikiContrib", "path": "/backend/Contraband/query/migrations/0002_auto_20190823_0431.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: muhamed-emadeldin/Crash-Course-on-Python-by-Google path: /filenames.py """ Given a list of filenames, we want to rename all the files with the extension hpp to the extension h by generating a list of tuples of the form (old_name, new_name). That is, given the following list of filenames filenam...
code_fim
medium
{ "lang": "python", "repo": "muhamed-emadeldin/Crash-Course-on-Python-by-Google", "path": "/filenames.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> else: tup2 = (file,file) newfilenames.append(tup2,) create_new_file_name(filenames) print (newfilenames)<|fim_prefix|># repo: muhamed-emadeldin/Crash-Course-on-Python-by-Google path: /filenames.py """ Given a list of filenames, we want to rename all the files with...
code_fim
hard
{ "lang": "python", "repo": "muhamed-emadeldin/Crash-Course-on-Python-by-Google", "path": "/filenames.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for file in filenames: if old_ext in file: new_file = file.replace(old_ext, new_ext) tup = (file,new_file) newfilenames.append(tup,) else: tup2 = (file,file) newfilenames.append(tup2,) create_new_file_nam...
code_fim
medium
{ "lang": "python", "repo": "muhamed-emadeldin/Crash-Course-on-Python-by-Google", "path": "/filenames.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cfvillalta/postdoc path: /make_dotplots_growth_rate_tyr_kds.py #!/usr/bin/env/python import sys #get filepath for comma delimited csv with tyr data. growth_data = sys.argv[1] #split filepath by backslash file_name_split = growth_data.split("/") #split filepath by . to separate filepath from exte...
code_fim
hard
{ "lang": "python", "repo": "cfvillalta/postdoc", "path": "/make_dotplots_growth_rate_tyr_kds.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>import random #make a number counter set to zero num = 0 #sort the dict growth_by_tyr by key and loop through each key. for x in sorted(growth_by_tyr): #add one to counter num = num+1 #add the key (genotype_condition) to a list called tyr_sorted. tyr_sorted.append(x) #extend list tyr_g...
code_fim
hard
{ "lang": "python", "repo": "cfvillalta/postdoc", "path": "/make_dotplots_growth_rate_tyr_kds.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def GetAcmDate(self, parameters): date = parameters[self._variableName] if date == DateEnum.Custom: customDate = parameters[self._customVariableName] if not customDate and self._mandatory: raise Exception('%s is mandatory, please supply a valid d...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/fa-absa-py3", "path": "/Python modules/gen_ael_variables_date_param.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: webclinic017/fa-absa-py3 path: /Python modules/gen_ael_variables_date_param.py import acm TODAY = acm.Time().DateNow() class DateEnum: Unselected = 'None' Custom = 'Custom Date' Yesterday = 'Yesterday' Today = 'Today' Tomorrow = 'Tomorrow' class DateParameter: DATE_DIC...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/fa-absa-py3", "path": "/Python modules/gen_ael_variables_date_param.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, aelVariables, variableName, customVariableName, customDisplayName, mandatory): self._aelVariables = aelVariables self._variableName = variableName self._customVariableName = customVariableName self._customDisplayName = customDisplayName self._...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/fa-absa-py3", "path": "/Python modules/gen_ael_variables_date_param.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SoftwareDevEngResearch/SolarCalcs path: /SolarCalcs/LocationComponents.py #!/usr/bin/env python # Author: Nicole Guymer # Date: May, 16 2018 # File: LocationComponents.py # Description: This file uses geopy to find the latitude and longitutde values, and time zones in decimal form for user given...
code_fim
medium
{ "lang": "python", "repo": "SoftwareDevEngResearch/SolarCalcs", "path": "/SolarCalcs/LocationComponents.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }