text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
if __name__ == '__main__':
atr = load_points('points.txt')
first_solution = initial_solution(atr)
print(first_solution)<|fim_prefix|># repo: wojcikb/MMWD_Project path: /MMWD_Project/p_initial_solution.py
from p_load_points import load_points
import random
def initial_solution(vec):
<|fim_m... | code_fim | hard | {
"lang": "python",
"repo": "wojcikb/MMWD_Project",
"path": "/MMWD_Project/p_initial_solution.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>newfile.close()
s1=["david","John","sara","michael","lucy","Brian"]
newfile=open("1usestoredata.txt","w")
for name in s1:
print(name, file = newfile)
newfile.close()<|fim_prefix|># repo: kapigula458/lecture0-1 path: /fileIO.py
var1=3
var2=34
var3=112
newfile=open("storedata.txt","w")
newfile.write(... | code_fim | hard | {
"lang": "python",
"repo": "kapigula458/lecture0-1",
"path": "/fileIO.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kapigula458/lecture0-1 path: /fileIO.py
var1=3
var2=34
var3=112
newfile=open("storedata.txt","w")
newfile.write(str(var1)+"\n")
newfile.write(str(var2)+"\n")
newfile.write(str(var3)+"\n")
newfile.close()
s1=["david","John","sara","michael","lucy","Brian"]
newfile=open("dostoredata.txt","w")
... | code_fim | medium | {
"lang": "python",
"repo": "kapigula458/lecture0-1",
"path": "/fileIO.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PinkD/rime-pinyin-zhwiki path: /word_frequency.py
import jieba
from collections import defaultdict
def cut(s: str) -> list:
<|fim_suffix|>if __name__ == '__main__':
with open("zhwiki_pinyin.sc", encoding="utf-8") as f:
for line in f:
line = line.strip()
words... | code_fim | medium | {
"lang": "python",
"repo": "PinkD/rime-pinyin-zhwiki",
"path": "/word_frequency.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
with open("zhwiki_pinyin.sc", encoding="utf-8") as f:
for line in f:
line = line.strip()
words = cut(line)
for word in words:
word_map[word].append(line)
with open("result.txt", mode="w", encoding="utf-8") as f:... | code_fim | medium | {
"lang": "python",
"repo": "PinkD/rime-pinyin-zhwiki",
"path": "/word_frequency.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if string1_letters.count(" ")!=0:
string1_letters.remove(" ")
if string1_letters.count(",")!=0:
string1_letters.remove(",")
if string2_letters.count(" ")!=0:
string2_letters.remove(" ")
if string2_letters.count(",")!=0:
strin... | code_fim | hard | {
"lang": "python",
"repo": "JiWKim/Study",
"path": "/170517_areAnagrams.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JiWKim/Study path: /170517_areAnagrams.py
#p.194
##q51 Anagrams
def areAnagrams(string1, string2):
string1=string1.upper()
string2=string2.upper()
<|fim_suffix|> for letter in string1_letters:
if string1_letters.count(letter)!=string2_letters.count(letter)... | code_fim | hard | {
"lang": "python",
"repo": "JiWKim/Study",
"path": "/170517_areAnagrams.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Anand191/For_Boo path: /App Backup/Before30v5.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 26 15:02:09 2017
@author: anand
"""
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 13:27:40 2017
@author: anand
"""
#!/usr/bin/env python2
# -*- cod... | code_fim | hard | {
"lang": "python",
"repo": "Anand191/For_Boo",
"path": "/App Backup/Before30v5.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#%%
final = []
count = 0
while (count<len(plot)):
temp = []
while(len(temp)<2):
temp.append(plot[count])
count += 1
if (count==len(plot)):
final.append(temp)
break
if (count==len(plot)):
break
final.append(temp)
#%%
grid = gri... | code_fim | hard | {
"lang": "python",
"repo": "Anand191/For_Boo",
"path": "/App Backup/Before30v5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#%%
grid = gridplot(final)
layout = layout([
[widgetbox(select)],
[grid]])
curdoc().add_root(layout)
# =============================================================================
# lt = row(grid,widgetbox(select))
# show(lt)
# ===========================================================... | code_fim | hard | {
"lang": "python",
"repo": "Anand191/For_Boo",
"path": "/App Backup/Before30v5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jamesleung/flightwithu-python-data path: /newpy7.py
import pika
credentials = pika.PlainCredentials('admin', 'admin')
connection = pika.BlockingConnection(pika.ConnectionParameters(host = '122.51.134.114',port = 5672,virtual_host = '/',credentials = credentials))
channel=connection.channel()
res... | code_fim | medium | {
"lang": "python",
"repo": "jamesleung/flightwithu-python-data",
"path": "/newpy7.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ch.basic_ack(delivery_tag = method.delivery_tag)
print(body.decode())
channel.basic_consume('python-test6',callback)
channel.start_consuming()<|fim_prefix|># repo: jamesleung/flightwithu-python-data path: /newpy7.py
import pika
credentials = pika.PlainCredentials('admin', 'admin')
connection = ... | code_fim | easy | {
"lang": "python",
"repo": "jamesleung/flightwithu-python-data",
"path": "/newpy7.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Jammy2211/PyAutoCTI path: /autocti/charge_injection/imaging/settings.py
import copy
import autoarray as aa
from typing import Tuple
class SettingsImagingCI(aa.SettingsImaging):
def __init__(
self,
parallel_pixels: Tuple[int, int] = None,
serial_pixels: T... | code_fim | hard | {
"lang": "python",
"repo": "Jammy2211/PyAutoCTI",
"path": "/autocti/charge_injection/imaging/settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
is_parallel_fit
If True, the CTI model that is used to fit the charge injection data includes a parallel CTI component.
is_serial_fit
If True, the CTI model that is used to fit the charge injection data includes a serial CT... | code_fim | hard | {
"lang": "python",
"repo": "Jammy2211/PyAutoCTI",
"path": "/autocti/charge_injection/imaging/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ing='utf-8'))
#print(WORDS)
print(b"adjustment\n".strip())<|fim_prefix|># repo: ruchit1131/Python_Programs path: /learn python/fun.py
from urllib.request import urlopen
WORD_URL="http://learncod<|fim_middle|>ethehardway.org/words.txt"
WORDS=[]
#for word in urlopen(WORD_URL).readlines():
#WORD... | code_fim | medium | {
"lang": "python",
"repo": "ruchit1131/Python_Programs",
"path": "/learn python/fun.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ruchit1131/Python_Programs path: /learn python/fun.py
from urllib.request import urlopen
WORD_URL="http://learncodethehardway.org/words.txt"
WORDS=[]
#for word in urlopen(WOR<|fim_suffix|>ing='utf-8'))
#print(WORDS)
print(b"adjustment\n".strip())<|fim_middle|>D_URL).readlines():
#WORD... | code_fim | medium | {
"lang": "python",
"repo": "ruchit1131/Python_Programs",
"path": "/learn python/fun.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if absensi_obj.write(cr,uid,ids,{'state':'approve'},context=context):
res = True
return res
def Action_Done(self,cr,uid,ids,context={}):
res = False
absensi_obj = self.pool.get("absensi")
if absensi_obj.write(cr,uid,ids,{'state':'done'},context=context):
res = True
return res
def ... | code_fim | hard | {
"lang": "python",
"repo": "lajayuhniyarsyah/ERP-Supra",
"path": "/latihan_erp/latihan_erp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lajayuhniyarsyah/ERP-Supra path: /latihan_erp/latihan_erp.py
from datetime import datetime
from stock import stock
import math
import time
import webbrowser
import netsvc
import openerp.exceptions
from osv import osv, fields
from openerp.tools.translate import _
import openerp.addons.decimal_prec... | code_fim | hard | {
"lang": "python",
"repo": "lajayuhniyarsyah/ERP-Supra",
"path": "/latihan_erp/latihan_erp.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return res
def Action_Canceled(self,cr,uid,ids,context={}):
res = False
absensi_obj = self.pool.get("absensi")
if absensi_obj.write(cr,uid,ids,{'state':'cancel'},context=context):
res = True
return res
class employeeinherit(osv.osv):
_inherit ='hr.employee'
_columns = {
'log_absen... | code_fim | medium | {
"lang": "python",
"repo": "lajayuhniyarsyah/ERP-Supra",
"path": "/latihan_erp/latihan_erp.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>a2 = {"name" : "juliy"}
a2["age"] = 22
print a2
print type(a2)
print dir(a2)<|fim_prefix|># repo: yoozoom/stypython path: /src/test/DictTest.py
# -*- coding:utf-8 -*-
# author yuzuo.yz 2017/7/26 20:38
<|fim_middle|># dict 字典map构建函数
jsonObj = dict(name="kaka", age=10, title="player")
# 类似json赋值的方式构建dict... | code_fim | hard | {
"lang": "python",
"repo": "yoozoom/stypython",
"path": "/src/test/DictTest.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoozoom/stypython path: /src/test/DictTest.py
# -*- coding:utf-8 -*-
# author yuzuo.yz 2017/7/26 20:38
# dict 字典map构建函数
jsonObj = dict(name="kaka", age=10, title="player")
# 类似json赋值的方式构建dict对象
dict2 = {
'name': 'messi',
'age': 22
}
<|fim_suffix|>a2 = {"name" : "juliy"}
a2["age"] = 22
... | code_fim | medium | {
"lang": "python",
"repo": "yoozoom/stypython",
"path": "/src/test/DictTest.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print a
a2 = {"name" : "juliy"}
a2["age"] = 22
print a2
print type(a2)
print dir(a2)<|fim_prefix|># repo: yoozoom/stypython path: /src/test/DictTest.py
# -*- coding:utf-8 -*-
# author yuzuo.yz 2017/7/26 20:38
# dict 字典map构建函数
jsonObj = dict(name="kaka", age=10, title="player")
# 类似json赋值的方式构建dict对象
di... | code_fim | easy | {
"lang": "python",
"repo": "yoozoom/stypython",
"path": "/src/test/DictTest.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Emile-Filteau/CSGames2015_Qualifications path: /csgames_quals/views.py
from django.shortcuts import render, redirect
from csgames_quals import models
def index(request):
participants = models.Participant.objects.all()
for participant in participants:
participant.score = 0
... | code_fim | hard | {
"lang": "python",
"repo": "Emile-Filteau/CSGames2015_Qualifications",
"path": "/csgames_quals/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> schedule_score = 0
for participant in participants:
for competition in participant.competitions.all():
if competition in participant.preferences.all():
schedule_score += 1
return render(request, 'schedule.html', {'participants': participants,
... | code_fim | hard | {
"lang": "python",
"repo": "Emile-Filteau/CSGames2015_Qualifications",
"path": "/csgames_quals/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def schedule(request):
participants = models.Participant.objects.all()
competitions = models.Competition.objects.all()
conflicts = []
for participant in participants:
for comp in participant.competitions.all():
for comp_temp in participant.competitions.all():
... | code_fim | hard | {
"lang": "python",
"repo": "Emile-Filteau/CSGames2015_Qualifications",
"path": "/csgames_quals/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>wavfile=wave.open(FILE_NAME+".wav",'wb')
wavfile.setnchannels(CHANNELS)
wavfile.setsampwidth(audio.get_sample_size(FORMAT))
wavfile.setframerate(RATE)
wavfile.writeframes(b''.join(frames))
wavfile.close()
stream.stop_stream()
stream.close()
audio.terminate()
#Importing pyplot
... | code_fim | hard | {
"lang": "python",
"repo": "keshav22/Odia-to-Text",
"path": "/first.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>frames=[]
i1=0
way=0
for i in range(0,int(RATE/CHUNK*RECORD_SECONDS)):
data=stream.read(CHUNK)
data_chunk=array('h',data)
frames.append(data)
wavfile=wave.open(FILE_NAME+".wav",'wb')
wavfile.setnchannels(CHANNELS)
wavfile.setsampwidth(audio.get_sample_size(FORMAT))
... | code_fim | medium | {
"lang": "python",
"repo": "keshav22/Odia-to-Text",
"path": "/first.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keshav22/Odia-to-Text path: /first.py
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 02:20:27 2018
@author: keshav
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 21 23:11:34 2018
@author: keshav
"""
import pyaudio
import wave
from array import array
#from matplotlib im... | code_fim | hard | {
"lang": "python",
"repo": "keshav22/Odia-to-Text",
"path": "/first.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>from surv.routes import *
from surv.utils.filters import *<|fim_prefix|># repo: pkugelmass/survivor path: /surv/__init__.py
from flask import Flask, render_template, redirect, url_for, request, session
<|fim_middle|>app = Flask(__name__)
app.secret_key = 'wow'
| code_fim | easy | {
"lang": "python",
"repo": "pkugelmass/survivor",
"path": "/surv/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pkugelmass/survivor path: /surv/__init__.py
from flask import Flask, render_template, redirect, url_for, request, session
<|fim_suffix|>from surv.routes import *
from surv.utils.filters import *<|fim_middle|>app = Flask(__name__)
app.secret_key = 'wow'
| code_fim | easy | {
"lang": "python",
"repo": "pkugelmass/survivor",
"path": "/surv/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main(sc):
spark = HiveContext(sc)
sqlContext = HiveContext(sc)
print "holaaaaa"
rows = sc.textFile('../lmf445/Flight_Project/Data/864625436_T_ONTIME_2*.csv').mapPartitionsWithIndex(parseCSV)
df = sqlContext.createDataFrame(rows)
busiest_route_month_pivot = \
df.select('... | code_fim | hard | {
"lang": "python",
"repo": "subhanshugpt07/Aviation_Big_Data_2017",
"path": "/Monthly_Bussiest_Route.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: subhanshugpt07/Aviation_Big_Data_2017 path: /Monthly_Bussiest_Route.py
from pyspark.sql.functions import *
import csv
from pyspark.sql.types import *
from pyspark.sql.functions import *
from pyspark import SparkContext
from pyspark.sql import HiveContext
from pyspark.sql.functions import *
from p... | code_fim | hard | {
"lang": "python",
"repo": "subhanshugpt07/Aviation_Big_Data_2017",
"path": "/Monthly_Bussiest_Route.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> spark = HiveContext(sc)
sqlContext = HiveContext(sc)
print "holaaaaa"
rows = sc.textFile('../lmf445/Flight_Project/Data/864625436_T_ONTIME_2*.csv').mapPartitionsWithIndex(parseCSV)
df = sqlContext.createDataFrame(rows)
busiest_route_month_pivot = \
df.select('ORIGIN_AIRPORT... | code_fim | hard | {
"lang": "python",
"repo": "subhanshugpt07/Aviation_Big_Data_2017",
"path": "/Monthly_Bussiest_Route.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: so-soon/coding_test_programmers path: /sorting_the_biggest_number.py
from functools import cmp_to_key
def compare(x,y):
t1 = int(x+y)
t2 = int(y+x)
<|fim_suffix|>
def solution(numbers):
answer = ''
for i in range(len(numbers)):
numbers[i] = str(numbers[i])
numbers.s... | code_fim | medium | {
"lang": "python",
"repo": "so-soon/coding_test_programmers",
"path": "/sorting_the_biggest_number.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> numbers.sort(key = cmp_to_key(compare))
answer = ''.join(numbers)
s = 0
for i in range(len(answer)):
if answer[i] == '0':
s += 1
else:
break
if s != 0:
answer = answer[s - 1:]
return answer<|fim_prefix|># repo: so-soon/coding_test_pr... | code_fim | hard | {
"lang": "python",
"repo": "so-soon/coding_test_programmers",
"path": "/sorting_the_biggest_number.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: h2magic-axious/RestApiServer path: /Trinamic/local_urls.py
from django.urls import path
from Trinamic import local_views
app_name = 'Trinamic'
urlpatterns = [
path('test', local_views.index, name='test'),
path('produc<|fim_suffix|>
path('item-detail/<int:item_id>', local_views.item_... | code_fim | medium | {
"lang": "python",
"repo": "h2magic-axious/RestApiServer",
"path": "/Trinamic/local_urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
path('item-detail/<int:item_id>', local_views.item_detail, name='item-detail')
]<|fim_prefix|># repo: h2magic-axious/RestApiServer path: /Trinamic/local_urls.py
from django.urls import path
from Trinamic import local_views
app_name = 'Trinamic'
urlpatterns = [
path('test', local_views.index, n... | code_fim | medium | {
"lang": "python",
"repo": "h2magic-axious/RestApiServer",
"path": "/Trinamic/local_urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='surface',
name='surfaceConicConstantOptable',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='surface',
name='surfaceDecenterXOptable',
... | code_fim | hard | {
"lang": "python",
"repo": "YangHan101/ODT",
"path": "/OpticalDesignTool/ODTUserInterface/LensDataEditor/migrations/0008_auto_20160512_1511.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: YangHan101/ODT path: /OpticalDesignTool/ODTUserInterface/LensDataEditor/migrations/0008_auto_20160512_1511.py
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-12 22:11
from __future__ import unicode_literals
from django.db import migrations, models
<|fim_suffix|> operations = [... | code_fim | hard | {
"lang": "python",
"repo": "YangHan101/ODT",
"path": "/OpticalDesignTool/ODTUserInterface/LensDataEditor/migrations/0008_auto_20160512_1511.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jstyrud/py_trees path: /py_trees/demos/blackboard_remappings.py
#!/usr/bin/env python
#
# License: BSD
# https://raw.githubusercontent.com/splintered-reality/py_trees/devel/LICENSE
#
##############################################################################
# Documentation
#################... | code_fim | hard | {
"lang": "python",
"repo": "jstyrud/py_trees",
"path": "/py_trees/demos/blackboard_remappings.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def command_line_argument_parser() -> argparse.ArgumentParser:
"""
Process command line arguments.
Returns:
the argument parser
"""
parser = argparse.ArgumentParser(
description=description(),
epilog=epilog(),
formatter_class=argparse.RawDescriptionHel... | code_fim | hard | {
"lang": "python",
"repo": "jstyrud/py_trees",
"path": "/py_trees/demos/blackboard_remappings.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
the argument parser
"""
parser = argparse.ArgumentParser(
description=description(),
epilog=epilog(),
formatter_class=argparse.RawDescriptionHelpFormatter,
)
return parser
class Remap(py_trees.behaviour.Behaviour):
"""Custom writer that su... | code_fim | hard | {
"lang": "python",
"repo": "jstyrud/py_trees",
"path": "/py_trees/demos/blackboard_remappings.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Axelphiman/PracticaII-L-R3 path: /VentanaArbolAle.py
import tkinter
from tkinter import messagebox
import string
import random
from ArbolBinario import ArbolBinario
from tkinter import *
class VentanaArbolAle:
def __init__(self):
def informacionNodo():
charNodo.... | code_fim | hard | {
"lang": "python",
"repo": "Axelphiman/PracticaII-L-R3",
"path": "/VentanaArbolAle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Propiedades panel de resultado
result_box = Label(windowRandomTree, font=("Consolas", 18), bg="#005e35", fg="#ffffff", width="63",
height="7")
result_box.config(text="PreOrder: "+','.join(arbol.PreOrder(arbol.root))+"\nInOrder: "+','.... | code_fim | hard | {
"lang": "python",
"repo": "Axelphiman/PracticaII-L-R3",
"path": "/VentanaArbolAle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: latte-horse/jinahan path: /통계분석/Ptython/카이/20191016 파이썬을 이용한 단어 빈도수 계산.py
import konlpy
from collections import Counter
# 저는 이미 khaiii로 형태소 분석이 끝났기 때문에 불필요 할 것 같습니다.
# 대신에 collections 의 counter 함수를 이용해서 빈도수만 채크
<|fim_suffix|>print(return_list)
# text_file="C:/Users/student/Documents/jinahan/통계... | code_fim | hard | {
"lang": "python",
"repo": "latte-horse/jinahan",
"path": "/통계분석/Ptython/카이/20191016 파이썬을 이용한 단어 빈도수 계산.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(return_list)
# text_file="C:/Users/student/Documents/jinahan/통계분석/sample_file/words.txt"
# #형태소 분석이 끝난 파일
# noun_count = 20
# #빈도수 20개의 명사
# output_file = "C:/Users/student/Documents/jinahan/통계분석/sample_file/count.txt"
# #빈도수 측정
# open_text = open(text_file,'r',-1,"utf-8")
# #파일을 가지고옴.
# text = ope... | code_fim | hard | {
"lang": "python",
"repo": "latte-horse/jinahan",
"path": "/통계분석/Ptython/카이/20191016 파이썬을 이용한 단어 빈도수 계산.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("this is under=",cls.fp)
return cls.fp
class woman(human):
def __init__(self,eyes,foot):
super().__init__(eyes,foot)
def disp(self,name,bldgroup):
self.n=name
self.b=bldgroup
print("woman eyes=",self.e)
print("woman f... | code_fim | medium | {
"lang": "python",
"repo": "Bit4z/python",
"path": "/python class/inhertence.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bit4z/python path: /python class/inhertence.py
class human:
fp='priti'
def __init__(self,eyes,foot):
self.e=eyes
self.f=foot
def details(self,name,bldgroup):
self.n=name
self.b=bldgroup
def display(self):
print("human eyes=",self.e)... | code_fim | medium | {
"lang": "python",
"repo": "Bit4z/python",
"path": "/python class/inhertence.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vtemian/interviews-prep path: /cracking-the-code-interview/arrays/01-unique.py
"""
Implement an alghorithm to determine if a sting has all unique characters.
What if you can't use additional data structures?
"""
def is_unique_n_2(string: str) -> bool:
"""
We take the first character ... | code_fim | hard | {
"lang": "python",
"repo": "vtemian/interviews-prep",
"path": "/cracking-the-code-interview/arrays/01-unique.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def is_unique_n_set(string: str) -> bool:
"""
Transform the string in a set and check it's length.
If it's different from the lenght of the string, return False
"""
return len(set(string)) == len(string)
def is_unique_n_bit_vector(string: str) -> bool:
"""
Simil... | code_fim | hard | {
"lang": "python",
"repo": "vtemian/interviews-prep",
"path": "/cracking-the-code-interview/arrays/01-unique.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ToddZenger/PHYS19a path: /tutorial/lesson00/logical.py
"""
Author: Todd Zenger, Brandeis University
This program introduces more about logical
statements and if statements
"""
# First, let's practice with some logical statements
# Let's ask it some questions
print("Is 5 less than 3? {}".format(... | code_fim | hard | {
"lang": "python",
"repo": "ToddZenger/PHYS19a",
"path": "/tutorial/lesson00/logical.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if(a):
print("Hello!")
else:
print("Goodbye!")
# We will have Hello! printed out
if(b):
print("Hello!")
else:
print("Goodbye!")
# We will have Goodbye! printed out
print("\n~~~Now let's look at more practical use of if-else~~~\n")
data = 3
print("\nData is: {}".format(data))
if(data>10)... | code_fim | hard | {
"lang": "python",
"repo": "ToddZenger/PHYS19a",
"path": "/tutorial/lesson00/logical.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print("\n~~~Now let's look at more practical use of if-else~~~\n")
data = 3
print("\nData is: {}".format(data))
if(data>10):
print("Too big!")
elif(data <=10 and data > 7):
print("Just right!")
elif(data <=7 and data > 3):
print("Almost!")
else:
print("Too small!")<|fim_prefix|># repo: T... | code_fim | hard | {
"lang": "python",
"repo": "ToddZenger/PHYS19a",
"path": "/tutorial/lesson00/logical.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print ""
print "--------------------------"
print "= Find frames (MAY 2017) ="
print "--------------------------"
print ""
print("Press f to output frame number, w to write a frame to image, and q to quit")
while(cap.isOpened() and cap_thermal.isOpened()):
ret, frame = cap.read()
ret, frame_th... | code_fim | hard | {
"lang": "python",
"repo": "martincooney/PastVision",
"path": "/pastvision_desktop/scripts/basic/findFrameNumbers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: martincooney/PastVision path: /pastvision_desktop/scripts/basic/findFrameNumbers.py
#!/usr/bin/env python
#Copyright 2017 Martin Cooney
#This file is subject to the terms and conditions defined in file 'Readme.md', which is part of this source code package.
<|fim_suffix|>cv2.namedWindow("R... | code_fim | hard | {
"lang": "python",
"repo": "martincooney/PastVision",
"path": "/pastvision_desktop/scripts/basic/findFrameNumbers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> num_steps = 500001 #Number of total steps
lr_start = 1e-3 #Starting learning rate for lr decay
lr_min = 0 #Minimum learning rate for lr decay
lr_decay = .97 #Learning rate decay multiplier
# Monte Carlo sampling
M ... | code_fim | medium | {
"lang": "python",
"repo": "slundqui/tfRAM",
"path": "/params/dram.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slundqui/tfRAM path: /params/dram.py
#Params object for mono_dram
class DramParams(object):
##Bookkeeping params
#Base output directory
out_dir = "/home/slundquist/mountData/ram/"
#Inner run directory
run_dir = out_dir + "/mono_dram/"
#Save paramete... | code_fim | hard | {
"lang": "python",
"repo": "slundqui/tfRAM",
"path": "/params/dram.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jbzerlamenace/cryptostab path: /test.py
#%%
from model import BtcModel
import matplotlib.pyplot as plt
<|fim_suffix|>print(agent_kapital)
print(agent_wage)
print(empty_model.kapital_households)
print(empty_model.kapital_households_speculators)
# print(test1)
# plt.hist(agent_kapital)
# plt.show... | code_fim | hard | {
"lang": "python",
"repo": "jbzerlamenace/cryptostab",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(agent_kapital)
print(agent_wage)
print(empty_model.kapital_households)
print(empty_model.kapital_households_speculators)
# print(test1)
# plt.hist(agent_kapital)
# plt.show()
# %%<|fim_prefix|># repo: jbzerlamenace/cryptostab path: /test.py
#%%
from model import BtcModel
import matplotlib.pyplot as... | code_fim | hard | {
"lang": "python",
"repo": "jbzerlamenace/cryptostab",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>result = json.dumps(dictionary, sort_keys=True,indent=4, separators=(',', ': '))
outfile = open('topic_dictionary.json','w')
outfile.write(result)
outfile.close()<|fim_prefix|># repo: MichaelGofron/election-buzz path: /tweet_analysis_py/generate_bag.py
import json
import math
import string
dictionar... | code_fim | medium | {
"lang": "python",
"repo": "MichaelGofron/election-buzz",
"path": "/tweet_analysis_py/generate_bag.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dictionary['Topics'][topic] = list(set(words))
result = json.dumps(dictionary, sort_keys=True,indent=4, separators=(',', ': '))
outfile = open('topic_dictionary.json','w')
outfile.write(result)
outfile.close()<|fim_prefix|># repo: MichaelGofron/election-buzz path: /tweet_analysis_py/generate_bag.py
im... | code_fim | hard | {
"lang": "python",
"repo": "MichaelGofron/election-buzz",
"path": "/tweet_analysis_py/generate_bag.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MichaelGofron/election-buzz path: /tweet_analysis_py/generate_bag.py
import json
import math
import string
dictionary = {}
dictionary['Topics'] = {}
f = open('topic_dictionary.json','r')
dictionary = json.load(f)
<|fim_suffix|> dictionary['Topics'][topic] = list(set(words))
result = json.d... | code_fim | hard | {
"lang": "python",
"repo": "MichaelGofron/election-buzz",
"path": "/tweet_analysis_py/generate_bag.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.lowest_config[0,:,:][self.lowest_config[0,:,:]<(math.pi/2)] = 0
self.lowest_config[0,:,:][self.lowest_config[0,:,:]>(math.pi/2)] = math.pi
def plot_spin_z(self):
N = self.N
cartesion = self.cal_cartesion(self.lowest_config)
z_direction_config = cartesion[2,... | code_fim | hard | {
"lang": "python",
"repo": "Yibo-Zhang/ising_model",
"path": "/python/heisenberg/up_down_model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Yibo-Zhang/ising_model path: /python/heisenberg/up_down_model.py
import time
import numpy as np
import math
from numpy.random import rand
import matplotlib.pyplot as plt
import matplotlib as mpl
class Up_down_flip_model():
def __init__(self,N,step,label='simple flip model'):
self.N =... | code_fim | hard | {
"lang": "python",
"repo": "Yibo-Zhang/ising_model",
"path": "/python/heisenberg/up_down_model.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_grid = np.copy(grid)
new_grid[:,a,b] = [new_theta,new_beta]
return self.calculate_single_energy(new_grid,a,b,J,lamda)
def flipping_random_new_direction(self,lamda,temperature):
'''Monte Carlo move using Metropolis algorithm '''
for i in range(self.N):
... | code_fim | hard | {
"lang": "python",
"repo": "Yibo-Zhang/ising_model",
"path": "/python/heisenberg/up_down_model.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: binggroup/MyOlap path: /myolap-server/myolap-bg/myolap/handler/__init__.py
# -*- coding: utf-8 -*-
from flask import (
jsonify
)
from myolap.utils.const import _const
import time
<|fim_suffix|>
# def get_column_type(df,col):
# # 需要进一步完善
# r= _const.SQL_FIELD_TYPE_STR
# str_dtype... | code_fim | hard | {
"lang": "python",
"repo": "binggroup/MyOlap",
"path": "/myolap-server/myolap-bg/myolap/handler/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# def get_column_type(df,col):
# # 需要进一步完善
# r= _const.SQL_FIELD_TYPE_STR
# str_dtype = df[col].dtype
# if str_dtype.startswith('datetime'):
# r=_const.SQL_FIELD_TYPE_DATE
# elif str_dtype.startswith('int') \
# or str_dtype.startswith('float'):
# r = _cons... | code_fim | hard | {
"lang": "python",
"repo": "binggroup/MyOlap",
"path": "/myolap-server/myolap-bg/myolap/handler/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>url_candidato = [
url(r'^$', core_views.candidato, name='candidato'),
url(r'^perfil/new/$',
permission_required('core.add_candidatura')(core_views.PerfilCandidatoCreate.as_view()),
name='perfil_new'),
url(r'^vagas/$',
permission_required('core.add_candidatura')(core_vie... | code_fim | hard | {
"lang": "python",
"repo": "migueleichler/job-convo",
"path": "/core/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: migueleichler/job-convo path: /core/urls.py
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import permission_required
from core import views as core_views
<|fim_suffix|>
url_candidato = [
url(r'^$', core_views.candida... | code_fim | hard | {
"lang": "python",
"repo": "migueleichler/job-convo",
"path": "/core/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
url_candidato = [
url(r'^$', core_views.candidato, name='candidato'),
url(r'^perfil/new/$',
permission_required('core.add_candidatura')(core_views.PerfilCandidatoCreate.as_view()),
name='perfil_new'),
url(r'^vagas/$',
permission_required('core.add_candidatura')(core_vi... | code_fim | hard | {
"lang": "python",
"repo": "migueleichler/job-convo",
"path": "/core/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hrshjain/simplex-method path: /simplex.py
import csv
import numpy as np
import copy
##Importing A and converting to int##
with open('my_A.csv', 'r') as f:
reader = csv.reader(f)
A=list(reader)
for i in range(len(A)):
for j in range(len(A[i])):
A[i][j] = int(A[i][j])
print(... | code_fim | hard | {
"lang": "python",
"repo": "hrshjain/simplex-method",
"path": "/simplex.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Binverse = B.I
print("Binverse =")
print(Binverse)
DeltaxBeta = Binverse*N*Ej
print("DeltaxBeta =")
print(DeltaxBeta)
##Fourth Step
print("\nStep4")
tlist = []
bSize = b.shape[0]
for i in range(bSize):
titem = DeltaxBeta.item(i) / xBetaStar.item(i... | code_fim | hard | {
"lang": "python",
"repo": "hrshjain/simplex-method",
"path": "/simplex.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tjlee/poptimizer path: /poptimizer/portfolio/tests/test_optimizer.py
import pandas as pd
import pytest
from scipy import stats
from poptimizer.portfolio import Portfolio, optimizer, portfolio
class FakeMetricsResample:
def __init__(self, _=None):
self.count = 30
@property
... | code_fim | medium | {
"lang": "python",
"repo": "tjlee/poptimizer",
"path": "/poptimizer/portfolio/tests/test_optimizer.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_for_trade(opt, monkeypatch):
monkeypatch.setattr(optimizer.config, "COSTS", 0.001)
monkeypatch.setattr(portfolio, "MAX_HISTORY", 100)
monkeypatch.setattr(portfolio, "ADD_DAYS", 100)
df = opt._for_trade()
assert isinstance(df, pd.DataFrame)
assert df.shape == (2, 4)
a... | code_fim | hard | {
"lang": "python",
"repo": "tjlee/poptimizer",
"path": "/poptimizer/portfolio/tests/test_optimizer.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kedaduck/Python-Projects path: /face-recognition/show_camera.py
import cv2
# 1 import
# 2 create video capture entry
vc = cv2.VideoCapture(0)
<|fim_suffix|> # 4 show picture
cv2.imshow('me', img)
# 5 wait keyborad
if cv2.waitKey(1) != -1:
# 6 close camera and windows
... | code_fim | medium | {
"lang": "python",
"repo": "kedaduck/Python-Projects",
"path": "/face-recognition/show_camera.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 4 show picture
cv2.imshow('me', img)
# 5 wait keyborad
if cv2.waitKey(1) != -1:
# 6 close camera and windows
vc.release()
cv2.destroyAllWindows()
break<|fim_prefix|># repo: kedaduck/Python-Projects path: /face-recognition/show_camera.py
import cv2
# 1 im... | code_fim | medium | {
"lang": "python",
"repo": "kedaduck/Python-Projects",
"path": "/face-recognition/show_camera.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|><int:article_id>/delete', views.delete_article, name='remove_article'),
path('categories/', views.categories, name='categories')
]<|fim_prefix|># repo: Hugant/Django-Vue-SPA path: /article/urls.py
from django.urls import path
from article import views
urlpatterns = [
path('', views.index, name='index... | code_fim | hard | {
"lang": "python",
"repo": "Hugant/Django-Vue-SPA",
"path": "/article/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hugant/Django-Vue-SPA path: /article/urls.py
from django.urls import path
from article import views
urlpatterns = [
path('', views.index, name='index'),
path('articles/', views.articles, name='articles'),
path('articles/add', views.add_article, name='add_article'),
path('articles/<int:artic... | code_fim | medium | {
"lang": "python",
"repo": "Hugant/Django-Vue-SPA",
"path": "/article/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> views.article, name='article'),
path('articles/<int:article_id>/edit', views.edit_article, name='edit_article'),
path('articles/<int:article_id>/delete', views.delete_article, name='remove_article'),
path('categories/', views.categories, name='categories')
]<|fim_prefix|># repo: Hugant/Django-Vue-SPA ... | code_fim | medium | {
"lang": "python",
"repo": "Hugant/Django-Vue-SPA",
"path": "/article/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='url',
name='links',
field=models.URLField(null=True),
),
]<|fim_prefix|># repo: sabbamonte/Tasker path: /Tasker/migrations/0016_auto_20201201_1822.py
# Generated by Django 3.1.3 on 2020-12-01 18:... | code_fim | medium | {
"lang": "python",
"repo": "sabbamonte/Tasker",
"path": "/Tasker/migrations/0016_auto_20201201_1822.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sabbamonte/Tasker path: /Tasker/migrations/0016_auto_20201201_1822.py
# Generated by Django 3.1.3 on 2020-12-01 18:22
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('Tasker', '0015_auto_20201130_1559'),
]
operations = [
migrations.AlterFie... | code_fim | easy | {
"lang": "python",
"repo": "sabbamonte/Tasker",
"path": "/Tasker/migrations/0016_auto_20201201_1822.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: learningdevthink/study_reader path: /string_reverse.py
str_me = "abcd"
str_arr = ["a","b","c","d"]
for s in str_arr[::]:
print("{}".format(s), end="")
<|fim_suffix|>me[::]:
print("{}".format(s), end="")
print("")<|fim_middle|>print("")
print("<< This is same >>")
for s in str_ | code_fim | easy | {
"lang": "python",
"repo": "learningdevthink/study_reader",
"path": "/string_reverse.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>me[::]:
print("{}".format(s), end="")
print("")<|fim_prefix|># repo: learningdevthink/study_reader path: /string_reverse.py
str_me = "abcd"
str_arr = ["a","b","c","d"]
for s in str_arr[::]:
print("{}".format(s), end="")
<|fim_middle|>print("")
print("<< This is same >>")
for s in str_ | code_fim | easy | {
"lang": "python",
"repo": "learningdevthink/study_reader",
"path": "/string_reverse.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: geekcomputers/Python path: /Tic_Tac_Toe.py
import random
# a python program for tic-tac-toe game
# module intro for introduction
# module show_board for values
# module playgame
def introduction():
print("Hello this a sample tic tac toe game")
print("It will rotate turns between player... | code_fim | hard | {
"lang": "python",
"repo": "geekcomputers/Python",
"path": "/Tic_Tac_Toe.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_computer_move(board, computer_letter):
if computer_letter == "X":
player_letter = "O"
else:
player_letter = "X"
for i in range(1, 10):
copy = get_board_copy(board)
if is_space_free(copy, i):
make_move(copy, computer_letter, i)
if... | code_fim | hard | {
"lang": "python",
"repo": "geekcomputers/Python",
"path": "/Tic_Tac_Toe.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jihadfathalla/Mashreq-HRMS_2 path: /contracts/models.py
from django.db import models
from employees.models import *
# Create your models here.
class Department(models.Model):
department_name = models.CharField(max_length=30)
department_dec = models.ForeignKey(
'self',
o... | code_fim | medium | {
"lang": "python",
"repo": "jihadfathalla/Mashreq-HRMS_2",
"path": "/contracts/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pos_id = models.ForeignKey(
Position,
on_delete=models.CASCADE,
blank=True,
null=True,
)
start_date = models.DateField('HireDate')
end_date = models.DateField(
default=None,
blank=True,
null=True,
)
def __str__(self):
... | code_fim | hard | {
"lang": "python",
"repo": "jihadfathalla/Mashreq-HRMS_2",
"path": "/contracts/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Position(models.Model):
position_name = models.CharField(max_length=30)
def __str__(self):
return self.position_name
class Contract(models.Model):
user_id = models.ForeignKey(
CustomUser,
on_delete=models.CASCADE,
blank=True,
null=True,
)
... | code_fim | medium | {
"lang": "python",
"repo": "jihadfathalla/Mashreq-HRMS_2",
"path": "/contracts/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kawoukaka/Algorithms path: /leetcode/string/13_Roman to Integer.py
class Solution:
def romanToInt(self, s: str) -> int:
encodeTable = {
"I": 1,
"V": 5,
"X": 10,
"L": 50,<|fim_suffix|> i -= 2
else:
total +... | code_fim | hard | {
"lang": "python",
"repo": "kawoukaka/Algorithms",
"path": "/leetcode/string/13_Roman to Integer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> i -= 2
else:
total += encodeTable[s[i]]
i -= 1
return total
s = Solution()
print(s.romanToInt("MCMXCIV"))<|fim_prefix|># repo: kawoukaka/Algorithms path: /leetcode/string/13_Roman to Integer.py
class Solution:
def romanToInt(self, s: str) -> i... | code_fim | hard | {
"lang": "python",
"repo": "kawoukaka/Algorithms",
"path": "/leetcode/string/13_Roman to Integer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='expense',
name='approved_at',
field=models.DateTimeField(help_text='Expense approved at', null=True),
),
]<|fim_prefix|># repo: Sravanksk/fyle-qbo-api path: /apps/fyle/migrations/0002_expense_appro... | code_fim | medium | {
"lang": "python",
"repo": "Sravanksk/fyle-qbo-api",
"path": "/apps/fyle/migrations/0002_expense_approved_at.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ShunKaiZhang/LeetCode path: /contains_duplicate_III.py
# python3
# Given an array of integers,
# find out whether there are two distinct indices i and j in the array such that the absolute difference
# between nums[i] and nums[j] is at most t and the absolute difference between i and j is at m... | code_fim | hard | {
"lang": "python",
"repo": "ShunKaiZhang/LeetCode",
"path": "/contains_duplicate_III.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return False
# naive
nums_index = sorted(range(len(nums)), key=lambda x: nums[x])
nums.sort()
for i in range(len(nums)):
for j in range(i + 1, len(nums)):
if nums[j] - nums[i] <= t and abs(nums_index[j] - nums_index[i]) <= k:
... | code_fim | hard | {
"lang": "python",
"repo": "ShunKaiZhang/LeetCode",
"path": "/contains_duplicate_III.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>while True:
flag, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
gray = cv2.resize(gray, (360, 240))
frame = cv2.resize(frame, (360, 240))
#cv2.imwrite("frame%d.jpg" % count, frame)
hog = cv2.HOGDescriptor()
hog.setSVMDetector( cv2.HOGDescriptor_... | code_fim | hard | {
"lang": "python",
"repo": "AhmadRaju007/Pedestrian-Detection",
"path": "/pedestrian_detection.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AhmadRaju007/Pedestrian-Detection path: /pedestrian_detection.py
import numpy as np
import cv2
import time
help_message = '''
USAGE: peopledetect.py <video_name> ...
Press any key to continue, ESC to stop.
'''
def inside(r, q):
rx, ry, rw, rh = r
qx, qy, qw, qh = q
retur... | code_fim | hard | {
"lang": "python",
"repo": "AhmadRaju007/Pedestrian-Detection",
"path": "/pedestrian_detection.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SDSS-Computing-Studies/004d-for-loops-dh429 path: /task1.py
#!python3
"""
##### Task 1
Ask the user to enter an integer.
Print the multiplication tables up to 12 for that number
using a for loop instead of a while loop.
(2 points)
<|fim_suffix|>
outputs:
multiples of that number
example:
Ente... | code_fim | easy | {
"lang": "python",
"repo": "SDSS-Computing-Studies/004d-for-loops-dh429",
"path": "/task1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>number = input("Enter number:")
number = int(number)
for i in range(1, 13):
print(number * i, end=" ")<|fim_prefix|># repo: SDSS-Computing-Studies/004d-for-loops-dh429 path: /task1.py
#!python3
"""
##### Task 1
Ask the user to enter an integer.
Print the multiplication tables up to 12 for that num... | code_fim | medium | {
"lang": "python",
"repo": "SDSS-Computing-Studies/004d-for-loops-dh429",
"path": "/task1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mihir-yadav/MediHunt path: /backend/backend_BACKUP_5882.py
from flaskRun import getDriver
def f_1mg(medicine):
# driver = getDriver()
# URL = "https://www.1mg.com/search/all?name="+medicine
# r = requests.get(URL)
# soup = BeautifulSoup(r.content,'html.parser')
# # print(soup.prettify())... | code_fim | hard | {
"lang": "python",
"repo": "mihir-yadav/MediHunt",
"path": "/backend/backend_BACKUP_5882.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # driver = getDriver()
# driver.get("https://www.apollopharmacy.in/tsearch?q="+medicine)
# try:
# unavailable = driver.find_element_by_class_name("no-products")
# return medicine + ' not found'
# except NoSuchElementException :
# pdt = driver.find_element_by_class_name("tagalys-product-tile")
#... | code_fim | hard | {
"lang": "python",
"repo": "mihir-yadav/MediHunt",
"path": "/backend/backend_BACKUP_5882.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # driver = getDriver()
# URL = "https://pharmeasy.in/search/all?name=" + medicine
# r = requests.get(URL)
# soup = BeautifulSoup(r.content,'html.parser')
# # print(soup.prettify())
# name = ""
# cost = ""
# desc = ""
# name_table = soup.find('h1',attrs = {'class':'ooufh'})
# if(name_table):
# ... | code_fim | medium | {
"lang": "python",
"repo": "mihir-yadav/MediHunt",
"path": "/backend/backend_BACKUP_5882.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.