text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> # 变焦
def zoom(self, cha, direction):
if direction > 0:
self.nvrDll.CLIENT_DHPTZControlEx2(self.userSession, cha - 1, 4, 0, 8, 0, bool(0), None)
else:
self.nvrDll.CLIENT_DHPTZControlEx2(self.userSession, cha - 1, 5, 0, 8, 0, bool(0), None)
self.nvrDl... | code_fim | hard | {
"lang": "python",
"repo": "danny2jenny/rec-client-python",
"path": "/video/NvrDH.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Raises:
StagingCommandFailedError: if the staging command process exited non-zero.
"""
staging_dir = tempfile.mkdtemp(dir=staging_area)
args = self.mapper(self.GetPath(), descriptor, app_dir, staging_dir)
log.info('Executing staging command: [{0}]\n\n'.format(' '.join(args)))
... | code_fim | hard | {
"lang": "python",
"repo": "bopopescu/searchparty",
"path": "/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/staging.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Mirantis/stepler path: /stepler/horizon/app/ui/dropdown_menu.py
"""
-------------
Dropdown menu
-------------
Usually used in tables to add actions for rows.
"""
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
... | code_fim | medium | {
"lang": "python",
"repo": "Mirantis/stepler",
"path": "/stepler/horizon/app/ui/dropdown_menu.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Constructor.
It has predefined selector.
"""
super(DropdownMenu, self).__init__(*args, **kwgs)
self.locator = By.CSS_SELECTOR, '.btn-group'<|fim_prefix|># repo: Mirantis/stepler path: /stepler/horizon/app/ui/dropdown_menu.py
"""
-------------
Dropdown menu
----... | code_fim | medium | {
"lang": "python",
"repo": "Mirantis/stepler",
"path": "/stepler/horizon/app/ui/dropdown_menu.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def program_args(self):
return ['samtools', 'sort', '-@', AlignProcessing().cpus,
self.input()['sam'].path, '-o', self.output().path
]
class IndexBam(ExternalProgramTask):
def requires(self):
return SortSam()
def output(self):
return luigi.LocalTa... | code_fim | hard | {
"lang": "python",
"repo": "Janchorizo/luigi-wes-pipeline",
"path": "/pipeline/tasks/process_align.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def output(self):
return {
'bam' : luigi.LocalTarget( \
path.join(GlobalParams().base_dir, GlobalParams().exp_name+'_nodup.bam')),
'metrics' : luigi.LocalTarget( \
path.join(GlobalParams().base_dir, GlobalParams().exp_name+'_MD.matrix'))
... | code_fim | hard | {
"lang": "python",
"repo": "Janchorizo/luigi-wes-pipeline",
"path": "/pipeline/tasks/process_align.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Janchorizo/luigi-wes-pipeline path: /pipeline/tasks/process_align.py
import luigi
from luigi.contrib.external_program import ExternalProgramTask
from os import path
from .utils import MetaOutputHandler
from .utils import Wget
from .utils import GlobalParams
from .reference import ReferenceGenome... | code_fim | hard | {
"lang": "python",
"repo": "Janchorizo/luigi-wes-pipeline",
"path": "/pipeline/tasks/process_align.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> 5): -1.0},(0, -1): {(4, 4): -1.0},(-1, 1): {(4, 5): -1},(1, -1): {(5, 4): -1.4142135623730951},(1, 1): {(4, 5): -1},(-1, -1): {(3, 4): -1.4142135623730951}},(5, 0): {(1, 0): {(6, 0): -1.0},(0, 1): {(5, 1): -1.0},(-1, 0): {(4, 0): -1.0},(0, -1): {(5, 0): -1},(-1, 1): {(4, 1): -1.4142135623730951},(1, -1):... | code_fim | hard | {
"lang": "python",
"repo": "MingjiaYao123/STAT232C_cognitive_AI",
"path": "/hw3/GoalInference.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MingjiaYao123/STAT232C_cognitive_AI path: /hw3/GoalInference.py
1): {(2, 3): 1},(-1, 0): {(1, 2): 1},(0, -1): {(2, 1): 1},(-1, 1): {(1, 3): 1},(1, -1): {(3, 1): 1},(1, 1): {(3, 3): 1},(-1, -1): {(1, 1): 1}},(2, 3): {(1, 0): {(3, 3): 1},(0, 1): {(2, 4): 1},(-1, 0): {(1, 3): 1},(0, -1): {(2, 2): 1}... | code_fim | hard | {
"lang": "python",
"repo": "MingjiaYao123/STAT232C_cognitive_AI",
"path": "/hw3/GoalInference.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MingjiaYao123/STAT232C_cognitive_AI path: /hw3/GoalInference.py
}},(3, 0): {(1, 0): {(4, 0): -100},(0, 1): {(3, 1): -100},(-1, 0): {(2, 0): -100},(0, -1): {(3, 0): -100},(-1, 1): {(2, 1): -100},(1, -1): {(3, 0): -100},(1, 1): {(4, 1): -100},(-1, -1): {(3, 0): -100}},(3, 1): {(1, 0): {(4, 1): -100... | code_fim | hard | {
"lang": "python",
"repo": "MingjiaYao123/STAT232C_cognitive_AI",
"path": "/hw3/GoalInference.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Technariumas/PulsePlayer path: /read.py
from __future__ import division
#!/usr/bin/python3
# idVendor 0x0b9c
# idProduct 0x0315
import binascii
import time
import vlc
import numpy as np
forestFile = "/home/pi/PulsePlayer/sounds/jura.wav"
cityFile = "/home/pi/PulsePlayer/sou... | code_fim | hard | {
"lang": "python",
"repo": "Technariumas/PulsePlayer",
"path": "/read.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = f.read(5)
byte1 = ByteToHex(s[4]+s[3])
pulse = int(str(byte1), base=16)
bpm = (1000*60/pulse)
return bpm
avgArray = checkPulse()*np.ones((10, 1))
previousMean = np.mean(avgArray)
counter = 0
while 1:
bpm = checkPulse()
if (bpm < 120) and (bpm > 30):
counter+=1
... | code_fim | hard | {
"lang": "python",
"repo": "Technariumas/PulsePlayer",
"path": "/read.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>digitFifthPowers = []
for n in range(2, 1000000):
if(n == sumOfFifthPower(n)):
digitFifthPowers.append(n)
print(digitFifthPowers)
sum = 0
for x in digitFifthPowers:
sum += x
print(sum)<|fim_prefix|># repo: Zovengrogg/ProjectEuler path: /Euler30_DigitFifthPowers.py
# Di... | code_fim | medium | {
"lang": "python",
"repo": "Zovengrogg/ProjectEuler",
"path": "/Euler30_DigitFifthPowers.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zovengrogg/ProjectEuler path: /Euler30_DigitFifthPowers.py
# Digit Fifth Powers https://projecteuler.net/problem=30
def sumOfFifthPower(n):
<|fim_suffix|>digitFifthPowers = []
for n in range(2, 1000000):
if(n == sumOfFifthPower(n)):
digitFifthPowers.append(n)
print(digit... | code_fim | medium | {
"lang": "python",
"repo": "Zovengrogg/ProjectEuler",
"path": "/Euler30_DigitFifthPowers.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 13424010187/python path: /源码/【14】线条的规律-课程资料/【14】巧绘棋盘格(练习3)-成果包.py
'''巧绘棋盘格'''
#调用turtle模块
import turtle as t
#绘制棋盘格的竖线,通过设置步长去改变每条竖线的起/终点坐标
for x<|fim_suffix|>o(x, 180)
#绘制棋盘格的横线,通过设置步长去改变每条横线的起/终点坐标
for x in range(0, 181, 10):
t.penup()
t.goto(0, x)
t.pendown()
t.goto(180, x)
t.... | code_fim | medium | {
"lang": "python",
"repo": "13424010187/python",
"path": "/源码/【14】线条的规律-课程资料/【14】巧绘棋盘格(练习3)-成果包.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>o(x, 180)
#绘制棋盘格的横线,通过设置步长去改变每条横线的起/终点坐标
for x in range(0, 181, 10):
t.penup()
t.goto(0, x)
t.pendown()
t.goto(180, x)
t.hideturtle()
t.done()<|fim_prefix|># repo: 13424010187/python path: /源码/【14】线条的规律-课程资料/【14】巧绘棋盘格(练习3)-成果包.py
'''巧绘棋盘格'''
#调用turtle模块
import turtle as t
#绘制棋盘格的竖线,通过设置步... | code_fim | medium | {
"lang": "python",
"repo": "13424010187/python",
"path": "/源码/【14】线条的规律-课程资料/【14】巧绘棋盘格(练习3)-成果包.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>up()
t.goto(0, x)
t.pendown()
t.goto(180, x)
t.hideturtle()
t.done()<|fim_prefix|># repo: 13424010187/python path: /源码/【14】线条的规律-课程资料/【14】巧绘棋盘格(练习3)-成果包.py
'''巧绘棋盘格'''
#调用turtle模块
import turtle as t
#绘制棋盘格的竖线,通过设置步长去改变每条竖线的起/终点坐标
for x<|fim_middle|> in range(0, 181, 10):
t.penup()
t.g... | code_fim | medium | {
"lang": "python",
"repo": "13424010187/python",
"path": "/源码/【14】线条的规律-课程资料/【14】巧绘棋盘格(练习3)-成果包.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while l < r:
top, bottom = l, r
for i in range(r - l):
topLeft = matrix[top][l + i]
matrix[top][l + i] = matrix[bottom - i][l]
matrix[bottom - i][l] = matrix[bottom][r - i]
matrix[bottom][r - i] = matrix[top ... | code_fim | hard | {
"lang": "python",
"repo": "valmsmith39a/data-structures-algorithms",
"path": "/matrix/rotate_image.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: valmsmith39a/data-structures-algorithms path: /matrix/rotate_image.py
from typing import List
class RotateImage:
"""
Problem: Rotate Image (#48)
Problem Description:
Given n x n 2D matrix, rotate the image by 90 degrees (clockwise)
Must rotate the image in-place (do not allo... | code_fim | hard | {
"lang": "python",
"repo": "valmsmith39a/data-structures-algorithms",
"path": "/matrix/rotate_image.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hhenry01/ML-Motion-Blur path: /Backend/main_site/test_samples/test_samples.py
import ffmpeg
vid = ffmpeg.probe("man<|fim_suffix|>etadata = vid["streams"][0]
print(metadata)
print(metadata["r_frame_rate"])<|fim_middle|>_running.mp4")
print(vid["streams"])
m | code_fim | easy | {
"lang": "python",
"repo": "hhenry01/ML-Motion-Blur",
"path": "/Backend/main_site/test_samples/test_samples.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>adata)
print(metadata["r_frame_rate"])<|fim_prefix|># repo: hhenry01/ML-Motion-Blur path: /Backend/main_site/test_samples/test_samples.py
import ffmpeg
vid = ffmpeg.probe("man<|fim_middle|>_running.mp4")
print(vid["streams"])
metadata = vid["streams"][0]
print(met | code_fim | medium | {
"lang": "python",
"repo": "hhenry01/ML-Motion-Blur",
"path": "/Backend/main_site/test_samples/test_samples.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='blog',
name='route_name',
field=models.CharField(db_index=True, max_length=20),
),
]<|fim_prefix|># repo: git-haw/haw358 path: /blog/migrations/0006_auto_20170407_0344.py
# -*- coding: utf-8 -*-
... | code_fim | medium | {
"lang": "python",
"repo": "git-haw/haw358",
"path": "/blog/migrations/0006_auto_20170407_0344.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: git-haw/haw358 path: /blog/migrations/0006_auto_20170407_0344.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-07 03:44
from __future__ import unicode_literals
<|fim_suffix|> dependencies = [
('blog', '0005_auto_20170404_0409'),
]
operations = [
migr... | code_fim | medium | {
"lang": "python",
"repo": "git-haw/haw358",
"path": "/blog/migrations/0006_auto_20170407_0344.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marlboromoo/basinboa path: /basinboa/status.py
#!/usr/bin/env python
"""
Global status of basinboa.
reference: http://code.google.com/p/bogboa/source/browse/trunk/mudlib/gvar.py
"""
<|fim_suffix|>#------------------------------------------------------------------------------
# Server
#----... | code_fim | hard | {
"lang": "python",
"repo": "marlboromoo/basinboa",
"path": "/basinboa/status.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#------------------------------------------------------------------------------
# World
#------------------------------------------------------------------------------
WORLD = None
CHARACTER_LOADER = None
MOB_LOADER = None
LOBBY = {} #.key is Client object, value is Guest object
_PLAYERS = {} #. key... | code_fim | hard | {
"lang": "python",
"repo": "marlboromoo/basinboa",
"path": "/basinboa/status.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for people in self :
if people.date_of_birth :
# if date of birth from a person is exist
if people.date_of_birth.month < today.month :
difference = 0
elif people.date_of_birth.month == today.month :
if people.date_of_birth.day <= today.day :
... | code_fim | medium | {
"lang": "python",
"repo": "lokajayae/travel_umroh",
"path": "/models/res_partner.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lokajayae/travel_umroh path: /models/res_partner.py
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class NamaModel(models.Model):
_inherit = 'res.partner'
identity_number = fields.Char(
string="KTP Number"
)
father_name = fields.Char(
string="Fathe... | code_fim | medium | {
"lang": "python",
"repo": "lokajayae/travel_umroh",
"path": "/models/res_partner.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: waqasshafi/T-Salloc path: /requestGenerator.py
import glob
import os
import constants
class RequestGenerator:
def __init__ (self, traceFileDirectory):
self.traceFileDirectory = traceFileDirectory
def readTraceFile(self):
<|fim_suffix|>
if __name__ == '__main__':
traceFileDirectory = 'inpu... | code_fim | hard | {
"lang": "python",
"repo": "waqasshafi/T-Salloc",
"path": "/requestGenerator.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
Collects all the files in the trace directory
'''
files = glob.glob(self.traceFileDirectory + '*')
for file in files:
if os.path.isdir(file): print os.path.basename(file) + '/' # we may need to recursively print from directories
else: print os.path.basename(file)
if __name__ == '__ma... | code_fim | medium | {
"lang": "python",
"repo": "waqasshafi/T-Salloc",
"path": "/requestGenerator.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Category(models.Model):
categoryName = models.CharField(max_length=20)
class MongoMeta:
db_table = "DocsManageApp_category"
def __str__(self):
return self.categoryName
#MongoMeta를 통해 db_table = "DocsManageApp_category" 존재하는 db사용<|fim_prefix|># repo: FRESH-TUNA/DocsManagem... | code_fim | medium | {
"lang": "python",
"repo": "FRESH-TUNA/DocsManagementSystem-Django",
"path": "/DocsManageApp/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FRESH-TUNA/DocsManagementSystem-Django path: /DocsManageApp/models.py
from django.db import models
class Document(models.Model):
category = models.CharField(max_length=20)
content = models.TextField()
url = models.TextField()
class MongoMeta:
db_table = "DocsManageApp_doc... | code_fim | medium | {
"lang": "python",
"repo": "FRESH-TUNA/DocsManagementSystem-Django",
"path": "/DocsManageApp/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> categoryName = models.CharField(max_length=20)
class MongoMeta:
db_table = "DocsManageApp_category"
def __str__(self):
return self.categoryName
#MongoMeta를 통해 db_table = "DocsManageApp_category" 존재하는 db사용<|fim_prefix|># repo: FRESH-TUNA/DocsManagementSystem-Django path: /DocsM... | code_fim | medium | {
"lang": "python",
"repo": "FRESH-TUNA/DocsManagementSystem-Django",
"path": "/DocsManageApp/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhuohuwu0603/interview-algothims path: /none_ladder/1206. Next Greater Element I.py
'''
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2.
The Next ... | code_fim | hard | {
"lang": "python",
"repo": "zhuohuwu0603/interview-algothims",
"path": "/none_ladder/1206. Next Greater Element I.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(len(nums1)):
# 初始化标记变量
found = False
for j in range(len(nums2)):
if found and nums2[j] > nums1[i]:
result.append(nums2[j])
break
#控制更新标记变量
if ... | code_fim | hard | {
"lang": "python",
"repo": "zhuohuwu0603/interview-algothims",
"path": "/none_ladder/1206. Next Greater Element I.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # use monontone stack
def nextGreaterElement(self, nums1, nums2):
if not nums1 or not nums2:
return []
# 声明单调栈
monoStack = []
# 存放从右往左扫描,每一个元素的向右延伸的第一个比它大的元素
eleGreaterMap = {}
# 返回结果
result = []
for i in ... | code_fim | hard | {
"lang": "python",
"repo": "zhuohuwu0603/interview-algothims",
"path": "/none_ladder/1206. Next Greater Element I.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
##
print('Python Configuration Options')
print('----------------------------')
print("version : ", options.version)
print("year : ", options.year)
print("type : ", options.type)
print("globalTag : ", options.globalTag)
print("triggerInfo... | code_fim | hard | {
"lang": "python",
"repo": "desy-cms/analysis-ntuplizer",
"path": "/python/Parser_cfi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ##
print('Python Configuration Options')
print('----------------------------')
print("version : ", options.version)
print("year : ", options.year)
print("type : ", options.type)
print("globalTag : ", options.globalTag)
print("triggerInfo ... | code_fim | hard | {
"lang": "python",
"repo": "desy-cms/analysis-ntuplizer",
"path": "/python/Parser_cfi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: desy-cms/analysis-ntuplizer path: /python/Parser_cfi.py
from __future__ import print_function
import os
import yaml
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
def parser(yml_file=None):
cmssw_base = os.getenv("CMSSW_BASE")
# command l... | code_fim | hard | {
"lang": "python",
"repo": "desy-cms/analysis-ntuplizer",
"path": "/python/Parser_cfi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DariuszSanitariusz/Basic_board_programming path: /src/part1_ex5.py
from board_driver_simulator_v2 import open,close,but,pot,det,led
import time
<|fim_suffix|>try:
open()
while(True): #pętla nieskończona
led(int('1001', 2))
time.sleep(0.25)
led(int('110', 2))
... | code_fim | medium | {
"lang": "python",
"repo": "DariuszSanitariusz/Basic_board_programming",
"path": "/src/part1_ex5.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while(True): #pętla nieskończona
led(int('1001', 2))
time.sleep(0.25)
led(int('110', 2))
time.sleep(0.25)
finally:
close()<|fim_prefix|># repo: DariuszSanitariusz/Basic_board_programming path: /src/part1_ex5.py
from board_driver_simulator_v2 import open,close,but,p... | code_fim | medium | {
"lang": "python",
"repo": "DariuszSanitariusz/Basic_board_programming",
"path": "/src/part1_ex5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "*******************************************************************"
print "Welcome to Light LCC COMMAND verification"
print "*******************************************************************"
test_ids = []
scenarios = []
handlers = []
approaches = []
cflags = []
logs = []... | code_fim | hard | {
"lang": "python",
"repo": "hoantien/Light_code",
"path": "/atlantis_fw/qc_platform/02_IT/handler/script/auto_test_command.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print "********************************************************************"
print "EXECUTE LCC COMMAND AUTOMATION TEST"
print "********************************************************************"
# Create logs folder
os.system("mkdir logs")
for module in testlist.keys():
module_test(testlist, mo... | code_fim | hard | {
"lang": "python",
"repo": "hoantien/Light_code",
"path": "/atlantis_fw/qc_platform/02_IT/handler/script/auto_test_command.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hoantien/Light_code path: /atlantis_fw/qc_platform/02_IT/handler/script/auto_test_command.py
#!/bin/python
#*******************************************************************************
# @File's name : auto_test_command.py
# @Company : Light Co.
# @Author : Hung.Bui - Ligh... | code_fim | hard | {
"lang": "python",
"repo": "hoantien/Light_code",
"path": "/atlantis_fw/qc_platform/02_IT/handler/script/auto_test_command.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hiren2599/auctionera path: /website/migrations/0003_auto_20190405_2104.py
# Generated by Django 2.1.5 on 2019-04-05 15:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.AddFiel... | code_fim | medium | {
"lang": "python",
"repo": "hiren2599/auctionera",
"path": "/website/migrations/0003_auto_20190405_2104.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('website', '0002_auto_20190402_1509'),
]
operations = [
migrations.AddField(
model_name='auction',
name='base_price',
field=models.IntegerField(default=200),
),
migrations.AlterField(
model_name=... | code_fim | medium | {
"lang": "python",
"repo": "hiren2599/auctionera",
"path": "/website/migrations/0003_auto_20190405_2104.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devtrainer14/DemoPython path: /pat_double_Triangle.py
def pattern(n):
# for loop for rows
for i in range(1,n+1):
# conditional operator
if(i % 2 != 0):
k =i + 1
else:
i
# for loop for printing spaces
for g in ... | code_fim | medium | {
"lang": "python",
"repo": "devtrainer14/DemoPython",
"path": "/pat_double_Triangle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>dict = {}
i=0
while i<3:
i = i+1
name = input("Enter name")
dob = input("Enter dob")
dict[name]=dob
print(dict)
name_key = input("Enter name to find the birthday:")
print("Hi ",name_key," Your Bith Date is ",dict[name_key])<|fim_prefix|># repo: devtrainer14/DemoPython path: /p... | code_fim | medium | {
"lang": "python",
"repo": "devtrainer14/DemoPython",
"path": "/pat_double_Triangle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def debugReloadShader(self):
self.lightManager.debugReloadShader()
self._setPositionComputationShader()
self._setCombinerShader()
self._setLightingShader()
self._setFinalPassShader()
self.antialias.reloadShader()
def _attachUpdateTask(self):
... | code_fim | hard | {
"lang": "python",
"repo": "ternence-li/RenderPipeline-1",
"path": "/classes/RenderingPipeline.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ternence-li/RenderPipeline-1 path: /classes/RenderingPipeline.py
import math
from panda3d.core import TransparencyAttrib, Texture, Vec2, NodePath
from panda3d.core import Mat4, CSYupRight, TransformState, CSZupRight, LVecBase2i
from direct.gui.OnscreenImage import OnscreenImage
from direct.gui.... | code_fim | hard | {
"lang": "python",
"repo": "ternence-li/RenderPipeline-1",
"path": "/classes/RenderingPipeline.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
self.temporalProjXOffs += 1
self.temporalProjXOffs = self.temporalProjXOffs % self.temporalProjFactor
self.cullBounds = self._computeCameraBounds()
self.lightManager.setCullBounds(self.cullBounds)
self.lightManager.update()
self.lightingComputeContainer.... | code_fim | hard | {
"lang": "python",
"repo": "ternence-li/RenderPipeline-1",
"path": "/classes/RenderingPipeline.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if p == 2:
# Any integer has a double root 0 or 1 modulo 2
r = n % 2
return (r, r)
if not is_quadratic_residue(n, p):
return (None, None)
# express p - 1 as q*2^s (where q is odd)
q, s = div_while(p - 1, 2)
if s == 1:
r = pow(n, (p+1)//4, p)
... | code_fim | hard | {
"lang": "python",
"repo": "nilsso/quadratic-sieve-rs",
"path": "/python-version/sqrt_mod.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nilsso/quadratic-sieve-rs path: /python-version/sqrt_mod.py
from naive_factor import div_while
from legendre import is_quadratic_residue
# Infinite iterator over repeated mod-squarings
# @param a Integer to square
# @param m Modulus
# @yields a^(2^i) (mod m) for i in [1,2,...]
def squarings(a, m... | code_fim | hard | {
"lang": "python",
"repo": "nilsso/quadratic-sieve-rs",
"path": "/python-version/sqrt_mod.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># counts = get_collection_counts(images)
target_img = nib.load(images[0])
desc = 'Average maps for %s' % search_term
avg_effect = average_maps(images_effect, target_img, desc)
desc = 'Average other maps'
avg_other = average_maps(images_other, target_img, desc)
contrast_img = nib.Nifti1Image(avg_effect -... | code_fim | hard | {
"lang": "python",
"repo": "jasmainak/neurovault-meta",
"path": "/04-encoder.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jasmainak/neurovault-meta path: /04-encoder.py
import matplotlib.pyplot as plt
import pandas as pd
import nibabel as nib
import numpy as np
from nilearn import datasets
from nilearn import surface
from nilearn.plotting import (plot_stat_map, plot_glass_brain,
plot_... | code_fim | hard | {
"lang": "python",
"repo": "jasmainak/neurovault-meta",
"path": "/04-encoder.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AdilKhurshid/Poker-Hands path: /poker.py
"""#####################################################################################################################
# This is a simple game in which you will enter different combinations of card and it will tell you to winning situation
############... | code_fim | hard | {
"lang": "python",
"repo": "AdilKhurshid/Poker-Hands",
"path": "/poker.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def pair(card_ls):
# Calling function to count number of same cards and storing it into new list
if len(cards_count_list) == 0:
face_values_count(card_ls)
# Coping global list into local list for alterations
cards_cnt_ls = cards_count_list[:]
# Finding Maximum occurrence of... | code_fim | hard | {
"lang": "python",
"repo": "AdilKhurshid/Poker-Hands",
"path": "/poker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Checking consecutive number in list and increasing values of hit Variable
for o in range(len(card_val)-1):
if card_val[o]-1 == card_val[o+1]:
hit += 1
else:
hit = 0
# if we have 4 or greater than 4 consecutive hit return Tr... | code_fim | hard | {
"lang": "python",
"repo": "AdilKhurshid/Poker-Hands",
"path": "/poker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return render_to_response('///home/sean/newproject/epictools/templates/index.html', {
'epicBigBlog': epicBigBlog
}, context_instance=RequestContext(request))<|fim_prefix|># repo: smunchy/strange_tools path: /epictools/views.py
# Author: Sean Fallon
# Shout out to Kenneth Love
# Date ... | code_fim | medium | {
"lang": "python",
"repo": "smunchy/strange_tools",
"path": "/epictools/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> epicBigBlog = get_object_or_404(epicTools, active=True, slug=slug)
return render_to_response('///home/sean/newproject/epictools/templates/index.html', {
'epicBigBlog': epicBigBlog
}, context_instance=RequestContext(request))<|fim_prefix|># repo: smunchy/strange_tools path: /epic... | code_fim | hard | {
"lang": "python",
"repo": "smunchy/strange_tools",
"path": "/epictools/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smunchy/strange_tools path: /epictools/views.py
# Author: Sean Fallon
# Shout out to Kenneth Love
# Date Created:
# Date Changed:
# All standard imports used in Django
from django.http import HttpResponse
from django.shortcuts import render_to_response , get_object_or_404
from django.template im... | code_fim | medium | {
"lang": "python",
"repo": "smunchy/strange_tools",
"path": "/epictools/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def animate(i):
s = str(ser.readline(),'utf-8')
st = s.rstrip().split(',')
with open('middle.csv', 'a', newline ='') as f:
writer = csv.writer(f)
writer.writerow(st)
lis = [float(x) for x in st[1:17]]
a = np.array(lis).reshape(4,4)
line.set_array(a)
#li... | code_fim | hard | {
"lang": "python",
"repo": "Senior-ME12/Design-System-to-Detect-Position-and-Impact-of-Ball-on-Soft-Surface",
"path": "/Data/ALL_Sensor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Senior-ME12/Design-System-to-Detect-Position-and-Impact-of-Ball-on-Soft-Surface path: /Data/ALL_Sensor.py
import serial
#import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
#from datetime import datetime
#dt = datetime.now()
#dt.microseco... | code_fim | hard | {
"lang": "python",
"repo": "Senior-ME12/Design-System-to-Detect-Position-and-Impact-of-Ball-on-Soft-Surface",
"path": "/Data/ALL_Sensor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ModelInference/synoptic path: /traces/abstract/invarimint-syn-comparison/tse14-eval/gen_traces.py
'''
Description:
-----------
Generates traces for comparing declarative and procedural Synoptic algorithms.
Generates 100 log files, ranging over event types from an alphabet of 8 events,
each log c... | code_fim | hard | {
"lang": "python",
"repo": "ModelInference/synoptic",
"path": "/traces/abstract/invarimint-syn-comparison/tse14-eval/gen_traces.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f.write(e + "\n")
execs = total_events / 4
for ex in range(execs):
etype = 0
for ev in range(total_events / execs):
etype_s = random.randint(0, etypes)
logEventFn("e" + str(etype_s))
logEventFn("--")
return
def main():
# vary nu... | code_fim | hard | {
"lang": "python",
"repo": "ModelInference/synoptic",
"path": "/traces/abstract/invarimint-syn-comparison/tse14-eval/gen_traces.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Attributes:
LOG_FILENAME (string): Filename of the log file.
TIME_TEMPLATE (string): Custom template to log the time.
MAX_LOGSIZE (int): Maximum size(Bytes) of the log file.
Args:
config_path (string): Absolute path where LogManager should
store the log... | code_fim | hard | {
"lang": "python",
"repo": "zhuduan/youtube-dl-gui",
"path": "/youtube_dl_gui/logmanager.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
LOG_FILENAME = "log"
TIME_TEMPLATE = "[{time}] {error_msg}"
MAX_LOGSIZE = 524288 # Bytes
def __init__(self, config_path, add_time=False):
self.config_path = config_path
self.add_time = add_time
self.log_file = os.path.join(config_path, self.LOG_FILENAME)
... | code_fim | hard | {
"lang": "python",
"repo": "zhuduan/youtube-dl-gui",
"path": "/youtube_dl_gui/logmanager.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def draw_result(self, img, result):
'''
根据result,向image上画框,result维度为[number, 6], 每组4个数的含义是(class, x_center, y_center, width, height, confidence)
'''
print("hell")
print(len(result))
for i in range(len(result)):
x = int(result[i][1])
... | code_fim | hard | {
"lang": "python",
"repo": "knowmefly/Youth-AI-SelfImprovement",
"path": "/YOLO-位置检测/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> detect_timer.tic() #记录检测开始的时间
result = self.detect(image) #检测
detect_timer.toc() #结束检测开始的时间
print('Average detecting time: {:.3f}s'.format(
detect_timer.average_time))
self.draw_result(image, result)
cv2.imwrite('image1.jp... | code_fim | hard | {
"lang": "python",
"repo": "knowmefly/Youth-AI-SelfImprovement",
"path": "/YOLO-位置检测/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: knowmefly/Youth-AI-SelfImprovement path: /YOLO-位置检测/test.py
import os
import cv2
import argparse
import numpy as np
import tensorflow as tf
import utils.config as cfg
from utils.model_yolo import YOLONet
from utils.timer import Timer
#检测的类Detector
class Detector(object):
def __i... | code_fim | hard | {
"lang": "python",
"repo": "knowmefly/Youth-AI-SelfImprovement",
"path": "/YOLO-位置检测/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ai2cm/pace path: /util/tests/test_zarr_monitor.py
import tempfile
try:
import zarr
except ModuleNotFoundError:
zarr = None
import copy
import logging
from datetime import datetime, timedelta
import cftime
import pytest
import pace.util
from pace.util import X_DIMS, Y_DIMS
from pace.ut... | code_fim | hard | {
"lang": "python",
"repo": "ai2cm/pace",
"path": "/util/tests/test_zarr_monitor.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@requires_zarr
@requires_xarray
def test_monitor_file_store_inconsistent_calendars(
state_list_with_inconsistent_calendars, cube_partitioner, numpy
):
with tempfile.TemporaryDirectory(suffix=".zarr") as tempdir:
monitor = pace.util.ZarrMonitor(tempdir, cube_partitioner)
initial_st... | code_fim | hard | {
"lang": "python",
"repo": "ai2cm/pace",
"path": "/util/tests/test_zarr_monitor.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print ' '.join(map(str, res)) if res[0] >= 1 else -1
for _ in range(int(raw_input())):
n, k, b = map(int, raw_input().split())
calc(n, k, b)<|fim_prefix|># repo: PaGrom/HackerRank path: /Algorithms/Constructive Algorithms/Bonetrousle.py
# https://www.hackerrank.com/challenges/bonetrousle
de... | code_fim | hard | {
"lang": "python",
"repo": "PaGrom/HackerRank",
"path": "/Algorithms/Constructive Algorithms/Bonetrousle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaGrom/HackerRank path: /Algorithms/Constructive Algorithms/Bonetrousle.py
# https://www.hackerrank.com/challenges/bonetrousle
def calc(n, k, b):
if n > (k - b + 1 + k) * b / 2:
print -1
return
res = [n / b for _ in range(b)]
for i in range(b / 2):
res[i] ... | code_fim | medium | {
"lang": "python",
"repo": "PaGrom/HackerRank",
"path": "/Algorithms/Constructive Algorithms/Bonetrousle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cedadev/dapbench path: /scripts/clients/subset2d_cdat.py
#!/usr/bin/env python
# BSD Licence
# Copyright (c) 2011, Science & Technology Facilities Council (STFC)
# All rights reserved.
#
# See the LICENSE file in the source distribution of this software for
# the full license text.
# subset_2d_c... | code_fim | medium | {
"lang": "python",
"repo": "cedadev/dapbench",
"path": "/scripts/clients/subset2d_cdat.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ds = cdms2.open(dataset)
var = ds[variable]
subset = var(longitute=(lon0, lon1),
latitude=(lat0, lat1))
out_ds = cdms2.open(outfile, 'w')
out_ds.write(subset)
out_ds.close()<|fim_prefix|># repo: cedadev/dapbench path: /scripts/clients/subset2d_cdat.py
#!/usr/bin/env python
# BSD Licence
#... | code_fim | medium | {
"lang": "python",
"repo": "cedadev/dapbench",
"path": "/scripts/clients/subset2d_cdat.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tweak-com-public/tweak-api-client-python path: /TweakApi/models/team_builder_config.py
# coding: utf-8
"""
tweak-api
Tweak API to integrate with all the Tweak services. You can find out more about Tweak at <a href='https://www.tweak.com'>https://www.tweak.com</a>, #tweak.
Ope... | code_fim | hard | {
"lang": "python",
"repo": "tweak-com-public/tweak-api-client-python",
"path": "/TweakApi/models/team_builder_config.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @product_types.setter
def product_types(self, product_types):
"""
Sets the product_types of this TeamBuilderConfig.
:param product_types: The product_types of this TeamBuilderConfig.
:type: list[ProductType]
"""
self._product_types = product_types... | code_fim | hard | {
"lang": "python",
"repo": "tweak-com-public/tweak-api-client-python",
"path": "/TweakApi/models/team_builder_config.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: niteshsurtani/algorithm_coding path: /interviewbit/max_path_sum.py
maximum = 0
def maxPathSum(self, A):
<|fim_suffix|> if not A:
return 0
val = A.val + self.maxPathSum(A.left) + self.maxPathSum(A.right)
if val > maximum:
maximum = val
return maximum<|fim_m... | code_fim | easy | {
"lang": "python",
"repo": "niteshsurtani/algorithm_coding",
"path": "/interviewbit/max_path_sum.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not A:
return 0
val = A.val + self.maxPathSum(A.left) + self.maxPathSum(A.right)
if val > maximum:
maximum = val
return maximum<|fim_prefix|># repo: niteshsurtani/algorithm_coding path: /interviewbit/max_path_sum.py
maximum = 0
def maxPathSum(self, A):
<|fim_m... | code_fim | easy | {
"lang": "python",
"repo": "niteshsurtani/algorithm_coding",
"path": "/interviewbit/max_path_sum.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> val = A.val + self.maxPathSum(A.left) + self.maxPathSum(A.right)
if val > maximum:
maximum = val
return maximum<|fim_prefix|># repo: niteshsurtani/algorithm_coding path: /interviewbit/max_path_sum.py
maximum = 0
def maxPathSum(self, A):
global maximum
<|fim_middle|> if no... | code_fim | easy | {
"lang": "python",
"repo": "niteshsurtani/algorithm_coding",
"path": "/interviewbit/max_path_sum.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for item in list4:
print "xyz = ", item<|fim_prefix|># repo: pbarendse/Newton-particles path: /Old files/Tutorial files/basics_test.py
# basics_test.py
# write a script that
# 1) constructs a list 4 of (arbitrary) 3 dimensional coordinates x,y,z (floats)
# 2) nicely print the list by iterating over t... | code_fim | medium | {
"lang": "python",
"repo": "pbarendse/Newton-particles",
"path": "/Old files/Tutorial files/basics_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pbarendse/Newton-particles path: /Old files/Tutorial files/basics_test.py
# basics_test.py
# write a script that
# 1) constructs a list 4 of (arbitrary) 3 dimensional coordinates x,y,z (floats)
# 2) nicely print the list by iterating over the 4 list items
xyz1 = [1,2,3]
xyz2 = [4,5,6]
xyz3 = [7,... | code_fim | easy | {
"lang": "python",
"repo": "pbarendse/Newton-particles",
"path": "/Old files/Tutorial files/basics_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>list4 = [xyz1,xyz2,xyz3,xyz4]
for item in list4:
print "xyz = ", item<|fim_prefix|># repo: pbarendse/Newton-particles path: /Old files/Tutorial files/basics_test.py
# basics_test.py
# write a script that
# 1) constructs a list 4 of (arbitrary) 3 dimensional coordinates x,y,z (floats)
# 2) nicely pri... | code_fim | medium | {
"lang": "python",
"repo": "pbarendse/Newton-particles",
"path": "/Old files/Tutorial files/basics_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: European-XFEL/karabo_data path: /karabo_data/cli/make_virtual_cxi.py
import argparse
import logging
import os
import os.path as osp
import re
import sys
from karabo_data import RunDirectory
from karabo_data.components import AGIPD1M, LPD1M
from karabo_data.exceptions import SourceNameError
log ... | code_fim | hard | {
"lang": "python",
"repo": "European-XFEL/karabo_data",
"path": "/karabo_data/cli/make_virtual_cxi.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
# run directory
run_dir = os.path.abspath(args.run_dir)
if out_file is None:
m = re.search(r'/(raw|proc)/(r\d{4})/?$', run_dir)
if not m:
sys.exit("ERROR: '-o outfile' option needed when "
"input directory d... | code_fim | hard | {
"lang": "python",
"repo": "European-XFEL/karabo_data",
"path": "/karabo_data/cli/make_virtual_cxi.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>coef.plot(kind='bar')
from sklearn.linear_model import Ridge
ridge = Ridge(alpha = 2, normalize = True)
ridge.fit(X_train, y_train)
print(ridge.score(X_train, y_train))
print(ridge.score(X_test, y_test))
coef_ridge = pd.Series(ridge.coef_, predictors).sort_values()
print(coef_ridge)
coef_ridge.plot(kin... | code_fim | hard | {
"lang": "python",
"repo": "ManishBilore/DS080321-ML",
"path": "/lasso.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ManishBilore/DS080321-ML path: /lasso.py
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
auto_data = pd.read_csv("Detail_Cars.csv")
auto_data = auto_data.replace('?', np.nan)
col_object = auto_data.select_dtypes(include=['object'])
auto_data['price'] = pd.to_numeric(auto_data['p... | code_fim | hard | {
"lang": "python",
"repo": "ManishBilore/DS080321-ML",
"path": "/lasso.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>predictors = X_train.columns
coef = pd.Series(lasso.coef_, predictors).sort_values()
print(coef)
coef.plot(kind='bar')
from sklearn.linear_model import Ridge
ridge = Ridge(alpha = 2, normalize = True)
ridge.fit(X_train, y_train)
print(ridge.score(X_train, y_train))
print(ridge.score(X_test, y_test))
co... | code_fim | hard | {
"lang": "python",
"repo": "ManishBilore/DS080321-ML",
"path": "/lasso.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saisaranyaatti/100_days-coding-challenge path: /18.sum_of_fibnocci_sequence.py
#sum of fibnocci sequence in a given range using for loop
def fibnocci_sum(n):
<|fim_suffix|>#sum of fibnocci sequence in a given range using while loop
def fibnocci_sum(n):
a=0
b=1
s=a+b
i=2
... | code_fim | medium | {
"lang": "python",
"repo": "saisaranyaatti/100_days-coding-challenge",
"path": "/18.sum_of_fibnocci_sequence.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> a=0
b=1
s=a+b
i=2
while i<n:
s+=a+b
a,b=b,a+b
i+=1
return s
n=int(input())
print(fibnocci_sum(n))<|fim_prefix|># repo: saisaranyaatti/100_days-coding-challenge path: /18.sum_of_fibnocci_sequence.py
#sum of fibnocci sequence in a given range using ... | code_fim | medium | {
"lang": "python",
"repo": "saisaranyaatti/100_days-coding-challenge",
"path": "/18.sum_of_fibnocci_sequence.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#sum of fibnocci sequence in a given range using while loop
def fibnocci_sum(n):
a=0
b=1
s=a+b
i=2
while i<n:
s+=a+b
a,b=b,a+b
i+=1
return s
n=int(input())
print(fibnocci_sum(n))<|fim_prefix|># repo: saisaranyaatti/100_days-coding-challenge pa... | code_fim | medium | {
"lang": "python",
"repo": "saisaranyaatti/100_days-coding-challenge",
"path": "/18.sum_of_fibnocci_sequence.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: faro1219/wot path: /tests/test_ot.py
np.ones(m2.shape[0]),
sklearn.metrics.pairwise.pairwise_distances(
m1, Y=m2, metric='sqeuclidean'), 1, 1,
0.1, 250, np.ones(... | code_fim | hard | {
"lang": "python",
"repo": "faro1219/wot",
"path": "/tests/test_ot.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> row_ids = ['a', 'b', 'c']
column_ids = ['d', 'e', 'f', 'g', 'h'];
clusters = pd.DataFrame([3, 1, 2, 3, 1, 1, 2, 3],
index=['a', 'b', 'c', 'd', 'e', 'f', 'g',
'h'])
grouped_by_cluster = clusters.groupby(c... | code_fim | hard | {
"lang": "python",
"repo": "faro1219/wot",
"path": "/tests/test_ot.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> transport_maps = list()
ncells = [4, 2, 5, 6, 3]
for i in range(0, len(ncells) - 1):
transport_map = pd.read_csv('inputs/transport_maps/t' + str(i) +
'_t' + str(i + 1) + '.csv',
index_col=0)... | code_fim | hard | {
"lang": "python",
"repo": "faro1219/wot",
"path": "/tests/test_ot.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
if companies_CSV_file is not None:
df = pd.read_csv(companies_CSV_file, encoding='utf-8', delimiter=';')
companies_list = df["companies"].tolist()
#companies_with_twitter_account = [str(x) for x in companies_list if str(x)!='nan']
... | code_fim | hard | {
"lang": "python",
"repo": "Luc-Bertin/Pi2_project",
"path": "/Twitter_Class_Analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Luc-Bertin/Pi2_project path: /Twitter_Class_Analysis.py
# coding: utf-8
import tweepy
import json
import os
from datetime import datetime
import pandas as pd
import credentials.credentials_twitter as cred
class Twitter_Analysis:
""" copyright© 2019 — Luc Bertin - License MIT """
__consu... | code_fim | hard | {
"lang": "python",
"repo": "Luc-Bertin/Pi2_project",
"path": "/Twitter_Class_Analysis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MarcosVinicius1994/Projetos-de-Machine-Learning path: /SeleçãoDeAtributosEnviado.py
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 30 23:15:33 2019
@author: marco
Nome: Marcos Vinicius Timoteo Nunes Matricula: 16.2.8388
Disciplina: Aprendizagem de Maquina
Professor: Luiz Carlos Bambirra
... | code_fim | hard | {
"lang": "python",
"repo": "MarcosVinicius1994/Projetos-de-Machine-Learning",
"path": "/SeleçãoDeAtributosEnviado.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Pegando a lista de combinacoes
print(vetAcuracia)
print('Maior valor de acuracia', MAXpred)
print('Menor valor de acuracia', MINpred)
print('A melhor combinacao é:',ListaDeCombinacoes[vetAcuracia.index(MAXpred)])
print('A segunda melhor é:',ListaDeCombinacoes[vetAcuracia.index(M... | code_fim | hard | {
"lang": "python",
"repo": "MarcosVinicius1994/Projetos-de-Machine-Learning",
"path": "/SeleçãoDeAtributosEnviado.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.get(key)
def __setitem__(self, key, value):
if type(key) is not str or not key:
raise ValueError('invalid key - must be non-empty string')
self._engine.setValue(key, _as_string(value))
def __delitem__(self, key):
if key not in self:
... | code_fim | hard | {
"lang": "python",
"repo": "innodatalabs/redstork-ui",
"path": "/ui/settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|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_suffix|>
if __name__ == '__main__':
atr = load_points('points.txt')
first_solution = initial_solution(atr)
print(first_solution)<|... | code_fim | hard | {
"lang": "python",
"repo": "wojcikb/MMWD_Project",
"path": "/MMWD_Project/p_initial_solution.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.