text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> """
from download_files import download_kegg_info_files
species_file = SafeConfigParser()
species_file.read(species_ini_file)
if not species_file.has_section('KEGG'):
logger.error('Species INI file has no KEGG section, which is needed'
' to run the proces... | code_fim | hard | {
"lang": "python",
"repo": "akhileshkaushal/annotation-refinery",
"path": "/process_kegg.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>port = 10000
adresa = '0.0.0.0'
server_address = (adresa, port)
sock.bind(server_address)
logging.info("Serverul a pornit pe %s si portul %d", adresa, port)
sock.listen(5)
while True:
logging.info('Asteptam conexiui...')
conexiune, address = sock.accept()
logging.info("Handshake cu %s", addres... | code_fim | medium | {
"lang": "python",
"repo": "bogdangvr/teme-fmi",
"path": "/retele/tema2/tcp/tcp_server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bogdangvr/teme-fmi path: /retele/tema2/tcp/tcp_server.py
# TCP Server
import socket
import logging
import time
logging.basicConfig(format = u'[LINE:%(lineno)d]# %(levelname)-8s [%(asctime)s] %(message)s', level = logging.NOTSET)
<|fim_suffix|>port = 10000
adresa = '0.0.0.0'
server_address = (a... | code_fim | medium | {
"lang": "python",
"repo": "bogdangvr/teme-fmi",
"path": "/retele/tema2/tcp/tcp_server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@parameterized_class([
{'yaml': yaml_0, 'expected': 0},
{'yaml': yaml_1_5, 'expected': 1.5}
])
class TestAvgWorkflowSizeCount(unittest.TestCase):
def test(self):
self.assertEqual(AvgWorkflowSize(self.yaml.expandtabs(2)).count(), self.expected)<|fim_prefix|># repo: radon-h2020/radon-to... | code_fim | hard | {
"lang": "python",
"repo": "radon-h2020/radon-tosca-metrics",
"path": "/tests/metrics/test_avg_workflow_size_count.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: radon-h2020/radon-tosca-metrics path: /tests/metrics/test_avg_workflow_size_count.py
import unittest
from parameterized import parameterized_class
from toscametrics.blueprint.avg_workflow_size import AvgWorkflowSize
yaml_0 = 'tosca_definitions_version: tosca_simple_yaml_1_0\ntopology_template:\... | code_fim | hard | {
"lang": "python",
"repo": "radon-h2020/radon-tosca-metrics",
"path": "/tests/metrics/test_avg_workflow_size_count.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kotsky/py-libs path: /data_structures/trees/bst.py
"""Binary Search Tree
In this tree each node has max 2 childs and
following condition is applied
`node.left.value < node.value <= node.right.value`.
Methods:
bst = BST(value)
bst.insert(value)
bst.contains(value) - check if that value is i... | code_fim | hard | {
"lang": "python",
"repo": "kotsky/py-libs",
"path": "/data_structures/trees/bst.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def insert(self, value):
root = self
while True:
if root.value <= value:
if root.right is not None:
root = root.right
else:
root.right = BST(value)
break
else:
... | code_fim | hard | {
"lang": "python",
"repo": "kotsky/py-libs",
"path": "/data_structures/trees/bst.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pak21/election2019 path: /election2019.py
#!/usr/bin/env python3
import json
import pandas as pd
RESULTS_2015_FILENAME = 'bbc-2015-results.json'
RESULTS_2017_FILENAME = 'HoC-GE2017-constituency-results.csv'
REFERENDUM_RESULTS_FILENAME = 'estimated-leave-vote-by-constituency.csv'
PARTY_NAMES_2... | code_fim | hard | {
"lang": "python",
"repo": "pak21/election2019",
"path": "/election2019.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(RESULTS_2015_FILENAME) as f:
json2015 = json.loads(json.load(f)['uk_data'])
results2015 = pd.DataFrame.from_dict(json2015, orient='index').drop('mapPanelMessage', axis=1)
results2015.columns = ['declaration_2015', 'winning_party_2015']
results2017 = results2017.j... | code_fim | hard | {
"lang": "python",
"repo": "pak21/election2019",
"path": "/election2019.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uci-cbcl/FactorNet path: /train.py
#!/usr/bin/env python
"""
Script for training model.
Use `train.py -h` to see an auto-generated description of advanced options.
"""
import utils
import numpy as np
# Standard library imports
import sys
import os
import errno
import argparse
import pickle
de... | code_fim | hard | {
"lang": "python",
"repo": "uci-cbcl/FactorNet",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> features = ['bigwig']
if tf:
print 'Single-task training:', tf
singleTask = True
if meta:
print 'Including metadata features'
features.append('meta')
if gencode:
print 'Including genome annotations'
features.appen... | code_fim | hard | {
"lang": "python",
"repo": "uci-cbcl/FactorNet",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
The main executable function
"""
parser = make_argument_parser()
args = parser.parse_args()
input_dirs = args.inputdirs
tf = args.factor
valid_chroms = args.validchroms
valid_input_dirs = args.validinputdirs
test_chroms = args.testchroms
epochs = args.epoch... | code_fim | hard | {
"lang": "python",
"repo": "uci-cbcl/FactorNet",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Trainzack/vmflib2 path: /vmflib2/games/garrysmod.py
"""
Helper classes for creating maps in any Source Engine game that uses garrysmod.fgd.
This file was auto-generated by import_fgd.py on 2020-01-19 09:11:13.836022.
"""
from vmflib2.vmf import *
class EnvProjectedtexture(Entity):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "Trainzack/vmflib2",
"path": "/vmflib2/games/garrysmod.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Auto-generated from garrysmod.fgd, line 5.
Ladder. Players will be able to move freely along this brush, as if it was a ladder.Apply the toolsinvisibleladder material to a func_ladder brush.
"""
def __init__(self, vmf_map: "ValveMap"):
Entity.__init__(self, "func_ladder", v... | code_fim | hard | {
"lang": "python",
"repo": "Trainzack/vmflib2",
"path": "/vmflib2/games/garrysmod.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>fasta.fasta(input).separateByLengthAndWriteKmerAbundance(kmer, lengthRange, output)<|fim_prefix|># repo: PinarSiyah/NGStoolkit path: /bin/fa2lengthSeparatedKmerAbundace.py
#!/usr/bin/env python
import fasta
import argparse
parser = argparse.ArgumentParser(description='gets kmer (eg. dimer) distribution... | code_fim | medium | {
"lang": "python",
"repo": "PinarSiyah/NGStoolkit",
"path": "/bin/fa2lengthSeparatedKmerAbundace.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PinarSiyah/NGStoolkit path: /bin/fa2lengthSeparatedKmerAbundace.py
#!/usr/bin/env python
import fasta
import argparse
parser = argparse.ArgumentParser(description='gets kmer (eg. dimer) distribution for each position')
parser.add_argument('-i', required= True, help='input')
parser.add_argument(... | code_fim | medium | {
"lang": "python",
"repo": "PinarSiyah/NGStoolkit",
"path": "/bin/fa2lengthSeparatedKmerAbundace.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_incorrect_range_in_subnet(webapp):
webapp.post('/api/subnets/', data=json.dumps({'name':'10.100.100.0','netmask':22}))
with pytest.raises(requests.HTTPError):
webapp.post('/api/ranges/', data=json.dumps({'name':'test_range_00','min':'172.100.100.100',
'max':'172.100.10... | code_fim | hard | {
"lang": "python",
"repo": "GR360RY/dhcpawn",
"path": "/tests/test_ut/test_ips.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GR360RY/dhcpawn path: /tests/test_ut/test_ips.py
import ldap
import requests
import pytest
import random
import json
from ipaddr import IPv4Address
from .utils import _server_dn, _ldap_init
def test_ip_address_conflict(webapp):
webapp.post('/api/hosts/', data=json.dumps({'name':'test_host_00... | code_fim | hard | {
"lang": "python",
"repo": "GR360RY/dhcpawn",
"path": "/tests/test_ut/test_ips.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qq529952515/viperpython path: /MODULES/DefenseEvasion_ProcessInjection_CsharpAssemblyLoader.py
# -*- coding: utf-8 -*-
# @File : SimpleRewMsfModule.py
# @Date : 2019/1/11
# @Desc :
import base64
from Lib.ModuleAPI import *
class PostModule(PostMSFRawModule):
NAME = "内存执行C#可执行文件"
DE... | code_fim | hard | {
"lang": "python",
"repo": "qq529952515/viperpython",
"path": "/MODULES/DefenseEvasion_ProcessInjection_CsharpAssemblyLoader.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if status is not True:
self.log_error("模块执行失败,失败原因:{}".format(message))
else:
assembly_out = base64.b64decode(data).decode('utf-8', errors="ignore")
if assembly_out is None or len(assembly_out) == 0:
self.log_warning("exe文件未输出信息")
... | code_fim | hard | {
"lang": "python",
"repo": "qq529952515/viperpython",
"path": "/MODULES/DefenseEvasion_ProcessInjection_CsharpAssemblyLoader.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mkarmann/conway-reversed path: /src/bestguess/bestguess.py
super().__init__()
self.conv = nn.Conv2d(in_features, out_features, kernel_size=3, bias=False)
def forward(self, x):
return self.conv(F.pad(x, [1, 1, 1, 1], mode='circular'))
class TiledResBlock(nn.Module):
... | code_fim | hard | {
"lang": "python",
"repo": "mkarmann/conway-reversed",
"path": "/src/bestguess/bestguess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='')
img = data.reshape(fig.canvas.get_width_height()[::-1] + (3,))
if video_fname is not None:
if video_out is None:
if not os.path.exists(os.pa... | code_fim | hard | {
"lang": "python",
"repo": "mkarmann/conway-reversed",
"path": "/src/bestguess/bestguess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mkarmann/conway-reversed path: /src/bestguess/bestguess.py
end = state_step(end)
if np.any(end):
return {
"start": start,
"end": end,
"delta": delta
}
class TiledConv2d(nn.Module):
def __init__(self, in_feature... | code_fim | hard | {
"lang": "python",
"repo": "mkarmann/conway-reversed",
"path": "/src/bestguess/bestguess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dschrimpsher/gos-my-visors path: /gos_my_visors/visor_frame.py
from tkinter import *
def get_visor_details(visor, parent, starting_row):
Label(parent, text='----------------------------------------------').grid(row=starting_row+1, columnspan=4)
Label(parent, text='Attributes: ' + str(vi... | code_fim | hard | {
"lang": "python",
"repo": "dschrimpsher/gos-my-visors",
"path": "/gos_my_visors/visor_frame.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Label(parent, text='------------------------------------').grid(row=starting_row+5, columnspan=4)
Label(parent, text='Talent: ' + str(visor.get_talent())).grid(row=starting_row+6, columnspan=4)
row = starting_row+7
column = 0
for index in range(len(visor.military_stars)):
Labe... | code_fim | hard | {
"lang": "python",
"repo": "dschrimpsher/gos-my-visors",
"path": "/gos_my_visors/visor_frame.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for index in range(len(visor.political_stars)):
Label(parent, width=15, text='Political Stars').grid(row=row, column=column)
Label(parent, text=get_stars(visor.political_stars[index])).grid(row=row, column=column + 1)
Label(parent, width=15, text='Political Level').grid(row=row... | code_fim | hard | {
"lang": "python",
"repo": "dschrimpsher/gos-my-visors",
"path": "/gos_my_visors/visor_frame.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ellipse(img, box, color[, thickness[, lineType]]) -> img
@overload
@param img Image.
@param box Alternative ellipse representation via RotatedRect. This means that
the function draws an ellipse inscribed in the rotated rectangle.
@param color Ellipse color.
@param thickness Thickness of the ellipse... | code_fim | hard | {
"lang": "python",
"repo": "kethan1/OpenCV-Python",
"path": "/OpenCV Drawing/cv2_ellipse.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kethan1/OpenCV-Python path: /OpenCV Drawing/cv2_ellipse.py
import cv2
image = cv2.imread("../Images/RPi_Image.png")
image = cv2.ellipse(
image,
(100, 100), # Tuple with the center in (x, y) form
(50, 30), # Tuple with the size of the ellipse in (length / 2, width / 2) form
... | code_fim | hard | {
"lang": "python",
"repo": "kethan1/OpenCV-Python",
"path": "/OpenCV Drawing/cv2_ellipse.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: svamol/testplan path: /tests/unit/testplan/testing/multitest/driver/test_driver.py
"""Unit tests for the driver base."""
from testplan.testing.multitest.driver import base
def pre_start_fn(driver):
assert driver.pre_start_called
driver.pre_start_fn_called = True
def post_start_fn(dri... | code_fim | hard | {
"lang": "python",
"repo": "svamol/testplan",
"path": "/tests/unit/testplan/testing/multitest/driver/test_driver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_start_stop_fn(self, runpath):
"""Test pre/post start callables when starting/stopping the driver
implicitly via a context manager."""
driver = self.MyDriver(
name="MyDriver",
runpath=runpath,
pre_start=pre_start_fn,
post... | code_fim | hard | {
"lang": "python",
"repo": "svamol/testplan",
"path": "/tests/unit/testplan/testing/multitest/driver/test_driver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: haotongye/pytorch-project-example path: /common/utils.py
import csv
import json
import pickle
import random
from collections import OrderedDict
from pathlib import Path
import numpy as np
import torch
from box import Box
class FixedOrderedDict(OrderedDict):
"""
OrderedDict with fixed k... | code_fim | hard | {
"lang": "python",
"repo": "haotongye/pytorch-project-example",
"path": "/common/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def set_random_seed(random_seed):
random.seed(random_seed)
np.random.seed(random_seed)
torch.manual_seed(random_seed)
torch.cuda.manual_seed_all(random_seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
def get_model_log_and_ckpt_paths(model_d... | code_fim | hard | {
"lang": "python",
"repo": "haotongye/pytorch-project-example",
"path": "/common/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mars-project/mars path: /mars/dataframe/contrib/raydataset/tests/test_mldataset.py
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the... | code_fim | hard | {
"lang": "python",
"repo": "mars-project/mars",
"path": "/mars/dataframe/contrib/raydataset/tests/test_mldataset.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@require_ray
@pytest.mark.asyncio
@pytest.mark.parametrize("chunk_size_and_num_shards", [[5, 5], [5, 4], [None, None]])
@pytest.mark.skipif(
ray_deprecate_ml_dataset in (True, None),
reason="Ray (>=2.0) has deprecated MLDataset.",
)
async def test_convert_to_ray_mldataset(
ray_start_regular_s... | code_fim | hard | {
"lang": "python",
"repo": "mars-project/mars",
"path": "/mars/dataframe/contrib/raydataset/tests/test_mldataset.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # in order to pass checks
value1 = np.random.rand(10, 10)
value2 = np.random.rand(10, 10)
df1 = pd.DataFrame(value1)
df2 = pd.DataFrame(value2)
if ray:
obj_ref1, obj_ref2 = ray.put(df1), ray.put(df2)
batch = ChunkRefBatch(shard_id=0, obj_refs=[obj_ref1, obj_ref2])
... | code_fim | hard | {
"lang": "python",
"repo": "mars-project/mars",
"path": "/mars/dataframe/contrib/raydataset/tests/test_mldataset.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LLNL/FPChecker path: /tests/parser/static/test_tokenize_nested_loops/test_nested_loops.py
import subprocess
import os
import pathlib
import sys
sys.path.insert(1, str(pathlib.Path(__file__).parent.absolute())+"/../../../../parser")
#sys.path.insert(1, '/usr/workspace/wsa/laguna/fpchecker/FPCheck... | code_fim | medium | {
"lang": "python",
"repo": "LLNL/FPChecker",
"path": "/tests/parser/static/test_tokenize_nested_loops/test_nested_loops.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_1():
l = Tokenizer(SOURCE)
count = 0
for token in l.tokenize():
count += 1
sys.stdout.write('\n'+str(type(token))+':')
sys.stdout.write(str(token))
print('Len:', count)
assert count == 90
if __name__ == '__main__':
test_1()<|fim_prefix|># repo: LLNL/FPChecker path: /tes... | code_fim | hard | {
"lang": "python",
"repo": "LLNL/FPChecker",
"path": "/tests/parser/static/test_tokenize_nested_loops/test_nested_loops.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ominux/wavetorch path: /wavetorch/viz/__init__.py
from .plot import plot_total_field, \
plot_confusion_matrix, \
<|fim_suffix|>ot_structure_evolution, \
plot_field_snapshot, \
plot_probe_integrals, \
apply_sublabels, \
... | code_fim | hard | {
"lang": "python",
"repo": "ominux/wavetorch",
"path": "/wavetorch/viz/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ot_structure_evolution, \
plot_field_snapshot, \
plot_probe_integrals, \
apply_sublabels, \
bbox_white<|fim_prefix|># repo: ominux/wavetorch path: /wavetorch/viz/__init__.py
from .plot import plot_total_field, \
pl... | code_fim | hard | {
"lang": "python",
"repo": "ominux/wavetorch",
"path": "/wavetorch/viz/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: irtyamine/genetic-algorithm path: /ga/characteristics.py
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 23 06:08:57 2019
@author: Khoi To
"""
<|fim_suffix|> def __init__(self, chromosome_length, number_of_genes):
self.chromosome_length = chromosome_length
self.number_of_genes... | code_fim | easy | {
"lang": "python",
"repo": "irtyamine/genetic-algorithm",
"path": "/ga/characteristics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.chromosome_length = chromosome_length
self.number_of_genes = number_of_genes<|fim_prefix|># repo: irtyamine/genetic-algorithm path: /ga/characteristics.py
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 23 06:08:57 2019
<|fim_middle|>@author: Khoi To
"""
class Characteristics(object... | code_fim | medium | {
"lang": "python",
"repo": "irtyamine/genetic-algorithm",
"path": "/ga/characteristics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.display.setspeed(speed)
self.display.setdistance(total_distance)
self.display.setbestlaptime(best_lap_time)
self.display.setlapnumber(lap_number)
self.display.setvmax(max_speed)
self.display.setsignalbar(g... | code_fim | hard | {
"lang": "python",
"repo": "PUT-PTM/LapTracker",
"path": "/LapTracker/LapTracker/LapTracker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PUT-PTM/LapTracker path: /LapTracker/LapTracker/LapTracker.py
import ptvsd
import gpsd
import RPi.GPIO as GPIO
import time
import glob,os
import datetime
from Distance import calculate_distance
from LineIntersection import intersects
from Display import DisplaySetter
from OutOfTrack import OutOf... | code_fim | hard | {
"lang": "python",
"repo": "PUT-PTM/LapTracker",
"path": "/LapTracker/LapTracker/LapTracker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if(lap_number >= 2):
lap_time = actual_time - start_time
self.display.pushalert(lap_time)
#print(lap_time)
if lap_time<best_lap_t... | code_fim | hard | {
"lang": "python",
"repo": "PUT-PTM/LapTracker",
"path": "/LapTracker/LapTracker/LapTracker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1Server/OneServer path: /test/test_metadata.py
import unittest
from oneserver import metadata
from manager import OneServerManager
from wrappers.libDLNA import DLNAInterface
##
# Tests the MIMEType Class of the Metadata python file
class TestMIMEType(unittest.TestCase):
<|fim_suffix|... | code_fim | hard | {
"lang": "python",
"repo": "1Server/OneServer",
"path": "/test/test_metadata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_getMIMEType(self):
mimemp4 = metadata.MIMEType('mp4', 'object.item.audioItem.musicTrack', 'http-get:*:audio/mp4:')
self.assertEquals(mimemp4.extension, metadata.getMIMEType('mp4').extension)
self.assertEquals(mimemp4.mime_class, metadata.getMIMEType('mp4').mime_class)
self.assert... | code_fim | medium | {
"lang": "python",
"repo": "1Server/OneServer",
"path": "/test/test_metadata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: icgw/practice path: /LeetCode/Python3/0021._Merge_Two_Sorted_Lists.py
#!/usr/bin/env python3
from data_structures import ListNode
class Solution:
def mergeTwoLists(self, l1, l2):
<|fim_suffix|>if __name__ == "__main__":
l1 = ListNode.stringToListNode("[1, 2, 4]")
l2 = ListNode.string... | code_fim | hard | {
"lang": "python",
"repo": "icgw/practice",
"path": "/LeetCode/Python3/0021._Merge_Two_Sorted_Lists.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mikegraham/blist path: /_sorteddict.py
from _sortedlist import sortedset
import collections
class sorteddict(collections.MutableMapping):
__slots__ = ['_sortedkeys', '_map']
def __init__(self, *args, **kw):
self._map = dict()
key = None
if len(args) > 0:
... | code_fim | hard | {
"lang": "python",
"repo": "mikegraham/blist",
"path": "/_sorteddict.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __repr__(self):
return 'sorteddict(%s)' % repr(self._map)
def __eq__(self, other):
if not isinstance(other, sorteddict):
return False
return self._map == other._map<|fim_prefix|># repo: mikegraham/blist path: /_sorteddict.py
from _sortedlist import sorteds... | code_fim | hard | {
"lang": "python",
"repo": "mikegraham/blist",
"path": "/_sorteddict.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> avg_values = 0
for keyword in words:
avg_values = avg_values + ord(str(keyword))
avg_value = int(avg_values/len(words))
return avg_value<|fim_prefix|># repo: dipghoshraj/shiftencode path: /shiftencode/sftascii.py
def ascii_(words):
word_list = []
for word_ in words:
... | code_fim | easy | {
"lang": "python",
"repo": "dipghoshraj/shiftencode",
"path": "/shiftencode/sftascii.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dipghoshraj/shiftencode path: /shiftencode/sftascii.py
def ascii_(words):
word_list = []
for word_ in words:
word_list.append(ord(word_))
return word_list
<|fim_suffix|> avg_values = 0
for keyword in words:
avg_values = avg_values + ord(str(keyword))
avg_va... | code_fim | easy | {
"lang": "python",
"repo": "dipghoshraj/shiftencode",
"path": "/shiftencode/sftascii.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> q = ras('q').strip()
if not q:
return render_template_g(
'search.html.jinja',
hide_title=True,
page_title='搜索',
has_result=False,
)
else:
result = search_term(q, start=0, length=20)
return render_template_g(
... | code_fim | hard | {
"lang": "python",
"repo": "thphd/2047",
"path": "/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> j = j[0]
lines = []
l = j['data']['data']['list']
for seas in l:
season_str = seas['season_cn']
resos = seas['items']
for reso in resos:
details = resos[reso]
for ep in details:
epn = ep['episode']
files = e... | code_fim | hard | {
"lang": "python",
"repo": "thphd/2047",
"path": "/search.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thphd/2047 path: /search.py
from commons import *
from app import app
aqlc_pmf = AQLController(None, 'dbpmf')
aql_pmf = aqlc_pmf.aql
def break_terms(s):
s = s.split(' ')
s = [i.strip() for i in s if len(i.strip())]
s = s[:4] # take first 4 terms only
return s
def break_terms_ar... | code_fim | hard | {
"lang": "python",
"repo": "thphd/2047",
"path": "/search.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> p = head
q = p.next if p else p
while q and q != p:
p = p.next
q = q.next
q = q.next if q else q
return q<|fim_prefix|># repo: SaitoTsutomu/leetcode path: /codes_/0141_Linked_List_Cycle.py
# %% [141. *Linked List Cycle](https://leetcode.... | code_fim | easy | {
"lang": "python",
"repo": "SaitoTsutomu/leetcode",
"path": "/codes_/0141_Linked_List_Cycle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SaitoTsutomu/leetcode path: /codes_/0141_Linked_List_Cycle.py
# %% [141. *Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/)
# 問題:ListNodeがサイクルかどうかを返す
# 解法:1つずつ進むポインタと2つずつ進むポインタを使う
class Solution:
<|fim_suffix|> p = head
q = p.next if p else p
while q and ... | code_fim | easy | {
"lang": "python",
"repo": "SaitoTsutomu/leetcode",
"path": "/codes_/0141_Linked_List_Cycle.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #If you are copy pasting proxy ips, put in the list below
#proxies = ['121.129.127.209:80', '124.41.215.238:45169', '185.93.3.123:8080', '194.182.64.67:3128', '106.0.38.174:8080', '163.172.175.210:3128', '13.92.196.150:8080']
proxies = get_proxies2()
proxy_pool = cycle(proxies)
url = ... | code_fim | medium | {
"lang": "python",
"repo": "nikitcha/ceebios_poke_stream",
"path": "/proxy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nikitcha/ceebios_poke_stream path: /proxy.py
import requests
from itertools import cycle
import re
def get_proxies1():
url = 'https://free-proxy-list.net/'
response = requests.get(url)
proxies = re.findall(r"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[0... | code_fim | hard | {
"lang": "python",
"repo": "nikitcha/ceebios_poke_stream",
"path": "/proxy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> url = 'https://www.sslproxies.org'
response = requests.get(url)
proxies = re.findall(r"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):\d{1,5}\b", response.text)
return proxies
def main():
#If you are copy pasting proxy ips, put in the list... | code_fim | medium | {
"lang": "python",
"repo": "nikitcha/ceebios_poke_stream",
"path": "/proxy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return [(tk_tgt.mu - tk_src.mu, tk_tgt.tau - tk_src.tau)
for tk_src, tk_tgt in zip(self.source_gmm.components, self.target_gmm.components)]
def get_gmm_velocity(self, gmm, gmm_dot, x, t):
return velocity(gmm, gmm_dot, x, t)<|fim_prefix|># repo: dccastro/NDFlow path: /... | code_fim | hard | {
"lang": "python",
"repo": "dccastro/NDFlow",
"path": "/ndflow/warping/flow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> u = 0
u_prime = 0
q_q_prime_ = [_q_k(x, tk) for tk in gmm.components]
pi = gmm.weights
q = sum(pi_k * qqp_k[0] for pi_k, qqp_k in zip(pi, q_q_prime_))
q_prime = sum(pi_k * qqp_k[1] for pi_k, qqp_k in zip(pi, q_q_prime_))
for k, theta_k in enumerate(gmm.components):
q_k,... | code_fim | medium | {
"lang": "python",
"repo": "dccastro/NDFlow",
"path": "/ndflow/warping/flow.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dccastro/NDFlow path: /ndflow/warping/flow.py
from ._flow_base import GMMFlowBase
from ..distributions import normal
from ..models.mixture import MixtureModel
def _q_k(x, theta):
q_k = theta.likelihood(x)
q_k_prime = -((theta.tau * (x - theta.mu)).T * q_k).T
return q_k, q_k_prime
... | code_fim | hard | {
"lang": "python",
"repo": "dccastro/NDFlow",
"path": "/ndflow/warping/flow.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: valentinpy/ssd.pytorch path: /data/scripts/analyse_corrected_annotations.py
import torch
import argparse
import numpy as np
from data import BaseTransform
from data.kaist import KAISTAnnotationTransform, KAISTDetection
from data.kaist import KAIST_CLASSES as KAISTlabelmap
from eval.get_GT import... | code_fim | hard | {
"lang": "python",
"repo": "valentinpy/ssd.pytorch",
"path": "/data/scripts/analyse_corrected_annotations.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> labelmap = KAISTlabelmap
dataset_mean = (104, 117, 123) # TODO VPY and for kaist ?
dataset = KAISTDetection(root=args.dataset_root,image_set=args.image_set, transform=BaseTransform(300, dataset_mean), target_transform=KAISTAnnotationTransform(output_format='SSD'), dataset_name="KAIST", correc... | code_fim | hard | {
"lang": "python",
"repo": "valentinpy/ssd.pytorch",
"path": "/data/scripts/analyse_corrected_annotations.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> obj = model(pk=pk)
try:
url = related_field.to_representation(obj)
except AttributeError:
url = related_field.to_native(obj)
resource[field_name] = url
else:
... | code_fim | hard | {
"lang": "python",
"repo": "scottfisk/drf-json-api",
"path": "/rest_framework_json_api/parsers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scottfisk/drf-json-api path: /rest_framework_json_api/parsers.py
from rest_framework import parsers, relations
from rest_framework_json_api.utils import (
get_related_field, is_related_many,
model_from_obj, model_to_resource_type
)
from django.utils import six
class JsonApiMixin(object)... | code_fim | hard | {
"lang": "python",
"repo": "scottfisk/drf-json-api",
"path": "/rest_framework_json_api/parsers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> resource[field_name].append(url)
else:
pk = links[field_name]
model = related_field.queryset.model
obj = model(pk=pk)
try:
url = related_field.to_representation... | code_fim | hard | {
"lang": "python",
"repo": "scottfisk/drf-json-api",
"path": "/rest_framework_json_api/parsers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Extracting bg and fg.')
# Foreground & Background extraction
fg = (out > clipping_threshold)
bg = 1 - fg
fg_im = img * fg[:,:,np.newaxis] # foreground image of shape (x, y, 3)
print('Applying Gaussian Blur')
blur = cv2.GaussianBlu... | code_fim | hard | {
"lang": "python",
"repo": "randomMatrix77/Deep-Learning-based-Image-Matting",
"path": "/depth_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: randomMatrix77/Deep-Learning-based-Image-Matting path: /depth_model.py
import torch
import cv2
import numpy as np
import os
import matplotlib.pyplot as plt
os.environ['TORCH_HOME'] = "D:/Softwares/miniconda/torch_models"
print('current location : {}'.format(os.getenv("TORCH_HOME",os.path.... | code_fim | hard | {
"lang": "python",
"repo": "randomMatrix77/Deep-Learning-based-Image-Matting",
"path": "/depth_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> avg = np.array(avg)
clipping_threshold = avg.min()
print('Face detected. Using {} as clipping value'.format(clipping_threshold))
# Resize output to original (image) size
out = torch.nn.functional.interpolate(out.unsqueeze(1), size=img.shape[:2],
... | code_fim | hard | {
"lang": "python",
"repo": "randomMatrix77/Deep-Learning-based-Image-Matting",
"path": "/depth_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>board756911916 = gamma_board(board)
assert board756911916 is not None
assert board756911916 == ("..1\n"
"..1\n"
"441\n"
"213\n"
"324\n")
del board756911916
board756911916 = None
assert gamma_move(board, 3, 4, 1) == 0
assert gamma_move(board, 4, 4, 1) == 0
assert gamma_move(board, 1, 1, 2) == 0
assert g... | code_fim | hard | {
"lang": "python",
"repo": "kozakusek/ipp-2020-testy",
"path": "/z2/part2/batch/jm/parser_errors_2/598259602.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kozakusek/ipp-2020-testy path: /z2/part2/batch/jm/parser_errors_2/598259602.py
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions... | code_fim | hard | {
"lang": "python",
"repo": "kozakusek/ipp-2020-testy",
"path": "/z2/part2/batch/jm/parser_errors_2/598259602.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f'{self._Animal__nome} fala Ah Ah Ah ')
def __init__(self, nome):
super().__init__(nome)
def main():
print('-=-|-=-|-=-|-=-|-=-|-=-|-=-|-=-|-=-|-=-|-=-|-=-|-=-|-=-|-=-')
# testando
feliz = Gato('Felix')
feliz.comer()
feliz.falar()
puto = Cachorro('Pu... | code_fim | hard | {
"lang": "python",
"repo": "gugajung/guppe",
"path": "/Teórico/Sec17/Sec17-07-Polimorfismo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gugajung/guppe path: /Teórico/Sec17/Sec17-07-Polimorfismo.py
"""
Seção 17 -
* Polimofismo
Poli -> Multas
Morfis -> Formas
Objetios que podem possuir muitas formas OU podem comportar de formas diferentes
Quando a gente re-implemneta um metodo presente na classe Pai em classes filhas ,estamos r... | code_fim | hard | {
"lang": "python",
"repo": "gugajung/guppe",
"path": "/Teórico/Sec17/Sec17-07-Polimorfismo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wdd0225/pytorch2caffe path: /example/MGN_analysis_example.py
import sys
sys.path.insert(0,'.')
import torch
import torch.nn as nn
from torchvision.models import resnet
import pytorch_analyser
from option import args
from model import mgn
<|fim_suffix|>
# net = Model(num_classes=2220)
# #... | code_fim | hard | {
"lang": "python",
"repo": "wdd0225/pytorch2caffe",
"path": "/example/MGN_analysis_example.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = 'MGN'
# net = inception_v3(True, transform_input=False)
net.eval()
input_tensor=torch.ones(1,3,384,128)
blob_dict, tracked_layers=pytorch_analyser.analyse(net,input_tensor)
pytorch_analyser.save_csv(tracked_layers,'/tmp/analysis.csv')<|fim_prefix|># repo: wdd0225/pytorch2caf... | code_fim | hard | {
"lang": "python",
"repo": "wdd0225/pytorch2caffe",
"path": "/example/MGN_analysis_example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leftshiftone/dynabuffers path: /dynabuffers-python/dynabuffers/api/map/ImplicitDynabuffersMap.py
from typing import List
from dynabuffers.api.ISerializable import ISerializable
from dynabuffers.api.map.DynabuffersMap import DynabuffersMap
class ImplicitDynabuffersMap(DynabuffersMap):
<|fim_suf... | code_fim | medium | {
"lang": "python",
"repo": "leftshiftone/dynabuffers",
"path": "/dynabuffers-python/dynabuffers/api/map/ImplicitDynabuffersMap.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_value(self):
return self.get("value")<|fim_prefix|># repo: leftshiftone/dynabuffers path: /dynabuffers-python/dynabuffers/api/map/ImplicitDynabuffersMap.py
from typing import List
from dynabuffers.api.ISerializable import ISerializable
from dynabuffers.api.map.DynabuffersMap import D... | code_fim | medium | {
"lang": "python",
"repo": "leftshiftone/dynabuffers",
"path": "/dynabuffers-python/dynabuffers/api/map/ImplicitDynabuffersMap.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> a nota'))
media=(n1+n2)/2
print('A media das notas do aluno é {}'.format(media))<|fim_prefix|># repo: viniciusscastro/Curso-em-Video-Exercicios-de-Python-nao-modularizados path: /Coding/vini diretory/Aula07 tratamento de dados e realização de contas/desafioAula07#7.py
n1 = float(input('qual sua primeira... | code_fim | easy | {
"lang": "python",
"repo": "viniciusscastro/Curso-em-Video-Exercicios-de-Python-nao-modularizados",
"path": "/Coding/vini diretory/Aula07 tratamento de dados e realização de contas/desafioAula07#7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: daodaoliang/asn1tools path: /asn1tools/source/c/oer.py
(self.location_inner('', '.'))
for member in type_.root_members:
member_checker = self.get_member_checker(checker,
member.name)
with self.asn1_members_back... | code_fim | hard | {
"lang": "python",
"repo": "daodaoliang/asn1tools",
"path": "/asn1tools/source/c/oer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> lengths = []
optionals = get_sequence_optionals(type_)
extension_bit = get_sequence_extension_bit(type_)
lengths.append(get_sequence_present_mask_length(optionals,
extension_bit))
for member in type_.root_memb... | code_fim | hard | {
"lang": "python",
"repo": "daodaoliang/asn1tools",
"path": "/asn1tools/source/c/oer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(type_, oer.Integer):
lines = self.format_integer(checker)
lines[0] += ' value;'
elif isinstance(type_, oer.Boolean):
lines = self.format_boolean()
lines[0] += ' value;'
elif isinstance(type_, oer.Real):
lines... | code_fim | hard | {
"lang": "python",
"repo": "daodaoliang/asn1tools",
"path": "/asn1tools/source/c/oer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
__new__(cls: type,worksetKind: WorksetKind,inverted: bool)
__new__(cls: type,worksetKind: WorksetKind)
"""
pass
WorksetKind=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""The WorksetKind.
Get: WorksetKind(self: WorksetKindFilter) -> WorksetKind
... | code_fim | hard | {
"lang": "python",
"repo": "gtalarico/ironpython-stubs",
"path": "/release/stubs.min/Autodesk/Revit/DB/__init___parts/WorksetKindFilter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gtalarico/ironpython-stubs path: /release/stubs.min/Autodesk/Revit/DB/__init___parts/WorksetKindFilter.py
class WorksetKindFilter(WorksetFilter,IDisposable):
"""
A filter used to match worksets of the given WorksetKind.
WorksetKindFilter(worksetKind: WorksetKind,inverted: bool)
W... | code_fim | hard | {
"lang": "python",
"repo": "gtalarico/ironpython-stubs",
"path": "/release/stubs.min/Autodesk/Revit/DB/__init___parts/WorksetKindFilter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,worksetKind,inverted=None):
"""
__new__(cl... | code_fim | hard | {
"lang": "python",
"repo": "gtalarico/ironpython-stubs",
"path": "/release/stubs.min/Autodesk/Revit/DB/__init___parts/WorksetKindFilter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param length: int
:param distance: float
:rtype: float
"""
return distance/(length*2)
def get_norm_distance_deg(norm_distance: float) -> float:
"""
Get the normalized distance in degrees. This is probably what you want. If it is some crazy number, will return 360.
:param... | code_fim | medium | {
"lang": "python",
"repo": "jadolfbr/jade2",
"path": "/jade2/antibody/util.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jadolfbr/jade2 path: /jade2/antibody/util.py
import math
import logging
def get_norm_distance(length: int, distance: float) -> float:
<|fim_suffix|> """
Get the normalized distance in degrees. This is probably what you want. If it is some crazy number, will return 360.
:param norm_di... | code_fim | hard | {
"lang": "python",
"repo": "jadolfbr/jade2",
"path": "/jade2/antibody/util.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>##############################################################################
# Now we can read the channels that we want to map to the cortical locations.
# Then we can compute the forward solution.
info = hcp.read_info(subject=subject, hcp_path=hcp_path, data_type='rest',
run_inde... | code_fim | hard | {
"lang": "python",
"repo": "mne-tools/mne-hcp",
"path": "/tutorials/plot_compute_forward.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mne-tools/mne-hcp path: /tutorials/plot_compute_forward.py
"""
.. _tut_forward:
=====================
Compute forward model
=====================
Here we'll first compute a source space, then the bem model
and finally the forward solution.
"""
# Author: Denis A. Engemann
# License: BSD 3 clause... | code_fim | hard | {
"lang": "python",
"repo": "mne-tools/mne-hcp",
"path": "/tutorials/plot_compute_forward.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>##############################################################################
# For the same reason `ico` has to be set to `None` when computing the bem.
# The headshape is not computed with MNE and has a none standard configuration.
bems = mne.make_bem_model(subject, conductivity=(0.3,),
... | code_fim | hard | {
"lang": "python",
"repo": "mne-tools/mne-hcp",
"path": "/tutorials/plot_compute_forward.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> key = kwargs.get('key', None)
if key is None:
raise Http404
try:
pk = Base62.decode(key)
except:
raise Http404
object = self.get_object(pk)
return object.link_url
def get_object(self, pk):
try:
ob... | code_fim | medium | {
"lang": "python",
"repo": "elijah74/django-url-shortener",
"path": "/base/shortener/views.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elijah74/django-url-shortener path: /base/shortener/views.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.http import Http404
from django.views import generic
from .baseconv import Base62
from .models import Shortener
<|fim_suffix|> try:
objec... | code_fim | hard | {
"lang": "python",
"repo": "elijah74/django-url-shortener",
"path": "/base/shortener/views.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_object(self, pk):
try:
object = self.model.objects.get(pk=pk)
except self.model.DoesNotExist:
raise Http404
if object.status == object.INACTIVE:
raise Http404
return object<|fim_prefix|># repo: elijah74/django-url-shortener p... | code_fim | medium | {
"lang": "python",
"repo": "elijah74/django-url-shortener",
"path": "/base/shortener/views.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tharaneetharan/node-addon-sqlite-backup path: /binding.gyp
{
"targets": [{
"target_name": "node-addon-sqlite-backup",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
<|fim_suffix|> "cppsrc/modules/compress.c"
],
'inclu... | code_fim | medium | {
"lang": "python",
"repo": "tharaneetharan/node-addon-sqlite-backup",
"path": "/binding.gyp",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> "cppsrc/modules/compress.c"
],
'include_dirs': [
"<!@(node -p \"require('node-addon-api').include\")"
],
'libraries': [],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
'defines': [ 'NAPI_DISABLE_CP... | code_fim | medium | {
"lang": "python",
"repo": "tharaneetharan/node-addon-sqlite-backup",
"path": "/binding.gyp",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>': [],
'dependencies': [
"<!(node -p \"require('node-addon-api').gyp\")"
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ]
}]
}<|fim_prefix|># repo: tharaneetharan/node-addon-sqlite-backup path: /binding.gyp
{
"targets": [{
"target_name": "node-addon-sqli... | code_fim | hard | {
"lang": "python",
"repo": "tharaneetharan/node-addon-sqlite-backup",
"path": "/binding.gyp",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
cmd = ' '.join(sys.argv[1:])
i = 1
while True:
print '=== Iteration {} ==='.format(i)
status = subprocess.call(cmd, shell=True)
print '=== exit status {} ==='.format(status)
i += 1
time.sleep(1)
except Keyboa... | code_fim | medium | {
"lang": "python",
"repo": "CraigDawson/gbin",
"path": "/forever.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CraigDawson/gbin path: /forever.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage: forever.py command args
"""
import sys
import time
import subprocess
<|fim_suffix|> i = 1
while True:
print '=== Iteration {} ==='.format(i)
status = subprocess.c... | code_fim | medium | {
"lang": "python",
"repo": "CraigDawson/gbin",
"path": "/forever.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
try:
cmd = ' '.join(sys.argv[1:])
i = 1
while True:
print '=== Iteration {} ==='.format(i)
status = subprocess.call(cmd, shell=True)
print '=== exit status {} ==='.format(status)
i += 1
time.sleep(1)
... | code_fim | medium | {
"lang": "python",
"repo": "CraigDawson/gbin",
"path": "/forever.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>admin.site.register(Item, ItemAdmin)
admin.site.register(Photo)<|fim_prefix|># repo: by46/muggle path: /gallery/admin.py
from django.contrib import admin
from .models import Photo, Item
# Register your models here.
class PhotoInline(admin.StackedInline):
<|fim_middle|> model = Photo
class ItemAd... | code_fim | medium | {
"lang": "python",
"repo": "by46/muggle",
"path": "/gallery/admin.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.