text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: tcquinn/daily-message path: /message_database.py
import pandas as pd
import boto3
import s3fs
import json
import random
import os
class MessageDatabaseCSV:
def next_message(self):
message_list_df = self.get_dataframe()
print('Successfully retrieved message database')
... | code_fim | hard | {
"lang": "python",
"repo": "tcquinn/daily-message",
"path": "/message_database.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muhammadaqibawaan/btr-project path: /btre_main/contact_app/urls.py
from django.urls import path
from . import views
<|fim_suffix|>urlpatterns = [
path('contacts/', views.contact_view,name='contact_view'),
]<|fim_middle|>app_name = 'contact_app'
| code_fim | easy | {
"lang": "python",
"repo": "muhammadaqibawaan/btr-project",
"path": "/btre_main/contact_app/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('contacts/', views.contact_view,name='contact_view'),
]<|fim_prefix|># repo: muhammadaqibawaan/btr-project path: /btre_main/contact_app/urls.py
from django.urls import path
from . import views
<|fim_middle|>app_name = 'contact_app'
| code_fim | easy | {
"lang": "python",
"repo": "muhammadaqibawaan/btr-project",
"path": "/btre_main/contact_app/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akcj/django-blog-cms path: /articles/admin.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from articles.models import Article,Category,Tag
from users.models import User
from img.upload import delete_image_to_qiniu
from django.db.models.signals... | code_fim | hard | {
"lang": "python",
"repo": "akcj/django-blog-cms",
"path": "/articles/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> url = 'media/' + str(instance.img)
delete_image_to_qiniu(url)
post_delete.connect(delete_file,sender=Article)
#超级用户则展示全部,非超级用户只展示和登录用户相关的信息
def get_queryset(self,request):
qs = super(ArticleAdmin,self).get_queryset(request)
if request.user.is_superuser:
... | code_fim | hard | {
"lang": "python",
"repo": "akcj/django-blog-cms",
"path": "/articles/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> publish(connection, channel, 'album_tracks', album)
publish(connection, channel, 'album_genres', album)
print('[*] Requeueing done {len(albums_ids)} in {round(time.time() - time_start, 2)} s')
except KeyboardInterrupt :
connection.close()
sys.exit(0)<|f... | code_fim | hard | {
"lang": "python",
"repo": "Abderrahman-byte/music-app",
"path": "/scripts/requeue_all_albums.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Abderrahman-byte/music-app path: /scripts/requeue_all_albums.py
import time, sys
from tracks.models import Album
from .main import connect_to_broker
from .get_artist_albums import sleepWithHeartbeats
from .requeue_all_artists import publish
def run() :
<|fim_suffix|> publish(connect... | code_fim | hard | {
"lang": "python",
"repo": "Abderrahman-byte/music-app",
"path": "/scripts/requeue_all_albums.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for count, album in enumerate(albums_ids):
if count % 5000 == 0 :
print(f'[*] delivered {count} in {round(time.time() - time_start, 2)} s')
sleepWithHeartbeats(connection, 300)
elif count % 500 == 0 :
print(f'[*] delivered {co... | code_fim | hard | {
"lang": "python",
"repo": "Abderrahman-byte/music-app",
"path": "/scripts/requeue_all_albums.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
repeated_message = [
"P + 2 l ! a t o",
"1 e 8 0 R $ 4 u",
"5 - r ] + a > /",
"P x w l b 3 k \\",
"2 e 3 5 R 8 y u",
"< ! r ^ ( ) k 0",
]
decrypted_message = decrypt_message(repeated_message)
print(decrypted_messa... | code_fim | hard | {
"lang": "python",
"repo": "choroba/perlweeklychallenge-club",
"path": "/challenge-046/lubos-kolouch/python/ch-1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: choroba/perlweeklychallenge-club path: /challenge-046/lubos-kolouch/python/ch-1.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Counter
def decrypt_message(lines: [str]) -> str:
<|fim_suffix|> Returns:
str: The decrypted message.
"""
message_length =... | code_fim | medium | {
"lang": "python",
"repo": "choroba/perlweeklychallenge-club",
"path": "/challenge-046/lubos-kolouch/python/ch-1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
repeated_message = [
"P + 2 l ! a t o",
"1 e 8 0 R $ 4 u",
"5 - r ] + a > /",
"P x w l b 3 k \\",
"2 e 3 5 R 8 y u",
"< ! r ^ ( ) k 0",
]
decrypted_message = decrypt_message(repeated_message)
print(decrypted_messag... | code_fim | hard | {
"lang": "python",
"repo": "choroba/perlweeklychallenge-club",
"path": "/challenge-046/lubos-kolouch/python/ch-1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hugo-W/Imperial-festival path: /Testing stream-realtime plot and keyEvents/mouseMotionStreamplotly.py
from Tkinter import *
import tkMessageBox
#import time
import plotly.plotly as py
import plotly.tools as tls
from plotly.graph_objs import *
class MainLoop:
def __init__(self, master,stream... | code_fim | hard | {
"lang": "python",
"repo": "Hugo-W/Imperial-festival",
"path": "/Testing stream-realtime plot and keyEvents/mouseMotionStreamplotly.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Make data object made up of the 2 scatter objs
data = Data([trace1])
# Define dictionary of axis style options
axis_style = dict(
showgrid=False, # remove grid
showline=False, # remove axes lines
zeroline=False # remove x=0 and y=0 lines
)
... | code_fim | hard | {
"lang": "python",
"repo": "Hugo-W/Imperial-festival",
"path": "/Testing stream-realtime plot and keyEvents/mouseMotionStreamplotly.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crowdbotics-apps/web-app-27346 path: /home/migrations/0002_app_plan_subscription.py
# Generated by Django 2.2.20 on 2021-05-24 22:45
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = ... | code_fim | hard | {
"lang": "python",
"repo": "crowdbotics-apps/web-app-27346",
"path": "/home/migrations/0002_app_plan_subscription.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> },
),
migrations.CreateModel(
name='Plan',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=20, verbose_name='Name')),
(... | code_fim | hard | {
"lang": "python",
"repo": "crowdbotics-apps/web-app-27346",
"path": "/home/migrations/0002_app_plan_subscription.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sander76/aio_wx_widgets path: /tests/widgets/test_all_widgets.py
import importlib
import inspect
import logging
import sys
from pathlib import Path
from unittest.mock import Mock
import pytest
from aio_wx_widgets import widgets
logging.basicConfig(level=logging.DEBUG)
_LOGGER = logging.getLogg... | code_fim | hard | {
"lang": "python",
"repo": "sander76/aio_wx_widgets",
"path": "/tests/widgets/test_all_widgets.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> kwargs = {}
if name == "AioButton":
kwargs["label"] = "a label"
kwargs["callback"] = Mock()
elif name == "Group":
kwargs["label"] = "grouplabel"
elif name == "Entry":
kwargs["binding"] = Mock()
... | code_fim | hard | {
"lang": "python",
"repo": "sander76/aio_wx_widgets",
"path": "/tests/widgets/test_all_widgets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LaSalleIT/SMAmanager path: /config.py
import json
class ConfigObject(object):
def __init__(self, version, type, redis, http):
self.version = version
self.type = type
self.redis = redis
self.http = http
@property.getter
def get_http_properties(self)... | code_fim | hard | {
"lang": "python",
"repo": "LaSalleIT/SMAmanager",
"path": "/config.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # checks
try:
if parsed["version"] is None:
raise AttributeError("version")
if parsed["type"] is None:
raise AttributeError("type")
if parsed["redis"]["port"] is None:
raise... | code_fim | hard | {
"lang": "python",
"repo": "LaSalleIT/SMAmanager",
"path": "/config.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def feature_correlation(x, y):
n = range(len(x))
x_avg = sum(x) / len(x)
y_avg = sum(y) / len(y)
cov = sum([(x[i] - x_avg) * (y[i] - y_avg) for i in n])
x_dev = math.sqrt(sum([(x[i] - x_avg) ** 2 for i in n]))
y_dev = math.sqrt(sum([(y[i] - y_avg) ** 2 f... | code_fim | medium | {
"lang": "python",
"repo": "vladimercury/DataAnalysisNew",
"path": "/feature_selection/pearson.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vladimercury/DataAnalysisNew path: /feature_selection/pearson.py
def pearson(data, labels, dumped=False):
import numpy as np
import util.dump as dump
import math
import warnings
import scipy.stats as stats
warnings.filterwarnings('ignore')
def get_features(data_set):
... | code_fim | medium | {
"lang": "python",
"repo": "vladimercury/DataAnalysisNew",
"path": "/feature_selection/pearson.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> from util.frame import progress
print('Pearson: computing corellation coefficients:')
feat_len = len(x)
result = []
for i in range(feat_len):
result.append(feature_correlation(x[i], y))
if i % 10 == 0:
progress((i + 1) / feat_... | code_fim | hard | {
"lang": "python",
"repo": "vladimercury/DataAnalysisNew",
"path": "/feature_selection/pearson.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>use('ggplot')
iris = datasets.load_iris()<|fim_prefix|># repo: jmacenka/python-unordered_scripts path: /20180618_Sklearn_v00.py
import sklearn
from sklearn import dataset<|fim_middle|>s
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style. | code_fim | medium | {
"lang": "python",
"repo": "jmacenka/python-unordered_scripts",
"path": "/20180618_Sklearn_v00.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmacenka/python-unordered_scripts path: /20180618_Sklearn_v00.py
import sklearn
from sklearn import datasets
import pandas as pd
import numpy as np
<|fim_suffix|>use('ggplot')
iris = datasets.load_iris()<|fim_middle|>import matplotlib.pyplot as plt
plt.style. | code_fim | easy | {
"lang": "python",
"repo": "jmacenka/python-unordered_scripts",
"path": "/20180618_Sklearn_v00.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return wrapper
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--srcdir', default='D:\\Projects\\Project-IGI1\\game\\')
parser.set_defaults(func=print_help(parser))
subpar = parser.add_subparsers()
extnum = subpar.add_parser('extnum', help='Count files by extension')
extnum.s... | code_fim | medium | {
"lang": "python",
"repo": "NEWME0/Project-IGI1",
"path": "/tools/fsys/__main__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NEWME0/Project-IGI1 path: /tools/fsys/__main__.py
import os
import argparse
from collections import defaultdict
def extnum_func(args):
dataset = defaultdict(lambda:0)
<|fim_suffix|>
def print_help(parser):
def wrapper(args):
parser.print_help()
return wrapper
def main():
parser = argp... | code_fim | hard | {
"lang": "python",
"repo": "NEWME0/Project-IGI1",
"path": "/tools/fsys/__main__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
parser = argparse.ArgumentParser()
parser.add_argument('--srcdir', default='D:\\Projects\\Project-IGI1\\game\\')
parser.set_defaults(func=print_help(parser))
subpar = parser.add_subparsers()
extnum = subpar.add_parser('extnum', help='Count files by extension')
extnum.set_defaults(func=e... | code_fim | medium | {
"lang": "python",
"repo": "NEWME0/Project-IGI1",
"path": "/tools/fsys/__main__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ACHerrick/Aggregator-submission path: /island_of_misfit_code/tripadvisor_scrape.py
# Scrapes Tripadvisor restaurant page for data
'''
Code in this file scrapes all of the desired information (name, rating, price, address,
city, state, zipcode, country, phone #) on Tripadvisor. We did not use thi... | code_fim | hard | {
"lang": "python",
"repo": "ACHerrick/Aggregator-submission",
"path": "/island_of_misfit_code/tripadvisor_scrape.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> phone_tag = soup.find_all('div', class_ = "fl phoneNumber")
phone = phone_tag[0].text
phone = re.findall("[0-9-]{12}", phone)
phone = phone[0].replace("-", "")
# returns in form 3126671701
restaurant_info = {
"name": name,
"rating": rating,
"price": price
"cuisine"... | code_fim | hard | {
"lang": "python",
"repo": "ACHerrick/Aggregator-submission",
"path": "/island_of_misfit_code/tripadvisor_scrape.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/add_car', methods=['GET', 'POST'])
def add_car():
form= AddCarForm()
if form.submit():
db.create_all()
car = Car(user_id=form.user_id.data, car_vin=form.car_vin.data)
db.session.add(car)
db.session.commit()
flash('Congratulations, you registered... | code_fim | medium | {
"lang": "python",
"repo": "Sguthrie16/CUS1166_-sguthrie16-_git-test",
"path": "/Add_car/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> form= AddCarForm()
if form.submit():
db.create_all()
car = Car(user_id=form.user_id.data, car_vin=form.car_vin.data)
db.session.add(car)
db.session.commit()
flash('Congratulations, you registered a car!')
return render_template('add_car.html', title='Add... | code_fim | medium | {
"lang": "python",
"repo": "Sguthrie16/CUS1166_-sguthrie16-_git-test",
"path": "/Add_car/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sguthrie16/CUS1166_-sguthrie16-_git-test path: /Add_car/app.py
from flask import Flask, render_template
from config import Config
from forms import *
from models import *
from flask_sqlalchemy import SQLAlchemy
<|fim_suffix|>@app.route('/add_car', methods=['GET', 'POST'])
def add_car():
form... | code_fim | medium | {
"lang": "python",
"repo": "Sguthrie16/CUS1166_-sguthrie16-_git-test",
"path": "/Add_car/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MingshengCai1997/Siamese-RPN-tensorflow path: /module/pic_to_vedio.py
import sys
sys.path.append('./')
import os
import numpy as np
import cv2
from config import cfg
from utils.image_reader_forward import Image_reader
class Pic_vedio():
def __init__(self):
<|fim_suffix|> pre_box=[50.,5... | code_fim | medium | {
"lang": "python",
"repo": "MingshengCai1997/Siamese-RPN-tensorflow",
"path": "/module/pic_to_vedio.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pre_box=[50.,50.,50.,50.]
for step in range(self.reader.img_num):
img,box_ori,img_p,box_p,offset,ratio=self.reader.get_data(frame_n=step,pre_box=pre_box)
if step==0:
fourcc=cv2.VideoWriter_fourcc('M','J','P','G')
img_h,img_w,_=img.sha... | code_fim | hard | {
"lang": "python",
"repo": "MingshengCai1997/Siamese-RPN-tensorflow",
"path": "/module/pic_to_vedio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iLecus/learn-python path: /normalize_map.py
def normalize(name):
name = name.lower()
<|fim_suffix|>= ''.join(l)
return s
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)<|fim_middle|> l = list(name)
l[0] = l[0].upper()
s | code_fim | easy | {
"lang": "python",
"repo": "iLecus/learn-python",
"path": "/normalize_map.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>= ''.join(l)
return s
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)<|fim_prefix|># repo: iLecus/learn-python path: /normalize_map.py
def normalize(name):
name = name.lower()
<|fim_middle|> l = list(name)
l[0] = l[0].upper()
s | code_fim | easy | {
"lang": "python",
"repo": "iLecus/learn-python",
"path": "/normalize_map.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> points = []
for fn in filenames:
inFile = File(fn, mode="r")
results = spatial.las_within(inFile, poly["rings"], ["x", "y", "z"], True)
points += results
return js.dumps({"params": ["x", "y", "z"], "points": points})
def get_stats_by_geom(filename, poly):
inFile =... | code_fim | medium | {
"lang": "python",
"repo": "mbrc27/lasREST",
"path": "/las_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbrc27/lasREST path: /las_manager.py
import json as js, spatial, os, numpy as np
from laspy.file import File
#start_time = time.time()
#print("--- %s seconds ---" % (time.time() - start_time))
def get_header(filename):
inFile = File(filename, mode="r")
header = spatial.las_header(inFil... | code_fim | hard | {
"lang": "python",
"repo": "mbrc27/lasREST",
"path": "/las_manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_stats_by_geom_mfn(filenames, poly):
points = []
for fn in filenames:
inFile = File(fn, mode="r")
results = spatial.get_stats_by_geom(inFile, poly["rings"], ["z"], True)
points += results
return js.dumps({"params": ["z"], "points": points})<|fim_prefix|># repo: m... | code_fim | hard | {
"lang": "python",
"repo": "mbrc27/lasREST",
"path": "/las_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('primary_docs', '0028_auto_20181002_1312'),
]
operations = [
migrations.AddField(
model_name='worktimetable',
name='hours',
field=models.DecimalField(decimal_places=2, max_digits=10, null=True, verbose_name='Всего часов'),... | code_fim | medium | {
"lang": "python",
"repo": "Uther88/ForestCRM-backend",
"path": "/primary_docs/migrations/0029_auto_20181004_1415.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='worktimetable',
name='hours',
field=models.DecimalField(decimal_places=2, max_digits=10, null=True, verbose_name='Всего часов'),
),
migrations.AlterField(
model_name='worktimetable',... | code_fim | medium | {
"lang": "python",
"repo": "Uther88/ForestCRM-backend",
"path": "/primary_docs/migrations/0029_auto_20181004_1415.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Uther88/ForestCRM-backend path: /primary_docs/migrations/0029_auto_20181004_1415.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-04 14:15
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.time... | code_fim | medium | {
"lang": "python",
"repo": "Uther88/ForestCRM-backend",
"path": "/primary_docs/migrations/0029_auto_20181004_1415.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: enthought/sandia-data-archive path: /sdafile/file_inserter.py
import numpy as np
from .record_inserter import inserter
from .numeric_inserter import ArrayInserter as NumericArrayInserter
from .utils import set_encoded
<|fim_suffix|> """
record_type = 'file'
def record_dataset_attr... | code_fim | medium | {
"lang": "python",
"repo": "enthought/sandia-data-archive",
"path": "/sdafile/file_inserter.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def can_insert(data):
""" Can insert file-like objects. """
return hasattr(data, 'read')
def prepare_data(self):
contents = self.data.read()
if not isinstance(contents, bytes):
contents = contents.encode('ascii')
self.data = np... | code_fim | hard | {
"lang": "python",
"repo": "enthought/sandia-data-archive",
"path": "/sdafile/file_inserter.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> record_type = 'file'
def record_dataset_attributes(self, dict_like):
attrs = dict(
RecordType='numeric',
Empty=self.empty,
Complex='no',
Sparse='no',
)
set_encoded(dict_like, **attrs)
@staticmethod
def can_insert(dat... | code_fim | medium | {
"lang": "python",
"repo": "enthought/sandia-data-archive",
"path": "/sdafile/file_inserter.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jometa/beasiswa path: /app/__init__.py
import os
from flask import Flask, render_template, session, redirect
def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='124sdsd'
)
if test_config is None:
... | code_fim | medium | {
"lang": "python",
"repo": "jometa/beasiswa",
"path": "/app/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> @app.route('/hello')
def hello():
return 'Hello, World!'
@app.route('/')
def index():
if session.get('user_id', None) is not None:
return redirect('/app/data')
return render_template('index.html')
return app<|fim_prefix|># repo: jometa/beasiswa pa... | code_fim | medium | {
"lang": "python",
"repo": "jometa/beasiswa",
"path": "/app/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ScrapperItem(scrapy.Item):
link = scrapy.Field()
address = scrapy.Field()
description = scrapy.Field()
image_url = scrapy.Field()
owner_name = scrapy.Field()
owner_contact = scrapy.Field()
active_search = scrapy.Field()
pass<|fim_prefix|># repo: wangda8791/realestate... | code_fim | easy | {
"lang": "python",
"repo": "wangda8791/realestate",
"path": "/scrapper/scrapper/items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangda8791/realestate path: /scrapper/scrapper/items.py
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
<|fim_suffix|>class ScrapperItem(scrapy.Item):
link = scrapy.Field()
address = ... | code_fim | easy | {
"lang": "python",
"repo": "wangda8791/realestate",
"path": "/scrapper/scrapper/items.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> link = scrapy.Field()
address = scrapy.Field()
description = scrapy.Field()
image_url = scrapy.Field()
owner_name = scrapy.Field()
owner_contact = scrapy.Field()
active_search = scrapy.Field()
pass<|fim_prefix|># repo: wangda8791/realestate path: /scrapper/scrapper/items.p... | code_fim | easy | {
"lang": "python",
"repo": "wangda8791/realestate",
"path": "/scrapper/scrapper/items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> answer = gameOptions['yes']
result = 0
print("Let's play!!!")
while answer == (gameOptions['yes']) :
(playerAHand, playerBHand) = playerChoises(playerA,playerB,playerOptions)
result = playGame(playerAHand, playerBHand, playerOptions)
if result == 1 :
p... | code_fim | hard | {
"lang": "python",
"repo": "depaulo/PythonPractice",
"path": "/python practice/8-RockPaperScissors.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> _answer = input("Do you want to play again?\n Answer y for YES or n for NO.\n")
return _answer
def main() :
playerAHand = None
playerBHand = None
playerA = ''
playerB = ''
playerOptions = {'paper' : 'pp', 'stone' : 'st', 'scissors' : 'sc'}
gameOptions = {'yes' : 'y', 'n... | code_fim | hard | {
"lang": "python",
"repo": "depaulo/PythonPractice",
"path": "/python practice/8-RockPaperScissors.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: depaulo/PythonPractice path: /python practice/8-RockPaperScissors.py
def playerChoises(playerA, playerB, playerOptions) :
while True :
playerAHand = input(
playerA + " what is your option? \ntype pp for paper, st for stone or sc for scissors\n")
if playerAHand == p... | code_fim | hard | {
"lang": "python",
"repo": "depaulo/PythonPractice",
"path": "/python practice/8-RockPaperScissors.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user',
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
sa.Column('username', mysql.VARCHAR(length=64), nullable=True),
sa.Column('email', mysql.VARCHAR... | code_fim | hard | {
"lang": "python",
"repo": "jjjkakagiggs/madblog",
"path": "/back-end/migrations/versions/bff64a27bc9b_add_posts_table.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jjjkakagiggs/madblog path: /back-end/migrations/versions/bff64a27bc9b_add_posts_table.py
"""add posts table
Revision ID: bff64a27bc9b
Revises: 4783cd3d66c8
Create Date: 2020-09-27 14:35:46.031402
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revisio... | code_fim | medium | {
"lang": "python",
"repo": "jjjkakagiggs/madblog",
"path": "/back-end/migrations/versions/bff64a27bc9b_add_posts_table.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aivaras-ciurlionis/meteo path: /src/app.py
from flask import Flask, request
from src.measuring.postProcessMeasuring import PostProcessMeasuring
from src.prediction.predictionWrapper import PredictionWrapper
from src.utilities.errorFunctions import imagesMeanSquareError
from src.utilities.errorF... | code_fim | medium | {
"lang": "python",
"repo": "aivaras-ciurlionis/meteo",
"path": "/src/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> files = request.args.getlist('files')
error_fun = request.args['error']
measuring = PostProcessMeasuring().set_files(files)
if error_fun == 'mse':
measuring.set_error_function(imagesMeanSquareError.ImagesMeanSquareError())
if error_fun == 'hk':
measuring.set_error_func... | code_fim | hard | {
"lang": "python",
"repo": "aivaras-ciurlionis/meteo",
"path": "/src/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TilenBerlak/PythonProgramming path: /5. Hrček_na_kolesu(vse v eni).py
#Hrček na kolesu
#Obvezna naloga------------------------------------------------------
def v_seznam(s):
if s != "":
s = s.split("; ")
i = 0
while i < len(s):
s[i] = s[i].replac... | code_fim | hard | {
"lang": "python",
"repo": "TilenBerlak/PythonProgramming",
"path": "/5. Hrček_na_kolesu(vse v eni).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> t = [205.134, 205.182, 205.190, 205.207,
250.13, 250.83, 251.6,
308.412, 308.416]
self.assertIsNone(odstrani_neveljavne(t))
self.assertEqual(t, [250.13, 250.83, 251.6])
t = [5.18, 5.907, 6.632, 7.215,
132.3, 132.94,
... | code_fim | hard | {
"lang": "python",
"repo": "TilenBerlak/PythonProgramming",
"path": "/5. Hrček_na_kolesu(vse v eni).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertSequenceEqual(oznaci_veljavne([
5.18, 5.907, 6.632, 7.215,
132.3, 132.94,
183.12,
205.134, 205.182, 205.190, 205.207,
308.412, 308.416,
512.73, 513.20, 513.65,
918.2, 918.73]),
[True] * 4... | code_fim | hard | {
"lang": "python",
"repo": "TilenBerlak/PythonProgramming",
"path": "/5. Hrček_na_kolesu(vse v eni).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dazzul94/python_basic path: /20190921/openPdf4.py
import PyPDF2
minutesFile = open('pdf/meetingminutes.pdf','rb')
pdfReader = PyPDF2.PdfFileReader(minutesFile)
<|fim_suffix|>pdfWriter.write(resultPdfFile)
resultPdfFile.close()<|fim_middle|># 90도 회전
page = pdfReader.getPage(0)
# page.rotateClock... | code_fim | hard | {
"lang": "python",
"repo": "dazzul94/python_basic",
"path": "/20190921/openPdf4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># resultPdfFile = open('rotate1.pdf', 'wb')
resultPdfFile = open('rotate2.pdf', 'wb')
pdfWriter.write(resultPdfFile)
resultPdfFile.close()<|fim_prefix|># repo: dazzul94/python_basic path: /20190921/openPdf4.py
import PyPDF2
minutesFile = open('pdf/meetingminutes.pdf','rb')
pdfReader = PyPDF2.PdfFileRea... | code_fim | medium | {
"lang": "python",
"repo": "dazzul94/python_basic",
"path": "/20190921/openPdf4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Vollmind/otus-L5 path: /httpd.py
import concurrent.futures
import logging
import mimetypes
import os
import socket
from datetime import datetime
from optparse import OptionParser
from urllib.parse import unquote
INDEX_PAGE = 'index.html'
def fill_file_info(path, need_body):
file_stat = os.... | code_fim | hard | {
"lang": "python",
"repo": "Vollmind/otus-L5",
"path": "/httpd.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def read_http_request(client_socket):
data = b''
partlen = 1024
while True:
part = client_socket.recv(partlen)
data += part
if b'\r\n\r\n' in data:
split = data.split(b'\r\n\r\n')
body = split[1]
request_splitted = split[0].decode().s... | code_fim | hard | {
"lang": "python",
"repo": "Vollmind/otus-L5",
"path": "/httpd.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Add base headers
headers.update({
'Connection': 'keep-alive',
'Server': 'Python socket'
})
response = f'{http} {code} {mnemonic}\r\n'
response += '\r\n'.join([f'{k}: {v}' for k, v in headers.items()])
response += '\r\n\r\n'
return response.encode() + body
de... | code_fim | hard | {
"lang": "python",
"repo": "Vollmind/otus-L5",
"path": "/httpd.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Retrieve the note and checks user access to the note
:param context: the request context
:param note_id: the id of the note to retrieve.
:returns: the note
"""
try:
note = notes_helper.get_note(note_id)
note_type = notes_helper.ge... | code_fim | hard | {
"lang": "python",
"repo": "airshipit/shipyard",
"path": "/src/bin/shipyard_airflow/shipyard_airflow/control/notes/notedetails_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'redirect_inscription' in request.session:
try:
redirect_inscription = request.session['redirect_inscription']
del request.session['redirect_inscription']
return HttpResponseRedirect( redirect_inscription )
except:
return HttpResponseRedirect( reverse('c2v:myc2v') )
else:
if mode==1... | code_fim | medium | {
"lang": "python",
"repo": "pitchmyjob/v1-pitchmyjob",
"path": "/myc2v/tools.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pitchmyjob/v1-pitchmyjob path: /myc2v/tools.py
# -*- coding: utf-8 -*-
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.core.urlresolvers import reverse
<|fim_suffix|> if 'redirect_inscription' in request.session:
try:
redirect_inscription = request.session['... | code_fim | medium | {
"lang": "python",
"repo": "pitchmyjob/v1-pitchmyjob",
"path": "/myc2v/tools.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: njaneto/dev-python path: /scripts_py/Cap_3/exec_8.py
#comprimento da escada
from math import sin
from math import pi
def main(): <|fim_suffix|>linação (graus): "))
angulo = (pi/180)*graus
comprimento = altura / sin(angulo)
print("O comprimento da escada ate a casa e: ", round(comprimen... | code_fim | medium | {
"lang": "python",
"repo": "njaneto/dev-python",
"path": "/scripts_py/Cap_3/exec_8.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>lo)
print("O comprimento da escada ate a casa e: ", round(comprimento))
main()<|fim_prefix|># repo: njaneto/dev-python path: /scripts_py/Cap_3/exec_8.py
#comprimento da escada
from math import sin
from math import pi
def main(): <|fim_middle|>
altura = eval(input("Digite a altura: "))
graus ... | code_fim | medium | {
"lang": "python",
"repo": "njaneto/dev-python",
"path": "/scripts_py/Cap_3/exec_8.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>linação (graus): "))
angulo = (pi/180)*graus
comprimento = altura / sin(angulo)
print("O comprimento da escada ate a casa e: ", round(comprimento))
main()<|fim_prefix|># repo: njaneto/dev-python path: /scripts_py/Cap_3/exec_8.py
#comprimento da escada
from math import sin
from math import pi
d... | code_fim | medium | {
"lang": "python",
"repo": "njaneto/dev-python",
"path": "/scripts_py/Cap_3/exec_8.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shivashankar101/PycharmProjects path: /automation/table_contents.py
from selenium import webdriver
browser = webdriver.Chrome(executable_path="/Users/shiv/desktop/drivers/chrome/chromedriver")
browser.get("https://en.wikipedia.org/wiki/List_of_state_and_union_territory_capitals_in_India")
browse... | code_fim | medium | {
"lang": "python",
"repo": "Shivashankar101/PycharmProjects",
"path": "/automation/table_contents.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f'this table has \n{row} rows, \n{cols} columns')
# col x_path : //*[@id="mw-content-text"]/div[1]/table[2]/thead/tr/th[3]
for r in range(2, row+1):
for c in range(1, cols+1):
value = browser.find_element_by_xpath("//*[@id='mw-content-text']/div[1]/table[2]/tbody/tr["+str(r)+"]/th["+st... | code_fim | hard | {
"lang": "python",
"repo": "Shivashankar101/PycharmProjects",
"path": "/automation/table_contents.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># col x_path : //*[@id="mw-content-text"]/div[1]/table[2]/thead/tr/th[3]
for r in range(2, row+1):
for c in range(1, cols+1):
value = browser.find_element_by_xpath("//*[@id='mw-content-text']/div[1]/table[2]/tbody/tr["+str(r)+"]/th["+str(c)+"]").text
print(value, end=" ")
print()... | code_fim | hard | {
"lang": "python",
"repo": "Shivashankar101/PycharmProjects",
"path": "/automation/table_contents.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coolpotato1/IDS_project path: /NSL_KDD_attack_types.py
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 3 19:11:13 2020
@author: Henning
"""
import enum
class attack_types(enum.Enum):
#Specific attacks
APACHE2 = ["apache2"]
BACK = ["back"]
BUFFER_OVERFLOW = ["buffer_overflo... | code_fim | hard | {
"lang": "python",
"repo": "coolpotato1/IDS_project",
"path": "/NSL_KDD_attack_types.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> U2R = ["buffer_overflow", "loadmodule", "rootkit", "perl", "xterm", "sqlattack", "ps"]
ALL_ATTACKS_BUT_DOS = PROBE + R2L + U2R
ALL_ATTACKS_BUT_PROBE = DOS + R2L + U2R
ALL_ATTACKS_BUT_R2L = DOS + PROBE + U2R
ALL_ATTACKS_BUT_U2R = DOS + PROBE + R2L
KDD_ATTACKS = DOS + PROBE... | code_fim | hard | {
"lang": "python",
"repo": "coolpotato1/IDS_project",
"path": "/NSL_KDD_attack_types.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PriontoAbdullah/Python-Programming-Practice path: /Chepter 05 ( List )/Advance Method in List.py
fruits=['apple',"banana","mango","apple",'guava','orange','jack-fruits']
print(fruits.count('apple'))
number=[2,9,4,7,0,1]
print(sorted(number)) # numbers are shorted in print but the list not sorted... | code_fim | medium | {
"lang": "python",
"repo": "PriontoAbdullah/Python-Programming-Practice",
"path": "/Chepter 05 ( List )/Advance Method in List.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print(number)
fruits_copy=fruits.copy() # copy a list into other list[\'';p=][]/">./"
print(fruits_copy)<|fim_prefix|># repo: PriontoAbdullah/Python-Programming-Practice path: /Chepter 05 ( List )/Advance Method in List.py
fruits=['apple',"banana","mango","apple",'guava','orange','jack-fruits']
print(fr... | code_fim | hard | {
"lang": "python",
"repo": "PriontoAbdullah/Python-Programming-Practice",
"path": "/Chepter 05 ( List )/Advance Method in List.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ArthurVianna/importacao-arquivo-teste path: /app/users/schemas.py
from datetime import date
from decimal import Decimal
# pylint might have a problem with this pydantic import
# add this exception in ".pylintrc" so pylint ignores imports from pydantic
# "--extension-pkg-whitelist=pydantic"
from ... | code_fim | medium | {
"lang": "python",
"repo": "ArthurVianna/importacao-arquivo-teste",
"path": "/app/users/schemas.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class UserCreate(UserBase):
pass
class User(UserBase):
id : int
private : bool
incomplete : bool
last_order_date : date = None
avg_ticket : Decimal = None
last_ticket : Decimal = None
most_frequent_store_cnpj : str = None
last_store_cnpj : str = None
class Confi... | code_fim | medium | {
"lang": "python",
"repo": "ArthurVianna/importacao-arquivo-teste",
"path": "/app/users/schemas.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RheingoldRiver/leaguepedia_archive path: /zelda_fix_module_names.py
from log_into_wiki import *
import re
site = login('me','zelda') # Set wiki
summary = 'Rename Modules' # Set summary
limit = 10<|fim_suffix|> p.text()
text_table = text.split('\n')
newlines = []
for line in text_table:
new... | code_fim | medium | {
"lang": "python",
"repo": "RheingoldRiver/leaguepedia_archive",
"path": "/zelda_fix_module_names.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>le:Utils(.+?)['\"] *\)", r"require('Module:\1Util')",line))
newtext = '\n'.join(newlines)
if text != newtext:
p.save(newtext)<|fim_prefix|># repo: RheingoldRiver/leaguepedia_archive path: /zelda_fix_module_names.py
from log_into_wiki import *
import re
site = login('me','zelda') # Set wiki
summary =... | code_fim | hard | {
"lang": "python",
"repo": "RheingoldRiver/leaguepedia_archive",
"path": "/zelda_fix_module_names.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Solution(object):
def searchRange(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
length = len(nums)
i, j = 0, length - 1
left = None
while i <= j:
mid = i + (j - i) // 2
... | code_fim | hard | {
"lang": "python",
"repo": "Aaron-Bird/leetcode",
"path": "/Python/034 Search for a Range.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aaron-Bird/leetcode path: /Python/034 Search for a Range.py
# Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.
# Your algorithm's runtime complexity must be in the order of O(log n).
# If the target is not found in the arr... | code_fim | hard | {
"lang": "python",
"repo": "Aaron-Bird/leetcode",
"path": "/Python/034 Search for a Range.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def searchRange(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[int]
"""
length = len(nums)
i, j = 0, length - 1
left = None
while i <= j:
mid = i + (j - i) // 2
if nums[mid] <... | code_fim | hard | {
"lang": "python",
"repo": "Aaron-Bird/leetcode",
"path": "/Python/034 Search for a Range.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.module.save(*args, **kwargs)
def train_batch(self, *args, **kwargs):
return self.module.train_batch(*args, **kwargs)
def eval_batch(self, *args, **kwargs):
return self.module.eval_batch(*args, **kwargs)<|fim_prefix|># repo: imperialite/info-theoretic-probing ... | code_fim | medium | {
"lang": "python",
"repo": "imperialite/info-theoretic-probing",
"path": "/src/h02_learn/model/data_parallel.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@status.command("past", help="info of past downlink(s).")
@click.argument("mission")
def past(mission):
show_downlink_status(mission_id=mission, timeline="previous")
@status.command("future", help="info of upcoming downlinks.")
@click.argument("mission")
def upcoming(mission):
show_downlink_sta... | code_fim | hard | {
"lang": "python",
"repo": "sakethramanujam/rover",
"path": "/rover/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@camera.command("ids", help="show camera instrment ids.")
@click.argument("mission")
def camids(mission):
get_cameras(mission_id=mission, what="ids")
@cli.group(help="download mission raw images/metadata.")
def download():
pass
@download.command("images", help="download images.")
@click.argume... | code_fim | hard | {
"lang": "python",
"repo": "sakethramanujam/rover",
"path": "/rover/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sakethramanujam/rover path: /rover/cli.py
import click
import os
from rover.rover.tools import n_pages
from .rover.main import show_missions, show_downlink_status, show_stats, get_cameras, downloader
@click.group()
def cli():
pass
@cli.command("missions", help="show list of active mission... | code_fim | hard | {
"lang": "python",
"repo": "sakethramanujam/rover",
"path": "/rover/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '#$sxqt-6%d*d95@7*=j%bg*-32(ic@lst#396=0f$54_4*++r3'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
CORS_ORIGIN_WHITELIST = (
'127.0.0.1:8000',
'localhost:8000',
... | code_fim | medium | {
"lang": "python",
"repo": "katharosada/bus-shaming",
"path": "/busshaming/conf/dev_settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: katharosada/bus-shaming path: /busshaming/conf/dev_settings.py
"""
Django settings for busshaming project.
Generated by 'django-admin startproject' using Django 1.9.7.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings an... | code_fim | hard | {
"lang": "python",
"repo": "katharosada/bus-shaming",
"path": "/busshaming/conf/dev_settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='BuyingTicket',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.IntegerField(default=0, help_text='수량')),
... | code_fim | medium | {
"lang": "python",
"repo": "ytshaha/my-first-blog",
"path": "/shop/migrations/0006_buyingticket.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ytshaha/my-first-blog path: /shop/migrations/0006_buyingticket.py
# Generated by Django 2.0.13 on 2021-01-26 17:32
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|> operations = [
migrations.CreateModel(
... | code_fim | medium | {
"lang": "python",
"repo": "ytshaha/my-first-blog",
"path": "/shop/migrations/0006_buyingticket.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: patrickfriedman/workloadsecurityapi path: /apiWorkloadSecurity.py
from __future__ import print_function
import sys, warnings
import deepsecurity
from deepsecurity.rest import ApiException
from playsound import playsound
from twilio.rest import Client
import csv
import time
# play a sound ... | code_fim | hard | {
"lang": "python",
"repo": "patrickfriedman/workloadsecurityapi",
"path": "/apiWorkloadSecurity.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if(flag == 1):
lists.append(name)
lists.append(platform)
lists.append(policyname)
lists.append(status)
sourceFile.close()
def list():
# Setup
if not sys.warnoptions:
warnings.simplefilter("ignore")
configuration = deepsecurity.Configuration()
configuration.host = 'https... | code_fim | hard | {
"lang": "python",
"repo": "patrickfriedman/workloadsecurityapi",
"path": "/apiWorkloadSecurity.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Authentication
configuration.api_key['api-secret-key'] = apikey
# Initialization
# Set Any Required Values
api_instance = deepsecurity.ComputersApi(deepsecurity.ApiClient(configuration))
api_version = 'v1'
expand_options = deepsecurity.Expand()
expand_options.add(expand_options.none)
... | code_fim | hard | {
"lang": "python",
"repo": "patrickfriedman/workloadsecurityapi",
"path": "/apiWorkloadSecurity.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='CaseGrades',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('club', models.TextField(blank=True, null=True, verbose_name='в каком к... | code_fim | hard | {
"lang": "python",
"repo": "stkudryashov/django-goodgame",
"path": "/goodgame/content/migrations/0009_auto_20210328_1958.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stkudryashov/django-goodgame path: /goodgame/content/migrations/0009_auto_20210328_1958.py
# Generated by Django 3.1.7 on 2021-03-28 19:58
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel(
... | code_fim | hard | {
"lang": "python",
"repo": "stkudryashov/django-goodgame",
"path": "/goodgame/content/migrations/0009_auto_20210328_1958.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ALaks96/MapReduce_Pyspark_Large_Matrix_Multiplication path: /MapReduce program 1/mapper_check.py
#!/usr/bin/python
import sys
# We assume we know the dimensions of the final matrix output (m row, n columns)
# Here we will set m and n for our matrix example where A is (2 x 3) and B is (3 x 2) so... | code_fim | hard | {
"lang": "python",
"repo": "ALaks96/MapReduce_Pyspark_Large_Matrix_Multiplication",
"path": "/MapReduce program 1/mapper_check.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(0, m + 1): # We add 1 so Python will replicate m times
print '%s\t%s' % ((i, col),(provenance, row, value))
# Printing last object!
#print '%s\t%s' % ((i, col),(provenance, row, value))
# Each element then goes through a sort&shuffle phase where key-value pai... | code_fim | hard | {
"lang": "python",
"repo": "ALaks96/MapReduce_Pyspark_Large_Matrix_Multiplication",
"path": "/MapReduce program 1/mapper_check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.