text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> # Make sure we fail when file cannot be opened
pytest.raises(OpenL3Error, openl3.process_audio_file,
'/fake/directory/asdf.wav', model=model)
pytest.raises(OpenL3Error, openl3.process_audio_file, None, model=model)
K.clear_session()
def test_process_image_file():
te... | code_fim | hard | {
"lang": "python",
"repo": "Bomme/openl3",
"path": "/tests/test_core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AaltoVision/pytorch-semseg path: /ptsemseg/models/tiramisu.py
import torch
import torch.nn as nn
from collections import OrderedDict
from ptsemseg.utils import initialize_weights
class _DenseLayer(nn.Sequential):
def __init__(self, num_input_features, growth_rate, bn_size, drop_rate):
... | code_fim | hard | {
"lang": "python",
"repo": "AaltoVision/pytorch-semseg",
"path": "/ptsemseg/models/tiramisu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = self.features[7](x) # Denseblock-down4
keep_shortcuts.append(x)
x = self.features[8](x) # Transition-down4
x = self.features[9](x) # Denseblock-down5
keep_shortcuts.append(x)
x = self.features[10](x) # Transition-down5
keep_shortcuts = keep_sho... | code_fim | hard | {
"lang": "python",
"repo": "AaltoVision/pytorch-semseg",
"path": "/ptsemseg/models/tiramisu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = self.features[12](torch.cat(keep,1)) # Transition-up1
x = torch.cat((x[:,:,1:-1,1:-1], keep_shortcuts[0]),1)
del keep[:]
for name, layer in self.features[13].named_children():
x = layer(x)
keep.append(x.narrow(1,0, self.growth_rate))
x ... | code_fim | hard | {
"lang": "python",
"repo": "AaltoVision/pytorch-semseg",
"path": "/ptsemseg/models/tiramisu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: roarkemc/StatTools path: /stattools/smoothing/__init__.py
"""Scatterplot smoothers."""
from .bin import BinSmoother
fr<|fim_suffix|>nelSmoother
from .knn import KNNSmoother
from .polynomial import PolynomialSmoother
from .smoothing import BaggingSmoother<|fim_middle|>om .kde import KernelDensity... | code_fim | medium | {
"lang": "python",
"repo": "roarkemc/StatTools",
"path": "/stattools/smoothing/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ort PolynomialSmoother
from .smoothing import BaggingSmoother<|fim_prefix|># repo: roarkemc/StatTools path: /stattools/smoothing/__init__.py
"""Scatterplot smoothers."""
from .bin import BinSmoother
fr<|fim_middle|>om .kde import KernelDensityEstimator
from .kernel import KernelSmoother
from .knn import... | code_fim | medium | {
"lang": "python",
"repo": "roarkemc/StatTools",
"path": "/stattools/smoothing/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>nelSmoother
from .knn import KNNSmoother
from .polynomial import PolynomialSmoother
from .smoothing import BaggingSmoother<|fim_prefix|># repo: roarkemc/StatTools path: /stattools/smoothing/__init__.py
"""Scatterplot smoothers."""
from .bin import BinSmoother
fr<|fim_middle|>om .kde import KernelDensity... | code_fim | medium | {
"lang": "python",
"repo": "roarkemc/StatTools",
"path": "/stattools/smoothing/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def gps_status_callback(self,data):
gps_covariance = data.position_covariance
self.gps_Hacc = sqrt(gps_covariance[0])
self.gps_Vacc = sqrt(gps_covariance[8])
if self.gps_Hacc < 10.0 and self.gps_Vacc < 10.0:
self.check_list['gps'] = True
def vel_test_od... | code_fim | hard | {
"lang": "python",
"repo": "tranqkhue/bugcar",
"path": "/src/bugcar_bringup/script/conditional_launch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tranqkhue/bugcar path: /src/bugcar_bringup/script/conditional_launch.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import rospy
import roslaunch
import tf
import nump as np
from geometry_msgs.msg import Twist
from bno055_usd_stick_msgs.msg import Output as BNO055_OUTPUT
from bno055_usd_stic... | code_fim | hard | {
"lang": "python",
"repo": "tranqkhue/bugcar",
"path": "/src/bugcar_bringup/script/conditional_launch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.enterExpression21(ctx)
def exitExpression1(self, ctx: JavaParserLabeled.Expression1Context):
if self.is_safe and self.need_cast and self.variable is not None:
# Type casting
child = ctx.getChild(0).getChild(0)
self.token_stream_rewriter.replace... | code_fim | hard | {
"lang": "python",
"repo": "m-zakeri/CodART",
"path": "/codart/refactorings/pushdown_method.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if ctx.IDENTIFIER(0).getText() == self.source_class and self.is_safe:
self.detected_class = True
self.start = ctx.start
self.stop = ctx.stop
def enterMethodCall0(self, ctx: JavaParserLabeled.MethodCall0Context):
if ctx.IDENTIFIER().getText() == self... | code_fim | hard | {
"lang": "python",
"repo": "m-zakeri/CodART",
"path": "/codart/refactorings/pushdown_method.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: m-zakeri/CodART path: /codart/refactorings/pushdown_method.py
"""
## Introduction
The module implements push-down method refactoring
### Pre-conditions:
Todo: Add pre-conditions
### Post-conditions:
Todo: Add post-conditions
"""
__version__ = '0.1.1'
__author__ = "Morteza Zakeri"
try:
... | code_fim | hard | {
"lang": "python",
"repo": "m-zakeri/CodART",
"path": "/codart/refactorings/pushdown_method.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simondharding/pygtop path: /pygtop/__init__.py
from .ligands import *
from .targets import *
from .interactions import *
from .exceptions import *
<<<<<<< HEAD
__version__ = <|fim_suffix|> https and version to 2.1.5 by simon)
__author__ = "Sam Ireland"<|fim_middle|>"2.1.4"
=======
__version__ = ... | code_fim | medium | {
"lang": "python",
"repo": "simondharding/pygtop",
"path": "/pygtop/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> https and version to 2.1.5 by simon)
__author__ = "Sam Ireland"<|fim_prefix|># repo: simondharding/pygtop path: /pygtop/__init__.py
from .ligands import *
from .targets import *
from .interactions<|fim_middle|> import *
from .exceptions import *
<<<<<<< HEAD
__version__ = "2.1.4"
=======
__version__ = ... | code_fim | medium | {
"lang": "python",
"repo": "simondharding/pygtop",
"path": "/pygtop/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>"2.1.4"
=======
__version__ = "2.1.5"
>>>>>>> 548f9a8 (fixes for https and version to 2.1.5 by simon)
__author__ = "Sam Ireland"<|fim_prefix|># repo: simondharding/pygtop path: /pygtop/__init__.py
from .ligands import *
from .targets import *
from .interactions<|fim_middle|> import *
from .exceptions imp... | code_fim | medium | {
"lang": "python",
"repo": "simondharding/pygtop",
"path": "/pygtop/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if random is True:
if random_state is None:
rand_idx = np.random.permutation(y.shape[0])[:N]
else:
rand_idx = np.random.RandomState(seed=random_state).permutation(y.shape[0])[:N]
else:
rand_idx = np.arange(y.shape[0])[:N]
... | code_fim | hard | {
"lang": "python",
"repo": "remykusters/DeePyMoD_sensor",
"path": "/src/deepymod/data/base.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: remykusters/DeePyMoD_sensor path: /src/deepymod/data/base.py
""" Contains the base class for the Dataset (1 and 2 dimensional) and a function
that takes a Pytorch tensor and converts it to a numpy array"""
import torch
import numpy as np
from numpy import ndarray
def pytorch_func(function... | code_fim | hard | {
"lang": "python",
"repo": "remykusters/DeePyMoD_sensor",
"path": "/src/deepymod/data/base.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Shnitselon/cloudshell-cli path: /cloudshell/cli/command_template/command_template.py
import re
from collections import OrderedDict
class CommandTemplate:
def __init__(self, command, action_map=None, error_map=None):
"""Command Template.
:type command: str
:type acti... | code_fim | hard | {
"lang": "python",
"repo": "Shnitselon/cloudshell-cli",
"path": "/cloudshell/cli/command_template/command_template.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> :rtype: OrderedDict
"""
return self._error_map
# ToDo: Needs to be reviewed
def get_command(self, **kwargs):
action_map = OrderedDict(kwargs.get("action_map", None) or OrderedDict())
action_map.update(self._action_map)
error_map = OrderedDict(self._... | code_fim | medium | {
"lang": "python",
"repo": "Shnitselon/cloudshell-cli",
"path": "/cloudshell/cli/command_template/command_template.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> cmd = self._command
keys = re.findall(r"{(\w+)}", self._command)
for key in keys:
if key not in kwargs or kwargs[key] is None:
cmd = re.sub(r"\[[^[]*?{{{key}}}.*?\]".format(key=key), r"", cmd)
if not cmd:
raise Exception(self.__class... | code_fim | hard | {
"lang": "python",
"repo": "Shnitselon/cloudshell-cli",
"path": "/cloudshell/cli/command_template/command_template.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> audio_filename = converted_paths[i]
#Need to be converted to an absolute path
audio_filename = os.path.abspath(audio_filename)
'''
Perform data extraction and label storage
'''
label_filename = audio_filename.split(audio_filename.split('.')[-1])[0]+'... | code_fim | hard | {
"lang": "python",
"repo": "yiweichen04/Application-of-Word2vec-in-Phoneme-Recognition",
"path": "/data_preprocess.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yiweichen04/Application-of-Word2vec-in-Phoneme-Recognition path: /data_preprocess.py
#-*- encoding:utf-8 -*-
import numpy as np
import pickle
import librosa
from pathlib import Path
import os
import re
import sys
import h5py
import python_speech_features
from python_speech_features import mfcc
im... | code_fim | hard | {
"lang": "python",
"repo": "yiweichen04/Application-of-Word2vec-in-Phoneme-Recognition",
"path": "/data_preprocess.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IlyasYOY/di-python path: /app/route.py
import logging
from flask import Blueprint, current_app, jsonify, request
routes = Blueprint('routes', __name__)
logger = logging.getLogger(__name__)
@routes.route('/todos', methods=['GET'])
def get_todos():
<|fim_suffix|>@routes.route('/todos', methods=... | code_fim | hard | {
"lang": "python",
"repo": "IlyasYOY/di-python",
"path": "/app/route.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@routes.route('/todos/<string:identity>', methods=['GET'])
def get_todo(identity: str):
todo_fetched_by_id = current_app.todos.fetch_by_id(identity)
return jsonify(todo_fetched_by_id.to_dict()), 200
@routes.route('/todos/<string:identity>', methods=['DELETE'])
def remove_todo(identity: str):
... | code_fim | medium | {
"lang": "python",
"repo": "IlyasYOY/di-python",
"path": "/app/route.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Copy tensor to numpy.
grad, grad_square = grad_trace
index = index.numpy()
grad = grad.numpy()
grad_square = grad_square.numpy()
# update adagrad
_moment[index] += grad_square
std = np.sqrt(_moment[index]) + 1e-10
grad = -self._lr ... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PGL",
"path": "/pgl/utils/shared_embedding.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PaddlePaddle/PGL path: /pgl/utils/shared_embedding.py
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PGL",
"path": "/pgl/utils/shared_embedding.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def from_file(cls,
weight_path,
optimizer='AdaGrad',
learning_rate=0.1,
num_workers=1):
"""Initialize SharedEmbedding from array stored in weight_path
"""
return cls(weight_path=weight_path... | code_fim | hard | {
"lang": "python",
"repo": "PaddlePaddle/PGL",
"path": "/pgl/utils/shared_embedding.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tor4z/level-set-machine-learning path: /lsml/util/distance_transform.py
import numpy
import skfmm
def distance_transform(arr, band, dx):
""" A thin wrapper around the skfmm distance transform function, but
handles edge cases where the provided array is completely negative or
positiv... | code_fim | hard | {
"lang": "python",
"repo": "tor4z/level-set-machine-learning",
"path": "/lsml/util/distance_transform.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dist = skfmm.distance(arr, narrow=band, dx=dx)
if hasattr(dist, 'mask'):
mask = ~dist.mask
dist = dist.data
else:
# If no mask, then the band was large enough to
# include the entire domain.
mask = numpy.ones(arr.shape, dtype=numpy.bool)
return dis... | code_fim | hard | {
"lang": "python",
"repo": "tor4z/level-set-machine-learning",
"path": "/lsml/util/distance_transform.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GuillaumeDesforges/simple-ocr path: /app/Controller.py
import os
from time import strftime, gmtime
import editdistance
import keras
import numpy as np
from PyQt4 import QtCore
from app.Msg_screen import *
from app.Progress_screen import ProgressWindow
from engine.callbacks.gui import GUICallbac... | code_fim | hard | {
"lang": "python",
"repo": "GuillaumeDesforges/simple-ocr",
"path": "/app/Controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TODO
print('Translating page "' + self.page_name + '", with network "' + self.network_name + '"')
self.ui.start_eval_button.setEnabled(False)
self.ui.pause_eval_button.setEnabled(True)
self.ui.end_eval_button.setEnabled(True)
self.ui.apply_page... | code_fim | hard | {
"lang": "python",
"repo": "GuillaumeDesforges/simple-ocr",
"path": "/app/Controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
## Test Window ##
def bind_test(self):
self.ui.apply_network.clicked.connect(self.set_network)
self.ui.start_test_button.clicked.connect(self.start_test)
def start_test(self):
print('Testing Network "' + self.network_name + '"')
data_path = '/home/arsle... | code_fim | hard | {
"lang": "python",
"repo": "GuillaumeDesforges/simple-ocr",
"path": "/app/Controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>train_set = (train_x, train_y)
valid_set = (train_x, train_y)
test_set = (test_x, test_y)
train_set_x, train_set_y = shared_dataset(train_set)
valid_set_x, valid_set_y = shared_dataset(valid_set)
test_set_x, test_set_y = shared_dataset(test_set)
##########################################################... | code_fim | hard | {
"lang": "python",
"repo": "myt00seven/svrg",
"path": "/cifar/jaehoon_sample.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: myt00seven/svrg path: /cifar/jaehoon_sample.py
#######################3 Theano shared dataset ######################
def shared_dataset(data_xy, borrow=True):
data_x, data_y = data_xy
shared_x = theano.shared(numpy.asarray(data_x,
dtype=theano.con... | code_fim | medium | {
"lang": "python",
"repo": "myt00seven/svrg",
"path": "/cifar/jaehoon_sample.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rafimuhammad01/mtf-hackathon path: /training/migrations/0008_training_topic.py
# Generated by Django 3.2 on 2021-05-05 19:19
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('forum', '0043_auto_20210506_0219'),
('training', '0007_auto_20210501_2003'... | code_fim | easy | {
"lang": "python",
"repo": "rafimuhammad01/mtf-hackathon",
"path": "/training/migrations/0008_training_topic.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('forum', '0043_auto_20210506_0219'),
('training', '0007_auto_20210501_2003'),
]
operations = [
migrations.AddField(
model_name='training',
name='topic',
field=models.ManyToManyField(blank=True, to='forum.Topic'),
... | code_fim | medium | {
"lang": "python",
"repo": "rafimuhammad01/mtf-hackathon",
"path": "/training/migrations/0008_training_topic.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> seg_loss_meters = list()
seg_loss_meters.append(train_seg_cs_loss)
if args['include_vistas']:
seg_loss_meters.append(train_seg_vis_loss)
seg_loss_meters.append(train_seg_extra_loss)
curr_iter = start_iter
for i in range(args['max_iter']):
optimizer.param_groups[0]... | code_fim | hard | {
"lang": "python",
"repo": "anon454/TrunkSegmentation",
"path": "/train/train_with_correspondences.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anon454/TrunkSegmentation path: /train/train_with_correspondences.py
ort cityscapes, correspondences
import utils.corr_transforms as corr_transforms
import utils.transforms as extended_transforms
import utils.joint_transforms as joint_transforms
import datasets.dataset_configs as data_configs
imp... | code_fim | hard | {
"lang": "python",
"repo": "anon454/TrunkSegmentation",
"path": "/train/train_with_correspondences.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> optimizer.zero_grad()
# correspondence loss
if output_vals_ref.size(0) > 0:
loss_corr_hr = corr_loss_fct(
output_vals_ref,
output_vals_other,
pts_ref_orig,
pts_other_orig,
... | code_fim | hard | {
"lang": "python",
"repo": "anon454/TrunkSegmentation",
"path": "/train/train_with_correspondences.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tspycher/pyaeromanager path: /cli/others/airplaneform.py
__author__ = 'tspycher'
import npyscreen
from app.documents.airplane import Airplane, PerformanceChart
from cli import MultilineManage
class AirplaneChartForm(npyscreen.ActionPopup):
parent_document = None
document = None
updat... | code_fim | hard | {
"lang": "python",
"repo": "tspycher/pyaeromanager",
"path": "/cli/others/airplaneform.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.update:
pass
else:
self.parent_document.charts.append(self.document)
self.parentApp.switchFormPrevious()
def on_cancel(self):
self.parentApp.switchFormPrevious()
def while_editing(self, *args, **keywords):
self.document.name... | code_fim | hard | {
"lang": "python",
"repo": "tspycher/pyaeromanager",
"path": "/cli/others/airplaneform.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MLStruckmann/tensorflow-templates path: /1-computer-vision/1-cv-preprocess-plot-data.py
# Plot input data
plt.figure(figsize=(10, 10))
for images, labels in train_ds.take(1):
for<|fim_suffix|>pe("uint8"))
plt.title(class_names[labels[i]])
plt.axis("off")
for image_batch, lab... | code_fim | medium | {
"lang": "python",
"repo": "MLStruckmann/tensorflow-templates",
"path": "/1-computer-vision/1-cv-preprocess-plot-data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pe("uint8"))
plt.title(class_names[labels[i]])
plt.axis("off")
for image_batch, labels_batch in train_ds:
print(image_batch.shape)
print(labels_batch.shape)
break<|fim_prefix|># repo: MLStruckmann/tensorflow-templates path: /1-computer-vision/1-cv-preprocess-plot-data.py
# Pl... | code_fim | medium | {
"lang": "python",
"repo": "MLStruckmann/tensorflow-templates",
"path": "/1-computer-vision/1-cv-preprocess-plot-data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return '%s' % (self.modulo)
class UD_modulo(models.Model): # Unidad didáctica del módulo
programacion = models.ForeignKey(Programacion_modulo, blank=True, null=True, on_delete=models.CASCADE)
nombre = models.CharField('Nombre de la unidad didáctica', max_length=300, blank=True, null=Tru... | code_fim | hard | {
"lang": "python",
"repo": "jjmartinr01/gauss3",
"path": "/programaciones/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def ceps_es_borrable(self, ceps):
cevps = ceps.cevprogsec_set.all()
return CalAlumValor.objects.filter(ca__cie__ieval__asapren__sapren=self, ca__cp__tipo='PRO',
ca__cp__borrado=False, ecpv__valor__gt=0,
... | code_fim | hard | {
"lang": "python",
"repo": "jjmartinr01/gauss3",
"path": "/programaciones/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jjmartinr01/gauss3 path: /programaciones/models.py
istemas Electrotécnicos y Automáticos", "590"),
("803", "Cultura Clásica", "590"),
("001", "Filosofía", "511"),
("002", "Griego", "511"),
("003", "Latín", "51... | code_fim | hard | {
"lang": "python",
"repo": "jjmartinr01/gauss3",
"path": "/programaciones/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: apkunpacker/happer path: /ds5-scripts/aosp_8_1/arm/LoadClassMembers.py
# LoadClass_arm.py is used to .... when the "ClassLinker::LoadClassMembers" method is invoked in 32-bit mode.
import gc
import os
import sys
from arm_ds.debugger_v1 import Debugger
from arm_ds.debugger_v1 import Debug... | code_fim | hard | {
"lang": "python",
"repo": "apkunpacker/happer",
"path": "/ds5-scripts/aosp_8_1/arm/LoadClassMembers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> direct_methods_off = instance_fields_off + length_instance_fields
direct_methods, length_direct_methods = class_data_item.get_direct_methods(dex_file_begin_val, class_data_off, direct_methods_off, direct_methods_size)
for idx in range(direct_methods_size):
config.log_print("[LoadClassMembers] [cla... | code_fim | hard | {
"lang": "python",
"repo": "apkunpacker/happer",
"path": "/ds5-scripts/aosp_8_1/arm/LoadClassMembers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bcgov/lear path: /legal-api/tests/unit/models/test_consent_continuation_out.py
# Copyright © 2023 Province of British Columbia
#
# 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 Lice... | code_fim | hard | {
"lang": "python",
"repo": "bcgov/lear",
"path": "/legal-api/tests/unit/models/test_consent_continuation_out.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> expiry_date = get_cco_expiry_date(filing.effective_date)
consent_continuation_out = ConsentContinuationOut()
consent_continuation_out.foreign_jurisdiction = 'CA'
consent_continuation_out.foreign_jurisdiction_region = 'AB'
consent_continuation_out.expiry_date = expiry_date
consent_... | code_fim | hard | {
"lang": "python",
"repo": "bcgov/lear",
"path": "/legal-api/tests/unit/models/test_consent_continuation_out.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def get_cco_expiry_date(filing_effective_date):
effective_date = LegislationDatetime.as_legislation_timezone(filing_effective_date)
_date = effective_date.replace(hour=23, minute=59, second=0, microsecond=0)
_date += datedelta.datedelta(months=6)
# Setting legislation timezone again afte... | code_fim | hard | {
"lang": "python",
"repo": "bcgov/lear",
"path": "/legal-api/tests/unit/models/test_consent_continuation_out.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: osgirl/boogio path: /boogio/test/test_iam_informer.py
# ----------------------------------------------------------------------------
# Copyright (C) 2017 Verizon. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in co... | code_fim | hard | {
"lang": "python",
"repo": "osgirl/boogio",
"path": "/boogio/test/test_iam_informer.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''Test expansion (fetching child resources) of iam informers.'''
informer = aws_informer.IAMInformer(
mediator=GLOBAL_MEDIATOR
)
self.assertEqual(informer.expansions, {})
informer.expand()
for key in informer.expansions:
self... | code_fim | hard | {
"lang": "python",
"repo": "osgirl/boogio",
"path": "/boogio/test/test_iam_informer.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MridulS/binder-launches path: /parser_py/alembic/versions/2e60c80f54ce_added_launch_table.py
"""Added launch table
Revision ID: 2e60c80f54ce
Revises:
Create Date: 2021-03-12 19:30:41.277172
"""
import sqlalchemy as sa
from alembic import op
from parser_py.settings import load_settings
# revi... | code_fim | hard | {
"lang": "python",
"repo": "MridulS/binder-launches",
"path": "/parser_py/alembic/versions/2e60c80f54ce_added_launch_table.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.drop_index("launches_timestamp_idx", table_name="launches")
op.drop_index("launches_provider_repo_idx", table_name="launches")
op.drop_index("launches_provider_idx", table_name="launches")
op.drop_index("launches_origin_i... | code_fim | hard | {
"lang": "python",
"repo": "MridulS/binder-launches",
"path": "/parser_py/alembic/versions/2e60c80f54ce_added_launch_table.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>doctors import AuthenticatedDoctor
from .doctors import DoctorDisease
from .time_statistics import TimeCount
from .region_statistics import RegionCount<|fim_prefix|># repo: medsci-tech/mime_analysis_flask_2017 path: /app/models/__init__.py
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
# imp... | code_fim | medium | {
"lang": "python",
"repo": "medsci-tech/mime_analysis_flask_2017",
"path": "/app/models/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: medsci-tech/mime_analysis_flask_2017 path: /app/models/__init__.py
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
# import your models here,
# otherwise, your models won't be detected by migrate.
from .us<|fim_suffix|>doctors import AuthenticatedDoctor
from .doctors import DoctorDise... | code_fim | hard | {
"lang": "python",
"repo": "medsci-tech/mime_analysis_flask_2017",
"path": "/app/models/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> text = [t.strip().split(': ') for t in text]
layer_info = [[int(t[0]), int(t[1])] for t in text]
state = layer_info
test_time = 0
while True:
if test_time % 1000 == 0:
print(test_time)
fw = Firewall(state, test_time)
state, success = fw.run()
... | code_fim | hard | {
"lang": "python",
"repo": "ngoldbaum/advent_of_code_2017",
"path": "/day_13/firewall.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ngoldbaum/advent_of_code_2017 path: /day_13/firewall.py
class Layer:
def __init__(self, depth, range, scanner_pos=None, scanner_step=None):
self.depth = depth
self.range = range
if scanner_step is not None:
self.scanner_step = scanner_step
else:
... | code_fim | hard | {
"lang": "python",
"repo": "ngoldbaum/advent_of_code_2017",
"path": "/day_13/firewall.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ENCODE-DCC/encoded path: /src/encoded/upgrade/award.py
from snovault import upgrade_step
@upgrade_step('award', '', '2')
def award_0_2(value, system):
# http://redmine.encodedcc.org/issues/1295
# http://redmine.encodedcc.org/issues/1307
rfa_mapping = ['ENCODE2', 'ENCODE2-Mouse']
... | code_fim | hard | {
"lang": "python",
"repo": "ENCODE-DCC/encoded",
"path": "/src/encoded/upgrade/award.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@upgrade_step('award', '6', '7')
def award_6_7(value, system):
# https://encodedcc.atlassian.net/browse/ENCD-4711
for milestone in value.get('milestones', []):
assay_term_name = milestone.get('assay_term_name', '')
if assay_term_name == 'single-nuclei ATAC-seq':
milest... | code_fim | hard | {
"lang": "python",
"repo": "ENCODE-DCC/encoded",
"path": "/src/encoded/upgrade/award.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: naseef12356/Adv-Auto-Filter-Bot path: /bot/translation.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) @CFCHART
class Translation(object):
START_TEXT = """<b>Hai {}!!</b>
<i>I AM PROPERTY OF @CFCHART AND @CFCHATOFFICIAL</i>"""
HELP_TEXT = """<i><u>Usage Gui... | code_fim | hard | {
"lang": "python",
"repo": "naseef12356/Adv-Auto-Filter-Bot",
"path": "/bot/translation.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|><b>➥ Language</b> : <code>English</code>
<b>➥ Library</b> : <i><a herf="https://t.me/CFCHART">സിനിമ ഫാക്ടറി</a></i>
"""<|fim_prefix|># repo: naseef12356/Adv-Auto-Filter-Bot path: /bot/translation.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) @CFCHART
class Translation(object):
... | code_fim | hard | {
"lang": "python",
"repo": "naseef12356/Adv-Auto-Filter-Bot",
"path": "/bot/translation.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: basnijholt/qmt path: /qmt/geometry/geo_2d_data.py
from shapely.geometry import LinearRing, LineString, MultiLineString, Polygon
from shapely.ops import unary_union
from typing import List, Optional, Sequence, Union
import numpy as np
from matplotlib.axes import Axes
import matplotlib._color_data ... | code_fim | hard | {
"lang": "python",
"repo": "basnijholt/qmt",
"path": "/qmt/geometry/geo_2d_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def polygons(self):
"""Return dictionary of parts that are polygons."""
return {k: v for k, v in self.parts.items() if isinstance(v, Polygon)}
@property
def edges(self):
"""Return dictionary of parts that are lines."""
return {k: v for k, v in sel... | code_fim | hard | {
"lang": "python",
"repo": "basnijholt/qmt",
"path": "/qmt/geometry/geo_2d_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if self.DB_IN_MEMORY:
self.SQLALCHEMY_DATABASE_URI = "sqlite://"
else:
self.DB_FD, self.DB_FILE = tempfile.mkstemp()
self.SQLALCHEMY_DATABASE_URI = "sqlite:///%s" % self.DB_FILE
#print "using db [%s]" % self.SQLALCHEMY_DATABASE_URI
... | code_fim | medium | {
"lang": "python",
"repo": "caffeinate/test-pylot",
"path": "/FlaskGunicornSqlAlchemy/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: caffeinate/test-pylot path: /FlaskGunicornSqlAlchemy/config.py
class Config(object):
DEBUG = True
SQLALCHEMY_DATABASE_URI = "mysql://root:mypass@localhost/flask_gunicorn"
SQLALCHEMY_ECHO=False
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_POOL_SIZE = 5
class TestConfig(ob... | code_fim | hard | {
"lang": "python",
"repo": "caffeinate/test-pylot",
"path": "/FlaskGunicornSqlAlchemy/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: python-mechanize/mechanize path: /examples/forms/echo.cgi
#!/usr/bin/python
# -*-python-*-
print "Content-Type: text/html\n"
import sys
import os
import string
import cgi
<|fim_suffix|>print "<html><head><title>Form submission parameters</title></head>"
form = cgi.FieldStorage()
print "<p>Recei... | code_fim | medium | {
"lang": "python",
"repo": "python-mechanize/mechanize",
"path": "/examples/forms/echo.cgi",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>print "<html><head><title>Form submission parameters</title></head>"
form = cgi.FieldStorage()
print "<p>Received parameters:</p>"
print "<pre>"
for k in form.keys():
v = form[k]
if isinstance(v, ListType):
vs = []
for item in v:
vs.append(item.value)
text = str... | code_fim | medium | {
"lang": "python",
"repo": "python-mechanize/mechanize",
"path": "/examples/forms/echo.cgi",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> coords.append(sub + [instance["depot"]])
plt.figure()
for sub in coords:
plt.plot(*list(zip(*sub)))
if show:
plt.show()<|fim_prefix|># repo: bsamseth/vehicle-routing-problem path: /plot_route.py
"""
This module prodvides the plotRoute function which can be used
to plot c... | code_fim | hard | {
"lang": "python",
"repo": "bsamseth/vehicle-routing-problem",
"path": "/plot_route.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bsamseth/vehicle-routing-problem path: /plot_route.py
"""
This module prodvides the plotRoute function which can be used
to plot customers and the route between them, based on a route
and a instance dictionary.
"""
import matplotlib.pyplot as plt
<|fim_suffix|> sub.append(instance["cust... | code_fim | hard | {
"lang": "python",
"repo": "bsamseth/vehicle-routing-problem",
"path": "/plot_route.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.figure()
for sub in coords:
plt.plot(*list(zip(*sub)))
if show:
plt.show()<|fim_prefix|># repo: bsamseth/vehicle-routing-problem path: /plot_route.py
"""
This module prodvides the plotRoute function which can be used
to plot customers and the route between them, based on ... | code_fim | hard | {
"lang": "python",
"repo": "bsamseth/vehicle-routing-problem",
"path": "/plot_route.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: the-tale/the-tale path: /src/the_tale/the_tale/accounts/friends/prototypes.py
import smart_imports
smart_imports.all()
class FriendshipPrototype(utils_prototypes.BasePrototype):
_model_class = models.Friendship
_readonly = ('is_confirmed', 'id', 'friend_1_id', 'friend_2_id')
_bidi... | code_fim | hard | {
"lang": "python",
"repo": "the-tale/the-tale",
"path": "/src/the_tale/the_tale/accounts/friends/prototypes.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> friendship_query = cls._model_class.objects.filter(django_models.Q(friend_1_id=account.id) | django_models.Q(friend_2_id=account.id), is_confirmed=True)
values = list(friendship_query.values_list('friend_1_id', 'friend_2_id'))
if not values:
return []
friends_... | code_fim | hard | {
"lang": "python",
"repo": "the-tale/the-tale",
"path": "/src/the_tale/the_tale/accounts/friends/prototypes.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
----------
directory : :class:`Directory`
Directory to scan with :func:`os.scandir()`.
"""
p = directory.fullpath
with os.scandir(p) as it:
for entry in it:
if not entry.is_dir(follow_symlinks=False):
if entry.is_symlink():
... | code_fim | hard | {
"lang": "python",
"repo": "weaverba137/comparator",
"path": "/comparator/find.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: weaverba137/comparator path: /comparator/find.py
# Licensed under a 3-clause BSD style license - see LICENSE.rst.
# -*- coding: utf-8 -*-
"""
comparator.find
===============
Utilities for scanning a filesystem.
"""
import os
from .db import Session, Directory, File
def walk(top):
"""Simpli... | code_fim | hard | {
"lang": "python",
"repo": "weaverba137/comparator",
"path": "/comparator/find.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eivindtn/Master-Thesis path: /lab/calibration/generated_pattern/monitor.py
import tkinter
from PIL import Image, ImageTk
def showPIL(pilImage):
root = tkinter.Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.overrideredirect(1)
root.geometry("%dx%d+0+0" % (w, ... | code_fim | hard | {
"lang": "python",
"repo": "eivindtn/Master-Thesis",
"path": "/lab/calibration/generated_pattern/monitor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> imgHeight = pilImage.size
if imgWidth > w or imgHeight > h:
ratio = min(w/imgWidth, h/imgHeight)
imgWidth = int(imgWidth*ratio)
imgHeight = int(imgHeight*ratio)
pilImage = pilImage.resize((imgWidth,imgHeight), Image.ANTIALIAS)
image = ImageTk.PhotoImage(pilImage)
... | code_fim | hard | {
"lang": "python",
"repo": "eivindtn/Master-Thesis",
"path": "/lab/calibration/generated_pattern/monitor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>scheduler_options = """
RequestMemory={}
""".format(5000 * cores_per_slot)
config = Config(
executors=[
HighThroughputExecutor(
cores_per_worker=1,
heartbeat_threshold=120,
heartbeat_period=30,
provider=CondorProvider(
scheduler_... | code_fim | medium | {
"lang": "python",
"repo": "olopade-lab/sv-pipeline",
"path": "/configs/ndcrc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>source ~/.bashrc
conda activate parsl
"""
scheduler_options = """
RequestMemory={}
""".format(5000 * cores_per_slot)
config = Config(
executors=[
HighThroughputExecutor(
cores_per_worker=1,
heartbeat_threshold=120,
heartbeat_period=30,
provider... | code_fim | medium | {
"lang": "python",
"repo": "olopade-lab/sv-pipeline",
"path": "/configs/ndcrc.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: olopade-lab/sv-pipeline path: /configs/ndcrc.py
from parsl.providers import CondorProvider
from parsl.config import Config
from parsl.executors import HighThroughputExecutor
from parsl.utils import get_all_checkpoints
<|fim_suffix|>scheduler_options = """
RequestMemory={}
""".format(5000 * core... | code_fim | medium | {
"lang": "python",
"repo": "olopade-lab/sv-pipeline",
"path": "/configs/ndcrc.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Unable to create %s' % node_type)<|fim_prefix|># repo: gretzky/tobin path: /tobin/factory.py
from .devices import Sensor, Output
class DeviceFactory():
<|fim_middle|> @staticmethod
def create(node_address, node_type, slave):
if node_type == 'SENSOR':
return Sens... | code_fim | hard | {
"lang": "python",
"repo": "gretzky/tobin",
"path": "/tobin/factory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gretzky/tobin path: /tobin/factory.py
from .devices import Sensor, Output
<|fim_suffix|> @staticmethod
def create(node_address, node_type, slave):
if node_type == 'SENSOR':
return Sensor('Sensor', node_address, slave)
if node_type == 'OUTPUT':
retur... | code_fim | easy | {
"lang": "python",
"repo": "gretzky/tobin",
"path": "/tobin/factory.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fgallud/mezzanine-scada path: /mezzanine_scada/datalogging/models.py
from django.db import models
class datalogging(models.Model):
<|fim_suffix|> return 'Data Logging Configuration'<|fim_middle|> sampling_time = models.FloatField('Sampling time [s]',default=60.0)
data_path = models... | code_fim | medium | {
"lang": "python",
"repo": "fgallud/mezzanine-scada",
"path": "/mezzanine_scada/datalogging/models.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'Data Logging Configuration'<|fim_prefix|># repo: fgallud/mezzanine-scada path: /mezzanine_scada/datalogging/models.py
from django.db import models
class datalogging(models.Model):
<|fim_middle|> sampling_time = models.FloatField('Sampling time [s]',default=60.0)
data_path = models... | code_fim | medium | {
"lang": "python",
"repo": "fgallud/mezzanine-scada",
"path": "/mezzanine_scada/datalogging/models.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sciber/xenial path: /presenters/components/categoriesmenu_presenter.py
"""
Categories menu component presenter
===================================
Contains CategoriesMenu class presenting data to the 'categoriesmenu.kv' component view.
"""
from kivy.properties import ListProperty
from kivy.uix.g... | code_fim | hard | {
"lang": "python",
"repo": "sciber/xenial",
"path": "/presenters/components/categoriesmenu_presenter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.clear_widgets()
for item in categoriesmenu_items:
item_widget = CategoriesMenuItem(item['category_id'], item['category_name'], item['category_icon'])
self.add_widget(item_widget)<|fim_prefix|># repo: sciber/xenial path: /presenters/components/categoriesmenu_pr... | code_fim | hard | {
"lang": "python",
"repo": "sciber/xenial",
"path": "/presenters/components/categoriesmenu_presenter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Presents data to the Categories menu component 'categoriesmenu.kv' view.
"""
categoriesmenu_items = ListProperty([])
def on_categoriesmenu_items(self, instance, categoriesmenu_items):
""" Updates the object attributes according to `categoriesmenu_items` attribute/argumen... | code_fim | hard | {
"lang": "python",
"repo": "sciber/xenial",
"path": "/presenters/components/categoriesmenu_presenter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if len(resampled[resampled.isnull() == True]) != 0:
print("WARNING: there are rows that could not be resampled due to not having enough data:")
print(resampled[resampled.isnull() == True])
if output_GSR_csv is None:
output_GSR_csv = osp.join(osp.dirname(Input_GSR_csv) + '_DownSampled_1S', osp... | code_fim | hard | {
"lang": "python",
"repo": "ubcmist/ML",
"path": "/Python_Arduino_Interface/GSR_Downsampling_1S.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ubcmist/ML path: /Python_Arduino_Interface/GSR_Downsampling_1S.py
'''
Inspired by:
https://machinelearningmastery.com/resample-interpolate-time-series-data-python/
sample script arguments
python GSR_Downsampling_1S.py
-i Data\GSR\data_Mar27_game2.csv
-o Data\GSR_DownSampled_1S\data_Mar27... | code_fim | hard | {
"lang": "python",
"repo": "ubcmist/ML",
"path": "/Python_Arduino_Interface/GSR_Downsampling_1S.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>gsr_original = read_csv(Input_GSR_csv, header=0, parse_dates=[0], index_col=0, squeeze=True, date_parser=date_time_parser)
if resampling_type == "mean":
resampled = gsr_original.resample('1S').mean().round()
elif resampling_type == "nearest":
resampled = gsr_original.resample('1S').nearest().roun... | code_fim | medium | {
"lang": "python",
"repo": "ubcmist/ML",
"path": "/Python_Arduino_Interface/GSR_Downsampling_1S.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: couchbase/couchbase-python-client path: /couchbase/logic/views.py
def total_rows(self) -> Optional[UnsignedInt64]:
return self._raw.get("total_rows", None)
def __repr__(self):
return f'ViewMetaData({self._raw})'
@dataclass
class ViewRow(object):
key: str = None
id: ... | code_fim | hard | {
"lang": "python",
"repo": "couchbase/couchbase-python-client",
"path": "/couchbase/logic/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def reduce(self) -> Optional[bool]:
return self._params.get('reduce', None)
@reduce.setter
def reduce(self, value # type: bool
) -> None:
self.set_option('reduce', value)
@property
def order(self) -> ViewOrdering:
value = self._pa... | code_fim | hard | {
"lang": "python",
"repo": "couchbase/couchbase-python-client",
"path": "/couchbase/logic/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: couchbase/couchbase-python-client path: /couchbase/logic/views.py
mplied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import annotations
import json
from dataclasses import dataclass
from datetime import timedelta
from... | code_fim | hard | {
"lang": "python",
"repo": "couchbase/couchbase-python-client",
"path": "/couchbase/logic/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: malave/mason path: /mason/engines/metastore/models/table/summary.py
from typing import Optional, List, Tuple
from dask.dataframe import DataFrame as DDataFrame
from pandas import DataFrame
from mason.clients.responsable import Responsable
from mason.clients.response import Response
from mason.e... | code_fim | hard | {
"lang": "python",
"repo": "malave/mason",
"path": "/mason/engines/metastore/models/table/summary.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.name = name
self.non_null = non_null
self.max = max
self.min = min
self.distinct_count = distinct_count
def to_dict(self) -> dict:
return {
"non_null": self.non_null,
"max": self.max,
"min": self.min,
... | code_fim | hard | {
"lang": "python",
"repo": "malave/mason",
"path": "/mason/engines/metastore/models/table/summary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: toddrme2178/pyccel path: /src_old/tests/examples/mpi/ex_1.py
# coding: utf-8
from pyccel.mpi import *
ierr = mpi_init()
comm = mpi_comm_world
size = comm.size
rank = comm.rank
n = 4
x = zeros(n, double)
y = zeros((3,2), double)
if rank == 0:
x = 1.0
y = 1.0
source = 0
dest = 1
tag... | code_fim | hard | {
"lang": "python",
"repo": "toddrme2178/pyccel",
"path": "/src_old/tests/examples/mpi/ex_1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>tag1 = 8765
if rank == source:
y[1,1] = 2.0
ierr = comm.send(y[1,1], dest, tag1)
print(("processor ", rank, " sent y(1,1) = ", y[1,1]))
if rank == dest:
ierr = comm.recv(y[1,1], source, tag1)
print(("processor ", rank, " got y(1,1) = ", y[1,1]))
tag1 = 6587
if rank == source:
y[... | code_fim | hard | {
"lang": "python",
"repo": "toddrme2178/pyccel",
"path": "/src_old/tests/examples/mpi/ex_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if rank == dest:
ierr = comm.recv(x, source, tagx)
print(("processor ", rank, " got ", x))
tag1 = 5678
if rank == source:
x[1] = 2.0
ierr = comm.send(x[1], dest, tag1)
print(("processor ", rank, " sent x(1) = ", x[1]))
if rank == dest:
ierr = comm.recv(x[1], source, tag1)
pr... | code_fim | medium | {
"lang": "python",
"repo": "toddrme2178/pyccel",
"path": "/src_old/tests/examples/mpi/ex_1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_sql_statement(
self, use_catalog_as_cluster_name: bool, where_clause_suffix: str
) -> str:
if use_catalog_as_cluster_name:
cluster_source = "current_database()"
else:
cluster_source = f"'{self._cluster}'"
return """
SELEC... | code_fim | hard | {
"lang": "python",
"repo": "alldatacenter/alldata",
"path": "/govern/data-meta/amundsen/databuilder/databuilder/extractor/teradata_metadata_extractor.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.