text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: rancher/validation-tests path: /tests/v3_validation/cattlevalidationtest/core/test_dns_services.py
ervice = client.update(consumed_service,
scale=final_consumed_service_scale,
name=consumed_service.name)
consumed_servic... | code_fim | hard | {
"lang": "python",
"repo": "rancher/validation-tests",
"path": "/tests/v3_validation/cattlevalidationtest/core/test_dns_services.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> random_name = random_str()
consumed_service_name = random_name.replace("-", "")
consumed_service2 = client.create_service(name=consumed_service_name,
stackId=env.id,
launchConfig=launch_config,
... | code_fim | hard | {
"lang": "python",
"repo": "rancher/validation-tests",
"path": "/tests/v3_validation/cattlevalidationtest/core/test_dns_services.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Parses arguments, returns ``(options, args)``.'''
if args is None:
args = sys.argv
parser = ArgumentParser(description='MicroDrop plugin manager',
parents=[MPM_PARSER])
return parser.parse_args()
def validate_args(args):
'''
Apply custom v... | code_fim | hard | {
"lang": "python",
"repo": "MIKA-SSS/mpm",
"path": "/mpm/bin/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MIKA-SSS/mpm path: /mpm/bin/__init__.py
# coding: utf-8
from argparse import ArgumentParser
from collections import OrderedDict
import datetime as dt
import logging
import sys
from path_helpers import path
import si_prefix as si
from .. import pformat_dict
from ..commands import (DEFAULT_INDEX_... | code_fim | hard | {
"lang": "python",
"repo": "MIKA-SSS/mpm",
"path": "/mpm/bin/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def validate_args(args):
'''
Apply custom validation and actions based on parsed arguments.
Parameters
----------
args : argparse.Namespace
Result from ``parse_args`` method of ``argparse.ArgumentParser``
instance.
Returns
-------
argparse.Namespace
... | code_fim | hard | {
"lang": "python",
"repo": "MIKA-SSS/mpm",
"path": "/mpm/bin/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Instagram/LibCST path: /libcst/matchers/tests/test_decorators.py
self.leaves.append(updated_node.value)
return updated_node
# Parse a module and verify we visited correctly.
module = fixture(
"""
a = "foo"
b = "bar"
... | code_fim | hard | {
"lang": "python",
"repo": "Instagram/LibCST",
"path": "/libcst/matchers/tests/test_decorators.py",
"mode": "psm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "foobarbaz"
"""
)
visitor = TestVisitor()
module.visit(visitor)
# We should have only visited a select number of nodes.
self.assertEqual(visitor.visits, {"baz1", "foo2", "bar2", "baz2", "foobarbaz2"})
self.assertEqual(
... | code_fim | hard | {
"lang": "python",
"repo": "Instagram/LibCST",
"path": "/libcst/matchers/tests/test_decorators.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self) -> None:
super().__init__()
self.visits: Set[str] = set()
self.leaves: Set[str] = set()
@call_if_inside(m.FunctionDef(m.Name("foo")))
@visit(m.SimpleString())
def visit_string1(self, node: c... | code_fim | hard | {
"lang": "python",
"repo": "Instagram/LibCST",
"path": "/libcst/matchers/tests/test_decorators.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>gister(models.UserTrackedContent)
except Exception, e:
pass<|fim_prefix|># repo: genghisu/eruditio path: /eruditio/shared_apps/django_userhistory/admin.py
import django_userhistory.models as models
from django.contrib import admin
try:
admin.site.register(models.UserAction)<|fim_middle|>
adm... | code_fim | medium | {
"lang": "python",
"repo": "genghisu/eruditio",
"path": "/eruditio/shared_apps/django_userhistory/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: genghisu/eruditio path: /eruditio/shared_apps/django_userhistory/admin.py
import django_userhistory.models as models
from django.contrib<|fim_suffix|>
admin.site.register(models.UserHistory)
admin.site.register(models.UserTrackedContent)
except Exception, e:
pass<|fim_middle|> import ... | code_fim | medium | {
"lang": "python",
"repo": "genghisu/eruditio",
"path": "/eruditio/shared_apps/django_userhistory/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> formatted_number = formats.number_format(number)
if hasattr(settings, 'POINTS_CUSTOM_NAME'):
return '{} {}'.format(
formatted_number, settings.POINTS_CUSTOM_NAME)
# Translators: display a number of points,
# like "1 poin... | code_fim | hard | {
"lang": "python",
"repo": "leliel12/otree-core",
"path": "/otree/currency.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leliel12/otree-core path: /otree/currency.py
'''
Vendored version of django-easymoney.
Putting directly in otree-core because PyCharm flags certain usages in yellow,
like:
c(1) + c(1)
Results in: "Currency does not define __add__, so the + operator cannot
be used on its instances"
If "a" i... | code_fim | hard | {
"lang": "python",
"repo": "leliel12/otree-core",
"path": "/otree/currency.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __unicode__(self):
return self._format_currency(Decimal(self))
def __str__(self):
string = self._format_currency(Decimal(self))
if six.PY2:
return string.encode('utf-8')
return string
@classmethod
def _format_currency(cls, number):
... | code_fim | hard | {
"lang": "python",
"repo": "leliel12/otree-core",
"path": "/otree/currency.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# Test custom models =============================================== >>
@pytest.mark.parametrize("model", [RandomForestRegressor, RandomForestRegressor()])
def test_custom_models(model):
"""Assert that ATOM works with custom models."""
atom = ATOMRegressor(X_reg, y_reg, random_state=1)
atom.... | code_fim | hard | {
"lang": "python",
"repo": "bmnds/ATOM",
"path": "/tests/test_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pytest.mark.parametrize("model", regression)
def test_models_regression(model):
"""Assert that all models work with regression."""
atom = ATOMRegressor(X_reg, y_reg, test_size=0.24, random_state=1)
atom.run(
models=model,
metric="neg_mean_absolute_error",
n_calls=2,
... | code_fim | hard | {
"lang": "python",
"repo": "bmnds/ATOM",
"path": "/tests/test_models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bmnds/ATOM path: /tests/test_models.py
# coding: utf-8
"""
Automated Tool for Optimized Modelling (ATOM)
Author: Mavs
Description: Unit tests for models.py
"""
# Standard packages
import pytest
import numpy as np
from sklearn.ensemble import RandomForestRegressor
# Keras
from tensorflow.keras... | code_fim | hard | {
"lang": "python",
"repo": "bmnds/ATOM",
"path": "/tests/test_models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LKWaters/Synthetic-Voice-Transfer path: /main.py
import discord
from discord.ext import commands
import time
from synthesize import synthesize
import multiprocessing
<|fim_suffix|> @client.command(pass_context = True)
async def say(ctx):
channel = ctx.message.author.voice.channel
... | code_fim | hard | {
"lang": "python",
"repo": "LKWaters/Synthetic-Voice-Transfer",
"path": "/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @client.command(pass_context = True)
async def make(ctx,*, sentance):
sen = str(sentance)
print(sen)
p1 = multiprocessing.Process(target = synthesize, args=(sen,))
p1.start()
p1.join()
await ctx.send("Ready")
@client.command(pass_context = True)... | code_fim | medium | {
"lang": "python",
"repo": "LKWaters/Synthetic-Voice-Transfer",
"path": "/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Serbeld/Practicas-de-Python-en-Notebook path: /Menus/Modulo.py
# -*- coding: utf-8 -*-
def buscar_un_paciente(id, diccionario):
try:
valor_de_prueba_de_errores = diccionario[id]['Nombre']
print("***** INFORMACIÓN DEL PACIENTE *****")
pr... | code_fim | hard | {
"lang": "python",
"repo": "Serbeld/Practicas-de-Python-en-Notebook",
"path": "/Menus/Modulo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("*** Información de diabetes ***")
print("HbA1C: " + str(diccionario[id]['Diabetes']['HbA1c']))
print("Glucosa: " + str(diccionario[id]['Diabetes']['Glucosa']))
except:
print( "El paciente no existe en la base de datos")<|fim_prefix|># repo: Serbeld/P... | code_fim | hard | {
"lang": "python",
"repo": "Serbeld/Practicas-de-Python-en-Notebook",
"path": "/Menus/Modulo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shootsoft/practice path: /LeetCode/python/031-060/032-search-for-a-range/range.py
__author__ = 'yinjun'
class Solution:
"""
@param A : a list of integers
@param target : an integer to be searched
@return : a list of length 2, [index1, index2]
"""
def searchRange(self, A, ... | code_fim | hard | {
"lang": "python",
"repo": "shootsoft/practice",
"path": "/LeetCode/python/031-060/032-search-for-a-range/range.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> while start + 1 < end:
mid = start + (end - start) /2
if A[mid] > target:
end = mid
else:
start = mid
if A[start] == target and A[end] == target:
pos2 = max(start, end)
elif A[end] == target:
... | code_fim | hard | {
"lang": "python",
"repo": "shootsoft/practice",
"path": "/LeetCode/python/031-060/032-search-for-a-range/range.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not self.keyframes:
return
self.publish_pose()
if self.current_frame.status:
self.publish_trajectory()
self.publish_constraint()
self.publish_point_cloud()
self.publish_slam_update()
def publish_pose(self):
... | code_fim | hard | {
"lang": "python",
"repo": "ivanacollg/bruce-original",
"path": "/bruce_slam/scripts/slam_node.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ivanacollg/bruce-original path: /bruce_slam/scripts/slam_node.py
SLAM_CONSTRAINT_TOPIC, Marker, queue_size=1, latch=True
)
self.cloud_pub = rospy.Publisher(
SLAM_CLOUD_TOPIC, PointCloud2, queue_size=1, latch=True
)
self.slam_update_pub = rospy.Publishe... | code_fim | hard | {
"lang": "python",
"repo": "ivanacollg/bruce-original",
"path": "/bruce_slam/scripts/slam_node.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ivanacollg/bruce-original path: /bruce_slam/scripts/slam_node.py
ax_rotation = rospy.get_param(ns + "nssm/max_rotation")
self.nssm_params.source_frames = rospy.get_param(ns + "nssm/source_frames")
self.nssm_params.cov_samples = rospy.get_param(ns + "nssm/cov_samples")
sel... | code_fim | hard | {
"lang": "python",
"repo": "ivanacollg/bruce-original",
"path": "/bruce_slam/scripts/slam_node.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abiraja2004/deep-learning-foundations path: /play/matplotlib-fun.py
import matplotlib.pyplot as plt
# testing examples from http://matplotlib.org/users/pyplot_tutorial.html
def example_line():
numbers = [1, 2, 3, 4]
plt.plot(numbers)
plt.ylabel('Numbers :) ')
plt.show()
# exa... | code_fim | medium | {
"lang": "python",
"repo": "abiraja2004/deep-learning-foundations",
"path": "/play/matplotlib-fun.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.figure(1)
plt.subplot(2, 1, 1)
plt.plot(cooked_tofu, tofu_function(cooked_tofu),
'bo', frozen_fofu, tofu_function(frozen_fofu), 'k')
plt.subplot(2, 1, 1)
plt.plot(frozen_fofu, np.sin(2 * np.pi * frozen_fofu), 'r--')
plt.show()
super_tofu()<|fim_prefix|># repo: ab... | code_fim | medium | {
"lang": "python",
"repo": "abiraja2004/deep-learning-foundations",
"path": "/play/matplotlib-fun.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Userbot007/X-tra-Telegram path: /userbot/plugins/sangmata.py
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
# Port to userbot by @MoveAngel
im... | code_fim | hard | {
"lang": "python",
"repo": "Userbot007/X-tra-Telegram",
"path": "/userbot/plugins/sangmata.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@register(outgoing=True, pattern="^.fakemail(?: |$)(.*)")
async def pembohong(fake):
if fake.fwd_from:
return
if not fake.reply_to_msg_id:
await fake.edit("```Reply to any user message.```")
return
reply_message = await fake.get_reply_message()
if not reply_message.... | code_fim | hard | {
"lang": "python",
"repo": "Userbot007/X-tra-Telegram",
"path": "/userbot/plugins/sangmata.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: great-expectations/great_expectations path: /contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_minimum_bounding_radius_to_be_between.py
from typing import Dict, Optional
import pandas as pd
import pygeos as geos
from great_e... | code_fim | hard | {
"lang": "python",
"repo": "great-expectations/great_expectations",
"path": "/contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_minimum_bounding_radius_to_be_between.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
... |
<|fim_suffix|> self,
configuration: ExpectationConfiguration,
metrics: Dict,
runtime_configuration: dict = None,
execution_engine: ExecutionEngine = None,
):
radius = metrics.get("column.geometry.minimum_bounding_radius")
diameter_flag = self.get_success_kwargs... | code_fim | hard | {
"lang": "python",
"repo": "great-expectations/great_expectations",
"path": "/contrib/great_expectations_geospatial_expectations/great_expectations_geospatial_expectations/expectations/expect_column_minimum_bounding_radius_to_be_between.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
... |
<|fim_prefix|># repo: google-research/pegasus path: /pegasus/layers/transformer_block.py
# Copyright 2023 The PEGASUS Authors.
#
# 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://... | code_fim | hard | {
"lang": "python",
"repo": "google-research/pegasus",
"path": "/pegasus/layers/transformer_block.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def stack(layers,
training,
inputs_BxIxD,
bias_BxIxI,
memory_BxMxD,
bias_BxIxM,
cache=None,
decode_i=None):
"""Stack AttentionBlock layers."""
if (memory_BxMxD is None) != (bias_BxIxM is None):
raise ValueError("memory and memo... | code_fim | hard | {
"lang": "python",
"repo": "google-research/pegasus",
"path": "/pegasus/layers/transformer_block.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> training,
inputs_BxIxD,
bias_BxIxI,
memory_BxMxD,
bias_BxIxM,
cache=None,
decode_i=None):
s_BxIxD = inputs_BxIxD
with tf.variable_scope("self_attention"):
y_BxIxD = contrib_layers.layer_n... | code_fim | hard | {
"lang": "python",
"repo": "google-research/pegasus",
"path": "/pegasus/layers/transformer_block.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def after_request(self, request, response):
session_string = pickle.dumps(request.session)
response.set_cookie("session_id", session_string)
return response<|fim_prefix|># repo: yubang/quick path: /quick/middleware/SessionMiddleware.py
# coding:UTF-8
"""
处理session的中间件
@autho... | code_fim | hard | {
"lang": "python",
"repo": "yubang/quick",
"path": "/quick/middleware/SessionMiddleware.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yubang/quick path: /quick/middleware/SessionMiddleware.py
# coding:UTF-8
"""
处理session的中间件
@author: yubang
"""
<|fim_suffix|> def after_request(self, request, response):
session_string = pickle.dumps(request.session)
response.set_cookie("session_id", session_string)
... | code_fim | hard | {
"lang": "python",
"repo": "yubang/quick",
"path": "/quick/middleware/SessionMiddleware.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # OLD_DIMENSIONS
if '819.0' in file_list:
with open(work_dir + '819.0', 'r') as f:
data = np.fromfile(f, dtype=np.int32)
norb_alpha, norb_beta = data[0:2]
norb = norb_alpha
nbas = norb # assumption
else:
norb = np.shape(data_fchk... | code_fim | hard | {
"lang": "python",
"repo": "abelcarreras/PyQchem",
"path": "/pyqchem/qchem_core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create temp directory in remote machine
try:
sftp.mkdir(remote_dir)
except OSError:
pass
sftp.chdir(remote_dir)
# Copy all files in local workdir to remote machine
file_list = os.listdir(work_dir)
for file in file_list:
sftp.put(os.path.join(work_dir,... | code_fim | hard | {
"lang": "python",
"repo": "abelcarreras/PyQchem",
"path": "/pyqchem/qchem_core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abelcarreras/PyQchem path: /pyqchem/qchem_core.py
if int(o_minor) == self.minor:
return True
return False
@property
def major(self):
return int(self._major)
@property
def minor(self):
return int(self._minor... | code_fim | hard | {
"lang": "python",
"repo": "abelcarreras/PyQchem",
"path": "/pyqchem/qchem_core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [
'animate',
'animation_images',
'animation_particles',
'animation_profiles',
'image',
'interpolate',
'plot',
'vector',
'visualize_sim',
]<|fim_prefix|># repo: dmentipl/plonk path: /src/plonk/visualize/__init__.py
"""Visualize SPH data.
The Plonk implementat... | code_fim | hard | {
"lang": "python",
"repo": "dmentipl/plonk",
"path": "/src/plonk/visualize/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmentipl/plonk path: /src/plonk/visualize/__init__.py
"""Visualize SPH data.
The Plonk implementation for visualizing smoothed particle hydrodynamics
simulations using kernel density estimation based interpolation.
"""
<|fim_suffix|>__all__ = [
'animate',
'animation_images',
'animat... | code_fim | hard | {
"lang": "python",
"repo": "dmentipl/plonk",
"path": "/src/plonk/visualize/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JohnGarbutt/oslo.limit path: /oslo_limit/limit.py
# -*- coding: utf-8 -*-
# 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.apache.org/licenses/LICENSE... | code_fim | hard | {
"lang": "python",
"repo": "JohnGarbutt/oslo.limit",
"path": "/oslo_limit/limit.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, claim, callback=None, verify=True):
"""Context manager for checking usage against resource claims.
:param claim: An object containing information about the claim.
:type claim: ``oslo_limit.limit.ProjectClaim``
:param callback: A callable function th... | code_fim | hard | {
"lang": "python",
"repo": "JohnGarbutt/oslo.limit",
"path": "/oslo_limit/limit.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jhlegarreta/dipy path: /dipy/utils/parallel.py
import numpy as np
import multiprocessing
from tqdm.auto import tqdm
from dipy.utils.optpkg import optional_package
joblib, has_joblib, _ = optional_package('joblib')
dask, has_dask, _ = optional_package('dask')
ray, has_ray, _ = optional_package('r... | code_fim | hard | {
"lang": "python",
"repo": "jhlegarreta/dipy",
"path": "/dipy/utils/parallel.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif engine == "dask":
if not has_dask:
raise dask()
if backend is None:
backend = "threading"
if n_jobs == -1:
n_jobs = multiprocessing.cpu_count()
n_jobs = n_jobs - 1
def partial(func, *args, **keywords):
d... | code_fim | hard | {
"lang": "python",
"repo": "jhlegarreta/dipy",
"path": "/dipy/utils/parallel.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> results = ray.get([func.remote(ii, *func_args, **func_kwargs)
for ii in in_list])
elif engine == "serial":
results = []
for in_element in in_list:
results.append(func(in_element, *func_args, **func_kwargs))
if out_shape is not None:
... | code_fim | hard | {
"lang": "python",
"repo": "jhlegarreta/dipy",
"path": "/dipy/utils/parallel.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
asyncio.get_event_loop().run_until_complete(helpers.auto_connect(print_what_is_playing))<|fim_prefix|># repo: postlund/pyatv path: /examples/auto_connect.py
"""Simple example that connects to a device with autodiscover."""
<|fim_middle|>import asyncio
from pyatv import helpers
# Method that is dispa... | code_fim | hard | {
"lang": "python",
"repo": "postlund/pyatv",
"path": "/examples/auto_connect.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: postlund/pyatv path: /examples/auto_connect.py
"""Simple example that connects to a device with autodiscover."""
<|fim_suffix|>from pyatv import helpers
# Method that is dispatched by the asyncio event loop
async def print_what_is_playing(atv):
"""Print what is playing for the discovered d... | code_fim | easy | {
"lang": "python",
"repo": "postlund/pyatv",
"path": "/examples/auto_connect.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erictang000/stackbot path: /ScopeFoundryHW/picoharp/picoharp_channel_optimizer.py
from ScopeFoundry import Measurement
import pyqtgraph as pg
import numpy as np
import time
from ScopeFoundry.helper_funcs import sibling_path, load_qt_ui_file
class PicoHarpChannelOptimizer(Measurement):
name ... | code_fim | medium | {
"lang": "python",
"repo": "erictang000/stackbot",
"path": "/ScopeFoundryHW/picoharp/picoharp_channel_optimizer.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.plot = self.graph_layout.addPlot(title="Picoharp Channel Optimizer")
self.c0_plotline = self.plot.plot()
self.c1_plotline = self.plot.plot()
self.settings.c0_visible.add_listener(self.c0_plotline.setVisible, bool)
self.settings.c1_visible.add_listener(self.c1... | code_fim | hard | {
"lang": "python",
"repo": "erictang000/stackbot",
"path": "/ScopeFoundryHW/picoharp/picoharp_channel_optimizer.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> message = client.messages.create(
body=sms_text,
from_=twilio_number,
to=my_number
)
return message.sid
if __name__ == '__main__':
load_dotenv()
vk_id = input('Введите id ')
while True:
if get_status(vk_id) == 1:
sms_sender(f'{vk_id} i... | code_fim | hard | {
"lang": "python",
"repo": "alexagrchkva/for_reference",
"path": "/python/api_sms/homework.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexagrchkva/for_reference path: /python/api_sms/homework.py
import os
import time
import requests
from dotenv import load_dotenv
from twilio.rest import Client
def get_status(user_id):
access_token = os.getenv('VK_TOKEN')
url = 'https://api.vk.com/method/users.get'
params = {
... | code_fim | hard | {
"lang": "python",
"repo": "alexagrchkva/for_reference",
"path": "/python/api_sms/homework.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jameclear/phd_helper path: /iv_manipulate.py
# -*- coding: utf-8 -*-
"""
Functions to manipulate and modify measurement data for RTD current-voltage
characteristics.
Functions contained in module.
------------------------------
- make_symmetric(data, quadrant)
- scale(data, factor)
- extract_reg... | code_fim | hard | {
"lang": "python",
"repo": "jameclear/phd_helper",
"path": "/iv_manipulate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Raises:
-------
IndexError
In case the data array has more than 2 dimensions, i.e. data for more
than one device.
ValueError
In case an invalid parameter is specified for the `region` variable.
Notes:
------
Requires an installation of NumPy and SciPy. ... | code_fim | hard | {
"lang": "python",
"repo": "jameclear/phd_helper",
"path": "/iv_manipulate.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cfinster/webkit.js path: /deps/WebKit/Source/webcorejs.gyp
{
'includes': [
'../../../build/features.gypi',
'WebCore/Modules/modules.gypi',
#'WebCore/bindings/bindings.gypi',
'WebCore/webcorejs.gypi'
#'core.gypi',
],
'variables': {
'enable_wexit_time_destructors': 1,... | code_fim | hard | {
"lang": "python",
"repo": "cfinster/webkit.js",
"path": "/deps/WebKit/Source/webcorejs.gyp",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Generated from make_style_builder.py
'<(SHARED_INTERMEDIATE_DIR)/WebCore/StyleBuilder.cpp',
'<(SHARED_INTERMEDIATE_DIR)/WebCore/StyleBuilderFunctions.cpp',
],
},
{
# We'll soon split libwebcore in multiple smaller libraries.
# webcore_prerequisites will ... | code_fim | hard | {
"lang": "python",
"repo": "cfinster/webkit.js",
"path": "/deps/WebKit/Source/webcorejs.gyp",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> uuid = Column(String(36), unique=True, nullable=False, default=lambda: str(uuid4()))
_name = Column(Unicode(32), unique=True, nullable=False)
_description = Column(Unicode(512))
_locked = Column(Boolean, default=False, nullable=False)
boxes = relationship(
"Box",
back... | code_fim | hard | {
"lang": "python",
"repo": "moloch--/RootTheBox",
"path": "/models/Corporation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: moloch--/RootTheBox path: /models/Corporation.py
# -*- coding: utf-8 -*-
"""
Created on Mar 12, 2012
@author: moloch
Copyright 2012 Root the Box
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You ... | code_fim | hard | {
"lang": "python",
"repo": "moloch--/RootTheBox",
"path": "/models/Corporation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def name(self):
return self._name
@name.setter
def name(self, value):
if not len(value) <= 32:
raise ValidationError("Corporation name must be 0 - 32 characters")
self._name = str(value)
@property
def description(self):
if sel... | code_fim | hard | {
"lang": "python",
"repo": "moloch--/RootTheBox",
"path": "/models/Corporation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mediawiki-utilities/python-oresapi path: /oresapi/oresapi.py
"""
This script provides access to a set of utilities for ORES
* score_revisions -- Scores a set of revisions using an ORES API
<|fim_suffix|>
if len(sys.argv) < 2:
sys.stderr.write(USAGE)
sys.exit(1)
elif sys.... | code_fim | hard | {
"lang": "python",
"repo": "mediawiki-utilities/python-oresapi",
"path": "/oresapi/oresapi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
sys.path.insert(0, ".")
module = import_module(module_path, package="oresapi")
except ImportError:
sys.stderr.write(traceback.format_exc())
sys.stderr.write("Could not find module {0}.\n".format(module_path))
sys.exit(1)
module.main(sys.argv[2:])<|... | code_fim | medium | {
"lang": "python",
"repo": "mediawiki-utilities/python-oresapi",
"path": "/oresapi/oresapi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if len(sys.argv) < 2:
sys.stderr.write(USAGE)
sys.exit(1)
elif sys.argv[1] in ("-h", "--help"):
sys.stderr.write(__doc__.format(usage=USAGE))
sys.exit(1)
elif sys.argv[1][:1] == "-":
sys.stderr.write(USAGE)
sys.exit(1)
module_name = sys.arg... | code_fim | hard | {
"lang": "python",
"repo": "mediawiki-utilities/python-oresapi",
"path": "/oresapi/oresapi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Run the user's editor and wait for it to close
subprocess.Popen(args).wait()
tmp.seek(0)
try:
all_new_data = yaml.safe_load(tmp)
break
except yaml.YAMLError as e:
if hasattr(e, 'problem_mark'):
error_line = e.pr... | code_fim | hard | {
"lang": "python",
"repo": "TafadzwaG/pokedex",
"path": "/bin/edit-csv-as-yaml",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TafadzwaG/pokedex path: /bin/edit-csv-as-yaml
#!/usr/bin/env python2
"""Quick, dirty script that will convert a csv file to yaml, spawn an editor
for you to fiddle with it, then convert back to csv and replace the original
file.
Run me as: $0 some_file.csv [other_file.csv ...]
The editor used i... | code_fim | hard | {
"lang": "python",
"repo": "TafadzwaG/pokedex",
"path": "/bin/edit-csv-as-yaml",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for dct in all_new_data:
filename = dct['name']
new_data = dct['rows']
column_names = dct['column_names']
with open(filename, 'wb') as outfile:
writer = csv.writer(outfile, lineterminator='\n')
writer.writerow([ column.encode('utf8') for column in column_names ])
f... | code_fim | hard | {
"lang": "python",
"repo": "TafadzwaG/pokedex",
"path": "/bin/edit-csv-as-yaml",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> num=1
amount=len(image_detail_websites)
for i in image_detail_websites:
filename='C:\\Users\\傻豪\\Pictures\\Saved Pictures\\%s%s.jpg'%(image_title,num)
print('正在下载图片:%s第%s/%s张,'%(image_title,num,amount))
with open(filename,'wb') as f:
f.write(requests.get(i,headers=header(i)).content)
time.s... | code_fim | hard | {
"lang": "python",
"repo": "FreedomHappy/Spider",
"path": "/spider code/spider3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FreedomHappy/Spider path: /spider code/spider3.py
import io
import sys
import requests
import json
import time
from lxml import html
from multiprocessing.dummy import Pool as ThreadPool
#r=requests.get('https://www.douban.com/')
#sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding='gb1803... | code_fim | hard | {
"lang": "python",
"repo": "FreedomHappy/Spider",
"path": "/spider code/spider3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># users different fonts
for font in ['Uroob', 'Karumbi', 'Purisa-Bold']:
img = BasicImage()
img.add_text('Hello World', font=font, size=10)
img.add_text('@full.stack.hero', size=3, pos=(91,98))
img.save(f'test_font_{font}.png')
# playing with box width
for i in range(2,11):
i... | code_fim | hard | {
"lang": "python",
"repo": "axju/txt2image",
"path": "/example/example1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: axju/txt2image path: /example/example1.py
from txt2image.basic import BasicImage
from txt2image.misc import random_color
text = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero ... | code_fim | hard | {
"lang": "python",
"repo": "axju/txt2image",
"path": "/example/example1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># playing with box width
for i in range(2,11):
img = BasicImage()
img.add_text_box(text, width=i*10, size=5)
img.add_text('@full.stack.hero', size=3, pos=(91,98))
img.save(f'test_box_{i}.png')
# playing with box width
for i in range(4,11):
img = BasicImage()
img.add_text... | code_fim | hard | {
"lang": "python",
"repo": "axju/txt2image",
"path": "/example/example1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Aludeku/Python-course-backup path: /lista exercícios/PythonTeste/desafio083.py
expr = str(input('Digite uma expressão: '))
lista = []
for c in expr:
if c == '(':
<|fim_suffix|>
print('Sua expressão está incorreta')
else:
print('Sua expressão está correta')<|fim_middle|> lista.a... | code_fim | medium | {
"lang": "python",
"repo": "Aludeku/Python-course-backup",
"path": "/lista exercícios/PythonTeste/desafio083.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print('Sua expressão está incorreta')
else:
print('Sua expressão está correta')<|fim_prefix|># repo: Aludeku/Python-course-backup path: /lista exercícios/PythonTeste/desafio083.py
expr = str(input('Digite uma expressão: '))
lista = []
for c in expr:
if c == '(':
<|fim_middle|> lista.a... | code_fim | medium | {
"lang": "python",
"repo": "Aludeku/Python-course-backup",
"path": "/lista exercícios/PythonTeste/desafio083.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def distanceBetweenPoints(p1,p2):
return ((((int(p2[0]) - int(p1[0]))**2) + ((int(p2[1]) - int(p1[1]))**2))**0.5)
def drawCircle(win, centre, radius, colour):
circle = Circle(centre, radius)
circle.setFill(colour)
circle.setWidth(2)
circle.draw(win)
def drawColouredEye(w... | code_fim | hard | {
"lang": "python",
"repo": "andrewKv/previousCoursework",
"path": "/Python Coursework/functionLibrary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def distanceBetweenPointsFormat(p1,p2):
p1 = p1.getX(), p1.getY()
p2 = p2.getX(), p2.getY()
return (distanceBetweenPoints(p1,p2))
def distanceBetweenPoints(p1,p2):
return ((((int(p2[0]) - int(p1[0]))**2) + ((int(p2[1]) - int(p1[1]))**2))**0.5)
def drawCircle(win, centre, ... | code_fim | medium | {
"lang": "python",
"repo": "andrewKv/previousCoursework",
"path": "/Python Coursework/functionLibrary.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andrewKv/previousCoursework path: /Python Coursework/functionLibrary.py
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Functional~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
def factorial(n):
<|fim_suffix|>def drawColouredEye(win, centre, radius, colour):
colourList = ["white",colour,"black"]
for i ... | code_fim | hard | {
"lang": "python",
"repo": "andrewKv/previousCoursework",
"path": "/Python Coursework/functionLibrary.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_get_private(self):
self.shell.private=True
self.shell.author = self.user
self.shell.save()
self.failUnless(Shell.objects.get_owned(self.user, pastie__slug=TEST_SLUG, version=0))<|fim_prefix|># repo: nyov/mooshell path: /testcases/Shell.py
from django.db import IntegrityError
from django... | code_fim | hard | {
"lang": "python",
"repo": "nyov/mooshell",
"path": "/testcases/Shell.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # same version AND shell is forbidden
shell = self.get_shell(self.pastie, self.lib)
shell.save()
self.assertEqual(shell.version, 1)
# updating shell should not change the version
shell.save()
self.assertEqual(shell.version, 1)
shell1 = self.get_shell(self.pastie, self.lib)
shell1.save()
... | code_fim | hard | {
"lang": "python",
"repo": "nyov/mooshell",
"path": "/testcases/Shell.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nyov/mooshell path: /testcases/Shell.py
from django.db import IntegrityError
from django.conf import settings
from mooshell.models import Shell
from mooshell.testcases.base import *
class ShellTest(MooshellBaseTestCase):
<|fim_suffix|> def test_search_public_only(self):
self.shell.private = T... | code_fim | hard | {
"lang": "python",
"repo": "nyov/mooshell",
"path": "/testcases/Shell.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getParallelFitness( self, *args ):
with mktemp( prefix = "vips" ) as tmpexe:
oldexe = self.exe
shutil.copyfile( self.exe, tmpexe )
shutil.copymode( self.exe, tmpexe )
try:
self.exe = tmpexe
results = ParallelTe... | code_fim | hard | {
"lang": "python",
"repo": "dornja/powergauge",
"path": "/benchmarks/vips/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validateCorrectness( self, outfile ):
correctness = ParallelTest.validateCorrectness( self, outfile )
with Multitmp( len( outfile ) ) as tmp:
Multitmp.check_call(
[ "sed", "-e", "/^#im_vips2ppm/d", outfile ],
stdout = tmp
)
... | code_fim | hard | {
"lang": "python",
"repo": "dornja/powergauge",
"path": "/benchmarks/vips/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dornja/powergauge path: /benchmarks/vips/test.py
#!/usr/bin/python
import os
import shutil
import sys
root = os.path.abspath( sys.argv[ 0 ] )
for i in range( 3 ):
root = os.path.dirname( root )
sys.path.append( os.path.join( root, "lib" ) )
from testutil import ParallelTest, Multitmp
from u... | code_fim | hard | {
"lang": "python",
"repo": "dornja/powergauge",
"path": "/benchmarks/vips/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sulter/MASTERlinker path: /includes/helpers.py
# Functions that multiple plugins should use
import copy
import json
import logging
import os
import re
import unicodedata
class Plugin:
def __init__(self, parent):
self.parent = parent
def handle_message(self, msg_data):
'''
This ... | code_fim | hard | {
"lang": "python",
"repo": "Sulter/MASTERlinker",
"path": "/includes/helpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if neg:
output = '-' + output
return output
def shorten_period(string, max_terms=2, collapse_weeks=True):
'''
Take an ISO 8601 period string, return something human readable.
Lowercase the time component while leaving the date component uppercase.
'''
if string[0] != 'P':
raise Valu... | code_fim | hard | {
"lang": "python",
"repo": "Sulter/MASTERlinker",
"path": "/includes/helpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return decorated_view
def handle_nonexistence(view):
"""
View decorator that catches ObjectDoesNotExist exceptions and returns a 404
HttpResponse.
"""
def decorated_view(*args, **kwargs):
try:
result = view(*args, **kwargs)
except ObjectDoesNotExist:
... | code_fim | hard | {
"lang": "python",
"repo": "CaoRuiming/CS1320-Final-Project",
"path": "/backend/api/decorators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CaoRuiming/CS1320-Final-Project path: /backend/api/decorators.py
from django.http import HttpRequest, HttpResponse
from django.core.exceptions import ObjectDoesNotExist
<|fim_suffix|> def decorated_view(*args, **kwargs):
try:
result = view(*args, **kwargs)
except O... | code_fim | hard | {
"lang": "python",
"repo": "CaoRuiming/CS1320-Final-Project",
"path": "/backend/api/decorators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_cuda_matmul_relu():
# pylint: disable=line-too-long
expected = [
[
'b0 = sch.get_block(name="C", func_name="main")',
'sch.annotate(block_or_loop=b0, ann_key="meta_schedule.tiling_structure", ann_val="SSSRRSRS")',
"l1, l2, l3 = sch.get_loops(bloc... | code_fim | hard | {
"lang": "python",
"repo": "were/tvm",
"path": "/tests/python/unittest/test_meta_schedule_schedule_rule_multi_level_tiling.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: were/tvm path: /tests/python/unittest/test_meta_schedule_schedule_rule_multi_level_tiling.py
'sch.annotate(block_or_loop=b0, ann_key="meta_schedule.tiling_structure", ann_val="SSRSRS")',
"l1, l2, l3 = sch.get_loops(block=b0)",
"v4, v5, v6, v7 = sch.sample_perfect_tile(l... | code_fim | hard | {
"lang": "python",
"repo": "were/tvm",
"path": "/tests/python/unittest/test_meta_schedule_schedule_rule_multi_level_tiling.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: were/tvm path: /tests/python/unittest/test_meta_schedule_schedule_rule_multi_level_tiling.py
"sch.reorder(l8, l16, l9, l17, l22, l10, l18, l23, l11, l19)",
'b24 = sch.cache_write(block=b0, write_buffer_index=0, storage_scope="global")',
"sch.reverse_compute_at... | code_fim | hard | {
"lang": "python",
"repo": "were/tvm",
"path": "/tests/python/unittest/test_meta_schedule_schedule_rule_multi_level_tiling.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PrintCLBHeader(Module):
def process(self, blob):
print(blob['CLBHeader'])
return blob
pipeline = Pipeline()
pipeline.attach(CLBPump,
filename='/Users/tamasgal/Data/KM3NeT/du1-clb/DOM2_run23.dat')
pipeline.attach(StatusBar)
pipeline.attach(PrintCLBHeader)
pipeline... | code_fim | hard | {
"lang": "python",
"repo": "kabartay/km3pipe",
"path": "/examples/nogallery/clb_pump.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, **context):
super(self.__class__, self).__init__(**context)
self.tots = []
def process(self, blob):
for pmt_data in blob['PMTData']:
self.tots.append(pmt_data.tot)
return blob
def finish(self):
plt.hist(self.tots, 80)
... | code_fim | medium | {
"lang": "python",
"repo": "kabartay/km3pipe",
"path": "/examples/nogallery/clb_pump.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kabartay/km3pipe path: /examples/nogallery/clb_pump.py
from __future__ import division, absolute_import, print_function
__author__ = 'tamasgal'
import matplotlib.pyplot as plt
from km3pipe import Pipeline, Module
from km3pipe.io import CLBPump
from km3modules import StatusBar
class TOTHisto(M... | code_fim | hard | {
"lang": "python",
"repo": "kabartay/km3pipe",
"path": "/examples/nogallery/clb_pump.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if k > 0:
s2 = self.active_ssms(k-1)
if s2 != s1:
return False
for j in s1:
if self.scales[j] is not None:
return False
if not self.ssms[j].stationary(k-self.ssm_starts[j]):
return False
... | code_fim | hard | {
"lang": "python",
"repo": "davmre/sigvisa",
"path": "/models/statespace/transient.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davmre/sigvisa path: /models/statespace/transient.py
import numpy as np
import scipy.stats
import copy
from sigvisa.models.statespace import StateSpaceModel
class TransientCombinedSSM(StateSpaceModel):
"""
State space model consisting of a bunch of submodels that come and go, each mode... | code_fim | hard | {
"lang": "python",
"repo": "davmre/sigvisa",
"path": "/models/statespace/transient.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # matrix case
else:
assert(len(x.shape)==2)
try:
rr = self.tmp_arrays[len(result)]
except KeyError:
rr = np.empty((len(result),))
self.tmp_arrays[len(result)] = rr
result[:] = 0
fo... | code_fim | hard | {
"lang": "python",
"repo": "davmre/sigvisa",
"path": "/models/statespace/transient.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acesarjunior/Splunk-Data-Transfer path: /settings_transfer.py
HOST="" #INSERT THE HOST/IP
#AUTHENTICATION
USER="" #INSERT THE USER
PASSWD='' #INSERT THE USER PASSWORD
PATH_SSH="" #INSERT THE SSH PATH WHERE THE KNOW_HOSTS IS LOCATED IN YOUR LOCAL MACHINE
#REMOTE DIRECTORIES
REMOTE_DIR_APPS="" #... | code_fim | medium | {
"lang": "python",
"repo": "acesarjunior/Splunk-Data-Transfer",
"path": "/settings_transfer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>LOCAL_DIR_APPS="" #INSERT THE DIR WHERE THE APPS WILL BE STORED
LOCAL_DIR_MODINPUTS="" #INSERT THE DIR WHERE THE MODINPUTS WILL BE STORED
LOCAL_DIR_KVSTORE="" #INSERT THE DIR WHERE THE KVSTORE WILL BE STORED<|fim_prefix|># repo: acesarjunior/Splunk-Data-Transfer path: /settings_transfer.py
HOST="" #INSER... | code_fim | hard | {
"lang": "python",
"repo": "acesarjunior/Splunk-Data-Transfer",
"path": "/settings_transfer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(
extract_qualified_name(TestClass.method),
"{}.TestClass.method".format(__name__),
)
self.assertEqual(
extract_qualified_name(TestDerived.method),
"{}.TestClass.method".format(__name__),
)
# Parameter __e... | code_fim | hard | {
"lang": "python",
"repo": "facebook/pyre-check",
"path": "/tools/generate_taint_models/tests/inspect_parser_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: facebook/pyre-check path: /tools/generate_taint_models/tests/inspect_parser_test.py
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from dataclasses ... | code_fim | hard | {
"lang": "python",
"repo": "facebook/pyre-check",
"path": "/tools/generate_taint_models/tests/inspect_parser_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ojengwa/seldon-ucl path: /dcs/analyze.py
import pandas as pd
import numpy as np
import datetime
def textAnalysis(series):
analysis = {}
minWordCount = float('inf')
maxWordCount = 0
totalWords = 0
wordCounts = {}
sumOfWordLengths = 0
wordFrequencies = []
frequencyCount = 0
averageWordsP... | code_fim | hard | {
"lang": "python",
"repo": "ojengwa/seldon-ucl",
"path": "/dcs/analyze.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> analysis["invalid"] = series.isnull().sum()
analysis["max"] = datetime.datetime.strftime(maximum, "%Y-%m-%dT%H:%M:%SZ")
analysis["median"] = datetime.datetime.strftime(median, "%Y-%m-%dT%H:%M:%SZ")
analysis["min"] = datetime.datetime.strftime(minimum, "%Y-%m-%dT%H:%M:%SZ")
return analysis
# Returns... | code_fim | hard | {
"lang": "python",
"repo": "ojengwa/seldon-ucl",
"path": "/dcs/analyze.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.