text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: broadinstitute/ml4h path: /ml4h/visualization_tools/annotation_storage.py """Methods for storing and retrieving annotations within notebooks.""" import abc import datetime from typing import Optional, Union from google.cloud import bigquery from google.cloud.bigquery import magics as bqmagics i...
code_fim
hard
{ "lang": "python", "repo": "broadinstitute/ml4h", "path": "/ml4h/visualization_tools/annotation_storage.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: openafs-contrib/afspy path: /afs/tests/lla/UbikLLATest.py #!/usr/bin/env python import unittest from BaseTest import parse_commandline, BasicTestSetup from afs.lla import UbikPeerLLA import afs class TestUbikLLAMethods(unittest.TestCase, BasicTestSetup): """ Tests UbikPeerLLA Methods...
code_fim
hard
{ "lang": "python", "repo": "openafs-contrib/afspy", "path": "/afs/tests/lla/UbikLLATest.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @unittest.expectedFailure def test_getDBState_not_syncSite(self): self.do_test_getDBState(self.not_SyncSite) return def do_test_voting(self, servername): d=self.LLA.getLongInfo(servername, self.DBPort,_cfg=afs.CONFIG,_user="test") for p in d["Peers"] : ...
code_fim
hard
{ "lang": "python", "repo": "openafs-contrib/afspy", "path": "/afs/tests/lla/UbikLLATest.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('insta', '0004_auto_20190522_1747'), ] operations = [ migrations.AlterField( model_name='image', name='profile_photo', field=models.ImageField(null=True, upload_to='images/'), ...
code_fim
medium
{ "lang": "python", "repo": "niklauspeter/instagram", "path": "/insta/migrations/0005_auto_20190522_1848.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('insta', '0004_auto_20190522_1747'), ] operations = [ migrations.AlterField( model_name='image', name='profile_photo', field=models.ImageField(null=True, upload_to='images/'), ), migrations.AlterField( ...
code_fim
medium
{ "lang": "python", "repo": "niklauspeter/instagram", "path": "/insta/migrations/0005_auto_20190522_1848.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: niklauspeter/instagram path: /insta/migrations/0005_auto_20190522_1848.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2019-05-22 15:48 from __future__ import unicode_literals <|fim_suffix|> operations = [ migrations.AlterField( model_name='image', nam...
code_fim
medium
{ "lang": "python", "repo": "niklauspeter/instagram", "path": "/insta/migrations/0005_auto_20190522_1848.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xjlin0/attendees path: /attendees/occasions/views/api/user_assembly_characters.py import time from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from rest_framework import viewsets from rest_framework.exceptions import AuthenticationFai...
code_fim
hard
{ "lang": "python", "repo": "xjlin0/attendees", "path": "/attendees/occasions/views/api/user_assembly_characters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_queryset(self): current_user = self.request.user current_user_organization = current_user.organization if current_user_organization: return CharacterService.by_organization_assemblys( organization_slug=current_user_organization.slug, ...
code_fim
hard
{ "lang": "python", "repo": "xjlin0/attendees", "path": "/attendees/occasions/views/api/user_assembly_characters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChengCat/qcgc path: /test/test_event_logger.py from support import lib,ffi import unittest class EventLoggerTestCase(unittest.TestCase): <|fim_suffix|> "Create and destroy event log" lib.qcgc_initialize() lib.qcgc_destroy() try: logfile = open(ffi.stri...
code_fim
easy
{ "lang": "python", "repo": "ChengCat/qcgc", "path": "/test/test_event_logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: pass finally: logfile.close() except: self.fail("Logfile does not exist")<|fim_prefix|># repo: ChengCat/qcgc path: /test/test_event_logger.py from support import lib,ffi import unittest class EventLoggerTestCase(unittest.Te...
code_fim
hard
{ "lang": "python", "repo": "ChengCat/qcgc", "path": "/test/test_event_logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(fname) as f: for i, l in enumerate(f): pass return i + 1 print("Number of lines in the file: ",file_lengthy("test.txt"))<|fim_prefix|># repo: Ekeopara-Praise/python-challenge-solutions path: /Ekeopara_Praise/Phase 2/FILE I & O/Day80 Tasks/...
code_fim
easy
{ "lang": "python", "repo": "Ekeopara-Praise/python-challenge-solutions", "path": "/Ekeopara_Praise/Phase 2/FILE I & O/Day80 Tasks/Task3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ekeopara-Praise/python-challenge-solutions path: /Ekeopara_Praise/Phase 2/FILE I & O/Day80 Tasks/Task3.py '''3. Write a Python program to count the number of lines in a text file.''' <|fim_suffix|> with open(fname) as f: for i, l in enumerate(f): pa...
code_fim
easy
{ "lang": "python", "repo": "Ekeopara-Praise/python-challenge-solutions", "path": "/Ekeopara_Praise/Phase 2/FILE I & O/Day80 Tasks/Task3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zikram/pykafka path: /tests/pykafka/test_simpleconsumer.py import mock import os import time import unittest2 from pykafka import KafkaClient from pykafka.simpleconsumer import OwnedPartition from pykafka.test.utils import get_cluster, stop_cluster class TestSimpleConsumer(unittest2.TestCase):...
code_fim
hard
{ "lang": "python", "repo": "zikram/pykafka", "path": "/tests/pykafka/test_simpleconsumer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_partition_offset_fetch_request(self): topic = mock.Mock() topic.name = "test_topic" partition = mock.Mock() partition.topic = topic partition.id = 12345 op = OwnedPartition(partition) request = op.build_offset_fetch_request() ...
code_fim
hard
{ "lang": "python", "repo": "zikram/pykafka", "path": "/tests/pykafka/test_simpleconsumer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> rqtime = int(time.time()) request = op.build_offset_commit_request() self.assertEqual(request.topic_name, topic.name) self.assertEqual(request.partition_id, partition.id) self.assertEqual(request.offset, op.last_offset_consumed) self.assertEqual(request.met...
code_fim
hard
{ "lang": "python", "repo": "zikram/pykafka", "path": "/tests/pykafka/test_simpleconsumer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for i in resp.json().get('data').get('list'): tupian_url = i.get('cover') name = i.get('title') tp_resp = requests.get(tupian_url, headers = headers) with open(f'{name}.jpg', 'wb') as f: # 若文件名中有斜杠则无法保存 f.write(tp_resp.content)<|fim_prefix|># repo: Weisswire/Python_Study_Homew...
code_fim
hard
{ "lang": "python", "repo": "Weisswire/Python_Study_Homework-Bilibili", "path": "/26_爬虫获取图片/26_爬虫获取图片.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Weisswire/Python_Study_Homework-Bilibili path: /26_爬虫获取图片/26_爬虫获取图片.py # import requests # def get_images(): # url = "https://api.bilibili.com/x/web-interface/dynamic/region?ps=12&rid=1" # header = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, li...
code_fim
medium
{ "lang": "python", "repo": "Weisswire/Python_Study_Homework-Bilibili", "path": "/26_爬虫获取图片/26_爬虫获取图片.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ :type s: str :rtype: int """ prev = 0 ans = 0 for k, g in groupby(s): l = len(list(g)) ans += min(l, prev) prev = l return ans<|fim_prefix|># repo: ckclark/leetcode path: /py/count-binary-substrings.py...
code_fim
easy
{ "lang": "python", "repo": "ckclark/leetcode", "path": "/py/count-binary-substrings.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ckclark/leetcode path: /py/count-binary-substrings.py from itertools import groupby class Solution(object): <|fim_suffix|> """ :type s: str :rtype: int """ prev = 0 ans = 0 for k, g in groupby(s): l = len(list(g)) ans ...
code_fim
easy
{ "lang": "python", "repo": "ckclark/leetcode", "path": "/py/count-binary-substrings.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> gt.seed_rng(42) seed(42) NUMBER_OF_NODES = 20 points = random((NUMBER_OF_NODES, 2)) points[0] = [0, 0] points[1] = [1, 1] g, pos = gt.triangulation(points, type="delaunay") g.set_directed(True) edges = list(g.edges()) # reciprocate edges for e in edges: g...
code_fim
medium
{ "lang": "python", "repo": "chongbingbao/image-segmentation-1", "path": "/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chongbingbao/image-segmentation-1 path: /test.py import graph_tool.all as gt from numpy.random import seed, random from scipy.linalg import norm <|fim_suffix|> gt.seed_rng(42) seed(42) NUMBER_OF_NODES = 20 points = random((NUMBER_OF_NODES, 2)) points[0] = [0, 0] points[1]...
code_fim
medium
{ "lang": "python", "repo": "chongbingbao/image-segmentation-1", "path": "/test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Ensure that attempting to access the triggered of anything but # an entry sensor in a V2 system throws an error: with pytest.raises(SimplipyError): assert keypad.triggered == 42 entry_sensor: SensorV2 = cast(SensorV2, system.sensors["609"]) assert ent...
code_fim
hard
{ "lang": "python", "repo": "bachya/simplisafe-python", "path": "/tests/sensor/test_v2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> entry_sensor: SensorV2 = cast(SensorV2, system.sensors["609"]) assert entry_sensor.data == 130 assert not entry_sensor.error assert not entry_sensor.low_battery assert entry_sensor.settings == 1 assert not entry_sensor.trigger_instantly assert not en...
code_fim
hard
{ "lang": "python", "repo": "bachya/simplisafe-python", "path": "/tests/sensor/test_v2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bachya/simplisafe-python path: /tests/sensor/test_v2.py """Define tests for V2 Sensor objects.""" from typing import cast import aiohttp import pytest from aresponses import ResponsesMockServer from simplipy import API from simplipy.device.sensor.v2 import SensorV2 from simplipy.errors import S...
code_fim
hard
{ "lang": "python", "repo": "bachya/simplisafe-python", "path": "/tests/sensor/test_v2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(dict_words) ''' 4) вывести 5 наиболее часто встречающихся слов (sort), вывести количество разных слов в тексте (set). ''' list_words_sort = list(dict_words.items()) print('Для всех слов:') list_words_sort.sort(key = lambda x: x[1], reverse = True) # Обратная сортировка по колличеству for i in r...
code_fim
hard
{ "lang": "python", "repo": "IvanGanin/Lessons", "path": "/lesson3.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IvanGanin/Lessons path: /lesson3.py with open('text.txt', mode = 'rt', encoding = 'utf-8') as f: text = f.read() ''' 1) методами строк очистить текст от знаков препинания; ''' temp = set() for i in text: temp.add(i) temp.remove(' ') temp.remove('\n') ltemp = list(temp) ltemp.sort() ltemp...
code_fim
hard
{ "lang": "python", "repo": "IvanGanin/Lessons", "path": "/lesson3.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> LAMBDA_ENVIRONMENT_VARIABLE = "lambda_environment_variable"<|fim_prefix|># repo: yuth/amplify-ci-support path: /src/release_artifacts_resources/ios/cdk/cdk/credential_rotation/lambda_functions/src/models/source_type.py from enum import Enum class SourceType(str, Enum): <|fim_middle|> """The sour...
code_fim
medium
{ "lang": "python", "repo": "yuth/amplify-ci-support", "path": "/src/release_artifacts_resources/ios/cdk/cdk/credential_rotation/lambda_functions/src/models/source_type.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuth/amplify-ci-support path: /src/release_artifacts_resources/ios/cdk/cdk/credential_rotation/lambda_functions/src/models/source_type.py from enum import Enum class SourceType(str, Enum): <|fim_suffix|> AWS_SESSION_CREDENTIALS = "aws_session_credentials" SECRETS_MANAGER = "secrets_mana...
code_fim
easy
{ "lang": "python", "repo": "yuth/amplify-ci-support", "path": "/src/release_artifacts_resources/ios/cdk/cdk/credential_rotation/lambda_functions/src/models/source_type.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>J8 = [0.315595,0.969839,-0.650295,-0.058989,-0.380561,-0.237262,1.546382,0.494935,-1.073902,\ 0.261010,2.938737,1.314844,-0.610274,-0.616883,2.923590,0.964480,-0.428509,1.169902,\ -0.285724,2.460704,-0.783270] h8 = [1.086629,0.879991,0.156720,0.300523,1.184974,0.604226,0.315772] J_ARRAY =...
code_fim
hard
{ "lang": "python", "repo": "nicksacco17/Quantum_Information", "path": "/HardInstances.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>J5 = [0.547770,0.466276,-0.372685,0.629326,0.640809,-0.206616,2.097702,0.647467,\ 0.817713,1.877727,0.437974,-1.265069,0.306160,-0.984917,-1.606176,0.606699,-0.444365,\ -0.550893,-2.175497,0.819336,0.503487] h5 = [0.354714,-1.470506,0.269355,0.426622,-1.128293,-0.105856,-0.958336] J6 = [0...
code_fim
hard
{ "lang": "python", "repo": "nicksacco17/Quantum_Information", "path": "/HardInstances.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nicksacco17/Quantum_Information path: /HardInstances.py NUM_HARD_INSTANCES = 9 J0 = [-0.974399,-0.389587,0.405797,-0.526664,1.122294,-0.274729,-1.826822, 0.859154,-0.473536,-0.106149,0.069886,0.018309,0.660378,1.388981, 1.340893,-0.755777,-0.846422,-0.855535,-0.877596,-0.263408,...
code_fim
hard
{ "lang": "python", "repo": "nicksacco17/Quantum_Information", "path": "/HardInstances.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("%s CLIENT requesting scripts" % datetime.datetime.now()) payload = (access_key, "request-scripts", amount) data = pickle.dumps(payload) sock.sendall(data) def editScript(scriptNo): print("%s CLIENT requesting to edit script %s" % (datetime.datetime.now(), scriptNo)) ...
code_fim
hard
{ "lang": "python", "repo": "bluesammer/Automatic-Youtube-Reddit-Text-To-Speech-Video-Generator-and-Uploader", "path": "/YouTube Bot Server/socketclient.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bluesammer/Automatic-Youtube-Reddit-Text-To-Speech-Video-Generator-and-Uploader path: /YouTube Bot Server/socketclient.py import socket from time import sleep import sys import pickle from threading import Thread import hashlib import datetime # Create a TCP/IP socket sock = socket.so...
code_fim
hard
{ "lang": "python", "repo": "bluesammer/Automatic-Youtube-Reddit-Text-To-Speech-Video-Generator-and-Uploader", "path": "/YouTube Bot Server/socketclient.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> global access_key print("Client listen thread active") while True: sleep(0.1) buf = sock.recv(800000) incomingdata = pickle.loads(buf) if incomingdata[0] == "login-success": login_success = incomingdata[1] access_key = incomingdat...
code_fim
hard
{ "lang": "python", "repo": "bluesammer/Automatic-Youtube-Reddit-Text-To-Speech-Video-Generator-and-Uploader", "path": "/YouTube Bot Server/socketclient.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: truenas/iocage path: /iocage_lib/ioc_debug.py # Copyright (c) 2014-2019, iocage # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing that the following conditions # are met: # 1. Redistributions of source code must r...
code_fim
hard
{ "lang": "python", "repo": "truenas/iocage", "path": "/iocage_lib/ioc_debug.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def run_jail_debug(self, name, path): jail_debug_path = f'{self.path}/{name}' jail_path = f'{path}/root' all_props = self.__get_jail_props__(name, path) fstab = self.__execute_debug__(['cat', f'{path}/fstab'], jail=name) hosts = self.__execute_debug__(['cat', f...
code_fim
hard
{ "lang": "python", "repo": "truenas/iocage", "path": "/iocage_lib/ioc_debug.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> aa = v['audio_features'][0]['array'] aa = [aa[k] for k in sorted(list(aa.keys()))] aas = [a.shape[0] for a in aa] assert len(aas) == len(ad), \ "insufficient audio feature num: {},{} ({}/{})".format(shard_name, k, aas, ad) assert all([aar == adr for aar,...
code_fim
hard
{ "lang": "python", "repo": "sripathisridhar/acav100m", "path": "/feature_extraction/code/tests/test_sample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_sample(): cmd, meta_path, out_path = prepare('samples/shard-{000000..000009}.tar') print('running') subprocess.run(cmd.split()) print('testing') check(meta_path, out_path) def test_sample_range(): cmd, meta_path, out_path = prepare('samples_range/shard-{000000..000029}....
code_fim
hard
{ "lang": "python", "repo": "sripathisridhar/acav100m", "path": "/feature_extraction/code/tests/test_sample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sripathisridhar/acav100m path: /feature_extraction/code/tests/test_sample.py import subprocess import shutil from pathlib import Path from utils import load_json, load_pickle from config import defaults from models.slowfast import LayerSlowFast from models.vggish import LayerVggish def prepare...
code_fim
hard
{ "lang": "python", "repo": "sripathisridhar/acav100m", "path": "/feature_extraction/code/tests/test_sample.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mtbentley/django-mailchimp path: /mailchimp/chimpy/utils.py from datetime import datetime def transform_datetime(dt): """ converts datetime parameter""" if dt is None: dt = '' else: assert isinstance(dt, datetime) dt = dt.strfti...
code_fim
medium
{ "lang": "python", "repo": "mtbentley/django-mailchimp", "path": "/mailchimp/chimpy/utils.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def flatten(params, key=None): """ flatten nested dictionaries and lists """ flat = {} for name, val in list(params.items()): if key is not None and not isinstance(key, int): name = "%s[%s]" % (key, name) if isinstance(val, dict): flat.update(flatten(val...
code_fim
medium
{ "lang": "python", "repo": "mtbentley/django-mailchimp", "path": "/mailchimp/chimpy/utils.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@click.command(name='Savify', context_settings=dict(allow_extra_args=True, ignore_unknown_options=True)) @click.help_option() @click.version_option(version=__version__) @click.option('-t', '--type', default=Choices.TYPE[0], help='Query type for text search.', type=click.Choice(Choices.TYPE))...
code_fim
hard
{ "lang": "python", "repo": "jimmymasaru/savify", "path": "/savify/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimmymasaru/savify path: /savify/cli.py """Console script for Savify.""" import sys import re import click import logging from os import system from pathlib import Path from . import __version__, __author__ from .types import * from .utils import PathHolder, create_dir from .savify import Savify...
code_fim
hard
{ "lang": "python", "repo": "jimmymasaru/savify", "path": "/savify/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> regex = r"^((%artist%|%album%|%playlist%)(\/(%artist%|%album%|%playlist%))*)+$" if re.search(regex, str(value)) or value is None: return value else: raise click.BadParameter('Group must be in the form x or x/x/x... where x in [%artist%, %album%, %playlist%]') def guided_cli(t...
code_fim
hard
{ "lang": "python", "repo": "jimmymasaru/savify", "path": "/savify/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open('tests/keys/testkey_ec', 'r') as ec_key: algo.prepare_key(ensure_unicode(ec_key.read())) @unittest.skipIf(not has_crypto, 'Not supported without cryptography library') def test_ec_verify_should_return_false_if_signature_invalid(self): algo = ECAlgorithm(hashe...
code_fim
hard
{ "lang": "python", "repo": "ralphbean/pyjwt", "path": "/tests/test_algorithms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> algo = ECAlgorithm(hashes.SHA256()) with open('tests/keys/testkey_ec', 'r') as ec_key: algo.prepare_key(ensure_unicode(ec_key.read())) @unittest.skipIf(not has_crypto, 'Not supported without cryptography library') def test_ec_verify_should_return_false_if_signature_in...
code_fim
hard
{ "lang": "python", "repo": "ralphbean/pyjwt", "path": "/tests/test_algorithms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ralphbean/pyjwt path: /tests/test_algorithms.py import base64 import hashlib from jwt.algorithms import Algorithm, HMACAlgorithm from .compat import unittest from .utils import ensure_bytes, ensure_unicode try: from cryptography.hazmat.primitives import hashes from jwt.algorithms impor...
code_fim
hard
{ "lang": "python", "repo": "ralphbean/pyjwt", "path": "/tests/test_algorithms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chiraagkv/ASL path: /streamlit_app.py import cv2 import mediapipe as mp import numpy as np from backend import load_model, predict_custom import streamlit as st from webrtc import VideoTransformer from streamlit_webrtc import VideoTransformerBase, webrtc_streamer, ClientSettings st.set_page_conf...
code_fim
medium
{ "lang": "python", "repo": "Chiraagkv/ASL", "path": "/streamlit_app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif page == "About": st.title("ASL to Text") st.markdown("""In recent years, ASL has become the medium of communication for thousands, if not millions of people. However, very few people with no hearing impairment know the various symbols of this sign-language. This project aims to bridge the ga...
code_fim
hard
{ "lang": "python", "repo": "Chiraagkv/ASL", "path": "/streamlit_app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># calculate equil populations from tProb -- this should match up with the known result! pi_known_pi = get_stationary_pops(tProb_known_pi) f_known_pi = -0.596*np.log(pi) # free energies in kcal/mol f_known_pi = f_known_pi - f_known_pi.min() # make lowest free energy value 0 print '----' print 'pi (true): ...
code_fim
hard
{ "lang": "python", "repo": "vvoelz/adaptive-seeding-paper", "path": "/code/for_Hongbin/test_known_pi_estimator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># get the timescales from tProb_known_pi evals, evecs = get_evals_evecs(tProb_known_pi) implied_timescale_known_pi = max(1.,-lagtime/np.log(evals[1])) print 'implied timescale (true) : 9.66e7 +/- 1.5e7 steps' print 'implied_timescale (estimate) :', implied_timescale_known_pi, 'steps.',<|fim_pref...
code_fim
hard
{ "lang": "python", "repo": "vvoelz/adaptive-seeding-paper", "path": "/code/for_Hongbin/test_known_pi_estimator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vvoelz/adaptive-seeding-paper path: /code/for_Hongbin/test_known_pi_estimator.py import os, sys sys.path.append('../') import numpy as np from twostate import * from estimators import * from BinManager import * # Here's a test of the MLE_known_pi estimator # First, let's read in one of the c...
code_fim
hard
{ "lang": "python", "repo": "vvoelz/adaptive-seeding-paper", "path": "/code/for_Hongbin/test_known_pi_estimator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>out = {} for sid, md in meta_map.items(): try: ra = md['ra'] dec = md['dec'] dr7objid = md['SDSS dr7 id'] location = location_keys[ np.where((ras == ra) & (decs == dec) & (dr7ids == dr7objid))[0][0] ] out[int(sid)] = location except KeyE...
code_fim
hard
{ "lang": "python", "repo": "tingard/Galaxy-builder-aggregation", "path": "/lib/recover_file_from_subjid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for sid, md in meta_map.items(): try: ra = md['ra'] dec = md['dec'] dr7objid = md['SDSS dr7 id'] location = location_keys[ np.where((ras == ra) & (decs == dec) & (dr7ids == dr7objid))[0][0] ] out[int(sid)] = location except KeyError: ...
code_fim
hard
{ "lang": "python", "repo": "tingard/Galaxy-builder-aggregation", "path": "/lib/recover_file_from_subjid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tingard/Galaxy-builder-aggregation path: /lib/recover_file_from_subjid.py # we want to create a file "location-map.json" which links a subject set with its original files import re import os import json import numpy as np import galaxy_utilities as gu def grab_data_from_file(fname): with op...
code_fim
hard
{ "lang": "python", "repo": "tingard/Galaxy-builder-aggregation", "path": "/lib/recover_file_from_subjid.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/gpu-burn/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.packa...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/gpu-burn/package.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> conflicts("~cuda", msg="gpu-burn requires cuda") conflicts("cuda_arch=none", msg="must select a CUDA architecture") def edit(self, spec, prefix): # update cuda architecture if necessary if "+cuda" in self.spec: cuda_arch = self.spec.variants["cuda_arch"].value ...
code_fim
hard
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/gpu-burn/package.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> nameEntry = Entry(nameWindow, width=15, justify='center', font=('Chalkboard SE', 30), bd=5, bg='white') nameEntry.place(x = screen_width/7, y=screen_height/5.5 ) button = Button(nameWindow, text="Save", font=("Chalkboard SE", 30),width=11, command=saveName, height=2, bg="#80deea", bd=3) ...
code_fim
hard
{ "lang": "python", "repo": "Ansh339412/C204", "path": "/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nameWindow.resizable(True, True) nameWindow.mainloop() def recivedMsg(): pass def setup(): global SERVER global PORT global IP_ADDRESS PORT = 6000 IP_ADDRESS = '127.0.0.1' SERVER = socket.socket(socket.AF_INET, socket.SOCK_STREAM) SERVER.connect((IP_ADDRES...
code_fim
hard
{ "lang": "python", "repo": "Ansh339412/C204", "path": "/client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ansh339412/C204 path: /client.py import socket from tkinter import * from threading import Thread import random from PIL import ImageTk, Image screen_width = None screen_height = None SERVER = None PORT = None IP_ADDRESS = None playerName = None <|fim_suffix|> canvas1 = Canvas( nameWindow,...
code_fim
hard
{ "lang": "python", "repo": "Ansh339412/C204", "path": "/client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ubco-mds-2020-labs/WineVision path: /pages/old/Rain.py import pandas as pd import numpy as np import dash import dash_html_components as html import dash_core_components as dcc from dash.dependencies import Input, Output import altair as alt import dash_bootstrap_components as dbc import dash_boo...
code_fim
hard
{ "lang": "python", "repo": "ubco-mds-2020-labs/WineVision", "path": "/pages/old/Rain.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def plot_scatter(xcol,ycol, winetype): wine_dif = wine.loc[(wine['Wine'].isin(winetype))] brush = alt.selection_interval() click = alt.selection_multi(fields=['Wine'], bind='legend') base = alt.Chart(wine_dif).properties( width=400, height=400 ).add_selection(brush) poi...
code_fim
hard
{ "lang": "python", "repo": "ubco-mds-2020-labs/WineVision", "path": "/pages/old/Rain.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def iterator(qs, batch_size=1000, order_by='pk', start_with=None, limit=None): for batch in batch_iterator(qs, batch_size, order_by, start_with, limit): for item in batch: yield item<|fim_prefix|># repo: wahello/django-chunked-iterator path: /django_chunked_iterator.py from __futu...
code_fim
hard
{ "lang": "python", "repo": "wahello/django-chunked-iterator", "path": "/django_chunked_iterator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if limit is not None: limit -= returned if returned: last_item = items[-1] try: start_with = getattr(last_item, order_by) except AttributeError: try: start_with = last_item[order_by] ...
code_fim
hard
{ "lang": "python", "repo": "wahello/django-chunked-iterator", "path": "/django_chunked_iterator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wahello/django-chunked-iterator path: /django_chunked_iterator.py from __future__ import unicode_literals, absolute_import def batch_iterator(qs, batch_size=1000, order_by='pk', start_with=None, limit=None): qs = qs.order_by(order_by) cond = order_by + '__gt' if ...
code_fim
hard
{ "lang": "python", "repo": "wahello/django-chunked-iterator", "path": "/django_chunked_iterator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # create dataset dataset = create_dataset(args_opt.test_data_dir, do_train=False, batch_size=config.batch_size, device_num=1, rank=0) # step_size = dataset.get_dataset_size() # define net net = xception(class_num=config.class_num) # load checkpoint param_dict = load_checkpoin...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/official/cv/Inception/xception/eval.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mindspore-ai/models path: /official/cv/Inception/xception/eval.py # Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/official/cv/Inception/xception/eval.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while True: if os.path.exists(sync_lock): break time.sleep(1) print("Device: {}, Finish sync unzip data from {} to {}.".format(get_device_id(), zip_file_1, save_dir_1)) args_opt.test_data_dir = args_opt.data_path if args_opt.modelarts_datase...
code_fim
hard
{ "lang": "python", "repo": "mindspore-ai/models", "path": "/official/cv/Inception/xception/eval.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ArvinZJC/UofG_PGT_PSD_Python path: /Labs/4/T5.py ''' Description: Task 5 Version: 1.0.0.20210128 Author: Arvin Zhao Date: 2021-01-28 14:45:12 Last Editors: Arvin Zhao LastEditTime: 2021-01-28 14:47:17 ''' <|fim_suffix|> x = np.ones((5, 5)) x[1:-1, 1:-1] = 25 print(x)<|fim_middle|>import numpy a...
code_fim
easy
{ "lang": "python", "repo": "ArvinZJC/UofG_PGT_PSD_Python", "path": "/Labs/4/T5.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>x = np.ones((5, 5)) x[1:-1, 1:-1] = 25 print(x)<|fim_prefix|># repo: ArvinZJC/UofG_PGT_PSD_Python path: /Labs/4/T5.py ''' Description: Task 5 Version: 1.0.0.20210128 Author: Arvin Zhao Date: 2021-01-28 14:45:12 Last Editors: Arvin Zhao LastEditTime: 2021-01-28 14:47:17 ''' <|fim_middle|>import numpy as...
code_fim
easy
{ "lang": "python", "repo": "ArvinZJC/UofG_PGT_PSD_Python", "path": "/Labs/4/T5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DreamEmulator/OpenCLSim path: /tests/test_blockly.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for `openclsim` package.""" import types <|fim_suffix|>@pytest.fixture def code(): """sample code""" code = """ def callback(): return 'callback called' """ return code ...
code_fim
medium
{ "lang": "python", "repo": "DreamEmulator/OpenCLSim", "path": "/tests/test_blockly.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_blockly_callback(code): """test if we can parse and execute a callback from blockly""" # module = types.ModuleType("module") # compile into ast (use <string> as a filename) ast = compile(code, filename="<string>", mode="exec") # execute the code in the context of the modu...
code_fim
medium
{ "lang": "python", "repo": "DreamEmulator/OpenCLSim", "path": "/tests/test_blockly.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> code = """ def callback(): return 'callback called' """ return code def test_blockly_callback(code): """test if we can parse and execute a callback from blockly""" # module = types.ModuleType("module") # compile into ast (use <string> as a filename) ast = compile(code, fi...
code_fim
medium
{ "lang": "python", "repo": "DreamEmulator/OpenCLSim", "path": "/tests/test_blockly.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ProjectFacet/facet path: /project/editorial/models/platforms.py from django.db import models from . import User, Organization #--------------------------------------------------------------------------# # Platforms and PlatformAccounts # Social accounts connected to Users, Organizat...
code_fim
hard
{ "lang": "python", "repo": "ProjectFacet/facet", "path": "/project/editorial/models/platforms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = models.CharField( max_length=250, help_text='Name of the platform.' ) # code for font awesome icon for the platform # ex. 'fa-facebook' is the Font Awesome icon for Facebook icon_code = models.CharField( max_length=50, blank=True, ...
code_fim
hard
{ "lang": "python", "repo": "ProjectFacet/facet", "path": "/project/editorial/models/platforms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>message = client.ip_messaging \ .services("SERVICE_SID") \ .channels("CHANNEL_SID") \ .messages("MESSAGE_SID") \ .update(body="MESSAGE") print(message.body)<|fim_prefix|># repo: kwhinnery/api-snippets path: /ip-messaging/rest/messages/updat...
code_fim
medium
{ "lang": "python", "repo": "kwhinnery/api-snippets", "path": "/ip-messaging/rest/messages/update-messages/update-messages.6.x.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kwhinnery/api-snippets path: /ip-messaging/rest/messages/update-messages/update-messages.6.x.py # Download the Python helper library from twilio.com/docs/python/install from twilio.rest import Client <|fim_suffix|>message = client.ip_messaging \ .services("SERVICE_SID") \ ...
code_fim
medium
{ "lang": "python", "repo": "kwhinnery/api-snippets", "path": "/ip-messaging/rest/messages/update-messages/update-messages.6.x.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> job = job_service.get_job_by_name(job_name, user_id) assert job.cron == '* * * * *' assert job.aws_cron == '* * * * ? *' assert job.human_cron == 'Every minute' assert job.schedule_is_active is True resp = web_client.put(f'/api/v1/jobs/{str(job.id)}/schedule', ...
code_fim
hard
{ "lang": "python", "repo": "seamless-io/seamless-web", "path": "/tests/integration/apis/test_job_flow.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: seamless-io/seamless-web path: /tests/integration/apis/test_job_flow.py import pytest import core.services.job as job_service def test_vanilla(web_client): res = web_client.get('/', follow_redirects=True) assert res.status_code == 200 def test_publish_user_not_found(cli_client): ...
code_fim
hard
{ "lang": "python", "repo": "seamless-io/seamless-web", "path": "/tests/integration/apis/test_job_flow.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abadithela/NFM2021_Static_Test_Synthesis path: /examples/parametered_grid.py _grid, plot_final_map, plot_augment_paths from src.simulation_helpers import run_iterations, run_iterations_SAPs, run_iterations_random_graph from time import gmtime, strftime plt.rcParams['mathtext.fontset'] = 'custom' ...
code_fim
hard
{ "lang": "python", "repo": "abadithela/NFM2021_Static_Test_Synthesis", "path": "/examples/parametered_grid.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for inP in range(len(nprops)): n_inP = nprops[inP] print("Computing data for t = "+str(iM)+" and nprops = "+str(n_inP)) time_avg, timed_out_avg, total_iter_avg, total_ILP_avg, time_avg_std = run_iterations_SAPs(iM, iN, n_inP, Niter, False, KEY) # Nodiagonal tra...
code_fim
hard
{ "lang": "python", "repo": "abadithela/NFM2021_Static_Test_Synthesis", "path": "/examples/parametered_grid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Niter = 50 # No. of iterations for each example t = [[3,3],[3,4],[3,5],[4,4]] # Grid size # t = [[3,3],[3,4]] lM = len(t) lN = len(t) P = [[2,3], [2,3], [2,3], [2,3], [2,3]] time_arr_no_diag = [[] for iM in range(lM)] # Stores time taking to solve a problem timed...
code_fim
hard
{ "lang": "python", "repo": "abadithela/NFM2021_Static_Test_Synthesis", "path": "/examples/parametered_grid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dabraude/PYSpeechLib path: /PYSpeechLib.py ######################################### # Base module ######################################### <|fim_suffix|>af = AudioFile() af.open(os.path.join('demo','test.raw')) af.frame() af.window() print af.length<|fim_middle|>import os from src import * fr...
code_fim
medium
{ "lang": "python", "repo": "dabraude/PYSpeechLib", "path": "/PYSpeechLib.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>af = AudioFile() af.open(os.path.join('demo','test.raw')) af.frame() af.window() print af.length<|fim_prefix|># repo: dabraude/PYSpeechLib path: /PYSpeechLib.py ######################################### # Base module ######################################### <|fim_middle|>import os from src import * fr...
code_fim
medium
{ "lang": "python", "repo": "dabraude/PYSpeechLib", "path": "/PYSpeechLib.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_tumble_window(self): t = self.t_env.from_elements( [(1, 1, "Hello"), (2, 2, "Hello"), (3, 4, "Hello"), (4, 8, "Hello")], ["a", "b", "c"]) result = t.window(Tumble.over("2.rows").on("a").alias("w"))\ .group_by("w, c").select("b.sum") ...
code_fim
hard
{ "lang": "python", "repo": "tianchen92/flink", "path": "/flink-python/pyflink/table/tests/test_window.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> result = t.window(Slide.over("2.seconds").every("1.seconds").on("a").alias("w"))\ .group_by("w, c").select("b.sum") actual = self.collect(result) expected = ['1', '3', '6', '12', '8'] self.assert_equals(actual, expected) def test_session_window(self): ...
code_fim
hard
{ "lang": "python", "repo": "tianchen92/flink", "path": "/flink-python/pyflink/table/tests/test_window.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tianchen92/flink path: /flink-python/pyflink/table/tests/test_window.py ################################################################################ # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed wit...
code_fim
hard
{ "lang": "python", "repo": "tianchen92/flink", "path": "/flink-python/pyflink/table/tests/test_window.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fms13/cdx path: /python/cdx/ReadContinuousDelayFile.py #!/usr/bin/env python ## # \addtogroup python_implementation # @{ # # \file ReadContinuousDelayFile.py # # \date April 4, 2012 # \author Frank Schubert # import numpy as np import h5py import warnings warnings.filterwarnings(...
code_fim
hard
{ "lang": "python", "repo": "fms13/cdx", "path": "/python/cdx/ReadContinuousDelayFile.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def compute_los_and_multipath_components_powers(self, link_name, start_time, length): g = self.f['links'][link_name] total_nof_cirs = len(g['cirs']) # check if start_time and length can be processed: if length != 0.0: if start_time + length > self.len...
code_fim
hard
{ "lang": "python", "repo": "fms13/cdx", "path": "/python/cdx/ReadContinuousDelayFile.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: GwenIves/Exercises path: /rgpwp/chapter15.py #!/usr/bin/env python # Copyright (c) 2008 Qtrac Ltd. All rights reserved. # This program or module is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License as published # by the Free Software Found...
code_fim
hard
{ "lang": "python", "repo": "GwenIves/Exercises", "path": "/rgpwp/chapter15.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> layout = QVBoxLayout() layout.addWidget(self.view) layout.addWidget(buttonBox) self.setLayout(layout) self.connect(addButton, SIGNAL("clicked()"), self.addRecord) self.connect(deleteButton, SIGNAL("clicked()"), self.deleteRecord) self.connect(closeB...
code_fim
hard
{ "lang": "python", "repo": "GwenIves/Exercises", "path": "/rgpwp/chapter15.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mesh = exodus(mesh, mode="a") points = mesh.get_coords() rotated_points = rotate(x=points[0], y=points[1], z=points[2], matrix=rot_mat) rotated_points = rotated_points.T mesh.put_coords(rotated_points[:, 0], rotated_points[:, 1], rotated...
code_fim
hard
{ "lang": "python", "repo": "GeoSinoLMU/MultiMesh", "path": "/multi_mesh/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GeoSinoLMU/MultiMesh path: /multi_mesh/utils.py """ A few functions to help out with specific tasks """ import numpy as np from pyexodus import exodus from multi_mesh.io.exodus import Exodus import h5py def get_rot_matrix(angle, x, y, z): """ :param angle: Rotation angle in radians (Rig...
code_fim
hard
{ "lang": "python", "repo": "GeoSinoLMU/MultiMesh", "path": "/multi_mesh/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x, y, z = np.asarray(x), np.asarray(y), np.asarray(z) return matrix.dot(np.array([x, y, z])) def rotate_mesh(mesh, event_loc, backwards=False): """ Rotate the coordinates of a mesh to make the source show up below the North Pole of the mesh. Can also be used to rotate backwards. ...
code_fim
hard
{ "lang": "python", "repo": "GeoSinoLMU/MultiMesh", "path": "/multi_mesh/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DeepinSC/todolist path: /backend/todolist_rest/migrations/0004_auto_20171215_1437.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-12-15 06:37 from __future__ import unicode_literals <|fim_suffix|> dependencies = [ ('todolist_rest', '0003_auto_20171214_1948'), ] ...
code_fim
medium
{ "lang": "python", "repo": "DeepinSC/todolist", "path": "/backend/todolist_rest/migrations/0004_auto_20171215_1437.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('todolist_rest', '0003_auto_20171214_1948'), ] operations = [ migrations.AlterField( model_name='todo', name='expire_date', field=models.DateField(default=datetime.datetime(2017, 12, 15, 6, 37, 48, 584292, tzinfo=utc)), ...
code_fim
medium
{ "lang": "python", "repo": "DeepinSC/todolist", "path": "/backend/todolist_rest/migrations/0004_auto_20171215_1437.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='todo', name='expire_date', field=models.DateField(default=datetime.datetime(2017, 12, 15, 6, 37, 48, 584292, tzinfo=utc)), ), ]<|fim_prefix|># repo: DeepinSC/todolist path: /backend/todolist_rest...
code_fim
medium
{ "lang": "python", "repo": "DeepinSC/todolist", "path": "/backend/todolist_rest/migrations/0004_auto_20171215_1437.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Modify default values (OPTIONAL) COMPANY ='EpiData' SITE = 'San_Francisco' STATION = 'WSN-1' SENSOR = "Temperature_Probe" ######################### # SKIP SSL VERIFICATION # ######################### import ssl try: _create_unverified_https_context = ssl._create_unverified_context except Attribu...
code_fim
hard
{ "lang": "python", "repo": "epidataio/epidata-community", "path": "/play/examples/python_2.7/sensor_data_query.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: epidataio/epidata-community path: /play/examples/python_2.7/sensor_data_query.py ############################ # Import Required Modules # ############################ import argparse import base64 from datetime import datetime, timedelta import httplib import json import numpy as np from pytz im...
code_fim
hard
{ "lang": "python", "repo": "epidataio/epidata-community", "path": "/play/examples/python_2.7/sensor_data_query.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_validate_search_no_input(): """Test validation of an empty value for search_input.""" payload = {"search_object_types": []} result = validate_search_payload(payload) assert result["errors"] == "No search_input string for search received." def tests_validate_search_no_types(): ...
code_fim
hard
{ "lang": "python", "repo": "Chaos-Monkey-Island/sawtooth-next-directory", "path": "/tests/unit/server/search_api_tests.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }