text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: PaddlePaddle/Paddle path: /test/ir/inference/test_trt_convert_elementwise.py
a": np.float32
if op_type != "elementwise_floordiv"
else np.int32
},
}
... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/Paddle",
"path": "/test/ir/inference/test_trt_convert_elementwise.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> attrs = [
program_config.ops[i].attrs for i in range(len(program_config.ops))
]
# for static_shape
clear_dynamic_shape()
self.trt_param.precision = paddle_infer.PrecisionType.Float32
program_config.set_input_type(np.float32)
yield self.c... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/Paddle",
"path": "/test/ir/inference/test_trt_convert_elementwise.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaddlePaddle/Paddle path: /test/ir/inference/test_trt_convert_elementwise.py
rogram_config
def sample_predictor_configs(
self, program_config
) -> (paddle_infer.Config, List[int], float):
def generate_dynamic_shape(attrs):
self.dynamic_shape.min_input_shape = ... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/Paddle",
"path": "/test/ir/inference/test_trt_convert_elementwise.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Calculates profit for Q1 2020 in each portfolio
internationalQ1 = internationalPortfolio.profit('2020-01-01', '2020-04-01')
nationalQ1 = nationalPortfolio.profit('2020-01-01', '2020-04-01')
# Prints results
print('International Portfolio Profit for Q1 2020 : ', internationalQ1)
print('National Portfoli... | code_fim | medium | {
"lang": "python",
"repo": "nbcl/fintual",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nbcl/fintual path: /main.py
"""MIT License
Copyright (c) 2020 nbcl
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 restriction, including without limitation the rig... | code_fim | hard | {
"lang": "python",
"repo": "nbcl/fintual",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Generates two different markets
NASDAQ = Market(['FB', 'AMZN', 'AAPL', 'NFLX', 'GOOGL'])
IPSA = Market(['ENELAM', 'FALABELLA', 'CENCOSUD', 'CHILE', 'CMPC'])
# Creates new portafolios for National and International Markets
internationalPortfolio = Portfolio(['AMZN', 'AAPL'], NASDAQ)
nationalPortfolio = ... | code_fim | medium | {
"lang": "python",
"repo": "nbcl/fintual",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AmmoniaAvenue/autopsy_usagestats path: /usagestats_conv.py
import xml.etree.ElementTree as ET
import glob, os, sqlite3, os, sys, re, json
import protobuf.usagestatsservice_pb2 as usagestatsservice_pb2
from enum import IntEnum
class EventType(IntEnum):
NONE = 0
MOVE_TO_FOREGROUND... | code_fim | hard | {
"lang": "python",
"repo": "AmmoniaAvenue/autopsy_usagestats",
"path": "/usagestats_conv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> add_entries_to_db(stats, db)
def calc_last_time_active(xml_element, filename):
"""
Calculate the absolute time (in EPOCH) when an event was active for the last time.
:param xml_element: The element containing an lastTimeActive attribute
:param filename: A filename where the na... | code_fim | hard | {
"lang": "python",
"repo": "AmmoniaAvenue/autopsy_usagestats",
"path": "/usagestats_conv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_describe():
an = Animal()
an.age = 14
print("anmial age", an.age)
dog = Dog()
Animal.age = 16
print("dog age",dog.age)<|fim_prefix|># repo: chopin1993/protocolmaster-20210731 path: /test/test_describe.py
class Animal(object):
def __init__(self):
self._age = ... | code_fim | medium | {
"lang": "python",
"repo": "chopin1993/protocolmaster-20210731",
"path": "/test/test_describe.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chopin1993/protocolmaster-20210731 path: /test/test_describe.py
class Animal(object):
def __init__(self):
self._age = 1
@property
def age(self):
return self._age
<|fim_suffix|>class Dog(Animal):
def __init__(self):
self._age = 2
@property
def ag... | code_fim | medium | {
"lang": "python",
"repo": "chopin1993/protocolmaster-20210731",
"path": "/test/test_describe.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.age = age
print("dog set age")
def test_describe():
an = Animal()
an.age = 14
print("anmial age", an.age)
dog = Dog()
Animal.age = 16
print("dog age",dog.age)<|fim_prefix|># repo: chopin1993/protocolmaster-20210731 path: /test/test_describe.py
class Animal(... | code_fim | medium | {
"lang": "python",
"repo": "chopin1993/protocolmaster-20210731",
"path": "/test/test_describe.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: onai/social-media-topic-modeling path: /corpus.py
'''
Topics on GAB data
'''
import json
import spacy
spacy.load('en')
import sys
from spacy.lang.en import English
from gensim.corpora.textcorpus import TextCorpus
import nltk
from gensim import utils
import gensim.models.ldamodel
from gensim impo... | code_fim | medium | {
"lang": "python",
"repo": "onai/social-media-topic-modeling",
"path": "/corpus.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, filename, dictionary):
super().__init__()
self.filename = filename
self.dictionary = corpora.Dictionary.load(dictionary)
def __iter__(self):
for tokens in token_stream(self.filename):
yield self.dictionary.doc2bow(tokens)
def __l... | code_fim | medium | {
"lang": "python",
"repo": "onai/social-media-topic-modeling",
"path": "/corpus.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if "stashActivity" in responseData and "items" in responseData["stashActivity"]:
exactMatches = 0
for data in responseData["stashActivity"]["items"]:
if HogDatabase.insertClanStashRecordIfNew(data["dateString"], data["timeString"], data["userName"... | code_fim | medium | {
"lang": "python",
"repo": "MicN/HogBotGit",
"path": "/src/kol/hogs/ClanStashLog.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MicN/HogBotGit path: /src/kol/hogs/ClanStashLog.py
from kol.database import HogDatabase
from kol.util import Report
def logClanStash(responseData, clanName, session):
<|fim_suffix|> if exactMatches > 10:
break
return True<|fim_middle|> if "stashActiv... | code_fim | hard | {
"lang": "python",
"repo": "MicN/HogBotGit",
"path": "/src/kol/hogs/ClanStashLog.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Quantization-aware training
train(qat_model, context, train_one_epoch, validate, qat=True)
print("Start converting the model to TFLite")
with torch.no_grad():
qat_model.eval()
qat_model.cpu()
# The step below converts the model to an actual quantized model, whic... | code_fim | hard | {
"lang": "python",
"repo": "WenzheLiu-Speech/TinyNeuralNetwork",
"path": "/examples/quick_start_for_expert.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WenzheLiu-Speech/TinyNeuralNetwork path: /examples/quick_start_for_expert.py
import os
import copy
import argparse
import sys
sys.path.append('../')
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim.lr_scheduler import CyclicLR, CosineAnnealingLR
from tinynn.conve... | code_fim | hard | {
"lang": "python",
"repo": "WenzheLiu-Speech/TinyNeuralNetwork",
"path": "/examples/quick_start_for_expert.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.input_dir_slash = './data/input/test/'
def test_file_pairs(self):
ignored_filename_patterns = ['\A\.$', '\A\.\.$', '\A\.DS_Store$']
ignored_regex_objects = expression_helper.regex_objects_from_patterns(ignored_filename_patterns)
actual = file_pairer.file_pairs(s... | code_fim | medium | {
"lang": "python",
"repo": "beepscore/diffie",
"path": "/tests/test_file_pairer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setUp(self):
self.input_dir_slash = './data/input/test/'
def test_file_pairs(self):
ignored_filename_patterns = ['\A\.$', '\A\.\.$', '\A\.DS_Store$']
ignored_regex_objects = expression_helper.regex_objects_from_patterns(ignored_filename_patterns)
actual = fil... | code_fim | medium | {
"lang": "python",
"repo": "beepscore/diffie",
"path": "/tests/test_file_pairer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beepscore/diffie path: /tests/test_file_pairer.py
#!/usr/bin/env python3
import unittest
from diffie import file_pairer
from diffie import expression_helper
<|fim_suffix|> ignored_filename_patterns = ['\A\.$', '\A\.\.$', '\A\.DS_Store$']
ignored_regex_objects = expression_helper... | code_fim | medium | {
"lang": "python",
"repo": "beepscore/diffie",
"path": "/tests/test_file_pairer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> etree = html.fromstring(source).xpath("//div[@class='leftContent']")[0]
path = "/div[@class='posts-container expandable post-container_ forum-topic']/div"
items = etree.xpath(self.xpath(etree) + path)
comments = []
for comm in items:
comm = comm.xpath(... | code_fim | medium | {
"lang": "python",
"repo": "GroupLe/grouple-face-tagger",
"path": "/backend/parse_manga/web_components/main_page/comments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path = "/div[@class='posts-container expandable post-container_ forum-topic']/div"
items = etree.xpath(self.xpath(etree) + path)
comments = []
for comm in items:
comm = comm.xpath(self.xpath(comm) + "/div[@class='media-body']")[0]
comments.append(co... | code_fim | medium | {
"lang": "python",
"repo": "GroupLe/grouple-face-tagger",
"path": "/backend/parse_manga/web_components/main_page/comments.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GroupLe/grouple-face-tagger path: /backend/parse_manga/web_components/main_page/comments.py
from typing import List
from lxml import html
from grouple.backend.parse_manga.parqser.web_component import BaseComponent
class Comments(BaseComponent):
<|fim_suffix|> etree = html.fromstring(sour... | code_fim | medium | {
"lang": "python",
"repo": "GroupLe/grouple-face-tagger",
"path": "/backend/parse_manga/web_components/main_page/comments.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.agent.reset()
all_episode_actions = []
all_episode_observations = []
all_episode_steps = []
all_episode_rewards = []
for _ in range(collect_episodes):
episode_actions = []
episode_observations = []
episode_step = 0
... | code_fim | hard | {
"lang": "python",
"repo": "janwithb/thesis",
"path": "/utils/sampler.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janwithb/thesis path: /utils/sampler.py
from utils.misc import center_crop_image
class Sampler:
"""
Class for sampling episodes that returns the episode data (actions, observations, rewards).
"""
def __init__(self, env, replay_buffer, agent):
super().__init__()
<|fim_su... | code_fim | hard | {
"lang": "python",
"repo": "janwithb/thesis",
"path": "/utils/sampler.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jundengdeng/deepschmatzing path: /experiment_server.py
# low tec job scheduler, over http
import collections
from flask import Flask
app = Flask(__name__)
jobs = {
}
predictions = {}
epoch_info = {}
weight_info = {}
@app.route('/getjob')
def hello_world():
<|fim_suffix|>@app.route('update_... | code_fim | easy | {
"lang": "python",
"repo": "jundengdeng/deepschmatzing",
"path": "/experiment_server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> epoch_info[myid] =
if __name__ == '__main__':
app.run()<|fim_prefix|># repo: jundengdeng/deepschmatzing path: /experiment_server.py
# low tec job scheduler, over http
import collections
from flask import Flask
app = Flask(__name__)
jobs = {
<|fim_middle|>
}
predictions = {}
epoch_info = {}... | code_fim | medium | {
"lang": "python",
"repo": "jundengdeng/deepschmatzing",
"path": "/experiment_server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif this_url == "philosophy":
template = template_env.get_template('templates/justice-ndou/blog/categories/philosophy/philosophy.html')
context = {}
self.response.write(template.render(context))
elif this_url == "mathematics":
template = te... | code_fim | hard | {
"lang": "python",
"repo": "freelancing-solutions/justice-ndou-profile-site",
"path": "/blog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: freelancing-solutions/justice-ndou-profile-site path: /blog.py
import logging
import os
import webapp2
import jinja2
from google.appengine.ext import ndb
from google.appengine.api import users
from google.appengine.api import mail
import datetime
template_env = jinja2.Environment(loader=jinja2.Fi... | code_fim | hard | {
"lang": "python",
"repo": "freelancing-solutions/justice-ndou-profile-site",
"path": "/blog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: morgannewellsun/Reverse-Conway path: /src/components/tests/test_true_target_acc_fn.py
import unittest
import numpy as np
import tensorflow as tf
from components.binary_conway_forward_prop_fn import BinaryConwayForwardPropFn
from components.true_target_acc_fn import TrueTargetAccFn
<|fim_suffix... | code_fim | medium | {
"lang": "python",
"repo": "morgannewellsun/Reverse-Conway",
"path": "/src/components/tests/test_true_target_acc_fn.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> acc = TrueTargetAccFn(delta_steps=2)
forward = BinaryConwayForwardPropFn()
for _ in range(100):
test_start_prob = np.random.random((1, 10, 10, 1))
test_start_binary = test_start_prob > 0.5
test_stop_prob = tf.cast(forward(forward(test_start_binar... | code_fim | medium | {
"lang": "python",
"repo": "morgannewellsun/Reverse-Conway",
"path": "/src/components/tests/test_true_target_acc_fn.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> def parse_response_content(self, response_content):
response = super(AlipayCommerceEcApprovalQueryResponse, self).parse_response_content(response_content)
if 'approval_result' in response:
self.approval_result = response['approval_result']
if 'approval_traveler_dto_... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/response/AlipayCommerceEcApprovalQueryResponse.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/response/AlipayCommerceEcApprovalQueryResponse.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.ApprovalTravelerDTO import ApprovalTravelerD... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/response/AlipayCommerceEcApprovalQueryResponse.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @purpose.setter
def purpose(self, value):
self._purpose = value
def parse_response_content(self, response_content):
response = super(AlipayCommerceEcApprovalQueryResponse, self).parse_response_content(response_content)
if 'approval_result' in response:
self... | code_fim | hard | {
"lang": "python",
"repo": "alipay/alipay-sdk-python-all",
"path": "/alipay/aop/api/response/AlipayCommerceEcApprovalQueryResponse.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZaloznikV/Statistika path: /3_regresija.py
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 13 16:21:41 2021
@author: Hmeljaro
"""
import pandas as pd
import numpy as np
import itertools
from itertools import *
from sklearn.linear_model import LinearRegression
from sklearn.metrics imp... | code_fim | hard | {
"lang": "python",
"repo": "ZaloznikV/Statistika",
"path": "/3_regresija.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
Y = data.PULZ1 #ocenjujemo ta podatek
reg.fit(dodatno_alkohol, Y) #regresija
Y_ocenjeno = reg.predict(dodatno_alkohol)
mse = mean_squared_error(Y, Y_ocenjeno)
# rss = N* MSE
rss = n * mse
print("RSS dodatno alkohol je: ", rss)
reg.fit(dodatno_kadi, Y) #regresija
Y_ocenjeno = reg.pre... | code_fim | hard | {
"lang": "python",
"repo": "ZaloznikV/Statistika",
"path": "/3_regresija.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Y_ocenjeno = reg.predict(my_data.iloc[: , kombinacija])
mse = mean_squared_error(Y, Y_ocenjeno)
# rss = N* MSE
rss = n * mse
RSS.append(rss)
aic = 2 * m + n * np.log(rss)
AIC.append(aic) #seznam AIC-jev za posamezni model
min_index = AIC.index(min(AIC... | code_fim | hard | {
"lang": "python",
"repo": "ZaloznikV/Statistika",
"path": "/3_regresija.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># индексируемся по индексам (15 строк, 3 столбца)
print(df.iloc[:15, :3])
# индексируемся по именам
print(df.loc[:15])
# сортируемся по нескольким признакам
print(df.sort_values(by=['account length', 'total day charge'],
ascending=[True, False]).head())
# среднее столбцов, где длинна аккаунта 1
... | code_fim | hard | {
"lang": "python",
"repo": "pyro-bot/AI_2",
"path": "/Отчеты/1162 1/PanchishinIR/2/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyro-bot/AI_2 path: /Отчеты/1162 1/PanchishinIR/2/test.py
import numpy as np
# создание массива из списка
list_1 = [0,1,2,3,4]
arr_1d = np.array(list_1)
# прибавление и вычитание числа
def minus_plus(minus: bool):
global list_1, arr_1d
for i in range(len(list_1)):
list_1[i] += -... | code_fim | hard | {
"lang": "python",
"repo": "pyro-bot/AI_2",
"path": "/Отчеты/1162 1/PanchishinIR/2/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># решение задачек в main.py
import pandas as pd
# создаем
df = pd.DataFrame({
'int_col' : [1,2,6,8,-1],
'float_col' : [0.1, 0.2,0.2,10.1,None],
'str_col' : ['a','b',None,'c','a']})
print(df)
# индексируемся
print(df.loc[:,['float_col','int_col']]) #строки, от, до
# загружаемс... | code_fim | hard | {
"lang": "python",
"repo": "pyro-bot/AI_2",
"path": "/Отчеты/1162 1/PanchishinIR/2/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: opencord/vSGW path: /xos/tosca/resources/vsgwtenant.py
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... | code_fim | hard | {
"lang": "python",
"repo": "opencord/vSGW",
"path": "/xos/tosca/resources/vsgwtenant.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = self.get_xos_args(throw_exception=False)
return VSGWTenant.get_tenant_objects().filter(provider_service=args["provider_service"], service_specific_id=args["service_specific_id"])
return []
def can_delete(self, obj):
return super(XOSVSGWTenant, self).can_delete(o... | code_fim | hard | {
"lang": "python",
"repo": "opencord/vSGW",
"path": "/xos/tosca/resources/vsgwtenant.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ExampleTenant must always have a provider_service
provider_name = self.get_requirement("tosca.relationships.MemberOfService", throw_exception=throw_exception)
if provider_name:
args["provider_service"] = self.get_xos_object(VSGWService, throw_exception=throw_exception... | code_fim | hard | {
"lang": "python",
"repo": "opencord/vSGW",
"path": "/xos/tosca/resources/vsgwtenant.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yolandahq/CHMM-ALT path: /LabelModel/CHMM/Train.py
izers()
return self
def initialize_matrices(self):
"""
Initialize <HMM> transition and emission matrices
Returns
-------
self
"""
assert self._training_dataset and self._valid_... | code_fim | hard | {
"lang": "python",
"repo": "yolandahq/CHMM-ALT",
"path": "/LabelModel/CHMM/Train.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yolandahq/CHMM-ALT path: /LabelModel/CHMM/Train.py
Returns
-------
the initialized trainer
"""
self.initialize_matrices()
self.initialize_model()
self.initialize_optimizers()
return self
def initialize_matrices(self):
"""
... | code_fim | hard | {
"lang": "python",
"repo": "yolandahq/CHMM-ALT",
"path": "/LabelModel/CHMM/Train.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> label_set,
src_idx=None):
"""
calculate initial hidden states (not used in our setup since our sequences all begin from
[CLS], which corresponds to hidden state "O".
:param src_idx: source index
:param label_set: a set of all possible l... | code_fim | hard | {
"lang": "python",
"repo": "yolandahq/CHMM-ALT",
"path": "/LabelModel/CHMM/Train.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: switcheolytics/switcheo-tradescan-python path: /tests/__init__.py
from unittest import TestCase
DEVEL_AND_CO_SENTRY = "85.214.91.220"
WALLET_VALIDATOR = "swth1vwges9p847l9csj8ehrlgzajhmt4fcq4sd7gzl"
WALLET_DEVEL = "swth1qlue2pat9cxx2s5xqrv0ashs475n9va963h4hz"
USERNAME_DEVEL = "devel484"
cla... | code_fim | hard | {
"lang": "python",
"repo": "switcheolytics/switcheo-tradescan-python",
"path": "/tests/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if expect[key] and isinstance(expect[key][0], dict):
for i, entry in enumerate(actual[key]):
self.assertDictStructure(expect[key][0], entry, path + [key, i])
else:
for i, entry in enumerate(actual[key]):
... | code_fim | hard | {
"lang": "python",
"repo": "switcheolytics/switcheo-tradescan-python",
"path": "/tests/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> :param expect: dict with types
:param actual: dict with values
:param path: current path(list with keys)
:return: None
"""
self.assertEqual(expect.keys(), actual.keys(),
msg=f"Expected field keys are not same: {self.path_to_dict_path... | code_fim | hard | {
"lang": "python",
"repo": "switcheolytics/switcheo-tradescan-python",
"path": "/tests/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>averagePhiDiff = numpy.average(diff[1:10,0])
diff[:,0] = diff[:,0] - averagePhiDiff;
print diff[:,2]
print 'Average Phi Diff:', averagePhiDiff
print 'Max Diff (Phi, E1, E2):', max(abs(diff[:,0])), max(abs(diff[:,1])), max(abs(diff[:,2]))<|fim_prefix|># repo: ckrisgarrett/split-sweep-2017 path: /efield_... | code_fim | medium | {
"lang": "python",
"repo": "ckrisgarrett/split-sweep-2017",
"path": "/efield_diff.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print 'Average Phi Diff:', averagePhiDiff
print 'Max Diff (Phi, E1, E2):', max(abs(diff[:,0])), max(abs(diff[:,1])), max(abs(diff[:,2]))<|fim_prefix|># repo: ckrisgarrett/split-sweep-2017 path: /efield_diff.py
import numpy
import matplotlib.pyplot as plt
import math
import sys
import scipy
<|fim_middle... | code_fim | hard | {
"lang": "python",
"repo": "ckrisgarrett/split-sweep-2017",
"path": "/efield_diff.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ckrisgarrett/split-sweep-2017 path: /efield_diff.py
import numpy
import matplotlib.pyplot as plt
import math
import sys
import scipy
file1 = sys.argv[1]
file2 = sys.argv[2]
data1 = numpy.loadtxt(file1)
data2 = numpy.loadtxt(file2)
diff = data1 - data2
<|fim_suffix|>print 'Average Phi Diff:', a... | code_fim | medium | {
"lang": "python",
"repo": "ckrisgarrett/split-sweep-2017",
"path": "/efield_diff.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 0.0, 180.0),
'scale': Vec3(5.35842609406, 5.35842609406, 5.35842609406),
'collisionsOnly': 0,
'flattenType': 'light',
'loadType': 'loadModel',
'modelPath': 'phase_10/models/cashbotHQ/MintGearPost.bam'},
10010: {'type': 'model',
'name': 'middle',
... | code_fim | hard | {
"lang": "python",
"repo": "open-toontown/open-toontown",
"path": "/toontown/coghq/CashbotMintLavaRoomFoyer_Action01.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>nsOnly': 0,
'flattenType': 'light',
'loadType': 'loadModelCopy',
'modelPath': 'phase_10/models/cogHQ/CBMetalCrate2.bam'},
10016: {'type': 'model',
'name': 'upper',
'comment': '',
'parentEntId': 10015,
'pos': Point3(0.0, 0.0, 5.42841148376),
... | code_fim | hard | {
"lang": "python",
"repo": "open-toontown/open-toontown",
"path": "/toontown/coghq/CashbotMintLavaRoomFoyer_Action01.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: open-toontown/open-toontown path: /toontown/coghq/CashbotMintLavaRoomFoyer_Action01.py
from toontown.coghq.SpecImports import *
GlobalEntities = {1000: {'type': 'levelMgr',
'name': 'LevelMgr',
'comment': '',
'parentEntId': 0,
'cogLevel': 0,
'farPlaneDistanc... | code_fim | hard | {
"lang": "python",
"repo": "open-toontown/open-toontown",
"path": "/toontown/coghq/CashbotMintLavaRoomFoyer_Action01.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lalcs/jpholiday path: /tests/test_year_2024.py
# coding: utf-8
import datetime
import unittest
import jpholiday
class TestYear2024(unittest.TestCase):
def test_holiday(self):
"""
2024年祝日
"""
self.assertEqual(jpholiday.is_holiday_name(datetime.date(2024, 1, 1... | code_fim | medium | {
"lang": "python",
"repo": "Lalcs/jpholiday",
"path": "/tests/test_year_2024.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
2024年月祝日数
"""
self.assertEqual(len(jpholiday.month_holidays(2024, 1)), 2)
self.assertEqual(len(jpholiday.month_holidays(2024, 2)), 3)
self.assertEqual(len(jpholiday.month_holidays(2024, 3)), 1)
self.assertEqual(len(jpholiday.month_holidays(2024, ... | code_fim | medium | {
"lang": "python",
"repo": "Lalcs/jpholiday",
"path": "/tests/test_year_2024.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SilviaJC/uoffice path: /uoffice/apis/echo_handler.py
""""""
import os
import json
from django.http import JsonResponse
from django.views.generic import View
import django.conf
ID_HEADER = '_'.join(f'{__name__}'.split('.'))
<|fim_suffix|> try:
payload = json.loads(request.bo... | code_fim | hard | {
"lang": "python",
"repo": "SilviaJC/uoffice",
"path": "/uoffice/apis/echo_handler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get(self, _):
response = {
'echo': 'OK',
'ID': f'{self.ID}',
}
if django.conf.settings.DEBUG:
response.update({
'DEBUG MODE': django.conf.settings.DEBUG,
'GOOGLE_CLOUD_PROJECT': os.getenv('GOOGLE_CLOUD_PROJ... | code_fim | medium | {
"lang": "python",
"repo": "SilviaJC/uoffice",
"path": "/uoffice/apis/echo_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
payload = json.loads(request.body.decode('utf-8'))
return JsonResponse(payload)
except json.JSONDecodeError as err:
return JsonResponse({'error': f'{err}'})<|fim_prefix|># repo: SilviaJC/uoffice path: /uoffice/apis/echo_handler.py
""""""
import os
... | code_fim | hard | {
"lang": "python",
"repo": "SilviaJC/uoffice",
"path": "/uoffice/apis/echo_handler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: landoo-es/SIVA path: /Reportes/urls.py
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from reportes.views import ReportesListaView
<|fim_suffix|>
urlpatterns = patterns('',
url (
regex = '^lista/(?P<pmodelo>\w+)/(?P<ptpid>\d+)/(?P<pid>\d+)/$',
view = Repo... | code_fim | medium | {
"lang": "python",
"repo": "landoo-es/SIVA",
"path": "/Reportes/urls.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>urlpatterns = patterns('',
url (
regex = '^lista/(?P<pmodelo>\w+)/(?P<ptpid>\d+)/(?P<pid>\d+)/$',
view = ReportesListaView.as_view(),
name = 'reportes_list'
),
url (
regex = '^impresion/(?P<pid>\d+)/(?P<id>\d+)/$',
#regex = '^impresion/(?P<pid>\d+)/(?P<... | code_fim | medium | {
"lang": "python",
"repo": "landoo-es/SIVA",
"path": "/Reportes/urls.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kvh/basis-devkit path: /basis/core/extraction/connection.py
from __future__ import annotations
import json
import os
from datetime import date, datetime
from typing import Any, Callable, Dict, Generic, Iterator, List, Optional, Type, Union
import requests
from loguru import logger
from ratelimi... | code_fim | hard | {
"lang": "python",
"repo": "kvh/basis-devkit",
"path": "/basis/core/extraction/connection.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_default_headers(self) -> Dict:
return self.default_headers.copy()
def validate_params(self, params: Dict) -> Dict:
formatted = {}
for k, v in params.items():
if self.remove_none_params and v is None:
continue
if isinstance(v,... | code_fim | hard | {
"lang": "python",
"repo": "kvh/basis-devkit",
"path": "/basis/core/extraction/connection.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> ),
migrations.AddField(
model_name='shoe',
name='image',
field=models.ImageField(blank=True, null=True, upload_to='shoe/'),
),
migrations.AddField(
model_name='shoe',
name='name',
field=models.CharField(de... | code_fim | hard | {
"lang": "python",
"repo": "a19garcia95/my_shoe_store",
"path": "/src/shoe/migrations/0002_auto_20190423_0411.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: a19garcia95/my_shoe_store path: /src/shoe/migrations/0002_auto_20190423_0411.py
# Generated by Django 2.2 on 2019-04-23 04:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shoe', '0001_initial'),
]
operations = [
... | code_fim | hard | {
"lang": "python",
"repo": "a19garcia95/my_shoe_store",
"path": "/src/shoe/migrations/0002_auto_20190423_0411.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mabaochang/delta path: /delta/utils/metrics/metric_utils.py
# Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
... | code_fim | medium | {
"lang": "python",
"repo": "mabaochang/delta",
"path": "/delta/utils/metrics/metric_utils.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>#pylint: disable=invalid-name
def stats_confusion(confusion):
'''' confusion matrix to TP, FP, TN, FN '''
FP = confusion.sum(axis=0) - np.diag(confusion)
FN = confusion.sum(axis=1) - np.diag(confusion)
TP = np.diag(confusion)
TN = confusion.sum() - (TP + FN + TP)
return TN, FP, FN, TP<|fim_pre... | code_fim | medium | {
"lang": "python",
"repo": "mabaochang/delta",
"path": "/delta/utils/metrics/metric_utils.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nyaruka/sigtrac path: /sigtrac/public/urls.py
from .views import *
urlpatterns = patterns('',
<|fim_suffix|>'public.public_index'),
url(r'^series/$', Series.as_view(), name='public.series'))<|fim_middle|> (r'^$', IndexView.as_view(), {}, | code_fim | easy | {
"lang": "python",
"repo": "nyaruka/sigtrac",
"path": "/sigtrac/public/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>'^series/$', Series.as_view(), name='public.series'))<|fim_prefix|># repo: nyaruka/sigtrac path: /sigtrac/public/urls.py
from .views import *
urlpatterns = patterns('',
(r'^$', IndexView.as_view(), {}, <|fim_middle|>'public.public_index'),
url(r | code_fim | easy | {
"lang": "python",
"repo": "nyaruka/sigtrac",
"path": "/sigtrac/public/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vinodyk/feedjack path: /feedjack/filters.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import itertools as it, operator as op, functools as ft
import re, types
### Simple regex-based filters
def _regex_search(post, parameter, dissector, invert=False):
return invert ^ bo... | code_fim | hard | {
"lang": "python",
"repo": "vinodyk/feedjack",
"path": "/feedjack/filters.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
### Content processors
def pick_enclosure_link(post, parameter=''):
'''Override URL of the Post to point to url of the first enclosure with
href attribute non-empty and type matching specified regexp parameter (empty=any).
Missing "type" attribute for enclosure will be matched as an empty string.... | code_fim | hard | {
"lang": "python",
"repo": "vinodyk/feedjack",
"path": "/feedjack/filters.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Rasdaemon is a RAS (Reliability, Availability and Serviceability)
logging tool. It records memory errors, using the EDAC tracing events.
EDAC is a Linux kernel subsystem with handles detection of ECC errors
from memory controllers for most chipsets on i386 and x86_64
architectures. ... | code_fim | medium | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/rasdaemon/package.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/rasdaemon/package.py
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "JayjeetAtGithub/spack",
"path": "/var/spack/repos/builtin/packages/rasdaemon/package.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Purge the ParseResults from output dictionary
"""
output = dict()
for key, value in input.asDict().items():
if isinstance(value, ParseResults):
output[key] = value.asList()
else:
output[key] = value
return output<|fim_prefix|># repo: EverFi/d... | code_fim | medium | {
"lang": "python",
"repo": "EverFi/dataduct",
"path": "/dataduct/database/parsers/helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EverFi/dataduct path: /dataduct/database/parsers/helpers.py
"""SQL parser helpers
"""
from pyparsing import delimitedList
from pyparsing import Optional
from pyparsing import ParseResults
from .utils import _db_name
from .utils import _temp
from .utils import _temporary
from .utils import _if_no... | code_fim | hard | {
"lang": "python",
"repo": "EverFi/dataduct",
"path": "/dataduct/database/parsers/helpers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def paranthesis_list(output_name, input_var=_db_name):
"""Parser for a delimiedList enclosed in paranthesis
"""
return '(' + delimitedList(input_var).setResultsName(output_name) + ')'
def exists(parser, output_name):
"""Get a parser that returns boolean on existance
"""
return p... | code_fim | medium | {
"lang": "python",
"repo": "EverFi/dataduct",
"path": "/dataduct/database/parsers/helpers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeffrade/python-collections path: /machine-learning/csv_explore.py
#!/usr/bin/env python3
# Script that uses pandas lib to understand data in a csv file.
# Example usage: ./csv_explore.py --file data.csv --command headers
import sys
import argparse
import pandas
import numpy
cmd_choices = ['hea... | code_fim | hard | {
"lang": "python",
"repo": "jeffrade/python-collections",
"path": "/machine-learning/csv_explore.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def exec_headers(self):
d = pandas.read_csv(self.filename)
print(d.columns.values.tolist())
def exec_create_sets(self):
df, test_rows = self.get_rand_rows()
train_rows = df.drop(test_rows.index)
self.write_to_csv(test_rows, self.filename + '.test')
... | code_fim | hard | {
"lang": "python",
"repo": "jeffrade/python-collections",
"path": "/machine-learning/csv_explore.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># generate all numbers
# overwrite data segment with identifiable pattern - cyclic!
# >>> pairs =
# ...[(242, 156, 'm', 'n'),
# ... (234, 217, '2', '3'),
# ... (130, 245, 'v', 'w'),
# ... (54 , 105, '^', '_'),
# ... (142, 239),
# ... (18 , 117),
# ... (24 , 43),
# ... (115, 44),
# ... (123, 13),
# ..... | code_fim | hard | {
"lang": "python",
"repo": "cimi/cscg-2020",
"path": "/eVMoji/brute_force.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>check_pointer()
# n3w_ag3_v1rtu4liz4t1on_xxxx
def brute_force_pointer():
with open("solve-output.txt", "w") as outfile:
# x - position, y - pointer, z - length
z = 5
for x in trange(32, leave=False):
for y in trange(32, leave=False):
for z in range(0, 9):
generate_p... | code_fim | hard | {
"lang": "python",
"repo": "cimi/cscg-2020",
"path": "/eVMoji/brute_force.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cimi/cscg-2020 path: /eVMoji/brute_force.py
# -*- coding: UTF-8 -*-
from pwn import *
from tqdm import trange, tqdm
import string
nums = []
# we used to use only the numbers available in the source
with open("analysis/numbers.txt", "r") as nf:
lines = nf.readlines()
for l in lines:
if i... | code_fim | hard | {
"lang": "python",
"repo": "cimi/cscg-2020",
"path": "/eVMoji/brute_force.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: usc-ee250-spring2020/GrovePi-EE250 path: /ee250/lab08/analyze.py
import matplotlib.pyplot as plt
import numpy as np
from pydub import AudioSegment
import sys
import os
#required: sudo apt-get install ffmpeg python3-tk
MAX_FRQ = 2000
SLICE_SIZE = 0.15
def main(start_time, file):
print("Impor... | code_fim | hard | {
"lang": "python",
"repo": "usc-ee250-spring2020/GrovePi-EE250",
"path": "/ee250/lab08/analyze.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sample_slice_fft = np.fft.fft(sample_slice)/n #perform the fourier transform on the sample_slice and normalize by dividing by n
max_frq_idx = int(MAX_FRQ*slice_duration) #get the index of the maximum frequency (2000)
frq = frq[range(max_frq_idx)] #truncate the freque... | code_fim | hard | {
"lang": "python",
"repo": "usc-ee250-spring2020/GrovePi-EE250",
"path": "/ee250/lab08/analyze.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """**********************SAMPLE SLICE FFT PLOT**********************"""
n = slice_frame_size #n is the number of elements in the slice
#generating the frequency spectrum
k = np.arange(n) #k is an array from 0 to [n] with a step of ... | code_fim | hard | {
"lang": "python",
"repo": "usc-ee250-spring2020/GrovePi-EE250",
"path": "/ee250/lab08/analyze.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> posts = defaultdict(list)
for prev_line, line in zip(lines, lines[1:]):
if 'sending to' in line:
date = prev_line.split()[0]
book_icon = 'python' in prev_line.lower() and PY_BOOK or OTHER_BOOK
posts[date].append(book_icon)
for date, books in posts.... | code_fim | medium | {
"lang": "python",
"repo": "xtakacsx/bitesofpy",
"path": "/48/safari.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xtakacsx/bitesofpy path: /48/safari.py
from collections import defaultdict
import os
import urllib.request
TMP = os.getenv("TMP", "/tmp")
DATA = 'safari.logs'
SAFARI_LOGS = os.path.join(TMP, DATA)
PY_BOOK, OTHER_BOOK = '🐍', '.'
urllib.request.urlretrieve(
f'https://bites-data.s3.us-east-2.... | code_fim | medium | {
"lang": "python",
"repo": "xtakacsx/bitesofpy",
"path": "/48/safari.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def create_chart(log=None):
log = log or SAFARI_LOGS
lines = _get_lines(log)
posts = defaultdict(list)
for prev_line, line in zip(lines, lines[1:]):
if 'sending to' in line:
date = prev_line.split()[0]
book_icon = 'python' in prev_line.lower() and PY_BOOK ... | code_fim | medium | {
"lang": "python",
"repo": "xtakacsx/bitesofpy",
"path": "/48/safari.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rob-blackbourn/chatter path: /chat-server/src/chatter/schema/__init__.py
from graphql import (
GraphQLSchema,
)
<|fim_suffix|>schema = GraphQLSchema(
query=RootQueryType,
mutation=RootMutationType,
subscription=RootSubscriptionType
)<|fim_middle|>from .queries import RootQueryTyp... | code_fim | medium | {
"lang": "python",
"repo": "rob-blackbourn/chatter",
"path": "/chat-server/src/chatter/schema/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>schema = GraphQLSchema(
query=RootQueryType,
mutation=RootMutationType,
subscription=RootSubscriptionType
)<|fim_prefix|># repo: rob-blackbourn/chatter path: /chat-server/src/chatter/schema/__init__.py
from graphql import (
GraphQLSchema,
)
<|fim_middle|>from .queries import RootQueryTyp... | code_fim | medium | {
"lang": "python",
"repo": "rob-blackbourn/chatter",
"path": "/chat-server/src/chatter/schema/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
('yeah',
'y34h.'),
('lol',
'l0l.'),
('omg',
'omg'),
('How are you?',
'sup n00b'),
('the universe',
'th3 j00n1v3rs3'),
('Nice to meet you.',
'nic3 t0 m33t j00.'),
)
return prompt.convert(in_text, ... | code_fim | medium | {
"lang": "python",
"repo": "nelsonlove/gpt-utils",
"path": "/src/gpt_utils/leetify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nelsonlove/gpt-utils path: /src/gpt_utils/leetify.py
from . import GPT
from .prompt import ConversionPrompt
@GPT.requires_key
def leetify(in_text, reverse=False):
prompt = ConversionPrompt(
'American<|fim_suffix|>
('yeah',
'y34h.'),
('lol',
'l0l.'),... | code_fim | medium | {
"lang": "python",
"repo": "nelsonlove/gpt-utils",
"path": "/src/gpt_utils/leetify.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>the universe',
'th3 j00n1v3rs3'),
('Nice to meet you.',
'nic3 t0 m33t j00.'),
)
return prompt.convert(in_text, reverse=reverse)<|fim_prefix|># repo: nelsonlove/gpt-utils path: /src/gpt_utils/leetify.py
from . import GPT
from .prompt import ConversionPrompt
@GPT.require... | code_fim | hard | {
"lang": "python",
"repo": "nelsonlove/gpt-utils",
"path": "/src/gpt_utils/leetify.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/model-optimization path: /tensorflow_model_optimization/python/core/internal/tensor_encoding/core/gather_encoder.py
tween the `tf.function`s created below.
#
# The motivation behind this pattern is the following.
#
# The implementers of the `EncodingStageInterface` shou... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/model-optimization",
"path": "/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/gather_encoder.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def update_state_fn(flat_state, state_update_tensors):
"""See the `update_state` method of this class."""
py_utils.assert_compatible(flat_state_spec, flat_state)
state = tf.nest.pack_sequence_as(internal_structure['state'], flat_state)
state_update_tensors = tf.nest.pack_sequen... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/model-optimization",
"path": "/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/gather_encoder.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.model = '' # string identifying the model
self.experiment = '' # string to describe experiment
self.maps = [data.ID_MAP_T1H2O, data.ID_MAP_FF, data.ID_MAP_B1] # the used maps
self.patch_size = [1, 32, 32]
# training configuration
self.loss = 'mse' ... | code_fim | hard | {
"lang": "python",
"repo": "fabianbalsiger/mrf-reconstruction-midl2019",
"path": "/mrf/configuration/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fabianbalsiger/mrf-reconstruction-midl2019 path: /mrf/configuration/config.py
import pymia.config.configuration as cfg
import pymia.deeplearning.config as dlcfg
import mrf.data.data as data
class Configuration(dlcfg.DeepLearningConfiguration):
"""Represents a configuration."""
VERSION... | code_fim | medium | {
"lang": "python",
"repo": "fabianbalsiger/mrf-reconstruction-midl2019",
"path": "/mrf/configuration/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nateGeorge/IDmyDog path: /process_ims/machine_learning.py
from __future__ import print_function
import pandas as pd
import pickle as pk
import numpy as np
import json
import cPickle
from sklearn.svm import SVC
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomF... | code_fim | hard | {
"lang": "python",
"repo": "nateGeorge/IDmyDog",
"path": "/process_ims/machine_learning.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># try random forest again
params = {
'max_depth': [20, 30, 40, 50, 60],
'n_estimators': [30, 40]
}
print('[INFO] RandomForest gridsearching', params)
clf = RandomForestClassifier(random_state=42, n_jobs=-1)
model = GridSearchCV(clf, params, cv=3, refit=False)
model.fit(data, l... | code_fim | hard | {
"lang": "python",
"repo": "nateGeorge/IDmyDog",
"path": "/process_ims/machine_learning.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qwertyquerty/QMTR path: /util.py
from PyQt5 import QtWidgets
from PyQt5 import QtCore
import logging
import re
class QTextEditLogger(logging.Handler, QtCore.QObject):
<|fim_suffix|> return line.encode("ascii", "ignore").decode()
def escape_ansi(line):
ansi_escape = re.compile(r'(... | code_fim | hard | {
"lang": "python",
"repo": "qwertyquerty/QMTR",
"path": "/util.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.