text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: FletcherS7/the-blue-alliance path: /controllers/suggestions/suggest_match_video_review_controller.py
from consts.account_permissions import AccountPermissions
from controllers.suggestions.suggestions_review_base_controller import SuggestionsReviewBaseController
from helpers.suggestions.match_sugg... | code_fim | medium | {
"lang": "python",
"repo": "FletcherS7/the-blue-alliance",
"path": "/controllers/suggestions/suggest_match_video_review_controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.template_values.update({
"suggestions_and_events": zip(suggestions, events),
})
self.response.out.write(jinja2_engine.render('suggestions/suggest_match_video_review_list.html', self.template_values))
def post(self):
accept_keys = []
reject_key... | code_fim | hard | {
"lang": "python",
"repo": "FletcherS7/the-blue-alliance",
"path": "/controllers/suggestions/suggest_match_video_review_controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kwoolter/Quarantine path: /quarantine/model/events.py
class Event():
# Event Types
DEBUG = "debug"
QUIT = "quit"
DEFAULT = "default"
STATE = "state"
GAME = "game"
WORLD = "world"
EFFECT = "effect"
CONTROL = "control"
# Define states
STATE_LOADED = "Ga... | code_fim | medium | {
"lang": "python",
"repo": "kwoolter/Quarantine",
"path": "/quarantine/model/events.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, name: str, description: str = None, type: str = DEFAULT):
self.name = name
self.description = description
self.type = type
def __str__(self):
return "{0}:{1} ({2})".format(self.name, self.description, self.type)<|fim_prefix|># repo: kwoolter/Quar... | code_fim | medium | {
"lang": "python",
"repo": "kwoolter/Quarantine",
"path": "/quarantine/model/events.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO: implement with ROOT_DIR4
if not os.path.exists(stocksCSV):
# create pickle files reference strings
pickSP500Stocks = os.path.join(str(ROOT_DIR4), "stocks_dfs/sp500tickers.pickle")
pickB3Stocks = os.path.join(str(ROOT_DIR4), "stocks_B3dfs/b3tickers.pickle")
#... | code_fim | hard | {
"lang": "python",
"repo": "Franklin-Siqueira/Python-Generic-lLab",
"path": "/app18/models/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Franklin-Siqueira/Python-Generic-lLab path: /app18/models/main.py
# Copyright 2021 Franklin Siqueira.
# SPDX-License-Identifier: Apache-2.0
'''
Created on Jul 13, 2019
@author: franklincarrilho
'''
from flask import Blueprint, render_template, request
import os
import sys
import requests
from p... | code_fim | hard | {
"lang": "python",
"repo": "Franklin-Siqueira/Python-Generic-lLab",
"path": "/app18/models/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: source3/djangocms-bootstrap path: /cmsplugin_bootstrap/buttons.py
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from cms.plugin_pool import plugin_pool
from cmsplugin_bootstrap.change_form_widgets import (ExtraStylesWidget, MultipleRadioButtonsWidget,
Multipl... | code_fim | medium | {
"lang": "python",
"repo": "source3/djangocms-bootstrap",
"path": "/cmsplugin_bootstrap/buttons.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = _("Button wrapper")
render_template = "cms/plugins/bootstrap/naked.html"
child_classes = ['LinkPlugin']
tag_type = 'naked'
css_class_choices = (('btn', 'btn'),)
extra_classes_widget = MultipleRadioButtonsWidget((
('buttontype', (('', 'unstyled'),) + tuple(2 * ('btn-%... | code_fim | medium | {
"lang": "python",
"repo": "source3/djangocms-bootstrap",
"path": "/cmsplugin_bootstrap/buttons.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ssword/',confirm_reset_password, name='confirm_reset_password'),
path('create_user/',create_user, name='create_user'),
path('list_user/',list_user, name='list_user'),
path('edit_user/<pk>',edit_user, name='edit_user'),
path('delete_user/<pk>',delete_user, name='delete_user'),
path... | code_fim | hard | {
"lang": "python",
"repo": "HenriqueLR/payments",
"path": "/app/accounts/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HenriqueLR/payments path: /app/accounts/urls.py
#encoding: utf-8
from django.urls import path, reverse_lazy
from accounts.views import (create_account, list_account,
active_account, edit_profile, edit_password,
detail_profile, reset_... | code_fim | hard | {
"lang": "python",
"repo": "HenriqueLR/payments",
"path": "/app/accounts/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_new_cutout(self, width, height, scale=None, **kwargs):
''' Get a new Image Cutout using Skyserver
Replaces the current Image with a new image cutout. The
data, header, and wcs attributes are updated accordingly.
Parameters:
width (int):
... | code_fim | hard | {
"lang": "python",
"repo": "sdss/marvin",
"path": "/python/marvin/tools/image.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sdss/marvin path: /python/marvin/tools/image.py
_future__ import absolute_import, division, print_function
import os
import sys
import warnings
import random
import itertools
import requests
import PIL
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.collections import EllipseC... | code_fim | hard | {
"lang": "python",
"repo": "sdss/marvin",
"path": "/python/marvin/tools/image.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.wcs is None:
raise MarvinError('No WCS found. Cannot overlay fibers.')
# check the diameter
if diameter:
assert isinstance(diameter, (float, int)), 'diameter must be a number'
diameter = (diameter or 2.0) / float(self.header['SCALE'])
... | code_fim | hard | {
"lang": "python",
"repo": "sdss/marvin",
"path": "/python/marvin/tools/image.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Setup method."""
super(TfTrtIntegrationTest, self).setUp()
warnings.simplefilter("always")
self._input = np.random.random_sample(INPUT_DIMS)
def _GetConfigProto(self,
use_optimizer,
precision_mode=None,
is_dynamic_op=N... | code_fim | hard | {
"lang": "python",
"repo": "zylo117/tensorflow-gpu-macosx",
"path": "/tensorflow/tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>TEST_GRAPHS = {
"SingleEngineGraph":
TestGraph(
gdef=GetSingleEngineGraphDef(),
num_expected_engines=1,
expected_output_dims=(100, 6, 6, 6)),
"MultiEngineGraph":
TestGraph(
gdef=GetMultiEngineGraphDef(),
num_expected_engin... | code_fim | hard | {
"lang": "python",
"repo": "zylo117/tensorflow-gpu-macosx",
"path": "/tensorflow/tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zylo117/tensorflow-gpu-macosx path: /tensorflow/tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... | code_fim | hard | {
"lang": "python",
"repo": "zylo117/tensorflow-gpu-macosx",
"path": "/tensorflow/tensorflow/contrib/tensorrt/test/tf_trt_integration_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Fak3/dpr-api path: /app/database.py
import boto3
import os
from os.path import join, dirname
from dotenv import load_dotenv
from botocore.client import Config
from flask_sqlalchemy import SQLAlchemy
dot_env_path = join(dirname(__file__), '../.env')
load_dotenv(dot_env_path)
<|fim_suffix|>s3 = b... | code_fim | hard | {
"lang": "python",
"repo": "Fak3/dpr-api",
"path": "/app/database.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>s3 = boto3.client('s3',
region_name=region,
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
config=Config(signature_version='s3v4'))<|fim_prefix|># repo: Fak3/dpr-api path: /app/database.py
import bo... | code_fim | hard | {
"lang": "python",
"repo": "Fak3/dpr-api",
"path": "/app/database.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangjiapengone/CS61A-Fall18 path: /labs/lab01/tests/truthiness.py
test = {
'name': 'Truthiness',
'points': 0,
'suites': [
{
'cases': [
{
'code': r"""
>>> 0 or True
5154670fa295caf18cafa4245c1358a9
# locked
>>> no... | code_fim | hard | {
"lang": "python",
"repo": "wangjiapengone/CS61A-Fall18",
"path": "/labs/lab01/tests/truthiness.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>,
'type': 'wwpp'
},
{
'cases': [
{
'code': r"""
>>> False or 1
f26f9ec9ba426ebfdd8a43b22c8c74a0
# locked
>>> '' or 1 and 1/0
d7b5fd49f83e4ee318af207fc969c9f4
# locked
>>> not 0 and 12 o... | code_fim | hard | {
"lang": "python",
"repo": "wangjiapengone/CS61A-Fall18",
"path": "/labs/lab01/tests/truthiness.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # locked
>>> not 0 and 12 or 0
d7069594fd949c78b4021fc7911322a4
# locked
""",
'hidden': False,
'locked': True
}
],
'scored': False,
'type': 'wwpp'
}
]
}<|fim_prefix|># repo: wangjiapengone/CS61A-... | code_fim | hard | {
"lang": "python",
"repo": "wangjiapengone/CS61A-Fall18",
"path": "/labs/lab01/tests/truthiness.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JuDFTteam/aiida-kkr path: /aiida_kkr/workflows/kkr_imp_sub.py
ons']
except:
self.ctx.warnings.append('cound not set isteps in KKR_steps_stats dict')
isteps = -1
try:
first_rms = self.ctx.last_rms_all[0]
last_rms = self.ctx.last_rms_... | code_fim | hard | {
"lang": "python",
"repo": "JuDFTteam/aiida-kkr",
"path": "/aiida_kkr/workflows/kkr_imp_sub.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return do_kkr_step
def update_kkrimp_params(self):
"""
update set of KKR parameters (check for reduced mixing, change of
mixing strategy, change of accuracy setting)
"""
decrease_mixing_fac = False
switch_agressive_mixing = False
switch... | code_fim | hard | {
"lang": "python",
"repo": "JuDFTteam/aiida-kkr",
"path": "/aiida_kkr/workflows/kkr_imp_sub.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.ctx.kkr_higher_accuracy:
qbound = self.ctx.convergence_criterion
else:
qbound = self.ctx.threshold_aggressive_mixing
# store some values in self.ctx.KKR_steps_stats
for name, val in {
'isteps': isteps,
'imix': self.ct... | code_fim | hard | {
"lang": "python",
"repo": "JuDFTteam/aiida-kkr",
"path": "/aiida_kkr/workflows/kkr_imp_sub.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(TestCLI, self).setUp()
def test_list_strategy_steps(self):
sample_step = StrategyStep(mock,
TEST_CLOUD_ID,
TEST_STAGE,
TEST_STATE,
TEST_DET... | code_fim | hard | {
"lang": "python",
"repo": "starlingx/distcloud-client",
"path": "/distributedcloud-client/dcmanagerclient/tests/v1/test_step_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> sample_step = StrategyStep(mock,
TEST_CLOUD_ID,
TEST_STAGE,
TEST_STATE,
TEST_DETAILS,
TEST_STARTED_AT,
... | code_fim | medium | {
"lang": "python",
"repo": "starlingx/distcloud-client",
"path": "/distributedcloud-client/dcmanagerclient/tests/v1/test_step_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: starlingx/distcloud-client path: /distributedcloud-client/dcmanagerclient/tests/v1/test_step_manager.py
# Copyright (c) 2017 Ericsson AB.
# Copyright (c) 2020-2021 Wind River Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | code_fim | hard | {
"lang": "python",
"repo": "starlingx/distcloud-client",
"path": "/distributedcloud-client/dcmanagerclient/tests/v1/test_step_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ahcode0919/python-ds-algorithms path: /data_structures/tests/test_singly_linked_list_node.py
from data_structures.singly_linked_list_node import SinglyLinkedListNode
def test_singly_linked_list_node():
<|fim_suffix|> node = SinglyLinkedListNode(1)
assert node.data == 1
assert not nod... | code_fim | medium | {
"lang": "python",
"repo": "ahcode0919/python-ds-algorithms",
"path": "/data_structures/tests/test_singly_linked_list_node.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> node = SinglyLinkedListNode(1)
assert node.data == 1
assert not node.next
node = SinglyLinkedListNode(1, SinglyLinkedListNode(2))
assert node.data == 1
assert node.next.data == 2<|fim_prefix|># repo: ahcode0919/python-ds-algorithms path: /data_structures/tests/test_singly_linked_... | code_fim | medium | {
"lang": "python",
"repo": "ahcode0919/python-ds-algorithms",
"path": "/data_structures/tests/test_singly_linked_list_node.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> row = {
'Address': lot['address_full'],
'Date Modified': lot['date_modified'],
'Latitude': lot['latitude'],
'Longitude': lot['longitude'],
'Lot Number': lot['lot_number'],
'Parcel ID': lot['parcel_i... | code_fim | hard | {
"lang": "python",
"repo": "lfucg/lfucg-exactions",
"path": "/lfucg-exactions/server/plats/views.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lfucg/lfucg-exactions path: /lfucg-exactions/server/plats/views.py
plat_name,
'Plat Type': plat_type,
'Total Exactions': total_exactions,
'Sewer Due': sewer,
'Non-Sewer Due': non_sewer,
'Sewer Trans.': sewer_trans,
... | code_fim | hard | {
"lang": "python",
"repo": "lfucg/lfucg-exactions",
"path": "/lfucg-exactions/server/plats/views.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lfucg/lfucg-exactions path: /lfucg-exactions/server/plats/views.py
ment in zip(range(payment_queryset.count()), payment_serializer.data):
headers.extend(['Payment Type -%s-%s' %((i+1), (j+1))])
headers.extend(['Roads Paid -%s-%s' %((i+1), (j... | code_fim | hard | {
"lang": "python",
"repo": "lfucg/lfucg-exactions",
"path": "/lfucg-exactions/server/plats/views.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(f'A soma dos números {n1} + {n2} = {soma}')
elif escolha == 2:
subtracao = n1 - n2
print(f'A subtração entre os números {n1} - {n2} = {subtracao}')
elif escolha == 3:
multiplicacao = n1 * n2
print(f'A multiplicação entre os números {n1} x {n2} = {multiplic... | code_fim | hard | {
"lang": "python",
"repo": "cristinamais/exercicios_python",
"path": "/Exercicios Loop/exercicio 47 - secao 06.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cristinamais/exercicios_python path: /Exercicios Loop/exercicio 47 - secao 06.py
"""
47 - Faça um programa que apresente um menu de opções para o cálculo das seguintes operações entre dois números:
Adicao (opção 1) ..subtracao (opção 2)... multiplicacao (opção 3).. divisao (opção 4).. saida (opçã... | code_fim | hard | {
"lang": "python",
"repo": "cristinamais/exercicios_python",
"path": "/Exercicios Loop/exercicio 47 - secao 06.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wapcaplet/readthedocs.org path: /api/base.py
from django.contrib.auth.models import User
from django.conf.urls.defaults import url
from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authentication import BasicAuthentication
from tastypie.authorization import Au... | code_fim | hard | {
"lang": "python",
"repo": "wapcaplet/readthedocs.org",
"path": "/api/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Creates a new resource/object with the provided data.
Calls ``obj_create`` with the provided data and returns a response
with the new resource's location.
If a new resource is created, return ``HttpCreated`` (201 Created).
"""
deserialized = se... | code_fim | hard | {
"lang": "python",
"repo": "wapcaplet/readthedocs.org",
"path": "/api/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mattsta/kapi-python path: /kapi/api_resources/abstract/ability.py
from kapi.api_resources.abstract.api_resource import APIResource, APIRequest
import logging
logger = logging.getLogger(__name__)
def parseResult(cls, result):
# Lists of documents become lists of objects
if isinstance(r... | code_fim | medium | {
"lang": "python",
"repo": "mattsta/kapi-python",
"path": "/kapi/api_resources/abstract/ability.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Listable(APIResource):
@classmethod
def list(cls, key=None, **kwargs):
req = APIRequest(key=key)
url = cls.genURL(**kwargs)
got = req.get(url)
return parseResult(cls, got.json())
class Fetchable(APIResource):
@classmethod
def fetch(cls, key=None, *... | code_fim | hard | {
"lang": "python",
"repo": "mattsta/kapi-python",
"path": "/kapi/api_resources/abstract/ability.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sR = scale(speedRight)
sL = scale(speedLeft)
b2 = b3 = b4 = b5 = 0
if speedRight < 0:
b2 = b'\x02' + bytes([sR])
b3 = b'\x03' + bytes([0])
else:
b2 = b'\x02' + bytes([0])
b3 = b'\x03' + bytes([sR])
if speedLeft < 0:
b4 = b'\x04' + bytes([sL])... | code_fim | hard | {
"lang": "python",
"repo": "OpenRoberta/openroberta-lab",
"path": "/OpenRobertaServer/src/test/resources/crossCompilerTests/_expected/robotSpecific/targetLanguage/joycar/sensor_line_follower_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: corani/sapcli path: /sap/adt/programs.py
"""SAP Programs in ADT functionality module"""
import urllib
# pylint: disable=unused-import
from sap.adt.objects import OrderedClassMembers
from sap.adt.objects import ADTObjectType, ADTObject, ADTCoreData, ADTObjectSourceEditor, xmlns_adtcore_ancestor
... | code_fim | hard | {
"lang": "python",
"repo": "corani/sapcli",
"path": "/sap/adt/programs.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._ref = ADTCoreData.Reference()
@xml_element('program:ref')
def reference(self):
"""Returns reference"""
return self._ref
def __init__(self, connection, name, package=None, metadata=None):
super(Program, self).__init__(connection, name... | code_fim | hard | {
"lang": "python",
"repo": "corani/sapcli",
"path": "/sap/adt/programs.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_encrypt(mocker):
mocker.patch.object(demisto, 'args', return_value={'message': 'testing message'})
encrypt, _ = encrypt_email_body(client, {})
assert 'MIME-Version: 1.0\nContent-Disposition: attachment; filename="smime.p7m"\n' \
'Content-Type: application/x-pkcs7-mime; sm... | code_fim | hard | {
"lang": "python",
"repo": "demisto/content",
"path": "/Packs/SMIME_Messaging/Integrations/SMIME_Messaging/SMIME_Messaging_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: demisto/content path: /Packs/SMIME_Messaging/Integrations/SMIME_Messaging/SMIME_Messaging_test.py
import pytest
from SMIME_Messaging import Client, sign_email, encrypt_email_body, verify, decrypt_email_body, sign_and_encrypt,\
decode_str
import demistomock as demisto
with open('./test_data... | code_fim | hard | {
"lang": "python",
"repo": "demisto/content",
"path": "/Packs/SMIME_Messaging/Integrations/SMIME_Messaging/SMIME_Messaging_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ned21/aquilon path: /lib/aquilon/worker/templates/resource.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2011-2019 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this fi... | code_fim | hard | {
"lang": "python",
"repo": "ned21/aquilon",
"path": "/lib/aquilon/worker/templates/resource.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> pan_assign(lines, "justification", self.dbobj.reason)
self.body_intervention(lines)
def body_service_address(self, lines):
pan_assign(lines, "ip", str(self.dbobj.ip))
pan_assign(lines, "fqdn", str(self.dbobj.dns_record))
if self.dbobj.interfaces:
pa... | code_fim | hard | {
"lang": "python",
"repo": "ned21/aquilon",
"path": "/lib/aquilon/worker/templates/resource.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.profile = PlenaryHostObject.template_name(holder_object)
elif isinstance(holder_object, Cluster):
# Avoid circular dependency
from aquilon.worker.templates import PlenaryClusterObject
self.profile = PlenaryClusterObject.template_name(holder_obj... | code_fim | hard | {
"lang": "python",
"repo": "ned21/aquilon",
"path": "/lib/aquilon/worker/templates/resource.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_country_knows_answer_status_given_questionnaire(self):
self.assertEqual(AnswerStatus.options[None], self.uganda.answer_status())
answer = NumericalAnswer.objects.create(question=self.question2, country=self.uganda,
status=Answer.... | code_fim | hard | {
"lang": "python",
"repo": "eJRF/ejrf",
"path": "/questionnaire/tests/models/test_locations_model.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eJRF/ejrf path: /questionnaire/tests/models/test_locations_model.py
from questionnaire.models import Questionnaire, Section, QuestionGroup, Question, SubSection, Answer, NumericalAnswer
from questionnaire.models.answers import AnswerStatus, TextAnswer
from questionnaire.models.locations import Re... | code_fim | hard | {
"lang": "python",
"repo": "eJRF/ejrf",
"path": "/questionnaire/tests/models/test_locations_model.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_gets_versions_for_a__list_of_questionnaires(self):
answer = NumericalAnswer.objects.create(question=self.question2, country=self.uganda,
status=Answer.SUBMITTED_STATUS,
response=22, questio... | code_fim | hard | {
"lang": "python",
"repo": "eJRF/ejrf",
"path": "/questionnaire/tests/models/test_locations_model.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gammasoft71/Examples_Python path: /tkinter/FolderBrowserDialog/FolderBrowserDialog.py
#!/usr/bin/env python3
# -*-coding:utf-8 -*
import os
import platform
import tkinter
import tkinter.filedialog
import tkinter.ttk
<|fim_suffix|> self.label = tkinter.ttk.Label(self.frame, text='Path = ')
... | code_fim | hard | {
"lang": "python",
"repo": "gammasoft71/Examples_Python",
"path": "/tkinter/FolderBrowserDialog/FolderBrowserDialog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.geometry('300x300+200+100')
self.title('FolderBrowser example')
def main(self=None):
form = Form1()
form.mainloop()
def OnButtonClick(self):
directory = tkinter.filedialog.askdirectory(initialdir=os.path.join(os.environ['HOMEPATH' if platform.system() == 'Windows' else 'HOME... | code_fim | hard | {
"lang": "python",
"repo": "gammasoft71/Examples_Python",
"path": "/tkinter/FolderBrowserDialog/FolderBrowserDialog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def OnButtonClick(self):
directory = tkinter.filedialog.askdirectory(initialdir=os.path.join(os.environ['HOMEPATH' if platform.system() == 'Windows' else 'HOME'], 'Desktop'))
if directory:
self.label['text'] = 'Path = {}'.format(directory)
if __name__ == '__main__':
Form1.main()<|fim_pr... | code_fim | medium | {
"lang": "python",
"repo": "gammasoft71/Examples_Python",
"path": "/tkinter/FolderBrowserDialog/FolderBrowserDialog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fertigkeiten = Hilfsmethoden.FertStr2Array(self.ui.fertigkeitenEdit.text(),None)
self.fertigkeitenValid = True
for fertigkeit in fertigkeiten:
if not fertigkeit in self.datenbank.fertigkeiten and not fertigkeit in self.datenbank.übernatürlicheFertigkeiten:
... | code_fim | hard | {
"lang": "python",
"repo": "jooert/Sephrasto",
"path": "/DatenbankEditTalentWrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def nameChanged(self):
name = self.ui.nameEdit.text()
fertigkeiten = Hilfsmethoden.FertStr2Array(self.ui.fertigkeitenEdit.text(),None)
if name == "":
self.ui.nameEdit.setToolTip("Name darf nicht leer sein.")
self.ui.nameEdit.setStyleSheet("border: 1px so... | code_fim | hard | {
"lang": "python",
"repo": "jooert/Sephrasto",
"path": "/DatenbankEditTalentWrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jooert/Sephrasto path: /DatenbankEditTalentWrapper.py
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 18 11:04:21 2017
@author: Aeolitus
"""
import Fertigkeiten
from Hilfsmethoden import Hilfsmethoden, VoraussetzungException
import DatenbankEditTalent
from PyQt5 import QtWidgets, QtCore
class Da... | code_fim | hard | {
"lang": "python",
"repo": "jooert/Sephrasto",
"path": "/DatenbankEditTalentWrapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RetailMeNotSandbox/dart path: /src/python/dart/engine/emr/add_sub_graphs.py
import logging
import os
from dart.client.python.dart_client import Dart
from dart.config.config import configuration
from dart.engine.emr.metadata import EmrActionTypes
from dart.model.action import Action, ActionData, A... | code_fim | hard | {
"lang": "python",
"repo": "RetailMeNotSandbox/dart",
"path": "/src/python/dart/engine/emr/add_sub_graphs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> subgraph_definitions = [
SubGraphDefinition(data=SubGraphDefinitionData(
name='consume_subscription_workflow',
description='Add to a datastore to create entities for loading a dataset on an ongoing basis',
engine_name='emr_engine',
related_type=E... | code_fim | hard | {
"lang": "python",
"repo": "RetailMeNotSandbox/dart",
"path": "/src/python/dart/engine/emr/add_sub_graphs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> engine_id = None
for e in dart.get_engines():
if e.data.name == 'emr_engine':
engine_id = e.id
if not engine_id:
raise
subgraph_definitions = [
SubGraphDefinition(data=SubGraphDefinitionData(
name='consume_subscription_workflow',
... | code_fim | hard | {
"lang": "python",
"repo": "RetailMeNotSandbox/dart",
"path": "/src/python/dart/engine/emr/add_sub_graphs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_agencies_by_slug_endpoint(self):
"""Test grabbing an agency by their ID."""
# Grab the Agency.
federal_agency = self.federal_client.agency_by_id(
agency_slug='antitrust-modernization-commission'
)
# Make sure we have a response.
se... | code_fim | hard | {
"lang": "python",
"repo": "fagan2888/us-federal-register-python-api",
"path": "/tests/test_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Make sure we have a response.
self.assertIsNotNone(suggested_searches)
# And make sure the Slug matches.
self.assertEqual(
suggested_searches['slug'],
'accountable-care-organizations'
)
def test_documents_detailed_search_endpoint(self... | code_fim | hard | {
"lang": "python",
"repo": "fagan2888/us-federal-register-python-api",
"path": "/tests/test_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fagan2888/us-federal-register-python-api path: /tests/test_client.py
import unittest
from unittest import TestCase
from configparser import ConfigParser
from federal_register.client import FederalRegister
class FederalRegisterSession(TestCase):
"""Will perform a unit test for the `Federal... | code_fim | hard | {
"lang": "python",
"repo": "fagan2888/us-federal-register-python-api",
"path": "/tests/test_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#plot balances ##needs aesthetics -- plots should be moved out of functions in future versions
def plot_balance(bal_df):
plt.plot(bal_df["date"], bal_df["balance"])
plt.title("*Account* balance by date") ##make variable?
plt.xlabel("Date")
plt.ylabel("Balance ($)")
fig = plt.figu... | code_fim | hard | {
"lang": "python",
"repo": "jmlammert/tut_finance_code",
"path": "/fin_script_v1.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>#read files and clean dataframes
cheq_dfs = read_files(cheq_dir, cheq_cols)
sav_dfs = read_files(sav_dir, sav_cols)
cred_dfs = read_files(cred_dir, cred_cols)
#clean/combine dataframes
cheq_df = clean_dfs(cheq_dfs)
sav_df = clean_dfs(sav_dfs)
cred_df = clean_dfs(cred_dfs)
#record balances
che... | code_fim | hard | {
"lang": "python",
"repo": "jmlammert/tut_finance_code",
"path": "/fin_script_v1.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmlammert/tut_finance_code path: /fin_script_v1.py
##INSTRUCTIONS
##place this script in a folder containing separate folders for each account
##download .csv files of transactions for each account (e.g., chequing, savings, credit)
##start by getting downloading data "for all time", then updat... | code_fim | hard | {
"lang": "python",
"repo": "jmlammert/tut_finance_code",
"path": "/fin_script_v1.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tensorflow path: /tensorflow/python/debug/lib/check_numerics_callback_test.py
n_nn_ops
from tensorflow.python.ops import gradient_checker_v2
from tensorflow.python.ops import math_grad # pylint: disable=unused-import
from tensorflow.python.ops import math_ops
from tensorflow.python.op... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/debug/lib/check_numerics_callback_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/tensorflow path: /tensorflow/python/debug/lib/check_numerics_callback_test.py
.framework import errors
from tensorflow.python.framework import ops
from tensorflow.python.framework import test_util
from tensorflow.python.ops import array_grad # pylint: disable=unused-import
from tensor... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/debug/lib/check_numerics_callback_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check the content of the error message.
self.assertTrue(re.search(r"graph op.*\"RealDiv\"", message))
self.assertTrue(re.search(r"dtype.*float64", message))
self.assertIn("shape: ()\n", message)
self.assertIn("Input tensors (2):", message)
# Check that the correct input ops are p... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/tensorflow",
"path": "/tensorflow/python/debug/lib/check_numerics_callback_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ### commands auto generated by Alembic - please adjust! ###
op.add_column('gameversion', sa.Column('game_id', sa.Integer(), nullable=True))
op.create_foreign_key('gameversion_game_id_fkey', 'gameversion', 'game', ['game_id'], ['id'])
op.add_column('mod', sa.Column('game_id', sa.Integer(), ... | code_fim | medium | {
"lang": "python",
"repo": "ModulousSmash/ModulousNext",
"path": "/alembic/versions/4e0500347ce7_add_multigame_tables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ModulousSmash/ModulousNext path: /alembic/versions/4e0500347ce7_add_multigame_tables.py
"""add multigame tables
Revision ID: 4e0500347ce7
Revises: 29344aa34d9
Create Date: 2016-04-05 23:51:58.647657
"""
# revision identifiers, used by Alembic.
revision = '4e0500347ce7'
down_revision = '29344aa... | code_fim | medium | {
"lang": "python",
"repo": "ModulousSmash/ModulousNext",
"path": "/alembic/versions/4e0500347ce7_add_multigame_tables.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mmokko/aoc2017 path: /test_maze.py
from unittest import TestCase
from day5 import Maze
<|fim_suffix|> def test_find_way_out_if_maze_with_optional_incr(self):
sut = Maze([0, 3, 0, 1, -3])
sut.use_optional_increment = True
self.assertEqual(10, sut.find_way_out())<|fim_m... | code_fim | hard | {
"lang": "python",
"repo": "mmokko/aoc2017",
"path": "/test_maze.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_find_way_out_of_maze(self):
sut = Maze([0, 3, 0, 1, -3])
self.assertEqual(5, sut.find_way_out())
def test_find_way_out_if_maze_with_optional_incr(self):
sut = Maze([0, 3, 0, 1, -3])
sut.use_optional_increment = True
self.assertEqual(10, sut.find_wa... | code_fim | medium | {
"lang": "python",
"repo": "mmokko/aoc2017",
"path": "/test_maze.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> sut = Maze([])
self.assertEqual(0, sut.find_way_out())
def test_find_way_out_of_maze(self):
sut = Maze([0, 3, 0, 1, -3])
self.assertEqual(5, sut.find_way_out())
def test_find_way_out_if_maze_with_optional_incr(self):
sut = Maze([0, 3, 0, 1, -3])
su... | code_fim | easy | {
"lang": "python",
"repo": "mmokko/aoc2017",
"path": "/test_maze.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from math import hypot
l0 = float(input('Digite o Cateto Adjacente: '))
l1 = float(input('Digite o Cateto Oposto: '))
print('A Hipotenusa desse triângulo é {:.2f}'.format(hypot(l0, l1)))<|fim_prefix|># repo: thomas-rohde/Classes-Python path: /exercises/exe11 - 20/exe015.py
'''Calcula a hip com base em pi... | code_fim | medium | {
"lang": "python",
"repo": "thomas-rohde/Classes-Python",
"path": "/exercises/exe11 - 20/exe015.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thomas-rohde/Classes-Python path: /exercises/exe11 - 20/exe015.py
'''Calcula a hip com base em pit'''
'''from math import sqrt, pow
print('Digite os lados do triângulo retangulo:')
print('-' * 39)
l0 = float(input('Digite o 1º lado(co): '))
l1 = float(input('Digite o 2º lado(ca): '))
<|fim_suff... | code_fim | medium | {
"lang": "python",
"repo": "thomas-rohde/Classes-Python",
"path": "/exercises/exe11 - 20/exe015.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>TPJs = glob.glob('*TPJ_thresholded/*img')
TPJdict = {k:{} for k in ['L','R']}
for tpj in TPJs:
hemi = tpj[0]
surf = 'pial_left' if hemi=='L' else 'pial_right'
img = nilearn.image.load_img(tpj)
texture = np.round(surface.vol_to_surf(img, fsaverage[surf]))
TPJdict[hemi]['TPJ'] = np.where(texture==1)[0... | code_fim | hard | {
"lang": "python",
"repo": "samsydco/HBN",
"path": "/TPJ_check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samsydco/HBN path: /TPJ_check.py
#!/usr/bin/env python3
# check for TPJ / parcel overlap
# must run in conda env: new_nilearn
# needs nilearn version: 0.8.1
<|fim_suffix|>fsaverage = datasets.fetch_surf_fsaverage(mesh='fsaverage6')
TPJs = glob.glob('*TPJ_thresholded/*img')
TPJdict = {k:{} for... | code_fim | medium | {
"lang": "python",
"repo": "samsydco/HBN",
"path": "/TPJ_check.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adnapibar/ms-research-thesis path: /code/lstm_large_scale.py
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from keras.layers.core import Dense, Activation, Dropout
from keras.layers.recurrent import LSTM
from keras.models import Sequential
from sklearn.metrics... | code_fim | hard | {
"lang": "python",
"repo": "adnapibar/ms-research-thesis",
"path": "/code/lstm_large_scale.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def mean_absolute_percentage_error(y_true, y_pred):
return np.mean(np.abs((y_true - y_pred) / y_true)) * 100
def print_scores(y_test, predicted):
y_test_tp = np.transpose(y_test)
pred_tp = np.transpose(predicted)
mae = []
mse = []
mape = []
for i in range(2):
actual ... | code_fim | hard | {
"lang": "python",
"repo": "adnapibar/ms-research-thesis",
"path": "/code/lstm_large_scale.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def print_scores(y_test, predicted):
y_test_tp = np.transpose(y_test)
pred_tp = np.transpose(predicted)
mae = []
mse = []
mape = []
for i in range(2):
actual = y_test_tp[i]
predictions = pred_tp[i]
actual = (actual * maxs[i]) + means[i]
predictions ... | code_fim | hard | {
"lang": "python",
"repo": "adnapibar/ms-research-thesis",
"path": "/code/lstm_large_scale.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def group_shot_data_by_game_team(shots):
"""
Groups shot data by game and team using the globally defined shot zones
and target types.
"""
grouped_shot_data = dict()
# definining zones
zones = ['slot', 'left', 'right', 'blue_line', 'neutral_zone', 'behind_goal']
for shot ... | code_fim | hard | {
"lang": "python",
"repo": "leaffan/del_stats",
"path": "/backend/get_del_team_game_stats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leaffan/del_stats path: /backend/get_del_team_game_stats.py
'shots_unblocked_pp',
'shots_unblocked_sh', 'shots_on_goal_ev', 'shots_on_goal_5v5',
'shots_on_goal_pp', 'shots_on_goal_sh', 'goals_5v5', 'hit_post']
# retrieving shot data for current game and team
... | code_fim | hard | {
"lang": "python",
"repo": "leaffan/del_stats",
"path": "/backend/get_del_team_game_stats.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for period in events_data:
for event in events_data[period]:
if event['type'] != 'goal':
continue
# fixing penalty shots erroneously identified as power play goals
if event['data']['balance'] == 'PP0':
event['data']['balance']... | code_fim | hard | {
"lang": "python",
"repo": "leaffan/del_stats",
"path": "/backend/get_del_team_game_stats.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> story = Story.query.get_or_404(story_id)
if story:
for upvote in story.upvotes:
db.session.delete(upvote)
db.session.delete(story)
db.session.commit()
flash('成功删除故事')
else:
flash('无故事可删除')
return redirect(url_for('admin.audit'))<|fim_pref... | code_fim | hard | {
"lang": "python",
"repo": "Fansion/gushi",
"path": "/gushi/controllers/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Fansion/gushi path: /gushi/controllers/admin.py
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template, redirect, url_for, request, session, flash
from flask.ext.login import login_user, logout_user, login_required
from ..models import db, Upvote, Story, User
from ..decorators im... | code_fim | hard | {
"lang": "python",
"repo": "Fansion/gushi",
"path": "/gushi/controllers/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gabrielf10/webAmpunc path: /sistema/admin.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from django.contrib import admin
from django.db.models import Sum
from nested_inline.admin import NestedStackedInline, NestedModelAdmin
from .models import DetalleFactura, F... | code_fim | hard | {
"lang": "python",
"repo": "gabrielf10/webAmpunc",
"path": "/sistema/admin.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> list_display = ('nombre',)
list_filter = ('nombre',)
#este funciona mostrar el importe pero no me funciona en el inline dentro de Factura si lo soluciono
#en DetalleFacturaInline esta clase desaparece
@admin.register(DetalleFactura)
class AdminDetalleFactura(admin.ModelAdmin):
model = DetalleFactura
... | code_fim | hard | {
"lang": "python",
"repo": "gabrielf10/webAmpunc",
"path": "/sistema/admin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> NA = 1
BIAS = 2
BIAS_RELU = 3
BIAS_RELU_ADD = 4
class FuncEnum(Enum):
"""
Elementwise func enum.
"""
ADD = 1
SUB = 2
MUL = 3
DIV = 4
TANH = 5
COS = 6
SIN = 7
SIGN = 8
ABS = 9
LOGE = 10
EXP = 11
SQRT = 12
MAX = 13
MIN = ... | code_fim | medium | {
"lang": "python",
"repo": "facebookincubator/AITemplate",
"path": "/python/aitemplate/compiler/ops/common/epilogue.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebookincubator/AITemplate path: /python/aitemplate/compiler/ops/common/epilogue.py
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# 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 ... | code_fim | medium | {
"lang": "python",
"repo": "facebookincubator/AITemplate",
"path": "/python/aitemplate/compiler/ops/common/epilogue.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ADD = 1
SUB = 2
MUL = 3
DIV = 4
TANH = 5
COS = 6
SIN = 7
SIGN = 8
ABS = 9
LOGE = 10
EXP = 11
SQRT = 12
MAX = 13
MIN = 14
SIGMOID = 15
LRELU = 16
HARDTANH = 17
RELU = 18
NAN_TO_NUM = 19
CLAMP_NAN_TO_NUM = 20
SILU = 21
P... | code_fim | medium | {
"lang": "python",
"repo": "facebookincubator/AITemplate",
"path": "/python/aitemplate/compiler/ops/common/epilogue.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def export_serial_model(model,layer_names,save_dir):
network = collections.OrderedDict()
for l in layer_names:
if "output" in l:
break
network[l] = collections.OrderedDict()
layer = tflearn.variables.get_layer_variables_by_name(l)
if "lstm" in l:
... | code_fim | hard | {
"lang": "python",
"repo": "ichalkiad/tRustNN",
"path": "/src/parameter_persistence.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ichalkiad/tRustNN path: /src/parameter_persistence.py
import tensorflow as tf
import numpy as np
import collections
import tflearn
import json
import pickle
def export_serial_lstm_data(model,layer_outputs,feed,input_files,data="lstm",save_dir="/tmp/",save_mode="json"):
# data="lstm" for LSTM dat... | code_fim | hard | {
"lang": "python",
"repo": "ichalkiad/tRustNN",
"path": "/src/parameter_persistence.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: health20houston/medform.me path: /app/controllers/patient.py
from bottle import view, route, request
from model.model import *
from app.decorators.security import *
from model.model import *
@route("/dashboard")
@view("patient_dashboard")
@patientAccount
def patientDashboard(viewData):
return ... | code_fim | hard | {
"lang": "python",
"repo": "health20houston/medform.me",
"path": "/app/controllers/patient.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> viewData["medicalHisotryGroups"] = MedicalHistoryGroup.query.all()
#reload patient object to prevent lazyLoad exception with .medicalHistory
viewData["patient"] = Patient.get_by(id=viewData["patient"].id)
viewData["familyHistories"] = FamilyHistory.query.all()
viewData["surgeries"] = Surgery.query.a... | code_fim | hard | {
"lang": "python",
"repo": "health20houston/medform.me",
"path": "/app/controllers/patient.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> viewData["surgeries"] = Surgery.query.all()
viewData["allergies"] = Allergy.query.all()
return viewData
@route("/api/patient/getcode")
@patientAccount
def api_patientGetCode(viewData):
#
# Create a patient code. If we have an active code
# that isn't expired go grab it.
#
code = PatientCode.gener... | code_fim | hard | {
"lang": "python",
"repo": "health20houston/medform.me",
"path": "/app/controllers/patient.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asmlgkj/sentieon-google-genomics path: /runner/tool_yaml_to_pipeline_json.py
#!/usr/bin/env python
from __future__ import print_function
import yaml
import copy
import os
import json
def add_to_yaml(a, b, ignore_keys=set(("name", "description", "PIPELINE"))):
'''
If an object is in b b... | code_fim | hard | {
"lang": "python",
"repo": "asmlgkj/sentieon-google-genomics",
"path": "/runner/tool_yaml_to_pipeline_json.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>out_yaml = copy.deepcopy(germline)
if tn:
add_to_yaml(out_yaml, tn)
out_json = {}
for param in out_yaml["inputParameters"]:
k = param["name"]
if "defaultValue" not in param:
v = None
elif param["defaultValue"] == "None":
v = None
else:
v = param["defaultValue"]
... | code_fim | hard | {
"lang": "python",
"repo": "asmlgkj/sentieon-google-genomics",
"path": "/runner/tool_yaml_to_pipeline_json.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slarson/ncmir-semantic-sandbox path: /slarson/pywikipedia/families/wesolve_family.py
# -*- coding: utf-8 -*-
import urllib
import family, wikipedia
# The wikimedia family that is known as Wesolve
class UploadDisabled(wikipedia.Error):
"""Uploads are disabled on this wiki"""
class Family(... | code_fim | hard | {
"lang": "python",
"repo": "slarson/ncmir-semantic-sandbox",
"path": "/slarson/pywikipedia/families/wesolve_family.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ('/wsiwiki/index.php?title=%s:Movepage&action=submit' %
self.special_namespace_url(code))
def delete_address(self, code, name):
return '/wsiwiki/index.php?title=%s&action=delete' % name
def version_history_address(self, code, name):
return ('/wsiwik... | code_fim | hard | {
"lang": "python",
"repo": "slarson/ncmir-semantic-sandbox",
"path": "/slarson/pywikipedia/families/wesolve_family.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def move_address(self, code):
return ('/wsiwiki/index.php?title=%s:Movepage&action=submit' %
self.special_namespace_url(code))
def delete_address(self, code, name):
return '/wsiwiki/index.php?title=%s&action=delete' % name
def version_history_address(self, cod... | code_fim | hard | {
"lang": "python",
"repo": "slarson/ncmir-semantic-sandbox",
"path": "/slarson/pywikipedia/families/wesolve_family.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pangeamt/nectm path: /tools/mosesdecoder-master/scripts/training/bilingual-lm/create_blm_ini.py
#!/usr/bin/env python
#
# This file is part of moses. Its use is licensed under the GNU Lesser General
# Public License version 2.1 or, at your option, any later version.
import argparse
import os
im... | code_fim | hard | {
"lang": "python",
"repo": "Pangeamt/nectm",
"path": "/tools/mosesdecoder-master/scripts/training/bilingual-lm/create_blm_ini.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.