text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: dunnkers/toy-neural-network path: /toynn/activations.py
import numpy as np
class Activation:
def func(self, x: float) -> float: raise NotImplementedError
def grad(self, x: float) -> float: raise NotImplementedError
class RELU(Activation):
def func(self, x: float) -> float: return np... | code_fim | hard | {
"lang": "python",
"repo": "dunnkers/toy-neural-network",
"path": "/toynn/activations.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zyc2206122693/leetcode_python path: /999.可以被一步捕获的棋子数.py
#
# @lc app=leetcode.cn id=999 lang=python3
#
# [999] 可以被一步捕获的棋子数
#
# @lc code=start
class Solution:
<|fim_suffix|> '''
1.找到R的位置
2.向4个方向遍历,找到第一个P,该方向停止遍历
3.找到第一个B,该方向停止遍历
'''
#定义上下左右
dx... | code_fim | hard | {
"lang": "python",
"repo": "zyc2206122693/leetcode_python",
"path": "/999.可以被一步捕获的棋子数.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
1.找到R的位置
2.向4个方向遍历,找到第一个P,该方向停止遍历
3.找到第一个B,该方向停止遍历
'''
#定义上下左右
dx,dy = [-1,1,0,0],[0,0,-1,1]
x,y,res = 0,0,0
for i in range(8):
for j in range(8):
if board[i][j] == 'R':
#记录位置
... | code_fim | hard | {
"lang": "python",
"repo": "zyc2206122693/leetcode_python",
"path": "/999.可以被一步捕获的棋子数.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while running:
line = raw_input("大王,有什么需要小人服务呢?>")
if line == 'q':
print "大王再见,大王慢走。"
break
elif line == '?' or line == 'h' or line == 'H' or line == 'help':
print '''
按q退出
按 ?/h/H/help 显示帮助
按s显... | code_fim | medium | {
"lang": "python",
"repo": "liangdl/OMOOC2py",
"path": "/_src/om2py1w/1wex1/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def input_journal():
while running:
line = raw_input("大王,有什么需要小人服务呢?>")
if line == 'q':
print "大王再见,大王慢走。"
break
elif line == '?' or line == 'h' or line == 'H' or line == 'help':
print '''
按q退出
按 ?/h/H/help 显示帮... | code_fim | hard | {
"lang": "python",
"repo": "liangdl/OMOOC2py",
"path": "/_src/om2py1w/1wex1/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liangdl/OMOOC2py path: /_src/om2py1w/1wex1/main.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys, os, time
running = True
# display_journalay journal.txt
def display_journal():
# display journal.txt content
if os.path.isfile('journal.txt'):
print "大王,这是您之前的口谕:"
pri... | code_fim | medium | {
"lang": "python",
"repo": "liangdl/OMOOC2py",
"path": "/_src/om2py1w/1wex1/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RuzhaK/PythonAdvanced path: /Comprehensions/T3EvenMatrix.py
def strs_to_ints(param):
return [int(x) for x in param]
def read_matrix():
<|fim_suffix|>
def get_even_elements(row):
return [x for x in row if x%2==0]
def get_even_matrix(matrix):
return [get_even_elements(row) for ... | code_fim | medium | {
"lang": "python",
"repo": "RuzhaK/PythonAdvanced",
"path": "/Comprehensions/T3EvenMatrix.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [x for x in row if x%2==0]
def get_even_matrix(matrix):
return [get_even_elements(row) for row in matrix]
def print_result(even_matrix):
print(even_matrix)
matrix=read_matrix()
even_matrix=get_even_matrix(matrix)
print_result(even_matrix)<|fim_prefix|># repo: RuzhaK/PythonAdvance... | code_fim | medium | {
"lang": "python",
"repo": "RuzhaK/PythonAdvanced",
"path": "/Comprehensions/T3EvenMatrix.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_even_matrix(matrix):
return [get_even_elements(row) for row in matrix]
def print_result(even_matrix):
print(even_matrix)
matrix=read_matrix()
even_matrix=get_even_matrix(matrix)
print_result(even_matrix)<|fim_prefix|># repo: RuzhaK/PythonAdvanced path: /Comprehensions/T3EvenMatrix.py... | code_fim | medium | {
"lang": "python",
"repo": "RuzhaK/PythonAdvanced",
"path": "/Comprehensions/T3EvenMatrix.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># create the conditional pro-gan
cond_pro_gan = ConditionalProGAN(
num_classes=10,
depth=4,
device=th.device("cuda")
)
# train the model
cond_pro_gan.train(
dataset=dataset,
epochs=[20, 20, 20, 20],
batch_sizes=[128, 128, 128, 128],
fade_in_percentage=[50, 50, 50, 50],
fee... | code_fim | hard | {
"lang": "python",
"repo": "akanimax/pro_gan_pytorch-examples",
"path": "/implementation/train_conditional_cifar-10.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akanimax/pro_gan_pytorch-examples path: /implementation/train_conditional_cifar-10.py
import torch as th
from torchvision.datasets import CIFAR10
from torchvision.transforms import Compose, Normalize, ToTensor
from pro_gan_pytorch.PRO_GAN import ConditionalProGAN
# create the dataset:
dataset =... | code_fim | medium | {
"lang": "python",
"repo": "akanimax/pro_gan_pytorch-examples",
"path": "/implementation/train_conditional_cifar-10.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [
'no',\
'packing_date',\
'packing_name',\
'qty',\
'qty_out',\
'location',\
]<|fim_prefix|># repo: Rizalimami/dym path: /dym_report_kartu_stock/models/dym_report_kartu_stock_sm.py
from openerp import models, fi... | code_fim | hard | {
"lang": "python",
"repo": "Rizalimami/dym",
"path": "/dym_report_kartu_stock/models/dym_report_kartu_stock_sm.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rizalimami/dym path: /dym_report_kartu_stock/models/dym_report_kartu_stock_sm.py
from openerp import models, fields, api
class dym_report_kartu_stock_sm(models.Model):
_inherit = 'stock.move'
def _report_xls_kartu_stock_fields(self, cr, uid, context=None):
<|fim_suffix|> retu... | code_fim | hard | {
"lang": "python",
"repo": "Rizalimami/dym",
"path": "/dym_report_kartu_stock/models/dym_report_kartu_stock_sm.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _report_xls_kartu_stock_fields(self, cr, uid, context=None):
return [
'no',\
'packing_date',\
'packing_name',\
'qty',\
'qty_out',\
'location',\
]
#aris
def _report_xls_kartu_stock_fields_sparepart(self... | code_fim | hard | {
"lang": "python",
"repo": "Rizalimami/dym",
"path": "/dym_report_kartu_stock/models/dym_report_kartu_stock_sm.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># New feature...
for i in range(3):
print(str(i + 1))<|fim_prefix|># repo: topherPedersen2/SuperSweetProject path: /supersweet.py
print("Super Sweet Open Source Project!")
<|fim_middle|>print("Now includes my excellent new feature...")
| code_fim | easy | {
"lang": "python",
"repo": "topherPedersen2/SuperSweetProject",
"path": "/supersweet.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: topherPedersen2/SuperSweetProject path: /supersweet.py
print("Super Sweet Open Source Project!")
<|fim_suffix|># New feature...
for i in range(3):
print(str(i + 1))<|fim_middle|>print("Now includes my excellent new feature...")
| code_fim | easy | {
"lang": "python",
"repo": "topherPedersen2/SuperSweetProject",
"path": "/supersweet.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># structure_model_w_stdp = sim.StructuralMechanism(weight=g_max, s_max=s_max)
ff_projection = sim.Projection(
source_pop, target_pop,
sim.FromListConnector(init_ff_connections),
synapse_dynamics=sim.SynapseDynamics(slow=structure_model_w_stdp),
label="plastic_ff_projection"
)
lat_projec... | code_fim | hard | {
"lang": "python",
"repo": "Quantumgame/neurogenesis",
"path": "/synaptogenesis/binocular_input_topographic_map.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Quantumgame/neurogenesis path: /synaptogenesis/binocular_input_topographic_map.py
"""
Test for ocular preferrence in topographic maps using STDP and synaptic rewiring.
http://hdl.handle.net/1842/3997
"""
# Imports
import numpy as np
import pylab as plt
import time
from pacman.model.constraints.p... | code_fim | hard | {
"lang": "python",
"repo": "Quantumgame/neurogenesis",
"path": "/synaptogenesis/binocular_input_topographic_map.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangyum/Anaconda path: /pkgs/anaconda-navigator-1.1.0-py27_0/lib/python2.7/site-packages/anaconda_navigator/api/project_api.py
# -*- coding: utf-8 -*-
#
# Copyright 2016 Continuum Analytics, Inc.
# May be copied and distributed freely only as part of an Anaconda or
# Miniconda installation.
#
""... | code_fim | hard | {
"lang": "python",
"repo": "wangyum/Anaconda",
"path": "/pkgs/anaconda-navigator-1.1.0-py27_0/lib/python2.7/site-packages/anaconda_navigator/api/project_api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Developed as part of Anaconda Navigator, details will initially only
include information necessary for UI functions.
"""
keys = ('name', 'default_environment', 'environments', 'commands', 'icon',
'default_channels', 'is_app', 'dev_tool', 'version',
'description', 'i... | code_fim | hard | {
"lang": "python",
"repo": "wangyum/Anaconda",
"path": "/pkgs/anaconda-navigator-1.1.0-py27_0/lib/python2.7/site-packages/anaconda_navigator/api/project_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maheshmnj/POPULAR_CODING_Questions_Solution path: /leetcode/problem_121.py
# Problem 121: Best Time to Buy and Sell Stock (Easy): https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
<|fim_suffix|> def maxProfit(self, prices: List[int]) -> int:
buy_day = 0
sell_day =... | code_fim | medium | {
"lang": "python",
"repo": "maheshmnj/POPULAR_CODING_Questions_Solution",
"path": "/leetcode/problem_121.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
prices = [7,1,5,3,6,4]
print(Solution().maxProfit(prices)) # 5<|fim_prefix|># repo: maheshmnj/POPULAR_CODING_Questions_Solution path: /leetcode/problem_121.py
# Problem 121: Best Time to Buy and Sell Stock (Easy): https://leetcode.com/problems/best-time-to-buy-and-sell-... | code_fim | hard | {
"lang": "python",
"repo": "maheshmnj/POPULAR_CODING_Questions_Solution",
"path": "/leetcode/problem_121.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# def change_status(self):
# self.root.ids.status.text = "Places to visit: " + str(self.place_collection.total_unvisited_places())
# print("hello")
# def create_widgets(self):
# index = 1
# for place in self.place_collection.file_places:
# location_b... | code_fim | hard | {
"lang": "python",
"repo": "cooper-plath/CooperPlathA2",
"path": "/TestingApp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cooper-plath/CooperPlathA2 path: /TestingApp.py
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.properties import StringProperty
from PlaceCollection import PlaceCollection
from Place import Place
from kivy.properties import ListProperty
dictio... | code_fim | hard | {
"lang": "python",
"repo": "cooper-plath/CooperPlathA2",
"path": "/TestingApp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jjmanzer/public path: /release/classes/bgp/openconfig_bgp_neighbor.py
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.ya... | code_fim | hard | {
"lang": "python",
"repo": "jjmanzer/public",
"path": "/release/classes/bgp/openconfig_bgp_neighbor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class openconfig_bgp_common_multiprotocol(PybindBase):
"""
This class was auto-generated by the PythonClass plugin for PYANG
from YANG module openconfig-bgp-common-multiprotocol - based on the path /openconfig-bgp-common-multiprotocol. Each member element of
the container is represented as a clas... | code_fim | hard | {
"lang": "python",
"repo": "jjmanzer/public",
"path": "/release/classes/bgp/openconfig_bgp_neighbor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
This class was auto-generated by the PythonClass plugin for PYANG
from YANG module openconfig-bgp-common-multiprotocol - based on the path /openconfig-bgp-common-multiprotocol. Each member element of
the container is represented as a class variable - with a specific
YANG type.
YANG Descri... | code_fim | hard | {
"lang": "python",
"repo": "jjmanzer/public",
"path": "/release/classes/bgp/openconfig_bgp_neighbor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UpdateFormNode(Node):
def __init__(self, parent, var_name):
self.parent = Variable(parent)
self.var_name = var_name
def render(self, context):
update = Update(parent=self.parent.resolve(context))
form = UpdateForm(instance=update)
context... | code_fim | medium | {
"lang": "python",
"repo": "myrlund/Issues",
"path": "/src/fokus/update/templatetags/update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: myrlund/Issues path: /src/fokus/update/templatetags/update.py
import re
from django.template import TemplateSyntaxError, Node, Variable
from django import template
from fokus.update.models import Update
from fokus.update.forms import UpdateForm
from fokus.core.templatetags.tools import split_to... | code_fim | medium | {
"lang": "python",
"repo": "myrlund/Issues",
"path": "/src/fokus/update/templatetags/update.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@register.tag
def update_form(parser, token):
parent, var_name = split_token(token)
return UpdateFormNode(parent, var_name)<|fim_prefix|># repo: myrlund/Issues path: /src/fokus/update/templatetags/update.py
import re
from django.template import TemplateSyntaxError, Node, Variable
from django imp... | code_fim | medium | {
"lang": "python",
"repo": "myrlund/Issues",
"path": "/src/fokus/update/templatetags/update.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spdd/Simple_Search_Engine_With_Python path: /spiders/project/detki38/script.py
import MySQLdb
mydb = MySQLdb.connect(host = 'localhost',
user = 'root',
passwd = 'mysql',
db = 'irk<|fim_suffix|>s WHERE id BETWEEN 1040001 AND 1050000"
cur.execute(delete1)<|fim_middle|>db')
cur = m... | code_fim | easy | {
"lang": "python",
"repo": "spdd/Simple_Search_Engine_With_Python",
"path": "/spiders/project/detki38/script.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>s WHERE id BETWEEN 1040001 AND 1050000"
cur.execute(delete1)<|fim_prefix|># repo: spdd/Simple_Search_Engine_With_Python path: /spiders/project/detki38/script.py
import MySQLdb
mydb = MySQLdb.connect(host = 'localhost',
<|fim_middle|> user = 'root',
passwd = 'mysql',
db = 'irkdb')
cur = m... | code_fim | medium | {
"lang": "python",
"repo": "spdd/Simple_Search_Engine_With_Python",
"path": "/spiders/project/detki38/script.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.outputLog_TextBox.append(self, stringToUpdate)
def on_click(self):
# ====CHANGE BUTTON TEXT=====
# if self.trainingTimer.isActive():
# self.trainingTimer.stop()
# self.train_Button.setText('TRAIN')
# else:
# self.trainingTimer.start(10... | code_fim | hard | {
"lang": "python",
"repo": "JasJohn3/ATHENA_MULTI_THREAD",
"path": "/Data/QtCustomWidgets/QTrainWidget.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JasJohn3/ATHENA_MULTI_THREAD path: /Data/QtCustomWidgets/QTrainWidget.py
from PyQt5.QtWidgets import *
import Training
class QTrainWidget(QWidget):
def __init__(self, parent=None):
super().__init__()
self.initUI()
def initUI(self):
# ===EPOCHS PROGRESS BAR===
... | code_fim | hard | {
"lang": "python",
"repo": "JasJohn3/ATHENA_MULTI_THREAD",
"path": "/Data/QtCustomWidgets/QTrainWidget.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> labels_series_train = self.batchX_placeholder[self.n_predict_step:self.n_train, :]
labels_series_valid = self.batchX_placeholder[self.n_train:, :]
labels_series_total = self.batchX_placeholder[self.n_predict_step:, :]
# the total loss take all predictions into account
... | code_fim | hard | {
"lang": "python",
"repo": "liangmuxin/dsbox-featurizer",
"path": "/dsbox/datapreprocessing/featurizer/timeseries/RNN_timeseries.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: liangmuxin/dsbox-featurizer path: /dsbox/datapreprocessing/featurizer/timeseries/RNN_timeseries.py
=1,
description='Maximum number of iterations. Default is 300 ',
semantic_types=['https://metadata.datadrivendiscovery.org/types/TuningParameter']
)
n_dense_dim = hyperparams... | code_fim | hard | {
"lang": "python",
"repo": "liangmuxin/dsbox-featurizer",
"path": "/dsbox/datapreprocessing/featurizer/timeseries/RNN_timeseries.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shawa/adblockparser path: /adblockparser/parser.py
ck if rule applies to an URL, use ``match_url`` method::
>>> rule = AdblockRule("swf|")
>>> rule.match_url("http://example.com/annoyingflash.swf")
True
>>> rule.match_url("http://example.com/swf/index.html")
False
Rules ... | code_fim | hard | {
"lang": "python",
"repo": "shawa/adblockparser",
"path": "/adblockparser/parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shawa/adblockparser path: /adblockparser/parser.py
rmat details:
* https://adblockplus.org/en/filter-cheatsheet
* https://adblockplus.org/en/filters
Instantiate AdblockRule with a rule line:
>>> from adblockparser import AdblockRule
>>> rule = AdblockRule("@@||mydomain.no/a... | code_fim | hard | {
"lang": "python",
"repo": "shawa/adblockparser",
"path": "/adblockparser/parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> general_re, domain_required_rules, rules_with_options):
"""
Return if ``url``/``options`` are matched by rules defined by
``general_re``, ``domain_required_rules`` and ``rules_with_options``.
``general_re`` is a compiled regex for rules without options.
... | code_fim | hard | {
"lang": "python",
"repo": "shawa/adblockparser",
"path": "/adblockparser/parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hrabbit2000/deep_bp path: /test/otest.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import os
sys.path.append(os.path.abspath("./"))
import time
import mnist_loader
import network
import numpy as np
<|fim_suffix|># bp = network.Network([2, 3, 2])
# bp.weights = [np.array([(0.1, 0.2... | code_fim | hard | {
"lang": "python",
"repo": "hrabbit2000/deep_bp",
"path": "/test/otest.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># bp = network.Network([2, 3, 2])
# bp.weights = [np.array([(0.1, 0.2), (0.2, 0.3), (0.3, 0.4)]), np.array([(0.5, 0.6, 0.7), (1.0, 1.0, 1.0)])]
# bp.biases = [np.array([(0.3,), (0.4,), (0.5,)]), np.array([(0.2,), (1.0,)])]
# inputs = [np.array([(1,), (2,)])]
# ds = [np.array([(0.5,), (0.2,)])]
# training_... | code_fim | hard | {
"lang": "python",
"repo": "hrabbit2000/deep_bp",
"path": "/test/otest.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TAEHYOKIM/TeamUp path: /김태효/LDA.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import Counter
import random
def p_topic_given_document(topic, d, alpha=0.1):
return ((document_topic_counts[d][topic] + alpha) /
(document_lengths[d] + K * alpha))
def p_word_give... | code_fim | medium | {
"lang": "python",
"repo": "TAEHYOKIM/TeamUp",
"path": "/김태효/LDA.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def sample_from(weights):
total = sum(weights)
rnd = total * random.random()
for i, w in enumerate(weights):
rnd -= w
if rnd <= 0:
return i
documents = [["Hadoop", "Big Data", "HBase", "Java", "Spark", "Storm", "Cassandra"],
["NoSQL", "MongoDB", "Cassandra", "H... | code_fim | hard | {
"lang": "python",
"repo": "TAEHYOKIM/TeamUp",
"path": "/김태효/LDA.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for iter in range(1000):
for d in range(D):
for i, (word, topic) in enumerate(zip(documents[d],
document_topics[d])):
document_topic_counts[d][topic] -= 1
topic_word_counts[topic][word] -= 1
topic_counts[topic] -... | code_fim | hard | {
"lang": "python",
"repo": "TAEHYOKIM/TeamUp",
"path": "/김태효/LDA.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def build_api_factory(
throttler: Optional[AsyncThrottler] = None,
auth: Optional[AuthBase] = None, ) -> WebAssistantsFactory:
throttler = throttler or create_throttler()
api_factory = WebAssistantsFactory(
throttler=throttler,
auth=auth)
return api_factory
d... | code_fim | hard | {
"lang": "python",
"repo": "vic-en/hummingbot",
"path": "/hummingbot/connector/exchange/ftx/ftx_web_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: edm1/NHS_MRD2 path: /old-versions/v1_original-pipeline/stage1.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import pickle
import libs.stage1_funcs as s1f
import libs.stage1_classes as s1c
import libs.motif_filter as mtf
import libs.clustering as clf
import subprocess
def main(arg... | code_fim | hard | {
"lang": "python",
"repo": "edm1/NHS_MRD2",
"path": "/old-versions/v1_original-pipeline/stage1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Write the .tab summary file
tab_file = './results/{0}/{0}.tab'.format(args['<id>'])
cluster_records.write_tabulated(tab_file, args['--top'])
# Write the detailed summary report
cluster_records.write_detail_output(
'./results/{0}/{0}.detail'.format(args['<id>']),
... | code_fim | hard | {
"lang": "python",
"repo": "edm1/NHS_MRD2",
"path": "/old-versions/v1_original-pipeline/stage1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AndyLi-26/tetris path: /game.py
import random
import pygame
from pygame.locals import *
class new_game:
def __init__(self,x=12,y=20,tetriminos=[[[1, 1, 1, 1],[0,0,0,0]], [[2, 0, 0], [2, 2, 2]], [[0, 0, 3], [3, 3, 3]], [[4, 4], [4, 4]], [[0, 5, 5], [5, 5, 0]], [[0, 6, 0], [6, 6, 6]], [[7, 7, 0... | code_fim | hard | {
"lang": "python",
"repo": "AndyLi-26/tetris",
"path": "/game.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.spawn(0)
def __str__(self):
s='[XXXXXXXXXXXX]\n'
for i in self.board:
s+='['
for j in i:
if int(j)==j:
s+=' '+str(j)+' '
else:
s+="'"+j+"'"
s+=']\n'
s+='[XXX... | code_fim | hard | {
"lang": "python",
"repo": "AndyLi-26/tetris",
"path": "/game.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>actions = ActionChains(driver)
actions.click(bigCookie)
for i in range(5000):
actions.perform()
count = int(cookieCount.text.split(" ")[0])
print(count)
for item in items:
value = int(item.text)
if value <= count:
upgrade_actions = ActionChains(driver)
... | code_fim | hard | {
"lang": "python",
"repo": "jsonballadares/seleniumtutorial",
"path": "/tutorial3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(5000):
actions.perform()
count = int(cookieCount.text.split(" ")[0])
print(count)
for item in items:
value = int(item.text)
if value <= count:
upgrade_actions = ActionChains(driver)
upgrade_actions.click(item)
upgrade_actio... | code_fim | hard | {
"lang": "python",
"repo": "jsonballadares/seleniumtutorial",
"path": "/tutorial3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsonballadares/seleniumtutorial path: /tutorial3.py
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.webdriver import WebDriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.common.... | code_fim | hard | {
"lang": "python",
"repo": "jsonballadares/seleniumtutorial",
"path": "/tutorial3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
solution = Solution()
#J, S = get_test_case_1()
#J, S = get_test_case_2()
#J, S = get_test_case_3()
#J, S = get_test_case_4()
J, S = get_test_case_5()
#J, S = get_test_case_6()
print("\n J: ", J)
print(" S: ", S)
number_of_jewels = solu... | code_fim | hard | {
"lang": "python",
"repo": "arivolispark/datastructuresandalgorithms",
"path": "/leetcode/30_day_leetcoding_challenge/202005/20200502_jewels_and_stones/jewels_and_stones.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arivolispark/datastructuresandalgorithms path: /leetcode/30_day_leetcoding_challenge/202005/20200502_jewels_and_stones/jewels_and_stones.py
"""
Title: Jewels and Stones
You're given strings J representing the types of stones that are
jewels, and S representing the stones you have. Each characte... | code_fim | hard | {
"lang": "python",
"repo": "arivolispark/datastructuresandalgorithms",
"path": "/leetcode/30_day_leetcoding_challenge/202005/20200502_jewels_and_stones/jewels_and_stones.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sxs-collaboration/spectre path: /tests/Unit/Elliptic/Systems/Poisson/Equations.py
# Distributed under the MIT License.
# See LICENSE.txt for details.
import numpy as np
def flat_cartesian_fluxes(field_gradient):
return field_gradient
def curved_fluxes(inv_spatial_metric, field_gradient):... | code_fim | medium | {
"lang": "python",
"repo": "sxs-collaboration/spectre",
"path": "/tests/Unit/Elliptic/Systems/Poisson/Equations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def auxiliary_fluxes_2d(field):
return auxiliary_fluxes(field, 2)
def auxiliary_fluxes_3d(field):
return auxiliary_fluxes(field, 3)<|fim_prefix|># repo: sxs-collaboration/spectre path: /tests/Unit/Elliptic/Systems/Poisson/Equations.py
# Distributed under the MIT License.
# See LICENSE.txt for d... | code_fim | medium | {
"lang": "python",
"repo": "sxs-collaboration/spectre",
"path": "/tests/Unit/Elliptic/Systems/Poisson/Equations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def curved_fluxes(inv_spatial_metric, field_gradient):
return np.einsum("ij,j", inv_spatial_metric, field_gradient)
def add_curved_sources(christoffel_contracted, field_flux):
return -np.einsum("i,i", christoffel_contracted, field_flux)
def auxiliary_fluxes(field, dim):
return np.diag(np.r... | code_fim | medium | {
"lang": "python",
"repo": "sxs-collaboration/spectre",
"path": "/tests/Unit/Elliptic/Systems/Poisson/Equations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_day(self) -> None:
actual = self.day
given = solution.day
self.assertEqual(
actual, given, f"Today is wrong, expexted {actual} but got {given}!"
)
def test_fare(self) -> None:
actual = self.charts[self.day]
given = solution.fare... | code_fim | hard | {
"lang": "python",
"repo": "Tevin-254/python",
"path": "/challenges/week_1/bus_fare_challenge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Tracking___: Checking Values For Today's Date, Day and Fare =====")
unittest.main(exit=False)
print("EndTracking___: Checking Return Values For Today's Date, Day and Fare =======")<|fim_prefix|># repo: Tevin-254/python path: /challenges/week_1/bus_fare_challenge.py
# WRITE YOUR CODE ... | code_fim | hard | {
"lang": "python",
"repo": "Tevin-254/python",
"path": "/challenges/week_1/bus_fare_challenge.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tevin-254/python path: /challenges/week_1/bus_fare_challenge.py
# WRITE YOUR CODE SOLUTION HERE
import bus_fare_challenge as solution
import datetime
import unittest
class TestBusFareChallenge(unittest.TestCase):
def setUp(self) -> None:
self.date = datetime.datetime.now().date()
... | code_fim | hard | {
"lang": "python",
"repo": "Tevin-254/python",
"path": "/challenges/week_1/bus_fare_challenge.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert token.token['access']
initial_access = token.token['access']
initial_time = token.token['time']
time.sleep(3)
token.refresh_token()
token2 = DataLakeCredential(token.token)
assert token2.token['access']
assert initial_access != token2.token['access']
assert token... | code_fim | hard | {
"lang": "python",
"repo": "Azure/azure-data-lake-store-python",
"path": "/tests/test_lib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Azure/azure-data-lake-store-python path: /tests/test_lib.py
# -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the proj... | code_fim | hard | {
"lang": "python",
"repo": "Azure/azure-data-lake-store-python",
"path": "/tests/test_lib.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert principal_token.token['access']
assert principal_token.token['secret']
initial_access = principal_token.token['access']
initial_time = principal_token.token['time']
time.sleep(3)
principal_token.refresh_token()
token2 = DataLakeCredential(principal_token.token)
asser... | code_fim | hard | {
"lang": "python",
"repo": "Azure/azure-data-lake-store-python",
"path": "/tests/test_lib.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 5,
}’
“http://192.168.0.207:5000/transactions/new”<|fim_prefix|># repo: bsairline/myson path: /test_command.py
curl -X POST -H “Content-Type: application/json” -d<|fim_middle|>’{
'sender' : “4498dcbf5abb465a98338a028c144b72”,
'recipient' : “someone-other-address”,
'amount' : | code_fim | medium | {
"lang": "python",
"repo": "bsairline/myson",
"path": "/test_command.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bsairline/myson path: /test_command.py
curl -X POST -H “Content-Type: application/json” -d<|fim_suffix|> 'recipient' : “someone-other-address”,
'amount' : 5,
}’
“http://192.168.0.207:5000/transactions/new”<|fim_middle|>’{
'sender' : “4498dcbf5abb465a98338a028c144b72”,
| code_fim | easy | {
"lang": "python",
"repo": "bsairline/myson",
"path": "/test_command.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # recv the cipher text from the server
cipher_text = sock.recv(4096)
# decrypt the cipher text
plain_text = decrypt(cipher_text, secret_key)
print(f'the server {server_address} sended {plain_text}')
finally:
sock.close()<|fim_prefix|># repo: pash4paul/diffie_hellman path: /client... | code_fim | hard | {
"lang": "python",
"repo": "pash4paul/diffie_hellman",
"path": "/client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_revision():
"""
:returns: Revision number of this branch/checkout, if available. None if
no revision number can be determined.
"""
package_dir = os.path.dirname(__file__)
checkout_dir = os.path.normpath(os.path.join(package_dir, '..'))
path = os.path.join(checkout_d... | code_fim | hard | {
"lang": "python",
"repo": "GaretJax/coffin",
"path": "/coffin/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>import os
def _get_git_revision(path):
revision_file = os.path.join(path, 'refs', 'heads', 'master')
if not os.path.exists(revision_file):
return None
fh = open(revision_file, 'r')
try:
return fh.read()
finally:
fh.close()
def get_revision():
"""
:retu... | code_fim | medium | {
"lang": "python",
"repo": "GaretJax/coffin",
"path": "/coffin/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GaretJax/coffin path: /coffin/__init__.py
"""
Coffin
~~~~~~
`Coffin <http://www.github.com/coffin/coffin>` is a package that resolves the
impedance mismatch between `Django <http://www.djangoproject.com/>` and `Jinja2
<http://jinja.pocoo.org/2/>` through various adapters. The aim is to use Coffi... | code_fim | medium | {
"lang": "python",
"repo": "GaretJax/coffin",
"path": "/coffin/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> logger.setLevel(logging.DEBUG)
logger.addHandler(handler)
logger.propagate = False
return logger<|fim_prefix|># repo: melio-consulting/filly path: /filly/log.py
# -*- coding: utf-8 -*-
import logging
def setup_custom_logger(name):
formatter = logging.Formatter(fmt='%(asctime)s - %(l... | code_fim | medium | {
"lang": "python",
"repo": "melio-consulting/filly",
"path": "/filly/log.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ichwoni/python_ path: /codeup#100/#6069.py
scr=input()
if scr=='A':
print('best!!<|fim_suffix|> print('slowly~')
else:
print('what?')<|fim_middle|>!')
elif scr=='B':
print('good!!')
elif scr=='C':
print('run!')
elif scr=='D':
| code_fim | medium | {
"lang": "python",
"repo": "ichwoni/python_",
"path": "/codeup#100/#6069.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('slowly~')
else:
print('what?')<|fim_prefix|># repo: ichwoni/python_ path: /codeup#100/#6069.py
scr=input()
if scr=='A':
print('best!!<|fim_middle|>!')
elif scr=='B':
print('good!!')
elif scr=='C':
print('run!')
elif scr=='D':
| code_fim | medium | {
"lang": "python",
"repo": "ichwoni/python_",
"path": "/codeup#100/#6069.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ichwoni/python_ path: /codeup#100/#6069.py
scr=input()
if scr=='A':
print('best!!!')
elif scr=='B':
print('good!!')
elif <|fim_suffix|> print('slowly~')
else:
print('what?')<|fim_middle|>scr=='C':
print('run!')
elif scr=='D':
| code_fim | easy | {
"lang": "python",
"repo": "ichwoni/python_",
"path": "/codeup#100/#6069.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iceriser/PFCH2018-NYC-Park-Monuments-Project path: /filetransformation.py
import csv
import json
import re
merged_data = {
'artist' : '',
'birthdate' : '',
'birthplace' : '',
'death date' : '',
'death place' : '',
'monument' : '',
'borough' : [],
'parkname' : [],
... | code_fim | medium | {
"lang": "python",
"repo": "iceriser/PFCH2018-NYC-Park-Monuments-Project",
"path": "/filetransformation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>with open ('monumentdata.json') as json_data, open ('monumentdatafix.json', 'w') as fixed_file:
d = json.load(json_data)
for row in d:
#print (row[1]['birthdate'])
merged_data['artist'] = row[0]
merged_data['birthdate'] = row[1]['birthdate']
merged_data['birthdate']... | code_fim | medium | {
"lang": "python",
"repo": "iceriser/PFCH2018-NYC-Park-Monuments-Project",
"path": "/filetransformation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SimonSlominski/Pybites_Exercises path: /100_days_of_code/88-90-Home-inventory-app/inventory_app.py
import sqlite3
import sys
from contextlib import contextmanager
DB = "Inventory.db"
def first_launch():
# Creates the DB on first launch, otherwise
try:
conn = sqlite3.connect(DB)... | code_fim | hard | {
"lang": "python",
"repo": "SimonSlominski/Pybites_Exercises",
"path": "/100_days_of_code/88-90-Home-inventory-app/inventory_app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def check_input():
# Checks the users' input to see if it matches a room/table name.
while True:
print('\n')
for room in list_rooms():
print(room)
selection = input('Select a room: ').lower()
if selection not in list_rooms():
print("\n%s does... | code_fim | hard | {
"lang": "python",
"repo": "SimonSlominski/Pybites_Exercises",
"path": "/100_days_of_code/88-90-Home-inventory-app/inventory_app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def add_room():
# Adds a room. Scrubs the input first to only allow default chars.
name = input("\nWhat name would you like to give the room? ")
name = scrub(name)
with access_db() as cursor:
cursor.execute("CREATE TABLE '" + name.lower() + "' """"
... | code_fim | hard | {
"lang": "python",
"repo": "SimonSlominski/Pybites_Exercises",
"path": "/100_days_of_code/88-90-Home-inventory-app/inventory_app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>name='delete'),
# path('detail/<int:pk>/', ProjectDetailView.as_view(), name='detail'),
# path('a/', ProjectAList.as_view(), name='a'),
# path('b/', ProjectBList.as_view(), name='b'),
# path('c/', ProjectCList.as_view(), name='c'),
# path('d/', ProjectDList.as_view(), name='d'),
# ]
#
... | code_fim | hard | {
"lang": "python",
"repo": "springsandy/DM",
"path": "/drama/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>_view(), name='list'),
# # path(r'', include('router.urls')),
# path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
# path('add/', ProjectCreateVeiw.as_view(), name='add'),
# path('update/<int:pk>/', ProjectUpdateView.as_view(), name='update'),
# path('delete... | code_fim | hard | {
"lang": "python",
"repo": "springsandy/DM",
"path": "/drama/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: springsandy/DM path: /drama/urls.py
# from django.conf import settings
# from django.contrib.auth.models import User
# from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# from django.urls import path, include
# from rest_framework import routers
#
# from drama import views
# fro... | code_fim | hard | {
"lang": "python",
"repo": "springsandy/DM",
"path": "/drama/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ruthnixon/DjangoWebApp path: /CSE_310/Project_03/rp-portfolio/django_app/Personal_Site/models.py
from django.db import models
import datetime
<|fim_suffix|>class Post(models.Model):
title=models.CharField(max_length=30)
body=models.CharField(max_length=500)
date_posted=datetime.datet... | code_fim | medium | {
"lang": "python",
"repo": "ruthnixon/DjangoWebApp",
"path": "/CSE_310/Project_03/rp-portfolio/django_app/Personal_Site/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> title=models.CharField(max_length=30)
body=models.CharField(max_length=500)
date_posted=datetime.datetime.now()<|fim_prefix|># repo: ruthnixon/DjangoWebApp path: /CSE_310/Project_03/rp-portfolio/django_app/Personal_Site/models.py
from django.db import models
import datetime
<|fim_middle|># C... | code_fim | medium | {
"lang": "python",
"repo": "ruthnixon/DjangoWebApp",
"path": "/CSE_310/Project_03/rp-portfolio/django_app/Personal_Site/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hamletrpg/Grid-Based-Battle-System path: /Gui.py
import pygame as pg
import pygame_gui
from utilities import *
class Gui:
def __init__(self):
<|fim_suffix|> def event(self, event):
if event.type == pg.USEREVENT:
if event.user_type == pygame_gui.UI_BUTTON_PRESSED:
... | code_fim | hard | {
"lang": "python",
"repo": "hamletrpg/Grid-Based-Battle-System",
"path": "/Gui.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.generic_button = pygame_gui.elements.UIButton(relative_rect=pg.Rect((l, t), (w, h)),
text = str(g_text),
manager = self.manager)
def what_pressed(self):
if self... | code_fim | hard | {
"lang": "python",
"repo": "hamletrpg/Grid-Based-Battle-System",
"path": "/Gui.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> cur.execute(tablequery)
print("Table created successfully")
except:
print("Unable to create table")
if __name__ == "__main__":
main()<|fim_prefix|># repo: jvtaylar-cpe/jvtaylar-cpe path: /createTable.py
import sqlite3 as lit
def main():
try:
db = li... | code_fim | medium | {
"lang": "python",
"repo": "jvtaylar-cpe/jvtaylar-cpe",
"path": "/createTable.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> tablequery = "CREATE TABLE users(id INTEGER, name TEXT, email TEXT) "
cur.execute(tablequery)
print("Table created successfully")
except:
print("Unable to create table")
if __name__ == "__main__":
main()<|fim_prefix|># repo: jvtaylar-cpe/jvtaylar-cpe path... | code_fim | medium | {
"lang": "python",
"repo": "jvtaylar-cpe/jvtaylar-cpe",
"path": "/createTable.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jvtaylar-cpe/jvtaylar-cpe path: /createTable.py
import sqlite3 as lit
def main():
<|fim_suffix|>if __name__ == "__main__":
main()<|fim_middle|> try:
db = lit.connect('dbase.db')
cur= db.cursor()
tablequery = "CREATE TABLE users(id INTEGER, name TEXT, email... | code_fim | hard | {
"lang": "python",
"repo": "jvtaylar-cpe/jvtaylar-cpe",
"path": "/createTable.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
driver = Car_Specialists('Carl Max', 'Volvo', 'driver', '$50,000')
mech = mechanic('Dickson Martin', 'Volvo', 'mechanic', '$150,000')
print(driver.persona_details())
print(mech.persona_details())
#print(help(mech))
list = [102, 343 , 'que', 2.2, 50]
print(list[0:4])<|fim_prefix|># repo: Apeiron... | code_fim | medium | {
"lang": "python",
"repo": "ApeironAfrican/Africa_Apeiron_Py",
"path": "/Car_Specialist.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ApeironAfrican/Africa_Apeiron_Py path: /Car_Specialist.py
import Cars_Class
class Car_Specialists:
def __init__(self,name,car_type,skill,amount):
self.name = name
self.car_type = car_type
self.skill = skill
self.amount = amount
def persona_details(self):... | code_fim | medium | {
"lang": "python",
"repo": "ApeironAfrican/Africa_Apeiron_Py",
"path": "/Car_Specialist.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(driver.persona_details())
print(mech.persona_details())
#print(help(mech))
list = [102, 343 , 'que', 2.2, 50]
print(list[0:4])<|fim_prefix|># repo: ApeironAfrican/Africa_Apeiron_Py path: /Car_Specialist.py
import Cars_Class
class Car_Specialists:
def __init__(self,name,car_type,skill,amount):... | code_fim | medium | {
"lang": "python",
"repo": "ApeironAfrican/Africa_Apeiron_Py",
"path": "/Car_Specialist.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>s[pos-1] > list_len:
# ls[pos] =<|fim_prefix|># repo: yoga24/PythonStart path: /Start/Isort.py
def isort(ls):
for index in range(1, le<|fim_middle|>n(ls)):
list_len = ls[index]
pos = index
# while pos > 0 and l | code_fim | medium | {
"lang": "python",
"repo": "yoga24/PythonStart",
"path": "/Start/Isort.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoga24/PythonStart path: /Start/Isort.py
def isort(ls):
for index in range(1, le<|fim_suffix|>s[pos-1] > list_len:
# ls[pos] =<|fim_middle|>n(ls)):
list_len = ls[index]
pos = index
# while pos > 0 and l | code_fim | medium | {
"lang": "python",
"repo": "yoga24/PythonStart",
"path": "/Start/Isort.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HenriqueSoares28/Python-EX path: /ex067.py
from time import sleep
while True:
n = int(input('Quer ver a tabuada de qual<|fim_suffix|>t('Digite 0 para fechar o programa.')
print('')
print('Obrigado, até logo!')<|fim_middle|> valor? '))
print('-'*20)
if n <= 0:
break
for... | code_fim | medium | {
"lang": "python",
"repo": "HenriqueSoares28/Python-EX",
"path": "/ex067.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>t('Digite 0 para fechar o programa.')
print('')
print('Obrigado, até logo!')<|fim_prefix|># repo: HenriqueSoares28/Python-EX path: /ex067.py
from time import sleep
while True:
n = int(input('Quer ver a tabuada de qual<|fim_middle|> valor? '))
print('-'*20)
if n <= 0:
break
for... | code_fim | medium | {
"lang": "python",
"repo": "HenriqueSoares28/Python-EX",
"path": "/ex067.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sharikhh/Cancer-Prediction-through-Machine-Learning path: /Cancer Prediction/my final/flask_cancer.py
import os
mycwd = 'C:\\Users\\ASUS\\Desktop\\sharikhh\\Data Science\\Machine Learning 2\\Project\\Final File\\my final'
os.chdir(mycwd)
os.getcwd()
#os.listdir()
# an object of WSGI applicat... | code_fim | hard | {
"lang": "python",
"repo": "sharikhh/Cancer-Prediction-through-Machine-Learning",
"path": "/Cancer Prediction/my final/flask_cancer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#app = Flask(__name__)
logreg = pickle.load(open('Final_Model.pkl', 'rb'))
@app.route('/')
def home():
return render_template('demo_logreg.html')
@app.route('/predict',methods=['POST'])
def predict():
'''
For rendering results on HTML GUI
'''
input_features = [float(x) ... | code_fim | medium | {
"lang": "python",
"repo": "sharikhh/Cancer-Prediction-through-Machine-Learning",
"path": "/Cancer Prediction/my final/flask_cancer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/predict',methods=['POST'])
def predict():
'''
For rendering results on HTML GUI
'''
input_features = [float(x) for x in request.form.values()]
final_features = np.array(input_features)
query = final_features.reshape(1,-1)
output = variety_mappings[logreg.pr... | code_fim | medium | {
"lang": "python",
"repo": "sharikhh/Cancer-Prediction-through-Machine-Learning",
"path": "/Cancer Prediction/my final/flask_cancer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nuria/study path: /EPI/17_interval_covering.py
#!usr/local/bin
# returns a set with best visisting times
import heapdict
def best_visiting_times(I):
<|fim_suffix|> return result
if __name__=="__main__":
I = [[0,3], [2,6],[3,4],[6,9]]
I = [[1,2], [2,3], [3,4],[2,3],[3,4],[4,5]]
... | code_fim | hard | {
"lang": "python",
"repo": "nuria/study",
"path": "/EPI/17_interval_covering.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return result
if __name__=="__main__":
I = [[0,3], [2,6],[3,4],[6,9]]
I = [[1,2], [2,3], [3,4],[2,3],[3,4],[4,5]]
print best_visiting_times(I)<|fim_prefix|># repo: nuria/study path: /EPI/17_interval_covering.py
#!usr/local/bin
# returns a set with best visisting times
import heapdict
... | code_fim | hard | {
"lang": "python",
"repo": "nuria/study",
"path": "/EPI/17_interval_covering.py",
"mode": "spm",
"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.