text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>def welcome():
session_attributes = {}
card_title = "Welcome"
say = "Hello. How are you? "
reprompt = "What would you like to know? Ask away"
should_end_session = False
return response(session_attributes, speechlet_response(
card_title, say, reprompt, should_end_session))
... | code_fim | hard | {
"lang": "python",
"repo": "jnicho02/greyhound-alexa-skill",
"path": "/handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jnicho02/greyhound-alexa-skill path: /handler.py
import boto3
import botocore.config
import datetime
import dog
import json
import mixpanel
import os
bucket = 'greyhound-alexa-skill-de-serverlessdeploymentbuck-14c51cxj3j8zx'
s3 = boto3.client(
's3',
'eu-west-1',
config=botocore.confi... | code_fim | hard | {
"lang": "python",
"repo": "jnicho02/greyhound-alexa-skill",
"path": "/handler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='enterprisewechatapp',
name='agent_id',
field=models.CharField(default=None, max_length=1024),
preserve_default=False,
),
]<|fim_prefix|># repo: xlmvm1984/robot_pi path: /enterprise_wech... | code_fim | medium | {
"lang": "python",
"repo": "xlmvm1984/robot_pi",
"path": "/enterprise_wechat/migrations/0002_enterprisewechatapp_agent_id.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xlmvm1984/robot_pi path: /enterprise_wechat/migrations/0002_enterprisewechatapp_agent_id.py
# Generated by Django 2.1.3 on 2018-11-16 16:18
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AddField(
model_name='enterprisewechatapp',
... | code_fim | medium | {
"lang": "python",
"repo": "xlmvm1984/robot_pi",
"path": "/enterprise_wechat/migrations/0002_enterprisewechatapp_agent_id.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bglima/mlclass path: /03_Validation/wekaexamples/helper.py
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | code_fim | hard | {
"lang": "python",
"repo": "bglima/mlclass",
"path": "/03_Validation/wekaexamples/helper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def print_title(title):
"""
Prints the title underlined.
:param title: the title to print
:type title: str
"""
print("\n" + title)
print("=" * len(title))
def print_info(info):
"""
Prints the info.
:param info: the info to print
:type info: str
"""
p... | code_fim | hard | {
"lang": "python",
"repo": "bglima/mlclass",
"path": "/03_Validation/wekaexamples/helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def print_info(info):
"""
Prints the info.
:param info: the info to print
:type info: str
"""
print("\n" + info)<|fim_prefix|># repo: bglima/mlclass path: /03_Validation/wekaexamples/helper.py
# This program is free software: you can redistribute it and/or modify
# it under the t... | code_fim | medium | {
"lang": "python",
"repo": "bglima/mlclass",
"path": "/03_Validation/wekaexamples/helper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: couchbase/couchbase-python-client path: /couchbase/tests/kv_range_scan_t.py
canOptions
from couchbase.result import ScanResult, ScanResultIterable
from tests.environments import CollectionType
from tests.test_features import EnvironmentFeatures
class RangeScanTestSuite:
TEST_MANIFEST = [
... | code_fim | hard | {
"lang": "python",
"repo": "couchbase/couchbase-python-client",
"path": "/couchbase/tests/kv_range_scan_t.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: couchbase/couchbase-python-client path: /couchbase/tests/kv_range_scan_t.py
with_batch_item_limit',
'test_prefix_scan_with_concurrency',
'test_sampling_scan_with_batch_byte_limit',
'test_sampling_scan_with_batch_item_limit',
'test_sampling_scan_with_concurrency',
... | code_fim | hard | {
"lang": "python",
"repo": "couchbase/couchbase-python-client",
"path": "/couchbase/tests/kv_range_scan_t.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # w/ the seed, we should get the same results
res = cb_env.collection.scan(scan_type, ScanOptions(timeout=timedelta(seconds=10),
ids_only=True,
consistent_with=test_mutat... | code_fim | hard | {
"lang": "python",
"repo": "couchbase/couchbase-python-client",
"path": "/couchbase/tests/kv_range_scan_t.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.DeleteModel(
name='locations',
),
]<|fim_prefix|># repo: mriduldhall/DroneNav path: /user_system/migrations/0008_delete_locations.py
# Generated by Django 3.1.4 on 2020-12-23 14:37
from django.db import migrations
<|fim_middle|>
class Migrat... | code_fim | medium | {
"lang": "python",
"repo": "mriduldhall/DroneNav",
"path": "/user_system/migrations/0008_delete_locations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('user_system', '0007_delete_routes'),
]
operations = [
migrations.DeleteModel(
name='locations',
),
]<|fim_prefix|># repo: mriduldhall/DroneNav path: /user_system/migrations/0008_delete_location... | code_fim | easy | {
"lang": "python",
"repo": "mriduldhall/DroneNav",
"path": "/user_system/migrations/0008_delete_locations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mriduldhall/DroneNav path: /user_system/migrations/0008_delete_locations.py
# Generated by Django 3.1.4 on 2020-12-23 14:37
from django.db import migrations
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.DeleteModel(
name='locations',
... | code_fim | medium | {
"lang": "python",
"repo": "mriduldhall/DroneNav",
"path": "/user_system/migrations/0008_delete_locations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PandABlocks/PandABlocks-FPGA path: /common/python/make_extensions.py
# This script installs files into the extensions directory
import sys
import os.path
import shutil
import fnmatch
from .ini_util import read_ini, ini_get
def get_modules(ini):
for section in ini.sections():
if se... | code_fim | hard | {
"lang": "python",
"repo": "PandABlocks/PandABlocks-FPGA",
"path": "/common/python/make_extensions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> top = sys.argv[1]
app_file = sys.argv[2]
target = sys.argv[3]
extensions = sys.argv[4]
target_dir = os.path.join(top, 'targets', target)
modules_dir = os.path.join(top, 'modules')
target_ini = read_ini(os.path.join(target_dir, '%s.target.ini' % target))
app_ini = read_ini... | code_fim | hard | {
"lang": "python",
"repo": "PandABlocks/PandABlocks-FPGA",
"path": "/common/python/make_extensions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self, inode=None, location=None, parent=None, **kwargs):
"""Initializes a path specification.
Note that an XFS path specification must have a parent.
Args:
inode (Optional[int]): inode.
location (Optional[str]): location.
parent (Optional[PathSpec]): parent path speci... | code_fim | hard | {
"lang": "python",
"repo": "log2timeline/dfvfs",
"path": "/dfvfs/path/xfs_path_spec.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: log2timeline/dfvfs path: /dfvfs/path/xfs_path_spec.py
# -*- coding: utf-8 -*-
"""The XFS path specification implementation."""
from dfvfs.lib import definitions
from dfvfs.path import factory
from dfvfs.path import path_spec
class XFSPathSpec(path_spec.PathSpec):
<|fim_suffix|> Args:
... | code_fim | hard | {
"lang": "python",
"repo": "log2timeline/dfvfs",
"path": "/dfvfs/path/xfs_path_spec.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if "continue" not in r_json:
print(r_json)
break
else:
cont = r_json["continue"]["cmcontinue"]
with open('data/users.csv', 'w', newline='') as csvfile:
fieldnames = ['name']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
writ... | code_fim | hard | {
"lang": "python",
"repo": "jfilter/wikipedia-edits-verified-accounts",
"path": "/get_verified_users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
with open('data/users.csv', 'w', newline='') as csvfile:
fieldnames = ['name']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
writer.writerows(user)<|fim_prefix|># repo: jfilter/wikipedia-edits-verified-accounts path: /get_verified_users.py
import csv
impor... | code_fim | hard | {
"lang": "python",
"repo": "jfilter/wikipedia-edits-verified-accounts",
"path": "/get_verified_users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jfilter/wikipedia-edits-verified-accounts path: /get_verified_users.py
import csv
import pathlib
import requests
# create folders for later use
pathlib.Path('data/recent_changes').mkdir(parents=True, exist_ok=True)
pathlib.Path('data/allrevisions').mkdir(parents=True, exist_ok=True)
base_url... | code_fim | hard | {
"lang": "python",
"repo": "jfilter/wikipedia-edits-verified-accounts",
"path": "/get_verified_users.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> TEST = True
DEBUG = False
class DevConfig(Config):
DEBUG = True
class PrdConfig(Config):
pass<|fim_prefix|># repo: LaundroMat/save-belgium-from-telemarketing path: /config.py
class Config(object):
<|fim_middle|> DEBUG = True
TEST = True
class TestConfig(Config):
| code_fim | medium | {
"lang": "python",
"repo": "LaundroMat/save-belgium-from-telemarketing",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LaundroMat/save-belgium-from-telemarketing path: /config.py
class Config(object):
<|fim_suffix|>
class TestConfig(Config):
TEST = True
DEBUG = False
class DevConfig(Config):
DEBUG = True
class PrdConfig(Config):
pass<|fim_middle|> DEBUG = True
TEST = True
| code_fim | easy | {
"lang": "python",
"repo": "LaundroMat/save-belgium-from-telemarketing",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dannl/hunter-sim-classic path: /event/tick.py
from event import Event
class Tick(Event):
<|fim_suffix|> super().__init__('tick', priority)
self.ticker = ticker
self.engine = engine
self.char_state = char_state
def act(self):
self.ticker.tick(self.engi... | code_fim | medium | {
"lang": "python",
"repo": "dannl/hunter-sim-classic",
"path": "/event/tick.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def act(self):
self.ticker.tick(self.engine, self.char_state)<|fim_prefix|># repo: dannl/hunter-sim-classic path: /event/tick.py
from event import Event
class Tick(Event):
<|fim_middle|>
def __init__(self, ticker, engine, char_state, priority):
super().__init__('tick', priority)... | code_fim | hard | {
"lang": "python",
"repo": "dannl/hunter-sim-classic",
"path": "/event/tick.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__('tick', priority)
self.ticker = ticker
self.engine = engine
self.char_state = char_state
def act(self):
self.ticker.tick(self.engine, self.char_state)<|fim_prefix|># repo: dannl/hunter-sim-classic path: /event/tick.py
from event import Event
... | code_fim | medium | {
"lang": "python",
"repo": "dannl/hunter-sim-classic",
"path": "/event/tick.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> os.makedirs(git_dir)
os.makedirs(work_tree)
# Prepare master repo
master.git.checkout(b=test_name)
# Create work tree
with open(join(work_tree, '.git'), 'w') as f:
f.write('gitdir: ' + git_dir)
# Clone master
os.environ['GIT_DIR'] = git_dir
os.environ['GIT_WO... | code_fim | medium | {
"lang": "python",
"repo": "msiemens/PyGitUp",
"path": "/PyGitUp/tests/test_out_of_tree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create work tree
with open(join(work_tree, '.git'), 'w') as f:
f.write('gitdir: ' + git_dir)
# Clone master
os.environ['GIT_DIR'] = git_dir
os.environ['GIT_WORK_TREE'] = work_tree
repo = Repo.init(work_tree)
repo.git.remote('add', 'origin', master_path)
repo.git... | code_fim | medium | {
"lang": "python",
"repo": "msiemens/PyGitUp",
"path": "/PyGitUp/tests/test_out_of_tree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: msiemens/PyGitUp path: /PyGitUp/tests/test_out_of_tree.py
# System imports
import os
from os.path import join
from git import *
from PyGitUp.tests import basepath, write_file, init_master
test_name = 'out-of-tree'
testfile_name = 'file'
<|fim_suffix|> # Modify file in our repo
repo_path... | code_fim | hard | {
"lang": "python",
"repo": "msiemens/PyGitUp",
"path": "/PyGitUp/tests/test_out_of_tree.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nerdymcnerdyson/pythonPlay path: /pythonCodeJam/standingOvation/standingO.py
import sys
rl = lambda: sys.stdin.readline().strip()
cases = int(rl())
for case in xrange(cases):
crowd = rl().split()[1]<|fim_suffix|>hyLevel
runningTotal += (int(person) - 1)
if runningTotal < 0:
#print 'invi... | code_fim | medium | {
"lang": "python",
"repo": "nerdymcnerdyson/pythonPlay",
"path": "/pythonCodeJam/standingOvation/standingO.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> runningTotal += 1
#print 'invited friend', runningTotal
#shyLevel+= 1
print 'Case #{0}: {1}'.format(case+1, invited)<|fim_prefix|># repo: nerdymcnerdyson/pythonPlay path: /pythonCodeJam/standingOvation/standingO.py
import sys
rl = lambda: sys.stdin.readline().strip()
cases = int(rl())
for case... | code_fim | hard | {
"lang": "python",
"repo": "nerdymcnerdyson/pythonPlay",
"path": "/pythonCodeJam/standingOvation/standingO.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marc-hanheide/QuickVote path: /modules/domains.py
# common imports
from modules.common import *
import modules.glob as glob
from collections import defaultdict
import math
class domain_manager:
def __init__(self, db):
self.domain_coll = db['domains']
self.ensure_debug_domain()
se... | code_fim | hard | {
"lang": "python",
"repo": "marc-hanheide/QuickVote",
"path": "/modules/domains.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check that domain exists
def is_domain(self,domain):
# ensure domain is safe (alphanumeric)
if domain.isalnum() == False:
if domain.isalpha() == False:
if domain.isdigit() == False:
return False
# test if domain exists
if self.domain_coll.find_one({'name' : d... | code_fim | hard | {
"lang": "python",
"repo": "marc-hanheide/QuickVote",
"path": "/modules/domains.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_active_session(self, domain, quuid):
c = self.domain_coll.find_one({'name': domain})
if 'session' not in c:
c['session'] = {}
if quuid not in c['session']:
return self.set_active_session(domain, quuid)
return c['session'][quuid]
# Check that domain exists
def... | code_fim | hard | {
"lang": "python",
"repo": "marc-hanheide/QuickVote",
"path": "/modules/domains.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdempsey/ml_search path: /tests/test_ml_search.py
import pytest
from mock import MagicMock, patch
from ml_search.ml_search import MLSearch
import json
<|fim_suffix|> """Create an instance of the MLSearch class."""
ml_search_instance = MLSearch()
ml_search_instance.log_level = 'INFO'
... | code_fim | medium | {
"lang": "python",
"repo": "rdempsey/ml_search",
"path": "/tests/test_ml_search.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ml_search_instance
# Test functions
# ==============
class TestMLSearch(object):
pass<|fim_prefix|># repo: rdempsey/ml_search path: /tests/test_ml_search.py
import pytest
from mock import MagicMock, patch
from ml_search.ml_search import MLSearch
import json
<|fim_middle|># Helper fixtu... | code_fim | hard | {
"lang": "python",
"repo": "rdempsey/ml_search",
"path": "/tests/test_ml_search.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/RADLAN-AGGREGATEVLAN-MIB.py
#
# PySNMP MIB module RADLAN-AGGREGATEVLAN-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-AGGREGATEVLAN-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:36:39 2019
# On ... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/RADLAN-AGGREGATEVLAN-MIB.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>gregateVlanIndex.setStatus('current')
rlAggregateVlanName = MibTableColumn((1, 3, 6, 1, 4, 1, 89, 73, 2, 1, 2), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readcreate")
if mibBuilder.loadTexts: rlAggregateVlanName.setStatus('current')
rlAggregateVlanPhysAddressType = Mib... | code_fim | hard | {
"lang": "python",
"repo": "agustinhenze/mibs.snmplabs.com",
"path": "/pysnmp/RADLAN-AGGREGATEVLAN-MIB.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __moveBar(self, idx, pos):
ids = self.bars[idx]["Ids"]
for id in ids:
self.canv.delete(id)
self.bars[idx]["Ids"] = self.__addBar(pos)
self.bars[idx]["Pos"] = pos
self.bars[idx]["Value"] = pos*(self.max_val - self.min_val)+self.min_val
def __... | code_fim | hard | {
"lang": "python",
"repo": "12HuYang/Rooster",
"path": "/tkSliderWidget.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 12HuYang/Rooster path: /tkSliderWidget.py
#https://raw.githubusercontent.com/MenxLi/tkSliderWidget/master/tkSliderWidget.py
from tkinter import *
from tkinter.ttk import *
class Slider(Frame):
LINE_COLOR = "#476b6b"
LINE_WIDTH = 3
BAR_COLOR_INNER = "#5c8a8a"
BAR_COLOR_OUTTER =... | code_fim | hard | {
"lang": "python",
"repo": "12HuYang/Rooster",
"path": "/tkSliderWidget.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: armor-ai/CrossMiner path: /reviewsAnalyzeAll.py
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# __author__ = "Yichuan Man"
# __version__ = "1.0"
# __date__ = "29/4/2016"
import os
import re
import sys
import math
import json
import yaml
import gensim
import numpy as np
from sklearn.cluster import... | code_fim | hard | {
"lang": "python",
"repo": "armor-ai/CrossMiner",
"path": "/reviewsAnalyzeAll.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if avr_keywords_rating and avr_low_review_rating:
analyze_data[14].append(str(round((avr_keywords_rating - avr_low_review_rating) / avr_keywords_rating, 5)))
else:
analyze_data[14].append(str(0))
for i in range(1, len(analyze_data)):
analyze_data[i] = ' '.join(analyze_data[... | code_fim | hard | {
"lang": "python",
"repo": "armor-ai/CrossMiner",
"path": "/reviewsAnalyzeAll.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # getting clean data info
path = 'Output/' + platform + '/' + app
name = app + '_clean_data.txt'
data = read_data(path, name, '\n', 0)
clean_num = 0
clean_rating = 0
for line in data:
line = line.split('******')
if line[5] == 'None':
continue
... | code_fim | hard | {
"lang": "python",
"repo": "armor-ai/CrossMiner",
"path": "/reviewsAnalyzeAll.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f1(10)
if __name__ == '__main__':
main()<|fim_prefix|># repo: H4dr1en/flameprof path: /tests/sample2.py
import time
def f1(n):
<|fim_middle|> time.sleep(0.1)
if n:
f2(n-1)
def f2(n):
time.sleep(0.1)
if n:
f1(n-1)
def main():
| code_fim | medium | {
"lang": "python",
"repo": "H4dr1en/flameprof",
"path": "/tests/sample2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
main()<|fim_prefix|># repo: H4dr1en/flameprof path: /tests/sample2.py
import time
def f1(n):
time.sleep(0.1)
if n:
f2(n-1)
<|fim_middle|>
def f2(n):
time.sleep(0.1)
if n:
f1(n-1)
def main():
f1(10)
| code_fim | medium | {
"lang": "python",
"repo": "H4dr1en/flameprof",
"path": "/tests/sample2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: H4dr1en/flameprof path: /tests/sample2.py
import time
def f1(n):
time.sleep(0.1)
if n:
f2(n-1)
def f2(n):
time.sleep(0.1)
if n:
f1(n-1)
<|fim_suffix|>if __name__ == '__main__':
main()<|fim_middle|>
def main():
f1(10)
| code_fim | easy | {
"lang": "python",
"repo": "H4dr1en/flameprof",
"path": "/tests/sample2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> simulate = (not ( not (request.args.get('simulate', False) ) )) if simulate is not None else simulate
account = broker.get_account(account_id=account_id)
return json(broker.close_positions(account=account, positions=account.positions, simulate=simulate))
@app.route("/accounts/<account_id>/or... | code_fim | hard | {
"lang": "python",
"repo": "KloudTrader/paperbroker",
"path": "/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if order_type is None:
raise Exception('order_type is a required field')
if quantity is None:
raise Exception('quantity is a required field')
order.add_leg(asset=asset, order_type=order_type, quantity=quantity)
account = broker.get... | code_fim | hard | {
"lang": "python",
"repo": "KloudTrader/paperbroker",
"path": "/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KloudTrader/paperbroker path: /server.py
from flask import Flask, request, send_from_directory
from paperbroker import PaperBroker
from paperbroker.orders import Order
from paperbroker.adapters.quotes import TradierQuoteAdapter
import ujson
# initialize a PaperBroker with defaults
broker = Paper... | code_fim | hard | {
"lang": "python",
"repo": "KloudTrader/paperbroker",
"path": "/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Antom91/idewave-core-old path: /World/Chat/Builders/ChatPacketBuilder.py
from struct import pack
from World.Chat.Constants.ChatMsgType import ChatMsgType
from World.Chat.Constants.ChatTag import ChatTag
from Utils.Debug.Logger import Logger
<|fim_suffix|> self.message_type = kwargs.pop... | code_fim | medium | {
"lang": "python",
"repo": "Antom91/idewave-core-old",
"path": "/World/Chat/Builders/ChatPacketBuilder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.sender_guid = kwargs.pop('sender_guid')
self.response = None
def build(self):
data = bytes()
data += pack(
'<BIQI',
self.message_type,
self.message_language,
self.sender_guid,
0
)
if Ch... | code_fim | hard | {
"lang": "python",
"repo": "Antom91/idewave-core-old",
"path": "/World/Chat/Builders/ChatPacketBuilder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='teacher',
name='name',
),
migrations.AddField(
model_name='teacher',
name='phone',
field=phone_field.models.PhoneField(blank=True, help_text='Contact phone number', ma... | code_fim | medium | {
"lang": "python",
"repo": "IndiaCFG2/team-5",
"path": "/LAHI/main/migrations/0014_auto_20200808_2049.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IndiaCFG2/team-5 path: /LAHI/main/migrations/0014_auto_20200808_2049.py
# Generated by Django 3.0.6 on 2020-08-08 15:19
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import phone_field.models
<|fim_suffix|> operations = [
m... | code_fim | medium | {
"lang": "python",
"repo": "IndiaCFG2/team-5",
"path": "/LAHI/main/migrations/0014_auto_20200808_2049.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Decodes a flattended 1D array into t, img structures"""
if len(flattened) < 8:
return None
t = binary_cast(flattened[:8], 'BBBBBBBB', 'd')[0]
img = cls.decompress(flattened[8:])
return t, img
class ImageM3(binary.Binary):
"""Misura3 image... | code_fim | hard | {
"lang": "python",
"repo": "tainstr/misura.canon",
"path": "/misura/canon/reference/image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Decompress lossless image data back into 2D array."""
# translate back uint8 into string
if not isinstance(imgz, str):
imgz = ''.join([chr(d) for d in imgz])
# zlib decompression
imgz = VariableLength.decompress(imgz)
####
w = binary_c... | code_fim | hard | {
"lang": "python",
"repo": "tainstr/misura.canon",
"path": "/misura/canon/reference/image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tainstr/misura.canon path: /misura/canon/reference/image.py
# -*- coding: utf-8 -*-
"""Option persistence on HDF files."""
import tables
import numpy as np
from ..parameters import cfilter
from .reference import Reference
from .variable import VariableLength, binary_cast
from . import binary
d... | code_fim | hard | {
"lang": "python",
"repo": "tainstr/misura.canon",
"path": "/misura/canon/reference/image.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"._tick0.Tick0Validator",
"._showticksuffix.ShowticksuffixValidator",
"._showtickprefix.ShowtickprefixValidator",
"._showticklabels.ShowticklabelsValidator",
"._showline.ShowlineValidator",
"._showgrid.ShowgridValidator",
... | code_fim | hard | {
"lang": "python",
"repo": "plotly/plotly.py",
"path": "/packages/python/plotly/plotly/validators/layout/ternary/aaxis/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plotly/plotly.py path: /packages/python/plotly/plotly/validators/layout/ternary/aaxis/__init__.py
import sys
from typing import TYPE_CHECKING
if sys.version_info < (3, 7) or TYPE_CHECKING:
from ._uirevision import UirevisionValidator
from ._title import TitleValidator
from ._tickwidt... | code_fim | hard | {
"lang": "python",
"repo": "plotly/plotly.py",
"path": "/packages/python/plotly/plotly/validators/layout/ternary/aaxis/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catapult-project/catapult path: /telemetry/telemetry/core/cros_interface.py
le|.
Args:
filename: The name of the remote source file.
destfile: The name of the file to copy to, and if it is not specified
then it is the basename of the source file.
"""
logging.debu... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/telemetry/telemetry/core/cros_interface.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Copies a remote file |filename| on the device to a local file |destfile|.
Args:
filename: The name of the remote source file.
destfile: The name of the file to copy to, and if it is not specified
then it is the basename of the source file.
"""
logging.debug("GetFil... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/telemetry/telemetry/core/cros_interface.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catapult-project/catapult path: /telemetry/telemetry/core/cros_interface.py
default location. We have to check for both
# paths in order to support this workflow.
_CHROME_PROCESS_REGEX = [re.compile(r'^/opt/google/chrome/chrome '),
re.compile(r'^/usr/local/?.*/chrome/chr... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/telemetry/telemetry/core/cros_interface.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@login_required
def trocar_senha(request):
form = TrocarSenhaForm(request, request.POST or None)
if form.is_valid():
form.save()
return HttpResponseRedirect('/')
context = {'form': form}
return render_to_response('trocar_senha.html',
context,
... | code_fim | hard | {
"lang": "python",
"repo": "andredalton/imecare",
"path": "/imecare/views/paciente.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andredalton/imecare path: /imecare/views/paciente.py
# coding=utf-8
from django.contrib.auth.decorators import login_required
from ..forms import TrocarSenhaForm
from ..models import Pessoa, Atendimento, Realiza
from django.http import *
from django.shortcuts import render_to_response
from djang... | code_fim | hard | {
"lang": "python",
"repo": "andredalton/imecare",
"path": "/imecare/views/paciente.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@login_required
def meus_procedimentos(request):
realizados = Realiza.objects.filter(paciente=request.user).order_by('-data', '-horario')
context = {'realizados': realizados}
return render_to_response('meus_procedimentos.html',
context,
... | code_fim | hard | {
"lang": "python",
"repo": "andredalton/imecare",
"path": "/imecare/views/paciente.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sum = 0
result = list( 0 for x in l)
for i in range( 0, N ):
sum = sum + l[i]
result[i] = sum / (i+1)
for i in range( N, len(l) ):
sum = sum - l[i-N] + l[i]
result[i] = sum / N
return result
def file_parser(fnames, nodes):
i = 0
for f in fnames... | code_fim | hard | {
"lang": "python",
"repo": "pgaref/memcached_bench",
"path": "/Python_plots/plots/utilisation/disk/cluster_disk.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pgaref/memcached_bench path: /Python_plots/plots/utilisation/disk/cluster_disk.py
__author__ = "Panagiotis Garefalakis"
__copyright__ = "Imperial College London"
# The MIT License (MIT)
#
# Copyright (c) 2016 Panagiotis Garefalakis
#
# Permission is hereby granted, free of charge, to any person ... | code_fim | hard | {
"lang": "python",
"repo": "pgaref/memcached_bench",
"path": "/Python_plots/plots/utilisation/disk/cluster_disk.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: saadmk11/resume-website path: /resume/cv/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappabl... | code_fim | hard | {
"lang": "python",
"repo": "saadmk11/resume-website",
"path": "/resume/cv/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lank=True)),
('other_skills', models.CharField(help_text=b'Sparate Skills by comma', max_length=200, blank=True)),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='WorkExperience',
... | code_fim | hard | {
"lang": "python",
"repo": "saadmk11/resume-website",
"path": "/resume/cv/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert uppercase_keys.__name__ == 'uppercase_keys'
assert uppercase_keys.__doc__ == ' Yelling keys. '
assert uppercase_keys({'ham': 'spam'}) == {'HAM': 'spam'}
assert uppercase_keys({'ham': 'spam'}) == {'HAM': 'spam'}
cache_info = uppercase_keys.cache_info()
assert cache_info.hits ... | code_fim | medium | {
"lang": "python",
"repo": "aeri4list/deck-chores",
"path": "/tests/test_utils.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aeri4list/deck-chores path: /tests/test_utils.py
from deck_chores.utils import lru_dict_arg_cache
@lru_dict_arg_cache
def uppercase_keys(arg: dict) -> dict:
<|fim_suffix|>
def test_lru_cache():
assert uppercase_keys.__name__ == 'uppercase_keys'
assert uppercase_keys.__doc__ == ' Yelling... | code_fim | medium | {
"lang": "python",
"repo": "aeri4list/deck-chores",
"path": "/tests/test_utils.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JulianoLagana/MT3 path: /src/modules/mlp.py
import torch
from torch import nn, Tensor
from torch.nn import functional as F
class MLP(nn.Module):
""" Very simple multi-layer perceptron (also called FFN)"""
def __init__(self, input_dim, hidden_dim, output_dim, num_layers):
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "JulianoLagana/MT3",
"path": "/src/modules/mlp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__()
self.num_layers = num_layers
h = [hidden_dim] * (num_layers - 1)
self.layers = nn.ModuleList(nn.Linear(n, k) for n, k in zip([input_dim] + h, h + [output_dim]))
def forward(self, x):
for i, layer in enumerate(self.layers):
x = F.r... | code_fim | medium | {
"lang": "python",
"repo": "JulianoLagana/MT3",
"path": "/src/modules/mlp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mkoistinen/django-easy-select2 path: /easy_select2/__init__.py
__all__ = [
'select2_meta_factory', 'select2_modelform_meta', 'select2<|fim_suffix|>elect2_modelform
from widgets import Select2Mixin, Select2, Select2Multiple<|fim_middle|>_modelform',
'Select2', 'Select2Multiple', 'Select2Mi... | code_fim | medium | {
"lang": "python",
"repo": "mkoistinen/django-easy-select2",
"path": "/easy_select2/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>elect2_modelform
from widgets import Select2Mixin, Select2, Select2Multiple<|fim_prefix|># repo: mkoistinen/django-easy-select2 path: /easy_select2/__init__.py
__all__ = [
'select2_meta_factory', 'select2_modelform_meta', 'select2_modelform',
'Select2', 'Select2Multiple', 'Select2Mixin', 'apply_s... | code_fim | medium | {
"lang": "python",
"repo": "mkoistinen/django-easy-select2",
"path": "/easy_select2/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dominoFire/sweeper path: /sweeper/utils.py
__author__ = '@dominofire'
import itertools
import os
import pandas as pd
import networkx as nx
#import matplotlib.pyplot as plt
import uuid
import logging
def split_path(file_location):
"""
Divide un path de un archivo en una tupla de la form... | code_fim | hard | {
"lang": "python",
"repo": "dominoFire/sweeper",
"path": "/sweeper/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def export_gml(workflow, file_name='workflow.gml'):
g = nx.DiGraph()
for t in workflow.tasks:
g.add_node(t)
for d in workflow.dependencies:
g.add_edge(d[0], d[1])
print(workflow)
print(workflow.tasks)
print(workflow.dependencies)
nx.write_gml(g, file_name, stri... | code_fim | hard | {
"lang": "python",
"repo": "dominoFire/sweeper",
"path": "/sweeper/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# def plot_gantt_chart(schedule_mapping_list, filename=None, title='Scheduling plan'):
# """
# Plot a Gantt chart of the SchedulingMapping List
# :param schedule_mapping_list: SchedulingMapping list of SchedulingMapping
# :return: None, plot is
# """
# import math
# import rpy... | code_fim | hard | {
"lang": "python",
"repo": "dominoFire/sweeper",
"path": "/sweeper/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def download(self):
# Make sure the directory exists #
self.dest.directory.create(safe=True)
# Remove previous download #
self.dest.remove()
# Message #
print("\n Downloading '%s'" % self.url)
# Download #
import wget
return wget.... | code_fim | hard | {
"lang": "python",
"repo": "xapple/seqsearch",
"path": "/seqsearch/databases/mothur/silva.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xapple/seqsearch path: /seqsearch/databases/mothur/silva.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Written by Lucas Sinclair.
MIT Licensed.
Contact at www.sinclair.bio
"""
# Built-in modules #
import os, tarfile
# First party modules #
from seqsearch.databases import Database
from... | code_fim | hard | {
"lang": "python",
"repo": "xapple/seqsearch",
"path": "/seqsearch/databases/mothur/silva.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> all_paths = """
/silva.tgz
"""
@property
def rank_names(self):
"""
The names of the taxonomic rank at each level.
There are a total of 7 ranks.
"""
return ['Domain', # 0
'Phylum', # 1
... | code_fim | hard | {
"lang": "python",
"repo": "xapple/seqsearch",
"path": "/seqsearch/databases/mothur/silva.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mdgart/scarlet path: /scarlet/scheduling/management/commands/do_scheduled_updates.py
from django.core.management.base import BaseCommand
from django.db import transaction
from django.utils import timezone
<|fim_suffix|> def handle(self, *args, **options):
with transaction.commit_on_su... | code_fim | easy | {
"lang": "python",
"repo": "mdgart/scarlet",
"path": "/scarlet/scheduling/management/commands/do_scheduled_updates.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Command(BaseCommand):
def handle(self, *args, **options):
with transaction.commit_on_success():
for obj in models.Schedule.objects.select_for_update(
).filter(when__lte=timezone.now()):
obj.do_updates()<|fim_prefix|># repo:... | code_fim | easy | {
"lang": "python",
"repo": "mdgart/scarlet",
"path": "/scarlet/scheduling/management/commands/do_scheduled_updates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with transaction.commit_on_success():
for obj in models.Schedule.objects.select_for_update(
).filter(when__lte=timezone.now()):
obj.do_updates()<|fim_prefix|># repo: mdgart/scarlet path: /scarlet/scheduling/management/commands/do_sch... | code_fim | medium | {
"lang": "python",
"repo": "mdgart/scarlet",
"path": "/scarlet/scheduling/management/commands/do_scheduled_updates.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: h-bryant/funcsim path: /tests/test_rdarrays.py
import numpy as np
import xarray as xr
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),
"../"))
import rdarrays as rd
<|fim_suffix|> varNames = x.indexes['variables']
... | code_fim | hard | {
"lang": "python",
"repo": "h-bryant/funcsim",
"path": "/tests/test_rdarrays.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # steps index inclusing all steps
if a.shape[0] > 0:
stepLabels = list(x.indexes['steps'])
for i in range(len(steps)):
stepLabels.append(stepLabels[-1] + 1)
else:
stepLabels = list(range(steps))
d = rd.RDdata(x, steps=3, namePositions=namePos)
# ad... | code_fim | hard | {
"lang": "python",
"repo": "h-bryant/funcsim",
"path": "/tests/test_rdarrays.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ktapsyman/LeetCodez path: /014_Longest Common Prefix/014_lark.py
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if 0 == len(strs) or "" in strs:
return ""
if len(strs)=... | code_fim | hard | {
"lang": "python",
"repo": "ktapsyman/LeetCodez",
"path": "/014_Longest Common Prefix/014_lark.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> MinLenStr = min(strs, key=len)
prifix = ""
ind = -1
for j in MinLenStr:
ind = ind+1
for k in strs:
if k[ind] == j:
continue
else:return prifix
prifix=prifix+j
return pri... | code_fim | hard | {
"lang": "python",
"repo": "ktapsyman/LeetCodez",
"path": "/014_Longest Common Prefix/014_lark.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> prifix = ""
ind = -1
for j in MinLenStr:
ind = ind+1
for k in strs:
if k[ind] == j:
continue
else:return prifix
prifix=prifix+j
return prifix<|fim_prefix|># repo: ktapsyman/LeetCodez pa... | code_fim | hard | {
"lang": "python",
"repo": "ktapsyman/LeetCodez",
"path": "/014_Longest Common Prefix/014_lark.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lase>/', listar_clase_alumnos, name = 'clase_alumnos'),
path('profesor/clases/<int:id_clase>/<int:id_alum_horario>/', listar_asistencia, name = 'asistencia_list_clase'),
]<|fim_prefix|># repo: nemesis-umbrella/HorarioAPI path: /asistencia/urls.py
from django.urls import path
from .views import perfil... | code_fim | medium | {
"lang": "python",
"repo": "nemesis-umbrella/HorarioAPI",
"path": "/asistencia/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nemesis-umbrella/HorarioAPI path: /asistencia/urls.py
from django.urls import path
from .views import perfil, listar_horario, listar_asistencia, listar_clases_profesor, listar_clase_alumnos
urlpatterns = [
path('alumno/', perfil, name = 'perfil_alumno'),
path('alumno/horario/', listar_ho... | code_fim | medium | {
"lang": "python",
"repo": "nemesis-umbrella/HorarioAPI",
"path": "/asistencia/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rdb/BlenderRealtimeEngineAddon path: /brte/engine.py
if "bpy" in locals():
import imp
imp.reload(socket_api)
imp.reload(_converters)
imp.reload(processors)
else:
import bpy
from . import socket_api
from . import converters as _converters
from . import processors
i... | code_fim | hard | {
"lang": "python",
"repo": "rdb/BlenderRealtimeEngineAddon",
"path": "/brte/engine.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ViewportTuple = collections.namedtuple('Viewport', ('height', 'width'))
def get_collection_name(collection):
class_name = collection.rna_type.__class__.__name__
clean_name = class_name.replace("BlendData", "").lower()
return clean_name
class RealTimeEngine():
bl_idname = 'RTE_FRAMEWORK'... | code_fim | hard | {
"lang": "python",
"repo": "rdb/BlenderRealtimeEngineAddon",
"path": "/brte/engine.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joelimgu/Info path: /aruco-decoder/tests/test_aruco_detection_red.py
import os
import unittest
from aruco import ArucoDetector
class TestArucoDetectionRed(unittest.TestCase):
ar = ArucoDetector()
<|fim_suffix|> result = self.ar.read_image(os.path.abspath("./datasets/red.jpg"))
... | code_fim | medium | {
"lang": "python",
"repo": "joelimgu/Info",
"path": "/aruco-decoder/tests/test_aruco_detection_red.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_red_tilted_l(self):
result = self.ar.read_image(os.path.abspath("./datasets/red-tilted-l.jpg"))
self.assertEqual(self.RED, result)<|fim_prefix|># repo: joelimgu/Info path: /aruco-decoder/tests/test_aruco_detection_red.py
import os
import unittest
from aruco import ArucoDetec... | code_fim | hard | {
"lang": "python",
"repo": "joelimgu/Info",
"path": "/aruco-decoder/tests/test_aruco_detection_red.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('KEF_App', '0002_teacher_query'),
]
operations = [
migrations.RemoveField(
model_name='teacher_query',
name='query_author',
),
]<|fim_prefix|># repo: IndiaCFG2/team-22 path: /KEF_22/KEF_22/KEF_App/migrations/0003_remove_te... | code_fim | easy | {
"lang": "python",
"repo": "IndiaCFG2/team-22",
"path": "/KEF_22/KEF_22/KEF_App/migrations/0003_remove_teacher_query_query_author.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IndiaCFG2/team-22 path: /KEF_22/KEF_22/KEF_App/migrations/0003_remove_teacher_query_query_author.py
# Generated by Django 3.1 on 2020-08-08 21:19
<|fim_suffix|> dependencies = [
('KEF_App', '0002_teacher_query'),
]
operations = [
migrations.RemoveField(
mo... | code_fim | medium | {
"lang": "python",
"repo": "IndiaCFG2/team-22",
"path": "/KEF_22/KEF_22/KEF_App/migrations/0003_remove_teacher_query_query_author.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name='teacher_query',
name='query_author',
),
]<|fim_prefix|># repo: IndiaCFG2/team-22 path: /KEF_22/KEF_22/KEF_App/migrations/0003_remove_teacher_query_query_author.py
# Generated by Django 3.1 on 2020-08-08 21:... | code_fim | medium | {
"lang": "python",
"repo": "IndiaCFG2/team-22",
"path": "/KEF_22/KEF_22/KEF_App/migrations/0003_remove_teacher_query_query_author.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NemoHimma/ZeroRL path: /Discrete_Algo/utils/PGhyperparameters.py
import torch
import math
class Config(object):
def __init__(self):
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
self.seed = 1
self.num_processes = 16 # aka num_age... | code_fim | medium | {
"lang": "python",
"repo": "NemoHimma/ZeroRL",
"path": "/Discrete_Algo/utils/PGhyperparameters.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.num_mini_batch = 8
self.clip_ratio = 0.2
self.ppo_epoch = 3
self.num_envs_steps = 1e7
self.num_updates = int(self.num_envs_steps // self.num_steps // self.num_processes)
self.USE_DECAY_LR = True
self.USE_PROPER_TIME_LIMITS = True
self.... | code_fim | medium | {
"lang": "python",
"repo": "NemoHimma/ZeroRL",
"path": "/Discrete_Algo/utils/PGhyperparameters.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HopeCollector/SLAMResearch path: /CH3-Transform/kitti_ros/scripts/utils/KittiPreprocessor.py.bak
#!/usr/bin/env python3
import numpy as np
# self-implemented XML parser
from XmlParser import XmlParser
class KittiPreprocessor(object):
"""
Load PointCloud data from bin file [X, Y, Z, I... | code_fim | hard | {
"lang": "python",
"repo": "HopeCollector/SLAMResearch",
"path": "/CH3-Transform/kitti_ros/scripts/utils/KittiPreprocessor.py.bak",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Filter camera angles for KiTTI Datasets
"""
@staticmethod
def filter_by_camera_angle(pc):
bool_in = np.logical_and((pc[:, 1] < pc[:, 0] - 0.27), (-pc[:, 1] < pc[:, 0] - 0.27))
"""
/*
* @brief KiTTI Velodyne Coordinate
* |x(forwar... | code_fim | hard | {
"lang": "python",
"repo": "HopeCollector/SLAMResearch",
"path": "/CH3-Transform/kitti_ros/scripts/utils/KittiPreprocessor.py.bak",
"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.