text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: Yetaeng/Problem-Solving path: /programmers/Python/구명보트.py from collections import deque def solution(people, limit): <|fim_suffix|> left_idx = 0 right_idx = len(people)-1 while left_idx <= right_idx: if people[left_idx] + people[right_idx] <= limit: cnt += 1 ...
code_fim
easy
{ "lang": "python", "repo": "Yetaeng/Problem-Solving", "path": "/programmers/Python/구명보트.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: elleryqueenhomels/universal_style_transfer path: /main.py # Demo - train the decoders & use them to stylize image from __future__ import print_function from train import train from infer import stylize from utils import list_images <|fim_suffix|> if IS_TRAINING: training_imgs_path...
code_fim
hard
{ "lang": "python", "repo": "elleryqueenhomels/universal_style_transfer", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def main(): if IS_TRAINING: training_imgs_paths = list_images(TRAINING_IMGS_PATH) train(training_imgs_paths, ENCODER_WEIGHTS_PATH, MODEL_SAVE_PATH, autoencoder_levels=AUTUENCODER_LEVELS_TRAIN, debug=DEBUG, logging...
code_fim
hard
{ "lang": "python", "repo": "elleryqueenhomels/universal_style_transfer", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @is_command def item_info(self, player, *args): if len(args) == 0: raise CommandException(CommandException.NOT_ENOUGH_ARGUMENTS) item_id = args[0] if item_id in player.inventory: item = player.inventory[item_id] elif item_id in player.locati...
code_fim
medium
{ "lang": "python", "repo": "lysol/lvlss", "path": "/src/commands/item_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@given('the browser is open, navigate to the SCALE URL, and login') def the_browser_is_open_navigate_to_the_scale_url_and_login(driver, nas_ip, root_password): """the browser is open, navigate to the SCALE URL, and login.""" if nas_ip not in driver.current_url: driver.get(f"http://{nas_ip}...
code_fim
medium
{ "lang": "python", "repo": "truenas/webui", "path": "/tests/bdd/scale/test_NAS_T1250.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: truenas/webui path: /tests/bdd/scale/test_NAS_T1250.py # coding=utf-8 """SCALE UI: feature tests.""" import pytest import xpaths from function import ( wait_on_element, is_element_present, wait_on_element_disappear ) from pytest_bdd import ( given, scenario, then, whe...
code_fim
hard
{ "lang": "python", "repo": "truenas/webui", "path": "/tests/bdd/scale/test_NAS_T1250.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@then('on the Groups page, click Add') def on_the_groups_page_click_add(driver): """on the Groups page, click Add.""" assert wait_on_element(driver, 10, xpaths.groups.title) assert wait_on_element(driver, 10, xpaths.button.add, 'clickable') driver.find_element_by_xpath(xpaths.button.add).c...
code_fim
hard
{ "lang": "python", "repo": "truenas/webui", "path": "/tests/bdd/scale/test_NAS_T1250.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> No parameters required. Returns: ChatMembersFilter Raises: :class:`telegram.Error` """ ID = "chatMembersFilterAdministrators" def __init__(self, **kwargs): pass @staticmethod def read(q: dict, *args) -> "ChatMembersFilterAdministrators":...
code_fim
medium
{ "lang": "python", "repo": "iTeam-co/pytglib", "path": "/pytglib/api/types/chat_members_filter_administrators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: iTeam-co/pytglib path: /pytglib/api/types/chat_members_filter_administrators.py from ..utils import Object class ChatMembersFilterAdministrators(Object): """ Returns the owner and administrators Attributes: ID (:obj:`str`): ``ChatMembersFilterAdministrators`` <|fim_suffi...
code_fim
medium
{ "lang": "python", "repo": "iTeam-co/pytglib", "path": "/pytglib/api/types/chat_members_filter_administrators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: styagi15/Python path: /prac.py #!/usr/bin/python L=['ABC','ABC'] con1=[] for i in range (0,len(L[1])): #con.append(L[1][i]) con=[] for j in range (0, len(L)): print(L[j][i]) <|fim_suffix|>for k in range (0,len(con1)): if con1[k].count('A')==2: con2.append('a') elif con1...
code_fim
easy
{ "lang": "python", "repo": "styagi15/Python", "path": "/prac.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>con2=[] for k in range (0,len(con1)): if con1[k].count('A')==2: con2.append('a') elif con1[k].count('B')==2: con2.append('b') else: con2.append('n')<|fim_prefix|># repo: styagi15/Python path: /prac.py #!/usr/bin/python L=['ABC','ABC'] con1=[] for i in range (0,len(L[1])): #con.ap...
code_fim
easy
{ "lang": "python", "repo": "styagi15/Python", "path": "/prac.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> image = np.zeros((512,512,3), np.uint8) # Let's define four points pts = np.array( [[10,50], [400,50], [90,200], [50,500]], np.int32) # Let's now reshape our points in form required by polylines pts = pts.reshape((-1,1,2)) cv2.polylines(image, [pts], True, (0,0,255), 3) cv2.imshow("Polygon", image...
code_fim
hard
{ "lang": "python", "repo": "SumathiGit/OpenCv", "path": "/Images and shapes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ image = np.zeros((512,512,3), np.uint8) cv2.putText(image, 'Hello World!', (75,290), cv2.FONT_HERSHEY_COMPLEX, 2, (100,170,0), 3) cv2.imshow("Hello World!", image) cv2.imwrite("Text.jpg",image) cv2.waitKey(0) cv2.destroyAllWindows()<|fim_prefix|># repo: SumathiGit/OpenCv path: /Images and shapes.p...
code_fim
hard
{ "lang": "python", "repo": "SumathiGit/OpenCv", "path": "/Images and shapes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SumathiGit/OpenCv path: /Images and shapes.py import cv2 import numpy as np """ # Create a black image image = np.zeros((512,512,3), np.uint8) # Can we make this in black and white? image_bw = np.zeros((512,512), np.uint8) cv2.imshow("Black Rectangle (Color)", image) cv2.imshow("Black Rectangle...
code_fim
hard
{ "lang": "python", "repo": "SumathiGit/OpenCv", "path": "/Images and shapes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: giorgiovinci/amshackathon path: /backend/ams/views.py from django import http from django.utils import simplejson as json import urllib2 import logging from google.appengine.api import urlfetch import cmath import math from ams.forthsquare import ForthSquare from ams.twitter import Twitter OAUT...
code_fim
hard
{ "lang": "python", "repo": "giorgiovinci/amshackathon", "path": "/backend/ams/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ''' if len(venuesInRadar) == 1: # return detailed information response = http.HttpResponse(venuesInRadar[0], content_type='application/json') response["Access-Control-Allow-Origin"] = "*" return response ''' print venuesIn...
code_fim
hard
{ "lang": "python", "repo": "giorgiovinci/amshackathon", "path": "/backend/ams/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Test that get_pylintrc_path finds the expected one in the hiearchy.""" search_paths, expected_path, __ = pylintrc_files mocker.patch("pylint.config.os.path.expanduser", return_value=search_paths[HOME_DIR]) actual_path = get_pylintrc_path( search_paths=list(searc...
code_fim
hard
{ "lang": "python", "repo": "MarkMoretto/spyder-master", "path": "/spyder/plugins/pylint/tests/test_pylint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Store test .pylintrc files at the paths and determine the result.""" search_paths = pylintrc_search_paths # Determine the bad names that should be reported pylintrc_locations = request.param bad_names = [ALL_DIR] for search_path_name, search_path in search_paths.items(): ...
code_fim
hard
{ "lang": "python", "repo": "MarkMoretto/spyder-master", "path": "/spyder/plugins/pylint/tests/test_pylint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarkMoretto/spyder-master path: /spyder/plugins/pylint/tests/test_pylint.py # -*- coding: utf-8 -*- # ---------------------------------------------------------------------------- # Copyright © 2020- Spyder Project Contributors # # Released under the terms of the MIT License # --------------------...
code_fim
hard
{ "lang": "python", "repo": "MarkMoretto/spyder-master", "path": "/spyder/plugins/pylint/tests/test_pylint.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@decorator def coroutine(f, *a, **kw): """This decorator starts the coroutine for us.""" i = f(*a, **kw) i.next() return i<|fim_prefix|># repo: mixerlabs/util path: /coroutine.py """Coroutine utilities.""" <|fim_middle|>from decorator import decorator
code_fim
easy
{ "lang": "python", "repo": "mixerlabs/util", "path": "/coroutine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mixerlabs/util path: /coroutine.py """Coroutine utilities.""" <|fim_suffix|>@decorator def coroutine(f, *a, **kw): """This decorator starts the coroutine for us.""" i = f(*a, **kw) i.next() return i<|fim_middle|>from decorator import decorator
code_fim
easy
{ "lang": "python", "repo": "mixerlabs/util", "path": "/coroutine.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.num_passenger -= 1 close_list = list(self.dict_seats.values()) if passenger_name in close_list: close_num_seat = int(close_list.index(passenger_name) + 1) self.dict_seats.update({close_num_seat: "Free"}) else: print(f'Passenger {pass...
code_fim
hard
{ "lang": "python", "repo": "dfarfel/QA_Learning_1", "path": "/Class_object/Class_task_2_2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dfarfel/QA_Learning_1 path: /Class_object/Class_task_2_2.py import sys class Bus: def __init__(self): self.seats=0 self.dict_seats={} self.num_passenger = 0 def conctructor(self,seats): self.seats=seats for i in range(1,self.seats+1): s...
code_fim
hard
{ "lang": "python", "repo": "dfarfel/QA_Learning_1", "path": "/Class_object/Class_task_2_2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return render_template('index.html', date = date, hour = hour, temp = temp, hum = hum) if __name__ == '__main__': app.debug = True app.run(host = "127.0.0.1", port = 8888)<|fim_prefix|># repo: karotka/dht22 path: /web/index.py from flask import Flask, request from flask import render_templa...
code_fim
hard
{ "lang": "python", "repo": "karotka/dht22", "path": "/web/index.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> conn = sqlite3.connect("data.db") c = conn.cursor() res = c.execute("SELECT STRFTIME('%%H', date), AVG(temp), AVG(hum) FROM data " "WHERE STRFTIME('%%d.%%m.%%Y', date)='%s' " "GROUP BY STRFTIME('%%H', date) " % (date, )) hour = list() temp = list() hum = list() ...
code_fim
hard
{ "lang": "python", "repo": "karotka/dht22", "path": "/web/index.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: karotka/dht22 path: /web/index.py from flask import Flask, request from flask import render_template import sqlite3 import datetime app = Flask(__name__) @app.route('/') def index(date = ""): date = request.args.get('date') <|fim_suffix|> return render_template('index.html', date = dat...
code_fim
hard
{ "lang": "python", "repo": "karotka/dht22", "path": "/web/index.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Time : 时间 High : 最高价 Low : 最低价 Volume : 交易量 Last : 最新价 """ Time = fields.String() High = fields.String() Low = fields.String() Volume = fields.String() Last = fields.String()<|fim_prefix|># repo: 418sec/py-cry...
code_fim
easy
{ "lang": "python", "repo": "418sec/py-crypto-exchange-api-client", "path": "/crypto_exchange/models/tick.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 418sec/py-crypto-exchange-api-client path: /crypto_exchange/models/tick.py # -*- coding: utf-8 -*- from .base import BaseSchema from marshmallow import fields <|fim_suffix|> Time = fields.String() High = fields.String() Low = fields.String() Volume = fields.String() Last = fie...
code_fim
medium
{ "lang": "python", "repo": "418sec/py-crypto-exchange-api-client", "path": "/crypto_exchange/models/tick.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ASO92/Python_knowledge path: /Appdatabase project/datamanagers.py from abc import ABC, abstractmethod from datetime import datetime, timedelta, date import os import housekeeper import yfinance as yf import pandas as pd class DataManager(ABC): def __init__(self): self...
code_fim
hard
{ "lang": "python", "repo": "ASO92/Python_knowledge", "path": "/Appdatabase project/datamanagers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.__myHousekeeper.df_to_csv(self.__dir_list, self.__upper_stages, file_name, data) class DataManager_YahooFinance(DataManager): def __init__(self): super().__init__() def download_ticker_data_from_scratch(self, ...
code_fim
hard
{ "lang": "python", "repo": "ASO92/Python_knowledge", "path": "/Appdatabase project/datamanagers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> size = 512 val_trans = [Normalization([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])] cap = cv2.VideoCapture(0 + cv2.CAP_DSHOW) # 参数为0时调用本地摄像头;url连接调取网络摄像头;文件地址获取本地视频 cap.set(3, 1920) # 设置分辨率 cap.set(4, 1080) cap.set(cv2.CAP_PROP_FPS, 30) ret, frame = cap.read() while (True): ...
code_fim
hard
{ "lang": "python", "repo": "darknli/CenterFace", "path": "/demo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: darknli/CenterFace path: /demo.py from core.detector import Detector from utils.augmentations import * from torchvision.transforms.transforms import Compose from config.mask_config import * from config.train_config import model_info np.random.seed(3) colors = np.random.randint(128, 256, (100, 3...
code_fim
hard
{ "lang": "python", "repo": "darknli/CenterFace", "path": "/demo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def notify(status): session = boto3.Session(profile_name='trbryan') sns = session.client('sns') response = sns.publish( TopicArn='arn:aws:sns:us-west-2:509611857908:opensprinkler_et_update', Message=status, Subject='Daily OpenSprinkler ET Adjustment', MessageStructure='string', ) ...
code_fim
hard
{ "lang": "python", "repo": "toddrbryan/EBSM", "path": "/get_et_rate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: toddrbryan/EBSM path: /get_et_rate.py import os, sys, datetime, pytz, tzlocal, urllib.request, requests, csv, hashlib, json, boto3 uri = 'ftp://ftpcimis.water.ca.gov/pub2/daily/daily107.csv' #Station 107 is Santa Barbara base_et = 0.15 def main(): try: tempfile = tempfile_name() get_...
code_fim
hard
{ "lang": "python", "repo": "toddrbryan/EBSM", "path": "/get_et_rate.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sky-bot/Interview_Preparation path: /LeetCode/tree/Range_Sum_of_BST.py # 938. Range Sum of BST # Share # Given the root node of a binary search tree, return the sum of values of all nodes with value between L and R (inclusive). # The binary search tree is guaranteed to have unique values. ...
code_fim
hard
{ "lang": "python", "repo": "sky-bot/Interview_Preparation", "path": "/LeetCode/tree/Range_Sum_of_BST.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># return result # def cal_sum(self, root, L, R, result): # if not root: # return result # left = self.cal_sum(root.left, L, R, result) # right = self.cal_sum(root.right, L, R, result) # if root.val < L or root.val ...
code_fim
medium
{ "lang": "python", "repo": "sky-bot/Interview_Preparation", "path": "/LeetCode/tree/Range_Sum_of_BST.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # CONV3 -> BN -> RELU Block applied to X X = Conv2D(32, (1, 1), strides=(1, 1), name='conv2',kernel_regularizer=regularizers.l2(0.001),padding="same")(X) X = BatchNormalization(axis=3, name='bn2')(X) X = Activation('relu')(X) #X = Dropout(0.5)(X) # MAXPOOL3 X = MaxPooli...
code_fim
hard
{ "lang": "python", "repo": "pohwa065/Surface-Defect-Image-Classification-with-Convolutional-Neural-Network", "path": "/CNN_Keras.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pohwa065/Surface-Defect-Image-Classification-with-Convolutional-Neural-Network path: /CNN_Keras.py import math import numpy as np import h5py import matplotlib.pyplot as plt import scipy from PIL import Image from scipy import ndimage import tensorflow as tf from tensorflow.python.framewo...
code_fim
hard
{ "lang": "python", "repo": "pohwa065/Surface-Defect-Image-Classification-with-Convolutional-Neural-Network", "path": "/CNN_Keras.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> correct = [i for i,item in enumerate(predicted_classes) if item == y_test_orig[i]] wrong = [i for i,item in enumerate(predicted_classes) if item != y_test_orig[i]] print(predicted_classes) print(y_test_orig) print(correct) print(wrong) accuracy={} for i in range(7): all = np.sum(...
code_fim
hard
{ "lang": "python", "repo": "pohwa065/Surface-Defect-Image-Classification-with-Convolutional-Neural-Network", "path": "/CNN_Keras.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: BlenderCN-Org/xiuminglib path: /xiuminglib/io/exr.py from os.path import abspath, dirname, join, basename import numpy as np import cv2 import xiuminglib as xm logger, thisfile = xm.config.create_logger(abspath(__file__)) class EXR(): """Reads EXR files. EXR files can be generic or p...
code_fim
hard
{ "lang": "python", "repo": "BlenderCN-Org/xiuminglib", "path": "/xiuminglib/io/exr.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Args: outpath (str): Path to the result .npy file. vis (bool, optional): Whether to visualize the normal vectors as an image. Writes - A .npy file containing an aliased normal map and its alpha map. - If ``vis``, a .png visualization of anti...
code_fim
hard
{ "lang": "python", "repo": "BlenderCN-Org/xiuminglib", "path": "/xiuminglib/io/exr.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> template_common.validate_models(data, _SCHEMA) v = template_common.flatten_data(data['models'], {}) v['optionsCommand'] = _generate_options(data['models']) v['solenoidCommand'] = _generate_solenoid(data['models']) v['beamCommand'] = _generate_beam(data['models']) v['currentCommand'...
code_fim
hard
{ "lang": "python", "repo": "yeeon/sirepo", "path": "/sirepo/template/hellweg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> solenoid = models.solenoid if solenoid.sourceDefinition == 'none': return '' if solenoid.sourceDefinition == 'values': #TODO(pjm): latest version also has solenoid.fringeRegion return 'SOLENOID {} {} {}'.format( solenoid.fieldStrength, solenoid.length, solen...
code_fim
hard
{ "lang": "python", "repo": "yeeon/sirepo", "path": "/sirepo/template/hellweg.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yeeon/sirepo path: /sirepo/template/hellweg.py beam_info = hellweg_dump_reader.beam_info(_dump_file(run_dir), frame) points = hellweg_dump_reader.get_points(beam_info, report.reportType) hist, edges = np.histogram(points, template_common.histogram_bins(report.histogramBins)) return { ...
code_fim
hard
{ "lang": "python", "repo": "yeeon/sirepo", "path": "/sirepo/template/hellweg.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AdityaGupta6/e-com path: /ecommerce/shop/models.py from functools import update_wrapper from django.db import models # Create your models here. class Product(models.Model): product_id=models.AutoField product_name=models.CharField(max_length=50) category=models.CharField(max_length...
code_fim
hard
{ "lang": "python", "repo": "AdityaGupta6/e-com", "path": "/ecommerce/shop/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> update_id=models.AutoField(primary_key=True); order_id=models.IntegerField(default=0) update_desc=models.CharField(max_length=50000,default="") timestamp=models.DateField(auto_now_add=True) def __str__(self): return self.update_desc[0:7] + "..."<|fim_prefix|># repo: AdityaGupt...
code_fim
hard
{ "lang": "python", "repo": "AdityaGupta6/e-com", "path": "/ecommerce/shop/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ort * from utils.construct_model_data import construct_model_and_data from utils.generate_model import ImageModel from utils.generate_video import video from utils.load_data import ImageData, split_data from utils.show_or_save import * from utils.gradient_strategy.centerconv_generator import CenterConvGen...
code_fim
medium
{ "lang": "python", "repo": "LiYangSir/Like_Attack", "path": "/utils/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: LiYangSir/Like_Attack path: /utils/__init__.py from utils.gradient_strategy.dct_generator import DCTGenerator from utils.gradient_strategy.random_generator import RandomGenerator from utils.gradient_str<|fim_suffix|>ort * from utils.construct_model_data import construct_model_and_data from utils....
code_fim
medium
{ "lang": "python", "repo": "LiYangSir/Like_Attack", "path": "/utils/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>m utils.load_data import ImageData, split_data from utils.show_or_save import * from utils.gradient_strategy.centerconv_generator import CenterConvGenerator<|fim_prefix|># repo: LiYangSir/Like_Attack path: /utils/__init__.py from utils.gradient_strategy.dct_generator import DCTGenerator from utils.gradie...
code_fim
medium
{ "lang": "python", "repo": "LiYangSir/Like_Attack", "path": "/utils/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Om-Gupta-Dev/First-Django path: /FirstProject/CRUD/migrations/0002_auto_20200713_0035.py # Generated by Django 3.0.8 on 2020-07-12 19:05 from django.db import migrations <|fim_suffix|> dependencies = [ ('CRUD', '0001_initial'), ] operations = [ migrations.RenameFiel...
code_fim
easy
{ "lang": "python", "repo": "Om-Gupta-Dev/First-Django", "path": "/FirstProject/CRUD/migrations/0002_auto_20200713_0035.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RenameField( model_name='employee', old_name='eAdddress', new_name='eAddress', ), ]<|fim_prefix|># repo: Om-Gupta-Dev/First-Django path: /FirstProject/CRUD/migrations/0002_auto_20200713_0035.py # Generated by Django 3.0...
code_fim
medium
{ "lang": "python", "repo": "Om-Gupta-Dev/First-Django", "path": "/FirstProject/CRUD/migrations/0002_auto_20200713_0035.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('CRUD', '0001_initial'), ] operations = [ migrations.RenameField( model_name='employee', old_name='eAdddress', new_name='eAddress', ), ]<|fim_prefix|># repo: Om-Gupta-Dev/First-Django path: /FirstProject/CRUD/m...
code_fim
easy
{ "lang": "python", "repo": "Om-Gupta-Dev/First-Django", "path": "/FirstProject/CRUD/migrations/0002_auto_20200713_0035.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> data = struct.unpack(">hhhB", adcs1_data) self.bdot = tuple(data[0:3]) self.state = data[3] def __str__(self): adcs1_str = ("""ADCS1: State:\t{} Bdot:\t{}""".format(self.state, self.bdot)) return adcs1_str class ADCS2(object): def __init__...
code_fim
hard
{ "lang": "python", "repo": "aausat/gr-aausat", "path": "/python/beacon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aausat/gr-aausat path: /python/beacon.py from datetime import datetime import struct BEACON_LENGTH = 84 EPS_LENGTH = 20 COM_LENGTH = 10 # reverse engineered ADCS1_LENGTH = 7 ADCS2_LENGTH = 6 AIS_LENGTH = 20 class EPS(object): def __init__(self, eps_data): if len(eps_data) != EPS_LE...
code_fim
hard
{ "lang": "python", "repo": "aausat/gr-aausat", "path": "/python/beacon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Reverse engineered classes class ADCS1(object): def __init__(self, adcs1_data): data = struct.unpack(">hhhB", adcs1_data) self.bdot = tuple(data[0:3]) self.state = data[3] def __str__(self): adcs1_str = ("""ADCS1: State:\t{} Bdot:\t{}""".format(se...
code_fim
hard
{ "lang": "python", "repo": "aausat/gr-aausat", "path": "/python/beacon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>e("%w"))+1 # print(dd) # print(nn) print((datetime.now().date())+(timedelta(days=dd-nn)))<|fim_prefix|># repo: yustshachar/pythonProject1 path: /date_time1/targil9.4.py from datetime import * dd=int(input("enter n<|fim_middle|>umber day: ")) nn=int(datetime.now().strftim
code_fim
easy
{ "lang": "python", "repo": "yustshachar/pythonProject1", "path": "/date_time1/targil9.4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yustshachar/pythonProject1 path: /date_time1/targil9.4.py from datetime import * dd=int(input("enter n<|fim_suffix|>e("%w"))+1 # print(dd) # print(nn) print((datetime.now().date())+(timedelta(days=dd-nn)))<|fim_middle|>umber day: ")) nn=int(datetime.now().strftim
code_fim
easy
{ "lang": "python", "repo": "yustshachar/pythonProject1", "path": "/date_time1/targil9.4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: costrouc/moa-grammar path: /tests/test_yaccer.py import pytest from moa.primitives import NDArray, UnaryOperation, BinaryOperation, Function from moa.yaccer import build_parser @pytest.mark.parametrize("expression,result", [ ("< 1 2 3>", NDArray(shape=(3,), data=[1, 2, 3], constant=False))...
code_fim
hard
{ "lang": "python", "repo": "costrouc/moa-grammar", "path": "/tests/test_yaccer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize("expression, result", [ ('main(){}', Function(arguments=[], statements=[], identifier='main')), ('foo_bar(array A^1 <5>){}', Function( arguments=[NDArray(shape=(5,), data=None, constant=False, identifier='A')], statements=[], identifier='foo_bar')),...
code_fim
hard
{ "lang": "python", "repo": "costrouc/moa-grammar", "path": "/tests/test_yaccer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("expression, result", [ ('main(){}', Function(arguments=[], statements=[], identifier='main')), ('foo_bar(array A^1 <5>){}', Function( arguments=[NDArray(shape=(5,), data=None, constant=False, identifier='A')], statements=[], identifier='foo_bar'))...
code_fim
hard
{ "lang": "python", "repo": "costrouc/moa-grammar", "path": "/tests/test_yaccer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ordering = ['name'] def __str__(self): return "{} {} {}".format(self.name, self.address, self.city)<|fim_prefix|># repo: jasimdipu/resturent path: /res_info/models.py from django.db import models # Create your models here. class GeneralInformation(models.Model): <|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "jasimdipu/resturent", "path": "/res_info/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jasimdipu/resturent path: /res_info/models.py from django.db import models # Create your models here. class GeneralInformation(models.Model): name = models.CharField(max_length=100) address = models.TextField() city = models.CharField(max_length=20) <|fim_suffix|> def __str__(s...
code_fim
easy
{ "lang": "python", "repo": "jasimdipu/resturent", "path": "/res_info/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> newNumber = input("Δώσε μου τη καταχώρηση σου: ") if newNumber != 'q' and newNumber != 'r' and newNumber != '0r' : if newNumber[0] != '0' : alist.append(float(newNumber)) check = True else : numberToList = list(newNumber)...
code_fim
medium
{ "lang": "python", "repo": "CortoMaltese3/Coursity-IntroductionToProgammingWithPython", "path": "/Week 3/Askisi_3_2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CortoMaltese3/Coursity-IntroductionToProgammingWithPython path: /Week 3/Askisi_3_2.py #Άσκηση 3.2: Ουρά δύο άκρων print("Οδηγίες: Το πρόγραμμα καταχωρει αριθμους σε μια λίστα! Τρέχει σε άπειρο βρόχο, έως ότου πληκτρολογήσεις 'q'. \nΑν θελήσεις να βγάλεις το πρώτο στοιχείο της λίστας, πληκτρολό...
code_fim
hard
{ "lang": "python", "repo": "CortoMaltese3/Coursity-IntroductionToProgammingWithPython", "path": "/Week 3/Askisi_3_2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #παρατηρήσεις : #1) Στο πρόγραμμα δεν έχει μπει κάποιος έλεγχος για την εισοδο του χρήστη κι έτσι αν πληκτρολογήσει κάτι εκτος από αριθμό ή 'q' / 'r' / '0r' το πρόγραμμα σκάει #2) Ο έλεγχος με το 'r', '0r' έγινε εκτός της πρώτης εισόδου για να συμπεριλάβουμε τη περίπτωση που η λίστα ειναι κενή. Αν...
code_fim
hard
{ "lang": "python", "repo": "CortoMaltese3/Coursity-IntroductionToProgammingWithPython", "path": "/Week 3/Askisi_3_2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># x1 = np.arange(9.0).reshape((3, 3)) # x2 = np.arange(3.0) # print x1 # print x2 # print np.multiply(x1, x2)<|fim_prefix|># repo: hanchensu/adrd path: /py_bayes/svm/train.py ''' Created on Nov 1, 2013 @author: hanchensu ''' from numpy import * import numpy as np def smoSimple(dataMatIn, classLabels, C...
code_fim
medium
{ "lang": "python", "repo": "hanchensu/adrd", "path": "/py_bayes/svm/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hanchensu/adrd path: /py_bayes/svm/train.py ''' Created on Nov 1, 2013 @author: hanchensu ''' from numpy import * import numpy as np def smoSimple(dataMatIn, classLabels, C, toler, maxIter): <|fim_suffix|>matrix = mat([[1,2],[3,4],[5,6]]) m,n= shape(matrix) matA = mat([[1,2],[2,3],[5,6]]) matB...
code_fim
medium
{ "lang": "python", "repo": "hanchensu/adrd", "path": "/py_bayes/svm/train.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>matA = mat([[1,2],[2,3],[5,6]]) matB = mat([1,2,3]).transpose() print matA print matB print multiply(matA,matB) # x1 = np.arange(9.0).reshape((3, 3)) # x2 = np.arange(3.0) # print x1 # print x2 # print np.multiply(x1, x2)<|fim_prefix|># repo: hanchensu/adrd path: /py_bayes/svm/train.py ''' Created on ...
code_fim
hard
{ "lang": "python", "repo": "hanchensu/adrd", "path": "/py_bayes/svm/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Carnivictid/projectrpg path: /quests.py import world import items class Quest: def __init__(self): raise NotImplementedError("Do not create raw quest classes") def __str__(self): return self.quest_name def give_reward(self, player): print("You receive: \n{} gold\n{} exp".format(s...
code_fim
hard
{ "lang": "python", "repo": "Carnivictid/projectrpg", "path": "/quests.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>''' #### Working on new quest architecture #### class QuestObject: def __init__(self): self.quest_status = 0 self.complete_status = 0 self.quest_name = "Quest Name" self.reward_gold = 0 self.reward_exp = 0 self.reward_item = [] self.quest_logs = [] self.player_log = [] self.complete = F...
code_fim
hard
{ "lang": "python", "repo": "Carnivictid/projectrpg", "path": "/quests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return self.quest_name def give_reward(self, player): if self.complete: print("You tried to get rewards twice! Something broke!") return print("You completed the quest: {}".format(self.quest_name)) print("Here is your reward:") for item in self.reward_item: print("...
code_fim
hard
{ "lang": "python", "repo": "Carnivictid/projectrpg", "path": "/quests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>her_list"), path("directory/teachers/<int:pk>/", TeacherDetailAPIView.as_view(), name="teacher_detail"), ]<|fim_prefix|># repo: bartkoz/directory path: /app/urls.py from django.urls import path, re_path from app.views import UploaderAPIView, TeacherListAPIView, TeacherDetailAPIView app_name = "dire...
code_fim
medium
{ "lang": "python", "repo": "bartkoz/directory", "path": "/app/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bartkoz/directory path: /app/urls.py from django.urls import path, re_path from app.views import UploaderAPIView, TeacherListAPIView, TeacherDetai<|fim_suffix|>her_list"), path("directory/teachers/<int:pk>/", TeacherDetailAPIView.as_view(), name="teacher_detail"), ]<|fim_middle|>lAPIView ap...
code_fim
hard
{ "lang": "python", "repo": "bartkoz/directory", "path": "/app/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(image[0]) print("~~~~~~~~~~~~~~~") print(image.shape[0]) print("~~~~~~~~~~~~~~~") print(len(image))<|fim_prefix|># repo: yavaralikhan/proj path: /Mar12D.py import cv2 print(cv2.__version__) <|fim_middle|>image = cv2.imread("download.jpeg", 1) print(image) print(image.shape)
code_fim
medium
{ "lang": "python", "repo": "yavaralikhan/proj", "path": "/Mar12D.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yavaralikhan/proj path: /Mar12D.py import cv2 print(cv2.__version__) <|fim_suffix|>print(image[0]) print("~~~~~~~~~~~~~~~") print(image.shape[0]) print("~~~~~~~~~~~~~~~") print(len(image))<|fim_middle|>image = cv2.imread("download.jpeg", 1) print(image) print(image.shape)
code_fim
medium
{ "lang": "python", "repo": "yavaralikhan/proj", "path": "/Mar12D.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rajat08/NLP_projects path: /text_processing_basics/code/cs505_a1_rajat08/regex.py import re from pathlib import Path RAW_DUMP_XML = Path("raw_data/Wikipedia.xml") def count_regexp(): """Counts the occurences of the regular expressions you will write. """ # Here's an exampl...
code_fim
hard
{ "lang": "python", "repo": "rajat08/NLP_projects", "path": "/text_processing_basics/code/cs505_a1_rajat08/regex.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> example_matches = [matches[i * (count // 5)] for i in range(5)] print("Found {} occurences of {}".format(count, name)) print("Here are examples:") print("\n".join(example_matches)) print("\n") if __name__ == "__main__": count_rege...
code_fim
hard
{ "lang": "python", "repo": "rajat08/NLP_projects", "path": "/text_processing_basics/code/cs505_a1_rajat08/regex.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def save(self, fileName:str): filedesc = Path(fileName).with_suffix('.cdc') self.salveCnnDescriptor(filedesc) fileName = fileName.encode('utf-8') return clib.CnnSaveInFile(self.cnn.p, c.create_string_buffer(fileName)) @staticmethod def load(fileName): s...
code_fim
hard
{ "lang": "python", "repo": "Xx220xX/Convolutional-Network-python", "path": "/CNN_GPU/CNN.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def addReluLayer(self): clib.CnnAddReluLayer(self.cnn.p) def addDropOutLayer(self, pontoAtivacao, seed): clib.CnnAddDropOutLayer(self.cnn.p, pontoAtivacao, seed) def addFullConnectLayer(self, saida, funcaoAtivacao): clib.CnnAddFullConnectLayer(self.cnn.p, saida, funca...
code_fim
hard
{ "lang": "python", "repo": "Xx220xX/Convolutional-Network-python", "path": "/CNN_GPU/CNN.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {name} nm".format(name=sys.argv[0]) else: DSN = dbconn2.read_cnf() DSN['db'] = 'mmm_db' # the database we want to connect to dbconn2.connect(DSN) print lookupByNM(sys.argv[1])<|fim_prefix|># ...
code_fim
hard
{ "lang": "python", "repo": "Wellesley-CS304-SP18/semester-project-foodies", "path": "/uploadops.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wellesley-CS304-SP18/semester-project-foodies path: /uploadops.py # uploadops.py # CS304-Final Project # Created by: Megan Shum, Maxine Hood, Mina Hattori #!/usr/local/bin/python2.7 # This file handles all the SQL calls for the upload page. import sys import MySQLdb import dbconn2 <|fim_suffix|...
code_fim
hard
{ "lang": "python", "repo": "Wellesley-CS304-SP18/semester-project-foodies", "path": "/uploadops.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># ================================================================ # This starts the ball rolling, *if* the script is run as a script, # rather than just being imported. if __name__ == '__main__': if len(sys.argv) < 2: print "Usage: {name} nm".format(name=sys.argv[0]) else: DSN = ...
code_fim
hard
{ "lang": "python", "repo": "Wellesley-CS304-SP18/semester-project-foodies", "path": "/uploadops.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gofur/learnpython path: /ex12.py umur = raw_input("Berapakah umurmu?") tinggi = raw<|fim_suffix|>nggumu %r, dan beratmu %r." % (umur, tinggi, berat)<|fim_middle|>_input("Berapakah tinggimu?") berat = raw_input("Berapa beratmu?") print "Jadi, umurmu adalah %r, ti
code_fim
medium
{ "lang": "python", "repo": "gofur/learnpython", "path": "/ex12.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>nggumu %r, dan beratmu %r." % (umur, tinggi, berat)<|fim_prefix|># repo: gofur/learnpython path: /ex12.py umur = raw_input("Berapakah umurmu?") tinggi = raw<|fim_middle|>_input("Berapakah tinggimu?") berat = raw_input("Berapa beratmu?") print "Jadi, umurmu adalah %r, ti
code_fim
medium
{ "lang": "python", "repo": "gofur/learnpython", "path": "/ex12.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> super(Weapon, self).__init__(name) self.power = power @staticmethod def fromJSON(jsonstr): obj = Equipment.fromJSON(jsonstr) return Weapon(obj["name"], obj["power"]) def __str__(self): return "{}: Power({})".format(self.name, self.power)<|fim_prefix|>#...
code_fim
medium
{ "lang": "python", "repo": "david3355/PyGame", "path": "/weapon.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: david3355/PyGame path: /weapon.py __author__ = 'Jager' from equipment import Equipment <|fim_suffix|> return "{}: Power({})".format(self.name, self.power)<|fim_middle|>class Weapon (Equipment): def __init__(self, name, power): super(Weapon, self).__init__(name) self.p...
code_fim
hard
{ "lang": "python", "repo": "david3355/PyGame", "path": "/weapon.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: david3355/PyGame path: /weapon.py __author__ = 'Jager' from equipment import Equipment class Weapon (Equipment): def __init__(self, name, power): super(Weapon, self).__init__(name) self.power = power <|fim_suffix|> return "{}: Power({})".format(self.name, self.power)...
code_fim
medium
{ "lang": "python", "repo": "david3355/PyGame", "path": "/weapon.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dannycrief/full-stack-web-dev-couse path: /Web/B/5/5.4/first.py def h1_wrap(func): def func_wrapper(param): <|fim_suffix|> return "Hello, " + name.capitalize() print(say_hi("Stephan"))<|fim_middle|> return "<h1>"+func(param) + "</h1>" return func_wrapper @h1_wrap def say_hi(...
code_fim
medium
{ "lang": "python", "repo": "dannycrief/full-stack-web-dev-couse", "path": "/Web/B/5/5.4/first.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return "Hello, " + name.capitalize() print(say_hi("Stephan"))<|fim_prefix|># repo: dannycrief/full-stack-web-dev-couse path: /Web/B/5/5.4/first.py def h1_wrap(func): def func_wrapper(param): return "<h1>"+func(param) + "</h1>" return func_wrapper <|fim_middle|> @h1_wrap def say_hi(...
code_fim
easy
{ "lang": "python", "repo": "dannycrief/full-stack-web-dev-couse", "path": "/Web/B/5/5.4/first.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>T_DIR$/test4.py" /> <option name="PARAMETERS" value="" /> <option name="SHOW_COMMAND_LINE" value="false" /> <option name="EMULATE_TERMINAL" value="false" /> <option name="MODULE_MODE" value="false" /> <option name="REDIRECT_INPUT" value="false" /> <option name="INPUT_FI...
code_fim
hard
{ "lang": "python", "repo": "PenuverWoo/hori_check", "path": "/venv/Lib/site-packages/matplotlib/backends/backend_qt5agg.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: PenuverWoo/hori_check path: /venv/Lib/site-packages/matplotlib/backends/backend_qt5agg.py onfiguration name="test3" type="PythonConfigurationType" factoryName="Python" temporary="true"> <module name="hori_check" /> <option name="INTERPRETER_OPTIONS" value="" /> <option name="PAR...
code_fim
hard
{ "lang": "python", "repo": "PenuverWoo/hori_check", "path": "/venv/Lib/site-packages/matplotlib/backends/backend_qt5agg.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>m itemvalue="Python.test3" /> </list> </recent_temporary> </component> <component name="SvnConfiguration"> <configuration /> </component> <component name="TaskManager"> <task active="true" id="Default" summary="Default task"> <changelist id="b9acfeb2-5104-4c03-bdda-fe9dd331...
code_fim
hard
{ "lang": "python", "repo": "PenuverWoo/hori_check", "path": "/venv/Lib/site-packages/matplotlib/backends/backend_qt5agg.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Возведение в степень. Логика та же, что в делении def powering(user_list): pownum=user_list[0] for item in user_list[1:]: pownum **= item return pownum while True: operation = input("Enter operation sign, please (*), (/), (+), (-), (^). \nTo quit, please enter 'done' > ") i...
code_fim
hard
{ "lang": "python", "repo": "alx42195/PythonOOP", "path": "/2_class3_task1+2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> multnum=1 for item in user_list: multnum *= item return multnum # Деление. Здесь долго мучился, т.к. нужно первое число оставть и делить его на второе, т.е цикл со второго индекса # пока не нашел в Интернете запись через slice напр.: for i in collection[1:] def division(user_list): ...
code_fim
hard
{ "lang": "python", "repo": "alx42195/PythonOOP", "path": "/2_class3_task1+2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alx42195/PythonOOP path: /2_class3_task1+2.py # Задание 1 # Выучите основные стандартные исключения, которые перечислены в данном уроке. # Задание 2 # Напишите программу-калькулятор, которая поддерживает следующие операции: сложение, вычитание, # умножение, деление и возведение в степень. Програм...
code_fim
hard
{ "lang": "python", "repo": "alx42195/PythonOOP", "path": "/2_class3_task1+2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def package(self): cmake = CMake(self) cmake.install() copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/ruy/all/conanfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: conan-io/conan-center-index path: /recipes/ruy/all/conanfile.py import os from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, replace_in_file, rmdir from c...
code_fim
hard
{ "lang": "python", "repo": "conan-io/conan-center-index", "path": "/recipes/ruy/all/conanfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kawser-nerd/CLCDSA path: /Source Codes/CodeJamData/17/31/19.py import itertools import math def score(stack): syrup = math.pi * max(x[0] for x in stack)**2 for item in stack: syrup += 2*math.pi*item[0]*item[1] return syrup def ring_score(item): return 2...
code_fim
medium
{ "lang": "python", "repo": "Kawser-nerd/CLCDSA", "path": "/Source Codes/CodeJamData/17/31/19.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for case in range(1, cases+1): n, k = map(int, next(infile).split()) pancakes = [] for _ in range(n): pancakes.append(tuple(map(int, next(infile).split()))) pancakes.sort(key=ring_score, reverse=True) preliminary...
code_fim
hard
{ "lang": "python", "repo": "Kawser-nerd/CLCDSA", "path": "/Source Codes/CodeJamData/17/31/19.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Maxime00/Salamander_controller path: /Lab9/Webots/controllers/pythonController/exercise_9c.py """Exercise 9c""" import time import numpy as np import matplotlib.pyplot as plt from plot_results import plot_2d from run_simulation import run_simulation from simulation_parameters import SimulationPa...
code_fim
hard
{ "lang": "python", "repo": "Maxime00/Salamander_controller", "path": "/Lab9/Webots/controllers/pythonController/exercise_9c.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }