text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: sharkweek/brokkr path: /brokkr/mech_math/tensors.py """Define stress/strain tensors.""" from numpy import array, empty from unyt.dimensions import pressure, length from unyt.array import unyt_array __all__ = ['BaseTensor', 'StrainTensor', 'StressTensor'] class BaseTensor(unyt_array): """B...
code_fim
hard
{ "lang": "python", "repo": "sharkweek/brokkr", "path": "/brokkr/mech_math/tensors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new = super().__new__(cls, strains, units) new.__stype = stype # check dimensions if new.has_dimension(length / length): return new else: raise TypeError( "`units` must be in strain (length/length or dimensionsless)" ...
code_fim
hard
{ "lang": "python", "repo": "sharkweek/brokkr", "path": "/brokkr/mech_math/tensors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r"""StrainTensor type. Must be 'engineering' or 'tensor' strain. Notes ----- Only affects shear strains (i.e. :math:`\varepsilon_4`, :math:`\varepsilon_5`, and :math:`\varepsilon_6`). Using Voigt notation, the relationship is defined: .. m...
code_fim
hard
{ "lang": "python", "repo": "sharkweek/brokkr", "path": "/brokkr/mech_math/tensors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> msgBox = QtGui.QMessageBox() msgBox.setWindowTitle(QtGui.QApplication.translate(parent_name, title, None, QtGui.QApplication.UnicodeUTF8)) msgBox.setText(QtGui.QApplication.translate(parent_name, message, None, QtGui.QApplication.UnicodeUTF8)) msgBox.setIcon(icon) msgBox.exec_()<|fim_p...
code_fim
easy
{ "lang": "python", "repo": "ComputerArchitectureGroupPWr/Floorplan-Maker", "path": "/src/MyMessageBox.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ComputerArchitectureGroupPWr/Floorplan-Maker path: /src/MyMessageBox.py from PyQt4 import QtGui __author__ = 'pawel' <|fim_suffix|> msgBox = QtGui.QMessageBox() msgBox.setWindowTitle(QtGui.QApplication.translate(parent_name, title, None, QtGui.QApplication.UnicodeUTF8)) msgBox.setTex...
code_fim
easy
{ "lang": "python", "repo": "ComputerArchitectureGroupPWr/Floorplan-Maker", "path": "/src/MyMessageBox.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: glueball-css/glueball path: /glueball/settings.py import os DOCSITE = "http://glueball.io/docs/" DIRNAME = os.path.dirname(__file__) # Modules each have a directory at this location MODULE_ROOT = 'glueball.modules' # This is where the .css files will be written to CSS_ROOT = os.path.join(DIRN...
code_fim
hard
{ "lang": "python", "repo": "glueball-css/glueball", "path": "/glueball/settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># CSS files to include at the top of the generated CSS file INCLUDES_DIR = os.path.join(DIRNAME, 'includes') INCLUDES = ( 'normalize.css', ) PSEUDO_LOOKUP = { 'hvr': 'hover', 'fcs': 'focus', 'lst': 'last-child', 'fst': 'first-child', 'odd': 'nth-child(odd)', 'evn': 'nth-child(...
code_fim
hard
{ "lang": "python", "repo": "glueball-css/glueball", "path": "/glueball/settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.name class Meta: verbose_name_plural = '作家妻子'<|fim_prefix|># repo: Dante9527-A/study path: /month03.2/day05/mysitel3/oto/models.py from django.db import models # Create your models here. class Author(models.Model): <|fim_middle|> name = models.CharField('姓名',max_length...
code_fim
hard
{ "lang": "python", "repo": "Dante9527-A/study", "path": "/month03.2/day05/mysitel3/oto/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dante9527-A/study path: /month03.2/day05/mysitel3/oto/models.py from django.db import models # Create your models here. class Author(models.Model): name = models.CharField('姓名',max_length=20) def __str__(self): return self.name class Meta: verbose_name_plural = '作者' ...
code_fim
easy
{ "lang": "python", "repo": "Dante9527-A/study", "path": "/month03.2/day05/mysitel3/oto/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> verbose_name_plural = '作者' class Wife(models.Model): name = models.CharField('姓名',max_length=20) author = models.OneToOneField(Author,verbose_name='丈夫' ,on_delete=models.CASCADE) def __str__(self): return self.name class Meta: verbose_name_plural = '作家妻子'<|fim_pref...
code_fim
medium
{ "lang": "python", "repo": "Dante9527-A/study", "path": "/month03.2/day05/mysitel3/oto/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass admin.site.register(Author, AuthorAdmin)<|fim_prefix|># repo: cjsapaglinawan/django-crispy-forms-fancy-formsets path: /test_project/test_app/admin.py from django.contrib import admin from test_project.test_app.models import Author <|fim_middle|>class AuthorAdmin(admin.ModelAdmin):
code_fim
easy
{ "lang": "python", "repo": "cjsapaglinawan/django-crispy-forms-fancy-formsets", "path": "/test_project/test_app/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cjsapaglinawan/django-crispy-forms-fancy-formsets path: /test_project/test_app/admin.py from django.contrib import admin from test_project.test_app.models import Author <|fim_suffix|> pass admin.site.register(Author, AuthorAdmin)<|fim_middle|>class AuthorAdmin(admin.ModelAdmin):
code_fim
easy
{ "lang": "python", "repo": "cjsapaglinawan/django-crispy-forms-fancy-formsets", "path": "/test_project/test_app/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Set the log file name def setLogFile(filename): log.addHandler(logging.handlers.RotatingFileHandler(filename))<|fim_prefix|># repo: code-fortis/Jarvis path: /lib/logger.py # Import all the modules required import logging # Setup log variable to be exported out log = logging.getLogger('logger') <|...
code_fim
hard
{ "lang": "python", "repo": "code-fortis/Jarvis", "path": "/lib/logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: code-fortis/Jarvis path: /lib/logger.py # Import all the modules required import logging # Setup log variable to be exported out log = logging.getLogger('logger') # Function: runExample # Allows developer to test the logger prehand. def runExample(): log.debug('debug message') log.info(...
code_fim
medium
{ "lang": "python", "repo": "code-fortis/Jarvis", "path": "/lib/logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: biocommons/eutils path: /src/eutils/_internal/xmlfacades/entrezgeneset.py # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals from .base import Base from .entrezgene import Entrezgene <|fim_suffix|> """ _root_tag = "Entrezgene-Set...
code_fim
hard
{ "lang": "python", "repo": "biocommons/eutils", "path": "/src/eutils/_internal/xmlfacades/entrezgeneset.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># <LICENSE> # Copyright 2015 eutils Committers # # 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-2.0 # # Unless required by applicabl...
code_fim
hard
{ "lang": "python", "repo": "biocommons/eutils", "path": "/src/eutils/_internal/xmlfacades/entrezgeneset.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ors,genericfixes,VASPdetectors,VASPfixes<|fim_prefix|># repo: MichaelSluydts/QueueManager-client path: /errors/__init__.py __all__ = ['generic','genericdetectors','genericfixes','VASPdetectors','VASPfix<|fim_middle|>es'] from . import generic,genericdetect
code_fim
easy
{ "lang": "python", "repo": "MichaelSluydts/QueueManager-client", "path": "/errors/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MichaelSluydts/QueueManager-client path: /errors/__init__.py __all__ = ['generic','genericdetectors','genericfixes','VASPdetectors','VASPfix<|fim_suffix|>ors,genericfixes,VASPdetectors,VASPfixes<|fim_middle|>es'] from . import generic,genericdetect
code_fim
easy
{ "lang": "python", "repo": "MichaelSluydts/QueueManager-client", "path": "/errors/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hscspring/The-DataStructure-and-Algorithms path: /BiSearch/get_closest_wall(AliInterview).py # // You have an array with 0 or 1. # // 0 represents empty space and 1 represents wall. # // for example # // [0 0 0 1 0 0 0 1 0 0 0 1 0 1] # // Compute an output vector, in which each elem...
code_fim
hard
{ "lang": "python", "repo": "hscspring/The-DataStructure-and-Algorithms", "path": "/BiSearch/get_closest_wall(AliInterview).py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> lst = [0, 0, 1] assert get_distance_to_the_closet_wall(lst) == [2, 1, 0] lst = [0, 1, 0] assert get_distance_to_the_closet_wall(lst) == [1, 0, 1] lst = [1, 0, 0] assert get_distance_to_the_closet_wall(lst) == [0, 1, 2] lst = [0, 0, 0] assert get_distance_to_the_closet_wa...
code_fim
hard
{ "lang": "python", "repo": "hscspring/The-DataStructure-and-Algorithms", "path": "/BiSearch/get_closest_wall(AliInterview).py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_sub_distance(sub_s, is_start: bool, is_end: bool): if is_start: return list(range(len(sub_s), 0, -1)) elif is_end: return list(range(1, len(sub_s)+1)) else: mid = len(sub_s) // 2 left = list(range(1, mid+1)) right = list(reversed(left)) ...
code_fim
hard
{ "lang": "python", "repo": "hscspring/The-DataStructure-and-Algorithms", "path": "/BiSearch/get_closest_wall(AliInterview).py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(PlotLaTeX, self).add_texts(plotData) @staticmethod def tableToLaTeX(table, rowLabels, colLabels): delimiter_cells = "\t&\t" delimiter_rows = '\t \\\\ \\hline \n' result = "\hline \n" + delimiter_cells for colLabel in colLabels[:-1]: result += colLabel + delimiter_cells result += co...
code_fim
hard
{ "lang": "python", "repo": "thomas-mueller/clipl", "path": "/clipl/plot_modules/plotlatex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thomas-mueller/clipl path: /clipl/plot_modules/plotlatex.py # -*- coding: utf-8 -*- import os import logging import clipl.utility.logger as logger log = logging.getLogger(__name__) import ROOT import clipl.plotbase as plotbase import clipl.plotdata as plotdata from clipl.utility.mplhisto imp...
code_fim
hard
{ "lang": "python", "repo": "thomas-mueller/clipl", "path": "/clipl/plot_modules/plotlatex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for step in range(2001): cost_val , W_val, b_val, _ = sess.run([cost, W, b, train], feed_dict={ X:[1,2,3,4,5], Y:[2,1,3,1,4] }) if step % 100 == 0: print(step, cost_val, W_val, b_val) print(sess.run(hypothesis, feed_dict={X:[1,5,3,5]}))<|fim_prefix|># repo: fomuon/tensorflow-ex...
code_fim
hard
{ "lang": "python", "repo": "fomuon/tensorflow-exams", "path": "/src/example_003.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: fomuon/tensorflow-exams path: /src/example_003.py import os import tensorflow as tf os.environ['TF_CPP_MIN_LOG_LEVEL']='2' X = tf.placeholder(tf.float32, shape=[None]) Y = tf.placeholder(tf.float32, shape=[None]) W = tf.Variable(tf.random_normal([1]), name='weight') b = tf.Variable(tf.r...
code_fim
medium
{ "lang": "python", "repo": "fomuon/tensorflow-exams", "path": "/src/example_003.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> Also support | split ruby \ruby{椎名|真昼}{しいな|まひる} -> 椎名(しいな)真昼(まひる) """ return ''.join('{}({})'.format(*pair) for pair in zip(match['word'].split('|'), match['ruby'].split('|'))) def format_line(source_line: str, fts: FootnoteStorage, ofs: OFootnoteStorage, ...
code_fim
hard
{ "lang": "python", "repo": "tongyuantongyu/NovelDeploy", "path": "/compiler/bbcode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tongyuantongyu/NovelDeploy path: /compiler/bbcode.py import re from typing import Match, Callable, Tuple fnorder = ['①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳', '㉑', '㉒', '㉓', '㉔', '㉕', '㉖', '㉗', '㉘', '㉙', '㉚', '㉛', '㉜', ...
code_fim
hard
{ "lang": "python", "repo": "tongyuantongyu/NovelDeploy", "path": "/compiler/bbcode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ram-Aditya/Healthcare-Data-Analytics path: /env/lib/python2.7/site-packages/lasagne/layers/special.py td(axis=0)`` instead. """ # Subtract the offset layer = BiasLayer(layer, -offset, shared_axes) # Do not optimize the offset parameter layer.params[layer.b].remove('trainable')...
code_fim
hard
{ "lang": "python", "repo": "Ram-Aditya/Healthcare-Data-Analytics", "path": "/env/lib/python2.7/site-packages/lasagne/layers/special.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> alpha : Theano shared variable, expression, numpy array or callable Initial value, expression or initializer for the alpha values. The shape must match the incoming shape, skipping those axes the alpha values are shared over (see the example below). See :func:`lasagne.u...
code_fim
hard
{ "lang": "python", "repo": "Ram-Aditya/Healthcare-Data-Analytics", "path": "/env/lib/python2.7/site-packages/lasagne/layers/special.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # scale coordinates from [-1, 1] to [0, width/height - 1] x = (x + 1) / 2 * (width_f - 1) y = (y + 1) / 2 * (height_f - 1) # obtain indices of the 2x2 pixel neighborhood surrounding the coordinates; # we need those in floatX for interpolation and in int64 for indexing. x0_f = T.fl...
code_fim
hard
{ "lang": "python", "repo": "Ram-Aditya/Healthcare-Data-Analytics", "path": "/env/lib/python2.7/site-packages/lasagne/layers/special.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LiHeng/chicago-crime path: /python/multi_view_learning/graph_embedding.py """ Hongjian Problem: use taxi flow as an independent view to predict crime. Task: 1. Get graph embedding representation of regions from taxi flow. 2. Use leaveOneOut to test the error of this single view. 3. R...
code_fim
hard
{ "lang": "python", "repo": "LiHeng/chicago-crime", "path": "/python/multi_view_learning/graph_embedding.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def CA_clustering_with_embedding(): ge = get_graph_embedding_features("geo_all.txt") from sklearn.cluster import KMeans kmeans = KMeans(n_clusters=4, max_iter=100).fit(ge) for idx, lab in enumerate(kmeans.labels_): print idx+1, lab colorMaps = ['blue', 'red', 'g', '...
code_fim
hard
{ "lang": "python", "repo": "LiHeng/chicago-crime", "path": "/python/multi_view_learning/graph_embedding.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EBI-Metagenomics/ebi-metagenomics-libs path: /mgnify_backlog/mgnify_handler.py GS_MODULE'] = 'backlog_cli.settings' django.setup() from backlog.models import Study, Run, AssemblyJob, RunAssembly, Assembler, AssemblyJobStatus, RunAssemblyJob, Biome, \ User, Pipeline, \ UserRequest, Annot...
code_fim
hard
{ "lang": "python", "repo": "EBI-Metagenomics/ebi-metagenomics-libs", "path": "/mgnify_backlog/mgnify_handler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def update_annotation_jobs_from_accessions(self, run_or_assembly_accessions=None, study_accessions=None, status_description=None, priority=None, pipeline_version=None, directory=None, delete=False, auto_confi...
code_fim
hard
{ "lang": "python", "repo": "EBI-Metagenomics/ebi-metagenomics-libs", "path": "/mgnify_backlog/mgnify_handler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: EBI-Metagenomics/ebi-metagenomics-libs path: /mgnify_backlog/mgnify_handler.py ublic') <= datetime.now().date(), ena_last_update=get_date(data, 'last_updated') ) s.save(using=self.database) return s def update_study_obj(self, data): ...
code_fim
hard
{ "lang": "python", "repo": "EBI-Metagenomics/ebi-metagenomics-libs", "path": "/mgnify_backlog/mgnify_handler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: akuhantu/My-Python-Creations path: /Info Covid 19/Covid.py import json from urllib import request #Copyrights 2020 #Created By Zhirrr url = "https://indonesia-covid-19.mathdro.id/api/provinsi" <|fim_suffix|> print(f" 🤗Sembuh: {covid['kasusSemb']}") print(f" Meninggal: {covid['...
code_fim
hard
{ "lang": "python", "repo": "akuhantu/My-Python-Creations", "path": "/Info Covid 19/Covid.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>data = json.loads(response.read()) for covid in data['data']: print("---------------------------") print("---------------------------") print(f"- {covid['provinsi']}:") print(f" 🤕Positif: {covid['kasusPosi']}") print(f" 🤗Sembuh: {covid['kasusSemb']}") print(...
code_fim
medium
{ "lang": "python", "repo": "akuhantu/My-Python-Creations", "path": "/Info Covid 19/Covid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chris-wood/checkin path: /checkin.py import os from twilio.rest import TwilioRestClient account_sid = os.environ["TWILIO_SID"] #"{{ account_sid }}" # Your Account SID from www.twilio.com/console auth_token = os.environ["TWILIO_AUTH"] #"{{ auth_token }}" # Your Auth Token from www.twilio.com/co...
code_fim
medium
{ "lang": "python", "repo": "chris-wood/checkin", "path": "/checkin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>message = client.messages.create(body="Hello from checkin", to="+13158065939", # Replace with your phone number from_="+15005550006") # Replace with your Twilio number print(message.sid)<|fim_prefix|># repo: chris-wood/checkin path: /checkin.py import os from twilio.rest import TwilioRestClie...
code_fim
medium
{ "lang": "python", "repo": "chris-wood/checkin", "path": "/checkin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chris-wood/checkin path: /checkin.py import os from twilio.rest import TwilioRestClient <|fim_suffix|>message = client.messages.create(body="Hello from checkin", to="+13158065939", # Replace with your phone number from_="+15005550006") # Replace with your Twilio number print(message....
code_fim
hard
{ "lang": "python", "repo": "chris-wood/checkin", "path": "/checkin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if cfg.dataset.val_data_path is not None: valid_losses = [] valid_accs = [] logger.info("Start Training") for epoch in range(cfg.training.max_epochs): artifact = wandb.Artifact('model', type='model') train_loss, train_acc, lr = train_fn( ...
code_fim
hard
{ "lang": "python", "repo": "seanbenhur/resusable_text_classification_template", "path": "/src/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: seanbenhur/resusable_text_classification_template path: /src/main.py import logging from pathlib import Path import os import hydra import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import torch import torch.nn as nn import wandb from omegaconf.omegacon...
code_fim
hard
{ "lang": "python", "repo": "seanbenhur/resusable_text_classification_template", "path": "/src/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> train_losses = [] train_accs = [] if cfg.dataset.val_data_path is not None: valid_losses = [] valid_accs = [] logger.info("Start Training") for epoch in range(cfg.training.max_epochs): artifact = wandb.Artifact('model', type='model') train_...
code_fim
hard
{ "lang": "python", "repo": "seanbenhur/resusable_text_classification_template", "path": "/src/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LukasL97/shop-4-me path: /back-flask/test/model/test_user.py from unittest import TestCase from dao.users_dao import UsersDAO, RequestersDAO from model.exception import IncorrectPasswordError, UserNotFoundError, UserAlreadyRegisteredError, \ UserSessionIdNotFoundError, UnexpectedNumberOfLoca...
code_fim
hard
{ "lang": "python", "repo": "LukasL97/shop-4-me", "path": "/back-flask/test/model/test_user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_login_with_unknown_user(self): with self.assertRaises(UserNotFoundError): self.user_handler.login('name', 'pw') self.assertEqual(len(self.user_handler.active_user_sessions), 0) def test_registration_with_correct_data(self): session_id = self.user_handl...
code_fim
hard
{ "lang": "python", "repo": "LukasL97/shop-4-me", "path": "/back-flask/test/model/test_user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Start periodic freshness check state_freshness_update_interval = self.config.STATE_FRESHNESS_UPDATE_INTERVAL if state_freshness_update_interval > 0: RepeatingTimer(self._timer, state_freshness_update_interval, self.check_freshness) def __repr__(self): ret...
code_fim
hard
{ "lang": "python", "repo": "jandayanan/indy-plenum", "path": "/plenum/server/view_change/view_changer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jandayanan/indy-plenum path: /plenum/server/view_change/view_changer.py from abc import ABC, abstractmethod from plenum.common.startable import Mode from plenum.common.timer import TimerService, RepeatingTimer from plenum.server.quorums import Quorums from stp_core.common.log import getlogger f...
code_fim
hard
{ "lang": "python", "repo": "jandayanan/indy-plenum", "path": "/plenum/server/view_change/view_changer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass @abstractmethod def view_no(self): pass @abstractmethod def view_change_in_progress(self): pass class ViewChanger(): def __init__(self, provider: ViewChangerDataProvider, timer: TimerService): self.provider = provider self._timer = time...
code_fim
hard
{ "lang": "python", "repo": "jandayanan/indy-plenum", "path": "/plenum/server/view_change/view_changer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print('time: ', ', '.join([d['seconds'] for d in data_list])) print('instructions: ', ', '.join([d['instructions'] for d in data_list])) print('skipped: ', ', '.join([str(100*int(d['skipped'])/int(d['instructions'])) for d in data_list])) return True def main(argv): args = parse_arg...
code_fim
hard
{ "lang": "python", "repo": "archercreat/dta-vs-osc", "path": "/attacking_anti_tamper/evaluation/print_value_lists.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: archercreat/dta-vs-osc path: /attacking_anti_tamper/evaluation/print_value_lists.py #!/usr/bin/env python3 # note: there most likely exist unused imports which haven't been removed as they have no effects on the generated output from __future__ import print_function import argparse import os im...
code_fim
hard
{ "lang": "python", "repo": "archercreat/dta-vs-osc", "path": "/attacking_anti_tamper/evaluation/print_value_lists.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> input_dir = args.input data_list = [] only_failures = True for data_file in os.listdir(input_dir): with open(os.path.join(input_dir, data_file), 'r') as reader: current_dict = {'attack_result': 'success'} for line in reader.readlines(): dat...
code_fim
hard
{ "lang": "python", "repo": "archercreat/dta-vs-osc", "path": "/attacking_anti_tamper/evaluation/print_value_lists.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DooSunny/Narsha-AMK path: /narsha/ex1_chatbot.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Example 1: GiGA Genie Keyword Spotting""" from __future__ import print_function import grpc import gigagenieRPC_pb2 import gigagenieRPC_pb2_grpc import MicrophoneStream as MS import user_auth as U...
code_fim
hard
{ "lang": "python", "repo": "DooSunny/Narsha-AMK", "path": "/narsha/ex1_chatbot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rms = audioop.rms(content,2) #print_rms(rms) def getVoice2Text(): print ("\n\n음성인식을 시작합니다.\n\n종료하시려면 Ctrl+\ 키를 누루세요.\n\n\n") channel = grpc.secure_channel('{}:{}'.format(HOST, PORT), UA.getCredentials()) stub = gigagenieRPC_pb2_grpc.GigagenieStub(channel) request ...
code_fim
hard
{ "lang": "python", "repo": "DooSunny/Narsha-AMK", "path": "/narsha/ex1_chatbot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def getText2VoiceStream(inText,inFileName): channel = grpc.secure_channel('{}:{}'.format(HOST, PORT), UA.getCredentials()) stub = gigagenieRPC_pb2_grpc.GigagenieStub(channel) message = gigagenieRPC_pb2.reqText() message.lang=0 message.mode=0 message.text=inText writeFile=open(inFileName,'wb') fo...
code_fim
hard
{ "lang": "python", "repo": "DooSunny/Narsha-AMK", "path": "/narsha/ex1_chatbot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: venth/aws-adfs path: /aws_adfs/commands.py # -*- coding: utf-8 -*- import logging import sys import click from . import list_profiles from . import login from . import reset from . import __version__ def _print_version(ctx, param, value): <|fim_suffix|> log_format = '%(asctime)s [%(module...
code_fim
hard
{ "lang": "python", "repo": "venth/aws-adfs", "path": "/aws_adfs/commands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not value or ctx.resilient_parsing: return click.echo(__version__) ctx.exit() @click.group() @click.option( '--version', is_flag=True, callback=_print_version, expose_value=False, is_eager=True, help='Show current tool version' ) @click.option( '-v', '-...
code_fim
medium
{ "lang": "python", "repo": "venth/aws-adfs", "path": "/aws_adfs/commands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(Path, 'r') as f: reader = csv.reader(f) k = 0 for row in reader: lat = float(row[0]) long = float(row[1]) if k == 0: gmap.marker(lat, long, 'green') k = 1 else: gmap.marker(lat, long, 'blue') k = 0 gma...
code_fim
hard
{ "lang": "python", "repo": "Ayush7614/Amazing-Python-Scripts", "path": "/Gmplot-Track the Route/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ayush7614/Amazing-Python-Scripts path: /Gmplot-Track the Route/main.py import csv from gmplot import gmplot # importing Path = input("Enter the path of your csv file , with filename and extension : ") Zoom = int( input("Enter your zoom level (less value zoom out , large value zoom in ) : ")...
code_fim
hard
{ "lang": "python", "repo": "Ayush7614/Amazing-Python-Scripts", "path": "/Gmplot-Track the Route/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if k == 0: gmap.marker(lat, long, 'green') k = 1 else: gmap.marker(lat, long, 'blue') k = 0 gmap.marker(lat, long, 'red') print("Done! Check file Output.html") gmap.draw("Output.html")<|fim_prefix|># repo: Ayush7614/Amazing-Python-Scripts p...
code_fim
hard
{ "lang": "python", "repo": "Ayush7614/Amazing-Python-Scripts", "path": "/Gmplot-Track the Route/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # To maintain O(1) insertion time DynamicArray must have a single type because of how they are stored in memory. with pytest.raises(TypeError): self.dynamicArray.insert("badType") if __name__ == "__main__": pytest.main()<|fim_prefix|># repo: HyperEntangledQubit/Data_Struc...
code_fim
hard
{ "lang": "python", "repo": "HyperEntangledQubit/Data_Structures_and_Algorithms_in_Python", "path": "/DynamicArray/TestDynamicArray.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HyperEntangledQubit/Data_Structures_and_Algorithms_in_Python path: /DynamicArray/TestDynamicArray.py #!/usr/bin/env python3 """ Unit Tests for DynamicArray TODO - Add doctests to source """ import pytest from DynamicArray import DynamicArray class TestDynamicArray(): @classmethod de...
code_fim
medium
{ "lang": "python", "repo": "HyperEntangledQubit/Data_Structures_and_Algorithms_in_Python", "path": "/DynamicArray/TestDynamicArray.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anatoliy-savchak/TemplePlus path: /tpdatasrc/co8infra/scr/Spell796 - Greater Vigor.py from toee import * def OnBeginSpellCast( spell ): print "Lesser Vigor OnBeginSpellCast" print "spell.target_list=", spell.target_list print "spell.caster=", spell.caster, " caster.level= ", spell.caster_leve...
code_fim
medium
{ "lang": "python", "repo": "anatoliy-savchak/TemplePlus", "path": "/tpdatasrc/co8infra/scr/Spell796 - Greater Vigor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print "Lesser Vigor OnBeginRound" def OnEndSpellCast( spell ): print "Lesser Vigor OnEndSpellCast" def heal_tick_greater_vigor( target, dice ): target.heal( OBJ_HANDLE_NULL, dice ) target.healsubdual( OBJ_HANDLE_NULL, dice )<|fim_prefix|># repo: anatoliy-savchak/TemplePlus path: /tpdatasrc/co8infra...
code_fim
hard
{ "lang": "python", "repo": "anatoliy-savchak/TemplePlus", "path": "/tpdatasrc/co8infra/scr/Spell796 - Greater Vigor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tid = [1] tdatas = [] for id in tid: with open('journey-to-the-moon.t{}'.format(id), 'r') as fh: na, pn = fh.readline().strip().split(' ') astronaut = [] for i in range(int(pn)): astronaut.append(map(in...
code_fim
hard
{ "lang": "python", "repo": "johnklee/algprac", "path": "/hackerrank/graph/medium/journey-to-the-moon.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: johnklee/algprac path: /hackerrank/graph/medium/journey-to-the-moon.py #!/usr/bin/env python r''' https://www.hackerrank.com/challenges/journey-to-the-moon/problem ''' import math import os import random import re import sys class Node: def __init__(self, v): self.v = v sel...
code_fim
hard
{ "lang": "python", "repo": "johnklee/algprac", "path": "/hackerrank/graph/medium/journey-to-the-moon.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Other distinct countury for i in range(n): if i not in ndict: cty_list.append(set([i])) print('Total {} unique countries...{}'.format(len(cty_list), cty_list)) # Calculate unique pairs if len(cty_list) == 1: return 0 elif len(cty_list) == 2: ...
code_fim
hard
{ "lang": "python", "repo": "johnklee/algprac", "path": "/hackerrank/graph/medium/journey-to-the-moon.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: emmett-framework/renoir path: /renoir/extensions.py # -*- coding: utf-8 -*- """ renoir.extensions ----------------- Provides base classes to create extensions. :copyright: 2014 Giovanni Barillari :license: BSD-3-Clause """ from typing import Any, Dict, Optional, Tuple, Type...
code_fim
hard
{ "lang": "python", "repo": "emmett-framework/renoir", "path": "/renoir/extensions.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Extension(metaclass=MetaExtension): namespace: Optional[str] = None file_extension: Optional[str] = None lexers: Dict[str, Type[Lexer]] = {} default_config: Dict[str, Any] = {} def __init__(self, templater, namespace, env, config=None): self.templater = templater ...
code_fim
hard
{ "lang": "python", "repo": "emmett-framework/renoir", "path": "/renoir/extensions.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mwoehlke-kitware/spartan path: /apps/iiwa/kuka_iiwa_state_translator.py from director import consoleapp from director import lcmUtils from director import robotstate import drake as lcmdrake import bot_core as lcmbotcore import numpy as np lastGripperMsg = lcmdrake.lcmt_schunk_wsg_status() last...
code_fim
medium
{ "lang": "python", "repo": "mwoehlke-kitware/spartan", "path": "/apps/iiwa/kuka_iiwa_state_translator.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> m = lcmbotcore.robot_state_t() m.utime = msg.utime m.pose = robotstate.getPoseLCMFromXYZRPY([0,0,0], [0,0,0]) m.twist = lcmbotcore.twist_t() m.twist.linear_velocity = lcmbotcore.vector_3d_t() m.twist.angular_velocity = lcmbotcore.vector_3d_t() m.num_joints = len(jointNames) ...
code_fim
hard
{ "lang": "python", "repo": "mwoehlke-kitware/spartan", "path": "/apps/iiwa/kuka_iiwa_state_translator.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NassimSadallah/Ai_Demos_RPi path: /robot_rc/examples/robot_rc.py #!/usr/bin/python ''' Flask-powered web app for remote control of ACROBOTIC's wheeled robot PyPi ''' from flask import Flask, render_template # Use the socketio module for using websockets # for easily handling requests in real-time...
code_fim
hard
{ "lang": "python", "repo": "NassimSadallah/Ai_Demos_RPi", "path": "/robot_rc/examples/robot_rc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # I expect the message to be formatted in JSON so I can parse # it as a Python dictionary and look for specific keys direction = msg['direction'] # this will tell me how to move the motors if direction != 'STP': spd = int(msg['speed']) if direction == 'FWD': # Use the motor control o...
code_fim
hard
{ "lang": "python", "repo": "NassimSadallah/Ai_Demos_RPi", "path": "/robot_rc/examples/robot_rc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DuanShengqi/tf2_notes path: /class1/p41_argmax.py import numpy as np import tensorflow as tf test = np.array([[<|fim_suffix|>的索引 print("每一行的最大值的索引", tf.argmax(test, axis=1)) # 返回每一行最大值的索引<|fim_middle|>1, 2, 3], [2, 3, 4], [5, 4, 3], [8, 7, 2]]) print("test:\n", test) print("每一列的最大值的索引:", tf.arg...
code_fim
medium
{ "lang": "python", "repo": "DuanShengqi/tf2_notes", "path": "/class1/p41_argmax.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>的索引 print("每一行的最大值的索引", tf.argmax(test, axis=1)) # 返回每一行最大值的索引<|fim_prefix|># repo: DuanShengqi/tf2_notes path: /class1/p41_argmax.py import numpy as np import tensorflow as tf test = np.array([[<|fim_middle|>1, 2, 3], [2, 3, 4], [5, 4, 3], [8, 7, 2]]) print("test:\n", test) print("每一列的最大值的索引:", tf.arg...
code_fim
medium
{ "lang": "python", "repo": "DuanShengqi/tf2_notes", "path": "/class1/p41_argmax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: reycn/Notion-Calendar-Sync path: /notioncalendarsync/notion_api.py from datetime import datetime, timedelta from notion.client import NotionClient from notioncalendarsync.google_calendar import GoogleCalendar class Notion(NotionClient): def events(self, collection_url): return [No...
code_fim
hard
{ "lang": "python", "repo": "reycn/Notion-Calendar-Sync", "path": "/notioncalendarsync/notion_api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def url(self): return self.page.get_browseable_url() @property def description(self): try: return self.page.children[0].title except: return None<|fim_prefix|># repo: reycn/Notion-Calendar-Sync path: /notioncalendarsync/notion_api...
code_fim
hard
{ "lang": "python", "repo": "reycn/Notion-Calendar-Sync", "path": "/notioncalendarsync/notion_api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Chronos.sleep(5) return "Authentic" if __name__ == '__main__': app.run(host='0.0.0.0', port=80)<|fim_prefix|># repo: KarimIO/Quantum-Inject-Detect path: /sampleserver.py #!/usr/bin/env python2.7 import os as OS import subprocess as Process import site as Site import time as Chronos if 'F...
code_fim
medium
{ "lang": "python", "repo": "KarimIO/Quantum-Inject-Detect", "path": "/sampleserver.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: KarimIO/Quantum-Inject-Detect path: /sampleserver.py #!/usr/bin/env python2.7 import os as OS import subprocess as Process import site as Site import time as Chronos if 'FLASK_APP' not in OS.environ: print "Running server..." OS.environ['FLASK_APP'] = __file__ Process.call(['sudo', ...
code_fim
medium
{ "lang": "python", "repo": "KarimIO/Quantum-Inject-Detect", "path": "/sampleserver.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> if use_single_email() == emailauth_use_singe_email: return func(*args, **kwds) else: raise Http404() return wrapper requires_single_email_mode = curry(require_emailauth_mode, emailauth_use_singe_email=True) requires_multi_emails_mode = curry(require_emaila...
code_fim
hard
{ "lang": "python", "repo": "redvasily/django-emailauth", "path": "/emailauth/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: redvasily/django-emailauth path: /emailauth/utils.py from django.conf import settings from django.http import Http404 from django.utils.functional import curry def email_verification_days(): return getattr(settings, 'EMAILAUTH_VERIFICATION_DAYS', 3) def use_single_email(): return getatt...
code_fim
hard
{ "lang": "python", "repo": "redvasily/django-emailauth", "path": "/emailauth/utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> "search for legal advisers on LAALAA" with self.app.test_client(): laalaa.find("sw1a1aa") def test_can_access_sendgrid(self): "connect to SendGrid" with self.app.test_client(): self.app.mail.connect() def test_can_access_backend(self): ...
code_fim
hard
{ "lang": "python", "repo": "ministryofjustice/cla_public", "path": "/cla_public/apps/checker/tests/smoketests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "connect to SendGrid" with self.app.test_client(): self.app.mail.connect() def test_can_access_backend(self): "connect to the backend" with self.app.test_client(): api.get_api_connection() def test_can_use_scope_diagnosis(self): "us...
code_fim
hard
{ "lang": "python", "repo": "ministryofjustice/cla_public", "path": "/cla_public/apps/checker/tests/smoketests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ministryofjustice/cla_public path: /cla_public/apps/checker/tests/smoketests.py import os import unittest import urlparse from bs4 import BeautifulSoup from cla_common.address_lookup.ordnance_survey import AddressLookup from flask import url_for, _request_ctx_stack from cla_public import app fr...
code_fim
hard
{ "lang": "python", "repo": "ministryofjustice/cla_public", "path": "/cla_public/apps/checker/tests/smoketests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.phantom_js( "/pos/web", "odoo.__DEBUG__.services['web_tour.tour']" ".run('pos_product_category_discount_tour')", "odoo.__DEBUG__.services['web_tour.tour']" ".tours.pos_product_category_discount_tour.ready", login="admin",...
code_fim
hard
{ "lang": "python", "repo": "ShaheenHossain/itpp-labs_pos-addons", "path": "/pos_product_category_discount/tests/test_default.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShaheenHossain/itpp-labs_pos-addons path: /pos_product_category_discount/tests/test_default.py # -*- coding: utf-8 -*- import odoo.tests from odoo.api import Environment @odoo.tests.common.at_install(True) @odoo.tests.common.post_install(True) class TestUi(odoo.tests.HttpCase): def test_01_...
code_fim
hard
{ "lang": "python", "repo": "ShaheenHossain/itpp-labs_pos-addons", "path": "/pos_product_category_discount/tests/test_default.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> env["ir.module.module"].search( [("name", "=", "pos_product_category_discount")], limit=1 ).state = "installed" self.phantom_js( "/pos/web", "odoo.__DEBUG__.services['web_tour.tour']" ".run('pos_product_category_discount_tour')", ...
code_fim
hard
{ "lang": "python", "repo": "ShaheenHossain/itpp-labs_pos-addons", "path": "/pos_product_category_discount/tests/test_default.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> shutil.copy2("tests/fixtures/csv-to-xml.csv", tmp_dir.name + "/csv-to-xml.csv") shutil.copy2("funcake_dags/scripts/csv_to_xml.py", tmp_dir.name + "/csv_to_xml.py") os.chdir(tmp_dir.name) output = os.system("DAGID=foo TIMESTAMP=bar python csv_to_xml.py") # If this f...
code_fim
hard
{ "lang": "python", "repo": "tulibraries/funcake_dags", "path": "/tests/csv_to_xml_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tulibraries/funcake_dags path: /tests/csv_to_xml_test.py import unittest from funcake_dags.scripts.csv_to_xml import csv_reader_to_xml_string, Counter import csv import shutil import tempfile import os class TestCsvToXml(unittest.TestCase): def test_csv_reader_to_xml_string(self): c...
code_fim
medium
{ "lang": "python", "repo": "tulibraries/funcake_dags", "path": "/tests/csv_to_xml_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Find the position of the wheel relative to the body try: (translation, rotation) = self.tf_listener.lookupTransform( "base_link", wheel_name, rospy.Time(0)) except: rospy.logerr("Transform bet...
code_fim
hard
{ "lang": "python", "repo": "Nurgak/rover_locomotion", "path": "/src/rover_locomotion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nurgak/rover_locomotion path: /src/rover_locomotion.py #!/usr/bin/env python import rospy import math import tf from std_msgs.msg import Float64 from geometry_msgs.msg import Twist class Locomotion(): def __init__(self): # Get the locomotion joints controllers from the yaml file ...
code_fim
hard
{ "lang": "python", "repo": "Nurgak/rover_locomotion", "path": "/src/rover_locomotion.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rospy.logdebug("Setting new speed, linear: %fm/s, angular: %frad/s" % (v_linear, v_angular)) # Stop the motors if v_angular == 0 and v_linear == 0: rospy.logdebug("Stopping all drive wheels") for joint_name in self.joint_pub: ...
code_fim
hard
{ "lang": "python", "repo": "Nurgak/rover_locomotion", "path": "/src/rover_locomotion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spedas/pyspedas path: /pyspedas/mms/fgm/mms_split_fgm_data.py import logging from pytplot import data_exists from pytplot import get_data, store_data, options logging.captureWarnings(True) logging.basicConfig(format='%(asctime)s: %(message)s', datefmt='%d-%b-%y %H:%M:%S', level=logging.INFO) ...
code_fim
hard
{ "lang": "python", "repo": "spedas/pyspedas", "path": "/pyspedas/mms/fgm/mms_split_fgm_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> options(tplot_name + '_btot' + suffix, 'legend_names', 'Bmag') options(tplot_name + '_btot' + suffix, 'ytitle', 'MMS'+probe + ' FGM') out_vars.append(tplot_name + '_bvec' + suffix) out_vars.append(tplot_name + '_btot' + suffix) return out_vars<|fim_prefix|># repo: spe...
code_fim
hard
{ "lang": "python", "repo": "spedas/pyspedas", "path": "/pyspedas/mms/fgm/mms_split_fgm_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> await asyncio.gather(*tasks) async def _resetup_platform( opp: OpenPeerPower, integration_name: str, integration_platform: str, unprocessed_conf: ConfigType, ) -> None: """Resetup a platform.""" integration = await async_get_integration(opp, integration_platform) conf = ...
code_fim
hard
{ "lang": "python", "repo": "OpenPeerPower/core", "path": "/openpeerpower/helpers/reload.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenPeerPower/core path: /openpeerpower/helpers/reload.py """Class to reload platforms.""" from __future__ import annotations import asyncio from collections.abc import Iterable import logging from openpeerpower import config as conf_util from openpeerpower.const import SERVICE_RELOAD from open...
code_fim
hard
{ "lang": "python", "repo": "OpenPeerPower/core", "path": "/openpeerpower/helpers/reload.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> root_config[integration_platform].append(p_config) component = integration.get_component() if hasattr(component, "async_reset_platform"): # If the integration has its own way to reset # use this method. await component.async_reset_platform(opp, integration_name) ...
code_fim
hard
{ "lang": "python", "repo": "OpenPeerPower/core", "path": "/openpeerpower/helpers/reload.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PL-96/pytorch-U-net path: /predict.py import torch from torchvision import transforms from ptsemseg.models.unet_pl import unet_pl import os from train_pl import CrackDataset from torch.utils.data import DataLoader, Dataset import cv2 import numpy as np import torch.nn.functional as F imp...
code_fim
hard
{ "lang": "python", "repo": "PL-96/pytorch-U-net", "path": "/predict.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>testdataset = CrackDataset(test_images, test_labels) test_loader = DataLoader(testdataset, batch_size = 2, shuffle = False) with torch.no_grad(): for data in test_loader: images, labels = data images, labels = images.to(device, dtype = torch.float32...
code_fim
medium
{ "lang": "python", "repo": "PL-96/pytorch-U-net", "path": "/predict.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def test_tx_prefix(self): """ Transaction prefix :return: """ data_hex = pkg_resources.resource_string(__name__, os.path.join('data', 'tx_prefix_01.txt')) data_bin = binascii.unhexlify(data_hex) reader = x.MemoryReaderWriter(bytearray(data_...
code_fim
hard
{ "lang": "python", "repo": "ph4r05/monero-serialize", "path": "/monero_serialize/tests/test_xmr_boost.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ph4r05/monero-serialize path: /monero_serialize/tests/test_xmr_boost.py #!/usr/bin/env python # -*- coding: utf-8 -*- import random import unittest import binascii import json import os import pkg_resources import asyncio import aiounittest from .test_data import XmrTestData from .. import xmrs...
code_fim
hard
{ "lang": "python", "repo": "ph4r05/monero-serialize", "path": "/monero_serialize/tests/test_xmr_boost.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }