text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>vislist = glob.glob("*.ms")
for visibility in vislist:
flagdata(vis=visibility, antenna=[ [RS508HBA, RS509HBA], [RS208HBA, RS509HBA], [CS302HBA0], [RS205HBA] ], mode='manual')
print "Finished flagging measurement sets. Enjoy!"<|fim_prefix|># repo: mpbusch/LOFAR-ForegroundGalaxyCollaboration path: /fla... | code_fim | easy | {
"lang": "python",
"repo": "mpbusch/LOFAR-ForegroundGalaxyCollaboration",
"path": "/flagAntennas.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mpbusch/LOFAR-ForegroundGalaxyCollaboration path: /flagAntennas.py
# This short program should be run in CASA, in the directory filled with .ms files you wish to flag.
# Feel free to change the 'antenna' parameter in flagdata to flag whichever antennas are giving you trouble.
# Author: Michael Bu... | code_fim | easy | {
"lang": "python",
"repo": "mpbusch/LOFAR-ForegroundGalaxyCollaboration",
"path": "/flagAntennas.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stephenslater/Crowd-Dynamics path: /streaming/get_stream.py
"""Grabs and downloads chunks of video from a live data source. You can specify
the livestream source using the start, header, and url variables. These chunks
are immediately fed into an object detection model using Tensorflow in another... | code_fim | hard | {
"lang": "python",
"repo": "stephenslater/Crowd-Dynamics",
"path": "/streaming/get_stream.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> curr_id = get_current()
headers={"origin": "https://commonspaces.harvard.edu", "Referer" : "https://commonspaces.harvard.edu/plaza-webcam"}
max = get_current()
while True:
time.sleep(1)
url = "https://d144v3end3hovo.cloudfront.net/monitor/harvard-spaces/science-center... | code_fim | medium | {
"lang": "python",
"repo": "stephenslater/Crowd-Dynamics",
"path": "/streaming/get_stream.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> headers={"origin": "https://commonspaces.harvard.edu", "Referer" : "https://commonspaces.harvard.edu/plaza-webcam"}
max = get_current()
while True:
time.sleep(1)
url = "https://d144v3end3hovo.cloudfront.net/monitor/harvard-spaces/science-center-plaza.stream/media_w1332054195_" ... | code_fim | medium | {
"lang": "python",
"repo": "stephenslater/Crowd-Dynamics",
"path": "/streaming/get_stream.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def all_close(a, b):
if isinstance(a, hips.models._lp_model.HIPSArray):
a = a.to_numpy()
if isinstance(b, hips.models._lp_model.HIPSArray):
b = b.to_numpy()
return np.allclose(a, b, rtol=REL_TOLERANCE, atol=ABS_TOLERANCE)
def is_integer(a):
return np.isclose(a.array, np.r... | code_fim | hard | {
"lang": "python",
"repo": "cxlvinchau/hips",
"path": "/src/hips/utils/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def all_close(a, b):
if isinstance(a, hips.models._lp_model.HIPSArray):
a = a.to_numpy()
if isinstance(b, hips.models._lp_model.HIPSArray):
b = b.to_numpy()
return np.allclose(a, b, rtol=REL_TOLERANCE, atol=ABS_TOLERANCE)
def is_integer(a):
return np.isclose(a.array, np.... | code_fim | hard | {
"lang": "python",
"repo": "cxlvinchau/hips",
"path": "/src/hips/utils/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cxlvinchau/hips path: /src/hips/utils/__init__.py
import numpy as np
import hips.models._lp_model
from hips.utils.tracking import Tracker
# Define global constants
REL_TOLERANCE = 1e-05
ABS_TOLERANCE = 1e-08
def set_tolerance(rel_tolerance=1e-09, abs_tolerance=0.0):
"""
Sets the relati... | code_fim | hard | {
"lang": "python",
"repo": "cxlvinchau/hips",
"path": "/src/hips/utils/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ball_radius = 0.2
ball_geometry = scn.Sphere(radius=ball_radius)
ball_geometry.firstMaterial.diffuse.contents = (.48, .48, .48)
ball_geometry.firstMaterial.specular.contents = (.88, .88, .88)
ball_node = scn.Node.nodeWithGeometry(ball_geometry)
rope_seg_nr = 45
rope_length... | code_fim | hard | {
"lang": "python",
"repo": "cclauss/sceneKit-wrapper-for-Pythonista",
"path": "/sceneKit demo/13_physicsDemo-1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cclauss/sceneKit-wrapper-for-Pythonista path: /sceneKit demo/13_physicsDemo-1.py
"""
physics experiments Nr. 1
"""
from objc_util import *
import ctypes
import sceneKit as scn
import ui
import math
class Demo:
@classmethod
def run(cls):
cls().main()
@on_main_thread
def ma... | code_fim | hard | {
"lang": "python",
"repo": "cclauss/sceneKit-wrapper-for-Pythonista",
"path": "/sceneKit demo/13_physicsDemo-1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> rope_nodes = []
for i in range(rope_seg_nr):
rope_nodes.append(scn.Node.nodeWithGeometry(rope_element_geometry))
if i > 0:
rope_nodes[-1].position = (0., -rope_seg_length, 0.)
rope_nodes[-2].addChildNode(rope_nodes[-1])
aConstraint = scn.DistanceConstraint.dista... | code_fim | hard | {
"lang": "python",
"repo": "cclauss/sceneKit-wrapper-for-Pythonista",
"path": "/sceneKit demo/13_physicsDemo-1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> glClearColor(1, 0, 0, 1)
glClear(GL_COLOR_BUFFER_BIT)
self.w.flip()
def test_set_fullscreen(self):
self.w = w = window.Window(200, 200)
w.push_handlers(self)
w.push_handlers(WindowEventLogger())
self.on_expose()
while not w.has_exit:
... | code_fim | hard | {
"lang": "python",
"repo": "njoubert/UndergraduateProjects",
"path": "/ShakaPlayer/trunk/vendor/pyglet-1.1.3/tests/window/WINDOW_SET_FULLSCREEN.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>me Do Curso:{}, Data conclusao:{}'.format(*registro.split(',')))<|fim_prefix|># repo: RenatoAlves06/ExerciciosDoCursoDePython path: /manipulacao_arquivos/io_v3.py
#!python
arquivo = open('pessoas.csv')
for registro in arquivo:<|fim_middle|>
print('Nome:{} Idade:{}'.format(*registro.strip().split(',')... | code_fim | medium | {
"lang": "python",
"repo": "RenatoAlves06/ExerciciosDoCursoDePython",
"path": "/manipulacao_arquivos/io_v3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RenatoAlves06/ExerciciosDoCursoDePython path: /manipulacao_arquivos/io_v3.py
#!python
arquivo = open('pessoas.csv')
for registro in arquivo:<|fim_suffix|>me Do Curso:{}, Data conclusao:{}'.format(*registro.split(',')))<|fim_middle|>
print('Nome:{} Idade:{}'.format(*registro.strip().split(',')... | code_fim | medium | {
"lang": "python",
"repo": "RenatoAlves06/ExerciciosDoCursoDePython",
"path": "/manipulacao_arquivos/io_v3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ericgao1997/JACK493 path: /original/sineapprox.py
## PSYC493 - Directed Studies
## Jack 'jryzkns' Zhou 2018
## code used for calculating a range of
## tolerable values of approximate the sine ratio with the identity
from matplotlib.pyplot import plot, show, xlabel, ylabel, title, axis
from mat... | code_fim | medium | {
"lang": "python",
"repo": "ericgao1997/JACK493",
"path": "/original/sineapprox.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## TOP
x=[]
y=[]
yt=[]
for i in arange(0.01,pi/2,0.01):
x.append(log(i))
y.append(diff(i))
yt.append(0.05)
if diff(i) >= threshold:
print(i*180/pi) #threshold value coverted to degrees
plot(x,y)
plot(x,yt)
title("Accuracy of using the approximation x = sin... | code_fim | medium | {
"lang": "python",
"repo": "ericgao1997/JACK493",
"path": "/original/sineapprox.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif udp.dport == 5353: # mDNS
# print 'mDNS'
# print udp
return mDNS(udp).get()
elif self.getip(ip.dst) == '239.255.255.250':
return {}
else:
# don't print standard ports
# 17500 dropbox
# if not ip.data.dport in [17500]:
# print 'other udp','port:'... | code_fim | hard | {
"lang": "python",
"repo": "AllGloryToTheHypnotoad/netscan2",
"path": "/netscan/PassiveScan.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AllGloryToTheHypnotoad/netscan2 path: /netscan/PassiveScan.py
#!/usr/bin/env python
from __future__ import print_function
# import datetime # time stamp
import pcapy # passive mapping
import os # check sudo
import dpkt # parse packets
import binascii # get M... | code_fim | hard | {
"lang": "python",
"repo": "AllGloryToTheHypnotoad/netscan2",
"path": "/netscan/PassiveScan.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # multicast is just like IPv4
if udp.dport == 5353:
# print udp
ans = mDNS(udp).get()
# print 25*'='
# pp.pprint(ans)
# print 25*'='
return ans
# print 'IPv6 UDP','port:',udp.dport,'src:',self.getip(ip.src,True),'dst:',self.getip(ip.dst,True)
# TCP not useful... | code_fim | hard | {
"lang": "python",
"repo": "AllGloryToTheHypnotoad/netscan2",
"path": "/netscan/PassiveScan.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChWeiking/PythonTutorial path: /Python基础/day11(继承、多态、类属性、类方法、静态方法)/demo/02_多态/01_多态.py
'''
python是弱类型语言(不需要声明类型,变量的类型是根据右侧的值判断的)
c#,java都是强类型语言(需要声明类型,一旦类型确定,只能赋值这样类型的值)
比如,要有一个数字,要存储
python:
num = 100
num = 'abc'
java:
int num = 100
num = 'abc' X
String name = 'laowang'... | code_fim | hard | {
"lang": "python",
"repo": "ChWeiking/PythonTutorial",
"path": "/Python基础/day11(继承、多态、类属性、类方法、静态方法)/demo/02_多态/01_多态.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Animal:
def shout():
print('Animal...shout...')
class Dog(Animal):
def shout():
print('Dog...旺旺...')
class Cat(Animal):
def shout():
print('Cat...喵喵...')
def test(animal):
animal.shout()
def main():
a = Animal()
test(a)
a = Dog()
test(a)
a = Cat()
test(a)
main()
'''
C#,... | code_fim | hard | {
"lang": "python",
"repo": "ChWeiking/PythonTutorial",
"path": "/Python基础/day11(继承、多态、类属性、类方法、静态方法)/demo/02_多态/01_多态.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return _SimModel_Mapping.MappedPropertyList_get_allocator(self)
def begin(self):
return _SimModel_Mapping.MappedPropertyList_begin(self)
def end(self):
return _SimModel_Mapping.MappedPropertyList_end(self)
def rbegin(self):
return _SimModel_Mapping.MappedProp... | code_fim | hard | {
"lang": "python",
"repo": "EnEff-BIM/EnEffBIM-Framework",
"path": "/SimModel_Python_API/simmodel_swig/Release/SimModel_Mapping.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EnEff-BIM/EnEffBIM-Framework path: /SimModel_Python_API/simmodel_swig/Release/SimModel_Mapping.py
):
return _SimModel_Mapping.MappedComponentList_get_allocator(self)
def begin(self):
return _SimModel_Mapping.MappedComponentList_begin(self)
def end(self):
return _... | code_fim | hard | {
"lang": "python",
"repo": "EnEff-BIM/EnEffBIM-Framework",
"path": "/SimModel_Python_API/simmodel_swig/Release/SimModel_Mapping.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class AppendTextInput(TextInput, AppendInput):
pass
class AppendNumberInput(NumberInput, AppendInput):
pass
class CurrencyInput(AppendNumberInput):
appended_text = _("$")
class CurrencyWithoutVATInput(AppendNumberInput):
appended_text = _("$ without VAT")<|fim_prefix|># repo: kato... | code_fim | hard | {
"lang": "python",
"repo": "katomaso/django-market",
"path": "/market/utils/widgets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: katomaso/django-market path: /market/utils/widgets.py
# coding: utf-8
"""Provide generally usable special widgets."""
from django.forms.widgets import Input, TextInput, NumberInput, ClearableFileInput
from django.utils.html import format_html, conditional_escape
from django.utils.encoding import... | code_fim | hard | {
"lang": "python",
"repo": "katomaso/django-market",
"path": "/market/utils/widgets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nhatkhai/bruteforce_search path: /search.py
#!/bin/python
#!/usr/bin/env python3
"""
TODO - Documentation
"""
import os
import sys
import signal
import logging
import datetime
import argparse
import subprocess
from pw_spec import iterfromrule
log=logging.getLogger(__name__)
log.setLevel(logging... | code_fim | hard | {
"lang": "python",
"repo": "nhatkhai/bruteforce_search",
"path": "/search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("-r", '--rule'
, help="specify which rule file will be use"
, default="rules.txt")
parser.add_argument("-c", '--cmd'
, help="""specify what script will be executed with the candidate
... | code_fim | hard | {
"lang": "python",
"repo": "nhatkhai/bruteforce_search",
"path": "/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: twdb/sdi path: /test/test_read.py
import os
import unittest
import numpy as np
from sdi.binary import Dataset
class TestRead(unittest.TestCase):
""" Test basic reading of binary files
"""
def setUp(self):
self.test_dir = os.path.dirname(__file__)
def test_read(self):... | code_fim | hard | {
"lang": "python",
"repo": "twdb/sdi",
"path": "/test/test_read.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Test that separate=False works as expected
"""
filename = os.path.join(self.test_dir, 'files', '07050823.bin')
d = Dataset(filename)
data = d.as_dict(separate=False)
assert 'frequencies' not in data
self.assertIsInstance(data['intensity'], np.nd... | code_fim | hard | {
"lang": "python",
"repo": "twdb/sdi",
"path": "/test/test_read.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jchow32/kevlar path: /kevlar/tests/test_call.py
#!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (c) 2017 The Regents of the University of California
#
# This file is part of kevlar (http://github.com/dib-lab/kevlar) and is
# lice... | code_fim | hard | {
"lang": "python",
"repo": "jchow32/kevlar",
"path": "/kevlar/tests/test_call.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> indel2 = kevlar.call.VariantIndel('chr6', 75522411, 'G', 'GATTACA')
assert str(indel2) == 'chr6:75522412:I->ATTACA'
vcfvalues = ['chr6', '75522412', '.', 'G', 'GATTACA', '.', 'PASS', '.']
assert indel2.vcf == '\t'.join(vcfvalues)
def test_variant_kmers():
# variant here---... | code_fim | hard | {
"lang": "python",
"repo": "jchow32/kevlar",
"path": "/kevlar/tests/test_call.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Rectangular Pulse.
u = rectpulse(L, fsT) generates a rectangular pulse spanning
L symbol periods with fsT samples per symbol. The resulting pulse has length
L * fsT.
u = rectpulse(..., normalize) where normalize is one of {False, True}
normalizes the pulse such that the m... | code_fim | medium | {
"lang": "python",
"repo": "sgwoodjr/velvet",
"path": "/velvet/pulses.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sgwoodjr/velvet path: /velvet/pulses.py
"""Pulse shaping functions
"""
#------------------------------------------------------------------------
# Copyright (c) 2015 SGW
#
# Distributed under the terms of the New BSD License.
#
# The full License is in the file LICENSE
#-------------------------... | code_fim | medium | {
"lang": "python",
"repo": "sgwoodjr/velvet",
"path": "/velvet/pulses.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> _CREASE.__init__(self)
self.name = "CREASING"
self.specie = 'nouns'
self.basic = "crease"
self.jsondata = {}<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_creasing.py
from xai.brain.wordbase.nouns._crease import _CREASE
<|fim_middle|>#calss header
class _CREASING(_CREASE... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_creasing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_creasing.py
from xai.brain.wordbase.nouns._crease import _CREASE
<|fim_suffix|> def __init__(self,):
_CREASE.__init__(self)
self.name = "CREASING"
self.specie = 'nouns'
self.basic = "crease"
self.jsondata = {}<|fim_middle|>#calss header
... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_creasing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: civicboom/civicboom path: /src/civicboom/model/message.py
from civicboom.model.meta import Base, CacheChangeListener
from sqlalchemy import Column, ForeignKey
from sqlalchemy import String, Unicode, UnicodeText
from sqlalchemy import Integer, DateTime, Boolean
from sqlalchemy import func
from sq... | code_fim | hard | {
"lang": "python",
"repo": "civicboom/civicboom",
"path": "/src/civicboom/model/message.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Flag message
"""
from civicboom.lib.database.actions import flag
flag(self, **kargs)
DDL('DROP TRIGGER IF EXISTS update_num_unread ON message').execute_at('before-drop', Message.__table__)
DDL("""
CREATE OR REPLACE FUNCTION update_num_unread() RETURNS TRIGGER A... | code_fim | hard | {
"lang": "python",
"repo": "civicboom/civicboom",
"path": "/src/civicboom/model/message.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> UPDATE member SET num_unread_messages = (
SELECT COUNT(message.id)
FROM message
WHERE
message.target_id=member.id AND
message.source_id IS NOT NULL AND
NOT message.read
) WHERE member.id = tmp_target_id;
... | code_fim | hard | {
"lang": "python",
"repo": "civicboom/civicboom",
"path": "/src/civicboom/model/message.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aksharanigam1112/MachineLearningIITK path: /packageML01/Practical28.py
def group1():
a = int(input("\nEnter 1st no:-"))
b = int(input("\nEnter 2nd no :-"))
c = a+b
print("\nAddition result = ",c)
return
def group2(x,y):
c = x+y
print("\nAddition Result = ",c)
ret... | code_fim | easy | {
"lang": "python",
"repo": "aksharanigam1112/MachineLearningIITK",
"path": "/packageML01/Practical28.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>a = int(input("\nEnter 1st no:-"))
b = int(input("\nEnter 2nd no :-"))
group2(a,b) #Calling function
print("\nAddition Result = ", group3(a,b))<|fim_prefix|># repo: aksharanigam1112/MachineLearningIITK path: /packageML01/Practical28.py
def group1():
a = int(input("\nEnter 1st no:-"))
b = int(... | code_fim | medium | {
"lang": "python",
"repo": "aksharanigam1112/MachineLearningIITK",
"path": "/packageML01/Practical28.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ip = get_ip()
tb = TypologyBuilder(ip, 12345, 'numcalc_typo1')
tb.add_hydrant(get_item, args=(50,))
tb.add_notch(add_one, 10, 5)
tb.add_notch(multiplied_by_two, 5, 10)
tb.add_notch(discard_some_item, 2, 2)
tb.add_bocca(Stdout, persistent_mode="stream")
if __name__ == "__main__":
tb.restart(interval=5... | code_fim | medium | {
"lang": "python",
"repo": "fujiaoliu/rezina",
"path": "/examples/numericalcalctypo1.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fujiaoliu/rezina path: /examples/numericalcalctypo1.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from rezina.utils.network import get_ip
from rezina import TypologyBuilder
from rezina.backends import Stdout
<|fim_suffix|>ip = get_ip()
tb = TypologyBuilder(ip, 12345, 'numcalc_typo1')
tb.add_... | code_fim | medium | {
"lang": "python",
"repo": "fujiaoliu/rezina",
"path": "/examples/numericalcalctypo1.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i,filePath in enumerate(filePaths):
self.writeSingleFileLines(filePath, [ss[i]])
def writeSingleFile(self, filePath, s):
"""" Write string to file. """
self.writeSingleFileLines(filePath, [s])
def flush(self, write=True):
... | code_fim | hard | {
"lang": "python",
"repo": "majgis/majgis",
"path": "/majgis/files.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: majgis/majgis path: /majgis/files.py
# Copyright 2012 majgis Contributors
#
# Individuals comprising majgis Contributors are identified in
# the NOTICE file found in the root directory of this project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may no... | code_fim | hard | {
"lang": "python",
"repo": "majgis/majgis",
"path": "/majgis/files.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>print __doc__
import time as time
import numpy as np
import pylab as pl
import mpl_toolkits.mplot3d.axes3d as p3
from scikits.learn.cluster import Ward
from scikits.learn.datasets.samples_generator import swiss_roll
###############################################################################
# Genera... | code_fim | medium | {
"lang": "python",
"repo": "mike-perdide/scikit-learn",
"path": "/examples/cluster/plot_ward_unstructured.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mike-perdide/scikit-learn path: /examples/cluster/plot_ward_unstructured.py
"""
===========================================================
A demo of hierarchical clustering - unstructured ward
===========================================================
Example builds a swiss roll dataset and ru... | code_fim | hard | {
"lang": "python",
"repo": "mike-perdide/scikit-learn",
"path": "/examples/cluster/plot_ward_unstructured.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> nested_obj = {
"a": [
{
"aa0": {
"aaa": "val_aaa"
},
},
{
"aa1": {
"aaa1": "val_aaa1"
}
}
... | code_fim | hard | {
"lang": "python",
"repo": "RaphaelSun/pai",
"path": "/contrib/python-sdk/test/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ],
"b": "haha"
}
n = Nested(nested_obj, sep="->")
self.assertEqual(n.get("a->0->aa0->aaa"), "val_aaa")
with self.assertRaises(KeyError):
nested_obj["a"][1]["aa2"]["aaa"]
n.set("a->1->aa2->aaa", "val_aaa2")
self.assertEqual... | code_fim | hard | {
"lang": "python",
"repo": "RaphaelSun/pai",
"path": "/contrib/python-sdk/test/test_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RaphaelSun/pai path: /contrib/python-sdk/test/test_utils.py
import unittest
from argparse import Namespace
from copy import deepcopy
from openpaisdk.utils import OrganizedList as ol
from openpaisdk.utils import Nested
class TestOrganizedList(unittest.TestCase):
lst = [dict(a="x", b=0), di... | code_fim | hard | {
"lang": "python",
"repo": "RaphaelSun/pai",
"path": "/contrib/python-sdk/test/test_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LawDog55/ALEAPP path: /scripts/artifacts/sbrowserWebsearch.py
import sqlite3
import textwrap
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, is_platform_windows
def get_sbrowserWebsearch(files_found, report_folder, seeker):
<|fim_suffix|> all_row... | code_fim | hard | {
"lang": "python",
"repo": "LawDog55/ALEAPP",
"path": "/scripts/artifacts/sbrowserWebsearch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> report.write_artifact_data_table(data_headers, data_list, file_found)
report.end_artifact_report()
else:
logfunc('No web search terms data available')
db.close()
return<|fim_prefix|># repo: LawDog55/ALEAPP path: /scripts/artifacts/sbrowserWebsearch.py
import sqlit... | code_fim | hard | {
"lang": "python",
"repo": "LawDog55/ALEAPP",
"path": "/scripts/artifacts/sbrowserWebsearch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># def callHollingIIPrey(number_of_preys:float, number_of_predators:float, step:float):
# result = Functions.hollingIIPrey(number_of_preys, number_of_predators)
# if number_of_preys + step * result < 0:
# return (0 - number_of_preys) / step
# elif number_of_preys + step * result > Const... | code_fim | hard | {
"lang": "python",
"repo": "ibrahimadlani/ProjectM3202c",
"path": "/Python/FunctionCallers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def callLotkaVolterraPredator(number_of_preys:float, number_of_predators:float, step:float):
result = Functions.lotkaVolterraPredator(number_of_preys, number_of_predators)
if number_of_predators + step * result < 0:
return (0 - number_of_preys) / step
else:
return result
def... | code_fim | hard | {
"lang": "python",
"repo": "ibrahimadlani/ProjectM3202c",
"path": "/Python/FunctionCallers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ibrahimadlani/ProjectM3202c path: /Python/FunctionCallers.py
#!/usr/bin/env python3
import Functions as Functions
import Constants as Constants
def callMalthus(number_of_individuals:float, step:float):
result = Functions.malthus(number_of_individuals)
if number_of_individuals + step * ... | code_fim | hard | {
"lang": "python",
"repo": "ibrahimadlani/ProjectM3202c",
"path": "/Python/FunctionCallers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beepscore/websearcher path: /get_top_hits.py
#!/usr/bin/env python3
from websearcher import top_hits
<|fim_suffix|>top_hits = top_hits.TopHits("@./data/input/top_hit_args.txt")
# top_hits_from_file_to_file writes to file, doesn't return anything
top_hits.top_hits_from_file_to_file()<|fim_middl... | code_fim | medium | {
"lang": "python",
"repo": "beepscore/websearcher",
"path": "/get_top_hits.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>top_hits = top_hits.TopHits("@./data/input/top_hit_args.txt")
# top_hits_from_file_to_file writes to file, doesn't return anything
top_hits.top_hits_from_file_to_file()<|fim_prefix|># repo: beepscore/websearcher path: /get_top_hits.py
#!/usr/bin/env python3
from websearcher import top_hits
<|fim_middl... | code_fim | medium | {
"lang": "python",
"repo": "beepscore/websearcher",
"path": "/get_top_hits.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # fail ("depthwise_run_106", depthwise_run,(1, 28, 28, 192, 1, 3, 3, 1, 1, 2, 2, 30, 16, 512, 3*16, 16)),
# fail ("depthwise_run_107", depthwise_run,(1, 14, 14, 384, 1, 3, 3, 1, 1, 1, 1, 16, 16, 160, 80, 16)),
# fail ("depthwise_run_108", depthwise_run,(1, 14, 1... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/akg",
"path": "/tests/st/ops/ascend/cube/test_depthwise_001.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mindspore-ai/akg path: /tests/st/ops/ascend/cube/test_depthwise_001.py
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/akg",
"path": "/tests/st/ops/ascend/cube/test_depthwise_001.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
from argparse import ArgumentParser
parser = ArgumentParser(description='Captcha Breaker')
parser.add_argument('--datadir', '-d', metavar='DATA', required=True, help='the directory for the glyph patterns')
subparsers = parser.add_subparsers(help='the subcommand ... | code_fim | hard | {
"lang": "python",
"repo": "jiridanek/is-muni-captcha-breaker",
"path": "/captcha_breaker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiridanek/is-muni-captcha-breaker path: /captcha_breaker.py
#!/usr/bin/env python
from captcha import *
from skimage import io
import numpy as np
import os, sys
def save_breaker(self, dest):
import shutil
if os.path.exists(dest):
shutil.rmtree(dest)
os.mkdir(dest)
... | code_fim | hard | {
"lang": "python",
"repo": "jiridanek/is-muni-captcha-breaker",
"path": "/captcha_breaker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_peach.py
#calss header
class _PEACH():
def __init__(self,):
self.name = "PEACH"
self.definitions = [u'a round fruit with sweet yellow flesh that has a lot of juice, a slightly furry red and yellow skin, and a large seed in its centre: ', u'som... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_peach.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lopezcaraballoch/striptease path: /compress_hdf5.py
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from datetime import datetime
from io import BytesIO
from pathlib import Path
from argparse import ArgumentParser
import json
import logging
from rich.progress import Progress
from rich.logging ... | code_fim | hard | {
"lang": "python",
"repo": "lopezcaraballoch/striptease",
"path": "/compress_hdf5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def callback(total_input, total_output, read_data, write_data):
progress.update(task, completed=total_input)
with filename.open("rb") as inpf:
pyzstd.compress_stream(
inpf,
buf,
level_or_option=9,
call... | code_fim | hard | {
"lang": "python",
"repo": "lopezcaraballoch/striptease",
"path": "/compress_hdf5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> import os
if blendblockimporter is not None:
ret = None
f1 = filename.lstrip("//").replace(os.sep, "/")
loc = _curr_blend_location
f2 = None
if loc is not None:
f2 = loc + "/" + f1
for f in f1, f2:
if f is None: continue
... | code_fim | hard | {
"lang": "python",
"repo": "agoose77/hivesystem",
"path": "/bee/blendsupport/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
done = False
for hook in sys.path_hooks:
if hasattr(hook, "__name__") and hook.__name__ == "blendblockimporter":
done = True
break
if not done:
sys.path_hooks.insert(0, blendblockimporter.blendblockimporter)
sys.path_importer_cache.clear()
if "//" not in sys.path: sys.pat... | code_fim | hard | {
"lang": "python",
"repo": "agoose77/hivesystem",
"path": "/bee/blendsupport/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agoose77/hivesystem path: /bee/blendsupport/__init__.py
import sys, os, spyder
from . import blendblockimporter
def file_exists(filename):
# global os
#if os is None: os = sys.modules["os"] #BGE re-initialization, or something...
if os is None: return False
filename2 = filename.... | code_fim | hard | {
"lang": "python",
"repo": "agoose77/hivesystem",
"path": "/bee/blendsupport/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> J = randint(self.B_min, self.B_max)
V[J, b, 0] = B # the value
V[J, b, 1] = 1 # the mark
# prepare our network to make a prediction:
# give the net a signal that it's about to make a prediction.
# I noticed that I've been doing it in... | code_fim | hard | {
"lang": "python",
"repo": "symphea/HF-RNN",
"path": "/opt/d/seq/utils/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: symphea/HF-RNN path: /opt/d/seq/utils/__init__.py
a test
# batc for the first time, we'll generate this batch and store
# it in self.test_mem. This way, we randomly choose a fixed
# test set and work with it.
# train_mem is similar but with one difference:
... | code_fim | hard | {
"lang": "python",
"repo": "symphea/HF-RNN",
"path": "/opt/d/seq/utils/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: symphea/HF-RNN path: /opt/d/seq/utils/__init__.py
lse.
inp_dist, # <-- the input distribution: could be rand,
# randn, or even lambda *shape: rand(*shape)<0.5
num_train_batches,
num_test_batches,
... | code_fim | hard | {
"lang": "python",
"repo": "symphea/HF-RNN",
"path": "/opt/d/seq/utils/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plstcharles/thelper path: /thelper/train/utils.py
r"""Returns the logged metadata of predicted bounding boxes.
The returned object is a print-friendly CSV string.
Note that this string might be very long if the dataset is large or if the model tends to generate a lot of
... | code_fim | hard | {
"lang": "python",
"repo": "plstcharles/thelper",
"path": "/thelper/train/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ...
# lists all metrics to instantiate as a dictionary
"metrics": {
# ...
# this is the name of the example consumer; it is used for lookup/printing only
"segmenter": {
# this type is used to instantiate the confusion matrix rep... | code_fim | hard | {
"lang": "python",
"repo": "plstcharles/thelper",
"path": "/thelper/train/utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plstcharles/thelper path: /thelper/train/utils.py
}
},
# ...
}
# ...
Attributes:
prefix: prefix to output sample names.
extension: extension of the generated output samples.
format: metadata output format.
cl... | code_fim | hard | {
"lang": "python",
"repo": "plstcharles/thelper",
"path": "/thelper/train/utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/momochess'
db = SQLAlchemy(app)
return create_routes(app)<|fim_prefix|># repo: MomoStudios/MomoChess path: /momochess/__init__.py
from flask import Flask, render_template, request
from flask_sqlalchemy imp<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "MomoStudios/MomoChess",
"path": "/momochess/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ql://localhost/momochess'
db = SQLAlchemy(app)
return create_routes(app)<|fim_prefix|># repo: MomoStudios/MomoChess path: /momochess/__init__.py
from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
from momochess.routes import create_routes
def create_app():
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "MomoStudios/MomoChess",
"path": "/momochess/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MomoStudios/MomoChess path: /momochess/__init__.py
from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
from momochess.routes import create_routes
def create_app():
<|fim_suffix|>ql://localhost/momochess'
db = SQLAlchemy(app)
return create_routes(app)<|fim... | code_fim | medium | {
"lang": "python",
"repo": "MomoStudios/MomoChess",
"path": "/momochess/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kadajett/iris path: /test/e2eserver.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from gevent import monkey
monkey.patch_all() # NOQA
<|fim_suffix|>if __name__ == '__main__':
config = load_config(sys.argv[1])
addr = (config['server']['host'], config['server']['port'])
print 'List... | code_fim | medium | {
"lang": "python",
"repo": "Kadajett/iris",
"path": "/test/e2eserver.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
config = load_config(sys.argv[1])
addr = (config['server']['host'], config['server']['port'])
print 'Listening on %s...' % (addr,)
application = get_api(config)
WSGIServer(addr, application).serve_forever()<|fim_prefix|># repo: Kadajett/iris path: /test/e2e... | code_fim | medium | {
"lang": "python",
"repo": "Kadajett/iris",
"path": "/test/e2eserver.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert actual is not None
assert actual.logger is not None
assert actual.name == name
assert actual.meta_data == meta_data
assert actual.shared_quote_token == shared_quote_token
assert actual.basket_indices == in_basket
assert actual.basket == basket_markets
assert actual.s... | code_fim | hard | {
"lang": "python",
"repo": "neilfutureftr/mango-explorer",
"path": "/tests/test_group.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neilfutureftr/mango-explorer path: /tests/test_group.py
from .context import mango
from .fakes import fake_account_info, fake_seeded_public_key, fake_token_info
from decimal import Decimal
from mango.layouts import layouts
def test_construction():
account_info = fake_account_info()
nam... | code_fim | hard | {
"lang": "python",
"repo": "neilfutureftr/mango-explorer",
"path": "/tests/test_group.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SnapshotJobStatus(JobStatus):
result: Optional[SnapshotJobResult] = Field(None)
definition: SnapshotJobDefinition = Field(...)<|fim_prefix|># repo: ninoseki/uzen path: /app/schemas/jobs/snapshot.py
from datetime import datetime
from typing import Optional
from arq.jobs import JobDef, JobRe... | code_fim | hard | {
"lang": "python",
"repo": "ninoseki/uzen",
"path": "/app/schemas/jobs/snapshot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ninoseki/uzen path: /app/schemas/jobs/snapshot.py
from datetime import datetime
from typing import Optional
from arq.jobs import JobDef, JobResult
from pydantic import Field
from app import types
from app.schemas.base import APIModel
from app.schemas.jobs.common import JobStatus
from app.schema... | code_fim | medium | {
"lang": "python",
"repo": "ninoseki/uzen",
"path": "/app/schemas/jobs/snapshot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> snapshot_id: types.ULID = Field(...)
class SnapshotJobDefinition(APIModel):
enqueue_time: datetime
payload: SnapshotCreate
@classmethod
def from_job_definition(cls, job_definition: JobDef) -> "SnapshotJobDefinition":
payload = job_definition.args[0]
enqueue_time = jo... | code_fim | medium | {
"lang": "python",
"repo": "ninoseki/uzen",
"path": "/app/schemas/jobs/snapshot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: metaclassco/django-oscar path: /src/oscar/templatetags/sorting_tags.py
# This is a rewrite of django-sorting but with added support for i18n title
# strings.
# See https://github.com/directeur/django-sorting
from django import template
from django.conf import settings
register = template.Librar... | code_fim | hard | {
"lang": "python",
"repo": "metaclassco/django-oscar",
"path": "/src/oscar/templatetags/sorting_tags.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> request = context['request']
get_vars = request.GET.copy()
sort_field = get_vars.pop('sort', [None])[0]
icon = ''
if sort_field == field:
# We are already sorting on this field, so we set the inverse
# direction within the GET params that ge... | code_fim | hard | {
"lang": "python",
"repo": "metaclassco/django-oscar",
"path": "/src/oscar/templatetags/sorting_tags.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> href = '%s?sort=%s' % (request.path, field)
if len(get_vars) > 0:
href += "&%s" % get_vars.urlencode()
if icon:
title = "%s %s" % (title, icon)
return '<a href="%s">%s</a>' % (href, title)
anchor = register.tag(anchor)<|fim_prefix|># repo: metaclas... | code_fim | hard | {
"lang": "python",
"repo": "metaclassco/django-oscar",
"path": "/src/oscar/templatetags/sorting_tags.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: astral-sh/ruff path: /crates/ruff/resources/test/fixtures/flake8_datetimez/DTZ006.py
import datetime
# no args
datetime.datetime.fromtimestamp(1234)
# wrong keywords
datetime.datetime.fromtimestamp(1234, bad=datetime.timezone.utc)
# none args
datetime.datetime.fromtimestamp(1234, None)
<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "astral-sh/ruff",
"path": "/crates/ruff/resources/test/fixtures/flake8_datetimez/DTZ006.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># no args unqualified
datetime.fromtimestamp(1234)
# uses `astimezone` method
datetime.fromtimestamp(1234).astimezone()<|fim_prefix|># repo: astral-sh/ruff path: /crates/ruff/resources/test/fixtures/flake8_datetimez/DTZ006.py
import datetime
# no args
datetime.datetime.fromtimestamp(1234)
<|fim_middle... | code_fim | hard | {
"lang": "python",
"repo": "astral-sh/ruff",
"path": "/crates/ruff/resources/test/fixtures/flake8_datetimez/DTZ006.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>from datetime import datetime
# no args unqualified
datetime.fromtimestamp(1234)
# uses `astimezone` method
datetime.fromtimestamp(1234).astimezone()<|fim_prefix|># repo: astral-sh/ruff path: /crates/ruff/resources/test/fixtures/flake8_datetimez/DTZ006.py
import datetime
# no args
datetime.datetime.fr... | code_fim | medium | {
"lang": "python",
"repo": "astral-sh/ruff",
"path": "/crates/ruff/resources/test/fixtures/flake8_datetimez/DTZ006.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>for k, v in tables.iteritems():
f.write("struct " + k + " {\n")
for x in v:
if x[1] == "INTEGER":
f.write(" uint32_t ")
if x[1] == "REAL":
f.write(" float ")
if x[1] == "TEXT":
f.write(" char *")
f.write(x[0]+ ";\n")
... | code_fim | hard | {
"lang": "python",
"repo": "THUNDERGROOVE/dogma-editor",
"path": "/codegen/cache_types.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: THUNDERGROOVE/dogma-editor path: /codegen/cache_types.py
#!/usr/bin/env python2
import sqlite3
def write_header(_f):
_f.write("/* Generated by codegen.py\n")
_f.write(" * DO NOT EDIT\n")
_f.write(" */\n\n\n")
db = sqlite3.connect("bulkdata.db")
f = open("src/cache_types.h", "w")
... | code_fim | hard | {
"lang": "python",
"repo": "THUNDERGROOVE/dogma-editor",
"path": "/codegen/cache_types.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> config_path = os.path.join(config.paths['config_path'], 'nagios.d')
if not os.path.exists(config_path):
os.makedirs(config_path)
return config_path
def _reload(self):
self._load_configs()
self._load_jobs()
def _load_configs(self):
for c... | code_fim | hard | {
"lang": "python",
"repo": "comodit/synapse-agent",
"path": "/synapse/resources/nagios-plugin/nagios.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sensors = attributes.keys()
status = {}
for sensor in sensors:
if sensor in self.plugins.keys():
status[sensor] = exec_cmd(self.plugins[sensor]['command'])
return status
def _configure(self):
config_path = os.path.join(config.paths[... | code_fim | hard | {
"lang": "python",
"repo": "comodit/synapse-agent",
"path": "/synapse/resources/nagios-plugin/nagios.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: comodit/synapse-agent path: /synapse/resources/nagios-plugin/nagios.py
import os
from io import StringIO
from ConfigParser import RawConfigParser
from synapse.syncmd import exec_cmd
from synapse.config import config
from synapse.logger import logger
from synapse.scheduler import SynSched
from s... | code_fim | hard | {
"lang": "python",
"repo": "comodit/synapse-agent",
"path": "/synapse/resources/nagios-plugin/nagios.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> severity_pattern = re.compile('^([A-Za-z]+)')
severity_remappings = {
'TRACE' : 'DEBUG',
'LOG' : 'DEBUG',
'WARN' : 'WARNING',
'CRIT' : 'CRITICAL'
}
# Build log element from message, and labels from metadata
log_element = dict(self.logline_metadata)
log_e... | code_fim | hard | {
"lang": "python",
"repo": "tangz1987/celo-monorepo",
"path": "/packages/analytics/client_log_exporter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('--env',
dest='env',
help='Environment to filter on (corresponding to testnet name)')
parser.add_argument('--input',
dest='input',
help... | code_fim | hard | {
"lang": "python",
"repo": "tangz1987/celo-monorepo",
"path": "/packages/analytics/client_log_exporter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tangz1987/celo-monorepo path: /packages/analytics/client_log_exporter.py
from __future__ import absolute_import
import argparse
import logging
import re
import json
import urllib2
import sys
import textwrap
import apache_beam as beam
from apache_beam.io.gcp.pubsub import ReadFromPubSub
from apa... | code_fim | hard | {
"lang": "python",
"repo": "tangz1987/celo-monorepo",
"path": "/packages/analytics/client_log_exporter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yunojuno-archive/heroku-tools path: /heroku_tools/deploy.py
# -*- coding: utf-8 -*-
"""Deployment scripts."""
import os
import subprocess
import click
import sarge
from . import (
config,
git,
heroku,
settings,
utils
)
def run_post_deployment_tasks(tasks):
# runs post-... | code_fim | hard | {
"lang": "python",
"repo": "yunojuno-archive/heroku-tools",
"path": "/heroku_tools/deploy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not utils.prompt_for_pin(""):
exit(0)
if maintenance:
click.echo("Putting up maintenance page")
heroku.toggle_maintenance(app_name, True)
if app.use_pipeline:
click.echo("Promoting upstream app: %s" % app.upstream_app)
heroku.promote_app(app.upstrea... | code_fim | hard | {
"lang": "python",
"repo": "yunojuno-archive/heroku-tools",
"path": "/heroku_tools/deploy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>is_disc = dfIsDisc_small.iloc[0,:].tolist() # Useful for certain selection methods
# and common when using small or large networks.
dict_common, dict_areas, \
dict_SVM_acc_dec, dict_knn_acc_dec = network_size_analysis.common_features_difference_accuracy(dfSummaries_small = dfSummaries_small,
... | code_fim | hard | {
"lang": "python",
"repo": "dengxiongshi/cost_based_selection",
"path": "/simple_examples/BA_network_size_analysis.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>##### Analyses: 1 replication
# We provide a function to compare the feature rankings obtained with the two
# network sizes, see the documentation of the function
# cost_based_selection.network_size_analysis.common_features_plot.
#
# We also provide a function to analyze the decrease of accuracy
# resul... | code_fim | hard | {
"lang": "python",
"repo": "dengxiongshi/cost_based_selection",
"path": "/simple_examples/BA_network_size_analysis.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.