text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def __repr__(self): record = AttendanceCodes.query.filter_by(id = cid).first() return "<attendance_record uid=%s cid=%s>" % (self.uid, record.cid) @classmethod def count(self, user): if isinstance(user, int): uid = user else: uid = user.id return self.query.filter_by...
code_fim
hard
{ "lang": "python", "repo": "CS-Center/CS-Center", "path": "/wcics/database/models/attendance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CS-Center/CS-Center path: /wcics/database/models/attendance.py # -*- coding: utf-8 -*- from ..consts.attendance import ATTENDANCE_CODE_MAX_LENGTH from .aliases import * from .helper import Helper from wcics.utils.time import get_time from wcics.utils.url import get_org_id class attendance_cod...
code_fim
hard
{ "lang": "python", "repo": "CS-Center/CS-Center", "path": "/wcics/database/models/attendance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlsendian/nessus-report-parser path: /nessus_report_parser/model/report.py from collections import UserDict from lxml import etree from .report_host import ReportHost class Report(UserDict): <|fim_suffix|> assert isinstance(properties, dict) self.data = properties @staticm...
code_fim
medium
{ "lang": "python", "repo": "mlsendian/nessus-report-parser", "path": "/nessus_report_parser/model/report.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Report(UserDict): def __init__(self, properties): assert isinstance(properties, dict) self.data = properties @staticmethod def from_etree(elem): assert isinstance(elem, etree._Element) assert elem.tag == 'Report' properties = { 'name'...
code_fim
medium
{ "lang": "python", "repo": "mlsendian/nessus-report-parser", "path": "/nessus_report_parser/model/report.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FFMG/myoddweb.piger path: /myodd/boost/libs/python/config/cxx.py # # Copyright (c) 2016 Stefan Seefeld # All rights reserved. # # Distributed under the Boost Software License, Version 1.0. # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "FFMG/myoddweb.piger", "path": "/myodd/boost/libs/python/config/cxx.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> context.Message('Checking for C++11 support...') if not context.TryCompile(source, '.cpp'): context.env['CXX11'] = False context.Result(0) else: context.env['CXX11'] = True context.Result(1) return True<|fim_prefix|># repo: FFMG/myoddweb.piger path: /myodd...
code_fim
medium
{ "lang": "python", "repo": "FFMG/myoddweb.piger", "path": "/myodd/boost/libs/python/config/cxx.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> T=transition_matrix.transition_matrix_non_reversible(self.C1).toarray() assert_allclose(T, self.T1.toarray()) if __name__=="__main__": unittest.main()<|fim_prefix|># repo: kziolkowska/PyEMMA path: /pyemma/msm/estimation/sparse/transition_matrix_test.py import unittest ...
code_fim
medium
{ "lang": "python", "repo": "kziolkowska/PyEMMA", "path": "/pyemma/msm/estimation/sparse/transition_matrix_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kziolkowska/PyEMMA path: /pyemma/msm/estimation/sparse/transition_matrix_test.py import unittest import numpy as np from pyemma.util.numeric import assert_allclose import scipy.sparse import transition_matrix """Unit tests for the transition_matrix module""" class TestTransitionMatrixNonRever...
code_fim
hard
{ "lang": "python", "repo": "kziolkowska/PyEMMA", "path": "/pyemma/msm/estimation/sparse/transition_matrix_test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_count_matrix(self): """Small test cases""" T=transition_matrix.transition_matrix_non_reversible(self.C1).toarray() assert_allclose(T, self.T1.toarray()) T=transition_matrix.transition_matrix_non_reversible(self.C1).toarray() assert_allclose(T, ...
code_fim
hard
{ "lang": "python", "repo": "kziolkowska/PyEMMA", "path": "/pyemma/msm/estimation/sparse/transition_matrix_test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument( '--use_mixer', type=int, default=0, # 1 help='Use schedule sampling') parser.add_argument( '--mixer_from', type=int, default=-1, help='If -1, then an annealing scheme will be used, based on mixer_descrease_every.\...
code_fim
hard
{ "lang": "python", "repo": "meunal/Attributes_SVO_Video_Captioning", "path": "/opts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: meunal/Attributes_SVO_Video_Captioning path: /opts.py import argparse # set for MSR-VTT defaults def parse_opts(): parser = argparse.ArgumentParser() parser.add_argument( '--dataset', type=str, default='msvd', choices=[ 'msvd', 'm...
code_fim
hard
{ "lang": "python", "repo": "meunal/Attributes_SVO_Video_Captioning", "path": "/opts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BCCWAI/Konverter path: /konverter/__main__.py from tensorflow import keras from konverter import Konverter import typer def main(input_model:str, output_script:str, indentation:int=2, verbose:bool=True, use_watermark:bool=True): model = keras.models.load_model(input_model) konverter = Konve...
code_fim
easy
{ "lang": "python", "repo": "BCCWAI/Konverter", "path": "/konverter/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = keras.models.load_model(input_model) konverter = Konverter(model, output_file=output_script, indent_spaces=indentation, verbose=verbose, use_watermark=use_watermark) def run(): typer.run(main) if __name__ == '__main__': run()<|fim_prefix|># repo: BCCWAI/Konverte...
code_fim
medium
{ "lang": "python", "repo": "BCCWAI/Konverter", "path": "/konverter/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aroodooteam/azxts path: /aro_account_fiscalyear_close/models/base_agency.py # -*- coding: utf-8 -*- import logging logger = logging.getLogger(__name__) from . import agency_account as agac from openerp import api, exceptions, fields, models, _ <|fim_suffix|> account_ids = fields.One2many(co...
code_fim
medium
{ "lang": "python", "repo": "aroodooteam/azxts", "path": "/aro_account_fiscalyear_close/models/base_agency.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> account_obj = self.env['account.account'] agac_obj = self.env['base.agency.account'] agac_ids = agac_obj.search([('agency_id', '=', self.id)]) agac_ids.unlink() for k,v in agac.ALL_AGENCY.iteritems(): if k[-2:] == self.code: for account i...
code_fim
medium
{ "lang": "python", "repo": "aroodooteam/azxts", "path": "/aro_account_fiscalyear_close/models/base_agency.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhouronghua/daisycloud-core path: /code/daisy/daisy/db/sqlalchemy/migrate_repo/versions/001_add_daisy_tables.py ), primary_key=True, nullable=False), Column('role_id', String(36), ForeignKey('roles.id'), n...
code_fim
hard
{ "lang": "python", "repo": "zhouronghua/daisycloud-core", "path": "/code/daisy/daisy/db/sqlalchemy/migrate_repo/versions/001_add_daisy_tables.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def define_dns_nameservers_table(meta): dns_nameservers = Table('dns_nameservers', meta, Column('id', String(36), primary_key=True, nullable=False), Column('dns', String(128)), ...
code_fim
hard
{ "lang": "python", "repo": "zhouronghua/daisycloud-core", "path": "/code/daisy/daisy/db/sqlalchemy/migrate_repo/versions/001_add_daisy_tables.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def make_ethereum_address() -> ChecksumEthAddress: return to_checksum_address('0x' + make_random_bytes(20).hex()) UNIT_BTC_ADDRESS1 = '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2' UNIT_BTC_ADDRESS2 = '1CounterpartyXXXXXXXXXXXXXXXUWLpVr' UNIT_BTC_ADDRESS3 = '18ddjB7HWTVxzvTbLp1nWvaBxU3U2oTZF2' ZERO_ETH_ADDRE...
code_fim
hard
{ "lang": "python", "repo": "tuanggo/rotki", "path": "/rotkehlchen/tests/utils/factories.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tuanggo/rotki path: /rotkehlchen/tests/utils/factories.py import base64 import random import string from typing import Optional from eth_utils.address import to_checksum_address from rotkehlchen.fval import FVal from rotkehlchen.serialization.deserialize import deserialize_ethereum_address from...
code_fim
medium
{ "lang": "python", "repo": "tuanggo/rotki", "path": "/rotkehlchen/tests/utils/factories.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def make_random_positive_fval(max_num: int = 1000000) -> FVal: return FVal(random.uniform(0, max_num)) def make_random_timestamp( start: Optional[Timestamp] = DEFAULT_START_TS, end: Optional[Timestamp] = None, ) -> Timestamp: if end is None: end = ts_now() if start is...
code_fim
hard
{ "lang": "python", "repo": "tuanggo/rotki", "path": "/rotkehlchen/tests/utils/factories.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheNikomo/PiMorse path: /run.py #!/usr/bin/env python3 import control from morse import morse <|fim_suffix|> for character in userinput: signals = morse[character.upper()] for signal in signals: print(signal, end="", flush=True) control.blink(signal) ...
code_fim
medium
{ "lang": "python", "repo": "TheNikomo/PiMorse", "path": "/run.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for character in userinput: signals = morse[character.upper()] for signal in signals: print(signal, end="", flush=True) control.blink(signal) print()<|fim_prefix|># repo: TheNikomo/PiMorse path: /run.py #!/usr/bin/env python3 import control from morse impo...
code_fim
medium
{ "lang": "python", "repo": "TheNikomo/PiMorse", "path": "/run.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nevoband/ansible-role-firewalld path: /molecule/default/tests/test_default.py import os import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') <|fim_suffix|> content = [ "<ser...
code_fim
hard
{ "lang": "python", "repo": "nevoband/ansible-role-firewalld", "path": "/molecule/default/tests/test_default.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> content = [ "<service name=\"http\"/>", "<port protocol=\"tcp\" port=\"4444\"/>", "<port protocol=\"tcp\" port=\"80\"/>", "<source address=\"127.0.0.1\"/>" ] file = host.file("/etc/firewalld/zones/public.xml") assert file.exists for line in content: ...
code_fim
medium
{ "lang": "python", "repo": "nevoband/ansible-role-firewalld", "path": "/molecule/default/tests/test_default.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def main(excel_workbook_name): validate_workbook(excel_workbook_name) loader = ExcelTestLoader() tests = loader.load_tests_from_workbook(excel_workbook_name) test_runner = TextTestRunner(verbosity=1, failfast=None, buff...
code_fim
hard
{ "lang": "python", "repo": "dataunit/dataunit", "path": "/dataunit/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> validate_workbook(excel_workbook_name) loader = ExcelTestLoader() tests = loader.load_tests_from_workbook(excel_workbook_name) test_runner = TextTestRunner(verbosity=1, failfast=None, buffer=None, ...
code_fim
hard
{ "lang": "python", "repo": "dataunit/dataunit", "path": "/dataunit/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dataunit/dataunit path: /dataunit/main.py from argparse import ArgumentParser from unittest.runner import TextTestRunner from dataunit.excel.loader import ExcelTestLoader from dataunit.excel.validator import validate_workbook def parse_args(argv: list): parser = ArgumentParser() parser....
code_fim
hard
{ "lang": "python", "repo": "dataunit/dataunit", "path": "/dataunit/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eBioKit/ebiokit-site path: /server/applications/migrations/0005_application_raw_options.py # -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-10-24 11:04 from __future__ import unicode_literals from django.db import migrations, models <|fim_suffix|> dependencies = [ ('appl...
code_fim
easy
{ "lang": "python", "repo": "eBioKit/ebiokit-site", "path": "/server/applications/migrations/0005_application_raw_options.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='application', name='raw_options', field=models.CharField(default=b'', max_length=2000), ), ]<|fim_prefix|># repo: eBioKit/ebiokit-site path: /server/applications/migrations/0005_application_raw_opt...
code_fim
medium
{ "lang": "python", "repo": "eBioKit/ebiokit-site", "path": "/server/applications/migrations/0005_application_raw_options.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('applications', '0004_task_incompatible'), ] operations = [ migrations.AddField( model_name='application', name='raw_options', field=models.CharField(default=b'', max_length=2000), ...
code_fim
easy
{ "lang": "python", "repo": "eBioKit/ebiokit-site", "path": "/server/applications/migrations/0005_application_raw_options.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Enables the pile-up correction for jets in a PF2PAT+PAT sequence to be called after the usePF2PAT function. """ enablePileUpCorrectionInPF2PAT( process, postfix, sequence) enablePileUpCorrectionInPAT( process, postfix, sequence)<|fim_prefix|># repo: cms-sw/cmssw path: /Common...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/CommonTools/ParticleFlow/python/Tools/enablePileUpCorrection.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> jetCorrFactors = getattr(process,"patJetCorrFactors"+postfix) # using non-pileup-charged-hadron-substracted kt6PFJets consistently with JetMET recommendation jetCorrFactors.rho = cms.InputTag("fixedGridRhoFastjetAll") def enablePileUpCorrection( process, postfix, sequence='patPF2PATSequence'...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/CommonTools/ParticleFlow/python/Tools/enablePileUpCorrection.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw path: /CommonTools/ParticleFlow/python/Tools/enablePileUpCorrection.py import FWCore.ParameterSet.Config as cms def enablePileUpCorrectionInPF2PAT( process, postfix, sequence='PF2PAT'): """ Modifies the PF2PAT sequence according to the recipe of JetMET: """ # pile u...
code_fim
hard
{ "lang": "python", "repo": "cms-sw/cmssw", "path": "/CommonTools/ParticleFlow/python/Tools/enablePileUpCorrection.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ericmjl/protein-systematic-characterization path: /src/apps/mutagenesis.py from calculators import mutagenesis as mt from flask import Flask, render_template, request import numpy as np import math app = Flask(__name__) mut_freq_mass = dict(low=500, med=100, high=50) mut_freq_fold = dict(low=5...
code_fim
medium
{ "lang": "python", "repo": "ericmjl/protein-systematic-characterization", "path": "/src/apps/mutagenesis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Access the necessary variables. target_mass = mut_freq_mass[mut_freq] fold_amp = mut_freq_fold[mut_freq] # Compute what needs to be computed. input_mass = mt.input_plasmid_mass(target_len, plasmid_len, target_mass) input_volume = mt.input_volume(input_mass, input_conc) num_c...
code_fim
hard
{ "lang": "python", "repo": "ericmjl/protein-systematic-characterization", "path": "/src/apps/mutagenesis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> subparsers = parser.add_subparsers(title='commands') dl_all = subparsers.add_parser('download_all', help='generate queries & download') dl_all.set_defaults(func=download_all) dl = subparsers.add_parser('download', help='create/generat...
code_fim
hard
{ "lang": "python", "repo": "Jonnyblacklabel/gsc_sa_downloader", "path": "/gsc_sa_downloader/gsc_sa_downloader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for job in tqdm(list(jobs), desc='jobs', leave=False): queue = db.get_query_queue_items(property_['id'], job['id'], finished = False, attempts = {'<=': 5}) thread_queue_ite...
code_fim
hard
{ "lang": "python", "repo": "Jonnyblacklabel/gsc_sa_downloader", "path": "/gsc_sa_downloader/gsc_sa_downloader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jonnyblacklabel/gsc_sa_downloader path: /gsc_sa_downloader/gsc_sa_downloader.py # _ __ __ __ __ __ __ # (_)___ ____ ____ __ __/ /_ / /___ ______/ /__/ /___ _/ /_ ___ / / # / / __ \/ __ \/ __ \/ / / / __ \/ / __ `/ ___/ //_/...
code_fim
hard
{ "lang": "python", "repo": "Jonnyblacklabel/gsc_sa_downloader", "path": "/gsc_sa_downloader/gsc_sa_downloader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not product: abort(404, description="The product with the product ID does not exist") product_json = { "id": product.id, "title": product.title, "description": product.description, "price": product.price, "image_url": product.image_url, } ...
code_fim
hard
{ "lang": "python", "repo": "SaiMounikaP/lcc-ecommerce-api", "path": "/endpoints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SaiMounikaP/lcc-ecommerce-api path: /endpoints.py from flask import Blueprint, abort, jsonify import crud from db import SessionLocal bp = Blueprint("endpoints", __name__, url_prefix="/") @bp.get("/categories") def read_categories(): db_session = SessionLocal() categories = crud.get_c...
code_fim
hard
{ "lang": "python", "repo": "SaiMounikaP/lcc-ecommerce-api", "path": "/endpoints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rows = [] # append header row (from sessions table). rows.append([request, format_timestamp(started_at), coordinator, 0]) # append main rows (from events table). for activity, event_id, source, source_elapsed in events: rows.append([activity, format_time...
code_fim
hard
{ "lang": "python", "repo": "lalithsuresh/cassandra-c3", "path": "/pylib/cqlshlib/tracing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lalithsuresh/cassandra-c3 path: /pylib/cqlshlib/tracing.py # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this fi...
code_fim
hard
{ "lang": "python", "repo": "lalithsuresh/cassandra-c3", "path": "/pylib/cqlshlib/tracing.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ arte_plus_7 main function """ opts = parser().parse_args() if opts.verbose: LOGGER.setLevel(logging.DEBUG) # Get programs if opts.url: programs = [Plus7Program.by_url(opts.url)] elif opts.program: programs = ArtePlus7.program(opts.program) elif opts...
code_fim
hard
{ "lang": "python", "repo": "cladmi/arte_plus7", "path": "/arte_plus7.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cladmi/arte_plus7 path: /arte_plus7.py #! /usr/bin/python # -*- coding:utf-8 -*- """ arte_plus_7 is a script to help download arte videos It's only configured for French at the moment. Usage: The following commands will return the videos urls found # The generic program page ./arte_pl...
code_fim
hard
{ "lang": "python", "repo": "cladmi/arte_plus7", "path": "/arte_plus7.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Download the video.""" url = self.urls[quality] directory = directory or '.' dl_name = '{name}_{quality}.mp4' dl_name = dl_name.format(name=self.full_name, quality=quality) dl_name = os.path.join(directory, dl_name) cmd = ['wget', '--continue',...
code_fim
hard
{ "lang": "python", "repo": "cladmi/arte_plus7", "path": "/arte_plus7.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: juliencombattelli/BE-RDS path: /tp1/grasp.py #!/usr/bin/ipython import numpy as np from robot import Robot from scipy.optimize import fmin_bfgs, fmin_slsqp import pinocchio as se3 from pinocchio.utils import * import time from FootSteps import * robot = Robot() i = 0 <|fim_suffix|>''' # Optimi...
code_fim
hard
{ "lang": "python", "repo": "juliencombattelli/BE-RDS", "path": "/tp1/grasp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.nfeval = 1 def __call__(self,x): print '===CBK=== {0:4d} {1: 3.6f} {2: 3.6f}'.format(self.nfeval, x[0], x[1], cost(x)) self.nfeval += 1 robot.display(robot.q0) q = robot.q0 for i in range(0,20): # Optimize cost without any constraints in BFGS, with traces. try: xopt_bfgs = fmin_bfgs...
code_fim
hard
{ "lang": "python", "repo": "juliencombattelli/BE-RDS", "path": "/tp1/grasp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GoogleCloudPlatform/cloud-opensource-python path: /compatibility_server/views.py # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # htt...
code_fim
medium
{ "lang": "python", "repo": "GoogleCloudPlatform/cloud-opensource-python", "path": "/compatibility_server/views.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># docker error DOCKER_ERROR_MEASURE = measure_module.MeasureInt( 'docker_error', 'The number of docker errors.', 'Errors') DOCKER_ERROR_VIEW = view_module.View( "docker_error_count", "The number of the docker errors", [], DOCKER_ERROR_MEASURE, aggregation_module.CountAggregation())...
code_fim
medium
{ "lang": "python", "repo": "GoogleCloudPlatform/cloud-opensource-python", "path": "/compatibility_server/views.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: helq/pytropos path: /tests/inputs/lists-tuples/outputs/10-list-test-store.py from pytropos.internals.values.builtin_values import * from pytropos.internals.values.python_values import PythonValue as PV <|fim_suffix|>store = { '_': PV.top(), 'c': PV.top(), 'b': PV.top(), 'a': PV.t...
code_fim
easy
{ "lang": "python", "repo": "helq/pytropos", "path": "/tests/inputs/lists-tuples/outputs/10-list-test-store.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>store = { '_': PV.top(), 'c': PV.top(), 'b': PV.top(), 'a': PV.top(), }<|fim_prefix|># repo: helq/pytropos path: /tests/inputs/lists-tuples/outputs/10-list-test-store.py from pytropos.internals.values.builtin_values import * from pytropos.internals.values.python_values import PythonValue ...
code_fim
easy
{ "lang": "python", "repo": "helq/pytropos", "path": "/tests/inputs/lists-tuples/outputs/10-list-test-store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sampling_rate = 1 / pq.s spiketrains = [neo.SpikeTrain([1, 5, 9, 11, 13, 20] * pq.s, t_stop=21*pq.s), neo.SpikeTrain([1, 4, 7, 12, 16, 18] * pq.s, t_stop=21*pq.s)] correct_annotatio...
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/elephant", "path": "/elephant/test/test_spike_train_synchrony.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NeuralEnsemble/elephant path: /elephant/test/test_spike_train_synchrony.py ue) self.assertEqual(synchrony, max(trace.synchrony)) self.assertEqual(len(trace.contrast), len(trace.active_spiketrains)) self.assertEqual(len(trace.active_spiketrains), len(trace.synchrony)) ...
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/elephant", "path": "/elephant/test/test_spike_train_synchrony.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> spiketrains = [neo.SpikeTrain([1, 5, 9, 11, 13, 20] * pq.s, t_stop=21*pq.s), neo.SpikeTrain([1, 4, 7, 12, 16, 18] * pq.s, t_stop=21*pq.s)] correct_annotations = np.array([[2, 2, 1, 3, 3, 1],...
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/elephant", "path": "/elephant/test/test_spike_train_synchrony.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> model, num_epochs, train_loader, valid_loader, test_loader, optimizer, device, logging_interval=50, best_model_save_path=None, scheduler=None, skip_train_acc=False, scheduler_on='valid_acc'): start_time = time.time() minibatch_loss_list, tra...
code_fim
hard
{ "lang": "python", "repo": "ashishpatel26/deeplearning-models", "path": "/pytorch_ipynb/helper_train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return log_dict def train_classifier_simple_v2( model, num_epochs, train_loader, valid_loader, test_loader, optimizer, device, logging_interval=50, best_model_save_path=None, scheduler=None, skip_train_acc=False, scheduler_on='valid_acc'): ...
code_fim
hard
{ "lang": "python", "repo": "ashishpatel26/deeplearning-models", "path": "/pytorch_ipynb/helper_train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ashishpatel26/deeplearning-models path: /pytorch_ipynb/helper_train.py from helper_evaluate import compute_accuracy from helper_evaluate import compute_epoch_loss import time import torch import torch.nn.functional as F from collections import OrderedDict import json import subprocess import sy...
code_fim
hard
{ "lang": "python", "repo": "ashishpatel26/deeplearning-models", "path": "/pytorch_ipynb/helper_train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> clf_ecg = pickle.load(open('/home/a/stress_classifier/classifier_for_ecg.p','rb')) predicted = clf_ecg.predict_proba(fm) df = pd.DataFrame(index = np.arange(0, len(data['timestamp'].values)), columns=['user', 'timestamp', 'stress_probability']) user = data['user'].values[0] for c in r...
code_fim
medium
{ "lang": "python", "repo": "aungkonazim/CerebralCortex-Kernel_archived", "path": "/cerebralcortex/algorithms/stress_prediction/stress_prediction.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: aungkonazim/CerebralCortex-Kernel_archived path: /cerebralcortex/algorithms/stress_prediction/stress_prediction.py # Copyright (c) 2017, MD2K Center of Excellence # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided t...
code_fim
hard
{ "lang": "python", "repo": "aungkonazim/CerebralCortex-Kernel_archived", "path": "/cerebralcortex/algorithms/stress_prediction/stress_prediction.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if os.path.exists('HIRES_history2b.csv'): os.remove('HIRES_history2b.csv') with open('HIRES_history2b.csv', 'w') as OFO: for line in lines: OFO.write('{}\n'.format(line.encode('utf-8').decode())) if __name__ == '__main__': # main() fix_csv()<|fim_prefi...
code_fim
hard
{ "lang": "python", "repo": "joshwalawender/KeckUtilities", "path": "/HIRES-history/instrument_history.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: joshwalawender/KeckUtilities path: /HIRES-history/instrument_history.py from __future__ import division, print_function ## Import General Tools import sys import os from astropy.table import Table, Column import matplotlib.pyplot as plt import matplotlib as mpl mpl.rcParams['font.size'] = 24 ...
code_fim
hard
{ "lang": "python", "repo": "joshwalawender/KeckUtilities", "path": "/HIRES-history/instrument_history.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> with open('HIRES_history2.csv', 'r') as FO: contents = FO.read() lines = contents.split('\n') if os.path.exists('HIRES_history2b.csv'): os.remove('HIRES_history2b.csv') with open('HIRES_history2b.csv', 'w') as OFO: for line in lines: OFO.write('{}\n'.f...
code_fim
hard
{ "lang": "python", "repo": "joshwalawender/KeckUtilities", "path": "/HIRES-history/instrument_history.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyccel/pyccel path: /tests/epyccel/test_arrays_multiple_assignments.py # pylint: disable=missing-function-docstring, missing-module-docstring import os import sys import warnings import pytest from pyccel.epyccel import epyccel from pyccel.decorators import stack_array from pyccel.errors.errors ...
code_fim
hard
{ "lang": "python", "repo": "pyccel/pyccel", "path": "/tests/epyccel/test_arrays_multiple_assignments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @stack_array('x') def f(): import numpy as np for i in range(3): x = np.ones(i, dtype=int) return x.sum() # Initialize singleton that stores Pyccel errors errors = Errors() # epyccel should raise an Exception with pytest.raises(PyccelSemanticE...
code_fim
hard
{ "lang": "python", "repo": "pyccel/pyccel", "path": "/tests/epyccel/test_arrays_multiple_assignments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def Finalize(self): super().Finalize() self._CalculateVolumes() def _CalculateVolumes(self): spheres_mp = self.model.GetModelPart('SpheresPart') fluid_mp = self.model.GetModelPart('FluidModelPart') # Adding up DEM particles' volume and making sure it is no...
code_fim
hard
{ "lang": "python", "repo": "KratosMultiphysics/Kratos", "path": "/applications/SwimmingDEMApplication/tests/tests_python_scripts/backward_coupling_scripts/backward_coupling_test_analysis.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: KratosMultiphysics/Kratos path: /applications/SwimmingDEMApplication/tests/tests_python_scripts/backward_coupling_scripts/backward_coupling_test_analysis.py import KratosMultiphysics as Kratos from KratosMultiphysics import Parameters import KratosMultiphysics.SwimmingDEMApplication.swimming_DEM_...
code_fim
hard
{ "lang": "python", "repo": "KratosMultiphysics/Kratos", "path": "/applications/SwimmingDEMApplication/tests/tests_python_scripts/backward_coupling_scripts/backward_coupling_test_analysis.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: savander10/AdviseMe path: /adviseme-database/Build/create.py from subprocess import call <|fim_suffix|>call(["node", "DatabaseBuildFiles/create_db.js"]) call(["node", "DatabaseBuildFiles/insert_student.js"]) call(["node", "DatabaseBuildFiles/insert_appointment.js"]) call(["python3", "Database...
code_fim
easy
{ "lang": "python", "repo": "savander10/AdviseMe", "path": "/adviseme-database/Build/create.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>call(["node", "DatabaseBuildFiles/create_db.js"]) call(["node", "DatabaseBuildFiles/insert_student.js"]) call(["node", "DatabaseBuildFiles/insert_appointment.js"]) call(["python3", "DatabaseBuildFiles/insert.py"])<|fim_prefix|># repo: savander10/AdviseMe path: /adviseme-database/Build/create.py from s...
code_fim
easy
{ "lang": "python", "repo": "savander10/AdviseMe", "path": "/adviseme-database/Build/create.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # sub-method to generate all permutations generate(list(S), 0, len(S) - 1) # sort the list of permutations generated result.sort() return result # Complexity Analysis # Time Complexity: O(N * N!), where N is the length of input string. # Space Complexity: O(N) wh...
code_fim
hard
{ "lang": "python", "repo": "htrahddis-hub/DSA-Together-HacktoberFest", "path": "/strings/Easy/permutations_of_a_string.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: htrahddis-hub/DSA-Together-HacktoberFest path: /strings/Easy/permutations_of_a_string.py # Link : https://practice.geeksforgeeks.org/problems/permutations-of-a-given-string2041/1 # Approach # To generate permutations of a string, we start with one particular index and try to swap # this index wi...
code_fim
hard
{ "lang": "python", "repo": "htrahddis-hub/DSA-Together-HacktoberFest", "path": "/strings/Easy/permutations_of_a_string.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print "Pull from remote repo" repo.remotes.origin.pull() # TODO: Add checking that git stash apply worked ok if stashed: git.stash("apply") if migration: os.system( "python {0} --mode=test db upgrade -d {1}".format( MANAGE_COLLECTOR, DB_MIGR...
code_fim
hard
{ "lang": "python", "repo": "fuel-infra/puppet-manifests", "path": "/modules/fuel_stats/files/github-poller.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # TODO: Add checking that git stash apply worked ok if stashed: git.stash("apply") if migration: os.system( "python {0} --mode=test db upgrade -d {1}".format( MANAGE_COLLECTOR, DB_MIGRATION ) ) os.system("sudo service uwsgi re...
code_fim
medium
{ "lang": "python", "repo": "fuel-infra/puppet-manifests", "path": "/modules/fuel_stats/files/github-poller.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fuel-infra/puppet-manifests path: /modules/fuel_stats/files/github-poller.py #!/usr/bin/python from git import * import re import os REPO_LOCAL = os.environ.get("REPO_LOCAL", "") if re.match("^~", REPO_LOCAL): REPO_LOCAL = os.path.expanduser(REPO_LOCAL) REPO_LOCAL = os.path.abspath(REPO_LOC...
code_fim
hard
{ "lang": "python", "repo": "fuel-infra/puppet-manifests", "path": "/modules/fuel_stats/files/github-poller.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: futursolo/hiyori path: /hiyori/connection.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright 2021 Kaede Hoshikawa # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of ...
code_fim
hard
{ "lang": "python", "repo": "futursolo/hiyori", "path": "/hiyori/connection.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self._idle_timer is not None: self._idle_timer.cancel() self._idle_timer = None async def get_ready(self) -> None: self._cancel_idle_timeout() if self.closing(): raise RuntimeError("This connection is closing.") if ( ...
code_fim
hard
{ "lang": "python", "repo": "futursolo/hiyori", "path": "/hiyori/connection.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> field_names = Parameter._get_field_names(csvreader.fieldnames, accepted_field_names) if field_names['param_name'] is None: warn('No param name column was found, could not load parameter') return param_dict if field_names['mechanism'] is ...
code_fim
hard
{ "lang": "python", "repo": "MaheshJethalia/BioCRNPyler", "path": "/biocrnpyler/parameter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.name = name.strip() self.param_type = param_type.strip() self.comment = comment.strip() # Set the value of the parameter if debug: print("%s [%s] = %s" % (self.name, self.param_type, value)) if param_type.strip() == 'Numeric': s...
code_fim
hard
{ "lang": "python", "repo": "MaheshJethalia/BioCRNPyler", "path": "/biocrnpyler/parameter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MaheshJethalia/BioCRNPyler path: /biocrnpyler/parameter.py # parameter.py - parameter processing # RMM, 19 Aug 2018 # # This file contains the Parameter class that is used for representing # parameters, as well as utility functions for manipulating # parameters. # # Copyright (c) 2018, Build-A-Ce...
code_fim
hard
{ "lang": "python", "repo": "MaheshJethalia/BioCRNPyler", "path": "/biocrnpyler/parameter.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: webclinic017/investtrack path: /investors/migrations/0068_auto_20200626_1124.py # Generated by Django 3.0.7 on 2020-06-26 03:24 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterField( model_name='tradestrategy', name='appl...
code_fim
medium
{ "lang": "python", "repo": "webclinic017/investtrack", "path": "/investors/migrations/0068_auto_20200626_1124.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('investors', '0067_auto_20200625_2224'), ] operations = [ migrations.AlterField( model_name='tradestrategy', name='applied_period', field=models.CharField(blank=True, choices=[('30', '30分钟'), ('D', '日线'), ('15', '15分钟'), ('...
code_fim
medium
{ "lang": "python", "repo": "webclinic017/investtrack", "path": "/investors/migrations/0068_auto_20200626_1124.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='BigTen', fields=[ ('name', models.CharField(db_index=True, max_length=45, primary_key=True, serialize=False, unique=True)), ('created', models.DateTimeField(auto_now_add=True)), ...
code_fim
hard
{ "lang": "python", "repo": "5h3rr1ll/Goodbuy", "path": "/goodbuyDatabase/migrations/0002_bigten.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: 5h3rr1ll/Goodbuy path: /goodbuyDatabase/migrations/0002_bigten.py # Generated by Django 3.0.1 on 2020-02-20 09:58 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('goodbuyDatabase', '0001_initial'), ] operations = [ migrations.CreateModel( ...
code_fim
hard
{ "lang": "python", "repo": "5h3rr1ll/Goodbuy", "path": "/goodbuyDatabase/migrations/0002_bigten.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: lensvol/pypiece path: /pypiece/pypiece.py # coding: utf-8 import click import os import subprocess class VenvNotFoundError(Exception): pass class PipNotFoundError(Exception): pass def fatal(msg, **kwargs): txt = msg.format(**kwargs) click.echo(click.style(txt, fg="red")) ...
code_fim
hard
{ "lang": "python", "repo": "lensvol/pypiece", "path": "/pypiece/pypiece.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with click.progressbar(lines, label="Processing packages", bar_template="%(label)s [%(bar)s] %(info)s", item_show_func=show_item, show_eta=False, ...
code_fim
hard
{ "lang": "python", "repo": "lensvol/pypiece", "path": "/pypiece/pypiece.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linneudm/sysnut path: /sysnut/core/views.py # -*- coding: utf-8 -*- from django.shortcuts import render from django.contrib.auth import login #from sysnut.settings import * # Página inicial def index(request): return render(request, 'index.html') def instructions(request): return render(req...
code_fim
medium
{ "lang": "python", "repo": "linneudm/sysnut", "path": "/sysnut/core/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def page_not_found(request): response = render_to_response('404.html', {}, context_instance=RequestContext(request)) response.status_code = 404 return response<|fim_prefix|># repo: linneudm/sysnut path: /sysnut/core/views.py # -*- coding: utf-8 -*- from dja...
code_fim
hard
{ "lang": "python", "repo": "linneudm/sysnut", "path": "/sysnut/core/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gslmota/Programs-PYTHON path: /Exercícios/Mundo 3/Projeto/projeto.py from lib.interface import * from lib.arquivo import * from time import sleep arquivo = 'projeto.txt' if not arqExiste(arquivo): criarArq(arquivo) cabecalho('Sistema Ar<|fim_suffix|>lif resposta == 3: cabecalho('Sain...
code_fim
hard
{ "lang": "python", "repo": "gslmota/Programs-PYTHON", "path": "/Exercícios/Mundo 3/Projeto/projeto.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>2: cabecalho('Novo Cadastro') nome = str(input('Digite o nome: ')) idade = leiaInt('Digite a idade: ') cadastrar(arquivo, nome, idade) elif resposta == 3: cabecalho('Saindo do Sistema!') break else: print('\033[31m ERRO: Por favor digite uma ...
code_fim
medium
{ "lang": "python", "repo": "gslmota/Programs-PYTHON", "path": "/Exercícios/Mundo 3/Projeto/projeto.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class DjopConfig(AppConfig): """ Application configuration for DJango Object Permission """ name = 'djop'<|fim_prefix|># repo: blenq/djop path: /djop/apps.py """ Application configuration for DJango Object Permission """ <|fim_middle|>from django.apps import AppConfig
code_fim
easy
{ "lang": "python", "repo": "blenq/djop", "path": "/djop/apps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: blenq/djop path: /djop/apps.py """ Application configuration for DJango Object Permission """ <|fim_suffix|>class DjopConfig(AppConfig): """ Application configuration for DJango Object Permission """ name = 'djop'<|fim_middle|>from django.apps import AppConfig
code_fim
easy
{ "lang": "python", "repo": "blenq/djop", "path": "/djop/apps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rodluger/paper path: /src/figures/infer_sigma.py # --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.13.0 # kernelspec: # display_name: Python 3 (i...
code_fim
hard
{ "lang": "python", "repo": "rodluger/paper", "path": "/src/figures/infer_sigma.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>init = { "log_sigma": 0.5 * np.log(np.median(sample_variance)), "log_k": np.log(np.sqrt(sample_variance)), } guide = numpyro.infer.autoguide.AutoNormal( model, init_loc_fn=numpyro.infer.init_to_value(values=init) ) optimizer = numpyro.optim.Adam(step_size=1e-3) svi = numpyro.infer.SVI( mod...
code_fim
hard
{ "lang": "python", "repo": "rodluger/paper", "path": "/src/figures/infer_sigma.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>jax_config.update("jax_enable_x64", True) def model(num_transit, statistic=None): log_sigma = numpyro.sample("log_sigma", dist.Normal(0.0, 10.0)) with numpyro.plate("targets", len(num_transit)): log_k = numpyro.sample("log_k", dist.Normal(0.0, 10.0)) lam = num_transit * 0.5 * jn...
code_fim
hard
{ "lang": "python", "repo": "rodluger/paper", "path": "/src/figures/infer_sigma.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Declare fundamental placeholder and weights to use for model""" self.inputs = tf.placeholder(tf.int32, shape=(None,self.n_input), name='inputs') self.inputs_mask = tf.placeholder(tf.float32, shape=(None, self.n_input), name='inputs_mask') self.targets = tf.place...
code_fim
hard
{ "lang": "python", "repo": "Koomook/semantic-classifier", "path": "/classifier/model.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Koomook/semantic-classifier path: /classifier/model.py import tensorflow as tf from tensorflow.python.layers.core import dense import numpy as np from .utils import * class AttentionMLP(object): """This Model is based on self-attention frame work. as called transformer : https://arxiv.or...
code_fim
hard
{ "lang": "python", "repo": "Koomook/semantic-classifier", "path": "/classifier/model.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: texas/tx_elevators path: /tx_elevators/management/commands/loadgeo.py from __future__ import division from __future__ import unicode_literals import csv import logging <|fim_suffix|> logger = logging.getLogger(__name__) with open(path) as csvfile: for total, row in e...
code_fim
hard
{ "lang": "python", "repo": "texas/tx_elevators", "path": "/tx_elevators/management/commands/loadgeo.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> from tx_elevators.models import Building logger = logging.getLogger(__name__) with open(path) as csvfile: for total, row in enumerate(csvfile, start=1): pass csvfile.seek(0) reader = csv.reader(csvfile) for row in tq...
code_fim
hard
{ "lang": "python", "repo": "texas/tx_elevators", "path": "/tx_elevators/management/commands/loadgeo.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DarkFisk/django-exchange path: /exchange/adapters/xe_exchangerates.py from __future__ import absolute_import import logging import datetime import bs4 from django.core.mail import mail_admins from exchange.models import Currency, ExchangeRate from django.conf import settings from exchange.adap...
code_fim
hard
{ "lang": "python", "repo": "DarkFisk/django-exchange", "path": "/exchange/adapters/xe_exchangerates.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for source in Currency.objects.filter(code__in=self.base_curr).all(): exchange_rates = self.get_exchangerates_by_day(source.code, date) if exchange_rates: exchange_rates.pop(source.code) for code, rate in exchange_rates.iteritems(): ...
code_fim
hard
{ "lang": "python", "repo": "DarkFisk/django-exchange", "path": "/exchange/adapters/xe_exchangerates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tokens = { 'commentsandwhitespace': [ (r'\s+', Text), (r'<!--', Comment), (r'//.*?\n', Comment.Single), (r'/\*.*?\*/', Comment.Multiline) ], 'slashstartsregex': [ include('commentsandwhitespace'), (r'/(\\.|...
code_fim
hard
{ "lang": "python", "repo": "wongjiahau/Pineapple", "path": "/pineapple.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }