text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> publish_requirements = (
FieldPublishRequirement("description", langs=["en"]),
FieldPublishRequirement("form_url", langs=["en"]),
ConditionalPublishRequirement(
RelationPublishRequirement("topics"),
"or",
DepartmentPublishRequirement(),
... | code_fim | hard | {
"lang": "python",
"repo": "cityofaustin/joplin",
"path": "/joplin/pages/form_container/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
Define plotting functionality.
"""
def plot_results(hist, str_ss, L0, xsol, xgt, Aop):
# Plot signal, coefficients and convergence statistics.
fig = plot.figure(
figsize=(12, 6),
tight_layout=True,
)
gs = gridspec.GridSpec(nrows=2, ncols=3)
fig.suptitle(
... | code_fim | hard | {
"lang": "python",
"repo": "lanl/scico",
"path": "/examples/scripts/sparsecode_poisson_pgm.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, input_shape: Shape, D0, D1, jit: bool = True):
self.D0 = D0
self.D1 = D1
output_shape = (D0.shape[0],)
super().__init__(
input_shape=input_shape,
input_dtype=snp.complex64,
output_dtype=snp.complex64,
... | code_fim | hard | {
"lang": "python",
"repo": "lanl/scico",
"path": "/examples/scripts/sparsecode_poisson_pgm.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lanl/scico path: /examples/scripts/sparsecode_poisson_pgm.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of the SCICO package. Details of the copyright
# and user license can be found in the 'LICENSE.txt' file distributed
# with the package.
r"""
Non-negative Poisson Loss R... | code_fim | hard | {
"lang": "python",
"repo": "lanl/scico",
"path": "/examples/scripts/sparsecode_poisson_pgm.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
This function is used to plot error images of three denoising methods.
[min, max] is the relative error range of pixels.
"""
plt.subplot(3, 5, num)
plt.imshow(np.fabs(X - img), vmin = min, vmax = max, cmap = plt.cm.gray)
cb = plt.colorbar(aspect = 8, shrink = 1, pad = 0.05,... | code_fim | hard | {
"lang": "python",
"repo": "zj15001/2D-MCTV-Denoising",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lamda = 0.1
rho = 50
K = 200
err = 0.0001
alpha_ratio = 0.5
para_mctv = pa.Parameter(lamda, rho, K, err, alpha_ratio)
# denoising
X1 = tv2d.denoising_2D_TV(noi_img, para_tv)
X2 = img_as_float(mpimg.imread('NLTV.jpg'))
X3 = mctv2d.denoising_2D_MCTV(noi_img, para_mctv)
# plot demo result figure
plt.figure... | code_fim | hard | {
"lang": "python",
"repo": "zj15001/2D-MCTV-Denoising",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zj15001/2D-MCTV-Denoising path: /main.py
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 23 23:36:52 2018
@author: Yilin Liu
"""
import tv2d, mctv2d
import parameter as pa
import numpy as np
import scipy.io as sio
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from skimage imp... | code_fim | hard | {
"lang": "python",
"repo": "zj15001/2D-MCTV-Denoising",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: danidee10/django-notifs path: /notifications/backends/aws_sqs_lambda.py
"""AWS SQS backend"""
import json
import logging
import boto3
from notifications import default_settings as settings
<|fim_suffix|>
class AwsSqsLambdaConsumer:
@classmethod
def consume(cls, event, context):
... | code_fim | hard | {
"lang": "python",
"repo": "danidee10/django-notifs",
"path": "/notifications/backends/aws_sqs_lambda.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class AwsSqsLambdaConsumer:
@classmethod
def consume(cls, event, context):
for record in event['Records']:
message = json.loads(record['body'])
provider = message['provider']
payload = message['payload']
context = message['context']
... | code_fim | hard | {
"lang": "python",
"repo": "danidee10/django-notifs",
"path": "/notifications/backends/aws_sqs_lambda.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Testando possibilidades
if num1 > num2:
print(f'O maior número digitado foi o {num1}.')
elif num2 > num1:
print(f'O maior número digitado foi o {num2}.')
else:
print('Os números são iguais.')<|fim_prefix|># repo: Lorranysousc/EstruturaDeDecisao path: /ListaDeExercicios/ex01.py
'''1. Faça um ... | code_fim | medium | {
"lang": "python",
"repo": "Lorranysousc/EstruturaDeDecisao",
"path": "/ListaDeExercicios/ex01.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Lorranysousc/EstruturaDeDecisao path: /ListaDeExercicios/ex01.py
'''1. Faça um Programa que peça dois números e imprima o maior deles.'''
<|fim_suffix|>#Testando possibilidades
if num1 > num2:
print(f'O maior número digitado foi o {num1}.')
elif num2 > num1:
print(f'O maior número digita... | code_fim | medium | {
"lang": "python",
"repo": "Lorranysousc/EstruturaDeDecisao",
"path": "/ListaDeExercicios/ex01.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mrr, map3 = f.score_submissions(subm_csv, gt_csv)
print(f'Mean reciprocal rank: {mrr}')
print(f'Mean average precision @3: {map3}')
if __name__ == '__main__':
main()<|fim_prefix|># repo: recsyschallenge/2019 path: /src/score_submission/score_subm.py
from pathlib import Path
impor... | code_fim | hard | {
"lang": "python",
"repo": "recsyschallenge/2019",
"path": "/src/score_submission/score_subm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: recsyschallenge/2019 path: /src/score_submission/score_subm.py
from pathlib import Path
import click
from . import functions as f
current_directory = Path(__file__).absolute().parent
default_data_directory = current_directory.joinpath('..', '..', 'data')
<|fim_suffix|> # calculate path to ... | code_fim | hard | {
"lang": "python",
"repo": "recsyschallenge/2019",
"path": "/src/score_submission/score_subm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FilippoGalanti/Temperature_Comparison path: /temperature_script.py
import time
import pandas as pd
import plotly.offline as pyo
import plotly.graph_objs as go
import plotly.subplots as ps
import requests
import datetime
def date_conversion(date):
return datetime.datetime.strftime(date, '%b... | code_fim | hard | {
"lang": "python",
"repo": "FilippoGalanti/Temperature_Comparison",
"path": "/temperature_script.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> geo_url2 = f"https://api.opencagedata.com/geocode/v1/google-v3-json?address={city_string2}&pretty=1&key={key_geo}&min_confidence=8"
feedback = requests.get(geo_url2)
if feedback.status_code != 200:
print("\nPlease fix the inputs.\n")
print(feedback.json())
continue
... | code_fim | hard | {
"lang": "python",
"repo": "FilippoGalanti/Temperature_Comparison",
"path": "/temperature_script.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rachmadvwp/MidapSim path: /midap_software/layer_compiler.py
import abc
import logging
from abc import ABC
from config import cfg
from logger import init_logger
from .fmem_info import FMEMInfo
class LayerCompiler(ABC):
def __init__(self):
self._logger = init_logger(self.__class... | code_fim | hard | {
"lang": "python",
"repo": "rachmadvwp/MidapSim",
"path": "/midap_software/layer_compiler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _update_state_by_process(self, fragments):
fmem_info = self.fmem_info
control_info = self.layer.control_info
for bank, _, _ in fragments:
fmem_info.discard_data(bank)
control_info.process_input(len(fragments))
def _generate_process_op(self, fragm... | code_fim | hard | {
"lang": "python",
"repo": "rachmadvwp/MidapSim",
"path": "/midap_software/layer_compiler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>group_node_query = orm.QueryBuilder().append(
orm.Group, filters={'label': WORKFLOWS_GROUP_LABEL}, tag='groups',
).append(orm.Node, project='*', with_group='groups', filters={
'and': [
{'attributes.exit_status': {"!==": 0}},
{'attributes.process_state': {"!==": 'waiting'}},
]
}... | code_fim | medium | {
"lang": "python",
"repo": "PhilippRue/commonwf-oxides-scripts",
"path": "/3-analyze/get_errors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>data = {}
for node in wf_nodes:
structure = node.inputs.structure
print(f"{structure.extras['element']} {structure.extras['configuration']} ({structure.pk}) -> {node.pk}: {node.process_state.value} ({node.exit_status})")
data[f"{structure.extras['element']}-{structure.extras['configuration']}"... | code_fim | hard | {
"lang": "python",
"repo": "PhilippRue/commonwf-oxides-scripts",
"path": "/3-analyze/get_errors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PhilippRue/commonwf-oxides-scripts path: /3-analyze/get_errors.py
#!/usr/bin/env runaiida
import os
import json
from aiida import orm
from aiida.cmdline.utils.common import get_workchain_report
SET_NAME = 'set2'
def get_plugin_name():
file_name = os.path.join(
os.path.dirname(os.pa... | code_fim | medium | {
"lang": "python",
"repo": "PhilippRue/commonwf-oxides-scripts",
"path": "/3-analyze/get_errors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stevinc/FUSION path: /utils/rehearsal.py
import random
class ReservoirSampler:
def __init__(self, windows, buffer_size=5000):
<|fim_suffix|> M = len(self.buffer)
if M < self.buffer_size:
self.buffer.append(data)
else:
i = random.randint(0, min(... | code_fim | hard | {
"lang": "python",
"repo": "stevinc/FUSION",
"path": "/utils/rehearsal.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def sample(self, batch_size):
return random.sample(self.buffer, batch_size)
def sample_trajectory(self, batch_size):
initial_index = random.randint(0, len(self.buffer) - batch_size)
return self.buffer[initial_index: initial_index + batch_size]<|fim_prefix|># repo: stevinc/... | code_fim | hard | {
"lang": "python",
"repo": "stevinc/FUSION",
"path": "/utils/rehearsal.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: taichi-dev/taichi path: /tests/python/test_paddle_io.py
import numpy as np
import pytest
from taichi.lang import impl
from taichi.lang.util import has_paddle
import taichi as ti
from tests import test_utils
if has_paddle():
import paddle
@pytest.mark.skipif(not has_paddle(), reason="Paddl... | code_fim | hard | {
"lang": "python",
"repo": "taichi-dev/taichi",
"path": "/tests/python/test_paddle_io.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@pytest.mark.skipif(not has_paddle(), reason="Paddle not installed.")
@test_utils.test(arch=[ti.cpu, ti.cuda])
def test_shape_matrix():
n = 12
x = ti.Matrix.field(3, 2, ti.f32, shape=(n, n))
X = x.to_paddle()
for i in range(n):
for j in range(n):
for k in range(3):
... | code_fim | hard | {
"lang": "python",
"repo": "taichi-dev/taichi",
"path": "/tests/python/test_paddle_io.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AulonSal/steward-fastapi path: /steward_fastapi/core/routers/flexible_data.py
from fastapi import APIRouter, Depends
import steward_fastapi.core.models.database as db
import steward_fastapi.core.models.validation as data
from steward_fastapi.core.authentication import oauth2_scheme
<|fim_suffix... | code_fim | hard | {
"lang": "python",
"repo": "AulonSal/steward-fastapi",
"path": "/steward_fastapi/core/routers/flexible_data.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>@router.get("/", response_model=list[data.ContentType])
async def get_flexible_data(token: str = Depends(oauth2_scheme)):
return await data.FlexibleData.from_queryset(db.FlexibleData.all())<|fim_prefix|># repo: AulonSal/steward-fastapi path: /steward_fastapi/core/routers/flexible_data.py
from fastapi... | code_fim | hard | {
"lang": "python",
"repo": "AulonSal/steward-fastapi",
"path": "/steward_fastapi/core/routers/flexible_data.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>aida + tempo + fuso)%24
print(resposta)<|fim_prefix|># repo: luizgallas/uri_iniciante path: /2057.py
saida, tempo, fuso = input().split(" "<|fim_middle|>)
saida = int(saida)
tempo = int(tempo)
fuso = int(fuso)
resposta = (24 + s | code_fim | medium | {
"lang": "python",
"repo": "luizgallas/uri_iniciante",
"path": "/2057.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luizgallas/uri_iniciante path: /2057.py
saida, tempo, fuso = input().split(" ")
saida = int(saida)
tempo = int(tempo<|fim_suffix|>aida + tempo + fuso)%24
print(resposta)<|fim_middle|>)
fuso = int(fuso)
resposta = (24 + s | code_fim | easy | {
"lang": "python",
"repo": "luizgallas/uri_iniciante",
"path": "/2057.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luizgallas/uri_iniciante path: /2057.py
saida, tempo, fuso = input().split(" "<|fim_suffix|>aida + tempo + fuso)%24
print(resposta)<|fim_middle|>)
saida = int(saida)
tempo = int(tempo)
fuso = int(fuso)
resposta = (24 + s | code_fim | medium | {
"lang": "python",
"repo": "luizgallas/uri_iniciante",
"path": "/2057.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns:
TYPE: Description
"""
_id = kwargs.get('_id')
node = kwargs.get('node')
path = BASE_PATH.format(node.user.json['_id'], node.json['_id'])
if _id:
path += '/{0}'.format(_id)
response = APIClient.get(
client=node.user.client,
oauth_key=node.user.oauth_key,
fingerprint=node.us... | code_fim | hard | {
"lang": "python",
"repo": "synapsepayments/SynapsePay-Python",
"path": "/synapse_pay/Transactions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: synapsepayments/SynapsePay-Python path: /synapse_pay/Transactions.py
"""Summary"""
import APIClient
from Transaction import Transaction
BASE_PATH = 'api/3/users/{0}/nodes/{1}/trans'
def create(**kwargs):
"""Summary
<|fim_suffix|>def get(**kwargs):
"""Summary
Args:
**kwargs: Descript... | code_fim | hard | {
"lang": "python",
"repo": "synapsepayments/SynapsePay-Python",
"path": "/synapse_pay/Transactions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> bcftools_ann_offline_predict_vcf,
bcftools_ann_offline_predict_csv):
"""Test the predictions offline annotation of the bcftools VCF
file using the CLI."""
runner = CliRunner()
... | code_fim | hard | {
"lang": "python",
"repo": "robertopreste/HmtNote",
"path": "/tests/test_bcftools_cli_offline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_bcftools_cli_annotation_offline_predict(self,
bcftools_ann_offline_predict_vcf,
bcftools_ann_offline_predict_csv):
"""Test the predictions offline annotation of the bcftools VCF
... | code_fim | hard | {
"lang": "python",
"repo": "robertopreste/HmtNote",
"path": "/tests/test_bcftools_cli_offline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: robertopreste/HmtNote path: /tests/test_bcftools_cli_offline.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# Created by Roberto Preste
import os
import pytest
from click.testing import CliRunner
from hmtnote import cli
DATADIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "data... | code_fim | hard | {
"lang": "python",
"repo": "robertopreste/HmtNote",
"path": "/tests/test_bcftools_cli_offline.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Generate detected primes. 0 and 1 are not primes
primes = [True for _ in range(num+1)]
primes[0] = primes[1] = False # Clearly not primes
current = 2
# Check for unmarked numbers
while current**2 <= num:
# If not marked => prime
if primes[current]:
#... | code_fim | hard | {
"lang": "python",
"repo": "craciunescu/algo",
"path": "/U1/src/e7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: craciunescu/algo path: /U1/src/e7.py
"""
@author: David E. Craciunescu
@date: 2020/02/18 (yyyy/mm/dd)
7. Write a program that receives a positive number N and obtains
the amount of prime numbers and the amount of perfect numbers there are
between 1 and N. Analyze the effici... | code_fim | hard | {
"lang": "python",
"repo": "craciunescu/algo",
"path": "/U1/src/e7.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> With this approach, we obtain:
- Temporal Complexity => O(n)
- Spacial Complexity => O(n)
"""
# Generate detected primes. 0 and 1 are not primes
primes = [True for _ in range(num+1)]
primes[0] = primes[1] = False # Clearly not primes
current = 2
# Che... | code_fim | hard | {
"lang": "python",
"repo": "craciunescu/algo",
"path": "/U1/src/e7.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ##定义字典用于接收或者处理结果
self.result_raw = {'success': {}, 'failed': {}, 'unreachable': {}, 'skipped': {}, 'status': {}}
# 循环打印这个结果,success,failed,unreachable需要每个都定义一个
for host, result in self.Playbook_results_callback.task_ok.items():
self.result_raw['success'][host] ... | code_fim | hard | {
"lang": "python",
"repo": "wqqsukida/ops_server",
"path": "/utils/ansible_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wqqsukida/ops_server path: /utils/ansible_api.py
# /usr/bin/env python
# -*- coding:utf-8 -*-
# Author : wuyifei
# Data : 10/10/18 10:18 AM
# FileName: ansible_api.py
import json
import datetime
from collections import namedtuple
from ansible.parsing.dataloader import DataLoader
from ansible... | code_fim | hard | {
"lang": "python",
"repo": "wqqsukida/ops_server",
"path": "/utils/ansible_api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if 'allow_many' not in kwargs:
kwargs['allow_many'] = True
super(JSONField, self).__init__(*args, **kwargs)
def to_internal_value_item(self, value):
if isinstance(value, string_types):
try:
return json.loads(value)
except Val... | code_fim | medium | {
"lang": "python",
"repo": "jet-admin/jet-bridge",
"path": "/packages/jet_bridge_base/jet_bridge_base/fields/json.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jet-admin/jet-bridge path: /packages/jet_bridge_base/jet_bridge_base/fields/json.py
from __future__ import absolute_import
import json
from six import string_types
from jet_bridge_base.fields.field import Field
class JSONField(Field):
field_error_messages = {
'invalid': 'not a val... | code_fim | medium | {
"lang": "python",
"repo": "jet-admin/jet-bridge",
"path": "/packages/jet_bridge_base/jet_bridge_base/fields/json.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='machinelearningmodel',
name='model_parameters',
field=django.contrib.postgres.fields.jsonb.JSONField(default={}, null=True),
),
]<|fim_prefix|># repo: ModelChimp/modelchimp path: /modelchimp/migr... | code_fim | medium | {
"lang": "python",
"repo": "ModelChimp/modelchimp",
"path": "/modelchimp/migrations/0034_auto_20180808_0826.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ModelChimp/modelchimp path: /modelchimp/migrations/0034_auto_20180808_0826.py
# Generated by Django 2.0.6 on 2018-08-08 08:26
import django.contrib.postgres.fields.jsonb
from django.db import migrations
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='mach... | code_fim | medium | {
"lang": "python",
"repo": "ModelChimp/modelchimp",
"path": "/modelchimp/migrations/0034_auto_20180808_0826.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
parser = argparse.ArgumentParser(description='''Process a FIH test output yaml file,
and validate no sucessfull boots have happened''')
parser.add_argument('filename', help='yaml file to process')
parser.add_argument('skip_size', help='instruction skip size')
parser.add_ar... | code_fim | hard | {
"lang": "python",
"repo": "mcu-tools/mcuboot",
"path": "/ci/fih_test_docker/validate_output.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mcu-tools/mcuboot path: /ci/fih_test_docker/validate_output.py
# Copyright (c) 2023 Arm Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | code_fim | hard | {
"lang": "python",
"repo": "mcu-tools/mcuboot",
"path": "/ci/fih_test_docker/validate_output.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = parser.parse_args()
test_stats = parse_yaml_file(args.filename)[0]
validate_output(test_stats, args.skip_size, args.fih_level)
if __name__ == "__main__":
main()<|fim_prefix|># repo: mcu-tools/mcuboot path: /ci/fih_test_docker/validate_output.py
# Copyright (c) 2023 Arm Limited
#
... | code_fim | hard | {
"lang": "python",
"repo": "mcu-tools/mcuboot",
"path": "/ci/fih_test_docker/validate_output.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mnubo/kubernetes-py path: /tests/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*<|fim_suffix|>which is part of this source code package.
#<|fim_middle|>-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', | code_fim | medium | {
"lang": "python",
"repo": "mnubo/kubernetes-py",
"path": "/tests/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mnubo/kubernetes-py path: /tests/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and<|fim_suffix|>which is part of this source code package.
#<|fim_middle|> conditions defined in
# file 'LICENSE.md', | code_fim | easy | {
"lang": "python",
"repo": "mnubo/kubernetes-py",
"path": "/tests/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>which is part of this source code package.
#<|fim_prefix|># repo: mnubo/kubernetes-py path: /tests/__init__.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and<|fim_middle|> conditions defined in
# file 'LICENSE.md', | code_fim | easy | {
"lang": "python",
"repo": "mnubo/kubernetes-py",
"path": "/tests/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def check_imphash(self, pe):
"""Check imphash in a list of known import hashes"""
ih = pe.get_imphash()
if ih in self.imphashes:
print("[+] Known suspicious import hash: %s" % (self.imphashes[ih]))
return True
return False
def check_pe_size(... | code_fim | hard | {
"lang": "python",
"repo": "CrackerCat/pecli",
"path": "/pecli/plugins/check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CrackerCat/pecli path: /pecli/plugins/check.py
#! /usr/bin/env python
import pefile
import datetime
import yara
import os
import copy
from pecli.plugins.base import Plugin
class PluginCheck(Plugin):
name = "check"
description = "Check for stuff in the file"
# Known suspicious sectio... | code_fim | hard | {
"lang": "python",
"repo": "CrackerCat/pecli",
"path": "/pecli/plugins/check.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Check if there is a TLS callback"""
callbacks = []
if (hasattr(pe, 'DIRECTORY_ENTRY_TLS') and \
pe.DIRECTORY_ENTRY_TLS and \
pe.DIRECTORY_ENTRY_TLS.struct and \
pe.DIRECTORY_ENTRY_TLS.struct.AddressOfCallBacks):
... | code_fim | hard | {
"lang": "python",
"repo": "CrackerCat/pecli",
"path": "/pecli/plugins/check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def vultr_cli(parser):
"""
Extend a parser with the Vultr options
"""
return parser<|fim_prefix|># repo: coreos/coreos-assembler path: /src/cosalib/vultr.py
from tenacity import (
retry,
stop_after_attempt
)
@retry(reraise=True, stop=stop_after_attempt(3))
def vultr_run_ore(buil... | code_fim | medium | {
"lang": "python",
"repo": "coreos/coreos-assembler",
"path": "/src/cosalib/vultr.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def vultr_run_ore_replicate(*args, **kwargs):
raise Exception("not implemented yet")
def vultr_cli(parser):
"""
Extend a parser with the Vultr options
"""
return parser<|fim_prefix|># repo: coreos/coreos-assembler path: /src/cosalib/vultr.py
from tenacity import (
retry,
sto... | code_fim | medium | {
"lang": "python",
"repo": "coreos/coreos-assembler",
"path": "/src/cosalib/vultr.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coreos/coreos-assembler path: /src/cosalib/vultr.py
from tenacity import (
retry,
stop_after_attempt
)
<|fim_suffix|>
def vultr_cli(parser):
"""
Extend a parser with the Vultr options
"""
return parser<|fim_middle|>
@retry(reraise=True, stop=stop_after_attempt(3))
def vul... | code_fim | hard | {
"lang": "python",
"repo": "coreos/coreos-assembler",
"path": "/src/cosalib/vultr.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: emCOMP/visualization path: /src/python/uploadInSubset.py
#!/usr/bin/env python
import json, re, argparse
from pprint import pprint
from server_messenger import ServerMessenger
import mysql.connector
import gspread # installed via pip install gspread
from oauth2client.client import SignedJwtAsser... | code_fim | medium | {
"lang": "python",
"repo": "emCOMP/visualization",
"path": "/src/python/uploadInSubset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # MySQL Storage
global database
database = mysql.connector.connect(
user=config["storage"]["user"],
password=config["storage"]["password"],
host=config["storage"]["host"],
database=config["storage"]["database"]
)
if __name__ ... | code_fim | hard | {
"lang": "python",
"repo": "emCOMP/visualization",
"path": "/src/python/uploadInSubset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if(serverStorage is not None):
serverStorage.close()
def connectToServer():
with open('../../local.conf') as config_file:
config = json.load(config_file)
# MySQL Storage
global database
database = mysql.connector.connec... | code_fim | hard | {
"lang": "python",
"repo": "emCOMP/visualization",
"path": "/src/python/uploadInSubset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UsersNewPassword(HTTPEndpoint):
async def post(self, request):
is_admin(request)
data = await request.json()
async with get_conn() as conn:
result = await Users(conn).new_pswd(data['id'])
return UJSONResponse({'password': result})<|fim_prefix|># repo... | code_fim | hard | {
"lang": "python",
"repo": "wooque/openpacs",
"path": "/backend/api/users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return UJSONResponse({'password': result['password'], 'username': data['username']})
class UsersDeactivate(HTTPEndpoint):
async def post(self, request):
is_admin(request)
data = await request.json()
async with get_conn() as conn:
await Users(conn).deactiv... | code_fim | hard | {
"lang": "python",
"repo": "wooque/openpacs",
"path": "/backend/api/users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wooque/openpacs path: /backend/api/users.py
from starlette.endpoints import HTTPEndpoint
from starlette.responses import UJSONResponse
from api.utils import gen_token, is_admin
from db.conn import get_conn
from db.users import Users
from exeptions import ApiException
class Login(HTTPEndpoint):... | code_fim | hard | {
"lang": "python",
"repo": "wooque/openpacs",
"path": "/backend/api/users.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RyanRasi/Python-Amazon-Scraper path: /scraper.py
import requests
from bs4 import BeautifulSoup
import smtplib
import time
#Python parser and email sender for checking the price of an item on Amazon.
#Created by Ryan Rasi.
#https://github.com/RyanRasi
#http://ryanrasi.com
#Variable ini... | code_fim | hard | {
"lang": "python",
"repo": "RyanRasi/Python-Amazon-Scraper",
"path": "/scraper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Strips the blank space around the title.
print(title.strip())
#Prints the current price and adds the currency identifier.
print("Current price is: £" + price)
#The argument for checking if the price of the game has gone down to less than 48.99.
if (converted_price < 50.00):... | code_fim | hard | {
"lang": "python",
"repo": "RyanRasi/Python-Amazon-Scraper",
"path": "/scraper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#Strips the blank space around the title.
print(title.strip())
#Prints the current price and adds the currency identifier.
print("Current price is: £" + price)
#The argument for checking if the price of the game has gone down to less than 48.99.
if (converted_price < 5... | code_fim | hard | {
"lang": "python",
"repo": "RyanRasi/Python-Amazon-Scraper",
"path": "/scraper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>hcommpro = commpro.Connect(con_str)
pressNumericOne(commpro)
pressOkey(commpro)
pressNumericOne(commpro)
pressOkey(commpro)<|fim_prefix|># repo: kakamissyou/crossinright path: /pullsdkdemo.py
# -*- coding: utf-8 -*-
from ctypes import windll,create_string_buffer
import time
__author__ = 'Administrator'
p... | code_fim | hard | {
"lang": "python",
"repo": "kakamissyou/crossinright",
"path": "/pullsdkdemo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kakamissyou/crossinright path: /pullsdkdemo.py
# -*- coding: utf-8 -*-
from ctypes import windll,create_string_buffer
import time
__author__ = 'Administrator'
params = "protocol=TCP,ipaddress=192.168.1.61,port=4370,timeout=4000,passwd=0"
commpro = windll.LoadLibrary("plcommpro.dll")
con_str = cre... | code_fim | hard | {
"lang": "python",
"repo": "kakamissyou/crossinright",
"path": "/pullsdkdemo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>df = pd.DataFrame(dictionary)
print(df)<|fim_prefix|># repo: johnma96/curso_github path: /archivo4.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
<|fim_middle|>x = np.arange(0,1,100)
y = x**2
dictionary = {'x':x, 'y':y}
| code_fim | medium | {
"lang": "python",
"repo": "johnma96/curso_github",
"path": "/archivo4.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johnma96/curso_github path: /archivo4.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
<|fim_suffix|>dictionary = {'x':x, 'y':y}
df = pd.DataFrame(dictionary)
print(df)<|fim_middle|>x = np.arange(0,1,100)
y = x**2
| code_fim | easy | {
"lang": "python",
"repo": "johnma96/curso_github",
"path": "/archivo4.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baixuexue123/flask-boilerplate path: /manage.py
import click
from services.app import create_app
app = create_app()
<|fim_suffix|>
cli.add_command(runserver)
if __name__ == '__main__':
cli()<|fim_middle|>@click.group()
def cli():
pass
@click.command()
@click.option('--host', defau... | code_fim | hard | {
"lang": "python",
"repo": "baixuexue123/flask-boilerplate",
"path": "/manage.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@click.group()
def cli():
pass
@click.command()
@click.option('--host', default='0.0.0.0', type=str)
@click.option('--port', default=8888, type=int)
def runserver(host, port):
click.echo('runserver...')
app.run(host='0.0.0.0', port=8888, debug=True, threaded=True)
cli.add_command(runserver... | code_fim | easy | {
"lang": "python",
"repo": "baixuexue123/flask-boilerplate",
"path": "/manage.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #TODO: is reshape/flatten required in newest numpy versions?
indLB, indUB, indEQ = \
where(isfinite(p.lb) & ~(p.lb == p.ub))[0], \
where(isfinite(p.ub) & ~(p.lb == p.ub))[0], \
where(p.lb == p.ub)[0]
initLenB = Len(p.b)
initLenBeq = Len(p.beq)
nLB, nUB, nEQ = Len(i... | code_fim | hard | {
"lang": "python",
"repo": "wangyum/Anaconda",
"path": "/lib/python2.7/site-packages/openopt/solvers/CVXOPT/cvxopt_misc.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wangyum/Anaconda path: /lib/python2.7/site-packages/openopt/solvers/CVXOPT/cvxopt_misc.py
import cvxopt # to ensure cvxopt is installed
import cvxopt.base
from openopt.kernel.ooMisc import Len
matrix = cvxopt.base.matrix
sparse = cvxopt.base.sparse
Sparse = cvxopt.spmatrix
from numpy import asf... | code_fim | hard | {
"lang": "python",
"repo": "wangyum/Anaconda",
"path": "/lib/python2.7/site-packages/openopt/solvers/CVXOPT/cvxopt_misc.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
transforms lb - ub bounds into (A, x) <= b, (Aeq, x) = beq conditions
this func is developed for those solvers that can handle lb, ub only via c(x)<=0, h(x)=0
"""
#TODO: is reshape/flatten required in newest numpy versions?
indLB, indUB, indEQ = \
where(isfinite(p.lb) & ~(... | code_fim | hard | {
"lang": "python",
"repo": "wangyum/Anaconda",
"path": "/lib/python2.7/site-packages/openopt/solvers/CVXOPT/cvxopt_misc.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: canada-ca/tracker path: /clients/python/tests/test_client.py
"""Tests for methods on the Client class"""
from gql.transport.exceptions import (
TransportQueryError,
TransportServerError,
TransportProtocolError,
)
from graphql.error import GraphQLError
import pytest
from tracker_clien... | code_fim | hard | {
"lang": "python",
"repo": "canada-ca/tracker",
"path": "/clients/python/tests/test_client.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mocker.patch("tracker_client.client.get_auth_token")
mocker.patch("tracker_client.client.create_client")
test_client = Client()
test_client.execute_query = mock_return
domain_list = test_client.get_domains()
# If get_domains didn't try to paginate, len(domain_list) will be 3.
... | code_fim | hard | {
"lang": "python",
"repo": "canada-ca/tracker",
"path": "/clients/python/tests/test_client.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: misterwilliam/connect-four path: /connect_four_heuristics.py
from game import DiscState
from grid import Point
import grid_utils
def on_first_move_select_mid_col(current_player, grid, possible_moves):
if grid_utils.is_row_all(grid, 0, DiscState.empty):
middle = int(grid.width / 2)
if ... | code_fim | hard | {
"lang": "python",
"repo": "misterwilliam/connect-four",
"path": "/connect_four_heuristics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> move = if_can_win_take_do_it(current_player, grid, possible_moves)
if move:
return move
move = block_opponent(current_player, grid, possible_moves)
if move:
return move<|fim_prefix|># repo: misterwilliam/connect-four path: /connect_four_heuristics.py
from game import DiscState
from grid ... | code_fim | medium | {
"lang": "python",
"repo": "misterwilliam/connect-four",
"path": "/connect_four_heuristics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_winning_move(grid, current_player):
for col_index in range(grid.width):
row_index = grid_utils.get_row_of_first(grid, col_index, DiscState.empty)
current_point = Point(row_index, col_index)
if not grid.is_inside(current_point):
continue
if grid_utils.is_in_row_run(grid, cu... | code_fim | hard | {
"lang": "python",
"repo": "misterwilliam/connect-four",
"path": "/connect_four_heuristics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self,
in_channels,
kernel_size,
stride=1,
padding=0,
dilation=1,
depth_multiplier=1,
bias=True,
):
_check_depth_multiplier(depth_multiplier)
out_channels = in_channels * depth_multiplier
super().__init__(
... | code_fim | hard | {
"lang": "python",
"repo": "qinzheng93/vision3d",
"path": "/vision3d/layers/basic_layers/depthwise_conv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qinzheng93/vision3d path: /vision3d/layers/basic_layers/depthwise_conv.py
import torch.nn as nn
def _check_depth_multiplier(x):
if not isinstance(x, int) or x <= 0:
raise ValueError(f'"depth_multiplier" ({x}) must be a positive integer.')
class DepthwiseConv1d(nn.Conv1d):
<|fim_su... | code_fim | hard | {
"lang": "python",
"repo": "qinzheng93/vision3d",
"path": "/vision3d/layers/basic_layers/depthwise_conv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CybOXProject/python-cybox path: /cybox/objects/linux_package_object.py
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import fields
<|fim_suffix|> architecture = VocabField("Architecture", LinuxPackageArchitecture)
cate... | code_fim | hard | {
"lang": "python",
"repo": "CybOXProject/python-cybox",
"path": "/cybox/objects/linux_package_object.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> architecture = VocabField("Architecture", LinuxPackageArchitecture)
category = fields.TypedField("Category", String)
description = fields.TypedField("Description", String)
epoch = fields.TypedField("Epoch", String)
evr = fields.TypedField("EVR", String)
name = fields.TypedField("Na... | code_fim | hard | {
"lang": "python",
"repo": "CybOXProject/python-cybox",
"path": "/cybox/objects/linux_package_object.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jfangwpi/Interactive_planning_and_sensing path: /src/lcmtypes/python/graph_data/entropy_path_trend_data.py
"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""
try:
import cStringIO.StringIO as BytesIO
except ImportError:
from io import BytesIO
... | code_fim | hard | {
"lang": "python",
"repo": "jfangwpi/Interactive_planning_and_sensing",
"path": "/src/lcmtypes/python/graph_data/entropy_path_trend_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if entropy_path_trend_data._packed_fingerprint is None:
entropy_path_trend_data._packed_fingerprint = struct.pack(">Q", entropy_path_trend_data._get_hash_recursive([]))
return entropy_path_trend_data._packed_fingerprint
_get_packed_fingerprint = staticmethod(_get_packed_fin... | code_fim | hard | {
"lang": "python",
"repo": "jfangwpi/Interactive_planning_and_sensing",
"path": "/src/lcmtypes/python/graph_data/entropy_path_trend_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: minhpqn/speaker-recognition-py3 path: /run_speaker_recognition.py
"""
Training the speaker identification model
"""
import re
import os
import argparse
from logzero import logger
from interface import ModelInterface
from utils import read_wav
def train(train_data_dir, model_path):
m = Mode... | code_fim | hard | {
"lang": "python",
"repo": "minhpqn/speaker-recognition-py3",
"path": "/run_speaker_recognition.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.do_train:
logger.info("Training speaker recognition model")
train(args.train_data_dir, args.model_path)
if args.do_eval:
evaluate(args.eval_data_dir, args.model_path)
if __name__ == "__main__":
main()<|fim_prefix|># repo: minhpqn/speaker-recognition-p... | code_fim | hard | {
"lang": "python",
"repo": "minhpqn/speaker-recognition-py3",
"path": "/run_speaker_recognition.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> weights_name = ['conv0/W:0', 'conv1/W:0', 'conv2/W:0', 'conv3/W:0', 'conv4/W:0', 'fc0/W:0', 'fc1/W:0', 'fct/W:0']
compensation_factor = {}
for layer in weights_name:
data = param_dict[layer]
numpy_mean, tf_mean = compute_mean(data)
compensation_factor[layer] = numpy_me... | code_fim | medium | {
"lang": "python",
"repo": "lclibardi/tensorpack",
"path": "/examples/DoReFa-Net/numpy2tf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lclibardi/tensorpack path: /examples/DoReFa-Net/numpy2tf.py
import numpy as np
import tensorflow as tf
import pickle
def compute_mean(data):
numpy_mean = np.mean(np.abs(data))
vec = tf.placeholder(tf.float32, data.shape)
avg = tf.reduce_mean(tf.abs(vec))
with tf.Session() a... | code_fim | medium | {
"lang": "python",
"repo": "lclibardi/tensorpack",
"path": "/examples/DoReFa-Net/numpy2tf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timohart7/tau-vehicle-37 path: /src/main_classifier.py
import os
import numpy as np
import matplotlib.pyplot as plt
import sklearn
from sklearn import model_selection
import cv2
import tensorflow as tf
import tensorflow.keras
from tensorflow.keras.layers import Dense, Activation, Flatten
from te... | code_fim | hard | {
"lang": "python",
"repo": "timohart7/tau-vehicle-37",
"path": "/src/main_classifier.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pred0 = np.argmax(np.array(model1.predict(TestNN)),1).reshape((-1,1))
pred1 = np.argmax(np.array(model4.predict(TestNN)),1).reshape((-1,1))
pred2 = np.argmax(np.array(model3.predict(TestNN)),1).reshape((-1,1))
pred3 = np.array(svmrbf.predict(TestSVM)).reshape((-1,1))
pred = np.concatenate((pred0,pred1,pr... | code_fim | hard | {
"lang": "python",
"repo": "timohart7/tau-vehicle-37",
"path": "/src/main_classifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Find all image files in the data directory.
X = [] # Feature vectors will go here.
y = [] # Class ids will go here.
for root, dirs, files in os.walk(directory):
#print(dirs)
for name in files:
#print(files)
if name.endswith('.jpg'):
path = os.path.join(root, name)... | code_fim | hard | {
"lang": "python",
"repo": "timohart7/tau-vehicle-37",
"path": "/src/main_classifier.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PatyLuPrz/unicollagen path: /ControlPanel/Apps/Productos/migrations/0004_delete_frances.py
# Generated by Django 2.2.1 on 2019-08-14 16:40
from django.db import migrations
<|fim_suffix|> dependencies = [
('Productos', '0003_auto_20190808_1021'),
]
operations = [
migr... | code_fim | easy | {
"lang": "python",
"repo": "PatyLuPrz/unicollagen",
"path": "/ControlPanel/Apps/Productos/migrations/0004_delete_frances.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('Productos', '0003_auto_20190808_1021'),
]
operations = [
migrations.DeleteModel(
name='Frances',
),
]<|fim_prefix|># repo: PatyLuPrz/unicollagen path: /ControlPanel/Apps/Productos/migrations/0004_delete_frances.py
# Generated by Djan... | code_fim | medium | {
"lang": "python",
"repo": "PatyLuPrz/unicollagen",
"path": "/ControlPanel/Apps/Productos/migrations/0004_delete_frances.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Gilango/godrays-thesis path: /code/render.py
#!/usr/bin/python
import os,sys
import glob
def CmdLineFindIndex( tag ):
for i in range(len(sys.argv)):
if sys.argv[i] == tag:
return i
return -1
def CmdLineFind( tag, defaultValue ):
<|fim_suf... | code_fim | medium | {
"lang": "python",
"repo": "Gilango/godrays-thesis",
"path": "/code/render.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>objPath = "/DPA/moosefs/PeanutButterJelly/prod/share/assets/oceanSurfaceObj/0018/256x256/obj/"
objFiles = glob.glob1(objPath,"*.obj")
objFiles.sort()
renderRange = CmdLineFind("-range", "1-200")
startFrame, endFrame = renderRange.split("-")
submittingList = []
baseName = ''
num = ''
type = ''
threshold = ... | code_fim | hard | {
"lang": "python",
"repo": "Gilango/godrays-thesis",
"path": "/code/render.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stephenthoma/ezdxf path: /tests/test_ac1015/test_create_new_layout.py
# Created: 25.04.2014, 2018 rewritten for pytest
# Copyright (C) 2014-2018, Manfred Moitzi
# License: MIT License
from __future__ import unicode_literals
import pytest
import ezdxf
@pytest.fixture(scope='module')
def dxf_ac10... | code_fim | medium | {
"lang": "python",
"repo": "stephenthoma/ezdxf",
"path": "/tests/test_ac1015/test_create_new_layout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> new_layout = create_new_layout(dxf_ac1015, 'mozman_layout_2')
assert 'mozman_layout_2' == new_layout.name
assert is_layout_in_object_section(new_layout, dxf_ac1015) is True
assert is_layout_in_dxf_layout_management_table(new_layout, dxf_ac1015) is True
assert block_record_for_layout_ex... | code_fim | medium | {
"lang": "python",
"repo": "stephenthoma/ezdxf",
"path": "/tests/test_ac1015/test_create_new_layout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> dwg.new_layout(name)
return dwg.layouts.get(name)
def test_create_new_layout(dxf_ac1015):
new_layout = create_new_layout(dxf_ac1015, 'mozman_layout')
assert 'mozman_layout' == new_layout.name
assert is_layout_in_object_section(new_layout, dxf_ac1015) is True
assert is_layout_in_d... | code_fim | medium | {
"lang": "python",
"repo": "stephenthoma/ezdxf",
"path": "/tests/test_ac1015/test_create_new_layout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: craymichael/ArgValidation path: /req_test.py
# ======================================================================================================================
# Copyright 2016 Zachariah Carmichael
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this f... | code_fim | hard | {
"lang": "python",
"repo": "craymichael/ArgValidation",
"path": "/req_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class TestNames(unittest.TestCase):
def test_single_name(self):
req_as_decorator(
req(
('pid', Arg(types=int)) # Validate kwarg pid type
), 123, pid=1, two=2
)
with self.assertRaises(TypeError):
req_as_decorator(
... | code_fim | hard | {
"lang": "python",
"repo": "craymichael/ArgValidation",
"path": "/req_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.