text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>tuple(x)
i=0
while i<len(y):
print y[i]
i+=1<|fim_prefix|># repo: Arunima123/SEM-6 path: /DS/lab2/q9.py
thistuple=(12, 7, 38, 56, 78 )
t=list(thistuple)
x=[]
i=0
while i<len(thistuple):
if thistup<|fim_middle|>le[i]%2==0:
x.append(thistuple[i])
i+=1
y= | code_fim | easy | {
"lang": "python",
"repo": "Arunima123/SEM-6",
"path": "/DS/lab2/q9.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arunima123/SEM-6 path: /DS/lab2/q9.py
thistuple=(12, 7, 38, 56, 78 )
t=list(thistuple)
x=[]
i=0
while i<len(thistuple):
if thistup<|fim_suffix|>tuple(x)
i=0
while i<len(y):
print y[i]
i+=1<|fim_middle|>le[i]%2==0:
x.append(thistuple[i])
i+=1
y= | code_fim | easy | {
"lang": "python",
"repo": "Arunima123/SEM-6",
"path": "/DS/lab2/q9.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 205c/HLDeliver path: /VTable.py
import MySQLdb
class VTable(object):
def __init__(self, host, user, pwd, db):
self.db = MySQLdb.connect(host=host,
user=user,
passwd=pwd,
db=db)
self.cur =... | code_fim | hard | {
"lang": "python",
"repo": "205c/HLDeliver",
"path": "/VTable.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# data is a list of tuples (row_number (0 indexed), col entry0, col entry 1, ...)
def loadTable(self, data):
for c in range(self.rows):
d = data[c]
self.cur.execute('INSERT INTO V VALUES ' + str(d))
self.db.commit()
# makes a default V table
... | code_fim | hard | {
"lang": "python",
"repo": "205c/HLDeliver",
"path": "/VTable.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mmkvdev/leetcode path: /Problems/BitWiseAndOfNumbersRange/Submissions/bitwiseAndOfNumbers.py
import math
class Solution:
<|fim_suffix|> if m == n:
return m
difference = n - m
msb = 1 << math.floor(math.log2(difference))
bits_to_remove = (msb << 1) - 1
... | code_fim | easy | {
"lang": "python",
"repo": "mmkvdev/leetcode",
"path": "/Problems/BitWiseAndOfNumbersRange/Submissions/bitwiseAndOfNumbers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if m == n:
return m
difference = n - m
msb = 1 << math.floor(math.log2(difference))
bits_to_remove = (msb << 1) - 1
return m & n & ~bits_to_remove<|fim_prefix|># repo: mmkvdev/leetcode path: /Problems/BitWiseAndOfNumbersRange/Submissions/bitwiseAndOfNumber... | code_fim | easy | {
"lang": "python",
"repo": "mmkvdev/leetcode",
"path": "/Problems/BitWiseAndOfNumbersRange/Submissions/bitwiseAndOfNumbers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> template_id = fields.Many2one('i2d.yml.template', string='Template')
partner_id = fields.Many2one('res.partner', string='Vendor',
domain=[('supplier', '=', True), ('is_company', '=', True)])
partner_vat = fields.Char(related='partner_id.vat', string='VAT of Ven... | code_fim | hard | {
"lang": "python",
"repo": "kumarinie/misc",
"path": "/i2d_yml_template_new/models/i2d_yml_template.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.ensure_one()
vals = {
'task_id': self.env.ref('i2d_yml_template_new.i2d_yml_template_task').id,
'file_type': 'export_external_location',
'datas_fname': self.name +'.yml',
'datas': b64encode(self.yml_content.encode('utf8')),
'... | code_fim | hard | {
"lang": "python",
"repo": "kumarinie/misc",
"path": "/i2d_yml_template_new/models/i2d_yml_template.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kumarinie/misc path: /i2d_yml_template_new/models/i2d_yml_template.py
# -*- coding: utf-8 -*-
# Copyright 2017 Willem Hulshof ((www.magnus.nl).)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from base64 import b64decode, b64encode
from odoo import models, fields, api
from odoo.... | code_fim | hard | {
"lang": "python",
"repo": "kumarinie/misc",
"path": "/i2d_yml_template_new/models/i2d_yml_template.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>< h):
r = 500.00
else:
r = 100.00
print("R$",round(r,2))<|fim_prefix|># repo: JosephLevinthal/Research-projects path: /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/3987/codes/1671_1879.py
# Ao testar sua solução, não se limite ao caso de e... | code_fim | easy | {
"lang": "python",
"repo": "JosephLevinthal/Research-projects",
"path": "/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/225/users/3987/codes/1671_1879.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joaquinipar/python_course path: /slice_test.py
a = ["hello","hola","bye bye","adios"]
<|fim_suffix|>#reverse string
word = "Hola"
new_word=word[::-1]
print(new_word)<|fim_middle|>b = a[0:4:2]
# list[start:end:step]
print(b)
| code_fim | easy | {
"lang": "python",
"repo": "joaquinipar/python_course",
"path": "/slice_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joaquinipar/python_course path: /slice_test.py
a = ["hello","hola","bye bye","adios"]
b = a[0:4:2]
# list[start:end:step]
print(b)
#reverse string
<|fim_suffix|>new_word=word[::-1]
print(new_word)<|fim_middle|>word = "Hola"
| code_fim | easy | {
"lang": "python",
"repo": "joaquinipar/python_course",
"path": "/slice_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>word = "Hola"
new_word=word[::-1]
print(new_word)<|fim_prefix|># repo: joaquinipar/python_course path: /slice_test.py
a = ["hello","hola","bye bye","adios"]
b = a[0:4:2]
# list[start:end:step]
print(b)
<|fim_middle|>#reverse string
| code_fim | easy | {
"lang": "python",
"repo": "joaquinipar/python_course",
"path": "/slice_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hectif/TheGame-Pygame- path: /morpion/morpion.py
#PALLIOT Willem
#Morpion inspiré, pas 100% personnel
#Import des bases
import time
import pygame
from pygame.locals import *
#Initialisation de pygame
pygame.init()
fenetre = pygame.display.set_mode((648,604), RESIZABLE)
depart = pygame.image.lo... | code_fim | hard | {
"lang": "python",
"repo": "hectif/TheGame-Pygame-",
"path": "/morpion/morpion.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fond = pygame.image.load("plateau2.png").convert()
fenetre.blit(fond, (0,0))
tcroix = pygame.image.load("tcroix.png").convert()
fenetre.blit(tcroix, (580,542))
pygame.display.flip()
background=[0,0,0,0,0,0,0,0,0]
croix=1
rond=2
player=croix
case=-1
while True:
utilisateur=True
... | code_fim | hard | {
"lang": "python",
"repo": "hectif/TheGame-Pygame-",
"path": "/morpion/morpion.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ImSoHappi/SniffingApi path: /blog/serializers.py
from .models import Cliente,Empleado,Orden,Usuario
from rest_framework import serializers
class ClienteSerializer( serializers.HyperlinkedModelSerializer ):
class Meta:
model= Cliente
fields = ( 'id', 'nombre', 'direccion', 'ci... | code_fim | medium | {
"lang": "python",
"repo": "ImSoHappi/SniffingApi",
"path": "/blog/serializers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class EmpleadoSerializer (serializers.HyperlinkedModelSerializer):
class Meta:
model= Empleado
fields = ('rut','nombre','telefono','correo','cliente')
class OrdenSerializer (serializers.HyperlinkedModelSerializer):
class Meta:
model= Orden
fields= ('folio','cliente... | code_fim | medium | {
"lang": "python",
"repo": "ImSoHappi/SniffingApi",
"path": "/blog/serializers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model= Orden
fields= ('folio','cliente','fecha','horainicio','horatermino','idascensor','modelo','fallas','reparaciones','piezas','trabajador')
class UsuarioSerializer (serializers.HyperlinkedModelSerializer):
class Meta:
model=Usuario
fields= ('usuario... | code_fim | hard | {
"lang": "python",
"repo": "ImSoHappi/SniffingApi",
"path": "/blog/serializers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akuntz09/theater path: /getFreq.py
import pickle
file = open('freq.txt', 'rb')
dict <|fim_suffix|>ict[split[1].lower()] = int(split[3])
#print dict['the']
pickle.dump(dict, open('wordFreq.p', 'wb'))<|fim_middle|>= {}
for line in file:
split = line.split('\t')
d | code_fim | easy | {
"lang": "python",
"repo": "akuntz09/theater",
"path": "/getFreq.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>['the']
pickle.dump(dict, open('wordFreq.p', 'wb'))<|fim_prefix|># repo: akuntz09/theater path: /getFreq.py
import pickle
file = open('freq.txt', 'rb')
dict = {}
for line in file:
split = line.split('\t')
d<|fim_middle|>ict[split[1].lower()] = int(split[3])
#print dict | code_fim | easy | {
"lang": "python",
"repo": "akuntz09/theater",
"path": "/getFreq.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Catboi347/python_homework path: /blog.py
from flask import Flask, flash, redirect, render_template, request, session, abort
from app import app
<|fim_suffix|> bar = {'username': 'Miguel','age': 23}
return render_template('blog_index.html', title='Home', foo=bar)
@app.route("/members/<str... | code_fim | medium | {
"lang": "python",
"repo": "Catboi347/python_homework",
"path": "/blog.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_template('member.html',member=name)
if __name__ == "__main__":
app.run()<|fim_prefix|># repo: Catboi347/python_homework path: /blog.py
from flask import Flask, flash, redirect, render_template, request, session, abort
from app import app
<|fim_middle|>app = Flask(__name__)
@app... | code_fim | hard | {
"lang": "python",
"repo": "Catboi347/python_homework",
"path": "/blog.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tintin305/GarminSleepAnalytics path: /ExtractData/meanValuesPieChart.py
#!/usr/bin/env python
import csv
import pandas as pd
import numpy as np
import sys, os
import matplotlib.pyplot as plt
import datetime
from datetime import timedelta
import matplotlib.pyplot as plt
import glob
import seaborn... | code_fim | hard | {
"lang": "python",
"repo": "tintin305/GarminSleepAnalytics",
"path": "/ExtractData/meanValuesPieChart.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO Determine what/if the DPI setting for this needs to be.
# TODO There is a warning on creating the postscript, that the backend doesn't support transparency.
# TODO Have the values for each of the part of the chart displayed on the chart.
labels = ['deepSleepSeconds','lightSleepSeco... | code_fim | medium | {
"lang": "python",
"repo": "tintin305/GarminSleepAnalytics",
"path": "/ExtractData/meanValuesPieChart.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bancaldo/gzt-scraper path: /players/views/core.py
import wx
import sys
from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin
from player import ViewPlayer
OK = wx.OK | wx.ICON_EXCLAMATION
ACV = wx.ALIGN_CENTER_VERTICAL
YN = wx.YES_NO | wx.ICON_WARNING
class AutoWidthListCtrl(wx.ListCtrl, ... | code_fim | hard | {
"lang": "python",
"repo": "bancaldo/gzt-scraper",
"path": "/players/views/core.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # noinspection PyUnusedLocal
def on_extract(self, event):
day = self.panel.day.GetValue()
if day:
if self.controller.are_evaluations_ready(day):
self.controller.extract_evaluations(day)
self.parent.Enable()
self.Destroy()
... | code_fim | hard | {
"lang": "python",
"repo": "bancaldo/gzt-scraper",
"path": "/players/views/core.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
on_size()
it redraws the gauge rectangle and repositions when frame windows is
resized
"""
size = self.GetSize()
self.SetSize(size)
gauge_pos, gauge_size = self.get_gauge_dimensions()
self.gauge.SetSize(gauge_size)
event.... | code_fim | hard | {
"lang": "python",
"repo": "bancaldo/gzt-scraper",
"path": "/players/views/core.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arielbendoy/python path: /Pets.py
Pets = ['Acey', 'Theodore', 'Fat-tail']
<|fim_suffix|>else:
print(name + ' is in list.')<|fim_middle|>print('Enter a pet name: ')
name = input()
if name not in Pets:
print('Pet name not in list.')
| code_fim | medium | {
"lang": "python",
"repo": "arielbendoy/python",
"path": "/Pets.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>else:
print(name + ' is in list.')<|fim_prefix|># repo: arielbendoy/python path: /Pets.py
Pets = ['Acey', 'Theodore', 'Fat-tail']
<|fim_middle|>print('Enter a pet name: ')
name = input()
if name not in Pets:
print('Pet name not in list.')
| code_fim | medium | {
"lang": "python",
"repo": "arielbendoy/python",
"path": "/Pets.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print ''
ms = Minesweeper(height, width, mines)
Minesweeper.print_table(ms.table_state)
# listen to commands by user.
while True:
command = raw_input("Command: ")
try:
if command == "exit":
break
elif 'd' == command[0]:
# open neighbour of selected coordin... | code_fim | hard | {
"lang": "python",
"repo": "causztic/digital-world",
"path": "/week5/minesweeper.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ms = Minesweeper(height, width, mines)
Minesweeper.print_table(ms.table_state)
# listen to commands by user.
while True:
command = raw_input("Command: ")
try:
if command == "exit":
break
elif 'd' == command[0]:
# open neighbour of selected coordinate if fla... | code_fim | hard | {
"lang": "python",
"repo": "causztic/digital-world",
"path": "/week5/minesweeper.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: causztic/digital-world path: /week5/minesweeper.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 20 11:15:50 2017
@author: yaojie
"""
import random
import sys
from copy import deepcopy
class Minesweeper(object):
# just for readability
WIN = True
IS_A_BOMB = ... | code_fim | hard | {
"lang": "python",
"repo": "causztic/digital-world",
"path": "/week5/minesweeper.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dataiku/dss-plugin-neo4j path: /tests/python/unit/test_export_nodes.py
from dku_neo4j.neo4j_handle import NodesExportParams
from mocking import MockNeo4jHandle, MockImportFileHandler, compare_queries
import pandas as pd
class TestNodesExport:
def setup_method(self):
self.recipe_conf... | code_fim | hard | {
"lang": "python",
"repo": "dataiku/dss-plugin-neo4j",
"path": "/tests/python/unit/test_export_nodes.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> df_iterator = self._create_dataframe_iterator()
with MockNeo4jHandle() as neo4jhandle:
neo4jhandle.insert_nodes_by_batch(df_iterator, self.dataset_schema, self.params)
assert len(neo4jhandle.queries) == len(df_iterator)
reference_query = """
WITH $data A... | code_fim | hard | {
"lang": "python",
"repo": "dataiku/dss-plugin-neo4j",
"path": "/tests/python/unit/test_export_nodes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_insert_nodes_by_batch(self):
df_iterator = self._create_dataframe_iterator()
with MockNeo4jHandle() as neo4jhandle:
neo4jhandle.insert_nodes_by_batch(df_iterator, self.dataset_schema, self.params)
assert len(neo4jhandle.queries) == len(df_iterator)
... | code_fim | hard | {
"lang": "python",
"repo": "dataiku/dss-plugin-neo4j",
"path": "/tests/python/unit/test_export_nodes.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IOLevi/holbertonschool-higher_level_programming path: /0x0F-python-object_relational_mapping/model_state.py
#!/usr/bin/python3
# contains the class definition of a State and an instance of Base
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
... | code_fim | easy | {
"lang": "python",
"repo": "IOLevi/holbertonschool-higher_level_programming",
"path": "/0x0F-python-object_relational_mapping/model_state.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> __tablename__ = 'states'
id = Column(
"id",
Integer,
primary_key=True,
nullable=False,
unique=True,
autoincrement=True)
name = Column("name", String(128), nullable=False)<|fim_prefix|># repo: IOLevi/holbertonschool-higher_level_programming path:... | code_fim | easy | {
"lang": "python",
"repo": "IOLevi/holbertonschool-higher_level_programming",
"path": "/0x0F-python-object_relational_mapping/model_state.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return_obj['language'] = infos[0].strip()
return_obj['pages'] = infos[1].strip()[0:(-1)*(len("pages")+1)]
if len(infos) >= 4:
return_obj['type'] = infos[2].strip()
index_to_use = 3
else:
return_obj['type'] = ''
index_to_use = 2
size = infos[ind... | code_fim | hard | {
"lang": "python",
"repo": "jcarlosadm/magparser",
"path": "/backend/mags.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jcarlosadm/magparser path: /backend/mags.py
from datetime import date, timedelta, datetime
from bs4 import BeautifulSoup
from utils import get_soup
DEFAULT_URL = "http://www.ebook3000.com/index_%s.htm"
MAX_PAGE = -1
def to_date(dateString):
if dateString is None or dateString == "":
... | code_fim | hard | {
"lang": "python",
"repo": "jcarlosadm/magparser",
"path": "/backend/mags.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YeoHoonYun/jiot-service path: /ha_device_control/device_subscrib_ha.py
import paho.mqtt.client as mqtt
import json, pprint
from device_rab_publish import rabbit_send
def on_connect(client, userdata, flags, rc):
print("Connected with result code " + str(rc))
client.subscribe(MQTT_PATH)
... | code_fim | hard | {
"lang": "python",
"repo": "YeoHoonYun/jiot-service",
"path": "/ha_device_control/device_subscrib_ha.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
MQTT_SERVER = "jiot.jiguem.com"
MQTT_PATH = "hasensor_message/#"
USER_NAME = "jiguem"
PWD = "jigeum!"
client = mqtt.Client()
client.username_pw_set(USER_NAME, PWD)
client.on_connect = on_connect
client.on_message = on_message
client.connect... | code_fim | medium | {
"lang": "python",
"repo": "YeoHoonYun/jiot-service",
"path": "/ha_device_control/device_subscrib_ha.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cnbillow/CBMooc path: /apps/courses/migrations/0002_auto_20180122_1057.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2018-01-22 10:57
from __future__ import unicode_literals
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('courses', '0001_initial'... | code_fim | easy | {
"lang": "python",
"repo": "cnbillow/CBMooc",
"path": "/apps/courses/migrations/0002_auto_20180122_1057.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='course',
name='degree',
field=models.SmallIntegerField(choices=[(0, '初级'), (1, '中级'), (2, '高级')], verbose_name='难度'),
),
]<|fim_prefix|># repo: cnbillow/CBMooc path: /apps/courses/migrations/0002... | code_fim | medium | {
"lang": "python",
"repo": "cnbillow/CBMooc",
"path": "/apps/courses/migrations/0002_auto_20180122_1057.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('courses', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='course',
name='degree',
field=models.SmallIntegerField(choices=[(0, '初级'), (1, '中级'), (2, '高级')], verbose_name='难度'),
),
]<|fim_pr... | code_fim | medium | {
"lang": "python",
"repo": "cnbillow/CBMooc",
"path": "/apps/courses/migrations/0002_auto_20180122_1057.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WuXunjin/LearnToPayAttention-Keras path: /normalizationtest.py
from keras.datasets import cifar10
from keras.datasets import cifar100
import numpy as np
from scipy import linalg
import matplotlib.pyplot as plt
from keras.preprocessing.image import ImageDataGenerator
<|fim_suffix|> x=x.astype... | code_fim | medium | {
"lang": "python",
"repo": "WuXunjin/LearnToPayAttention-Keras",
"path": "/normalizationtest.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> x=x.astype('float32')
g = ImageDataGenerator(featurewise_center=True,featurewise_std_normalization=True,zca_epsilon=1e-6,zca_whitening=True)
g.fit(x)
return g.standardize(x)
def show(i):
i = i.reshape((32,32,3))
m,M = i.min(), i.max()
plt.imshow((i - m) / (M - m))
plt.... | code_fim | medium | {
"lang": "python",
"repo": "WuXunjin/LearnToPayAttention-Keras",
"path": "/normalizationtest.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>plt.imshow(x10[6])
plt.show()
print("Pre-normalization")
X=normalizeDataset(x10)
print("Post-normalization")
plt.clf()
show(X[6])
plt.clf()
plt.imshow(X[6])
plt.show()
x10 = np.load("datasets/x10.npy")
plt.clf()
show(x10[6])<|fim_prefix|># repo: WuXunjin/LearnToPayAttention-Keras path: /normalizationtest... | code_fim | hard | {
"lang": "python",
"repo": "WuXunjin/LearnToPayAttention-Keras",
"path": "/normalizationtest.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidjrichardson/toucans path: /home/migrations/0029_auto_20190307_2153.py
# Generated by Django 2.1.7 on 2019-03-07 21:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0028_auto_20190307_1422'),
]
operations = ... | code_fim | hard | {
"lang": "python",
"repo": "davidjrichardson/toucans",
"path": "/home/migrations/0029_auto_20190307_2153.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ),
migrations.AlterField(
model_name='standingsentry',
name='leg_3_score',
field=models.IntegerField(blank=True, default=0),
),
migrations.AlterField(
model_name='standingsentry',
name='leg_4_golds',
fiel... | code_fim | hard | {
"lang": "python",
"repo": "davidjrichardson/toucans",
"path": "/home/migrations/0029_auto_20190307_2153.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># duration of the model in days
simulation_duration = 365
steps = int(simulation_duration // h)
# number of airport passengers per day
A_stock_cph = 4011.54
A_cph_oslo = 3936.22
A_oslo_stock = 3672.32
# list containing each city[name, population, initial number of infected]
cities = [City("Stockholm", ... | code_fim | hard | {
"lang": "python",
"repo": "ge0r/disease-spreading-sim",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ge0r/disease-spreading-sim path: /main.py
#! /usr/bin/env python2.7
import numpy as np
from my_methods import *
class City:
def __init__(self, name, population, infected, transport, emergency_policy):
self.name = name
self.population = population
self.infected = i... | code_fim | hard | {
"lang": "python",
"repo": "ge0r/disease-spreading-sim",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WJSNSeala/python_study path: /35.py
import random
name_list = []
<|fim_suffix|>while True:
cur_name = raw_input("Enter a name: ")
if cur_name == "":
break
else:
name_list.append(cur_name)<|fim_middle|>index = random.randrange(len(name_list))
print "The winner is... ... | code_fim | medium | {
"lang": "python",
"repo": "WJSNSeala/python_study",
"path": "/35.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
cur_name = raw_input("Enter a name: ")
if cur_name == "":
break
else:
name_list.append(cur_name)<|fim_prefix|># repo: WJSNSeala/python_study path: /35.py
import random
name_list = []
index = random.randrange(len(name_list))
<|fim_middle|>print "The winner is... ... | code_fim | easy | {
"lang": "python",
"repo": "WJSNSeala/python_study",
"path": "/35.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return all([util.find_spec(module_name) for module_name in module_names])<|fim_prefix|># repo: BhasherBEL/LDMv2 path: /api/requirement.py
import importlib
from importlib import util
def is_present(module_name: str) -> bool:
return util.find_spec(module_name) is not None
<|fim_middle|>def are_presen... | code_fim | easy | {
"lang": "python",
"repo": "BhasherBEL/LDMv2",
"path": "/api/requirement.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BhasherBEL/LDMv2 path: /api/requirement.py
import importlib
from importlib import util
<|fim_suffix|>def are_presents(module_names: list) -> bool:
return all([util.find_spec(module_name) for module_name in module_names])<|fim_middle|>
def is_present(module_name: str) -> bool:
return util.find_... | code_fim | medium | {
"lang": "python",
"repo": "BhasherBEL/LDMv2",
"path": "/api/requirement.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BhasherBEL/LDMv2 path: /api/requirement.py
import importlib
from importlib import util
<|fim_suffix|>def are_presents(module_names: list) -> bool:
return all([util.find_spec(module_name) for module_name in module_names])<|fim_middle|>def is_present(module_name: str) -> bool:
return util.find_... | code_fim | medium | {
"lang": "python",
"repo": "BhasherBEL/LDMv2",
"path": "/api/requirement.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return E, Ie, Ce, Eneto,
# Rendimiento motor, propulsor y motopropulsor:
def rendimiento_TB(Eneto, c, v9, v0, G0):
# Rendimiento motor:
eta_m = (Eneto * v0 + 0.5 * (G0 + c) * (v9 - v0) ** 2 - 0.5 * c * v0 ** 2) / (c * generador_gas.heating_value)
# Rendimiento propulsor:
eta_p = Enet... | code_fim | hard | {
"lang": "python",
"repo": "tfradar/entrega_turb",
"path": "/turborreactor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tfradar/entrega_turb path: /turborreactor.py
"""
# Se definen las partes del turborreactor
# Difusor, Tobera con su rendimiento
# Actuaciones del motor y rendimientos
"""
from air_model import RealGas
from isentropic_gas import IsentropicGas
import isa
air = RealGas(cp_option='naca', gamma_optio... | code_fim | hard | {
"lang": "python",
"repo": "tfradar/entrega_turb",
"path": "/turborreactor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kenbellows/lights-please-game path: /gamelib/charactersprite.py
import pygame
import action
import sceneobject
class CharacterSprite(sceneobject.SceneObject):
"""
This class represents any sprite directly controlled by user keyboard or mouse input.
Currently, it cont... | code_fim | hard | {
"lang": "python",
"repo": "kenbellows/lights-please-game",
"path": "/gamelib/charactersprite.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def handle(self, event):
"""
Handle user input events
"""
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
self.left()
self.state['ldown'] = True
''' Previous functionality if des... | code_fim | hard | {
"lang": "python",
"repo": "kenbellows/lights-please-game",
"path": "/gamelib/charactersprite.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>%2 ==0 :
print("*",end=" ")
else:
print("-",end="")
print()<|fim_prefix|># repo: JeevanMahesha/python_program path: /pratice_pattern/pattren_n_value_given_input.py
n = 3
for row in range(1,n+n):
for col in r<|fim_middle|>ange(1,n+n):
if col==n or row... | code_fim | easy | {
"lang": "python",
"repo": "JeevanMahesha/python_program",
"path": "/pratice_pattern/pattren_n_value_given_input.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
print("-",end="")
print()<|fim_prefix|># repo: JeevanMahesha/python_program path: /pratice_pattern/pattren_n_value_given_input.py
n = 3
for row in range(1,n+n):
for col in r<|fim_middle|>ange(1,n+n):
if col==n or row==n and col%2 ==0 :
print("*",end=" ... | code_fim | medium | {
"lang": "python",
"repo": "JeevanMahesha/python_program",
"path": "/pratice_pattern/pattren_n_value_given_input.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JeevanMahesha/python_program path: /pratice_pattern/pattren_n_value_given_input.py
n = 3
for row in range(1,n+n):
for col in range(1,n+n):
if col==n or row==n and col<|fim_suffix|> else:
print("-",end="")
print()<|fim_middle|>%2 ==0 :
print("*",end=" ... | code_fim | easy | {
"lang": "python",
"repo": "JeevanMahesha/python_program",
"path": "/pratice_pattern/pattren_n_value_given_input.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
conn = pymysql.connect(**db_config)
try:
while True :
n = input('请输入查询的页数:')
if n == 'q':
break
if n.isdigit():
sql_check(int(n),3)
else:
print("输入的不是数字!!!!")
except Exception as e :
print('执行过程中发生了异常',e)
conn.rollback()
fina... | code_fim | hard | {
"lang": "python",
"repo": "13528770807/Django",
"path": "/Pymysql/q01_pymysql.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # pan preview (if no ms preview)
if not os.path.isfile(os.path.join(dest_dir, 'prv_%02d.jpg' % (i+1))):
tmp = copy_file_matching_pathname('PREVIEW_*.JPG', os.path.dirname(f), dest_dir)
if tmp:
symlink_p(tmp, os.path.join(dest_dir, 'prv_%02d.jpg' % (i... | code_fim | hard | {
"lang": "python",
"repo": "huleg/ipol_demo",
"path": "/app/large_images/input/create_links.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huleg/ipol_demo path: /app/large_images/input/create_links.py
#!/usr/bin/env python
# This Python file uses the following encoding: utf-8
from __future__ import print_function
import subprocess
import shutil
import errno
import glob
import sys
import os
import re
import print_cfg
def mkdir_p(p... | code_fim | hard | {
"lang": "python",
"repo": "huleg/ipol_demo",
"path": "/app/large_images/input/create_links.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def objective(trial):
out = define_model(trial)
args = SimpleNamespace()
args.cuda = True
args.half = False
args.clip_grad_norm = False
args.log_every = 10
budget = 100
tbins = trial.suggest_discrete_uniform(1, 10)
batchsize = budget // tbins
trainer = DetTrainer(... | code_fim | hard | {
"lang": "python",
"repo": "etienne87/torch_object_rnn",
"path": "/hypertune_train_det.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def define_model(trial):
print('==> Building model..')
#fg_threshold = trial.suggest_discrete_uniform('fg_threshold', 0.5, 0.7, 0.1)
#bg_threshold = trial.suggest_discrete_uniform('bg_threshold', 0.3, 0.5, 0.1)
#allow_low_quality_matches = trial.suggest_categorical('allow_low_quality_match... | code_fim | hard | {
"lang": "python",
"repo": "etienne87/torch_object_rnn",
"path": "/hypertune_train_det.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: etienne87/torch_object_rnn path: /hypertune_train_det.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
from datasets.moving_mnist import make_mov... | code_fim | hard | {
"lang": "python",
"repo": "etienne87/torch_object_rnn",
"path": "/hypertune_train_det.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Hmmm. There should aways be some common base path."""
paths = [path for path, content in self._templates]
if len(paths) == 1:
return os.path.dirname(paths[0])
return common_path_prefix(paths)
_jst_script = 'var template = function(str){var fn = new Functio... | code_fim | hard | {
"lang": "python",
"repo": "nimnull/gaejstable",
"path": "/app/lib/webassets/filter/jst.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nimnull/gaejstable path: /app/lib/webassets/filter/jst.py
import os
import re
from webassets.filter import Filter
from webassets.utils import common_path_prefix
__all__ = ('JSTFilter',)
class JSTFilter(Filter):
"""`Jammit Style <http://documentcloud.github.com/jammit/#jst>`_ JavaScript
... | code_fim | hard | {
"lang": "python",
"repo": "nimnull/gaejstable",
"path": "/app/lib/webassets/filter/jst.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [
'__version__',
'AWS',
'Azure',
'GCP',
'IBM',
'Kubernetes',
'Lambda',
'Local',
'OCI',
'SCP',
'Optimizer',
'OptimizeTarget',
'backends',
'benchmark',
'list_accelerators',
'__root_dir__',
'Storage',
'StorageMode',
'StoreT... | code_fim | hard | {
"lang": "python",
"repo": "skypilot-org/skypilot",
"path": "/sky/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skypilot-org/skypilot path: /sky/__init__.py
"""The SkyPilot package."""
import os
# Replaced with the current commit when building the wheels.
__commit__ = '{{SKYPILOT_COMMIT_SHA}}'
__version__ = '1.0.0-dev0'
__root_dir__ = os.path.dirname(os.path.abspath(__file__))
# Keep this order to avoid ... | code_fim | hard | {
"lang": "python",
"repo": "skypilot-org/skypilot",
"path": "/sky/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> result,_ = self.ghost.evaluate(
"document.getElementById('%s').parentNode.getAttribute('class');" % selector)
if result == 'pagerlinkoff':
break
result,_ = self.ghost.evaluate(
"""
var element = document.querySelector('%s');
var evt = document.c... | code_fim | hard | {
"lang": "python",
"repo": "thayton/neekanee",
"path": "/neekanee/job_scrapers/neekanee/jobscrapers/taleo/gh.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_jobs = self.scrape_job_links(url)
print '# jobs: ', len(new_jobs)
for job_url in new_jobs:
self.ghost.open(job_url)
self.ghost.wait_for_page_loaded()
s = BeautifulSoup(self.ghost.content)
d = s.find('div', id='requisitionDescriptionInterface.descRequisitionContain... | code_fim | hard | {
"lang": "python",
"repo": "thayton/neekanee",
"path": "/neekanee/job_scrapers/neekanee/jobscrapers/taleo/gh.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thayton/neekanee path: /neekanee/job_scrapers/neekanee/jobscrapers/taleo/gh.py
import urlparse
from ghost import Ghost
from neekanee.jobscrapers.jobscraper import JobScraper
from neekanee.htmlparse.soupify import soupify, get_all_text
from neekanee_solr.models import *
class TaleoJobScraper(Jo... | code_fim | hard | {
"lang": "python",
"repo": "thayton/neekanee",
"path": "/neekanee/job_scrapers/neekanee/jobscrapers/taleo/gh.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@cd.jit(device=True)
def get_or_zero(a, i, j):
if not inside_bounds(a, i, j):
return 0
return a[i, j]
def make_kernel_patch_average(patch_radius):
PATCH_RADIUS = patch_radius
_SH_B_SIZE = 2 * PATCH_RADIUS + B_SIZE
@cd.jit()
def _kernel_patch_average(g_in, g_out):
... | code_fim | medium | {
"lang": "python",
"repo": "antoinewdg/automated-denoising-chain",
"path": "/utils/patch_average.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: antoinewdg/automated-denoising-chain path: /utils/patch_average.py
import math
import numpy as np
import cv2
from numba import jit, float32, vectorize, cuda as cd, float32, int32
import cvu
from utils import get_grid_dims
B_SIZE = 32
@cd.jit(device=True)
def _unflat_coords(a, idx):
retur... | code_fim | hard | {
"lang": "python",
"repo": "antoinewdg/automated-denoising-chain",
"path": "/utils/patch_average.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rh137/lyrics-crawler path: /song_class.py
import os
class Song:
def __init__(self, album, artist, title, link):
self.__album = album
self.__artist = artist
self.__title = title
self.link = link
self.lyrics = ''
def store_lyrics(self):
<|fim_suffix|> if 'kkbox' in self.link: return... | code_fim | hard | {
"lang": "python",
"repo": "rh137/lyrics-crawler",
"path": "/song_class.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def store_lyrics(self):
file_name = './lyrics/' + str(self).replace('/', '[slash]') + '.txt'
print(file_name)
if not os.path.isfile(file_name):
with open(file_name, 'w') as f:
f.write(self.lyrics)
return file_name
def title(self):
return self.__title
def from_(self):
if 'kkbox' i... | code_fim | medium | {
"lang": "python",
"repo": "rh137/lyrics-crawler",
"path": "/song_class.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_not_b_f(a, b):
result_str = ''
for i in b:
if i == '1':
result_str += '0'
else:
result_str += '1'
return result_str
a = input()
b = input()
c = get_and_f(a, b)
d = get_or_f(a, b)
e = get_else_f(a, b)
f = get_not_a_f(a, b)
g = get_not_b_f(a, b)
... | code_fim | hard | {
"lang": "python",
"repo": "cocoa-dev-1/coding-class",
"path": "/12813.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cocoa-dev-1/coding-class path: /12813.py
def get_and_f(a, b):
result_str = ''
for i in range(len(a)):
if a[i] == '1' and b[i] == '1':
result_str += '1'
else:
result_str += '0'
return result_str
def get_or_f(a, b):
result_str = ''
for i... | code_fim | hard | {
"lang": "python",
"repo": "cocoa-dev-1/coding-class",
"path": "/12813.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ktheylin/ProgrammingForEveryone path: /Python-WebAccessData/urllinks.py
# Note - this code must run in Python 2.x and you must download
# http://www.pythonlearn.com/code/BeautifulSoup.py
# Into the same folder as this program
<|fim_suffix|>html = urllib.urlopen(url).read()
soup = BeautifulSoup(h... | code_fim | hard | {
"lang": "python",
"repo": "ktheylin/ProgrammingForEveryone",
"path": "/Python-WebAccessData/urllinks.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Retrieve all of the anchor tags
tags = soup('a')
for tag in tags:
url = tag.get('href', None)
while count < outer_loop
count = count + 1
if count == inner_loop:
html = urllib.urlopen(url).read()
#print url
continue<|fim_prefix|># repo: ktheylin/ProgrammingForEveryone path: /Python-WebAccessDa... | code_fim | medium | {
"lang": "python",
"repo": "ktheylin/ProgrammingForEveryone",
"path": "/Python-WebAccessData/urllinks.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: modianor/sklearn-tutorial path: /决策树.py
# *_*coding:utf-8 *_*
#
# import pydot
from sklearn.datasets import load_iris
from sklearn.externals.six import StringIO
from sklearn.metrics import classification_report
from sklearn.model_selection import train_test_split
from sklearn.tree import Decision... | code_fim | hard | {
"lang": "python",
"repo": "modianor/sklearn-tutorial",
"path": "/决策树.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>y_pre = clf.predict(X_test)
print(classification_report(y_test, y_pre))<|fim_prefix|># repo: modianor/sklearn-tutorial path: /决策树.py
# *_*coding:utf-8 *_*
#
# import pydot
from sklearn.datasets import load_iris
from sklearn.externals.six import StringIO
from sklearn.metrics import classification_report
... | code_fim | medium | {
"lang": "python",
"repo": "modianor/sklearn-tutorial",
"path": "/决策树.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: odoo-modules/Mee path: /hr_biometric_machine_zk_yasser/__openerp__.py
{
"name" : "Biometric Device Integration Kware",
"version" : "1.0",
"author" : "Kware<|fim_suffix|>metric_machine_view.xml","secuirty/res_groups.xml"],
"active": True,
"installable": True
}<|fim_middle|>",
... | code_fim | medium | {
"lang": "python",
"repo": "odoo-modules/Mee",
"path": "/hr_biometric_machine_zk_yasser/__openerp__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Biometric Device Integration",
"depends" : ["base","hr",'hr_attendance'],
"data" : ["biometric_machine_view.xml","secuirty/res_groups.xml"],
"active": True,
"installable": True
}<|fim_prefix|># repo: odoo-modules/Mee path: /hr_biometric_machine_zk_yasser/__openerp__.py
{
"name" : "Bi... | code_fim | medium | {
"lang": "python",
"repo": "odoo-modules/Mee",
"path": "/hr_biometric_machine_zk_yasser/__openerp__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i, name in enumerate(names, 1):
print('.', end='', flush=True)
img = cv2.imread(name)
resized = cv2.resize(img, size)
new_name = str(i).zfill(zero_padding) + f'.{ext}'
new_name = os.path.join(output_dir, new_name)
cv2.imwrite(new_name, resized)
... | code_fim | hard | {
"lang": "python",
"repo": "foobar167/object_detection_demo",
"path": "/resize_v1_fixed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> input_dir = args.input
output_dir = args.output
ext = args.ext
size = eval(args.size)
msg = '--target-size must be a tuple of 2 integers'
assert isinstance(size, tuple) and len(size) == 2, msg
names = glob.glob(os.path.join(input_dir, f'*.{ext}'))
os.makedirs(output_dir, ex... | code_fim | hard | {
"lang": "python",
"repo": "foobar167/object_detection_demo",
"path": "/resize_v1_fixed.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: foobar167/object_detection_demo path: /resize_v1_fixed.py
# Resize images using fixed width and height, without aspect ratio.
# Resize images with fixed file format. For example, JPG images only.
# Example:
# python resize_v1_fixed.py --input ./data/raw --output ./data/images --ext jpg --size "(8... | code_fim | hard | {
"lang": "python",
"repo": "foobar167/object_detection_demo",
"path": "/resize_v1_fixed.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hiroki-yod/matsumoto_public path: /profile_edit/migrations/0002_auto_20211012_1341.py
# Generated by Django 3.2.7 on 2021-10-12 04:41
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddField(
model_... | code_fim | medium | {
"lang": "python",
"repo": "hiroki-yod/matsumoto_public",
"path": "/profile_edit/migrations/0002_auto_20211012_1341.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('profile_edit', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='profile',
name='notice_bbs',
field=models.BooleanField(default=False, verbose_name='投稿通知'),
),
migrations.AddField(
... | code_fim | medium | {
"lang": "python",
"repo": "hiroki-yod/matsumoto_public",
"path": "/profile_edit/migrations/0002_auto_20211012_1341.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pygame.init()
pygame.mixer.init()
pygame.mixer.music.load('forest.mp3')
pygame.mixer.music.play()
screen = pygame.display.set_mode(size)
gameover = False
#npc2.check_allive = True
speed = [0, 0]
_speed_ = 5#@random.randint(-4, 4)
#if _speed_ < 0:
#... | code_fim | hard | {
"lang": "python",
"repo": "NightRPR/uvagauvaga",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NightRPR/uvagauvaga path: /test.py
1, bg2.get_height() // 1))
image1 = pygame.image.load("gg_right.png")
image1 = pygame.transform.scale(image1, (image1.get_width() // 11, image1.get_height() // 11))
image2 = pygame.image.load("gg_left.png")
image2 = pygame.transform.scale(image2, (image2.... | code_fim | hard | {
"lang": "python",
"repo": "NightRPR/uvagauvaga",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def game_over():
screen = pygame.display.set_mode(size)
gameover = False
pygame.mixer.music.load('lose.mp3')
pygame.mixer.music.play()
key.check_used = 0
coin.check_used = 0
exit_button = Button((width // 2) - 75, (height // 2) + 35, 150, 50, (255, 0, 0), 0, 'Calibri', 5... | code_fim | hard | {
"lang": "python",
"repo": "NightRPR/uvagauvaga",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if add_dummy_ynames:
ynames = [ynames_dict[k] for k in range(number_y)]
# Create custom artists
simArtist = plt.Line2D((0, 1), (0, 0), color='k', marker='o', linestyle='')
anyArtist = plt.Line2D((0, 1), (0, 0), color='k')
#print color_dict
# print 'printing y... | code_fim | hard | {
"lang": "python",
"repo": "sellalab/PolygenicAdaptation1D",
"path": "/code/plot_functions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if groupings is None:
grouped = False
groupings = [{i} for i in range(number_y)]
else:
grouped = True
# Make sure all the elements are in a colour grouping
if grouped:
extra_group = set()
for i in range(number_y):
in_a_group = False
... | code_fim | hard | {
"lang": "python",
"repo": "sellalab/PolygenicAdaptation1D",
"path": "/code/plot_functions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sellalab/PolygenicAdaptation1D path: /code/plot_functions.py
default_plot_specs[stat] = plotspecs[stat]
the_label = ''
if domain is not None:
xlow = domain[0]
xhigh = domain[1]
for ii in range(number_y):
klow = x[ii].index(find_nearest(x[ii],xlo... | code_fim | hard | {
"lang": "python",
"repo": "sellalab/PolygenicAdaptation1D",
"path": "/code/plot_functions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: diarmuidclarke/cetus path: /cetusSite/cetus3pur/migrations/0009_eab_request_rw_or_ro.py
# Generated by Django 3.1.1 on 2020-10-24 22:22
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddField(
mode... | code_fim | medium | {
"lang": "python",
"repo": "diarmuidclarke/cetus",
"path": "/cetusSite/cetus3pur/migrations/0009_eab_request_rw_or_ro.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.