text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: matthewnaranjo/matthewnaranjo.github.io path: /update_posts.py
import sys
import os
from add_posts import AddPosts
class UpdatePosts():
def __init__(self, filename=None):
self.template = 'blog_temp.html'
self.folders = ["text reviews/"]
def find_posts(self):
for ... | code_fim | hard | {
"lang": "python",
"repo": "matthewnaranjo/matthewnaranjo.github.io",
"path": "/update_posts.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> t = []
if len(paragraphs) > 0:
for p in paragraphs:
print(p)
if p != '':
if p.startswith("image*"):
image_ref = p.split("*")[1]
t.append("""<img src="%s" alt="Image" class="img-f... | code_fim | hard | {
"lang": "python",
"repo": "matthewnaranjo/matthewnaranjo.github.io",
"path": "/update_posts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ê pode comprar US${:.2f}! :D'.format(real,dolar))<|fim_prefix|># repo: eurobsonrosa/curso-em-video-python path: /ex010.py
print('='*20+' REAL PARA DÓLAR '+'='*20)
real = f<|fim_middle|>loat(input('Quanto dinheiro você tem em reais:'))
dolar = real//4.15
print('Com R${:.2f} reais voc | code_fim | medium | {
"lang": "python",
"repo": "eurobsonrosa/curso-em-video-python",
"path": "/ex010.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eurobsonrosa/curso-em-video-python path: /ex010.py
print('='*20+' REAL PARA DÓLAR '+'='*20)
real = f<|fim_suffix|>
dolar = real//4.15
print('Com R${:.2f} reais você pode comprar US${:.2f}! :D'.format(real,dolar))<|fim_middle|>loat(input('Quanto dinheiro você tem em reais:')) | code_fim | easy | {
"lang": "python",
"repo": "eurobsonrosa/curso-em-video-python",
"path": "/ex010.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>load_image = Button(frame, text="Load Image", command=image_load)
load_image.pack(side=TOP, fill=X)
path = Entry(frame) # text entry field, for Load image
path.pack(side=TOP, fill=X)
photo = PhotoImage(file="blankThumbnail.gif")
display_image = Label(frame, image=photo)
display_image.photo = photo
disp... | code_fim | hard | {
"lang": "python",
"repo": "FriedYeti/python-image-covolution",
"path": "/image_convolution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>frame_right_fourth = Frame(frame_right) #holds third row of convolution matrix
frame_right_fourth.pack(side=TOP)
frame_right_fifth = Frame(frame_right) #hold error message
frame_right_fifth.pack(side=TOP)
update_matrix_button = Button(frame_right_first, text="Update Matrix", command=update_matrix)
updat... | code_fim | hard | {
"lang": "python",
"repo": "FriedYeti/python-image-covolution",
"path": "/image_convolution.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def post(self, root, _array):
if not root:
return 0
else:
self.hou(self, self.left, _array)
self.hou(self, self.right, _array)
_array.append(root.value)<|fim_prefix|># repo: buhuipao/LeetCode path: /2017/tree/tree.py
# _*_ coding: utf-8 ... | code_fim | hard | {
"lang": "python",
"repo": "buhuipao/LeetCode",
"path": "/2017/tree/tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not root:
return 0
else:
_array.append(root.value)
self.xian(self, root.left, _array)
self.xian(self, root.right, _array)
def mid(self, root, _array):
if not root:
return 0
else:
self.zhong(self... | code_fim | hard | {
"lang": "python",
"repo": "buhuipao/LeetCode",
"path": "/2017/tree/tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: buhuipao/LeetCode path: /2017/tree/tree.py
# _*_ coding: utf-8 _*_
# 树的先序,中序,后序递归遍历
class Tree(object):
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def convert(self, root):
<|fim_suffix|> def post(self, root, _array):
... | code_fim | hard | {
"lang": "python",
"repo": "buhuipao/LeetCode",
"path": "/2017/tree/tree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> phrases = []
words = nltk.word_tokenize(line) #split the text in words
phrase = ''
for word in words:
if word not in stopwords.words('english'):
phrase+=word + ' '
else:
if phrase != '':
phrases.append(phrase.strip())
phrase = ''
return phrases
# # response
f = open('textlist... | code_fim | medium | {
"lang": "python",
"repo": "Abhi591/NLP-",
"path": "/AssignKeyPhrases.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Abhi591/NLP- path: /AssignKeyPhrases.py
#---------------------------PROBLEM STATEMENT 2-----------------------------------
import re
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
<|fim_suffix|> phrases = []
words = nltk.word_tokenize(line) #spli... | code_fim | medium | {
"lang": "python",
"repo": "Abhi591/NLP-",
"path": "/AssignKeyPhrases.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jwilson1172/Algorithms path: /single_number/single_number.py
'''
Input: a List of integers where every int except one shows up twice
Returns: an integer
'''
<|fim_suffix|>
if __name__ == '__main__':
# Use the main function to test your implementation
arr = [1, 1, 4, 4, 5, 5, 3, 3, 9, 0,... | code_fim | hard | {
"lang": "python",
"repo": "Jwilson1172/Algorithms",
"path": "/single_number/single_number.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Your code here
cursor = 0
while cursor != len(arr):
# check if the current element is the same as the next element if so
# jump to the next tuple
if arr[cursor] == arr[cursor + 1]:
cursor += 2
print("found 2 {} skipping this number".format(arr[... | code_fim | medium | {
"lang": "python",
"repo": "Jwilson1172/Algorithms",
"path": "/single_number/single_number.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class addMoneyForm(forms.ModelForm):
class Meta():
model = representativePush
fields = ('pushMoney',)<|fim_prefix|># repo: pandeyroshan/Saleor path: /saleor/dashboard/University/forms.py
from django import forms
import inspect
from ...University.models import University, consignment,... | code_fim | medium | {
"lang": "python",
"repo": "pandeyroshan/Saleor",
"path": "/saleor/dashboard/University/forms.py",
"mode": "spm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pandeyroshan/Saleor path: /saleor/dashboard/University/forms.py
from django import forms
import inspect
from ...University.models import University, consignment,representativePush, representative
from ...account.models import User
class CreateUniversity(forms.ModelForm):
class Meta():
... | code_fim | medium | {
"lang": "python",
"repo": "pandeyroshan/Saleor",
"path": "/saleor/dashboard/University/forms.py",
"mode": "psm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def generate_map(self):
# configuration
value_base = 30
value_head = 60
income_base = 30
income_head = 60
multiple = 10
sumper_multiple = 5
# Add blocks
prevalue = -1
preincome = -1
namepool = blockname[... | code_fim | hard | {
"lang": "python",
"repo": "MiniMelissa/RichWomen",
"path": "/map.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Generate normal and super blocks
for i in range(0, self.msize):
# super blocks
if random.randint(1, 100) >=80 :
name = blockname.pop(random.randint(0, len(blockname)-1))
value = random.randint(value_base, value_head) * multiple * s... | code_fim | hard | {
"lang": "python",
"repo": "MiniMelissa/RichWomen",
"path": "/map.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MiniMelissa/RichWomen path: /map.py
# -*- coding: UTF-8 -*-
import random
class block:
#################################################################
# Initialize #
# btype: block type = 'normal' OR 'super' OR 'jail'(TODO) ... | code_fim | hard | {
"lang": "python",
"repo": "MiniMelissa/RichWomen",
"path": "/map.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('audios', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='audioclass',
options={'verbose_name': 'Audio class', 'verbose_name_plural': 'Audio classes'},
),
migrations.AlterModelOptions(
... | code_fim | medium | {
"lang": "python",
"repo": "zekzit/audioclassweekly",
"path": "/audios/migrations/0002_auto_20210223_2042.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterModelOptions(
name='audioclass',
options={'verbose_name': 'Audio class', 'verbose_name_plural': 'Audio classes'},
),
migrations.AlterModelOptions(
name='audioclassweek',
options={'verbose_name': 'Aud... | code_fim | medium | {
"lang": "python",
"repo": "zekzit/audioclassweekly",
"path": "/audios/migrations/0002_auto_20210223_2042.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zekzit/audioclassweekly path: /audios/migrations/0002_auto_20210223_2042.py
# Generated by Django 3.1.7 on 2021-02-23 13:42
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterModelOptions(
name='audioclass',
options={'verbo... | code_fim | medium | {
"lang": "python",
"repo": "zekzit/audioclassweekly",
"path": "/audios/migrations/0002_auto_20210223_2042.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return list(map(int, input().split()))
def trans_li_int_sp():
return list(map(list, (zip(*[li_int_sp() for _ in range(N)]))))
import pdb
import math
ABC = li_int_sp()
gcds = math.gcd(math.gcd(ABC[0],ABC[1]), ABC[2])
pdb.set_trace()
output = 0
for i in ABC:
output += i//gcds-1
print(outp... | code_fim | easy | {
"lang": "python",
"repo": "rikukawamura/atcoder",
"path": "/典型90問/022.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
ABC = li_int_sp()
gcds = math.gcd(math.gcd(ABC[0],ABC[1]), ABC[2])
pdb.set_trace()
output = 0
for i in ABC:
output += i//gcds-1
print(output)<|fim_prefix|># repo: rikukawamura/atcoder path: /典型90問/022.py
def int_sp():
return map(int, input().split())
<|fim_middle|>
def li_int_sp():
return ... | code_fim | medium | {
"lang": "python",
"repo": "rikukawamura/atcoder",
"path": "/典型90問/022.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rikukawamura/atcoder path: /典型90問/022.py
def int_sp():
return map(int, input().split())
def li_int_sp():
return list(map(int, input().split()))
def trans_li_int_sp():
return list(map(list, (zip(*[li_int_sp() for _ in range(N)]))))
<|fim_suffix|>ABC = li_int_sp()
gcds = math.gcd(... | code_fim | easy | {
"lang": "python",
"repo": "rikukawamura/atcoder",
"path": "/典型90問/022.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nmfta-repo/nmfta-opentelematics-prototype path: /sdk/python/v0.1-rc.4/opentelematicsapi/models/driver.py
# -*- coding: utf-8 -*-
"""
opentelematicsapi
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class Driver(object):
"""Implementation of th... | code_fim | hard | {
"lang": "python",
"repo": "nmfta-repo/nmfta-opentelematics-prototype",
"path": "/sdk/python/v0.1-rc.4/opentelematicsapi/models/driver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_transferfrom_reverts_due_to_insufficient_owner_balance(
adam, beth, token, accounts
):
token.approve(beth, 10 ** 24, {"from": adam})
with brownie.reverts("dev: Insufficient balance"):
token.transferFrom(adam, accounts[2], 10 ** 21 + 1, {"from": beth})
def test_transferfrom_r... | code_fim | medium | {
"lang": "python",
"repo": "skellet0r/CloudToken",
"path": "/tests/token/test_transferfrom.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skellet0r/CloudToken path: /tests/token/test_transferfrom.py
import pytest
import brownie
@pytest.fixture(autouse=True, scope="module")
def set_approval(adam, beth, token):
token.approve(beth, 10 ** 18, {"from": adam})
def test_transferfrom_descreases_owner_balance(adam, beth, token, acco... | code_fim | medium | {
"lang": "python",
"repo": "skellet0r/CloudToken",
"path": "/tests/token/test_transferfrom.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
path('', views.index, name='index'),
path('learn/<learning_code>', views.learning_view, name='learning'),
path('learn/<learning_code>/<unit_slug>', views.lesson_view, name='lesson'),
]<|fim_prefix|># repo: bestchanges/studyworthy path: /djangoapps/campus/urls.py
from django.ur... | code_fim | easy | {
"lang": "python",
"repo": "bestchanges/studyworthy",
"path": "/djangoapps/campus/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bestchanges/studyworthy path: /djangoapps/campus/urls.py
from django.urls import path
from . import views
<|fim_suffix|>urlpatterns = [
path('', views.index, name='index'),
path('learn/<learning_code>', views.learning_view, name='learning'),
path('learn/<learning_code>/<unit_slug>', ... | code_fim | easy | {
"lang": "python",
"repo": "bestchanges/studyworthy",
"path": "/djangoapps/campus/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>zation_NoLossUp import LossDiffAvgMaximization_NoLossUp<|fim_prefix|># repo: 2bright/adapow2 path: /adapow2/x/__init__.py
from .MultiStepProbing import MultiStepProbing
from .N<|fim_middle|>oLossUp import NoLossUp
from .LossDiffAvgMaximization import LossDiffAvgMaximization
from .LossDiffAvgMaximi | code_fim | medium | {
"lang": "python",
"repo": "2bright/adapow2",
"path": "/adapow2/x/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 2bright/adapow2 path: /adapow2/x/__init__.py
from .MultiStepProbing import MultiStepProbing
from .NoLossUp import NoLossUp
from .LossDiffAvgMaximization <|fim_suffix|>zation_NoLossUp import LossDiffAvgMaximization_NoLossUp<|fim_middle|>import LossDiffAvgMaximization
from .LossDiffAvgMaximi | code_fim | easy | {
"lang": "python",
"repo": "2bright/adapow2",
"path": "/adapow2/x/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Dropping ManyToManyField 'UserCriterion.users'
db.delete_table('criteria_usercriterion_users')
# Dropping ManyToManyField 'CountryCriterion.countries'
db.delete_table('criteria_countrycriterion_countries')
models = {
'criteria.weigh... | code_fim | hard | {
"lang": "python",
"repo": "feuervogel/lfs",
"path": "/criteria/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Deleting model 'CountryCriterion'
db.delete_table('criteria_countrycriterion')
# Deleting model 'LengthCriterion'
db.delete_table('criteria_lengthcriterion')
# Deleting model 'CartPriceCriterion'
db.delete_table('criteria_cartpricecriteri... | code_fim | hard | {
"lang": "python",
"repo": "feuervogel/lfs",
"path": "/criteria/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: feuervogel/lfs path: /criteria/migrations/0001_initial.py
from south.db import db
from django.db import models
from lfs.criteria.models import *
class Migration:
def forwards(self, orm):
# Adding model 'WeightCriterion'
db.create_table('criteria_weightcriterion... | code_fim | hard | {
"lang": "python",
"repo": "feuervogel/lfs",
"path": "/criteria/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LinderPi/transport-transparent-backend path: /api/migrations/0009_alter_route_delivery.py
# Generated by Django 3.2 on 2021-05-11 07:43
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('api', '0008_auto_20210510_1805'),
]
operations = [
migrat... | code_fim | easy | {
"lang": "python",
"repo": "LinderPi/transport-transparent-backend",
"path": "/api/migrations/0009_alter_route_delivery.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('api', '0008_auto_20210510_1805'),
]
operations = [
migrations.AlterField(
model_name='route',
name='delivery',
field=models.CharField(choices=[('internal', 'internal'), ('in', 'in'), ('out', 'out')], default='internal', ma... | code_fim | easy | {
"lang": "python",
"repo": "LinderPi/transport-transparent-backend",
"path": "/api/migrations/0009_alter_route_delivery.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bhatnagaranshika02/Deep-Learning path: /deeplearn1.py
import numpy as np
input_data = np.array([2,3])
weights = {'node_0':np.array([1,1]),
'node_1':np.array([-1,1]),
'output':np.array([2,-1])}
node_0_value = (input_data * weights['node_0'].sum)<|fim_suffix|>_value])
print(hid... | code_fim | medium | {
"lang": "python",
"repo": "bhatnagaranshika02/Deep-Learning",
"path": "/deeplearn1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
node_1_value = (input_data * weights['node_1'].sum)
hidden_layer_values = np.array([node_0_value , node_1_value])
print(hidden_layer_values)
output = (hidden_layer_values * weights['output']).sum()
print(output)<|fim_prefix|># repo: bhatnagaranshika02/Deep-Learning path: /deeplearn1.py
import numpy as n... | code_fim | medium | {
"lang": "python",
"repo": "bhatnagaranshika02/Deep-Learning",
"path": "/deeplearn1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ELFRoger/NetAnalyzer path: /clusters/web_fingerprint_cluster.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.path.append('../')
from sklearn.cluster import KMeans
from sklearn.cluster import AgglomerativeClustering
from sklearn.cluster import Birch
import joblib
from sklearn impo... | code_fim | hard | {
"lang": "python",
"repo": "ELFRoger/NetAnalyzer",
"path": "/clusters/web_fingerprint_cluster.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def cosion_kmeans():
n_clust = 1000
cosion_cluster = clusters.cosion_kmeans.CosineMeans()
cosion_cluster.set_n_cluster(n_clust)
# 需要进行聚类的数据集
data = get_feature()
matrix_data = scipy.sparse.csr_matrix(data)
#log
libs.logger.log('cosion k-means begining......'+str(n_clust))
... | code_fim | hard | {
"lang": "python",
"repo": "ELFRoger/NetAnalyzer",
"path": "/clusters/web_fingerprint_cluster.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DmitryVlaznev/leetcode path: /647-palindromic-substrings.py
# 647. Palindromic Substrings
# Medium
# Given a string, your task is to count how many palindromic substrings
# in this string.
# The substrings with different start indexes or end indexes are counted
# as different substrings even t... | code_fim | medium | {
"lang": "python",
"repo": "DmitryVlaznev/leetcode",
"path": "/647-palindromic-substrings.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>t = Solution()
print(t.countSubstrings("abc"))
print(t.countSubstrings("aaa"))
print(t.countSubstrings("abcdcba"))
print(t.countSubstrings("xabceece"))<|fim_prefix|># repo: DmitryVlaznev/leetcode path: /647-palindromic-substrings.py
# 647. Palindromic Substrings
# Medium
# Given a string, your task is ... | code_fim | hard | {
"lang": "python",
"repo": "DmitryVlaznev/leetcode",
"path": "/647-palindromic-substrings.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # check odds
for i in range(l):
p = q = i
while p >= 0 and q < l and s[p] == s[q]:
res = res + 1 if s[p : q + 1] else res
p, q = p - 1, q + 1
# check evens
for i in range(l - 1):
p, q = i, i + 1
... | code_fim | medium | {
"lang": "python",
"repo": "DmitryVlaznev/leetcode",
"path": "/647-palindromic-substrings.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>_equation([1,1], [2,3])
loss.check_path()<|fim_prefix|># repo: JJFrampton/projects_games_hero_quest2 path: /actions/line_of_sight_simple_directional_example.py
from line_of_sight_simple_directional import LineOfSightSimpleDirectional
loss =<|fim_middle|> LineOfSightSimpleDirectional()
loss.set | code_fim | easy | {
"lang": "python",
"repo": "JJFrampton/projects_games_hero_quest2",
"path": "/actions/line_of_sight_simple_directional_example.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JJFrampton/projects_games_hero_quest2 path: /actions/line_of_sight_simple_directional_example.py
from line_of_sight_simple_directional im<|fim_suffix|> LineOfSightSimpleDirectional()
loss.set_equation([1,1], [2,3])
loss.check_path()<|fim_middle|>port LineOfSightSimpleDirectional
loss = | code_fim | easy | {
"lang": "python",
"repo": "JJFrampton/projects_games_hero_quest2",
"path": "/actions/line_of_sight_simple_directional_example.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def print_text(self, text):
full_text = textwrap.fill(text, width=180)
height = (full_text.count('\n') + 1) * 11 + 1
img = Image.new("RGB", (self.x_size, height), (0, 0, 0))
fnt = ImageFont.truetype("FreeSans", 11)
d = ImageDraw.Draw(img)
d.multili... | code_fim | hard | {
"lang": "python",
"repo": "commandblockguy/userbar-chat",
"path": "/controller.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def await_event(self):
if self.event.wait(timeout=30.0):
self.event.clear()
event = self.events.pop(0)
print('event:', event)
return event
else:
return None
def print_text(self, text):
full_text = textwr... | code_fim | hard | {
"lang": "python",
"repo": "commandblockguy/userbar-chat",
"path": "/controller.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: commandblockguy/userbar-chat path: /controller.py
import time, uuid, threading, textwrap
from enum import Enum, auto
import numpy as np
from PIL import Image, ImageDraw, ImageFont
import png
class StreamController():
def __init__(self, x_size, y_size):
self.event = threading.... | code_fim | hard | {
"lang": "python",
"repo": "commandblockguy/userbar-chat",
"path": "/controller.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SofBro/DZ path: /sunset.py
# Напишите программу, которая обрабатывает результаты IQ-теста из файла “2-in.txt".
# В файле лежат несколько строк со значениями(не менее 4-х).
# Программа должна<|fim_suffix|> a.append(line)
f.close()
b = []*3*len(a)
for i in range(len(a)):
s = a[i].split(' ... | code_fim | medium | {
"lang": "python",
"repo": "SofBro/DZ",
"path": "/sunset.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> a.append(line)
f.close()
b = []*3*len(a)
for i in range(len(a)):
s = a[i].split(' ')
for k in range(len(s)):
if s[k].isdigit() == t:
n.append(s[k])
n = map(int, n)
n = sorted(n)
for h in range(len(n) - 3, len(n)):
b.append(n[h])
n = []
prin... | code_fim | medium | {
"lang": "python",
"repo": "SofBro/DZ",
"path": "/sunset.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''循环测试该目标框和哪一个目标更加的匹配,iou的值最大'''
for size in self.set.boxes_base:
stride = 416 // size
index_h = c_y // stride
index_w = c_x // stride
offset_x = (c_x % stride) / stride
offset_y = (c_y % stride) / str... | code_fim | hard | {
"lang": "python",
"repo": "shituo123456/Learn-DeepLearning",
"path": "/project3/YOLOWithMobileNet/DATASET.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shituo123456/Learn-DeepLearning path: /project3/YOLOWithMobileNet/DATASET.py
from torch.utils.data import Dataset, DataLoader
import cv2
import torch
from project3.YOLOWithMobileNet.SET import Set
import numpy as np
from math import log
class Voc2012DataSet(Dataset):
def __init__(self, ima... | code_fim | hard | {
"lang": "python",
"repo": "shituo123456/Learn-DeepLearning",
"path": "/project3/YOLOWithMobileNet/DATASET.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> image_path, boxes = self.dataset[item]
image = cv2.imread(image_path)
image_tensor = torch.from_numpy(image).float() / 255
image_tensor = image_tensor.permute(2, 0, 1)
targets_13 = torch.zeros((13, 13, 3, 6), dtype=torch.float32)
targets_26 = torch.zeros((26... | code_fim | hard | {
"lang": "python",
"repo": "shituo123456/Learn-DeepLearning",
"path": "/project3/YOLOWithMobileNet/DATASET.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='discussor',
name='reply_to',
field=models.ForeignKey(related_name='reply_to', to='discussion.DiscussionReply'),
),
]<|fim_prefix|># repo: dopecoder/Viewanalyze path: /discussion/migrations/0011_a... | code_fim | medium | {
"lang": "python",
"repo": "dopecoder/Viewanalyze",
"path": "/discussion/migrations/0011_auto_20150805_2104.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dopecoder/Viewanalyze path: /discussion/migrations/0011_auto_20150805_2104.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='discussor',
... | code_fim | medium | {
"lang": "python",
"repo": "dopecoder/Viewanalyze",
"path": "/discussion/migrations/0011_auto_20150805_2104.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('discussion', '0010_auto_20150805_2052'),
]
operations = [
migrations.AlterField(
model_name='discussor',
name='reply_to',
field=models.ForeignKey(related_name='reply_to', to='discussion.DiscussionReply'),
),
]<... | code_fim | easy | {
"lang": "python",
"repo": "dopecoder/Viewanalyze",
"path": "/discussion/migrations/0011_auto_20150805_2104.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: serhataras/Music-Recommender-based-on-Melody path: /source/ItemToItemCollaborativeFiltering/NNRecommendation.py
import pickle
import math
import numpy as np
from sklearn.manifold import TSNE
from scipy.spatial import KDTree
class NNRecommendation:
def __init__(self, path, dataSize, leafSize)... | code_fim | hard | {
"lang": "python",
"repo": "serhataras/Music-Recommender-based-on-Melody",
"path": "/source/ItemToItemCollaborativeFiltering/NNRecommendation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.kdtree.query(data, self.leafSize)
data_size = 662
nnr = NNRecommendation("Dataset/", data_size, 21)
nnr.preprocess()
nnr.generate_kdtree()
for i in range(data_size):
print("id: " + str(nnr.id[i]) + "; metadata: " + str(nnr.meta[i]) + "\nneighbours:")
print(nnr.query(nnr.tsne[i... | code_fim | hard | {
"lang": "python",
"repo": "serhataras/Music-Recommender-based-on-Melody",
"path": "/source/ItemToItemCollaborativeFiltering/NNRecommendation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _load_mnist(self, rootfolder, is_training, dtype):
if is_training:
self._data = self._read_byte_data(
os.path.join(rootfolder,'train-images-idx3-ubyte'),
16, (MNISTDataLayer.NUM_TRAIN,) + \
MNISTDataLayer.IMAG... | code_fim | hard | {
"lang": "python",
"repo": "UCBAIR/decaf-release",
"path": "/decaf/layers/data/mnist.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _read_byte_data(self, filename, skipbytes, shape):
fid = open(filename, 'rb')
fid.seek(skipbytes)
nbytes = np.prod(shape)
data = np.fromfile(fid, dtype=np.uint8, count=nbytes)
data.resize(shape)
return data<|fim_prefix|># repo: UCBAIR/decaf-release ... | code_fim | hard | {
"lang": "python",
"repo": "UCBAIR/decaf-release",
"path": "/decaf/layers/data/mnist.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: UCBAIR/decaf-release path: /decaf/layers/data/mnist.py
'''The MNIST dataset
'''
from decaf.layers.data import ndarraydata
import numpy as np
import os
class MNISTDataLayer(ndarraydata.NdarrayDataLayer):
NUM_TRAIN = 60000
NUM_TEST = 10000
IMAGE_DIM = (28,28)
def __init__(sel... | code_fim | hard | {
"lang": "python",
"repo": "UCBAIR/decaf-release",
"path": "/decaf/layers/data/mnist.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hectoregm/deep-computer-vision path: /3.05.1-test_alexnet.py
import faulthandler; faulthandler.enable()
from config import imagenet_alexnet_config as config
import mxnet as mx
import argparse
import json
import os
ap = argparse.ArgumentParser()
ap.add_argument("-c", "--checkpoints", required=Tru... | code_fim | hard | {
"lang": "python",
"repo": "hectoregm/deep-computer-vision",
"path": "/3.05.1-test_alexnet.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("[INFO] loading model...")
checkpointsPath = os.path.sep.join([args["checkpoints"], args["prefix"]])
model = mx.model.FeedForward.load(checkpointsPath, args["epoch"])
model = mx.model.FeedForward(
ctx=[mx.gpu(0)],
symbol=model.symbol,
arg_params=model.arg_params,
aux_params=model.au... | code_fim | hard | {
"lang": "python",
"repo": "hectoregm/deep-computer-vision",
"path": "/3.05.1-test_alexnet.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> total_error_count = 0
for file_name in sys.argv[1:]:
file_path = pathlib.Path(file_name)
module = ast.parse(file_path.read_text("utf-8"), str(file_path))
finder = LogFinder()
finder.name = file_name
finder.walk(node=module)
total_error_count += finde... | code_fim | hard | {
"lang": "python",
"repo": "apache/airflow",
"path": "/scripts/ci/pre_commit/pre_commit_check_lazy_logging.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apache/airflow path: /scripts/ci/pre_commit/pre_commit_check_lazy_logging.py
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copy... | code_fim | medium | {
"lang": "python",
"repo": "apache/airflow",
"path": "/scripts/ci/pre_commit/pre_commit_check_lazy_logging.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whalerock/netstorage path: /netstorage/utils.py
from . import exceptions
import logging
import os
import urllib
log = logging.getLogger(__name__)
<|fim_suffix|>
def stream_to_file(response, destination):
"""Write contents of response to a file.
:param response response: (required) requ... | code_fim | medium | {
"lang": "python",
"repo": "whalerock/netstorage",
"path": "/netstorage/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def stream_to_file(response, destination):
"""Write contents of response to a file.
:param response response: (required) requests.response
:param destination str: (required) Destination to save file
:returns: `str` file destination
"""
if response.status_code != 200:
raise... | code_fim | medium | {
"lang": "python",
"repo": "whalerock/netstorage",
"path": "/netstorage/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RainYang0925/IOSUIAutoTest path: /UIAWindows/register_sign_windows/login_guide_camera_window.py
# -*-coding:utf8-*-
################################################################################
#
#
#
################################################################################
"""
模块用法说明:... | code_fim | hard | {
"lang": "python",
"repo": "RainYang0925/IOSUIAutoTest",
"path": "/UIAWindows/register_sign_windows/login_guide_camera_window.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ***********************操作方法*********************************
def tap_skip_button(self, skip=True):
"""
Summary:
跳过引导
Args:
skip:True:点击提示框的跳过按钮,False:点击提示框的拍一张按钮
"""
log.logger.info("点击跳过引导页")
self.skip_guid... | code_fim | hard | {
"lang": "python",
"repo": "RainYang0925/IOSUIAutoTest",
"path": "/UIAWindows/register_sign_windows/login_guide_camera_window.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if name in context:
raise Exception("tried to double define %s" % name)
if type(value) == str:
context[name] = value
profiler.add_event(RacketDefineSucess("added the name: %s w/ value %s to context." % name, value))
return context
elif type(value) == list:
... | code_fim | hard | {
"lang": "python",
"repo": "ashdawngary/StarSLProfiler",
"path": "/defines.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = code[1]
value = code[2]
if type(name) != str:
profiler.add_event(RacketDefineError(code, name, "racket doesnt allow dynamic naming of identifers:"))
raise Exception("racket doesnt allow dynamic naming of identifers: %s" % name)
if name in context:
raise Exce... | code_fim | hard | {
"lang": "python",
"repo": "ashdawngary/StarSLProfiler",
"path": "/defines.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ashdawngary/StarSLProfiler path: /defines.py
from typing import Dict, List
from profileNode import Profiler, RacketDefineError, RacketDefineSucess, genesis
from evalexpr import evalexpr, lam
from printing import pttyobj
from structops import makestruct
def handle_define(gc, code, pf_node: Prof... | code_fim | hard | {
"lang": "python",
"repo": "ashdawngary/StarSLProfiler",
"path": "/defines.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "4. Call funtion with string variables"
a, b = 'snake', 'mouse'
my_function(a, b)
print "5. Values from other functions, here is randint:"
import random
my_function(random.randint(1,100), random.randint(1,100))
print "6. Values from raw input:"
d = raw_input("Please enter a value to be su... | code_fim | medium | {
"lang": "python",
"repo": "acenturione/LPTHW",
"path": "/ex19_SD3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "5. Values from other functions, here is randint:"
import random
my_function(random.randint(1,100), random.randint(1,100))
print "6. Values from raw input:"
d = raw_input("Please enter a value to be summed:")
my_function(d, d)
print "7. Values from math in function"
my_function(4 + 6, 5 +... | code_fim | hard | {
"lang": "python",
"repo": "acenturione/LPTHW",
"path": "/ex19_SD3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acenturione/LPTHW path: /ex19_SD3.py
# Learn Python the Hard Way Exercise 19 SD3
def my_function(arg1, arg2):
print "summing arg1: %r and arg2: %r..." % (arg1, arg2)
print arg1 + arg2
print "1. Call function by inserting numbers:"
my_function(4, 44)
<|fim_suffix|>print "7. Val... | code_fim | hard | {
"lang": "python",
"repo": "acenturione/LPTHW",
"path": "/ex19_SD3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whiplus2/Junction2020 path: /python-server/junction/aitojunction/migrations/0005_auto_20201107_1403.py
# Generated by Django 3.0.8 on 2020-11-07 14:03
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddField(
... | code_fim | hard | {
"lang": "python",
"repo": "whiplus2/Junction2020",
"path": "/python-server/junction/aitojunction/migrations/0005_auto_20201107_1403.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='place',
name='congestion',
field=models.CharField(choices=[('red', 'red'), ('yellow', 'yellow'), ('green', 'green')], default='green', max_length=16),
),
migrations.AddField(
model_n... | code_fim | hard | {
"lang": "python",
"repo": "whiplus2/Junction2020",
"path": "/python-server/junction/aitojunction/migrations/0005_auto_20201107_1403.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #ensures ship will fit on plane
column1=column
while column+(size-1) > 9:
column = randint(0,9)
if column > 9:
column = column1
#creates ship
for i in range(size):
aArray[level][row][column]="S"
column+=1
return aArray... | code_fim | hard | {
"lang": "python",
"repo": "christinolb/DataStructures",
"path": "/Battleship.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
#creating array
aArray = [[["-" for j in range(10)]for j in range(10)]for j in range(3)]
bArray = [[["-" for j in range(10)]for j in range(10)]for j in range(3)]
#list of ship sizes
sizes = [2,3,3,4,5]
clear = False
#creating 5 ships... | code_fim | hard | {
"lang": "python",
"repo": "christinolb/DataStructures",
"path": "/Battleship.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: christinolb/DataStructures path: /Battleship.py
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 8 13:31:03 2020
@author: chris
"""
from random import randint
def hint(l,r,c, aArray):
try:
if aArray[l][r-1][c] == "S":
return "(above)"
if aArray[l][r+1][c] == "S":
... | code_fim | hard | {
"lang": "python",
"repo": "christinolb/DataStructures",
"path": "/Battleship.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LiaaooiL/dqn path: /dqn_pytorch_cartpole/stable_baselines_dqn_swingup.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 11 22:24:49 2021
@author: dell
"""
import gym
import numpy as np
import cartpole_swingup_envs
<|fim_suffix|>#model = DQN(MlpPolicy, env, verbose=1)
mod... | code_fim | medium | {
"lang": "python",
"repo": "LiaaooiL/dqn",
"path": "/dqn_pytorch_cartpole/stable_baselines_dqn_swingup.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>obs = env.reset()
while True:
action, _states = model.predict(obs, deterministic=True)
obs, reward, done, info = env.step(action)
env.render()
if done:
obs = env.reset()<|fim_prefix|># repo: LiaaooiL/dqn path: /dqn_pytorch_cartpole/stable_baselines_dqn_swingup.py
#!/usr/bin/env pyth... | code_fim | hard | {
"lang": "python",
"repo": "LiaaooiL/dqn",
"path": "/dqn_pytorch_cartpole/stable_baselines_dqn_swingup.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>:2d}'.format(val), end='')
idx += 1
idx = 0
print()<|fim_prefix|># repo: dantsub/holbertonschool-higher_level_programming path: /0x03-python-data_structures/6-print_matrix_integer.py
#!/usr/bin/python3
def print_matrix_integer(matrix=[[]]):
idx = 0
for row in matrix:
... | code_fim | hard | {
"lang": "python",
"repo": "dantsub/holbertonschool-higher_level_programming",
"path": "/0x03-python-data_structures/6-print_matrix_integer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dantsub/holbertonschool-higher_level_programming path: /0x03-python-data_structures/6-print_matrix_integer.py
#!/usr/bin/python3
def print_matrix_integer(matrix=[[]]):
idx = 0
for <|fim_suffix|> print('{:d}'.format(val), end='')
else:
print('{:2d}'.format(val... | code_fim | hard | {
"lang": "python",
"repo": "dantsub/holbertonschool-higher_level_programming",
"path": "/0x03-python-data_structures/6-print_matrix_integer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>!python train.py --label_nc 0 --no_instance --name w --dataroot /content/drive/My\ Drive/pix2pixHD-colab/pix2pixHD/datasets/w --continue_train --display_freq 100 --checkpoints_dir /content/drive/My\ Drive/pix2pixHD-colab/pix2pixHD/checkpoints --which_epoch latest --save_epoch_freq 10<|fim_prefix|># repo: ... | code_fim | hard | {
"lang": "python",
"repo": "MohamedWalid22/Realistic-face-images-from-sketches",
"path": "/gp_project_colab.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MohamedWalid22/Realistic-face-images-from-sketches path: /gp_project_colab.py
# -*- coding: utf-8 -*-
"""GP_project_Colab
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1MGNXlydcYgFRoAd6NC_EZtLdbv5MM7kk
<|fim_suffix|>!python tra... | code_fim | hard | {
"lang": "python",
"repo": "MohamedWalid22/Realistic-face-images-from-sketches",
"path": "/gp_project_colab.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alemazzo/Pi-Cinema path: /SerieTv/admin.py
from django.contrib import admin
from .models import *
# Register your models here.
a<|fim_suffix|>ter(Stagione)
admin.site.register(Episodio)<|fim_middle|>dmin.site.register(Serie)
admin.site.regis | code_fim | easy | {
"lang": "python",
"repo": "alemazzo/Pi-Cinema",
"path": "/SerieTv/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ter(Stagione)
admin.site.register(Episodio)<|fim_prefix|># repo: alemazzo/Pi-Cinema path: /SerieTv/admin.py
from django.contrib import admin
from .models import *
# Register your models here.
a<|fim_middle|>dmin.site.register(Serie)
admin.site.regis | code_fim | easy | {
"lang": "python",
"repo": "alemazzo/Pi-Cinema",
"path": "/SerieTv/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>dmin.site.register(Serie)
admin.site.register(Stagione)
admin.site.register(Episodio)<|fim_prefix|># repo: alemazzo/Pi-Cinema path: /SerieTv/admin.py
from django.contrib import admin
from .mod<|fim_middle|>els import *
# Register your models here.
a | code_fim | easy | {
"lang": "python",
"repo": "alemazzo/Pi-Cinema",
"path": "/SerieTv/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hardik9897/xccelerata_internship path: /main.py
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore
cred = credentials.Certificate("venv/serviceAccountKey.json")
firebase_admin.initialize_app(cred)
db = firestore.client()
'''student_data = {}
for ... | code_fim | medium | {
"lang": "python",
"repo": "hardik9897/xccelerata_internship",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#db.collection('student').document("7qephQgRoDlGbJHPyeJc").update({"gender": "female"})
#db.collection('student').document("p1").update({"occupation": "engineer"})
'''dat = db.collection('student').where("age", ">", 20).get() # Get all documents with age >=40
for data in dat:
key = data.id
db.co... | code_fim | hard | {
"lang": "python",
"repo": "hardik9897/xccelerata_internship",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jakubwida/UJ_Sem5_2016_Python_Course path: /Zadania10/zad10_2.py
import unittest
class Stack:
def __init__(self, size=10):
self.items = size * [None] # utworzenie tablicy
self.n = 0 # liczba elementow na stosie
self.size = size
def is_e... | code_fim | hard | {
"lang": "python",
"repo": "jakubwida/UJ_Sem5_2016_Python_Course",
"path": "/Zadania10/zad10_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_full(self):
stack = Stack(5)
self.assertFalse(stack.is_full())
stack.push("a")
self.assertFalse(stack.is_full())
stack.push("b")
stack.push("c")
stack.push("d")
stack.push("e")
self.assertTrue(stack.is_full())
stack.pop()
self.assertFalse(stack.is_full())
def test_errors... | code_fim | hard | {
"lang": "python",
"repo": "jakubwida/UJ_Sem5_2016_Python_Course",
"path": "/Zadania10/zad10_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> stack = Stack(5)
self.assertTrue(stack.is_empty())
stack.push("a")
self.assertFalse(stack.is_empty())
stack.pop()
self.assertTrue(stack.is_empty())
def test_full(self):
stack = Stack(5)
self.assertFalse(stack.is_full())
stack.push("a")
self.assertFalse(stack.is_full())
stack.push("... | code_fim | medium | {
"lang": "python",
"repo": "jakubwida/UJ_Sem5_2016_Python_Course",
"path": "/Zadania10/zad10_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: war16641/python path: /tree.py
import copy
import time
from typing import TypeVar, Generic, List
from GoodToolPython.mybaseclasses.selfdelete import SelfDelete
import wx
from nose.tools import *
T_Node = TypeVar('T_Node')
T_Tree = TypeVar('T_Tree')
rootNode = 'root' # 根节点标志 这个值不重要
class Node(... | code_fim | hard | {
"lang": "python",
"repo": "war16641/python",
"path": "/tree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
通过node上挂载的data寻找node
此算法要求data定义了==操作符
:param data:
:return: 只返回一个符合条件的Node 没找到返回None
"""
for x in self._node_list:
if x.data == data:
return x
return None
def show_in_gui(self, valueexp=None) -> None:
... | code_fim | hard | {
"lang": "python",
"repo": "war16641/python",
"path": "/tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 返回所有的节点
# return self._node_list
def search_in_child_nodes(nds, lst):
# 在子节点列表中搜索
for nd in nds:
if nd.degree == 0: # 为叶
lst.append(nd)
else: # 为枝
lst.append(nd)
... | code_fim | hard | {
"lang": "python",
"repo": "war16641/python",
"path": "/tree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>groupId = input("Please enter a valid groupId")
wallJSON = json.dumps(client.Group.getWall(groupId))
jsonFile = open("groupWall.json", "w")
jsonFile.write(wallJSON)<|fim_prefix|># repo: Jaguar-515/robloxapi-examples path: /src/group/getGroupWall.py
import robloxapi, json
<|fim_middle|>client = robloxapi... | code_fim | easy | {
"lang": "python",
"repo": "Jaguar-515/robloxapi-examples",
"path": "/src/group/getGroupWall.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jaguar-515/robloxapi-examples path: /src/group/getGroupWall.py
import robloxapi, json
<|fim_suffix|>groupId = input("Please enter a valid groupId")
wallJSON = json.dumps(client.Group.getWall(groupId))
jsonFile = open("groupWall.json", "w")
jsonFile.write(wallJSON)<|fim_middle|>client = robloxapi... | code_fim | easy | {
"lang": "python",
"repo": "Jaguar-515/robloxapi-examples",
"path": "/src/group/getGroupWall.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def cl(self):
mask = 0x04
try:
if self.version == 3:
return bool(self.data0[constants.S300V3_CL] & mask)
else:
return {'cl', False}
except IndexError:
return False
def fanc(self):
ma... | code_fim | hard | {
"lang": "python",
"repo": "AdamRJonesHPD/SManager_Tools",
"path": "/s300/s300.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.