text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: dengxiongshi/cost_based_selection path: /simple_examples/BA_network_size_analysis.py
# -*- coding: utf-8 -*-
"""
We here illustrate on a very simple example, the general use of our package to
generate data with two different number of nodes, quantify the ability of the
selection methods to identi... | code_fim | hard | {
"lang": "python",
"repo": "dengxiongshi/cost_based_selection",
"path": "/simple_examples/BA_network_size_analysis.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> token = models.CharField(max_length=255, unique = True)
user = models.ForeignKey(User, related_name='apikeys')
@classmethod
def create(cls, user):
apikey = cls(user=user)
apikey.token = ''.join(random.sample(string.lowercase+string.uppercase+string.digits,32))
return apikey<|fim_prefix|># repo:... | code_fim | hard | {
"lang": "python",
"repo": "tiefpunkt/thingstore",
"path": "/thingstore/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tiefpunkt/thingstore path: /thingstore/models.py
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.utils.timezone import now, utc
import calendar, datetime, string, random
# Create your models here.
class Thing(mode... | code_fim | hard | {
"lang": "python",
"repo": "tiefpunkt/thingstore",
"path": "/thingstore/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
ordering = ['-timestamp']
class APIKey(models.Model):
token = models.CharField(max_length=255, unique = True)
user = models.ForeignKey(User, related_name='apikeys')
@classmethod
def create(cls, user):
apikey = cls(user=user)
apikey.token = ''.join(random.sample(string.lowercase+s... | code_fim | hard | {
"lang": "python",
"repo": "tiefpunkt/thingstore",
"path": "/thingstore/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
from scanner.post import Post, PostList<|fim_prefix|># repo: mratmartinez/Web path: /new_back/tests/context.py
import os
import sys
sys.path.insert(0, <|fim_middle|>os.path.abspath(os.path.join(os.path.dirname(__file__), '../src')))
del os, sys | code_fim | medium | {
"lang": "python",
"repo": "mratmartinez/Web",
"path": "/new_back/tests/context.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mratmartinez/Web path: /new_back/tests/context.py
import os
import sys
sys.path.insert(0, <|fim_suffix|>name(__file__), '../src')))
del os, sys
from scanner.post import Post, PostList<|fim_middle|>os.path.abspath(os.path.join(os.path.dir | code_fim | easy | {
"lang": "python",
"repo": "mratmartinez/Web",
"path": "/new_back/tests/context.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if warning_message == True:
###throw up a warning Window, is a thread so that other functions can happen simultaneously
t = Thread(target=warning_function)
t.start()
if sound == True: #fix this, the main program runs the side program
h... | code_fim | hard | {
"lang": "python",
"repo": "rip3045/VisionSystem",
"path": "/SoundTheAlarm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def warning_function():
"""Executing the warning message on call"""
app = QApplication(sys.argv)
ex = WarningBox()
sys.exit(app.exec_())
def sound_loop():
while True:
playsound('resources/enough.mp3')
def start_alarm(sound=True, warning_message=True, email=False):... | code_fim | hard | {
"lang": "python",
"repo": "rip3045/VisionSystem",
"path": "/SoundTheAlarm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rip3045/VisionSystem path: /SoundTheAlarm.py
import smtplib
import sys
from PyQt5.QtWidgets import QApplication, QWidget, \
QPushButton, QDesktopWidget, QLabel, QVBoxLayout
from PyQt5.QtGui import QIcon
from playsound import playsound
from threading import Thread
from PyQt5.QtCore impo... | code_fim | hard | {
"lang": "python",
"repo": "rip3045/VisionSystem",
"path": "/SoundTheAlarm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for f in listify(funcs):
x = f(x, **kwargs)
return x
class Floatify():
def __call__(self, item):
return item.float()
class Cudify():
def __init__(self):
self.ic = torch.cuda.is_available()
def __call__(self, item):
return item.cuda() if self.ic el... | code_fim | medium | {
"lang": "python",
"repo": "huylb314/AVIAD_AVIJST",
"path": "/aviad/pytorch/data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huylb314/AVIAD_AVIJST path: /aviad/pytorch/data.py
import numpy as np
from sklearn import metrics
import math
import torch
from torch.utils.data import Dataset, DataLoader
from typing import *
# fastai utility
def listify(o):
if o is None: return []
if isinstance(o, list): return o
... | code_fim | medium | {
"lang": "python",
"repo": "huylb314/AVIAD_AVIJST",
"path": "/aviad/pytorch/data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Onehotify(object):
def __init__(self, vocab_size):
self.vocab_size = vocab_size
def __call__(self, item):
return np.bincount(item, minlength=self.vocab_size)
class YOnehotify():
def __init__(self, num_classes):
self.num_classes = num_classes
def __call__(self... | code_fim | hard | {
"lang": "python",
"repo": "huylb314/AVIAD_AVIJST",
"path": "/aviad/pytorch/data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: minrk/delft-visit path: /cachedoutput.py
#!/usr/bin/env python
"""Process notebook by running cells and caching outputs on the filesystem.
Usage: python cachedoutput.py nb.ipynb > out.ipynb
"""
# Copyright (c) Min RK
# Distributed under the terms of the Modified BSD License
import errno
from h... | code_fim | hard | {
"lang": "python",
"repo": "minrk/delft-visit",
"path": "/cachedoutput.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Compute cache key for a cell
Includes hash of setup code (if cell is not part of the setup itself)
"""
sources = []
for idx, cell in self.setup:
if idx >= cell_index:
break
sources.append(cell.source)
sourc... | code_fim | hard | {
"lang": "python",
"repo": "minrk/delft-visit",
"path": "/cachedoutput.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Run a single cell, including setup if needed"""
run_cell = super(CachedOutputPreprocessor, self).run_cell
while self.setup_to_run:
idx, setup_cell = self.setup_to_run.pop(0)
if idx < cell_index:
run_cell(setup_cell)
if idx == c... | code_fim | hard | {
"lang": "python",
"repo": "minrk/delft-visit",
"path": "/cachedoutput.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doup123/capirca path: /capirca_rcmo_execution.py
import os
from capirca_rcmo import capirca_rcmo_<|fim_suffix|>er(malicious_ip,"")
os.system("python aclgen.py")<|fim_middle|>wrapper
with open("./malicious_ips","rb") as f:
malicious_ip=f.read()
wrap=capirca_rcmo_wrapp | code_fim | medium | {
"lang": "python",
"repo": "doup123/capirca",
"path": "/capirca_rcmo_execution.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> malicious_ip=f.read()
wrap=capirca_rcmo_wrapper(malicious_ip,"")
os.system("python aclgen.py")<|fim_prefix|># repo: doup123/capirca path: /capirca_rcmo_execution.py
import os
from capirca_rcmo import capirca_rcmo_<|fim_middle|>wrapper
with open("./malicious_ips","rb") as f:
| code_fim | easy | {
"lang": "python",
"repo": "doup123/capirca",
"path": "/capirca_rcmo_execution.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>er(malicious_ip,"")
os.system("python aclgen.py")<|fim_prefix|># repo: doup123/capirca path: /capirca_rcmo_execution.py
import os
from capirca_rcmo import capirca_rcmo_wrapper
with open("./malicious_ips","rb") as f:
<|fim_middle|> malicious_ip=f.read()
wrap=capirca_rcmo_wrapp | code_fim | easy | {
"lang": "python",
"repo": "doup123/capirca",
"path": "/capirca_rcmo_execution.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> download_csv(path, filename)
assert os.path.exists(filename)<|fim_prefix|># repo: star936/python-learning path: /tests/test_file.py
# coding: utf-8
import pytest
from utils.file import download_csv
import os
data = [(
'https://raw.githubusercontent.com/realpython/materials/master/itertools-... | code_fim | medium | {
"lang": "python",
"repo": "star936/python-learning",
"path": "/tests/test_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize('path,filename', data)
def test_download_csv(path, filename):
download_csv(path, filename)
assert os.path.exists(filename)<|fim_prefix|># repo: star936/python-learning path: /tests/test_file.py
# coding: utf-8
import pytest
from utils.file import download_csv
import os
... | code_fim | medium | {
"lang": "python",
"repo": "star936/python-learning",
"path": "/tests/test_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: star936/python-learning path: /tests/test_file.py
# coding: utf-8
import pytest
from utils.file import download_csv
import os
data = [(
'https://raw.githubusercontent.com/realpython/materials/master/itertools-in-python3/SP500.csv',
'data/SP500.csv')]
<|fim_suffix|> download_csv(path... | code_fim | medium | {
"lang": "python",
"repo": "star936/python-learning",
"path": "/tests/test_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: google/ml-compiler-opt path: /compiler_opt/benchmark/benchmark_chromium.py
# coding=utf-8
# Copyright 2020 Google LLC
#
# 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": "google/ml-compiler-opt",
"path": "/compiler_opt/benchmark/benchmark_chromium.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_environment = os.environ.copy()
new_environment['PATH'] += ':' + depot_tools_path
new_environment['CC'] = os.path.join(llvm_build_path, './bin/clang')
new_environment['CXX'] = os.path.join(llvm_build_path, './bin/clang++')
new_environment['AR'] = os.path.join(llvm_build_path, './bin/llvm-ar'... | code_fim | hard | {
"lang": "python",
"repo": "google/ml-compiler-opt",
"path": "/compiler_opt/benchmark/benchmark_chromium.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>Note that --perf_counters can be defined multiple times to grab more than one
performance counter. Also note that the chromium_build_path is a relative
directory. It is relative to the chromium source dir and specified this way
as there appears to be problems building chromium outside of the source
direct... | code_fim | hard | {
"lang": "python",
"repo": "google/ml-compiler-opt",
"path": "/compiler_opt/benchmark/benchmark_chromium.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.debug("Extracting data from main memory dump")
f=file("fingerprint.txt").read()
words=f.split()
r=open(CHIP_NUMBER+'_'+str(i)+'_'+FINGERPRINT_OUTPUT+str(acc)+'.txt','w')
r.write("@"+str(DATA_START)+"\r\n")
position = int(MEMORY_START,16)
linePos = 0
for word in words:
if position == in... | code_fim | hard | {
"lang": "python",
"repo": "hoangt/ProbableCause",
"path": "/uController/experiment/errormap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> position = int(MEMORY_START,16)
linePos = 0
for word in words:
if position == int(DATA_START,16)+(256*256/2)+2:
r.write("\r\n"+'q'+"\r\n")
break
if (position <= int(DATA_START,16)):
position = position + 1
continue
r.write(word)
position+=1
linePos=linePos+1
if(linePos==16):
... | code_fim | medium | {
"lang": "python",
"repo": "hoangt/ProbableCause",
"path": "/uController/experiment/errormap.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hoangt/ProbableCause path: /uController/experiment/errormap.py
import os
import sys
import time
import logging
import shutil
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
BST_CODE = "dram_bst"
FINGERPRINT_CODE = "dram_fingerprint"
IMGDECAY_CODE = "dram_imgdecay"
FINGERPRINT_OUT... | code_fim | hard | {
"lang": "python",
"repo": "hoangt/ProbableCause",
"path": "/uController/experiment/errormap.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TeoTwawki/pydarkstar path: /pydarkstar/scrubbing/scrubber.py
from ..darkobject import DarkObject
from bs4 import BeautifulSoup
import logging
import time
try:
from urllib.request import urlopen
except ImportError:
from urllib import urlopen
class Scrubber(DarkObject):
<|fim_suffix|> ... | code_fim | medium | {
"lang": "python",
"repo": "TeoTwawki/pydarkstar",
"path": "/pydarkstar/scrubbing/scrubber.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def scrub(self):
"""
Get item metadata.
"""
return {}
# noinspection PyBroadException
@staticmethod
def soup(url):
"""
Open URL and create tag soup.
:param url: website string
:type url: str
"""
handle = ''
... | code_fim | medium | {
"lang": "python",
"repo": "TeoTwawki/pydarkstar",
"path": "/pydarkstar/scrubbing/scrubber.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Get item metadata.
"""
return {}
# noinspection PyBroadException
@staticmethod
def soup(url):
"""
Open URL and create tag soup.
:param url: website string
:type url: str
"""
handle = ''
max_tries = 10... | code_fim | medium | {
"lang": "python",
"repo": "TeoTwawki/pydarkstar",
"path": "/pydarkstar/scrubbing/scrubber.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>: [
"Service",
"Manufacturing",
"Petroleum"
],
"type": "place"
},
{
"id": "18037014",
"hierarchy": [
"Service",
"Manufacturing",
"Plastic Products"
],
"type": "place"
},
{
"id": "18037015",
"hierarchy": [
"Service",
"M... | code_fim | hard | {
"lang": "python",
"repo": "woliveira0101/moneta",
"path": "/ripam/data/plaid_categories.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: woliveira0101/moneta path: /ripam/data/plaid_categories.py
01007",
"hierarchy": [
"Service",
"Advertising and Marketing",
"Market Research and Consulting"
],
"type": "place"
},
{
"id": "18001008",
"hierarchy": [
"Service",
"Advertising and Mar... | code_fim | hard | {
"lang": "python",
"repo": "woliveira0101/moneta",
"path": "/ripam/data/plaid_categories.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: woliveira0101/moneta path: /ripam/data/plaid_categories.py
"hierarchy": [
"Service",
"Home Improvement",
"Kitchens"
],
"type": "place"
},
{
"id": "18024015",
"hierarchy": [
"Service",
"Home Improvement",
"Interior Design"
],
"ty... | code_fim | hard | {
"lang": "python",
"repo": "woliveira0101/moneta",
"path": "/ripam/data/plaid_categories.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(fnjson,'r') as fp:
dconf = json.load(fp)
if 'DirectionDetectionAlgo' not in dconf:
dconf['DirectionDetectionAlgo'] = {'CentroidTracker':0, 'OpticFlow':1, 'UseFull':1}
#print(dconf)
return dconf
dconf = readconf(fnjson)<|fim_prefix|># repo: joyabhatt/jb-inhibition path: /c... | code_fim | easy | {
"lang": "python",
"repo": "joyabhatt/jb-inhibition",
"path": "/conf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joyabhatt/jb-inhibition path: /conf.py
import json
import sys
fnjson = 'sim.json'
for i in range(len(sys.argv)):
if sys.argv[i].endswith('.json'):
fnjson = sys.argv[i]
print('reading ', fnjson)
<|fim_suffix|> with open(fnjson,'r') as fp:
dconf = json.load(fp)
if 'DirectionDe... | code_fim | easy | {
"lang": "python",
"repo": "joyabhatt/jb-inhibition",
"path": "/conf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> <span>''' + load_lang('smtp_security') + '''</span>
<hr class="main_hr">
<select name="smtp_security">
''' + security_radios + '''
</select>
<hr class="main_h... | code_fim | hard | {
"lang": "python",
"repo": "openNAMU/openNAMU",
"path": "/route/main_setting_external.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openNAMU/openNAMU path: /route/main_setting_external.py
from .tool.func import *
def main_setting_external():
with get_db_connect() as conn:
curs = conn.cursor()
if admin_check() != 1:
return re_error('/ban')
i_list = [
'recaptcha',
... | code_fim | hard | {
"lang": "python",
"repo": "openNAMU/openNAMU",
"path": "/route/main_setting_external.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> conn.commit()
security_radios = ''
for i in ['tls', 'starttls', 'plain']:
if d_list[4] == i:
security_radios = '<option value="' + i + '">' + i + '</option>' + security_radios
else:
security_radios... | code_fim | hard | {
"lang": "python",
"repo": "openNAMU/openNAMU",
"path": "/route/main_setting_external.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: divyapy/odoo path: /pos_repair_order/__manifest__.py
# -*- coding: utf-8 -*-
{
"name" : "POS Repair Order",
"summary" : "POS Repair Order.",
"category" : "Point Of Sale",
"version" : "1.0.0",
"author" : "Prolitus ... | code_fim | hard | {
"lang": "python",
"repo": "divyapy/odoo",
"path": "/pos_repair_order/__manifest__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e_view.xml',
'views/bay.xml',
'views/removed_repair_line_view.xml',
'views/stock_warehouse_view.xml',
'views/stock_picking_view.xml'
],
"qweb" : ['... | code_fim | hard | {
"lang": "python",
"repo": "divyapy/odoo",
"path": "/pos_repair_order/__manifest__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#create option parser
parser = OptionParser(option_class=MyOption)
parser.add_option("-i", "--ID", dest="phoneID", help="Phoneme ID", metavar="PHONEID", type="string")
parser.add_option("-d", "--data", dest="datafile", help="Datafile containing conversion information (.csv)", metavar="DATFILE", type="st... | code_fim | hard | {
"lang": "python",
"repo": "karkirowle/iss",
"path": "/bin/phone-list.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>logger.setLevel(LEVELS.get(clevel, logging.NOTSET))
# create console handler and set level to debug
ch = logging.StreamHandler()
ch.setLevel(LEVELS.get(clevel, logging.NOTSET))
# create formatter
formatter = logging.Formatter("%(name)s - %(asctime)s - %(levelname)s - %(message)s")
# add formatter to ch
ch... | code_fim | hard | {
"lang": "python",
"repo": "karkirowle/iss",
"path": "/bin/phone-list.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karkirowle/iss path: /bin/phone-list.py
#!/usr/bin/env python3
#
# Copyright 2010 by Idiap Research Institute, http://www.idiap.ch
#
# See the file COPYING for the licence associated with this software.
#
# Author(s):
# David Imseng, November 2010
#
# Extract Phonelist from csv datafile
#
impo... | code_fim | hard | {
"lang": "python",
"repo": "karkirowle/iss",
"path": "/bin/phone-list.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if size == 0:
return self.nbMap[vpIdx]
else:
return self.nbMap[vpIdx][0:size]
def initialViewpoints(self,vps):
self.originalvps = vps
allVoxels = set()
for vp in self.originalvps:
allVoxels |= vp.voxels
# update voxe... | code_fim | hard | {
"lang": "python",
"repo": "suneric/aircraft_scanning",
"path": "/aircraft_scanning_plan/scripts/util.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suneric/aircraft_scanning path: /aircraft_scanning_plan/scripts/util.py
#! /usr/bin/env python
import sys
import os
import numpy as np
from math import *
from geometry_msgs.msg import Pose
import copy
from tf.transformations import *
MAXVALUE = 1000000
"""
ViewPoint for camere position with vo... | code_fim | hard | {
"lang": "python",
"repo": "suneric/aircraft_scanning",
"path": "/aircraft_scanning_plan/scripts/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>", "ConcatDataset", "PascalVOCDataset", "Cityscapes", "VisualPR", "Foggy_Cityscapes",
"SKUsBoxOnlineDataset", "VisualPR_2cls"]<|fim_prefix|># repo: RuiChen96/maskrcnn-benchmark path: /maskrcnn_benchmark/data/datasets/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Res... | code_fim | hard | {
"lang": "python",
"repo": "RuiChen96/maskrcnn-benchmark",
"path": "/maskrcnn_benchmark/data/datasets/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RuiChen96/maskrcnn-benchmark path: /maskrcnn_benchmark/data/datasets/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .coco import COCODataset
from .voc import PascalVOCDataset
<|fim_suffix|> VisualPR_2cls
from .foggy_cityscapes import Foggy_Cityscapes
from... | code_fim | medium | {
"lang": "python",
"repo": "RuiChen96/maskrcnn-benchmark",
"path": "/maskrcnn_benchmark/data/datasets/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: whaleygeek/variable_duty_cycle path: /Timer.py
# Timer.py 27/04/2017 D.J.Whale
import time
class Timer():
def __init__(self, rate=1.0):
<|fim_suffix|> if self.rate is None: return
while True:
now = time.time()
if self.next_time is None or now > self... | code_fim | medium | {
"lang": "python",
"repo": "whaleygeek/variable_duty_cycle",
"path": "/Timer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#TODO: add in the work we did on another project for accurate timers
#cooperative scheduling option, returning remaining time
#if within a threshold, stay in loop and sleep wait
#if within another threshold, busy wait for precise point
#capture how much late by, and if greater than a threshold, timing err... | code_fim | hard | {
"lang": "python",
"repo": "whaleygeek/variable_duty_cycle",
"path": "/Timer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>i Qiong Lei Sa Kui Pu Ta Shu Yang Ou Tai Mian Yin Diao Yu Mie Jun Niao Xie You Che Feng Lei Li Sin Luo Sek Ji Kwaan Jip Quan Cai Liang Gu Mao Gung Gua Sui Din Wang Mao Man Quan Shi Li Wang Kou Du Zhen Ting Bing Huo Dong Gong Cheng Qin Jiong Lu Xing Nan Xie Mie Bi Jie Su Hung Gong Gung You Xin... | code_fim | hard | {
"lang": "python",
"repo": "casept/anyascii",
"path": "/python/anyascii/_data/_034.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: casept/anyascii path: /python/anyascii/_data/_034.py
b='Qiu Tian Hei Kua Wu Yin Yi Xie Chou Nuo Dan Dai Xu Xing Xiong Liu Lin Xiang Yong Xin Zhen Dai Wu Pan Ru Ma Qian Yi Yin Nei Cheng Feng Taai Zhuo Fang Ao Wu Zuo Zhou Dong Su Yi Qiong K<|fim_suffix|>i Qiong Lei ... | code_fim | hard | {
"lang": "python",
"repo": "casept/anyascii",
"path": "/python/anyascii/_data/_034.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def status(self):
"""Refreshes and returns the status of the lease."""
self.refresh()
# NOTE(priteau): Temporary compatibility with old and new lease status
if self.lease.get('action') is not None:
return self.lease['action'], self.lease['statu... | code_fim | hard | {
"lang": "python",
"repo": "ChameleonCloud/hammers",
"path": "/ccmanage/lease.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ChameleonCloud/hammers path: /ccmanage/lease.py
"""
Lease management
"""
import datetime
import json
import numbers
import os
import sys
import time
import urllib.parse
from dateutil import tz
from blazarclient.client import Client as _BlazarClient # installed from github
# from heatclient.cl... | code_fim | hard | {
"lang": "python",
"repo": "ChameleonCloud/hammers",
"path": "/ccmanage/lease.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if lease exists, delete instances
current_lease = self.blazar.lease.get(self.id)
if current_lease:
for server in self.servers:
server.delete()
if not self._preexisting:
# don't auto-delete pre-existing leases
self.delet... | code_fim | hard | {
"lang": "python",
"repo": "ChameleonCloud/hammers",
"path": "/ccmanage/lease.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rich-ehrhardt/openshift-bare-metal path: /python/generate_inventory_file.py
ates a menu of tasks for user input for each task
"""
self.clear_screen()
self.input_choice = ''
valid_choices = range(1,14)
while self.input_choice not in valid_choices:
... | code_fim | hard | {
"lang": "python",
"repo": "rich-ehrhardt/openshift-bare-metal",
"path": "/python/generate_inventory_file.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rich-ehrhardt/openshift-bare-metal path: /python/generate_inventory_file.py
self.get_ignition_details()
elif self.input_choice == 11:
self.display_inventory()
elif self.input_choice == 12:
self.yaml_inventory()
sys.exit()
self.generate_... | code_fim | hard | {
"lang": "python",
"repo": "rich-ehrhardt/openshift-bare-metal",
"path": "/python/generate_inventory_file.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
get http details and directories names created under /var/www/html
"""
self.clear_screen()
port = input('enter http port \n'
'default [8080]: ')
default = 8080
port = set_values(port, default)
port = validate_port(p... | code_fim | hard | {
"lang": "python",
"repo": "rich-ehrhardt/openshift-bare-metal",
"path": "/python/generate_inventory_file.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def game_over(self):
"""Notifies the user when game is over"""
gameover = GLabel('GAME OVER :(')
gameover.font = '-50'
self.window.add(gameover,x=self.window.width/6,y=self.window.height*0.666)
def win_game(self):
"""Notifies the player if he/she removed al... | code_fim | hard | {
"lang": "python",
"repo": "sharlenechen0113/sc-projects",
"path": "/stanCode Projects/break_out_game/breakoutgraphics_extension.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sharlenechen0113/sc-projects path: /stanCode Projects/break_out_game/breakoutgraphics_extension.py
or the ball.
MAX_X_SPEED = 5 # Maximum initial horizontal speed for the ball.
SPEED_UP = 0.01 # Speed up constant
SCORE_MULTIPLE = 1 # Points added for each brick hit
class BreakoutGra... | code_fim | hard | {
"lang": "python",
"repo": "sharlenechen0113/sc-projects",
"path": "/stanCode Projects/break_out_game/breakoutgraphics_extension.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rmvanhees/pyspex path: /scripts/spx1_add_ogse2l1a.py
#!/usr/bin/env python3
#
# This file is part of pyspex
#
# https://github.com/rmvanhees/pyspex.git
#
# Copyright (c) 2019-2023 SRON - Netherlands Institute for Space Research
# All Rights Reserved
#
# License: BSD-3-Clause
"""
Add OGSE info... | code_fim | hard | {
"lang": "python",
"repo": "rmvanhees/pyspex",
"path": "/scripts/spx1_add_ogse2l1a.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.avantes:
add_ogse_wav_mon(args.ogse_dir / DB_WAV_MON, args.l1a_file)
if args.helios:
xds = helios_spectrum()
xds.to_netcdf(args.l1a_file, mode='a',
group='/gse_data/ReferenceSpectrum')
if args.grande:
xds = gsfc_polarizer()
... | code_fim | hard | {
"lang": "python",
"repo": "rmvanhees/pyspex",
"path": "/scripts/spx1_add_ogse2l1a.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Add OGSE data to an existing SPEXone L1A product."""
# parse command-line parameters
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', action='store_true', help='be verbose')
parser.add_argument('--ogse_dir', default='Logs', type=Path,
help=... | code_fim | hard | {
"lang": "python",
"repo": "rmvanhees/pyspex",
"path": "/scripts/spx1_add_ogse2l1a.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(
si.utils.obj_to_filename(
obj,
[
# ('__class__', '__name__'),
"name",
"foo",
("baz", lambda x: x.upper()),
],
)
)<|fim_prefix|># repo: JoshKarpel/simulacra path: /dev/obj_to_... | code_fim | easy | {
"lang": "python",
"repo": "JoshKarpel/simulacra",
"path": "/dev/obj_to_filename.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JoshKarpel/simulacra path: /dev/obj_to_filename.py
import simulacra as si
if __name__ == "__main__":
obj = si.Specification("John", foo="bar", baz="bo")
<|fim_suffix|> print(
si.utils.obj_to_filename(
obj,
[
# ('__class__', '__name__'),
... | code_fim | easy | {
"lang": "python",
"repo": "JoshKarpel/simulacra",
"path": "/dev/obj_to_filename.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aurelo/lphw path: /source/ex19.py
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print "You have %d cheeses" % cheese_count
print "You have %d boxes of crackers" % boxes_of_crackers
print "Get more!"
# feeding function directly
cheese_and_crackers(20, 30)
<|fim_suffix|>#... | code_fim | hard | {
"lang": "python",
"repo": "aurelo/lphw",
"path": "/source/ex19.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# feeding function directly
cheese_and_crackers(20, 30)
amount_of_cheese = 10
amount_of_crackers = 50
# feeding function with variables
cheese_and_crackers(amount_of_cheese, amount_of_crackers)
# math inside function arguments
cheese_and_crackers(10 + 20, 5 + 6)
# combining variables and math
cheese_... | code_fim | medium | {
"lang": "python",
"repo": "aurelo/lphw",
"path": "/source/ex19.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># feeding function with variables
cheese_and_crackers(amount_of_cheese, amount_of_crackers)
# math inside function arguments
cheese_and_crackers(10 + 20, 5 + 6)
# combining variables and math
cheese_and_crackers(amount_of_cheese + 100, amount_of_crackers + 1000)<|fim_prefix|># repo: aurelo/lphw path: /... | code_fim | medium | {
"lang": "python",
"repo": "aurelo/lphw",
"path": "/source/ex19.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
self.basic = ['conceit']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_conceits.py
#calss header
class _CONCEITS():
def __init__(self,):
<|fim_middle|> self.name = "CONCEITS"
self.definitions = conceit
self.parents = []
self.childen = []
self.properties = []
s... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/otherforms/_conceits.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_conceits.py
#calss header
class _CONCEITS():
def __init__(self,):
<|fim_suffix|> self.basic = ['conceit']<|fim_middle|> self.name = "CONCEITS"
self.definitions = conceit
self.parents = []
self.childen = []
self.properties = []
se... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/otherforms/_conceits.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.basic = ['conceit']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_conceits.py
#calss header
class _CONCEITS():
<|fim_middle|> def __init__(self,):
self.name = "CONCEITS"
self.definitions = conceit
self.parents = []
self.childen = []
self.properties = []
se... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/otherforms/_conceits.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main() -> None:
c = Catalogue(Path("/home/lukas/templates"))
x = cv2.imread("testboards/3.jpg")
# x = get_screen()
squares = getSquares(x, R1440P_CONFIG)
match_squares(c, squares, debug=True)
if __name__ == "__main__":
main()<|fim_prefix|># repo: corrodedHash/sigmarsGarden ... | code_fim | hard | {
"lang": "python",
"repo": "corrodedHash/sigmarsGarden",
"path": "/tools/match.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: corrodedHash/sigmarsGarden path: /tools/match.py
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
import cv2
from sigmarsGarden.catalogue import Catalogue
from sigmarsGarden.config import R1440P_CONFIG
from sigmarsGarden.parse import getSquares
from sigmarsGarden.scre... | code_fim | medium | {
"lang": "python",
"repo": "corrodedHash/sigmarsGarden",
"path": "/tools/match.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main() -> None:
c = Catalogue(Path("/home/lukas/templates"))
x = cv2.imread("testboards/3.jpg")
# x = get_screen()
squares = getSquares(x, R1440P_CONFIG)
match_squares(c, squares, debug=True)
if __name__ == "__main__":
main()<|fim_prefix|># repo: corrodedHash/sigmarsGarden... | code_fim | hard | {
"lang": "python",
"repo": "corrodedHash/sigmarsGarden",
"path": "/tools/match.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> client.enable_enhanced_monitoring(
StreamName=stream_name, ShardLevelMetrics=["IncomingBytes", "OutgoingBytes"]
)
resp = client.enable_enhanced_monitoring(
StreamName=stream_name, ShardLevelMetrics=["WriteProvisionedThroughputExceeded"]
)
assert len(resp["CurrentShard... | code_fim | hard | {
"lang": "python",
"repo": "localstack/moto",
"path": "/tests/test_kinesis/test_kinesis_monitoring.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: localstack/moto path: /tests/test_kinesis/test_kinesis_monitoring.py
import boto3
from moto import mock_kinesis
from tests import DEFAULT_ACCOUNT_ID
from .test_kinesis import get_stream_arn
@mock_kinesis
def test_enable_enhanced_monitoring_all():
client = boto3.client("kinesis", region_nam... | code_fim | hard | {
"lang": "python",
"repo": "localstack/moto",
"path": "/tests/test_kinesis/test_kinesis_monitoring.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> client = boto3.client("kinesis", region_name="us-east-1")
stream_name = "my_stream_summary"
client.create_stream(StreamName=stream_name, ShardCount=4)
client.enable_enhanced_monitoring(
StreamName=stream_name, ShardLevelMetrics=["IncomingBytes", "OutgoingBytes"]
)
stream ... | code_fim | hard | {
"lang": "python",
"repo": "localstack/moto",
"path": "/tests/test_kinesis/test_kinesis_monitoring.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lau1406/MusicVoter path: /Voter/data_helpers.py
import spotipy
from spotipy import util
from Voter.models import *
import os
from Voter.serializers import SongSerializer
def get_update_data(user_pk):
# Get current song
# TODO: define this elsewhere?
scope = 'user-modify-playback-s... | code_fim | hard | {
"lang": "python",
"repo": "Lau1406/MusicVoter",
"path": "/Voter/data_helpers.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> track_data = sp.current_user_playing_track()['item']
current_track, created = Song.objects.get_or_create(
uri=track_data['uri'],
defaults={
'name': track_data['name'],
'image': track_data['album']['images'][0]['url'],
'length_ms': track_data['dur... | code_fim | medium | {
"lang": "python",
"repo": "Lau1406/MusicVoter",
"path": "/Voter/data_helpers.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> if variant.CHROM.startswith('chr'):
chrom = variant.CHROM[3:]
else:
chrom = variant.CHROM
if chrom in tree:
overlap = tree[chrom].search(variant.POS)
if len(overlap) == 0:
reject_exon += 1
else:
accept += 1
sys.stdout.write(... | code_fim | hard | {
"lang": "python",
"repo": "khalidm/somatic-target-panel-pipeline",
"path": "/src/mutation_rate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Calculate mutation rate')
parser.add_argument('--vcfs', nargs='+', help='list of vcfs')
parser.add_argument('--bed', required=True, help='filter')
parser.add_argument('--verbose', action='store_true', help='more logging')
p... | code_fim | hard | {
"lang": "python",
"repo": "khalidm/somatic-target-panel-pipeline",
"path": "/src/mutation_rate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: khalidm/somatic-target-panel-pipeline path: /src/mutation_rate.py
#!/usr/bin/env python
'''
Intersects a vcf file with a bed and annotates it with bed values
Usage:
$0 bed < vcf > annotated_filtered_vcf
'''
import argparse
import logging
import sys
import cyvcf2
import intervaltree
d... | code_fim | hard | {
"lang": "python",
"repo": "khalidm/somatic-target-panel-pipeline",
"path": "/src/mutation_rate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tensorflow path: /tensorflow/python/data/util/traverse_test.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# 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... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/data/util/traverse_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ds = dataset_ops.Dataset.range(10).map(math_ops.square)
variant_tensor_ops = traverse.obtain_all_variant_tensor_ops(ds)
self.assertSetEqual(
set(["MapDataset", "RangeDataset"]),
set(x.name for x in variant_tensor_ops))
@combinations.generate(test_base.graph_only_combinations... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/data/util/traverse_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vstconsulting/vstutils path: /test_src/test_proj/suburls.py
from django.urls.conf import re_path
from django.contrib import admin
<|fim_suffix|>urlpatterns = [
re_path(r'^admin/', admin.site.urls),
re_path(r'^', admin.site.urls),
]<|fim_middle|>app_name = 'suburls_app'
| code_fim | easy | {
"lang": "python",
"repo": "vstconsulting/vstutils",
"path": "/test_src/test_proj/suburls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = [
re_path(r'^admin/', admin.site.urls),
re_path(r'^', admin.site.urls),
]<|fim_prefix|># repo: vstconsulting/vstutils path: /test_src/test_proj/suburls.py
from django.urls.conf import re_path
from django.contrib import admin
<|fim_middle|>app_name = 'suburls_app'
| code_fim | easy | {
"lang": "python",
"repo": "vstconsulting/vstutils",
"path": "/test_src/test_proj/suburls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pranjali97/OpenNMT-tf path: /opennmt/tests/training_test.py
import json
import os
import tensorflow as tf
from opennmt import inputters, models, training
from opennmt.tests import test_util
def _make_seq2seq_model(temp_dir):
vocab = test_util.make_vocab(
os.path.join(temp_dir, "vo... | code_fim | hard | {
"lang": "python",
"repo": "pranjali97/OpenNMT-tf",
"path": "/opennmt/tests/training_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> moving_average = training.MovingAverage(variables, step)
with strategy.scope():
moving_average.update()
variables[0].assign(3.0)
variables[1].assign(4.0)
with strategy.scope():
moving_average.update()
self.assertAllEqual(self.evalu... | code_fim | hard | {
"lang": "python",
"repo": "pranjali97/OpenNMT-tf",
"path": "/opennmt/tests/training_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bitcoin/bitcoin path: /test/functional/wallet_hd.py
#!/usr/bin/env python3
# Copyright (c) 2016-2022 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test Hierarchical Determinis... | code_fim | hard | {
"lang": "python",
"repo": "bitcoin/bitcoin",
"path": "/test/functional/wallet_hd.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.options.descriptors:
assert_equal(keypath[0:14], "m/84h/1h/0h/1/")
else:
assert_equal(keypath[0:7], "m/0'/1'")
if not self.options.descriptors:
# Generate a new HD seed on node 1 and make sure it is set
orig_masterkeyid = sel... | code_fim | hard | {
"lang": "python",
"repo": "bitcoin/bitcoin",
"path": "/test/functional/wallet_hd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check persistence of inactive seed by reloading restore. restore2 is still loaded to test the case where the wallet is not reloaded
restore_rpc.unloadwallet()
self.nodes[1].loadwallet('restore')
restore_rpc = self.nodes[1].get_wallet_rpc('restore')
... | code_fim | hard | {
"lang": "python",
"repo": "bitcoin/bitcoin",
"path": "/test/functional/wallet_hd.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dim_env = n_objects+n_agents+n_repositories
R = -1*np.ones([dim_env, dim_env])
Q = np.zeros([dim_env, dim_env])
# Distancia entre agentes e objetos
for i in range(n_agents):
for j in range(n_objects):
R[i,j+n_agents] = f_mult/np.linalg.norm(agents[i]-objects[j,0:2]... | code_fim | medium | {
"lang": "python",
"repo": "LucasFDutra/engenharia-eletrica",
"path": "/Algoritmo Multi-Agente Aplicado a Entrega e Coleta de Objetos/create_environment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LucasFDutra/engenharia-eletrica path: /Algoritmo Multi-Agente Aplicado a Entrega e Coleta de Objetos/create_environment.py
import numpy as np
def CreateEnvironment(dir_agents, dir_objects, dir_repositories, f_mult=1):
agents = np.genfromtxt(dir_agents, delimiter=',')
objects = np.genfrom... | code_fim | medium | {
"lang": "python",
"repo": "LucasFDutra/engenharia-eletrica",
"path": "/Algoritmo Multi-Agente Aplicado a Entrega e Coleta de Objetos/create_environment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Distancia entre agentes e objetos
for i in range(n_agents):
for j in range(n_objects):
R[i,j+n_agents] = f_mult/np.linalg.norm(agents[i]-objects[j,0:2])
# Distancia entre objetos e repositórios
for i in range(n_objects):
for j in range(n_repositories):
... | code_fim | medium | {
"lang": "python",
"repo": "LucasFDutra/engenharia-eletrica",
"path": "/Algoritmo Multi-Agente Aplicado a Entrega e Coleta de Objetos/create_environment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ibis-project/ibis path: /ibis/backends/impala/tests/test_udf.py
return table.tinyint_col
@pytest.fixture
def i16(table):
return table.smallint_col
@pytest.fixture
def i32(table):
return table.int_col
@pytest.fixture
def i64(table):
return table.bigint_col
@pytest.fixture
def ... | code_fim | hard | {
"lang": "python",
"repo": "ibis-project/ibis",
"path": "/ibis/backends/impala/tests/test_udf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> db = temp_database
udfcon.create_function(func, database=db)
funcs = udfcon.list_udas(database=db)
f = funcs[0]
assert f.name == func.name
assert f.inputs == func.inputs
assert f.output == func.output
@pytest.mark.xfail(
reason="Unknown reason. xfailing to restore the C... | code_fim | hard | {
"lang": "python",
"repo": "ibis-project/ibis",
"path": "/ibis/backends/impala/tests/test_udf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _register_uda(inputs, output, name):
func = api.aggregate_function(inputs, output, name=name)
func.register(name, "ibis_testing")
return func
@pytest.fixture
def udfcon(con, monkeypatch):
monkeypatch.setitem(con.con.options, "DISABLE_CODEGEN", "0")
return con
@pytest.fixture
d... | code_fim | hard | {
"lang": "python",
"repo": "ibis-project/ibis",
"path": "/ibis/backends/impala/tests/test_udf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mveselov/CodeWars path: /katas/kyu_6/your_ride_is_here.py
from string import ascii_uppercase
AZ = dict(zip(ascii_uppercase, xrange(1, 27)))
<|fim_suffix|>
def ride(group, comet):
return 'GO' if product_mod_47(group) == product_mod_47(comet) else 'STAY'<|fim_middle|>
def product_mod_47(seq):... | code_fim | medium | {
"lang": "python",
"repo": "mveselov/CodeWars",
"path": "/katas/kyu_6/your_ride_is_here.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def ride(group, comet):
return 'GO' if product_mod_47(group) == product_mod_47(comet) else 'STAY'<|fim_prefix|># repo: mveselov/CodeWars path: /katas/kyu_6/your_ride_is_here.py
from string import ascii_uppercase
AZ = dict(zip(ascii_uppercase, xrange(1, 27)))
<|fim_middle|>def product_mod_47(seq):
... | code_fim | medium | {
"lang": "python",
"repo": "mveselov/CodeWars",
"path": "/katas/kyu_6/your_ride_is_here.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'GO' if product_mod_47(group) == product_mod_47(comet) else 'STAY'<|fim_prefix|># repo: mveselov/CodeWars path: /katas/kyu_6/your_ride_is_here.py
from string import ascii_uppercase
AZ = dict(zip(ascii_uppercase, xrange(1, 27)))
def product_mod_47(seq):
return reduce(lambda a, b: a * b, ... | code_fim | easy | {
"lang": "python",
"repo": "mveselov/CodeWars",
"path": "/katas/kyu_6/your_ride_is_here.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> page_path = os.path.join(self.post_dir, "%s-%s.md" % (p["post_date"].split(" ")[0], p["post_name"]))
more_tag = '<!--more-->'
content = more_tag.join([self.__convert_to_markdown(data) for data in p["content"].split(more_tag)])
with open(page_path, "w") as ... | code_fim | hard | {
"lang": "python",
"repo": "hzmangel/wp2hugo",
"path": "/hugo_printer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.