text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>def first_scalability_exp_differ_thread_num(suffix_str='pdf'):
tuple_lst = get_exp1_data()
exp1_figure, ax_tuple = plt.subplots(2, 4, figsize=(16, 6))
ax_title_lst = ['(a) dataset = orkut', '(b) dataset = webbase', '(c) dataset = twitter', '(d) datset = friendster']
thread_lst = map(int,... | code_fim | hard | {
"lang": "python",
"repo": "zzerain/ppSCAN",
"path": "/paper/deprecated/scalability/scalability_figure_paper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BillionsRichard/pycharmWorkspace path: /Demo/mypackage/unicode2utf8.py
#coding:utf-8
# software = \u8f6f\u4ef6\u72b6\u6001
# hardware<|fim_suffix|>u72b6\u6001"
utf8Str = unicodeStr.encode('utf-8')
print(utf8Str)<|fim_middle|> = \u786c\u4ef6\u72b6\u6001
# disk = \u78c1\u76d8\u72b6\u6001
# service... | code_fim | medium | {
"lang": "python",
"repo": "BillionsRichard/pycharmWorkspace",
"path": "/Demo/mypackage/unicode2utf8.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>u72b6\u6001"
utf8Str = unicodeStr.encode('utf-8')
print(utf8Str)<|fim_prefix|># repo: BillionsRichard/pycharmWorkspace path: /Demo/mypackage/unicode2utf8.py
#coding:utf-8
# software = \u8f6f\u4ef6\u72b6\u6001
# hardware<|fim_middle|> = \u786c\u4ef6\u72b6\u6001
# disk = \u78c1\u76d8\u72b6\u6001
# service... | code_fim | medium | {
"lang": "python",
"repo": "BillionsRichard/pycharmWorkspace",
"path": "/Demo/mypackage/unicode2utf8.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.error_label.setText('Нажмите Ctrl + G чтобы открыть средство для подбора цвета')
if not name and color:
self.error_label.setText('Вы не ввели название подзадачи')
self.name_label.setStyleSheet('background-color: rgb(255, 0, 0)')
self.color_label.set... | code_fim | hard | {
"lang": "python",
"repo": "leonorino/time-tracker",
"path": "/project_editor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leonorino/time-tracker path: /project_editor.py
def set_rounded_pixmap(self):
# Получаем минимальную высоту, которую может занимать Label
size = self.picture_label.minimumSizeHint().height()
radius = size // 2
color = QColor(*self.info[5])
# Создаём прозра... | code_fim | hard | {
"lang": "python",
"repo": "leonorino/time-tracker",
"path": "/project_editor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.new_name = name
self.new_color = color
self.connection.commit()
self.close()
def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape:
self.close()
elif event.modifiers() == Qt.ControlModifier and event.key() == Qt.Key_G:
... | code_fim | hard | {
"lang": "python",
"repo": "leonorino/time-tracker",
"path": "/project_editor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ToyYoda/SkatEngine path: /Skat.py
from random import randint
class Card:
#init-Funktion. Legt eine Karte in der übergebenen Farbe mit dem übergebenen Wert an
def __init__(self,farbe,wert):
self.__farbe = farbe
self.__wert = wert
#Gibt die Farbe der Karte zurück
... | code_fim | hard | {
"lang": "python",
"repo": "ToyYoda/SkatEngine",
"path": "/Skat.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,game,hand = False, schneider = False, schwarz = False, ouvert = False):
self.hand = hand
self.schneider = schneider
self.schwarz = schwarz
self.ouvert = ouvert
self.game = game
class Game_variant_null(Game_variant):
def __init__(self, game... | code_fim | hard | {
"lang": "python",
"repo": "ToyYoda/SkatEngine",
"path": "/Skat.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ashwinvin/atom path: /atom/__init__.py
import logging
import os
import coloredlogs
<|fim_suffix|># Set Discord.py log level
logging.getLogger("discord.client").setLevel(logging.INFO)
logging.getLogger("asyncio").setLevel(logging.DEBUG)<|fim_middle|>__version__ = "1.1.1"
# Set root log level
lo... | code_fim | medium | {
"lang": "python",
"repo": "ashwinvin/atom",
"path": "/atom/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Set Discord.py log level
logging.getLogger("discord.client").setLevel(logging.INFO)
logging.getLogger("asyncio").setLevel(logging.DEBUG)<|fim_prefix|># repo: ashwinvin/atom path: /atom/__init__.py
import logging
import os
import coloredlogs
<|fim_middle|>__version__ = "1.1.1"
# Set root log level
lo... | code_fim | medium | {
"lang": "python",
"repo": "ashwinvin/atom",
"path": "/atom/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_not_unique_search(self):
self.traj = Trajectory()
self.traj.f_add_parameter('ghgghg.test')
self.traj.f_add_parameter('ghdsfdfdsfdsghg.test')
with self.assertRaises(pex.NotUniqueNodeError):
self.traj.test
self.traj.f_add_parameter('depth0.... | code_fim | hard | {
"lang": "python",
"repo": "SmokinCaterpillar/pypet",
"path": "/pypet/tests/unittests/trajectory_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> lookout = {
'parameters': {
'my': {
'param': 42,
'fff': 44
}
},
'results': {
'runs':{
'run_ALL':{
'myresult': 55
... | code_fim | hard | {
"lang": "python",
"repo": "SmokinCaterpillar/pypet",
"path": "/pypet/tests/unittests/trajectory_test.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SmokinCaterpillar/pypet path: /pypet/tests/unittests/trajectory_test.py
erived_parameters', recursive=True)
self.assertTrue('y' not in traj)
self.assertEqual(traj.k[0], 44)
traj.f_remove_child('results', recursive = True)
self.assertTrue('k' not in traj)
... | code_fim | hard | {
"lang": "python",
"repo": "SmokinCaterpillar/pypet",
"path": "/pypet/tests/unittests/trajectory_test.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bouke/spa-sync path: /spa_sync/providers/contacts/addressbook.py
#!/usr/bin/env python
# encoding: utf-8
"""
addressbook.py
Python wrapper around Mac OSX Address Book.
from: https://raw.github.com/prabhu/macutils/master/addressbook.py
"""
from AddressBook import *
# List of properties to be i... | code_fim | hard | {
"lang": "python",
"repo": "Bouke/spa-sync",
"path": "/spa_sync/providers/contacts/addressbook.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Extract value from unicode, Date or Dictionary object.
"""
aval = None
if type(tmpval) == objc.pyobjc_unicode:
aval = tmpval.lstrip('_$!<').rstrip('>!$_')
elif issubclass(tmpval.__class__, NSDate):
aval = tmpval.description()
elif type(tmpval) == NSCFDiction... | code_fim | hard | {
"lang": "python",
"repo": "Bouke/spa-sync",
"path": "/spa_sync/providers/contacts/addressbook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # create a run config for this agent, to run 5 games, send to breezy server
startData = {
"agent": "Sample Random Agent",
"size": 5
}
# tell breezy server to start the run
response = requests.post(
url="http://{}:{}/run/".format(opts.breezyIp, opts.breezyPort), ... | code_fim | hard | {
"lang": "python",
"repo": "HuntLily/Senior-Design-TPG-DOTA-2",
"path": "/PyTPG/agent_server_random.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HuntLily/Senior-Design-TPG-DOTA-2 path: /PyTPG/agent_server_random.py
from http.server import BaseHTTPRequestHandler, HTTPServer
import json
from optparse import OptionParser
import threading
import random
import requests
parser = OptionParser()
# the address of this agent server
parser.add_opti... | code_fim | hard | {
"lang": "python",
"repo": "HuntLily/Senior-Design-TPG-DOTA-2",
"path": "/PyTPG/agent_server_random.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Agent code to determine action from features would go here.
"""
action = random.randint(0,29) # just random action for this example
self.postResponse(json.dumps({"actionCode":action}))
if __name__ == "__main__":
"""
Sets up and start... | code_fim | hard | {
"lang": "python",
"repo": "HuntLily/Senior-Design-TPG-DOTA-2",
"path": "/PyTPG/agent_server_random.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> quanLinear(4096, 4096, bias=False),
nn.BatchNorm1d(4096),
nn.ReLU(inplace=True),
nn.Linear(4096, num_classes, bias=True) if fp_ll
else quanLinear(4096, num_classes, bias=True)
)
for m in self.modules():
if isinstance... | code_fim | hard | {
"lang": "python",
"repo": "zlijingtao/DAC20_reconstruction",
"path": "/models/alexnet_quan.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, input):
tfactor_list = [0.05]
weight = _quanFunc(tfactor=tfactor_list[0])(self.weight)
output = F.linear(input, weight, self.bias)
return output
class AlexNet(nn.Module):
def __init__(self, num_classes=1000, fp_fl=True, fp_ll=True):
sup... | code_fim | hard | {
"lang": "python",
"repo": "zlijingtao/DAC20_reconstruction",
"path": "/models/alexnet_quan.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zlijingtao/DAC20_reconstruction path: /models/alexnet_quan.py
import torch.nn as nn
import torch.nn.functional as F
import math
import torch
from torch.nn import init
class _quanFunc(torch.autograd.Function):
def __init__(self, tfactor):
super(_quanFunc,self).__init__()
sel... | code_fim | hard | {
"lang": "python",
"repo": "zlijingtao/DAC20_reconstruction",
"path": "/models/alexnet_quan.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XC-Li/Raspberry_Projects path: /sitting_timer.py
import time
from sakshat import SAKSHAT
SAKS = SAKSHAT()
buzzer = SAKS.buzzer
<|fim_suffix|>SAKS.tact_event_handler = click
try:
while True:
time.sleep(1)
print ("aa")
except KeyboardInterrupt:
buzzer.off()<|fim_... | code_fim | medium | {
"lang": "python",
"repo": "XC-Li/Raspberry_Projects",
"path": "/sitting_timer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(pin)
print(status)
buzzer.beep(0.2)
SAKS.tact_event_handler = click
try:
while True:
time.sleep(1)
print ("aa")
except KeyboardInterrupt:
buzzer.off()<|fim_prefix|># repo: XC-Li/Raspberry_Projects path: /sitting_timer.py
import time
from sakshat impor... | code_fim | easy | {
"lang": "python",
"repo": "XC-Li/Raspberry_Projects",
"path": "/sitting_timer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HarmsA/gtkEmployees path: /users/migrations/0003_auto_20200203_1044.py
# Generated by Django 2.2 on 2020-02-03 16:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
<|fim_suffix|> operations = ... | code_fim | medium | {
"lang": "python",
"repo": "HarmsA/gtkEmployees",
"path": "/users/migrations/0003_auto_20200203_1044.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('users', '0002_auto_20200128_1150'),
]
operations = [
migrations.AddField(
model_name='customuser',
name='portrait',
field=models.ImageField(blank=True, null=True, upload_to='images/'),
),
migrations.CreateM... | code_fim | medium | {
"lang": "python",
"repo": "HarmsA/gtkEmployees",
"path": "/users/migrations/0003_auto_20200203_1044.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>", np.max(flow))
print("min", np.min(flow))
visualize_flow(flow)<|fim_prefix|># repo: MatthewD1993/flownet2-tf path: /src/test_flow_gt.py
from .flowlib import flow_error, read_flow, visualize_flow
import os
import numpy as np
flow_file_path = os.path.abspath('./data<|fim_middle|>/samples/0flow.flo')
flow... | code_fim | medium | {
"lang": "python",
"repo": "MatthewD1993/flownet2-tf",
"path": "/src/test_flow_gt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MatthewD1993/flownet2-tf path: /src/test_flow_gt.py
from .flowlib import flow_error, read_flow, visualize_flow
import os
import numpy as np
flow_file_path = os.path.abspath('./data<|fim_suffix|>", np.max(flow))
print("min", np.min(flow))
visualize_flow(flow)<|fim_middle|>/samples/0flow.flo')
flow... | code_fim | medium | {
"lang": "python",
"repo": "MatthewD1993/flownet2-tf",
"path": "/src/test_flow_gt.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>/samples/0flow.flo')
flow = read_flow(flow_file_path)
print("max", np.max(flow))
print("min", np.min(flow))
visualize_flow(flow)<|fim_prefix|># repo: MatthewD1993/flownet2-tf path: /src/test_flow_gt.py
from .flowlib import flow_error, read_flow, visualize_flow
impor<|fim_middle|>t os
import numpy as np
f... | code_fim | medium | {
"lang": "python",
"repo": "MatthewD1993/flownet2-tf",
"path": "/src/test_flow_gt.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Parents
fields = ('parents_name','phone_no','student_id')<|fim_prefix|># repo: unicefkenya/da_api path: /oosc/oosc/parents/serializers.py
from rest_framework import serializers
from parents.models import Parents
class ParentsSerializer(serializer.ModelSerializer):
<|fim_middle|> ... | code_fim | easy | {
"lang": "python",
"repo": "unicefkenya/da_api",
"path": "/oosc/oosc/parents/serializers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: unicefkenya/da_api path: /oosc/oosc/parents/serializers.py
from rest_framework import serializers
from parents.models import Parents
<|fim_suffix|> model = Parents
fields = ('parents_name','phone_no','student_id')<|fim_middle|>class ParentsSerializer(serializer.ModelSerializer):
... | code_fim | medium | {
"lang": "python",
"repo": "unicefkenya/da_api",
"path": "/oosc/oosc/parents/serializers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lewfish/septa-bus-prediction path: /lewfish/septaprediction/gtfs.py
"""Tools for interacting with a GTFS database."""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
def get_shape_dicts(route_short_name, septa_fn):
"""Returns dicts that are useful for mapping fro... | code_fim | hard | {
"lang": "python",
"repo": "lewfish/septa-bus-prediction",
"path": "/lewfish/septaprediction/gtfs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> route_short_name = "47"
#XXX change me
septa_fn = "sqlite:////Users/lewfish/data/septa/septa_bus.sqlite"
route_block_to_shape, shape_to_path = get_shape_dicts(route_short_name, septa_fn)
for s_id, path in shape_to_path.iteritems():
print s_id
print path
pri... | code_fim | hard | {
"lang": "python",
"repo": "lewfish/septa-bus-prediction",
"path": "/lewfish/septaprediction/gtfs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if info_formats is not None:
if '/' in request.infoformat: # mimetype
if request.infoformat not in self.info_formats.values():
raise RequestError('unknown infoformat: ' + str(request.infoformat),
code='InvalidParameterValue',... | code_fim | hard | {
"lang": "python",
"repo": "DisyInformationssysteme/mapproxy",
"path": "/mapproxy/service/wmts.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def template_context(self):
return dict(service=bunch(default='', **self.service),
restful=True,
layers=self.layers,
info_formats=self.info_formats,
tile_matrix_sets=self.matrix_sets,
resource_t... | code_fim | hard | {
"lang": "python",
"repo": "DisyInformationssysteme/mapproxy",
"path": "/mapproxy/service/wmts.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DisyInformationssysteme/mapproxy path: /mapproxy/service/wmts.py
# This file is part of the MapProxy project.
# Copyright (C) 2011 Omniscale <http://omniscale.de>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.... | code_fim | hard | {
"lang": "python",
"repo": "DisyInformationssysteme/mapproxy",
"path": "/mapproxy/service/wmts.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return files
#files=getAllFiles('c://users//ananthan//pictures//','*.jpg')<|fim_prefix|># repo: tlananthu/python-learning path: /libraries/get_file_list.py
def getAllFiles(rootDir, wildcardsearch):
import glob
import os
<|fim_middle|> files=[]
for file in glob.glob(rootDir+'**/'+wild... | code_fim | medium | {
"lang": "python",
"repo": "tlananthu/python-learning",
"path": "/libraries/get_file_list.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tlananthu/python-learning path: /libraries/get_file_list.py
def getAllFiles(rootDir, wildcardsearch):
<|fim_suffix|>#files=getAllFiles('c://users//ananthan//pictures//','*.jpg')<|fim_middle|> import glob
import os
files=[]
for file in glob.glob(rootDir+'**/'+wildcardsearch,recursi... | code_fim | hard | {
"lang": "python",
"repo": "tlananthu/python-learning",
"path": "/libraries/get_file_list.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self._output_dtype
@property
def params(self):
return self._params
@params.setter
def params(self, val):
if type(val) != list:
raise AttributeError('type of params must be \'list\', '
'not \'{}\'.'.format(type(va... | code_fim | hard | {
"lang": "python",
"repo": "hanqian2019/tftf",
"path": "/tftf/layers/Layer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def activation_initializer(self, activation):
activations = {
'elu': elu,
'hard_sigmoid': hard_sigmoid,
'leaky_relu': leaky_relu,
'linear': linear,
# 'prelu': prelu,
'relu': relu,
'selu': selu,
'sig... | code_fim | hard | {
"lang": "python",
"repo": "hanqian2019/tftf",
"path": "/tftf/layers/Layer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hanqian2019/tftf path: /tftf/layers/Layer.py
import tensorflow as tf
from .activations import *
from .initializers import *
class Layer(object):
def __init__(self):
self._input_dim = None
self._output_dim = None
self._input_dtype = tf.float32
self._output_dty... | code_fim | hard | {
"lang": "python",
"repo": "hanqian2019/tftf",
"path": "/tftf/layers/Layer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iaciac/networkx path: /networkx/algorithms/tests/test_richcore.py
import networkx as nx
from nose.tools import *
def test_richcore():
<|fim_suffix|> sigmas, ranked_nodes, r_star = nx.richcore.extract_rich_core(G, weight='weight')
assert_equal(sigmas, [0, 19.0, 19.0, 19.0, 10.9999999999999... | code_fim | hard | {
"lang": "python",
"repo": "iaciac/networkx",
"path": "/networkx/algorithms/tests/test_richcore.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> sigmas, ranked_nodes, r_star = nx.richcore.extract_rich_core(G, weight='weight')
assert_equal(sigmas, [0, 19.0, 19.0, 19.0, 10.999999999999998, 30.0])
assert_equal(ranked_nodes, ['c', 'a', 'f', 'e', 'b', 'd'])
assert_equal(r_star, 5)<|fim_prefix|># repo: iaciac/networkx path: /networkx/al... | code_fim | hard | {
"lang": "python",
"repo": "iaciac/networkx",
"path": "/networkx/algorithms/tests/test_richcore.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: weaver-viii/skia-buildbot path: /slave/skia_slave_scripts/cc_unittests.py
#!/usr/bin/env python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the cc_unittests executabl... | code_fim | medium | {
"lang": "python",
"repo": "weaver-viii/skia-buildbot",
"path": "/slave/skia_slave_scripts/cc_unittests.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _Run(self):
# SchedulerTest is flaky, so disabling it for now. For details, see:
# https://code.google.com/p/chromium/issues/detail?id=380889
args = ['--gtest_filter=-SchedulerTest.*']
self._flavor_utils.RunFlavoredCmd('cc_unittests', args)
if '__main__' == __name__:
sys.exit(Bui... | code_fim | medium | {
"lang": "python",
"repo": "weaver-viii/skia-buildbot",
"path": "/slave/skia_slave_scripts/cc_unittests.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if '__main__' == __name__:
sys.exit(BuildStep.RunBuildStep(CCUnitTests))<|fim_prefix|># repo: weaver-viii/skia-buildbot path: /slave/skia_slave_scripts/cc_unittests.py
#!/usr/bin/env python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-s... | code_fim | hard | {
"lang": "python",
"repo": "weaver-viii/skia-buildbot",
"path": "/slave/skia_slave_scripts/cc_unittests.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def schema(self) -> SortedDict:
"""`SortedDict`: Ordered archive directory storage schema."""
return self._schema
@schema.setter
def schema(self, value: SortedDict):
self._schema = value
@property
def schema_file(self) -> str:
"""`str`: N... | code_fim | hard | {
"lang": "python",
"repo": "ethall/syphon",
"path": "/syphon/context.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ethall/syphon path: /syphon/context.py
"""syphon.context.py
Copyright (c) 2017-2018 Keithley Instruments, LLC.
Licensed under MIT (https://github.com/ehall/syphon/blob/master/LICENSE)
"""
from sortedcontainers import SortedDict
class Context(object):
"""Runtime settings container.""... | code_fim | hard | {
"lang": "python",
"repo": "ethall/syphon",
"path": "/syphon/context.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @data.setter
def data(self, value: str):
self._data = value
@property
def meta(self) -> str:
"""`str`: Absolute filepath or glob pattern of metadata files(s)."""
return self._meta
@meta.setter
def meta(self, value: str):
self._meta = value
@pr... | code_fim | hard | {
"lang": "python",
"repo": "ethall/syphon",
"path": "/syphon/context.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: neviim/switchboard path: /switchboard/app.py
import sys
import argparse
import json
from copy import deepcopy
from switchboard.client import SwitchboardClient
from switchboard.ws_ctrl_client import WSIODataClient
def check_port_arg(args, port_name):
if hasattr(args, port_name):
p... | code_fim | hard | {
"lang": "python",
"repo": "neviim/switchboard",
"path": "/switchboard/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not check_port_arg(self.args, 'client_port'):
sys.exit(1)
def run(self):
try:
self.run_client(int(self.args.client_port))
except KeyboardInterrupt:
sys.exit(0)
class WSIODataApp(WSIODataClient, App):
def __init__(self, ws_handler, c... | code_fim | hard | {
"lang": "python",
"repo": "neviim/switchboard",
"path": "/switchboard/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> configs['WSIOData port'] = {
'args': ['--ws_port', '-ip'],
'kwargs': { 'help': 'Switchboard Websocket Ctrl server port to connect to' }
}
configs['WSIOData host'] = {
'args': ['--ws_host', '-ih'],
'kwargs': { 'help': 'Switchboard Webs... | code_fim | hard | {
"lang": "python",
"repo": "neviim/switchboard",
"path": "/switchboard/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: phcreery/spotify-downloader path: /spotdl/utils/matching.py
g_str = slugify(string).replace("-", "")
if slug_str in simple_test_str and slug_str not in test_str:
final_str += f"-{slug_str}"
test_str += slug_str
return final_str
def create_clean_string(
... | code_fim | hard | {
"lang": "python",
"repo": "phcreery/spotify-downloader",
"path": "/spotdl/utils/matching.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ### Arguments
- results: The results to order.
- song: The song to order for.
- search_query: The search query.
### Returns
- The ordered results.
"""
# Assign an overall avg match value to each result
links_with_match_value = {}
# Iterate over all results
fo... | code_fim | hard | {
"lang": "python",
"repo": "phcreery/spotify-downloader",
"path": "/spotdl/utils/matching.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def calc_time_match(song: Song, result: Result) -> float:
"""
Calculate time difference between song and result
### Arguments
- song: song to match
- result: result to match
### Returns
- time difference between song and result
"""
if result.duration > song.duration:... | code_fim | hard | {
"lang": "python",
"repo": "phcreery/spotify-downloader",
"path": "/spotdl/utils/matching.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: feitianyiren/eums path: /eums/test/factories/purchase_order_item_factory.py
import factory
from eums.models import PurchaseOrderItem
from eums.test.factories.item_factory import ItemFactory
from eums.test.factories.purchase_order_factory import PurchaseOrderFactory
from eums.test.factories.sales... | code_fim | medium | {
"lang": "python",
"repo": "feitianyiren/eums",
"path": "/eums/test/factories/purchase_order_item_factory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = PurchaseOrderItem
purchase_order = factory.SubFactory(PurchaseOrderFactory)
sales_order_item = factory.SubFactory(SalesOrderItemFactory)
item_number = factory.Sequence(lambda n: 10 * n)
item = factory.SubFactory(ItemFactory)
quantity = 100
value = 1... | code_fim | medium | {
"lang": "python",
"repo": "feitianyiren/eums",
"path": "/eums/test/factories/purchase_order_item_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = PurchaseOrderItem
purchase_order = factory.SubFactory(PurchaseOrderFactory)
sales_order_item = factory.SubFactory(SalesOrderItemFactory)
item_number = factory.Sequence(lambda n: 10 * n)
item = factory.SubFactory(ItemFactory)
quantity = 100
value = 1000.00<|fim_pref... | code_fim | medium | {
"lang": "python",
"repo": "feitianyiren/eums",
"path": "/eums/test/factories/purchase_order_item_factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tughv/awesome-DeepLearning path: /transformer_courses/BERT_distillation/PaddleSlim-develop/paddleslim/nas/one_shot/one_shot_nas.py
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except ... | code_fim | hard | {
"lang": "python",
"repo": "tughv/awesome-DeepLearning",
"path": "/transformer_courses/BERT_distillation/PaddleSlim-develop/paddleslim/nas/one_shot/one_shot_nas.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Defines the computation performed at every call.
Should be overridden by all subclasses.
Args:
inputs(tuple): unpacked tuple arguments
kwargs(dict): unpacked dict arguments
"""
raise NotImplementedError('Abstract method.')
def forwar... | code_fim | hard | {
"lang": "python",
"repo": "tughv/awesome-DeepLearning",
"path": "/transformer_courses/BERT_distillation/PaddleSlim-develop/paddleslim/nas/one_shot/one_shot_nas.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_mapped_color_direct_alpha(self, x, y, color):
alpha = .5
p = Plot(x, y, color=color).add(Bars(alpha=alpha)).plot()
ax = p._figure.axes[0]
fcs = ax.collections[0].get_facecolors()
C0, C1, C2, *_ = p._theme["axes.prop_cycle"].by_key()["color"]
ex... | code_fim | hard | {
"lang": "python",
"repo": "mwaskom/seaborn",
"path": "/tests/_marks/test_bar.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mwaskom/seaborn path: /tests/_marks/test_bar.py
import numpy as np
import pandas as pd
from matplotlib.colors import to_rgba, to_rgba_array
import pytest
from numpy.testing import assert_array_equal
from seaborn._core.plot import Plot
from seaborn._marks.bar import Bar, Bars
class TestBar:
... | code_fim | hard | {
"lang": "python",
"repo": "mwaskom/seaborn",
"path": "/tests/_marks/test_bar.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: toomoresuch/pysonengine path: /eggs/igo_python-0.3-py2.6.egg/igo/Tagger.py
# -*- coding: utf-8 -*-
from igo.dictionary import Matrix, WordDic, Unknown, ViterbiNode
class Morpheme:
"""
形態素クラス
"""
def __init__(self, surface, feature, start):
self.surface = surface
... | code_fim | hard | {
"lang": "python",
"repo": "toomoresuch/pysonengine",
"path": "/eggs/igo_python-0.3-py2.6.egg/igo/Tagger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = vn.prev = prevs[0]
vn.cost = f.cost + self.mtx.linkCost(f.rightId, vn.leftId)
for i in range(1, len(prevs)):
p = prevs[i]
cost = p.cost + self.mtx.linkCost(p.rightId, vn.leftId)
if cost < vn.cost:
vn.cost = cost
... | code_fim | hard | {
"lang": "python",
"repo": "toomoresuch/pysonengine",
"path": "/eggs/igo_python-0.3-py2.6.egg/igo/Tagger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(buy_and_sell((9, 11, 8, 5, 7, 10)), 5) # Buy on "5" and sell on "10"
self.assertEqual(buy_and_sell((9, 11, 5, 2, 6, 6 )), 4) # Buy on "2" and sell on "6"
self.assertEqual(buy_and_sell((4, 4, 4, 4 )), 0) # Buy and sell for the same price
self.assertEqual(buy_and_sell... | code_fim | medium | {
"lang": "python",
"repo": "mauricioklein/algorithm-exercises",
"path": "/challenge-36/test_solver.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mauricioklein/algorithm-exercises path: /challenge-36/test_solver.py
import unittest
from solver import buy_and_sell
class TestSolver(unittest.TestCase):
<|fim_suffix|> self.assertEqual(buy_and_sell((9, 11, 8, 5, 7, 10)), 5) # Buy on "5" and sell on "10"
self.assertEqual(buy_and_sell((9, ... | code_fim | medium | {
"lang": "python",
"repo": "mauricioklein/algorithm-exercises",
"path": "/challenge-36/test_solver.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(self.connectedVehicleTrajectoryTimePoint) > 0:
ax1.scatter(self.connectedVehicleTrajectoryTimePoint, self.connectedVehicleTrajectoryDistancePoint, c="black", linewidths=4,
marker=".", edgecolor="none", s=50, label='Connected Vehicles Trajectory', zorde... | code_fim | hard | {
"lang": "python",
"repo": "mmitss/mmitss-az",
"path": "/src/tools/time-space-diagram/TimeSpaceDiagramManager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(self.transitTrajectoryTimePoint) > 0:
ax1.scatter(self.transitTrajectoryTimePoint, self.transitTrajectoryDistancePoint, c="black",
linewidths=4, marker=".", edgecolor="none", s=50, label='Connected Vehicles Trajectory', zorder=2)
if len(self.tr... | code_fim | hard | {
"lang": "python",
"repo": "mmitss/mmitss-az",
"path": "/src/tools/time-space-diagram/TimeSpaceDiagramManager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mmitss/mmitss-az path: /src/tools/time-space-diagram/TimeSpaceDiagramManager.py
"""
***************************************************************************************
© 2019 Arizona Board of Regents on behalf of the University of Arizona with rights
granted for USDOT OSADP distribut... | code_fim | hard | {
"lang": "python",
"repo": "mmitss/mmitss-az",
"path": "/src/tools/time-space-diagram/TimeSpaceDiagramManager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Performing {} + {}:".format(request.a, request.b))
result = service_client.service.add(request)
print("Result: {}".format(result.value))
print("Performing {} - {}:".format(request.a, request.b))
result = service_client.service.sub(request)
print("Result: {}".format(result.value))
print("Performin... | code_fim | hard | {
"lang": "python",
"repo": "singnet/snet-code-examples",
"path": "/python/client/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: singnet/snet-code-examples path: /python/client/test.py
from snet.sdk import SnetSDK
import example_service_pb2
import example_service_pb2_grpc
from config import config
sdk = SnetSDK(config)
org_id = "snet"
service_id = "example-service"
service_client = sdk.create_service_client(
org_i... | code_fim | medium | {
"lang": "python",
"repo": "singnet/snet-code-examples",
"path": "/python/client/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if portal_auth is not None:
portal_auth.access_token = self.auth_token
portal_auth.refresh_token = self.ref_token
else:
portal_auth = PortalAuth(portal=self.domain, access_token=self.auth_token, refresh_token=self.ref_token)
db.session.add(po... | code_fim | medium | {
"lang": "python",
"repo": "bogdanovdya/Clients_Lifetime",
"path": "/IApplication.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def save_auth(self):
"""
Сохраняет данные OAuth в БД
:return:
"""
portal_auth = PortalAuth.query.filter_by(portal=self.domain).first()
self.auth_token = self.bx24.auth_token
self.ref_token = self.bx24.refresh_token
if portal_auth is not... | code_fim | hard | {
"lang": "python",
"repo": "bogdanovdya/Clients_Lifetime",
"path": "/IApplication.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bogdanovdya/Clients_Lifetime path: /IApplication.py
from bitrix24.bitrix24 import Bitrix24
from models import PortalAuth
from app import db
class IApplication:
def __init__(self, domain, lang, auth_token, ref_token):
self.domain = domain.split('.bitrix24')[0]
self.auth_toke... | code_fim | hard | {
"lang": "python",
"repo": "bogdanovdya/Clients_Lifetime",
"path": "/IApplication.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rospy.init_node('pubmarker',anonymous=True,disable_signals=True)
timeconnect()<|fim_prefix|># repo: efraccaroli/nre_simhuskycontrol path: /python/connection_timing.py
#!/usr/bin/env python
'''
How long does it take to make a connection in ROS
'''
import rospy
import visualization_msgs.msg
import time
... | code_fim | hard | {
"lang": "python",
"repo": "efraccaroli/nre_simhuskycontrol",
"path": "/python/connection_timing.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: efraccaroli/nre_simhuskycontrol path: /python/connection_timing.py
#!/usr/bin/env python
'''
How long does it take to make a connection in ROS
'''
import rospy
import visualization_msgs.msg
import time
<|fim_suffix|>
rospy.init_node('pubmarker',anonymous=True,disable_signals=True)
timeconnect... | code_fim | hard | {
"lang": "python",
"repo": "efraccaroli/nre_simhuskycontrol",
"path": "/python/connection_timing.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>num = int.from_bytes(a[28:32], "little")
i = 0
while i < num:
of = int.from_bytes(a[32:36], "little") + i * 4
hz = int.from_bytes(a[of:of+4], "little")
if hz in dd:
of2 = int.from_bytes(a[36:40], "little") + i * 4
of2 = int.from_bytes(a[of2:of2+4], "little")
ln = a[of2]
st = a[of2 + 1: of2 + 1 ... | code_fim | medium | {
"lang": "python",
"repo": "Marisa-Chan/Xen-O-Proto",
"path": "/tools/strings/clientStrings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def hsh(b):
v = 5381
for a in b.encode("ascii"):
v = (33 * v + a) & 0xFFFFFFFF
return v
for l in f:
l = l.strip()
dd[hsh(l)] = l
f.close()
f = open("XenStrs.mdlr", "rb")
a = f.read()
f.close()
num = int.from_bytes(a[28:32], "little")
i = 0
while i < num:
of = int.from_bytes(a[32:36], "little")... | code_fim | medium | {
"lang": "python",
"repo": "Marisa-Chan/Xen-O-Proto",
"path": "/tools/strings/clientStrings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Marisa-Chan/Xen-O-Proto path: /tools/strings/clientStrings.py
#!/usr/bin/python3
#### File with string identifiers from client
f = open("clientSTRids.txt","r")
<|fim_suffix|>f.close()
f = open("XenStrs.mdlr", "rb")
a = f.read()
f.close()
num = int.from_bytes(a[28:32], "little")
i = 0
while i ... | code_fim | medium | {
"lang": "python",
"repo": "Marisa-Chan/Xen-O-Proto",
"path": "/tools/strings/clientStrings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gamichaelh/fHDHR path: /fHDHR/exceptions/__init__.py
"""Exceptions to throw."""
class TunerError(Exception):
def __init__(self, value):
self.value = value
<|fim_suffix|> def __str__(self):
return 'OriginSetupError: %s' % self.value
class EPGSetupError(Exception):
... | code_fim | medium | {
"lang": "python",
"repo": "gamichaelh/fHDHR",
"path": "/fHDHR/exceptions/__init__.py",
"mode": "psm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|>class OriginSetupError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return 'OriginSetupError: %s' % self.value
class EPGSetupError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return 'EPGSet... | code_fim | medium | {
"lang": "python",
"repo": "gamichaelh/fHDHR",
"path": "/fHDHR/exceptions/__init__.py",
"mode": "spm",
"license": "WTFPL",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create components: env, policy, collector
if env_setting is None:
env_fn, collector_env_cfg, _ = get_vec_env_setting(cfg.env)
else:
env_fn, collector_env_cfg, _ = env_setting
collector_env = create_env_manager(cfg.env.manager, [partial(env_fn, cfg=c) for c in collector_en... | code_fim | hard | {
"lang": "python",
"repo": "shengxuesun/DI-engine",
"path": "/ding/entry/application_entry.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def collect_demo_data(
input_cfg: Union[str, dict],
seed: int,
collect_count: int,
expert_data_path: str,
env_setting: Optional[List[Any]] = None,
model: Optional[torch.nn.Module] = None,
state_dict: Optional[dict] = None,
) -> None:
r"""
Ove... | code_fim | hard | {
"lang": "python",
"repo": "shengxuesun/DI-engine",
"path": "/ding/entry/application_entry.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shengxuesun/DI-engine path: /ding/entry/application_entry.py
from typing import Union, Optional, List, Any, Callable, Tuple
import pickle
import torch
from functools import partial
from ding.config import compile_config, read_config
from ding.worker import BaseLearner, SampleCollector, BaseSeria... | code_fim | hard | {
"lang": "python",
"repo": "shengxuesun/DI-engine",
"path": "/ding/entry/application_entry.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suryam35/Software-Lab-CS29006 path: /Assignment-3/Part-2/torch_package/data/transforms/rescale.py
#Imports
import numpy as np
from PIL import Image
class RescaleImage(object):
'''
Rescales the image to a given size.
'''
def __init__(self, output_size):
'''
... | code_fim | hard | {
"lang": "python",
"repo": "suryam35/Software-Lab-CS29006",
"path": "/Assignment-3/Part-2/torch_package/data/transforms/rescale.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Note: You do not need to resize the bounding boxes. ONLY RESIZE THE IMAGE.
'''
# Write your code here
width, height = image.shape[1] , image.shape[0]
image = Image.fromarray(image)
if isinstance(self.output_size , int):
if width < height:
... | code_fim | hard | {
"lang": "python",
"repo": "suryam35/Software-Lab-CS29006",
"path": "/Assignment-3/Part-2/torch_package/data/transforms/rescale.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ltstein/SCUTTLE path: /software/python/basics/L1_mpu.py
# This program accesses info from the Blue's onboard sensor, MPU9250
# It reads temp, accelerometer, gyro, and magnetometer data from the sensor.
# Uses RCPY library. See guitar.ucsd.edu/rcpy/rcpy.pdf for documentation
# Import external li... | code_fim | medium | {
"lang": "python",
"repo": "ltstein/SCUTTLE",
"path": "/software/python/basics/L1_mpu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def getTemp():
temp = mpu9250.read_imu_temp() # returns just temperature (deg C)
return(temp)
def getMag():
mag = mpu9250.read_mag_data() # gets x,y,z mag values (microtesla)
mag = np.round(mag, 1) # round values to 1 decimal
return(ma... | code_fim | hard | {
"lang": "python",
"repo": "ltstein/SCUTTLE",
"path": "/software/python/basics/L1_mpu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def getMag():
mag = mpu9250.read_mag_data() # gets x,y,z mag values (microtesla)
mag = np.round(mag, 1) # round values to 1 decimal
return(mag)
def getGyro():
gyro = mpu9250.read_gyro_data() # returns 3 axes gyro data (deg/s)
gyro = np.r... | code_fim | medium | {
"lang": "python",
"repo": "ltstein/SCUTTLE",
"path": "/software/python/basics/L1_mpu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peternewman22/Python_Courses path: /Python for Data Analysis and Visualisation/Find_and_replace.py
import numpy as np
import pandas as pd
from pandas import Series,DataFrame
<|fim_suffix|>for x in listToReplace:
if x in dictionary:
x = dictionary[x]
print(x)
else: print... | code_fim | medium | {
"lang": "python",
"repo": "peternewman22/Python_Courses",
"path": "/Python for Data Analysis and Visualisation/Find_and_replace.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(toReplace.columns)
listToReplace = toReplace["Topic"].tolist()
for x in listToReplace:
if x in dictionary:
x = dictionary[x]
print(x)
else: print(x)<|fim_prefix|># repo: peternewman22/Python_Courses path: /Python for Data Analysis and Visualisation/Find_and_replace.py
impo... | code_fim | easy | {
"lang": "python",
"repo": "peternewman22/Python_Courses",
"path": "/Python for Data Analysis and Visualisation/Find_and_replace.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>toReplace = pd.read_clipboard()
print(toReplace.columns)
listToReplace = toReplace["Topic"].tolist()
for x in listToReplace:
if x in dictionary:
x = dictionary[x]
print(x)
else: print(x)<|fim_prefix|># repo: peternewman22/Python_Courses path: /Python for Data Analysis and Visua... | code_fim | easy | {
"lang": "python",
"repo": "peternewman22/Python_Courses",
"path": "/Python for Data Analysis and Visualisation/Find_and_replace.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_queryset(self):
if 'question' in self.request.GET:
self.queryset = self.queryset.filter(
question=self.request.GET['question']
)
return self.queryset<|fim_prefix|># repo: tndatacommons/tndata_backend path: /tndata_backend/questions/api.... | code_fim | hard | {
"lang": "python",
"repo": "tndatacommons/tndata_backend",
"path": "/tndata_backend/questions/api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class AnswerViewSet(mixins.CreateModelMixin,
mixins.ListModelMixin,
mixins.RetrieveModelMixin,
mixins.DestroyModelMixin,
mixins.UpdateModelMixin,
viewsets.GenericViewSet):
queryset = Answer.objects... | code_fim | hard | {
"lang": "python",
"repo": "tndatacommons/tndata_backend",
"path": "/tndata_backend/questions/api.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tndatacommons/tndata_backend path: /tndata_backend/questions/api.py
from django.db.models import Q
from rest_framework import mixins, permissions, status, viewsets
from .serializers import QuestionSerializer, AnswerSerializer
from .models import Question, Answer
class QuestionViewSet(mixins.Cr... | code_fim | hard | {
"lang": "python",
"repo": "tndatacommons/tndata_backend",
"path": "/tndata_backend/questions/api.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> exporter = WeatherExporter(config)
start_http_server(os.environ.get('PORT', 9265))
while True:
for location in config['locations']:
exporter.report_metrics(location)
try:
time.sleep(os.environ.get('SCRAPE_INTERVAL', 600))
except KeyboardInterrupt... | code_fim | hard | {
"lang": "python",
"repo": "cejohnson/weather_exporter",
"path": "/weather_exporter/exporter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
config_file = os.environ.get('CONFIG_FILE', '/etc/weather_exporter/config.json')
with open(config_file, 'r') as cf:
config = json.load(cf)
exporter = WeatherExporter(config)
start_http_server(os.environ.get('PORT', 9265))
while True:
for loc... | code_fim | hard | {
"lang": "python",
"repo": "cejohnson/weather_exporter",
"path": "/weather_exporter/exporter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cejohnson/weather_exporter path: /weather_exporter/exporter.py
import json
import logging
import os
import requests
import re
import time
from prometheus_client import start_http_server, Gauge
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s: %(message)s')
logger = logg... | code_fim | hard | {
"lang": "python",
"repo": "cejohnson/weather_exporter",
"path": "/weather_exporter/exporter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anshiquanshu66/conll2019-snopes-experiments path: /src/scripts/models/generate_paths.py
import argparse
import copy
import json
import pickle
from concurrent.futures import ThreadPoolExecutor
import requests
from tqdm import tqdm
from athene.rte.utils.data_reader import evidence_num_to_text
fro... | code_fim | hard | {
"lang": "python",
"repo": "anshiquanshu66/conll2019-snopes-experiments",
"path": "/src/scripts/models/generate_paths.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _split_sent_str(sent_str):
segments = sent_str.split(PAGE_LINE_SEGMENTOR)
assert len(segments) == 2, "invalid page line_num concatenation: " + sent_str
return segments[0], int(segments[1])
def _check_hops(_claim_text, _evidence_text):
obj = copy.deepcopy(JSON_TEMPLATE)
obj['topi... | code_fim | hard | {
"lang": "python",
"repo": "anshiquanshu66/conll2019-snopes-experiments",
"path": "/src/scripts/models/generate_paths.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.skipif(SKIP_S3_TESTS, reason="Skipping mock S3 tests")
def test_query_ok():
num_parts = 3
with new_test_dataset(num_parts) as test_ds:
args = build_register_args(test_ds.copy_to_s3())
ds_name = args['name']
URLs.run(url_info=URLs.register_url(), json_body=args... | code_fim | hard | {
"lang": "python",
"repo": "eladroz/funnel-rocket",
"path": "/tests/test_apiserver.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.