text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> cv2.imshow('left', left_data)
cv2.imshow('right', right_data)
cv2.imwrite(f'{left_path}/{str(i)}.{file_format}', left_data)
cv2.imwrite(f'{right_path}/{str(i)}.{file_format}', right_data)
cv2.waitKey(500)
except:
print("Unable to capture frames.")
finally:
... | code_fim | hard | {
"lang": "python",
"repo": "carlosefrias/realsense-t265-and-d435-testing",
"path": "/Python/capture_fisheye_imgs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
for i in range(200):
frames = pipe.wait_for_frames()
left = frames.get_fisheye_frame(1)
left_data = np.asanyarray(left.get_data())
right = frames.get_fisheye_frame(2)
right_data = np.asanyarray(right.get_data())
cv2.imshow('left', left_data)
... | code_fim | medium | {
"lang": "python",
"repo": "carlosefrias/realsense-t265-and-d435-testing",
"path": "/Python/capture_fisheye_imgs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: carlosefrias/realsense-t265-and-d435-testing path: /Python/capture_fisheye_imgs.py
import pyrealsense2 as rs
import numpy as np
import cv2
import os
pipe = rs.pipeline()
cfg = rs.config()
cfg.enable_stream(rs.stream.fisheye, 1)
cfg.enable_stream(rs.stream.fisheye, 2)
pipe.start(cfg)
left_pat... | code_fim | medium | {
"lang": "python",
"repo": "carlosefrias/realsense-t265-and-d435-testing",
"path": "/Python/capture_fisheye_imgs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Kind => Defines the activity class that holds the execution logic
Extend => Defines whether the flow continues on activity error
Repeat => Defines how many times the activity repeats on error
This function will incrementally spits out a log of the
actio... | code_fim | hard | {
"lang": "python",
"repo": "mena-devs/slack-invite-flow",
"path": "/slack_invite_flow/flow.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> If an `initial` state is passed, the flow will ignore earlier
activities
Activity configurations provide the following:
Kind => Defines the activity class that holds the execution logic
Extend => Defines whether the flow continues on activity error
... | code_fim | hard | {
"lang": "python",
"repo": "mena-devs/slack-invite-flow",
"path": "/slack_invite_flow/flow.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mena-devs/slack-invite-flow path: /slack_invite_flow/flow.py
"""Flow related logic"""
import abc
import collections
import datetime
import six
ActivityConfig = collections.namedtuple('ActivityConfig', 'kind extend repeat')
Log = collections.namedtuple('Log', 'when action error')
class Faile... | code_fim | hard | {
"lang": "python",
"repo": "mena-devs/slack-invite-flow",
"path": "/slack_invite_flow/flow.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>',random.choice(p),'tansuikabutu=',random.choice(t),'dezart=',random.choice(d))<|fim_prefix|># repo: tourokusitai/chibi path: /calc.py
import random
s=[1,2,3,4,5]
z=[1,2,3,4,5,6,7,8,9,10]
n=[1,2,3,4,5]
p=[1,2,<|fim_middle|>3,4,5]
t=[1,2,3,4,5,6,7,8,9,10,11]
d=[1,2,3,4,5,6,7,8,9,10]
print('sarada='... | code_fim | medium | {
"lang": "python",
"repo": "tourokusitai/chibi",
"path": "/calc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tourokusitai/chibi path: /calc.py
import random
s=[1,2,3,4,5]
z=[1,2,3,4,5,6,7,8,9,10]
n=[1,2,3,4,5]
p=[1,2,<|fim_suffix|>random.choice(s),'zensai=',random.sample(z,2),'niku=',random.choice(n),'pizza=',random.choice(p),'tansuikabutu=',random.choice(t),'dezart=',random.choice(d))<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "tourokusitai/chibi",
"path": "/calc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mouseClick,
mouseDrag,
mouseMove,
mousePress,
mouseRelease,
resizeWindow,
)<|fim_prefix|># repo: pyqtgraph/pyqtgraph path: /tests/__init__.py
from .image_testing import TransposedImageItem, <|fim_middle|>assertImageApproved
from .ui_testing import (
| code_fim | easy | {
"lang": "python",
"repo": "pyqtgraph/pyqtgraph",
"path": "/tests/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyqtgraph/pyqtgraph path: /tests/__init__.py
from .image_testing import TransposedImageItem, <|fim_suffix|>mousePress,
mouseRelease,
resizeWindow,
)<|fim_middle|>assertImageApproved
from .ui_testing import (
mouseClick,
mouseDrag,
mouseMove,
| code_fim | medium | {
"lang": "python",
"repo": "pyqtgraph/pyqtgraph",
"path": "/tests/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shiqin6/FFASR-OpenAPI-Demos path: /python-demo/YaeDemoClient.py
# -*- coding: utf-8 -*-
# 请提前安装第三方库websocket-client(pip3 install websocket-client)
# access_id 与 access_ke 已留空,填入即可
# 运行时请把pcm文件放入test-case文件夹内
import time
import hashlib
import websocket
import json
import uuid
import os
import sys... | code_fim | hard | {
"lang": "python",
"repo": "shiqin6/FFASR-OpenAPI-Demos",
"path": "/python-demo/YaeDemoClient.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
testNum = 0
test = Clinent()
wavPath = testCase()
for pcm in os.listdir(wavPath):
if pcm[-4:] == ".pcm":
testNum = testNum + 1
path = wavPath + "/" + pcm
turl = makeURL(access_id, access_key)
test.create_connection(turl)
... | code_fim | hard | {
"lang": "python",
"repo": "shiqin6/FFASR-OpenAPI-Demos",
"path": "/python-demo/YaeDemoClient.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _save_as_numpy(predictions, output_directory, saved_keys):
predictions = predictions[[
c for c in predictions.columns if c not in saved_keys
]]
npy_filename = os.path.join(output_directory, '{}.npy')
numpy_predictions = to_numpy_dataset(predictions)
for k, v in numpy_predic... | code_fim | hard | {
"lang": "python",
"repo": "litanlitudan/ludwig",
"path": "/ludwig/data/postprocessing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: litanlitudan/ludwig path: /ludwig/data/postprocessing.py
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, Inc.
#
# 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 cop... | code_fim | hard | {
"lang": "python",
"repo": "litanlitudan/ludwig",
"path": "/ludwig/data/postprocessing.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gautierdag/pcfg-attention path: /utils/utils.py
def generate_filename_from_options(opt):
"""
Pass in options obtained from argparse and generates a filename for the run and models
"""
fs = '{}_emb_{}_hid_{}_de_{}_dd_{}_n_lyrs_{}_lr_{}'<|fim_suffix|> '_{}'.format(opt.optim)
if ... | code_fim | hard | {
"lang": "python",
"repo": "gautierdag/pcfg-attention",
"path": "/utils/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '_{}'.format(opt.optim)
if opt.attention:
fs += '_att_{}'.format(opt.attention_method)
if opt.positional_attention:
fs += '_pos_att_{}'.format(opt.positioning_generator_size)
if opt.attention and opt.positional_attention:
fs += '_mix_{}'.format(opt.attention_mixer)
... | code_fim | hard | {
"lang": "python",
"repo": "gautierdag/pcfg-attention",
"path": "/utils/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## Writting
db = shelve.open(namefile)
db['nif'] = nif
db['neighnet'] = neighnet
db['methodvalues'] = methodvalues
db.close()
def read_neighnet(namefile):
"""Read pre-computed neighnet computation."""
db = shelve.open(namefile)
nif = db['nif']
neighnet = db['neigh... | code_fim | hard | {
"lang": "python",
"repo": "tgquintela/FirmsLocations",
"path": "/FirmsLocations/IO/precomputers_io.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ## Writting
db = shelve.open(namefile)
db['cps'] = cps
db['net'] = net
db['methodvalues'] = methodvalues
db.close()
def read_net_cp(namefile):
"""Read pre-computed network cp assignation."""
db = shelve.open(namefile)
cps = db['cps']
net = db['net']
methodvalu... | code_fim | hard | {
"lang": "python",
"repo": "tgquintela/FirmsLocations",
"path": "/FirmsLocations/IO/precomputers_io.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tgquintela/FirmsLocations path: /FirmsLocations/IO/precomputers_io.py
"""
Precomputers IO
---------------
Module which groups all the functions related with input-output precomputation
of useful data from raw, or just clean data.
"""
import os
import shelve
import datetime
def generate_namef... | code_fim | hard | {
"lang": "python",
"repo": "tgquintela/FirmsLocations",
"path": "/FirmsLocations/IO/precomputers_io.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thinnect/python-moteannouncement path: /moteannouncement/__init__.py
"""__init__.py: moteannouncement init."""
<|fim_suffix|>from moteannouncement.deva_packets.v2 import RadioTechnologies
from moteannouncement.version import __version__<|fim_middle|>__author__ = "Raido Pahtma"
__license__ = "MIT... | code_fim | easy | {
"lang": "python",
"repo": "thinnect/python-moteannouncement",
"path": "/moteannouncement/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from moteannouncement.deva_packets.v2 import RadioTechnologies
from moteannouncement.version import __version__<|fim_prefix|># repo: thinnect/python-moteannouncement path: /moteannouncement/__init__.py
"""__init__.py: moteannouncement init."""
<|fim_middle|>__author__ = "Raido Pahtma"
__license__ = "MIT... | code_fim | easy | {
"lang": "python",
"repo": "thinnect/python-moteannouncement",
"path": "/moteannouncement/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Poio-NLP/poio-lib path: /tests/test_ngrams.py
import os
import unittest
import poiolib.ngrams
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
<|fim_suffix|> corpus_file = os.path.join(SCRIPT_DIR, "test_data", "der_linksdenker.txt")
ngram_map = poiolib.ngrams.corpus_ngram... | code_fim | medium | {
"lang": "python",
"repo": "Poio-NLP/poio-lib",
"path": "/tests/test_ngrams.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_corpus_ngrams(self):
corpus_file = os.path.join(SCRIPT_DIR, "test_data", "der_linksdenker.txt")
ngram_map = poiolib.ngrams.corpus_ngrams([corpus_file], 1)
result = {tuple(ngram): count for ngram, count in ngram_map.items()}
self.assertIn(("Der",), result)
... | code_fim | medium | {
"lang": "python",
"repo": "Poio-NLP/poio-lib",
"path": "/tests/test_ngrams.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> corpus_file = os.path.join(SCRIPT_DIR, "test_data", "der_linksdenker.txt")
ngram_map = poiolib.ngrams.corpus_ngrams([corpus_file], 1)
result = {tuple(ngram): count for ngram, count in ngram_map.items()}
self.assertIn(("Der",), result)
self.assertNotIn(("-über",), re... | code_fim | medium | {
"lang": "python",
"repo": "Poio-NLP/poio-lib",
"path": "/tests/test_ngrams.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return abs_ts_2, part, abs_time, len(abs_ts)
def perform_synth(abs_ts_2, specs):
# synthesize controller for abstracted system
abs_ts_2.owner = 'sys'
start_time = time.time()
ctrl = synthesize_controller(abs_ts_2, specs)
synth_time = time.time() - start_time
#print(ctrl)
... | code_fim | hard | {
"lang": "python",
"repo": "arw12625/tulip-control",
"path": "/examples/stutter/robot_2.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arw12625/tulip-control path: /examples/stutter/robot_2.py
"""
Construct and evaluate a robot task system
"""
import logging
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)
#logging.getLogger('tulip').setLevel(logging.ERROR)
logger.setLevel(logging.DEBUG)
#from nos... | code_fim | hard | {
"lang": "python",
"repo": "arw12625/tulip-control",
"path": "/examples/stutter/robot_2.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def object_color(obj_id, if_rgb, if_random):
obj_color = ["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5",
"#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5",
"#8dd3c7", "#b... | code_fim | hard | {
"lang": "python",
"repo": "wellowdata/cooperative_scene_parsing",
"path": "/utils/vis_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wellowdata/cooperative_scene_parsing path: /utils/vis_utils.py
"""
Created on April, 2018
@author: Siyuan Huang
visualize code for SUNRGBD
"""
import matplotlib.pyplot as plt
import numpy as np
from random import random as rand
from mpl_toolkits.mplot3d import Axes3D
def show_2dboxes(im, bd... | code_fim | hard | {
"lang": "python",
"repo": "wellowdata/cooperative_scene_parsing",
"path": "/utils/vis_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: share424/Flexible-Job-Shop-Scheduling-Problem path: /example.py
from fjsp import FJSP, save_as_excel, save_as_fig, save_as_excel
from ga<|fim_suffix|>e_as_fig('output.png', resources)
save_as_excel('output.xlsx', resources)<|fim_middle|> import GeneticAlgorithm
solver = GeneticAlgorithm()
fjsp =... | code_fim | medium | {
"lang": "python",
"repo": "share424/Flexible-Job-Shop-Scheduling-Problem",
"path": "/example.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e_as_fig('output.png', resources)
save_as_excel('output.xlsx', resources)<|fim_prefix|># repo: share424/Flexible-Job-Shop-Scheduling-Problem path: /example.py
from fjsp import FJSP, save_as_excel, save_as_fig, save_as_excel
from ga<|fim_middle|> import GeneticAlgorithm
solver = GeneticAlgorithm()
fjsp =... | code_fim | medium | {
"lang": "python",
"repo": "share424/Flexible-Job-Shop-Scheduling-Problem",
"path": "/example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>t.fjs", solver)
resources = fjsp.solve(iter=1, selected_offspring=.8)
save_as_fig('output.png', resources)
save_as_excel('output.xlsx', resources)<|fim_prefix|># repo: share424/Flexible-Job-Shop-Scheduling-Problem path: /example.py
from fjsp import FJSP, save_as_excel, save_as_fig, save_as_excel
from ga<... | code_fim | medium | {
"lang": "python",
"repo": "share424/Flexible-Job-Shop-Scheduling-Problem",
"path": "/example.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: decodeurs/presidentielle path: /parrainages/parrainages.py
import json, sys
parrainages_fichier = open('/Users/L/Desktop/Conseil Constitutionnel/tous20170314.json', encoding='utf-8')
parrainages_json = json.load(parrainages_fichier, encoding='utf-8')
arguments = sys.argv
arguments_ou_pas = True ... | code_fim | medium | {
"lang": "python",
"repo": "decodeurs/presidentielle",
"path": "/parrainages/parrainages.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not voir_toutes_conditions:
print('')
continue
def départementDe(x):
return x['Département']
départements = [départementDe(x) for x in parrainages]
compte_départements = {}
for département in départements:
if département in compte_départements:
compte_départements[département] += 1
e... | code_fim | hard | {
"lang": "python",
"repo": "decodeurs/presidentielle",
"path": "/parrainages/parrainages.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mitchjeitani/catacomb path: /catacomb/entry_points.py
import click
from catacomb import settings
from catacomb.common import constants
from catacomb.decorators.context import Context
from catacomb.utils.plugin_loader import PluginLoader
<|fim_suffix|> """Entry point for the `tomb` command. P... | code_fim | hard | {
"lang": "python",
"repo": "mitchjeitani/catacomb",
"path": "/catacomb/entry_points.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Entry point for the `tomb` command. Passes responsibility of handling
a command down the chain of subcommand handlers until we've found one that
can handle the given subcommand.
This entry point handles actions involving the contents of the current
tomb.
"""
pass<|fim_prefi... | code_fim | medium | {
"lang": "python",
"repo": "mitchjeitani/catacomb",
"path": "/catacomb/entry_points.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_simple_list(self):
l = range(1, 7)
random_sample = _.sample(l, 1)
self.assertIsInstance(random_sample, list)
for i in random_sample:
self.assertIn(i, l)
two_random_samples = _.sample(l, 2)
self.assertIsInstance(two_random_samples, li... | code_fim | hard | {
"lang": "python",
"repo": "ankitml/underscore",
"path": "/tests/test_collections.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ankitml/underscore path: /tests/test_collections.py
import unittest
from underscore import collection as _
from types import GeneratorType
from unittest.mock import patch
from .helpers import side_effects_fn
class TestEach(unittest.TestCase):
@patch('tests.helpers.side_effects_fn')
def... | code_fim | hard | {
"lang": "python",
"repo": "ankitml/underscore",
"path": "/tests/test_collections.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'v1' in temp_data_quant.coords.keys() and 'v2' in temp_data_quant.coords.keys() and 'v3' in temp_data_quant.coords.keys():
variable = namedtuple('variable', ['times', 'y', 'v1', 'v2', 'v3'])
return variable(temp_data_quant.time.values, temp_data_quant.data, temp_data_quant.coords['v... | code_fim | medium | {
"lang": "python",
"repo": "MAVENSDC/PyTplot",
"path": "/pytplot/get_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MAVENSDC/PyTplot path: /pytplot/get_data.py
# Copyright 2018 Regents of the University of Colorado. All Rights Reserved.
# Released under the MIT license.
# This software was developed at the University of Colorado's Laboratory for Atmospheric and Space Physics.
# Verify current version before us... | code_fim | medium | {
"lang": "python",
"repo": "MAVENSDC/PyTplot",
"path": "/pytplot/get_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeanYan604/ImgPreprocessing path: /src/Dataprocess.py
import cv2
import glob
from PIL import Image
import numpy as np
import os
import region
import math
def Maskgeneration(img_num, foldernum):
<|fim_suffix|> mask = np.zeros(ori_img.shape, np.uint8)
ori_img = ori_img.asty... | code_fim | hard | {
"lang": "python",
"repo": "SeanYan604/ImgPreprocessing",
"path": "/src/Dataprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # cv2.imshow('mask', mask)
# cv2.waitKey(0)
cv2.imwrite(mask_file, mask)
if __name__ == "__main__":
img_num = 27
foldernum = 11
Maskgeneration(img_num, foldernum)<|fim_prefix|># repo: SeanYan604/ImgPreprocessing path: /src/Dataprocess.py
import cv2
import... | code_fim | hard | {
"lang": "python",
"repo": "SeanYan604/ImgPreprocessing",
"path": "/src/Dataprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mask = np.zeros(ori_img.shape, np.uint8)
ori_img = ori_img.astype(np.float)
def_img = def_img.astype(np.float)
sub = ori_img - def_img
# print(sub.dtype)
mask[np.abs(sub) > 70] = 255
# cv2.imshow('mask', mask)
... | code_fim | hard | {
"lang": "python",
"repo": "SeanYan604/ImgPreprocessing",
"path": "/src/Dataprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#1. Load a pre-trained network (If you need a starting point, the VGG networks work great and are straightforward to use)
#2. Define a new, untrained feed-forward network as a classifier, using ReLU activations and dropout
#3. Train the classifier layers using backpropagation using the pre-trained network... | code_fim | hard | {
"lang": "python",
"repo": "ismith1024/Udacity-Deep-Learning-Project",
"path": "/train.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ismith1024/Udacity-Deep-Learning-Project path: /train.py
'''
Specifications
The first file, train.py, will train a new network on a dataset and save the model as a checkpoint.
Train a new network on a data set with train.py
Basic usage: python train.py data_directory
Prints out training loss, v... | code_fim | hard | {
"lang": "python",
"repo": "ismith1024/Udacity-Deep-Learning-Project",
"path": "/train.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_vegemite.py
#calss header
class _VEGEMITE():
def __init__(self,):
self.name = "VEGEMITE"
self.definitions = [u'a soft, dark brown, salty-tasting food for spreading on bread, made from yeast, that is popular in Australia and New Zealand']
se... | code_fim | easy | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_vegemite.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: poldracklab/bids-core path: /api/dao/containerstorage.py
import bson.errors
from .. import util
from .. import config
from . import APIStorageException
log = config.log
class ContainerStorage(object):
"""
This class provides access to mongodb collection elements (called containers).
... | code_fim | hard | {
"lang": "python",
"repo": "poldracklab/bids-core",
"path": "/api/dao/containerstorage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _get_all_el(self, query, user, public, projection):
if user:
if query.get('permissions'):
query['$and'] = [{'permissions': {'$elemMatch': user}}, {'permissions': query.pop('permissions')}]
else:
query['permissions'] = {'$elemMatch': u... | code_fim | hard | {
"lang": "python",
"repo": "poldracklab/bids-core",
"path": "/api/dao/containerstorage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> keyword = db.relationship('Keyword', backref=db.backref('event_keyword'))
def __init__(self, event=None, keyword=None):
self.event = event
self.keyword = keyword<|fim_prefix|># repo: Synergize-Southwest-Detroit/api path: /server/models/event_keyword.py
from server.models.db impor... | code_fim | hard | {
"lang": "python",
"repo": "Synergize-Southwest-Detroit/api",
"path": "/server/models/event_keyword.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Synergize-Southwest-Detroit/api path: /server/models/event_keyword.py
from server.models.db import db
class EventKeyword(db.Model):
<|fim_suffix|> def __init__(self, event=None, keyword=None):
self.event = event
self.keyword = keyword<|fim_middle|> __tablename__ = 'event_k... | code_fim | hard | {
"lang": "python",
"repo": "Synergize-Southwest-Detroit/api",
"path": "/server/models/event_keyword.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
@pulumi.getter(name="vpcId")
def vpc_id(self) -> str:
return pulumi.get(self, "vpc_id")
class AwaitableGetSubnetResult(GetSubnetResult):
# pylint: disable=using-constant-test
def __await__(self):
if False:
yield self
return GetSubnetResul... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws",
"path": "/sdk/python/pulumi_aws/ec2/get_subnet.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi-aws path: /sdk/python/pulumi_aws/ec2/get_subnet.py
if availability_zone_id and not isinstance(availability_zone_id, str):
raise TypeError("Expected argument 'availability_zone_id' to be a str")
pulumi.set(__self__, "availability_zone_id", availability_zone_id... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws",
"path": "/sdk/python/pulumi_aws/ec2/get_subnet.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pulumi/pulumi-aws path: /sdk/python/pulumi_aws/ec2/get_subnet.py
lumi.set(__self__, "customer_owned_ipv4_pool", customer_owned_ipv4_pool)
if default_for_az and not isinstance(default_for_az, bool):
raise TypeError("Expected argument 'default_for_az' to be a bool")
pulu... | code_fim | hard | {
"lang": "python",
"repo": "pulumi/pulumi-aws",
"path": "/sdk/python/pulumi_aws/ec2/get_subnet.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.wait_for_resource = ResourceSeizeQueue(
self.env,
"wait_for_resource",
resource=self.resource_1,
xy=(175, 169),
ways={"proc_1": [(225, 169), (265, 169)]},
)
self.release_resource = ResourceRelease(
self.e... | code_fim | hard | {
"lang": "python",
"repo": "fladdimir/casymda",
"path": "/examples/resources/resource_example_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fladdimir/casymda path: /examples/resources/resource_example_model.py
"""model template for generated model files"""
from casymda.blocks import (
Delay,
Entity,
NamedResource,
ResourceRelease,
ResourceSeizeQueue,
RoundRobinGateway,
SeizeProcessRelease,
Sink,
So... | code_fim | hard | {
"lang": "python",
"repo": "fladdimir/casymda",
"path": "/examples/resources/resource_example_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.proc_1 = Delay(
self.env,
"proc_1",
xy=(315, 169),
process_time=5,
ways={"proc_2": [(365, 169), (415, 169)]},
)
self.proc_2 = Delay(
self.env,
"proc_2",
xy=(465, 169),
... | code_fim | hard | {
"lang": "python",
"repo": "fladdimir/casymda",
"path": "/examples/resources/resource_example_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Gets the service of this Policy.
服务
:return: The service of this Policy.
:rtype: str
"""
return self._service
@service.setter
def service(self, service):
"""Sets the service of this Policy.
服务
:param service: The servi... | code_fim | hard | {
"lang": "python",
"repo": "huaweicloud/huaweicloud-sdk-python-v3",
"path": "/huaweicloud-sdk-lakeformation/huaweicloudsdklakeformation/v1/model/policy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :return: The service_type of this Policy.
:rtype: str
"""
return self._service_type
@service_type.setter
def service_type(self, service_type):
"""Sets the service_type of this Policy.
服务类型
:param service_type: The service_type of this Poli... | code_fim | hard | {
"lang": "python",
"repo": "huaweicloud/huaweicloud-sdk-python-v3",
"path": "/huaweicloud-sdk-lakeformation/huaweicloudsdklakeformation/v1/model/policy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huaweicloud/huaweicloud-sdk-python-v3 path: /huaweicloud-sdk-lakeformation/huaweicloudsdklakeformation/v1/model/policy.py
y_all_else': 'is_deny_all_else',
'is_enabled': 'is_enabled',
'name': 'name',
'options': 'options',
'policy_items': 'policy_items',
'pol... | code_fim | hard | {
"lang": "python",
"repo": "huaweicloud/huaweicloud-sdk-python-v3",
"path": "/huaweicloud-sdk-lakeformation/huaweicloudsdklakeformation/v1/model/policy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>tml': writers.HTMLfromReST,
'.moin.txt': writers.Moin,
#'.mw.txt': writers.MediaWiki,
}
command_RE = re.compile(r'^[#\[](\w+)\]?(?:\s+(.*?)|)\s*$')<|fim_prefix|># repo: GKernelCI/Gmeetbot path: /meetingLocalConfig.py
import re
from . import writers
class Config(object):
logFi... | code_fim | hard | {
"lang": "python",
"repo": "GKernelCI/Gmeetbot",
"path": "/meetingLocalConfig.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>g.html': writers.HTMLlog,
#'.1.html': writers.HTML,
'.html': writers.HTML2,
#'.rst': writers.ReST,
#'.txt': writers.Text,
#'.rst.html': writers.HTMLfromReST,
'.moin.txt': writers.Moin,
#'.mw.txt': writers.MediaWiki,
}
command_RE = re.compile(... | code_fim | medium | {
"lang": "python",
"repo": "GKernelCI/Gmeetbot",
"path": "/meetingLocalConfig.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GKernelCI/Gmeetbot path: /meetingLocalConfig.py
import re
from . import writers
class Config(object):
logFileDir = '/var/www/meetingology/logs/'
filenamePattern = '%(channel)s/%%Y/%(channel)s.%%F-%%H.%%M'
logUrlPrefix = 'https://ubottu.com/meetingology/logs/'
MeetBotInfoURL = 'h... | code_fim | medium | {
"lang": "python",
"repo": "GKernelCI/Gmeetbot",
"path": "/meetingLocalConfig.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """to show working elements"""
print("Shortest path between two nodes")
answer = connection.execute(connection.get_path, 0, 4)
for a in answer.values():
print(a)
print("Centrality closeness")
answer = connection.execute(connection.get_closeness, 1, True)
for a in answer... | code_fim | hard | {
"lang": "python",
"repo": "beoArcha/Graph_Connection",
"path": "/Graph_Connection/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beoArcha/Graph_Connection path: /Graph_Connection/main.py
#!/usr/bin/python3
from Graph_Connection.creator import Creator
from Graph_Connection.data_import import DataImport
from Graph_Connection.database import Database
from Graph_Connection.networking import Networking
from os import path
impor... | code_fim | hard | {
"lang": "python",
"repo": "beoArcha/Graph_Connection",
"path": "/Graph_Connection/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [
"__version__",
"get_tariff_rates",
"get_tou_times",
"calculate_charge",
"electricity_charges_general",
"electricity_charges_tou",
"electricity_charges_tou_demand",
"financial_year_ending",
"get_daily_usages",
"get_daily_charges",
"get_mont... | code_fim | hard | {
"lang": "python",
"repo": "aguinane/qld-tariffs",
"path": "/qldtariffs/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aguinane/qld-tariffs path: /qldtariffs/__init__.py
""" QLD Tariffs
Calculate the energy costs for QLD tariffs
"""
from .version import __version__
from .rates import get_tariff_rates
from .rates import get_tou_times
<|fim_suffix|>__all__ = [
"__version__",
"get_tariff_rates"... | code_fim | hard | {
"lang": "python",
"repo": "aguinane/qld-tariffs",
"path": "/qldtariffs/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Icelys/Slither path: /examples/bgTest.py
import slither, time, math
snakey = slither.Sprite()
snakey.setCostumeByName("costume0")
snakey.setYTo(360)
slither.slitherStage.setColor(40, 222, 40)
slither.slitherStage.addCostume("bg2.png", "bg")
slither.slitherStage.setCostumeByName("bg")
slither.set... | code_fim | easy | {
"lang": "python",
"repo": "Icelys/Slither",
"path": "/examples/bgTest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> global i
snakey.setXTo((math.sin(i) * 200) + 300)
i += 0.05
slither.runMainLoop(run_a_frame)<|fim_prefix|># repo: Icelys/Slither path: /examples/bgTest.py
import slither, time, math
snakey = slither.Sprite()
snakey.setCostumeByName("costume0")
snakey.setYTo(360)
slither.slitherStage.setColor... | code_fim | easy | {
"lang": "python",
"repo": "Icelys/Slither",
"path": "/examples/bgTest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while True:
print "Player %c" % player
x = self.get_input("Enter x-coordinate: ")
if x is None:
continue
y = self.get_input("Enter y-coordinate: ")
if y is None:
continue
try:
... | code_fim | hard | {
"lang": "python",
"repo": "NejcZupec/tictactoe",
"path": "/game/management/commands/play_game.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NejcZupec/tictactoe path: /game/management/commands/play_game.py
from django.core.management.base import BaseCommand
from game.game import Game
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'--first_player',
default='x',
... | code_fim | hard | {
"lang": "python",
"repo": "NejcZupec/tictactoe",
"path": "/game/management/commands/play_game.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattt416/rcbops-maas path: /rabbitmq_logs.py
import optparse
from maas_common import metric, status_ok, status_err
import elasticsearch
def search_for_loglevel(loglevel, index=None):
index = index or elasticsearch.most_recent_index()
query_string = 'ampq_{0} {1}'.format(loglevel.lower... | code_fim | medium | {
"lang": "python",
"repo": "mattt416/rcbops-maas",
"path": "/rabbitmq_logs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'hits' in errors:
status_ok()
metric('rabbitmq_logs_errors', 'uint32', errors['hits']['total'])
elif 'error' in errors:
status_err(errors['error'])
else:
status_err('Something went wrong searching for rabbitmq logs')
if 'hits' in warnings:
metric... | code_fim | hard | {
"lang": "python",
"repo": "mattt416/rcbops-maas",
"path": "/rabbitmq_logs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> errors = search_for_errors(options.index)
warnings = search_for_warnings(options.index)
if 'hits' in errors:
status_ok()
metric('rabbitmq_logs_errors', 'uint32', errors['hits']['total'])
elif 'error' in errors:
status_err(errors['error'])
else:
status_e... | code_fim | hard | {
"lang": "python",
"repo": "mattt416/rcbops-maas",
"path": "/rabbitmq_logs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CarlosWillian/python path: /exercicios/ex 071 a 080/ex075.py
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número: '))
n3 = int(input('Digite mais um número: '))
n4 = int(input('Digite o último número: '))
seq = (n1, n2, n3, n4)
print(f'Você digitou os valores {seq}')
print(... | code_fim | medium | {
"lang": "python",
"repo": "CarlosWillian/python",
"path": "/exercicios/ex 071 a 080/ex075.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if 3 not in seq:
print('O valor 3 não apareceu nenhuma vez')
else:
print(f'O valor 3 apareceu na {seq.index(3) + 1}ª posição')
print('Os valores pares digitados foram: ', end='')
for n in seq:
if n % 2 == 0:
print(n, end=' ')<|fim_prefix|># repo: CarlosWillian/python path: /exercicio... | code_fim | medium | {
"lang": "python",
"repo": "CarlosWillian/python",
"path": "/exercicios/ex 071 a 080/ex075.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('Os valores pares digitados foram: ', end='')
for n in seq:
if n % 2 == 0:
print(n, end=' ')<|fim_prefix|># repo: CarlosWillian/python path: /exercicios/ex 071 a 080/ex075.py
n1 = int(input('Digite um número: '))
n2 = int(input('Digite outro número: '))
n3 = int(input('Digite mais um nú... | code_fim | medium | {
"lang": "python",
"repo": "CarlosWillian/python",
"path": "/exercicios/ex 071 a 080/ex075.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return searched_list
def search_leaf_nodes_by_pattern(self, pattern, scope_pattern=False):
"""
Search leaf node by a given pattern.
Args:
pattern (Union[str, None]): The pattern of the node to search,
if None, return all node names.
... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindinsight",
"path": "/mindinsight/datavisual/data_transform/graph/msgraph.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mindspore-ai/mindinsight path: /mindinsight/datavisual/data_transform/graph/msgraph.py
ph.node_tree import NodeTree
from mindinsight.datavisual.proto_files.mindinsight_anf_ir_pb2 import DataType
from mindinsight.domain.graph.base import NodeTypeEnum, DebuggerSource
class MSGraph(Graph):
"""... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindinsight",
"path": "/mindinsight/datavisual/data_transform/graph/msgraph.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Build node tree.
Args:
root (NodeTree): Root node of node tree.
node_name (str): Node name.
node_type (str): Node type.
"""
scope_names = node_name.split('/')
cur_node = root
full_name = ""
for scope_n... | code_fim | hard | {
"lang": "python",
"repo": "mindspore-ai/mindinsight",
"path": "/mindinsight/datavisual/data_transform/graph/msgraph.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>rt TranslationStringFactory
TranslationString = TranslationStringFactory("hypothesis")<|fim_prefix|># repo: 11-eleven-11/h path: /h/i18n.py
# -*- coding: utf-8 -*-
from __future__ imp<|fim_middle|>ort unicode_literals
from pyramid.i18n impo | code_fim | easy | {
"lang": "python",
"repo": "11-eleven-11/h",
"path": "/h/i18n.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ing = TranslationStringFactory("hypothesis")<|fim_prefix|># repo: 11-eleven-11/h path: /h/i18n.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyramid.i18n impo<|fim_middle|>rt TranslationStringFactory
TranslationStr | code_fim | easy | {
"lang": "python",
"repo": "11-eleven-11/h",
"path": "/h/i18n.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 11-eleven-11/h path: /h/i18n.py
# -*- coding: utf-8 -*-
from __future__ imp<|fim_suffix|>rt TranslationStringFactory
TranslationString = TranslationStringFactory("hypothesis")<|fim_middle|>ort unicode_literals
from pyramid.i18n impo | code_fim | easy | {
"lang": "python",
"repo": "11-eleven-11/h",
"path": "/h/i18n.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: raikkon88/seguretat-p2 path: /bezoud.py
import random
from utils import generateRandomValue
from utils import getNumber
def bezoud(a, b):
# a i b > 0
# retorna per aquest ordre :
# mcd(a,b)
# a que ens han passat com entrada
# b que ens han passat com entrada
# Q Pot ser negatiu
# P P... | code_fim | hard | {
"lang": "python",
"repo": "raikkon88/seguretat-p2",
"path": "/bezoud.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> tmp = b
b = a % b
a = tmp
iteration += 1
if(iteration % 2 == 0):
pact *= -1
else:
qact *= -1
print("MCD : " + str(b))
print("Q_i : " + str(qact))
print("P_i : " + str(pact))
print("Moreover, ... : " + str(b) + " = " + str(qact) + ... | code_fim | hard | {
"lang": "python",
"repo": "raikkon88/seguretat-p2",
"path": "/bezoud.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return b, ina, inb, qact, pact
def bezoud_test():
print("algoritme d'euclides")
print("--------------------")
print("Entra si vols que s'autogenerin els numeros o si prefereixes entrar-los tu.")
print("- 0 -> Generats amb un nombre aleatori de 1 a " + str(digits) + " digits")
prin... | code_fim | hard | {
"lang": "python",
"repo": "raikkon88/seguretat-p2",
"path": "/bezoud.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cloudify-cosmo/cloudify-manager path: /rest-service/manager_rest/security/authentication.py
#########
# Copyright (c) 2013-2019 Cloudify Platform 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 ... | code_fim | medium | {
"lang": "python",
"repo": "cloudify-cosmo/cloudify-manager",
"path": "/rest-service/manager_rest/security/authentication.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Require that a user is authenticated"""
if not current_user.is_authenticated:
raise NoAuthProvided()
if current_user.is_locked or not current_user.active:
raise UnauthorizedError(
'Authentication failed for <User '
f'username=`{current_user.username}`... | code_fim | medium | {
"lang": "python",
"repo": "cloudify-cosmo/cloudify-manager",
"path": "/rest-service/manager_rest/security/authentication.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('security', '0009_auto_20180418_0912'),
]
operations = [
migrations.AlterField(
model_name='inputloggedrequest',
name='type',
field=models.PositiveSmallIntegerField(
choices=[(1, 'Common request'), (2, 'Thro... | code_fim | hard | {
"lang": "python",
"repo": "radimsuckr/django-security",
"path": "/security/migrations/0010_auto_20190710_1819.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: radimsuckr/django-security path: /security/migrations/0010_auto_20190710_1819.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-07-10 16:19
from __future__ import unicode_literals
<|fim_suffix|>
dependencies = [
('security', '0009_auto_20180418_0912'),
]
opera... | code_fim | hard | {
"lang": "python",
"repo": "radimsuckr/django-security",
"path": "/security/migrations/0010_auto_20190710_1819.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='inputloggedrequest',
name='type',
field=models.PositiveSmallIntegerField(
choices=[(1, 'Common request'), (2, 'Throttled request'), (3, 'Successful login request'),
(4... | code_fim | hard | {
"lang": "python",
"repo": "radimsuckr/django-security",
"path": "/security/migrations/0010_auto_20190710_1819.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> setup_logger()
assert logger.level == logging.DEBUG
assert len(logger.handlers) == 1
handler = logger.handlers[0]
assert isinstance(handler, logging.StreamHandler)
setup_logger()
assert len(logger.handlers) == 1
assert logger.handlers[0] is handler
handler = logging.N... | code_fim | medium | {
"lang": "python",
"repo": "yizhisec/delayed",
"path": "/tests/test_logger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> handler = logging.NullHandler()
set_handler(handler)
assert len(logger.handlers) == 1
assert logger.handlers[0] is handler<|fim_prefix|># repo: yizhisec/delayed path: /tests/test_logger.py
# -*- coding: utf-8 -*-
import logging
from delayed.logger import logger, set_handler, setup_logge... | code_fim | hard | {
"lang": "python",
"repo": "yizhisec/delayed",
"path": "/tests/test_logger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yizhisec/delayed path: /tests/test_logger.py
# -*- coding: utf-8 -*-
import logging
from delayed.logger import logger, set_handler, setup_logger
<|fim_suffix|> setup_logger()
assert len(logger.handlers) == 1
assert logger.handlers[0] is handler
handler = logging.NullHandler()
... | code_fim | hard | {
"lang": "python",
"repo": "yizhisec/delayed",
"path": "/tests/test_logger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>prediction = Predict_label(SUBMISSION_DATA_PATH,SAMPLE_SUBMISSION_PATH)
prediction.start(output_path=OUTPUT_PATH)<|fim_prefix|># repo: michelsn1/I2A2-User-Behavior-Challenge path: /main.py
from src.models.predict_model import Predict_label
### Argumentos com o caminho do datasets para predição
SUBMISSI... | code_fim | easy | {
"lang": "python",
"repo": "michelsn1/I2A2-User-Behavior-Challenge",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michelsn1/I2A2-User-Behavior-Challenge path: /main.py
from src.models.predict_model import Predict_label
<|fim_suffix|>prediction = Predict_label(SUBMISSION_DATA_PATH,SAMPLE_SUBMISSION_PATH)
prediction.start(output_path=OUTPUT_PATH)<|fim_middle|>### Argumentos com o caminho do datasets para pred... | code_fim | hard | {
"lang": "python",
"repo": "michelsn1/I2A2-User-Behavior-Challenge",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class MaxPooling(tf.keras.Model):
def call(self, x: Tuple[tf.Tensor, tf.Tensor, tf.Tensor]) -> tf.Tensor:
tri_fmap, tetra_fmap, penta_fmap = x
fmap = tf.concat([tf.reduce_max(tri_fmap, 1), tf.reduce_max(tetra_fmap, 1), tf.reduce_max(penta_fmap, 1)],
axis=-1)
... | code_fim | hard | {
"lang": "python",
"repo": "modudeepnlp/NLP_Tensorflow2.0",
"path": "/cnn_sm/model/ops.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class MaxPooling(tf.keras.Model):
def call(self, x: Tuple[tf.Tensor, tf.Tensor, tf.Tensor]) -> tf.Tensor:
tri_fmap, tetra_fmap, penta_fmap = x
fmap = tf.concat([tf.reduce_max(tri_fmap, 1), tf.reduce_max(tetra_fmap, 1), tf.reduce_max(penta_fmap, 1)],
axis=-1)
... | code_fim | hard | {
"lang": "python",
"repo": "modudeepnlp/NLP_Tensorflow2.0",
"path": "/cnn_sm/model/ops.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: modudeepnlp/NLP_Tensorflow2.0 path: /cnn_sm/model/ops.py
import tensorflow as tf
from tensorflow.keras import layers
import gluonnlp as nlp
from gluonnlp import Vocab
from typing import Tuple
class MultiChannelEmbedding(tf.keras.Model):
def __init__(self, vocab=Vocab):
<|fim_suffix|> ... | code_fim | hard | {
"lang": "python",
"repo": "modudeepnlp/NLP_Tensorflow2.0",
"path": "/cnn_sm/model/ops.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> res, resp = self.control.send('GWRS')
if not res or resp is None:
raise SSP_9081_Exception("no response")
return int(resp) == 1
def start(self):
return self.control.send('RUNP')
def stop(self):
return self.contro... | code_fim | hard | {
"lang": "python",
"repo": "maslovw/SSP-9081",
"path": "/ssp_9081/control.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def loadCSV(self, filename):
"""
loadCSV: format: step(1-10),voltage(0.0 - 36.40V),time(0s - 1200s)
Example:
1,12.0,5
2,2.4,10
"""
import csv
max_step = 2
ret = []
with open(file... | code_fim | hard | {
"lang": "python",
"repo": "maslovw/SSP-9081",
"path": "/ssp_9081/control.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maslovw/SSP-9081 path: /ssp_9081/control.py
from serial import Serial
from time import sleep
from ssp_9081.interfaces import SSP_9081_INTERFACE
import logging
class SSP_9081_Exception(Exception):
pass
class SSP_9081():
def __init__(self, interface: SSP_9081_INTERFACE, logLevel=logging... | code_fim | hard | {
"lang": "python",
"repo": "maslovw/SSP-9081",
"path": "/ssp_9081/control.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.