text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|># Reshape data train_input = train_input.values.reshape(1,row_count,input_column_count) train_output = train_output.values.reshape(1,row_count,len(train_output.columns)) # Build the model from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.optimizer...
code_fim
hard
{ "lang": "python", "repo": "Archmonger/Xanadu-Parse", "path": "/Xanadu-Parse/XanaduParse.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Archmonger/Xanadu-Parse path: /Xanadu-Parse/XanaduParse.py # Training dataset import pandas as pd import numpy as np train = pd.read_csv(r'train.csv', sep='|') train_input = train[['Altered File Name','Content Type']] train_output = train['Resolution'] row_count = train['Altered File Name'].coun...
code_fim
medium
{ "lang": "python", "repo": "Archmonger/Xanadu-Parse", "path": "/Xanadu-Parse/XanaduParse.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jdlrobson/ifttt path: /fabfile.py from fabric.api import task, env, sudo, cd tool_name = 'ifttt' env.hosts = ['tools-login.wmflabs.org'] env.sudo_user = 'tools.{}'.format(tool_name) env.sudo_prefix = 'sudo -ni ' env.use_ssh_config = True <|fim_suffix|>@task def deploy(*args): with cd(code_...
code_fim
medium
{ "lang": "python", "repo": "jdlrobson/ifttt", "path": "/fabfile.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@task def deploy(*args): with cd(code_dir): sudo('git rev-list HEAD --max-count=1') sudo('git fetch') sudo('git reset --hard origin/master') sudo('webservice uwsgi-python restart')<|fim_prefix|># repo: jdlrobson/ifttt path: /fabfile.py from fabric.api import task, env,...
code_fim
medium
{ "lang": "python", "repo": "jdlrobson/ifttt", "path": "/fabfile.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>app_name = 'TREC' urlpatterns = patterns('', url(r'^$', views.homepage, name='homepage'), url(r'^about/$',views.about, name='about'), url(r'^leaderboard/$', views.leaderboard, name='leaderboard'), url(r'^profile/$', views.profile, name='profile'), url(r'^profile/(?P<username>.+)/$', v...
code_fim
medium
{ "lang": "python", "repo": "2078910A/TRECevalProject", "path": "/TRECappProject/TREC/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 2078910A/TRECevalProject path: /TRECappProject/TREC/urls.py from django.conf.urls import patterns, url from TREC import views from registration.backends.simple.views import RegistrationView # Create a new class that redirects the user to the index page, if successful at logging class MyRegistra...
code_fim
medium
{ "lang": "python", "repo": "2078910A/TRECevalProject", "path": "/TRECappProject/TREC/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = patterns('', url(r'^$', views.homepage, name='homepage'), url(r'^about/$',views.about, name='about'), url(r'^leaderboard/$', views.leaderboard, name='leaderboard'), url(r'^profile/$', views.profile, name='profile'), url(r'^profile/(?P<username>.+)/$', views.otherprofile, ...
code_fim
medium
{ "lang": "python", "repo": "2078910A/TRECevalProject", "path": "/TRECappProject/TREC/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: os.mkdir(destination) except: print ("Folder has failed to be created") else: print (caseid + " folder created successfully") ## Calling the funcion createcasefolder createcasefolder (caseid) ## Branching the case based on the case type if casetype == "chat" or c...
code_fim
medium
{ "lang": "python", "repo": "tavaresrodrigo/oca", "path": "/case.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>##outliers in non-linear pattern X, y = generate_nonlinear_synthetic_sine_data_regression(600) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1, random_state=1) plot_data_2d_regression(X_train, y_train, x_limit=[-4,10], y_limit=[-2,10]) #add outliers in features X_train[::10]...
code_fim
hard
{ "lang": "python", "repo": "vishnu-sagar/Data-Science", "path": "/Data Science/11.regression/10.robust regression.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vishnu-sagar/Data-Science path: /Data Science/11.regression/10.robust regression.py import sys import os path = os.path.abspath(os.path.join('.')) sys.path.append(path) path = 'G://' sys.path.append(path) from common_utils import * from regression_utils import * from kernel_utils impor...
code_fim
hard
{ "lang": "python", "repo": "vishnu-sagar/Data-Science", "path": "/Data Science/11.regression/10.robust regression.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> create_couriers(pg_connection, data_couriers) create_orders(pg_connection, data_orders) order = pg_connection.execute(update(Order.__table__).where(Order.id == data_complete['order_id']).values( courier_id=data_complete['courier_id'], is_assign=True, is_complete=True, assign_time=assig...
code_fim
hard
{ "lang": "python", "repo": "EGP24/async_candy_shop", "path": "/tests/test_courier_service/test_get_courier_info.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: EGP24/async_candy_shop path: /tests/test_courier_service/test_get_courier_info.py import pytest from datetime import timedelta, datetime from sqlalchemy.future import select from sqlalchemy import update from tests.functions_for_testing import get_stub, create_couriers, create_orders, interval_t...
code_fim
hard
{ "lang": "python", "repo": "EGP24/async_candy_shop", "path": "/tests/test_courier_service/test_get_courier_info.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.asyncio async def test_validation_courier_id(client, pg_connection): data_couriers = get_stub('success_create_couriers.json') data_orders = get_stub('success_create_orders.json') data_complete = get_stub('success_complete_order.json') td = timedelta(minutes=15) assign_time...
code_fim
hard
{ "lang": "python", "repo": "EGP24/async_candy_shop", "path": "/tests/test_courier_service/test_get_courier_info.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># create linear solver ksp = PETSc.KSP() ksp.create(PETSc.COMM_WORLD) # use conjugate gradients ksp.setType('cg') # and incomplete Cholesky ksp.getPC().setType('none') #ksp.getPC().setType('jacobi') # obtain sol & rhs vectors x, b = A.getVecs() x.set(0) b.set(1) # and next solve ksp.setOperators(A) ksp.se...
code_fim
hard
{ "lang": "python", "repo": "ImageGuidedTherapyLab/ImageGuidedSolvers", "path": "/Examples/LinearAlgebra/solveCG.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ImageGuidedTherapyLab/ImageGuidedSolvers path: /Examples/LinearAlgebra/solveCG.py import sys, petsc4py print "init" PetscOptions = sys.argv PetscOptions.append("-ksp_monitor") PetscOptions.append("-ksp_converged_reason") PetscOptions.append("-ksp_rtol") PetscOptions.append("1.e-20") petsc4py.ini...
code_fim
medium
{ "lang": "python", "repo": "ImageGuidedTherapyLab/ImageGuidedSolvers", "path": "/Examples/LinearAlgebra/solveCG.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#Verificar se as entradas são válidas: if (H < 0) or (h < 0) or (r < 0) or (H < h) or (H < 2*r): print('Entradas invalidas') else: if (h < r): #Caso1 V=(1/3)*pi(h**2)*(3*r - h) elif(h < H - r): #Caso2 V=(2/3)*pi*r**3+pi*r**2(h - r) elif(h <= H): #Caso3 V=(4/3)*pi*(r**3) + pi*(r**2)*(H-2*r) - (1/...
code_fim
medium
{ "lang": "python", "repo": "JosephLevinthal/Research-projects", "path": "/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/4058/codes/1684_1102.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JosephLevinthal/Research-projects path: /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/4058/codes/1684_1102.py # Teste todas as possibilidades de entradas 'H', 'h' e 'x' # Se seu programa funciona para apenas um caso de tese, isso não...
code_fim
medium
{ "lang": "python", "repo": "JosephLevinthal/Research-projects", "path": "/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/222/users/4058/codes/1684_1102.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_completo = driver.find_element_by_class_name('DocumentView-content document-content fos-bottomref') documentos_info = driver.find_element_by_class_name('DocumentView-content-text') lista_documentos.append(documentos_info) print (lista_documentos) driver.close()<|fim_prefix|># repo: machadolopes/c...
code_fim
hard
{ "lang": "python", "repo": "machadolopes/celeiro", "path": "/celeiro.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: machadolopes/celeiro path: /celeiro.py from selenium import webdriver from datetime import date #cria driver para webscraping driver = webdriver.Chrome() #seleciona o dia atual do diário oficial today = date.today() dia = today.strftime("%d") mes = today.strftime("%m") ano = today.strftime("%Y"...
code_fim
hard
{ "lang": "python", "repo": "machadolopes/celeiro", "path": "/celeiro.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Post fields = ('id', 'author', 'body', 'created_at', 'likes') read_only_fields = ('id',) def get_likes(self, obj): return obj.likes.all().count()<|fim_prefix|># repo: Jerome-Allgood/test_social_network path: /post/api/serializers.py from rest_framework import serializers <...
code_fim
medium
{ "lang": "python", "repo": "Jerome-Allgood/test_social_network", "path": "/post/api/serializers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jerome-Allgood/test_social_network path: /post/api/serializers.py from rest_framework import serializers from post.models import Post class PostSerializer(serializers.ModelSerializer): likes = serializers.SerializerMethodField() class Meta: <|fim_suffix|> def get_likes(self, obj): return ...
code_fim
medium
{ "lang": "python", "repo": "Jerome-Allgood/test_social_network", "path": "/post/api/serializers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return True class AnonymousUser(AnonymousUserMixin): def can(self, permissions): return False def is_administrator(self): return False login_manager.anonymous_user = AnonymousUser @login_manager.user_loader def load_user(user_id): user_id = user_id.decode('utf-8') ...
code_fim
hard
{ "lang": "python", "repo": "ZipLib/learngit", "path": "/app/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def can(self, permissions): return False def is_administrator(self): return False login_manager.anonymous_user = AnonymousUser @login_manager.user_loader def load_user(user_id): user_id = user_id.decode('utf-8') if len(user_id) == 8: return Patient.query.filter_b...
code_fim
hard
{ "lang": "python", "repo": "ZipLib/learngit", "path": "/app/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZipLib/learngit path: /app/models.py from werkzeug.security import generate_password_hash, check_password_hash from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from flask import current_app from flask_login import UserMixin, AnonymousUserMixin from . import db, login_manager...
code_fim
hard
{ "lang": "python", "repo": "ZipLib/learngit", "path": "/app/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Register your models here. admin.site.register(MyUser, UserAdmin)<|fim_prefix|># repo: dbmiddle/twitter_clone path: /twitteruser/admin.py from django.contrib import admin from django.contrib.auth.admin import UserAdmin <|fim_middle|>from twitteruser.models import MyUser
code_fim
easy
{ "lang": "python", "repo": "dbmiddle/twitter_clone", "path": "/twitteruser/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dbmiddle/twitter_clone path: /twitteruser/admin.py from django.contrib import admin from django.contrib.auth.admin import UserAdmin <|fim_suffix|># Register your models here. admin.site.register(MyUser, UserAdmin)<|fim_middle|>from twitteruser.models import MyUser
code_fim
easy
{ "lang": "python", "repo": "dbmiddle/twitter_clone", "path": "/twitteruser/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: return self['committee'] except KeyError: try: return self['subcommittee'] except KeyError: raise @property def metadata(self): return Metadata.get_object(self['state'])<|fim_prefix|># repo: msabramo/...
code_fim
hard
{ "lang": "python", "repo": "msabramo/billy", "path": "/billy/models/committees.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: msabramo/billy path: /billy/models/committees.py from .base import (db, Document, RelatedDocument, RelatedDocuments, ListManager, DEBUG, logger) from .metadata import Metadata class CommitteeMember(dict): legislator_object = RelatedDocument('Legislator', instance_key='leg...
code_fim
hard
{ "lang": "python", "repo": "msabramo/billy", "path": "/billy/models/committees.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Committee(Document): collection = db.committees feed_entries = RelatedDocuments('FeedEntry', model_keys=['entity_ids']) members_objects = CommitteeMemberManager() def display_name(self): try: return self['committee'] except KeyError: try: ...
code_fim
hard
{ "lang": "python", "repo": "msabramo/billy", "path": "/billy/models/committees.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Given two weights a, b computes a coefficient about how equal they are: 1.0 : Totally equal 0.0 : Totally different The coefficient does not depend on (a + b) and is computed using the following formula 1 - (np.abs(a - b) / (a + b)) This function is often used li...
code_fim
hard
{ "lang": "python", "repo": "ulikoehler/UliEngineering", "path": "/UliEngineering/SignalProcessing/Weight.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> _schema_translator = { 'dav': 'http', 'davs': 'https', } _logger.debug( "[%s]Validating URN schema: %s", self.id, self.uri['scheme'] ) if self.uri['scheme'] in _schema_translator: _logger.deb...
code_fim
hard
{ "lang": "python", "repo": "hep-gc/dynafed_storagestats", "path": "/dynafed_storagestats/dav/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hep-gc/dynafed_storagestats path: /dynafed_storagestats/dav/base.py """Defines DAV's StorageShare sub-class.""" import logging import dynafed_storagestats.base import dynafed_storagestats.dav.helpers as davhelpers #################### # Module Variables # #################### # Creating logg...
code_fim
hard
{ "lang": "python", "repo": "hep-gc/dynafed_storagestats", "path": "/dynafed_storagestats/dav/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AndrewWoodcock/Leetcode_Problems path: /7. Reverse Integer.py def reverse(x: int) -> int: <|fim_suffix|> print(reverse(1534236469)) print(reverse(-123))<|fim_middle|> if x > 0: out = int(str(x)[::-1]) else: out = -int(str(abs(x))[::-1]) if (out <= -2147483647) or (out...
code_fim
medium
{ "lang": "python", "repo": "AndrewWoodcock/Leetcode_Problems", "path": "/7. Reverse Integer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(reverse(1534236469)) print(reverse(-123))<|fim_prefix|># repo: AndrewWoodcock/Leetcode_Problems path: /7. Reverse Integer.py def reverse(x: int) -> int: <|fim_middle|> if x > 0: out = int(str(x)[::-1]) else: out = -int(str(abs(x))[::-1]) if (out <= -2147483647) or (out ...
code_fim
medium
{ "lang": "python", "repo": "AndrewWoodcock/Leetcode_Problems", "path": "/7. Reverse Integer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (out <= -2147483647) or (out >= 2147483647): return 0 else: return out print(reverse(1534236469)) print(reverse(-123))<|fim_prefix|># repo: AndrewWoodcock/Leetcode_Problems path: /7. Reverse Integer.py def reverse(x: int) -> int: <|fim_middle|> if x > 0: out = int...
code_fim
medium
{ "lang": "python", "repo": "AndrewWoodcock/Leetcode_Problems", "path": "/7. Reverse Integer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 模板url template_url = 'https://careers.tencent.com/tencentcareer/api/post/Query?timestamp=1614616268558&countryId=&cityId=&bgIds=&productId=&categoryId=&parentCategoryId=&attrId=&keyword=&pageIndex={}&pageSize=10&language=zh-cn&area=cn' # 请求的url地址 request_url = response.re...
code_fim
medium
{ "lang": "python", "repo": "wafer133/test_20210118", "path": "/tencent/tencent/spiders/hr.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wafer133/test_20210118 path: /tencent/tencent/spiders/hr.py # -*- coding: utf-8 -*- import scrapy import json import re class HrSpider(scrapy.Spider): name = 'hr' allowed_domains = ['tencent.com'] start_urls = ['https://careers.tencent.com/tencentcareer/api/post/Query?timestamp=1614...
code_fim
medium
{ "lang": "python", "repo": "wafer133/test_20210118", "path": "/tencent/tencent/spiders/hr.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @abc.abstractmethod def next(self, current: Token | None) -> Token: ... @property def stream(self, current: Token | None = None): while True: yield (current := self.next(current))<|fim_prefix|># repo: MentalBlood/Marasmatic path: /marasmatic/Base.py import abc import typing import pydantic im...
code_fim
hard
{ "lang": "python", "repo": "MentalBlood/Marasmatic", "path": "/marasmatic/Base.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> source : Input | None = None def __post_init__(self): if self.source: for previous, current in itertools.pairwise(self.source.stream): if current is not None: self <<= Pair(previous, current) @abc.abstractmethod def __ilshift__(self, p: Pair) -> typing.Self: ... @abc.abstractmetho...
code_fim
medium
{ "lang": "python", "repo": "MentalBlood/Marasmatic", "path": "/marasmatic/Base.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MentalBlood/Marasmatic path: /marasmatic/Base.py import abc import typing import pydantic import itertools from .Pair import Pair from .Input import Input from .Token import Token @pydantic.dataclasses.dataclass(frozen = True, kw_only = False) class Base(metaclass = abc.ABCMeta): <|fi...
code_fim
hard
{ "lang": "python", "repo": "MentalBlood/Marasmatic", "path": "/marasmatic/Base.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): super(SeahorseTestCase, self).setUp() self.db = get_db_conn_synchronous() self.app = self.get_app() create_users() def tearDown(self): super(SeahorseTestCase, self).tearDown() delete_users() self.db.close() def get_app...
code_fim
medium
{ "lang": "python", "repo": "iepathos/seahorse", "path": "/tests/seahorse_tests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_app(self): if not hasattr(self, 'db'): self.db = get_db_conn_synchronous() app = make_app(self.db, test_conf) return app def assertGetReturns200(self, url): self.http_client.fetch(self.get_url(url), self.stop) response = self.wait() ...
code_fim
medium
{ "lang": "python", "repo": "iepathos/seahorse", "path": "/tests/seahorse_tests.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: iepathos/seahorse path: /tests/seahorse_tests.py # -*- coding: utf-8 -*- from seahorse.mind import make_app from seahorse.db import get_db_conn_synchronous from tornado.testing import AsyncHTTPTestCase from tests.mock_data import test_conf, create_users, delete_users <|fim_suffix|> if no...
code_fim
hard
{ "lang": "python", "repo": "iepathos/seahorse", "path": "/tests/seahorse_tests.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if str(other).isnumeric(): return Vector([val * other for val in self]) elif self.__isconformant(self, other): return sum([self[i] * other[i] for i in range(len(self))]) else: raise Exception def __eq__(self, other): if str(other).is...
code_fim
hard
{ "lang": "python", "repo": "DmitryDankov207/python-labs", "path": "/lr2/vector/vector.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DmitryDankov207/python-labs path: /lr2/vector/vector.py from math import sqrt class Vector: def __init__(self, data): self.__data = data def __get__(self): return self.__data def __set__(self, val): if not str(val).isnumeric(): raise Exception ...
code_fim
hard
{ "lang": "python", "repo": "DmitryDankov207/python-labs", "path": "/lr2/vector/vector.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def length(self): return sqrt(sum([val * val for val in self])) __isconformant = lambda self, x, y: True if len(x) == len(y) else False if __name__ == '__main__': vect1 = Vector([1, 2, 3, 4]) print('vect1: ', vect1) vect1[0] = 8 print('changed vect1[0]: ', vect1[0]) ...
code_fim
hard
{ "lang": "python", "repo": "DmitryDankov207/python-labs", "path": "/lr2/vector/vector.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SergeyAbdorin/Pixel_counting path: /pixel/backend/migrations/0001_initial.py # Generated by Django 3.2.7 on 2021-09-10 09:02 from django.db import migrations, models <|fim_suffix|> initial = True dependencies = [ ] operations = [ migrations.CreateModel( na...
code_fim
hard
{ "lang": "python", "repo": "SergeyAbdorin/Pixel_counting", "path": "/pixel/backend/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Images', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('image', models.ImageField(upload_to='images/')), ('uplo...
code_fim
hard
{ "lang": "python", "repo": "SergeyAbdorin/Pixel_counting", "path": "/pixel/backend/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='Images', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('image', models.ImageField(upload_to='images...
code_fim
hard
{ "lang": "python", "repo": "SergeyAbdorin/Pixel_counting", "path": "/pixel/backend/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DLu/ros_computer_monitor path: /ros_hard_drive/scripts/ros_hard_drive #!/usr/bin/python import rospy from ros_hard_drive.df import df from ros_computer_msgs.msg import Drive, HardDrives <|fim_suffix|> rospy.init_node('ros_hard_drive') self.pub = rospy.Publisher('/hard_drive_space...
code_fim
medium
{ "lang": "python", "repo": "DLu/ros_computer_monitor", "path": "/ros_hard_drive/scripts/ros_hard_drive", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> rospy.init_node('ros_hard_drive') self.pub = rospy.Publisher('/hard_drive_space', HardDrives, queue_size=1) self.drives = rospy.get_param('~drives', []) freq = rospy.get_param('~frequency', 1.0) self.timer = rospy.Timer(rospy.Duration(1.0/freq), self.publish) d...
code_fim
medium
{ "lang": "python", "repo": "DLu/ros_computer_monitor", "path": "/ros_hard_drive/scripts/ros_hard_drive", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: azizcruz/simple_real_time_chat_app_django path: /chat_app/views.py from django.shortcuts import render from django.http import HttpResponseRedirect from django.urls import reverse <|fim_suffix|># Handle Entering the Chatroom. def chatroom(request): if request.method != 'POST': return...
code_fim
medium
{ "lang": "python", "repo": "azizcruz/simple_real_time_chat_app_django", "path": "/chat_app/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Handle Entering the Chatroom. def chatroom(request): if request.method != 'POST': return HttpResponseRedirect(reverse('index')) else: context = { 'title': 'Chat Room', 'username': request.POST.get('username'), } return render(request, 'cha...
code_fim
medium
{ "lang": "python", "repo": "azizcruz/simple_real_time_chat_app_django", "path": "/chat_app/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> _TRUNCATE.__init__(self) self.name = "TRUNCATING" self.specie = 'verbs' self.basic = "truncate" self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_truncating.py from xai.brain.wordbase.verbs._truncate import _TRUNCATE #calss header class _TRUNCATING(_TRUNCA...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_truncating.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_truncating.py from xai.brain.wordbase.verbs._truncate import _TRUNCATE #calss header class _TRUNCATING(_TRUNCATE, ): <|fim_suffix|> _TRUNCATE.__init__(self) self.name = "TRUNCATING" self.specie = 'verbs' self.basic = "truncate" self.jsonda...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_truncating.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eddieatkinson/Python101 path: /python101.py # print "Hello, World" # print("Hello, World") # print """ # Triple quotes # are here # to # stay! # """ # name = "Eddie Atkinson" #This is a string # # Data types # # strings - English stuff, for people to read. # # numbers - something with digits ...
code_fim
hard
{ "lang": "python", "repo": "eddieatkinson/Python101", "path": "/python101.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>classSize = 19; question = "How big is your class?"; response = raw_input("> ") # Remember, raw input is always collected as a string response_as_an_int = int(response) if(response_as_an_int != classSize): print "You must not be in the Sept class." else: print "You're with me!"<|fim_prefix|># repo: eddi...
code_fim
hard
{ "lang": "python", "repo": "eddieatkinson/Python101", "path": "/python101.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> global energyConsumption global lastTime global accel global timestep throttle = 0 brake = 0 timestep+=1 if(speed<speedlimit[0]-3 and timestep%2==0): accel *=1.1 throttle =min(50,accel) trL = False msSpeed = speed*KMH_TO_MS print(msSpeed,trafficLight[2],trafficLight[0]) if (trafficLight[1]...
code_fim
medium
{ "lang": "python", "repo": "david-westreicher/catalysts2014", "path": "/autonomouscar/lvl5.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: david-westreicher/catalysts2014 path: /autonomouscar/lvl5.py import socket import time as t import math KMH_TO_MS = 1000.0/3600.0 def readData(): speed = sf.readline().strip().split() speed = float(speed[1]) distance = sf.readline().strip().split() distance = float(distance[1]) time = sf.r...
code_fim
hard
{ "lang": "python", "repo": "david-westreicher/catalysts2014", "path": "/autonomouscar/lvl5.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("127.0.0.1", 7000)) sf = s.makefile() while(True): speed, distance, time,speedlimit,trafficLight = readData() print(speed, distance, time,speedlimit,trafficLight) #update sf.readline() throttle,brake = move(speed, distance, time,speedli...
code_fim
hard
{ "lang": "python", "repo": "david-westreicher/catalysts2014", "path": "/autonomouscar/lvl5.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Touche-Design/tactio-software path: /visualization/ParseThread.py from PyQt5 import QtWidgets, QtCore, Qt, QtGui import numpy as np import serial import traceback import sys from PyTactio import SerialProcessor, SerialStatus ''' Defines the signals available from a running worker thread. Suppor...
code_fim
hard
{ "lang": "python", "repo": "Touche-Design/tactio-software", "path": "/visualization/ParseThread.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>''' class WorkerSignals(QtCore.QObject): finished = QtCore.pyqtSignal() error = QtCore.pyqtSignal(tuple) gridData = QtCore.pyqtSignal(tuple) sensorList = QtCore.pyqtSignal(list) ''' Parser thread Inherits from QRunnable to handler worker thread setup, signals and wrap-up. Calls the pars...
code_fim
medium
{ "lang": "python", "repo": "Touche-Design/tactio-software", "path": "/visualization/ParseThread.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Silentsoul04/tg20hack path: /web/bobby/src/solve.py #!/usr/bin/env python3 import sys import requests def post_data(endpoint, text): with requests.post(endpoint, data = text) as r: return r.text def run_test(): <|fim_suffix|> if len(base_endpoint) == 0: print(sys.argv[0] ...
code_fim
medium
{ "lang": "python", "repo": "Silentsoul04/tg20hack", "path": "/web/bobby/src/solve.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if len(sys.argv) == 1: base_endpoint = "https://bobby.tghack.no" elif len(sys.argv) == 2: base_endpoint = sys.argv[1].rstrip("/") if len(base_endpoint) == 0: print(sys.argv[0] + " <endpoint>") else: with requests.Session() as s: s.get(base_endpo...
code_fim
medium
{ "lang": "python", "repo": "Silentsoul04/tg20hack", "path": "/web/bobby/src/solve.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> logger.info("[thegroove360.italiafilmvideohd] fichas") itemlist = [] data = httptools.downloadpage(item.url, headers=headers).data patron = '<a class="poster" href="([^"]+)" title="(.*?)">\s*' patron += '<img src="([^"]+)" alt=".*?" />' matches = re.compile(patron, re.DOTALL).fi...
code_fim
hard
{ "lang": "python", "repo": "TheGridRepo/channels", "path": "/channels/italiafilmvideohd.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> data = scrapertools.cache_page(urlparse.urljoin(url, mir_url), headers=headers).replace('\n', '') for media_label, media_url in re.compile(patron_media).findall(data): urls.append(url_decode(media_url)) itemlist = servertools.find_video_items(d...
code_fim
hard
{ "lang": "python", "repo": "TheGridRepo/channels", "path": "/channels/italiafilmvideohd.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheGridRepo/channels path: /channels/italiafilmvideohd.py ------------------------------------------------------------ # TheGroove360 / XBMC Plugin # Canal para italiafilmvideohd # ------------------------------------------------------------ import base64 import re import urlparse from core imp...
code_fim
hard
{ "lang": "python", "repo": "TheGridRepo/channels", "path": "/channels/italiafilmvideohd.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>md = Misaka(fenced_code=True) md.init_app(app) if __name__ == '__main__': app.run(debug=True)<|fim_prefix|># repo: drmcarvalho/cyberiablog path: /app.py from flask import Flask from flask_misaka import Misaka from artigo import artigo from admin_artigo import admin_artigo from autenticacao import au...
code_fim
hard
{ "lang": "python", "repo": "drmcarvalho/cyberiablog", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: drmcarvalho/cyberiablog path: /app.py from flask import Flask from flask_misaka import Misaka from artigo import artigo from admin_artigo import admin_artigo from autenticacao import autenticacao from dotenv import load_dotenv import os <|fim_suffix|>app = Flask(__name__) app.secret_key = os.env...
code_fim
medium
{ "lang": "python", "repo": "drmcarvalho/cyberiablog", "path": "/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kasterma/raft path: /machine.py from collections import defaultdict from dataclasses import dataclass from typing import Union @dataclass class Command: id: str # uuid identifying the command key: str val: Union[None, int] # None means look up <|fim_suffix|> def __init__(self...
code_fim
medium
{ "lang": "python", "repo": "kasterma/raft", "path": "/machine.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """check if cmd has already been executed, then return its value, otherwise return None""" return self.cmds.get(cmd.id)<|fim_prefix|># repo: kasterma/raft path: /machine.py from collections import defaultdict from dataclasses import dataclass from typing import Union @dataclass class Co...
code_fim
hard
{ "lang": "python", "repo": "kasterma/raft", "path": "/machine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): self.state = defaultdict(int) self.cmds = {} # map from cmd uuid to result def execute(self, cmd: Command) -> int: """commands have int results; note that if cmd has already been executed return earlier result""" try: return self.cm...
code_fim
medium
{ "lang": "python", "repo": "kasterma/raft", "path": "/machine.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': f = open('/Users/zfeng/Downloads/D-small-attempt0.in') lines = f.readlines() f.close() for i in xrange(int(lines[0])): print str.format('Case #{0}: {1}', i + 1, solver(lines[i + 1]))<|fim_prefix|># repo: DaHuO/Supergraph path: /codes/BuildLinks1.10/test...
code_fim
medium
{ "lang": "python", "repo": "DaHuO/Supergraph", "path": "/codes/BuildLinks1.10/test_input/CJ/16_0_4_chinawork_q4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DaHuO/Supergraph path: /codes/BuildLinks1.10/test_input/CJ/16_0_4_chinawork_q4.py __author__ = 'zfeng' def solver(line): d = [int(i) for i in line.strip().split()] k, c, s = d[0], d[1], d[2] res = '' <|fim_suffix|> l = 1 for i in xrange(k): res += str(l) + ' ' ...
code_fim
easy
{ "lang": "python", "repo": "DaHuO/Supergraph", "path": "/codes/BuildLinks1.10/test_input/CJ/16_0_4_chinawork_q4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> __depends__ = ['deltapy.commander', 'deltapy.security']<|fim_prefix|># repo: hamed1361554/sportmagazine-server path: /src/deltapy/request_processor/multiprocess/__init__.py ''' Created on Feb 2, 2010 @author: Abi.Mohammadi & Majid.Vesal ''' from deltapy.packaging.package import ...
code_fim
medium
{ "lang": "python", "repo": "hamed1361554/sportmagazine-server", "path": "/src/deltapy/request_processor/multiprocess/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hamed1361554/sportmagazine-server path: /src/deltapy/request_processor/multiprocess/__init__.py ''' Created on Feb 2, 2010 @author: Abi.Mohammadi & Majid.Vesal ''' from deltapy.packaging.package import Package MULTI_PROCESS_REQUEST_PROCESSOR = 'deltapy.request_processor.multi_process' class M...
code_fim
medium
{ "lang": "python", "repo": "hamed1361554/sportmagazine-server", "path": "/src/deltapy/request_processor/multiprocess/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # database query was voor 48 schutters # voor kleinere klassen moeten we minder reservisten tonen if deelnemer.rank <= 2*limiet: sporter = deelnemer.sporterboog.sporter ver = deelnemer.bij_vereniging ver_str = str(ver) ...
code_fim
hard
{ "lang": "python", "repo": "RamonvdW/nhb-apps", "path": "/CompLaagRayon/view_indiv_rko.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_suffix|> wkl2limiet = dict() # [pk] = aantal for limiet in (KampioenschapIndivKlasseLimiet .objects .select_related('indiv_klasse') .filter(kampioenschap=deelkamp)): wkl2limiet[limiet.indiv_klasse.pk] = limiet.limie...
code_fim
hard
{ "lang": "python", "repo": "RamonvdW/nhb-apps", "path": "/CompLaagRayon/view_indiv_rko.py", "mode": "spm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_prefix|># repo: RamonvdW/nhb-apps path: /CompLaagRayon/view_indiv_rko.py # -*- coding: utf-8 -*- # Copyright (c) 2019-2023 Ramon van der Winkel. # All rights reserved. # Licensed under BSD-3-Clause-Clear. See LICENSE file for details. from django.urls import reverse from django.http import HttpResponse, Htt...
code_fim
hard
{ "lang": "python", "repo": "RamonvdW/nhb-apps", "path": "/CompLaagRayon/view_indiv_rko.py", "mode": "psm", "license": "BSD-3-Clause-Clear", "source": "the-stack-v2" }
<|fim_prefix|># repo: AsphaltWindows/chessai path: /py_src/models/km_c.py from ctypes import * kmlib = CDLL("models/libkmodes.so") create_kmodes = kmlib.create_kmodes create_kmodes.restype = c_void_p km_train_batch = kmlib.train_batch km_train_batch.restype = None assign_cluster = kmlib.assign_cluster assign_clust...
code_fim
hard
{ "lang": "python", "repo": "AsphaltWindows/chessai", "path": "/py_src/models/km_c.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def model_from_vals(model_vals): cat_num = model_vals[0] cluster_num = model_vals[1] categories = model_vals[2:2+cat_num] model = KM_C([], cluster_num, categories) free_kmodes(model.kmodes) ValsArray = c_uint32 * len(model_vals) ...
code_fim
hard
{ "lang": "python", "repo": "AsphaltWindows/chessai", "path": "/py_src/models/km_c.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> free_kmodes(self.kmodes) @staticmethod def model_from_vals(model_vals): cat_num = model_vals[0] cluster_num = model_vals[1] categories = model_vals[2:2+cat_num] model = KM_C([], cluster_num, categories) free_kmodes(model.kmodes) ValsArray = ...
code_fim
hard
{ "lang": "python", "repo": "AsphaltWindows/chessai", "path": "/py_src/models/km_c.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevin-meyers/tweet-generator path: /Code/lib/stretch_challenges/reverse.py import sys def reverse_word(word): <|fim_suffix|>if __name__ == '__main__': inputs = sys.argv[1:] print(reverse_word(' '.join(inputs)))<|fim_middle|> return word[::-1]
code_fim
easy
{ "lang": "python", "repo": "kevin-meyers/tweet-generator", "path": "/Code/lib/stretch_challenges/reverse.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': inputs = sys.argv[1:] print(reverse_word(' '.join(inputs)))<|fim_prefix|># repo: kevin-meyers/tweet-generator path: /Code/lib/stretch_challenges/reverse.py import sys def reverse_word(word): <|fim_middle|> return word[::-1]
code_fim
easy
{ "lang": "python", "repo": "kevin-meyers/tweet-generator", "path": "/Code/lib/stretch_challenges/reverse.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': inputs = sys.argv[1:] print(reverse_word(' '.join(inputs)))<|fim_prefix|># repo: kevin-meyers/tweet-generator path: /Code/lib/stretch_challenges/reverse.py import sys def reverse_word(word): <|fim_middle|> return word[::-1]
code_fim
easy
{ "lang": "python", "repo": "kevin-meyers/tweet-generator", "path": "/Code/lib/stretch_challenges/reverse.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Create a reference to the cities collection cities_ref = db.collection(u'Products').stream() for doc in cities_ref: #print(f'{doc.id} => {doc.to_dict()}') doc_dict = doc.to_dict() prod_name = doc_dict.get('product_name') prod_name_lc = prod_name.lower() lower_case_name = doc_dict.g...
code_fim
medium
{ "lang": "python", "repo": "felipezxkq/Pudu_helpers", "path": "/add_lower_case_field.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: felipezxkq/Pudu_helpers path: /add_lower_case_field.py import firebase_admin from firebase_admin import credentials from firebase_admin import firestore import timeit # Use a service account cred = credentials.Certificate('service-account.json') firebase_admin.initialize_app(cred) <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "felipezxkq/Pudu_helpers", "path": "/add_lower_case_field.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if lower_case_name is None: db.collection(u'Products').document(doc.id).update({"product_name_lc" : prod_name_lc}) print("Updated "+prod_name+" to "+prod_name_lc)<|fim_prefix|># repo: felipezxkq/Pudu_helpers path: /add_lower_case_field.py import firebase_admin from firebase_admin impo...
code_fim
hard
{ "lang": "python", "repo": "felipezxkq/Pudu_helpers", "path": "/add_lower_case_field.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: RIMEL-UCA/RIMEL-UCA.github.io path: /chapters/2023/Qualité logicielle dans les notebooks Jupyter/assets/python-scripts/0005_get_vol_surface.py #!/usr/bin/env python # coding: utf-8 # Examples require an initialized GsSession and relevant entitlements. External clients need to substitute thier ow...
code_fim
hard
{ "lang": "python", "repo": "RIMEL-UCA/RIMEL-UCA.github.io", "path": "/chapters/2023/Qualité logicielle dans les notebooks Jupyter/assets/python-scripts/0005_get_vol_surface.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> with open(f'SPX_{snap_time}_curve.csv', 'w') as f: df.to_csv(f) # Above process can be abstracted to a function # In[6]: def get_latest_vol_surface(dataset, bbid, strike_reference='delta', intraday=False): # Get the date/time of the most recent snap as_of = dt.datetime.now() if intraday e...
code_fim
hard
{ "lang": "python", "repo": "RIMEL-UCA/RIMEL-UCA.github.io", "path": "/chapters/2023/Qualité logicielle dans les notebooks Jupyter/assets/python-scripts/0005_get_vol_surface.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: andreabruera/novel_aficionados path: /scripts/count_model.py ### EXAMPLE: python3 -m scripts.count_model --input_type wiki_${window} --filedir /mnt/cimec-storage-sata/users/andrea.bruera/wikiextractor/wiki_for_bert/wiki_clean_for_count.txt --window_size ${window} import logging import numpy impo...
code_fim
hard
{ "lang": "python", "repo": "andreabruera/novel_aficionados", "path": "/scripts/count_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>training_parts = Corpus(args.filedir) word_cooccurrences, current_output_folder = initialize_count_model(args) if args.load_files: logging.info('Loading the vocabulary from file') vocabulary_file =open('{}/count_{}_vocabulary_trimmed.pickle'.format(current_output_folder, args.input_type), 'rb')...
code_fim
hard
{ "lang": "python", "repo": "andreabruera/novel_aficionados", "path": "/scripts/count_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WangYihang/CrackMe path: /templates/keygen.py #!/usr/bin/env python # encoding:utf-8 import sys def check_password(username, password): <|fim_suffix|>def get_password(username): password = "" print password def show_help(): print "Usage : \n\tpython %s [username]" % sys....
code_fim
hard
{ "lang": "python", "repo": "WangYihang/CrackMe", "path": "/templates/keygen.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def show_help(): print "Usage : \n\tpython %s [username]" % sys.argv[0] def main(): # if len(sys.argv) != 2: # show_help() # exit(1) # get_password(sys.argv[1]) check_password("admin", "123456") if __name__ == "__main__": main()<|fim_prefix|># repo: Wan...
code_fim
medium
{ "lang": "python", "repo": "WangYihang/CrackMe", "path": "/templates/keygen.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: LingChenBill/lc_pandas path: /ch01/7_columns_operation.py #! /usr/bin/python3 # -*- coding:utf-8 -*- # @Time: 2020/6/13 # @Author: Lingchen # @Prescription: 创建、删除列 import pandas as pd movie = pd.read_csv('../data/movie.csv') movie['has_seen'] = 0 print(movie.columns) <|fim_suffix|># 创建新列 movie[...
code_fim
hard
{ "lang": "python", "repo": "LingChenBill/lc_pandas", "path": "/ch01/7_columns_operation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 用insert()方法原地插入列 # 获取列索引 profit_index = movie.columns.get_loc('gross') + 1 print(profit_index) movie.insert(loc=profit_index, column='profit', value=movie['gross'] - movie['budget']) print(movie.head()) print(movie['profit'].head()) # print(movie)<|fim_prefix|># repo: LingChen...
code_fim
hard
{ "lang": "python", "repo": "LingChenBill/lc_pandas", "path": "/ch01/7_columns_operation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shivam-walia/spyproject2 path: /objective2.py # objective Plot user instrests using matplotlib pie chart <|fim_suffix|> #opens the file caption.txt file=open("caption.txt",'r') text=file.read() read=re.sub(r'...
code_fim
medium
{ "lang": "python", "repo": "Shivam-walia/spyproject2", "path": "/objective2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fig1, ax1 = plt.subplots() ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True, startangle=90) ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle. plt.show()<|fim_prefix|># repo: Shivam-walia/spyproject2 ...
code_fim
hard
{ "lang": "python", "repo": "Shivam-walia/spyproject2", "path": "/objective2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RenameModel( old_name='Expands', new_name='Expenses', ), ]<|fim_prefix|># repo: majid-ir/test-majid path: /web/migrations/0002_auto_20181004_2223.py # Generated by Django 2.1.1 on 2018-10-04 18:53 <|fim_middle|>from django.conf im...
code_fim
hard
{ "lang": "python", "repo": "majid-ir/test-majid", "path": "/web/migrations/0002_auto_20181004_2223.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: majid-ir/test-majid path: /web/migrations/0002_auto_20181004_2223.py # Generated by Django 2.1.1 on 2018-10-04 18:53 from django.conf import settings from django.db import migrations class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.RenameModel( ...
code_fim
medium
{ "lang": "python", "repo": "majid-ir/test-majid", "path": "/web/migrations/0002_auto_20181004_2223.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }