text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: nagadomi/nunif path: /nunif/modules/charbonnier_loss.py
from torch import nn
import torch
def charbonnier_loss(input, target, reduction="mean", eps=1.0e-6):
<|fim_suffix|> def __init__(self, eps=1e-6, reduction="mean"):
super().__init__()
self.eps = eps
self.reduction... | code_fim | hard | {
"lang": "python",
"repo": "nagadomi/nunif",
"path": "/nunif/modules/charbonnier_loss.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: howl-anderson/MicroTokenizer path: /MicroTokenizer/ensemble/merge_solutions.py
import networkx as nx
class MergeSolutions(object):
def __init__(self):
self.G = nx.DiGraph()
self.start_node = "<start>"
self.G.add_node(self.start_node, label=self.start_node)
se... | code_fim | hard | {
"lang": "python",
"repo": "howl-anderson/MicroTokenizer",
"path": "/MicroTokenizer/ensemble/merge_solutions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
solutions = [
["王小明", "来到", "了", "网易", "杭", "研", "大厦"],
["王", "小明", "来到", "了", "网易", "杭研", "大", "厦"],
]
merge_solutions = MergeSolutions()
best_solution = merge_solutions.merge(solutions)
print(best_solution)
merge_solutions.write_graph(... | code_fim | hard | {
"lang": "python",
"repo": "howl-anderson/MicroTokenizer",
"path": "/MicroTokenizer/ensemble/merge_solutions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tags = {'cmd': 'custom'}
self.mee6.stats.incr('mee6.command', tags=tags)
await self.mee6.send_message(
message.channel,
response
)<|fim_prefix|># repo: IceCruelStuff/mee6 path: /chat-bot/plugins/commands.py
import logging
... | code_fim | hard | {
"lang": "python",
"repo": "IceCruelStuff/mee6",
"path": "/chat-bot/plugins/commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IceCruelStuff/mee6 path: /chat-bot/plugins/commands.py
import logging
from plugin import Plugin
from utils import rich_response
log = logging.getLogger('discord')
class Commands(Plugin):
fancy_name = 'Custom Commands'
async def get_commands(self, server):
storage = await se... | code_fim | hard | {
"lang": "python",
"repo": "IceCruelStuff/mee6",
"path": "/chat-bot/plugins/commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>in_util import update_spixl_map, get_spixel_image, poolfeat, upfeat<|fim_prefix|># repo: zwxu064/TransInit path: /third_party/sp_fcn/__init__.py
from .models.Spixel_single_layer import SpixelNet1l_bn
from .loss import compute_semantic_pos_loss
from .train_util import init_spixe<|fim_middle|>l_grid, shift... | code_fim | medium | {
"lang": "python",
"repo": "zwxu064/TransInit",
"path": "/third_party/sp_fcn/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zwxu064/TransInit path: /third_party/sp_fcn/__init__.py
from .models.Spixel_single_layer import SpixelNet1l_bn
from .loss import compute_semantic_pos_loss
from .train_util import init_spixe<|fim_suffix|>in_util import update_spixl_map, get_spixel_image, poolfeat, upfeat<|fim_middle|>l_grid, shift... | code_fim | medium | {
"lang": "python",
"repo": "zwxu064/TransInit",
"path": "/third_party/sp_fcn/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>l_grid, shift9pos, label2one_hot_torch, build_LABXY_feat
from .train_util import update_spixl_map, get_spixel_image, poolfeat, upfeat<|fim_prefix|># repo: zwxu064/TransInit path: /third_party/sp_fcn/__init__.py
from .models.Spixel_single_layer import SpixelNet1l_bn
from .loss <|fim_middle|>import compute... | code_fim | medium | {
"lang": "python",
"repo": "zwxu064/TransInit",
"path": "/third_party/sp_fcn/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('additem', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='additem',
old_name='name',
new_name='business_name',
),
migrations.RenameField(
model_name='additem',
... | code_fim | medium | {
"lang": "python",
"repo": "mbogokennedy/VIOXY",
"path": "/additem/migrations/0002_auto_20180209_1208.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mbogokennedy/VIOXY path: /additem/migrations/0002_auto_20180209_1208.py
# Generated by Django 2.0.1 on 2018-02-09 09:08
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='addit... | code_fim | medium | {
"lang": "python",
"repo": "mbogokennedy/VIOXY",
"path": "/additem/migrations/0002_auto_20180209_1208.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('additem', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='additem',
old_name='name',
new_name='business_name',
),
migrations.RenameField(
model_name='additem',
... | code_fim | medium | {
"lang": "python",
"repo": "mbogokennedy/VIOXY",
"path": "/additem/migrations/0002_auto_20180209_1208.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_d_passed(self):
assert True
def test_nested_class_methodC_passed(self):
assert True
def test_simple_check2_passed(self):
pass
def test_complex_check2_passed(self):
pass
@pytest.fixture
def parametrized_username():
re... | code_fim | hard | {
"lang": "python",
"repo": "kondratyev-nv/vscode-python-test-adapter",
"path": "/test/test_samples/pytest/test/inner_fixture_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_parametrized_username_passed(non_parametrized_username):
assert non_parametrized_username in ['one', 'two', 'three']<|fim_prefix|># repo: kondratyev-nv/vscode-python-test-adapter path: /test/test_samples/pytest/test/inner_fixture_test.py
import pytest
import unittest
class Test_CheckMyApp... | code_fim | hard | {
"lang": "python",
"repo": "kondratyev-nv/vscode-python-test-adapter",
"path": "/test/test_samples/pytest/test/inner_fixture_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kondratyev-nv/vscode-python-test-adapter path: /test/test_samples/pytest/test/inner_fixture_test.py
import pytest
import unittest
class Test_CheckMyApp:
@unittest.skip("demonstrating skipping")
def test_simple_check_skipped(self):
pass
def test_complex_check_passed(self):
... | code_fim | hard | {
"lang": "python",
"repo": "kondratyev-nv/vscode-python-test-adapter",
"path": "/test/test_samples/pytest/test/inner_fixture_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
stime = datetime.strptime(jobs[j]['events']['S'],"%m/%d/%Y %H:%M:%S")
etime = datetime.strptime(jobs[j]['events']['E'],"%m/%d/%Y %H:%M:%S")
jobs[j]['run_time']=strfdelta(etime-stime,"{days}:{hours}:{minutes}:{seconds}")
except KeyError:
... | code_fim | hard | {
"lang": "python",
"repo": "ajdecon/torque_qhistory",
"path": "/torque_accounting/parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajdecon/torque_qhistory path: /torque_accounting/parser.py
# torque_accounting.py
# Functions for working with Torque accounting files
from datetime import datetime
import sys
# strfdelta: formatted print for timedelta object
# with thanks to http://stackoverflow.com/questions/8906926/formatti... | code_fim | hard | {
"lang": "python",
"repo": "ajdecon/torque_qhistory",
"path": "/torque_accounting/parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HudiSanji/cocoaPodsTemplate path: /config.py
#!/usr/bin/env python3
import os,shutil,stat
projectName="123"
httpsRepo=""
sshRepo=""
homePage=""
confirmed="n"
top_projectPath=os.path.abspath(os.path.dirname(os.getcwd()) + os.path.sep + ".")
projectPath=""
Author=""
Email=""
Example="n"
Language=... | code_fim | hard | {
"lang": "python",
"repo": "HudiSanji/cocoaPodsTemplate",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(filePath, "r", encoding="utf-8") as f:
# readlines以列表的形式将文件读出
lines = f.readlines()
with open(filePath, "w", encoding="utf-8") as f_w:
for line in lines:
for (key,value) in map.items():
if key in line:
line = line.re... | code_fim | hard | {
"lang": "python",
"repo": "HudiSanji/cocoaPodsTemplate",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#替换占位字符
def fileSed(filePath,map):
with open(filePath, "r", encoding="utf-8") as f:
# readlines以列表的形式将文件读出
lines = f.readlines()
with open(filePath, "w", encoding="utf-8") as f_w:
for line in lines:
for (key,value) in map.items():
if key in line:... | code_fim | hard | {
"lang": "python",
"repo": "HudiSanji/cocoaPodsTemplate",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wisamreid/DetectStereocillia path: /tests/model_eval_prototype.py
from src.model import mask_rcnn
from src.dataloader import MaskData
import src.transforms as t
import src.utils
import torch.optim
from torch.utils.data import DataLoader
import torchvision
import matplotlib.pyplot as plt
transfor... | code_fim | hard | {
"lang": "python",
"repo": "wisamreid/DetectStereocillia",
"path": "/tests/model_eval_prototype.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if epoch % 25 == 0:
print(f'Epoch:{epoch} | loss: {torch.tensor(epoch_loss).sum().item()}')
plt.plot(all_loss)
plt.show()
mask_rcnn.eval()
out = mask_rcnn(image.unsqueeze(0).cuda())
out = out[0]
src.utils.render_mask(image.unsqueeze(0), out, 0.5)
src.utils.render_mask(image.unsqueeze(0), da... | code_fim | hard | {
"lang": "python",
"repo": "wisamreid/DetectStereocillia",
"path": "/tests/model_eval_prototype.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> os_template = ['os_family', 'os_name', 'os_url', 'os_company', 'os_company_url', 'os_icon']
browser_template = ['typ', 'ua_family', 'ua_url', 'ua_company', 'ua_company_url', 'ua_icon', 'ua_info_url']
robot_template = ['ua_family', 'ua_name', 'ua_url', 'ua_company', 'ua_company_url'... | code_fim | hard | {
"lang": "python",
"repo": "hamaxx/uasparser2",
"path": "/uasparser2/ini_data_loader.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hamaxx/uasparser2 path: /uasparser2/ini_data_loader.py
import re
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
from .constants import EMPTY_RESULT, INFO_URL
class IniDataLoader(object):
def _to_python_reg(self, reg):
reg_... | code_fim | hard | {
"lang": "python",
"repo": "hamaxx/uasparser2",
"path": "/uasparser2/ini_data_loader.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>@robot.filter("session")
def printSeesino(message, session):
return "session: " + str(session)
@robot.filter(re.compile('找书:'))
def replayHuitie(message, session):
return findBook(message, session)
def findBook(message, session):
if session['kindle_count'] != 4:
return "请绑定Kindle账号,... | code_fim | hard | {
"lang": "python",
"repo": "SwyftG/KindlePush",
"path": "/views/wx/wx_urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SwyftG/KindlePush path: /views/wx/wx_urls.py
# encoding: utf-8
from emailUtil import emailSender
__author__ = 'lianggao'
__date__ = '2018/6/1 上午11:08'
import datetime
from werobot import WeRoBot
from werobot.contrib.tornado import make_handler
import re
robot = WeRoBot(token="你的token")
urls =... | code_fim | hard | {
"lang": "python",
"repo": "SwyftG/KindlePush",
"path": "/views/wx/wx_urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> session['kindle_count'] = 1
session['kindle_email'] = ""
session['kindle_auth_email'] = ""
session['kindle_auth_pwd'] = ""
return "解绑成功!\n请重新输入Kindle邮箱:"
@robot.filter("session")
def printSeesino(message, session):
return "session: " + str(session)
@robot.filter(re.compile('找书:'... | code_fim | hard | {
"lang": "python",
"repo": "SwyftG/KindlePush",
"path": "/views/wx/wx_urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nickderobertis/py-ex-latex path: /pyexlatex/models/control/and_.py
from pyexlatex.models.item import NoOptionsNoContentsItem
<|fim_suffix|> """
Used internally for writing multiple institutions.
"""
name = 'and'
def __init__(self):
super().__init__(self.name)<|fim_mi... | code_fim | easy | {
"lang": "python",
"repo": "nickderobertis/py-ex-latex",
"path": "/pyexlatex/models/control/and_.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(self.name)<|fim_prefix|># repo: nickderobertis/py-ex-latex path: /pyexlatex/models/control/and_.py
from pyexlatex.models.item import NoOptionsNoContentsItem
class And(NoOptionsNoContentsItem):
"""
Used internally for writing multiple institutions.
"""
name = 'an... | code_fim | easy | {
"lang": "python",
"repo": "nickderobertis/py-ex-latex",
"path": "/pyexlatex/models/control/and_.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if "args" in data:
Validator().dict(data["args"])
self.__get_modules(data)
def __get_modules(self, data: dict):
"""
Get the modules from the input dict
:param data: input dict
:type data: dict
"""
v = Validator([(data["mod... | code_fim | hard | {
"lang": "python",
"repo": "stfbk/tlsassistant",
"path": "/modules/parse_input_conf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param data: input dict
:type data: dict
"""
v = Validator([(data["modules"], list)])
for module in data["modules"]:
mod_data = load_configuration(module)
mod_path = Path(mod_data["path"])
self.__cache[mod_path.stem] = (
... | code_fim | hard | {
"lang": "python",
"repo": "stfbk/tlsassistant",
"path": "/modules/parse_input_conf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stfbk/tlsassistant path: /modules/parse_input_conf.py
import json
from pathlib import Path
from utils.validation import Validator
from utils.loader import load_class, load_configuration
from os.path import sep
from utils.configuration import merge
class Parser:
"""
Parse input conf file... | code_fim | hard | {
"lang": "python",
"repo": "stfbk/tlsassistant",
"path": "/modules/parse_input_conf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> graph_update.finish()
with graph.session() as s:
assert list(s.run("MATCH (n:GraphUpdate) RETURN n.uuid as uuid"))[0][0] == graph_update.uuid
assert list(s.run("MATCH (n:NodeSet) RETURN count(n)"))[0][0] == 2
assert list(s.run("MATCH (n:RelationshipSet)... | code_fim | hard | {
"lang": "python",
"repo": "kaiserpreusse/graphio",
"path": "/test/test_objects/test_update.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class TestGraphUpdateCycle:
def test_graph_update(self, graph, clear_graph, small_relationshipset, matching_nodesets):
ns1, ns2 = matching_nodesets
graph_update = GraphUpdate()
graph_update.start(graph)
ns1.merge(graph)
graph_update.add_nodeset(ns1.to_definit... | code_fim | hard | {
"lang": "python",
"repo": "kaiserpreusse/graphio",
"path": "/test/test_objects/test_update.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaiserpreusse/graphio path: /test/test_objects/test_update.py
from uuid import UUID
import pytest
from graphio.objects.update import GraphUpdate, RelationshipSet, NodeSet
@pytest.fixture
def small_relationshipset():
rs = RelationshipSet('TEST', ['Test'], ['Foo'], ['uuid'], ['uuid'])
... | code_fim | hard | {
"lang": "python",
"repo": "kaiserpreusse/graphio",
"path": "/test/test_objects/test_update.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> unittest.TextTestRunner(verbosity=2).run(tests.getTestSuites())
if __name__ == "__main__":
main()<|fim_prefix|># repo: samitheberber/Tuqqna path: /unittests.py
#!/usr/bin/env python
"""\
Unittests-file contains all information to launch unit test framework.
To run tests, just run this file and... | code_fim | easy | {
"lang": "python",
"repo": "samitheberber/Tuqqna",
"path": "/unittests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samitheberber/Tuqqna path: /unittests.py
#!/usr/bin/env python
"""\
Unittests-file contains all information to launch unit test framework.
To run tests, just run this file and you will see the result of tests.
"""
import unittest
<|fim_suffix|> unittest.TextTestRunner(verbosity=2).run(tes... | code_fim | easy | {
"lang": "python",
"repo": "samitheberber/Tuqqna",
"path": "/unittests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
def __init__(self, identity: str,
*, members: List[str] = None,
namespace: str = None,
attachments: List[str] = None,
name: str = None, description: str = None,
derived_from: List[str] = None,
... | code_fim | hard | {
"lang": "python",
"repo": "ClassWizard/PodLockParser",
"path": "/venv/lib/python3.9/site-packages/sbol3/collection.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """The purpose of the Experiment class is to aggregate
ExperimentalData objects for subsequent analysis, usually in
accordance with an experimental design. Namely, the member
properties of an Experiment MUST refer to ExperimentalData
objects.
"""
def __init__(self, identity: ... | code_fim | hard | {
"lang": "python",
"repo": "ClassWizard/PodLockParser",
"path": "/venv/lib/python3.9/site-packages/sbol3/collection.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ClassWizard/PodLockParser path: /venv/lib/python3.9/site-packages/sbol3/collection.py
import math
from typing import List, Any
from . import *
class Collection(TopLevel):
"""The Collection class is a class that groups together a set of
TopLevel objects that have something in common.
... | code_fim | hard | {
"lang": "python",
"repo": "ClassWizard/PodLockParser",
"path": "/venv/lib/python3.9/site-packages/sbol3/collection.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' parameters '''
filepath = sys.argv[1]
topN = 10
n_workers = None
sc = SparkContext(conf=SparkConf())
''' read file and parse graph '''
lines = sc.textFile(filepath, n_workers)
graph = lines.map(parse).filter(lambda (k, v): v)
''' calculate number of mutual friends... | code_fim | hard | {
"lang": "python",
"repo": "vamorel/BigDataEssentials",
"path": "/1_MutualFriends/commonfriends.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' print top-N potential friends '''
for (pf1, pf2), v in potentialfriend.takeOrdered(topN, key=lambda (k, v): -v):
print '{}\t{}\t{}'.format(pf1, pf2, v)
if __name__ == '__main__':
assert os.path.exists(sys.argv[1]), 'Cannot find file.'
starttime = time.time()
main()
... | code_fim | hard | {
"lang": "python",
"repo": "vamorel/BigDataEssentials",
"path": "/1_MutualFriends/commonfriends.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vamorel/BigDataEssentials path: /1_MutualFriends/commonfriends.py
'''
Hyounguk Shon
21-Sep-2019
Usage: spark-submit commonfriends.py [file.txt]
Social network data mining for friend recommendation.
Find pairs of potential friends based on number of mutual friends.
Example text file: http://www... | code_fim | hard | {
"lang": "python",
"repo": "vamorel/BigDataEssentials",
"path": "/1_MutualFriends/commonfriends.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Peritract/twitter-watcher path: /scripts/stream.py
"""This file contains the definition of the Watcher class; this class listens for new tweets and records them.
"""
from tweepy import Stream
from pymongo import MongoClient
import json
<|fim_suffix|> status = status._json
# Onl... | code_fim | hard | {
"lang": "python",
"repo": "Peritract/twitter-watcher",
"path": "/scripts/stream.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def on_status(self, status):
"""Receives a status from the stream."""
status = status._json
# Only worry about original tweets
if not status["is_quote_status"] and "retweeted_status" not in status \
and not status["in_reply_to_status_id"]:
# T... | code_fim | hard | {
"lang": "python",
"repo": "Peritract/twitter-watcher",
"path": "/scripts/stream.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> status = status._json
# Only worry about original tweets
if not status["is_quote_status"] and "retweeted_status" not in status \
and not status["in_reply_to_status_id"]:
# Take only a subset of fields
doc = {
"text": status["ful... | code_fim | hard | {
"lang": "python",
"repo": "Peritract/twitter-watcher",
"path": "/scripts/stream.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Match(models.Model):
"""
model to store matche details played between teams
"""
team1 = models.ForeignKey(Team, related_name=_("team1_metch"), on_delete=models.CASCADE)
team2 = models.ForeignKey(Team, related_name=_("team2_match"), on_delete=models.CASCADE)
date = models.Date... | code_fim | medium | {
"lang": "python",
"repo": "rmishra7/cms",
"path": "/matches/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> verbose_name = "Match"
verbose_name_plural = "Matchs"
app_label = "matches"
ordering = ("-date", )
def __unicode__(self):
return "%s" % (self.team1.name + " vs " + self.team2.name)<|fim_prefix|># repo: rmishra7/cms path: /matches/models.py
from django.db impor... | code_fim | hard | {
"lang": "python",
"repo": "rmishra7/cms",
"path": "/matches/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rmishra7/cms path: /matches/models.py
from django.db import models
from django.db.models.query import QuerySet
from django.utils.translation import ugettext_lazy as _
<|fim_suffix|> pass
class MatchManager(models.Manager, MatchMixin):
def get_queryset(self):
return MatchQuerySe... | code_fim | medium | {
"lang": "python",
"repo": "rmishra7/cms",
"path": "/matches/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def postorderTraversal(self, root: TreeNode):
ans = []
stack = []
stack.append(root)
while stack:
tmp = stack.pop()
if tmp:
ans.append(tmp.val)
stack.append(tmp.left)
stack.append(tmp.right)
... | code_fim | medium | {
"lang": "python",
"repo": "610yilingliu/leetcode",
"path": "/Python3/145.binary-tree-postorder-traversal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 610yilingliu/leetcode path: /Python3/145.binary-tree-postorder-traversal.py
#
# @lc app=leetcode id=145 lang=python3
#
# [145] Binary Tree Postorder Traversal
#
<|fim_suffix|> ans = []
stack = []
stack.append(root)
while stack:
tmp = stack.pop()
... | code_fim | hard | {
"lang": "python",
"repo": "610yilingliu/leetcode",
"path": "/Python3/145.binary-tree-postorder-traversal.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ans = []
stack = []
stack.append(root)
while stack:
tmp = stack.pop()
if tmp:
ans.append(tmp.val)
stack.append(tmp.left)
stack.append(tmp.right)
ans = ans[::-1]
return ans
# whil... | code_fim | hard | {
"lang": "python",
"repo": "610yilingliu/leetcode",
"path": "/Python3/145.binary-tree-postorder-traversal.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>parser = OptionParser()
parser.add_option("-p", "--path", dest="path", action="store", type="string",
help="Path of the fastq files", metavar="PATH")
parser.add_option("-v", dest="verbose", action="store_true",
help="tell me all")
(options, args) = parser.parse_args()
p... | code_fim | medium | {
"lang": "python",
"repo": "kykrueger/openbis",
"path": "/deep_sequencing_unit/source/Python/solexaQa.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kykrueger/openbis path: /deep_sequencing_unit/source/Python/solexaQa.py
#!/usr/bin/env python
'''
Python Wrapper for a perl based program.
Generates tile based quality graphics
Output: pdf
@author: Manuel Kohler
@copyright: ETH Zurich
@precondition: Working pdftk and SolexaQA.pl binaries
'''
... | code_fim | hard | {
"lang": "python",
"repo": "kykrueger/openbis",
"path": "/deep_sequencing_unit/source/Python/solexaQa.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vrypan/bucket3 path: /extras/mk_redirect_list.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
From v0.9.8 to 0.9.9, URLs changed from single digit month and day,
to double digit.
0.9.8 would create URLs like /2013/1/9/slug/
0.9.9 will create /2013/01/09/slug/
This script will print out a mapp... | code_fim | hard | {
"lang": "python",
"repo": "vrypan/bucket3",
"path": "/extras/mk_redirect_list.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
from bucket3 import b3tools
from bucket3 import Bucket3v2 as Bucket3
if __name__ == '__main__':
conf = b3tools.conf_get('.')
b = Bucket3(conf = conf)
for p in b.db_post_get_all(count=0): #count=0 means ALL posts
url = p['meta']['url']
date = p['meta']['date']
slug = p['meta']['slug']
... | code_fim | hard | {
"lang": "python",
"repo": "vrypan/bucket3",
"path": "/extras/mk_redirect_list.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: butla/microservice-playground path: /responder_app/app.py
import logging
import responder
api = responder.API()
<|fim_suffix|> async def on_get(self, req, resp):
resp.text = 'Hello, world'
if __name__ == '__main__':
api.add_route('/{who}', SampleResource)
api.add_route('/... | code_fim | medium | {
"lang": "python",
"repo": "butla/microservice-playground",
"path": "/responder_app/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
api.add_route('/{who}', SampleResource)
api.add_route('/', BenchmarkResource)
api.run(port=9090, log_level=logging.WARNING)
# with logging
# api.run(port=9090)<|fim_prefix|># repo: butla/microservice-playground path: /responder_app/app.py
import logging
im... | code_fim | medium | {
"lang": "python",
"repo": "butla/microservice-playground",
"path": "/responder_app/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DamonMok/PythonLearning path: /web服务器_并发web服务器实现_6.单进程下单线程版非堵塞kqueue(epoll)版服务器.py
import socket
import re
import select
def service_client(new_client_socket, recv_data):
print(recv_data)
# 1.获取请求路径
# GET /index.html HTTP/1.1
# 提取 /index.html
request_lines = recv_data.spli... | code_fim | hard | {
"lang": "python",
"repo": "DamonMok/PythonLearning",
"path": "/web服务器_并发web服务器实现_6.单进程下单线程版非堵塞kqueue(epoll)版服务器.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # 把tcp_server_socket的accept()加入监听事件
events.append(select.kevent(new_client_socket.fileno(), select.KQ_FILTER_READ))
elif event.filter == select.KQ_FILTER_READ:
# 如果是有客户发送请求消息
# 在字典中根据key接收浏览器的请求数据
recv_data = even... | code_fim | hard | {
"lang": "python",
"repo": "DamonMok/PythonLearning",
"path": "/web服务器_并发web服务器实现_6.单进程下单线程版非堵塞kqueue(epoll)版服务器.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>tring representing the word in S that matches the pattern P.
Example Input/Output 1:
Input:
?i?n
LION crane lion breath kiln
Output:
lion
Explanation:
Here P = "?i?n" and S = "LION crane lion breath kiln".
There are two words in S that match the pattern P.
lion klin
So the first occurring word lion is pri... | code_fim | hard | {
"lang": "python",
"repo": "muhammad-masood-ur-rehman/Skillrack",
"path": "/Python Programs/matching-word-replace.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>.
Example Input/Output 2:
Input:
BR??E?
BRIGHT BEST BRAVE BROKEN
Output:
BROKEN
s=input().strip()
k=s;p=[];m=0
l=input().strip().split()
for i in l:
m=0
if len(i)==len(s):
for j in range(len(i)):
if s[j]!='?' and s[j]!=i[j]:
m=1
if m==0:
p.ap... | code_fim | hard | {
"lang": "python",
"repo": "muhammad-masood-ur-rehman/Skillrack",
"path": "/Python Programs/matching-word-replace.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: muhammad-masood-ur-rehman/Skillrack path: /Python Programs/matching-word-replace.py
Matching Word - Replace ?
The program must accept two string values P and S as input. The string P represents a pattern. The string S represents a set of words. The character '?' in P matches any single character... | code_fim | hard | {
"lang": "python",
"repo": "muhammad-masood-ur-rehman/Skillrack",
"path": "/Python Programs/matching-word-replace.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if order[0] == '-':
q = q.order_by(getattr(Record, order[1:].desc()))
else:
q = q.order_by(getattr(Record, order))
return q.offset(offset).limit(50).all()
def toggle_flag(self, rec_id, flag_name):
rec = self.get(rec_id)
flag = rec.flags... | code_fim | hard | {
"lang": "python",
"repo": "ntpz/rbm2m",
"path": "/rbm2m/action/record_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ntpz/rbm2m path: /rbm2m/action/record_manager.py
# -*- coding: utf-8 -*-
from sqlalchemy import or_
from base_manager import BaseManager
from ..models import Record, RecordFlag
class RecordManager(BaseManager):
"""
Handles all DB interactions regarding records
"""
__model_... | code_fim | hard | {
"lang": "python",
"repo": "ntpz/rbm2m",
"path": "/rbm2m/action/record_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_flag(self, rec_id, flag_name):
rec = self.get(rec_id)
flag = rec.flags.filter(RecordFlag.name == flag_name).first()
if not flag:
rec.flags.append(RecordFlag(name=flag_name))<|fim_prefix|># repo: ntpz/rbm2m path: /rbm2m/action/record_manager.py
# -*- coding:... | code_fim | hard | {
"lang": "python",
"repo": "ntpz/rbm2m",
"path": "/rbm2m/action/record_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BuiThanhNam1998/Gtech path: /resources/views/frontend/layout/face_recognation.py
import cv2
img = cv2.imread("C:/Users/TCC/Downloads/post/img.png")
face_cascade = cv2.Casc<|fim_suffix|>R2GRAY)
faces = face_cascade.detectMultiScale(gray)
for (x,y,w,h) in faces:
cv2.rectangle(img, (x,y) , (x+w, y+h... | code_fim | medium | {
"lang": "python",
"repo": "BuiThanhNam1998/Gtech",
"path": "/resources/views/frontend/layout/face_recognation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>img, (x,y) , (x+w, y+h),(255,255,0), 1)
cv2.imwrite("C:/Users/TCC/Downloads/post/img1.png")<|fim_prefix|># repo: BuiThanhNam1998/Gtech path: /resources/views/frontend/layout/face_recognation.py
import cv2
img = cv2.imread("C:/Users/TCC/Downloads/post/img.png")
face_cascade = cv2.CascadeClassifier("haarca... | code_fim | medium | {
"lang": "python",
"repo": "BuiThanhNam1998/Gtech",
"path": "/resources/views/frontend/layout/face_recognation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>R2GRAY)
faces = face_cascade.detectMultiScale(gray)
for (x,y,w,h) in faces:
cv2.rectangle(img, (x,y) , (x+w, y+h),(255,255,0), 1)
cv2.imwrite("C:/Users/TCC/Downloads/post/img1.png")<|fim_prefix|># repo: BuiThanhNam1998/Gtech path: /resources/views/frontend/layout/face_recognation.py
import cv2
img = cv2.... | code_fim | medium | {
"lang": "python",
"repo": "BuiThanhNam1998/Gtech",
"path": "/resources/views/frontend/layout/face_recognation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: epelaaez/qiskit-optimization path: /qiskit_optimization/applications/vertex_cover.py
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root direct... | code_fim | hard | {
"lang": "python",
"repo": "epelaaez/qiskit-optimization",
"path": "/qiskit_optimization/applications/vertex_cover.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Convert a vertex cover instance into a
:class:`~qiskit_optimization.problems.QuadraticProgram`
Returns:
The :class:`~qiskit_optimization.problems.QuadraticProgram` created
from the vertex cover instance.
"""
mdl = Model(name="Vertex cover... | code_fim | hard | {
"lang": "python",
"repo": "epelaaez/qiskit-optimization",
"path": "/qiskit_optimization/applications/vertex_cover.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_update(client, auth, app):
auth.login()
assert client.get("/1/update").status_code == 200
# Update title of post
client.post(("/1/update"), data={"title": "updated", "body": ""})
# Check that title in DB is successfully changed.
with app.app_context():
db = get_db... | code_fim | hard | {
"lang": "python",
"repo": "tbrlpld/flaskr",
"path": "/tests/test_blog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tbrlpld/flaskr path: /tests/test_blog.py
import pytest
from flaskr.db import get_db
from flaskr.blog import create_post
def test_index(client, auth):
# When not logged in, the index should show links to register or log in
response = client.get("/")
assert b"Log In" in response.data... | code_fim | hard | {
"lang": "python",
"repo": "tbrlpld/flaskr",
"path": "/tests/test_blog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize("path", (
"/create",
"/1/update",
))
def test_create_update_validate(client, auth, path):
auth.login()
response = client.post(path, data={"title": "", "body": ""})
assert b"Title is required." in response.data
# The delete view should redirect to the index UR... | code_fim | hard | {
"lang": "python",
"repo": "tbrlpld/flaskr",
"path": "/tests/test_blog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: smiths/caseStudies path: /CaseStudies/glass/src/Python/Implementation/readTable.py
##This module implements a portion of the Input Format Module. In this
##case the input is the tabular data necessary for the different interpolations
import numpy as np
def read_z_array(filename):
with open... | code_fim | hard | {
"lang": "python",
"repo": "smiths/caseStudies",
"path": "/CaseStudies/glass/src/Python/Implementation/readTable.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> #length needs to be used somehow
with open(filename, "r") as f:
lines = f.readlines()
lines = lines[1:]
x_array = [line.split(",")[0::2] for line in lines]
for i in range(len(x_array)):
x_array[i] = [float(j) for j in x_array[i]]
return x_array
def read_y_array... | code_fim | hard | {
"lang": "python",
"repo": "smiths/caseStudies",
"path": "/CaseStudies/glass/src/Python/Implementation/readTable.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jack139/takit path: /src/stations.py
s|1568@ssh|松树|SFT|songshu|ss|1569@ssh|首山|SAT|shoushan|ss|1570@ssj|三十家|SRD|sanshijia|ssj|1571@ssp|三十里堡|SST|sanshilipu|sslb|1572@ssz|松树镇|SSL|songshuzhen|ssz|1573@sta|松桃|MZQ|songtao|st|1574@sth|索图罕|SHX|suotuhan|sth|1575@stj|三堂集|SDH|santangji|stj|1576@sto|石头|OTB|s... | code_fim | hard | {
"lang": "python",
"repo": "jack139/takit",
"path": "/src/stations.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>0@xhy|小河沿|XYD|xiaoheyan|xhy|1801@xhy|下花园|XYP|xiahuayuan|xhy|1802@xhz|小河镇|EKY|xiaohezhen|xhz|1803@xji|徐家|XJB|xujia|xj|1804@xji|峡江|EJG|xiajiang|xj|1805@xji|新绛|XJV|xinjiang|xj|1806@xji|辛集|ENP|xinji|xj|1807@xji|新江|XJM|xinjiang|xj|1808@xjk|西街口|EKM|xijiekou|xjk|1809@xjt|许家屯|XJT|xujiatun|xjt|1810@xjt|许家台|XTJ|xuj... | code_fim | hard | {
"lang": "python",
"repo": "jack139/takit",
"path": "/src/stations.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jack139/takit path: /src/stations.py
huijiahu|sjh|1513@sjh|沈家河|OJJ|shenjiahe|sjh|1514@sjh|松江河|SJL|songjianghe|sjh|1515@sji|尚家|SJB|shangjia|sj|1516@sji|孙家|SUB|sunjia|sj|1517@sji|沈家|OJB|shenjia|sj|1518@sji|松江|SAH|songjiang|sj|1519@sjk|三江口|SKD|sanjiangkou|sjk|1520@sjl|司家岭|OLK|sijialing|sjl|1521@sjn|... | code_fim | hard | {
"lang": "python",
"repo": "jack139/takit",
"path": "/src/stations.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> N = X.shape[0]
X_true = X
X_r = rec_img / 255
# calculate the error
dist = np.sum((X_true - X_r)**2)
error = dist / N
print ("Error for ", k," is:", error)
# return the image to it's original dimensions
rec_img = rec_img.reshape((hei... | code_fim | hard | {
"lang": "python",
"repo": "A-Katopodis/EM-Algorithm-Image-Fragmentation",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: A-Katopodis/EM-Algorithm-Image-Fragmentation path: /main.py
from __future__ import division
import numpy as np
from PIL import Image
# calculate the g(znk)
def get_Z(N, K, f, maximum):
# substract the maximum from the f
for k in range(K):
f[:,k] = f[:,k] - maximum
z = np.zer... | code_fim | hard | {
"lang": "python",
"repo": "A-Katopodis/EM-Algorithm-Image-Fragmentation",
"path": "/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return z, m
def run_experiments():
k=2
while k <= 64 :
# calculate optimal z,m
z, m = EM(X, k)
# we change transform the m to the original
# RGB value
m = m * 255
m = m.astype(np.uint8)
# Our new image
rec_img = np.zeros(X.sha... | code_fim | hard | {
"lang": "python",
"repo": "A-Katopodis/EM-Algorithm-Image-Fragmentation",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def process_im_multipe_crops_ordered_for_network_caffe(im_whole, boxes, w, h, pixel_means):
box = boxes[-1,:]
offset_x1, offset_y1 = 0, 0
im_padded = im_whole
if box[0] < 1 or box[1] < 1 or box[2] > im_whole.width or box[3] > im_whole.height:
offset_x1 = max(1-box[0], 0)
offset_y1 = max(1-box[1... | code_fim | hard | {
"lang": "python",
"repo": "QUVA-Lab/Long-term-Siamese-Tracker",
"path": "/utils/im_processing.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QUVA-Lab/Long-term-Siamese-Tracker path: /utils/im_processing.py
# --------------------------------------------------------
# Copyright (c) 2018 University of Amsterdam
# Written by Ran Tao
# --------------------------------------------------------
from PIL import Image, ImageOps
import numpy as... | code_fim | hard | {
"lang": "python",
"repo": "QUVA-Lab/Long-term-Siamese-Tracker",
"path": "/utils/im_processing.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> im_crop = im_padded.crop((box[0]+offset_x1-1, box[1]+offset_y1-1, box[2]+offset_x1-1, box[3]+offset_y1-1))
else:
im_crop = im_whole.crop((box[0]-1, box[1]-1, box[2]-1, box[3]-1))
im_array = np.array( im_crop.resize((w,h)), dtype=np.float32 )
im_array = im_array.transpose((2, 0, 1))
# tu... | code_fim | hard | {
"lang": "python",
"repo": "QUVA-Lab/Long-term-Siamese-Tracker",
"path": "/utils/im_processing.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> id = input.idProduct.value
reg = self.database(id)
output = Product()
output.id.value = id
output.name.value = reg[0]
output.price.value = reg[1]
output.stock.value = reg[2]
return output
def database(self,id):
""" This method simulates a database of produc... | code_fim | hard | {
"lang": "python",
"repo": "jiaxiaolei/tornado-webservices",
"path": "/demos/ProductService.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return output
def database(self,id):
""" This method simulates a database of products """
db = {1:('COMPUTER',1000.5,100),
2:('MOUSE',10.0,300),
3:('PENCIL BLUE',0.50,500),
4:('PENCIL RED',0.50,600),
5:('PENCIL WHITE',0.50,900),
6:('HEADPHONES',15.7,50... | code_fim | medium | {
"lang": "python",
"repo": "jiaxiaolei/tornado-webservices",
"path": "/demos/ProductService.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiaxiaolei/tornado-webservices path: /demos/ProductService.py
import tornado.httpserver
import tornado.ioloop
from tornadows import soaphandler
from tornadows import webservices
from tornadows import complextypes
from tornadows.soaphandler import webservice
class Input(complextypes.ComplexType):... | code_fim | hard | {
"lang": "python",
"repo": "jiaxiaolei/tornado-webservices",
"path": "/demos/ProductService.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Devil123145/CuBolt path: /cubolt/__init__.py
# The MIT License (MIT)
#
# Copyright (c) 2014 Bjoern Lange
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without restr... | code_fim | hard | {
"lang": "python",
"repo": "Devil123145/CuBolt",
"path": "/cubolt/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.injector = Injector(server)
self.injector.inject_update()
self.injector.inject_factory()
needed = time.time() - begin
print('[CB] Done (%.2fs).' % needed)
def get_class():
"""Gets the ServerScript instance to register.
Re... | code_fim | hard | {
"lang": "python",
"repo": "Devil123145/CuBolt",
"path": "/cubolt/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: QSCTech-Sange/ZJU-nCov-Hitcarder path: /main.py
from daka import DaKa
from mail import Mail
from halo import Halo
from apscheduler.schedulers.blocking import BlockingScheduler
import logging
import getpass
import time, datetime, os, sys
import requests, json, re
def doDaka(username, password,log... | code_fim | hard | {
"lang": "python",
"repo": "QSCTech-Sange/ZJU-nCov-Hitcarder",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create log
fh = logging.FileHandler('./log.txt',encoding='utf-8')
logger = logging.getLogger()
logger.setLevel(logging.INFO)
fm = logging.Formatter("[%(asctime)s] %(message)s",datefmt='%Y-%m-%d %H:%M:%S')
logger.addHandler(fh)
fh.setFormatter(fm)
if os.path.exists('./con... | code_fim | hard | {
"lang": "python",
"repo": "QSCTech-Sange/ZJU-nCov-Hitcarder",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
right = scope[right]
except:
right = float(right)
try:
left = scope[left]
except:
left = float(left)
if lexem == "+":
res = left + right
... | code_fim | hard | {
"lang": "python",
"repo": "zaldis/Compiler",
"path": "/coco_compiler/evaluator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if lexem == "+":
res = left + right
elif lexem == "-":
res = left - right
elif lexem == "*":
res = left * right
else:
res = left / right
stack.append(res)
co... | code_fim | hard | {
"lang": "python",
"repo": "zaldis/Compiler",
"path": "/coco_compiler/evaluator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zaldis/Compiler path: /coco_compiler/evaluator.py
import sys
INPUT_FILEPATH = sys.argv[1]
with open(INPUT_FILEPATH) as f:
input_lines = f.readlines()
scope = {}
for idx, input_line in enumerate(input_lines):
print(f"Line #{idx}")
lexems = [lexem.strip() for lexem in input_lin... | code_fim | hard | {
"lang": "python",
"repo": "zaldis/Compiler",
"path": "/coco_compiler/evaluator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi-azure path: /sdk/python/pulumi_azure/datafactory/managed_private_endpoint.py
Managed Private Endpoint. Changing this forces a new resource to be created.
:param pulumi.Input[str] target_resource_id: The ID of the Private Link Enabled Remote Resource which this Data Factory P... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-azure",
"path": "/sdk/python/pulumi_azure/datafactory/managed_private_endpoint.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
The ID of the Private Link Enabled Remote Resource which this Data Factory Private Endpoint should be connected to. Changing this forces a new resource to be created.
"""
return pulumi.get(self, "target_resource_id")
@target_resource_id.setter
def target_resour... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-azure",
"path": "/sdk/python/pulumi_azure/datafactory/managed_private_endpoint.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @name.setter
def name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "name", value)
@property
@pulumi.getter(name="subresourceName")
def subresource_name(self) -> Optional[pulumi.Input[str]]:
"""
Specifies the sub resource name which the Data Facto... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-azure",
"path": "/sdk/python/pulumi_azure/datafactory/managed_private_endpoint.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mente/p2psafety path: /p2psafety_django/p2psafety/urls.py
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from tast... | code_fim | hard | {
"lang": "python",
"repo": "mente/p2psafety",
"path": "/p2psafety_django/p2psafety/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>api_v1 = Api(api_name='v1')
api_v1.register(EventResource())
api_v1.register(EventUpdateResource())
api_v1.register(UserResource())
api_v1.register(RoleResource())
urlpatterns = patterns('',
url(r'^$', 'p2psafety.views.index', name='index'),
url(r'^', include('events.urls', namespace='events')),... | code_fim | medium | {
"lang": "python",
"repo": "mente/p2psafety",
"path": "/p2psafety_django/p2psafety/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if settings.DEBUG:
urlpatterns += staticfiles_urlpatterns()
urlpatterns += static(
settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT
)<|fim_prefix|># repo: mente/p2psafety path: /p2psafety_django/p2psafety/urls.py
from django.conf import settings
from django.conf.urls imp... | code_fim | hard | {
"lang": "python",
"repo": "mente/p2psafety",
"path": "/p2psafety_django/p2psafety/urls.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.