text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: eladroz/funnel-rocket path: /tests/test_apiserver.py # Copyright 2021 The Funnel Rocket Maintainers # # 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": "eladroz/funnel-rocket", "path": "/tests/test_apiserver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: baidu/baiduads-sdk path: /python/baiduads-sdk-auto/baiduads/wtpfeed/api/__init__.py from __future__ import absolute_import <|fim_suffix|># import apis into api package from baiduads.wtpfeed.api.wtp_feed_service import WtpFeedService<|fim_middle|># flake8: noqa
code_fim
easy
{ "lang": "python", "repo": "baidu/baiduads-sdk", "path": "/python/baiduads-sdk-auto/baiduads/wtpfeed/api/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># import apis into api package from baiduads.wtpfeed.api.wtp_feed_service import WtpFeedService<|fim_prefix|># repo: baidu/baiduads-sdk path: /python/baiduads-sdk-auto/baiduads/wtpfeed/api/__init__.py from __future__ import absolute_import <|fim_middle|># flake8: noqa
code_fim
easy
{ "lang": "python", "repo": "baidu/baiduads-sdk", "path": "/python/baiduads-sdk-auto/baiduads/wtpfeed/api/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> input = [0,0,0,0,0,0] print(input, end= " : ") print(remove_deuplicate(input)) input = [i for i in range(21)] print(input, end= " : ") print(remove_deuplicate(input))<|fim_prefix|># repo: ohmema/interview path: /python/interviews/Array/remove_duplicates.py #memory bound implimataion def remove_deuplic...
code_fim
medium
{ "lang": "python", "repo": "ohmema/interview", "path": "/python/interviews/Array/remove_duplicates.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ohmema/interview path: /python/interviews/Array/remove_duplicates.py #memory bound implimataion def remove_deuplicate(nums): single, i = 0, 1 while i < len(nums): if not isDuplicate(nums, single, nums[i]): single += 1 nums[single], nums[i] = nums[i], nums[...
code_fim
medium
{ "lang": "python", "repo": "ohmema/interview", "path": "/python/interviews/Array/remove_duplicates.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: boneil3/backtest path: /macro.py __author__ = 'brendan' import main import pandas as pd import numpy as np from datetime import datetime as dt from matplotlib import pyplot as plt import random import itertools import time import dateutil from datetime import timedelta data = pd.read_csv('raw_d...
code_fim
hard
{ "lang": "python", "repo": "boneil3/backtest", "path": "/macro.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fig4, ax4 = plt.subplots() data['US_M2'].dropna().pct_change(periods=1).plot(ax=ax4, label='US') data['UK_M2'].dropna().pct_change(periods=1).plot(ax=ax4, label='UK') data['GER_M2'].dropna().pct_change(periods=1).plot(ax=ax4, label='GER') data['ITA_M2'].dropna().pct_change(periods=1).plot(ax=ax4, label='I...
code_fim
hard
{ "lang": "python", "repo": "boneil3/backtest", "path": "/macro.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mhmdaris15/free-python-project path: /Code Politan/while_loop.py #Belajar while-loop data = "" # pada while loop perintah diulang berdasarkan data boolean # jika data true maka akan terus di eksekusi sampai data tsb false while data != "x": print("masukkan perulangan") #kata ini a...
code_fim
hard
{ "lang": "python", "repo": "Mhmdaris15/free-python-project", "path": "/Code Politan/while_loop.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>for ii in range(0, banyak): print(f"data ke {ii}") data_nama = input("nama :") data_tinggi_badan = int(input("tinggi :")) data_berat_badan = int(input("berat :")) nama.append(data_nama) tinggi_badan.append(data_tinggi_badan) berat_badan.append(data_berat_badan) prin...
code_fim
medium
{ "lang": "python", "repo": "Mhmdaris15/free-python-project", "path": "/Code Politan/while_loop.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: demirkirans/PlaDat-BLG411E path: /AWS_Services/matchPlacements.py import json import urllib3 import boto3 import time from boto3.dynamodb.conditions import Key,Attr from botocore.exceptions import ClientError def matching(student_skills, job_skills): counter = 0 for s_skill in student_skills: ...
code_fim
hard
{ "lang": "python", "repo": "demirkirans/PlaDat-BLG411E", "path": "/AWS_Services/matchPlacements.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> table = dynamodb.Table('Skills_jobs') db_response = table.scan(FilterExpression=Attr('Jobs_Company_ID').eq(Company_ID)&Attr('Jobs_ID').eq(Placement_ID)) for attribute in db_response['Items']: job_skills.append(attribute['name'])...
code_fim
hard
{ "lang": "python", "repo": "demirkirans/PlaDat-BLG411E", "path": "/AWS_Services/matchPlacements.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ############Scan all jobs ################ table = dynamodb.Table('Jobs') response = table.scan() if response['Count'] == 0: return { "statusCode": 500, 'body': json.dumps('Internal server error- There is no placement to show *-*') } ...
code_fim
hard
{ "lang": "python", "repo": "demirkirans/PlaDat-BLG411E", "path": "/AWS_Services/matchPlacements.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tim6her/listb path: /tests/test_doctests.py import doctest import unittest import os.path import listb.mrtools import listb.normalizetex import listb.pybibtools <|fim_suffix|>runner = unittest.TextTestRunner(verbosity=2) runner.run(suite)<|fim_middle|>suite = unittest.TestSuite() flags = docte...
code_fim
hard
{ "lang": "python", "repo": "tim6her/listb", "path": "/tests/test_doctests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>runner = unittest.TextTestRunner(verbosity=2) runner.run(suite)<|fim_prefix|># repo: tim6her/listb path: /tests/test_doctests.py import doctest import unittest import os.path import listb.mrtools import listb.normalizetex import listb.pybibtools <|fim_middle|>suite = unittest.TestSuite() flags = docte...
code_fim
hard
{ "lang": "python", "repo": "tim6her/listb", "path": "/tests/test_doctests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>flags = doctest.NORMALIZE_WHITESPACE suite.addTest(doctest.DocTestSuite(listb.mrtools, optionflags=flags)) suite.addTest(doctest.DocTestSuite(listb.normalizetex, optionflags=flags)) suite.addTest(doctest.DocTestSuite(listb.pybibtools, ...
code_fim
medium
{ "lang": "python", "repo": "tim6her/listb", "path": "/tests/test_doctests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> payload = response.json() self.assertIsInstance(payload, dict) self.assertDictEqual( payload, { "id": ph.pk, "shop": ph.shop, "name_of_discount": ph.name_of_discount, "text": ph.text, ...
code_fim
hard
{ "lang": "python", "repo": "rko619619/Skidon", "path": "/src/apps/api/tests/test_discount.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> user_headers = {"HTTP_AUTHORIZATION": self.user_token} admin_headers = {"HTTP_AUTHORIZATION": self.admin_token} data = { "shop": "shop", "name_of_discount": "sad", "text": "sad", "price": "sdsa", "additional_media": "http:...
code_fim
hard
{ "lang": "python", "repo": "rko619619/Skidon", "path": "/src/apps/api/tests/test_discount.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rko619619/Skidon path: /src/apps/api/tests/test_discount.py from typing import Optional from rest_framework import status from apps.api.tests.base import ApiTest class DiscountApiTest(ApiTest): def test_read(self): discount1 = self.create_discount("discount1") discount2 = ...
code_fim
hard
{ "lang": "python", "repo": "rko619619/Skidon", "path": "/src/apps/api/tests/test_discount.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sdss/sdss_install path: /python/sdss_install/application/Argument.py from __future__ import absolute_import, division, print_function, unicode_literals # The line above will help with 2to3 support. from sys import argv from os import environ, getenv from os.path import basename from argparse impo...
code_fim
hard
{ "lang": "python", "repo": "sdss/sdss_install", "path": "/python/sdss_install/application/Argument.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> '''Add command line arguments for bin file sdss_install''' xct = basename(argv[0]) parser = ArgumentParser(description=__doc__,prog=xct) parser.add_argument('-e', '--level', help='set logging level', metavar='LEVEL', choices=['debug','info','warning','error'], default='debug') parser.a...
code_fim
hard
{ "lang": "python", "repo": "sdss/sdss_install", "path": "/python/sdss_install/application/Argument.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def sdss_install(): '''Add command line arguments for bin file sdss_install''' xct = basename(argv[0]) parser = ArgumentParser(description=__doc__,prog=xct) parser.add_argument('-e', '--level', help='set logging level', metavar='LEVEL', choices=['debug','info','warning','error'], defa...
code_fim
hard
{ "lang": "python", "repo": "sdss/sdss_install", "path": "/python/sdss_install/application/Argument.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mpasternak/django-multiseek path: /multiseek/urls.py # -*- encoding: utf-8 -*- try: from django.conf.urls import url except ImportError: from django.urls import re_path as url from django.conf import settings from django.views.decorators.csrf import csrf_exempt from django.views.i18n i...
code_fim
hard
{ "lang": "python", "repo": "mpasternak/django-multiseek", "path": "/multiseek/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> url(r'^remove-from-results/(?P<pk>\d+)$', views.remove_by_hand, name="remove_from_results"), url(r'^remove-from-removed-results/(?P<pk>\d+)$', views.remove_from_removed_by_hand, name="remove_from_removed_results"), url(r'^reenable-removed-ids/$', views...
code_fim
hard
{ "lang": "python", "repo": "mpasternak/django-multiseek", "path": "/multiseek/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> url(r'^results/$', csrf_exempt(views.MultiseekResults.as_view( registry=settings.MULTISEEK_REGISTRY, template_name="multiseek/results.html" )), name="results"), url(r'^save_form/$', csrf_exempt(views.MultiseekSaveForm.as_view( registry=s...
code_fim
hard
{ "lang": "python", "repo": "mpasternak/django-multiseek", "path": "/multiseek/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Test failure""" self.helper_file_negative( "test/fixtures/templates/bad/properties_sg_ingress.yaml", 1 )<|fim_prefix|># repo: trav-c/cfn-python-lint path: /test/unit/rules/resources/ec2/test_sg_ingress.py """ Copyright Amazon.com, Inc. or its affiliates. All Rights ...
code_fim
hard
{ "lang": "python", "repo": "trav-c/cfn-python-lint", "path": "/test/unit/rules/resources/ec2/test_sg_ingress.py", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_prefix|># repo: trav-c/cfn-python-lint path: /test/unit/rules/resources/ec2/test_sg_ingress.py """ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0 """ from test.unit.rules import BaseRuleTestCase from cfnlint.rules.resources.ectwo.SecurityGroupIngress import ( ...
code_fim
hard
{ "lang": "python", "repo": "trav-c/cfn-python-lint", "path": "/test/unit/rules/resources/ec2/test_sg_ingress.py", "mode": "psm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tsouvarev/django-firebird path: /tests/test_main/test_base/models.py #-*- utf-8 -*- from django.db import models <|fim_suffix|>class BigS(models.Model): s = models.SlugField(max_length=255)<|fim_middle|> class FieldsTest(models.Model): date_field = models.DateTimeField()
code_fim
medium
{ "lang": "python", "repo": "tsouvarev/django-firebird", "path": "/tests/test_main/test_base/models.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class BigS(models.Model): s = models.SlugField(max_length=255)<|fim_prefix|># repo: tsouvarev/django-firebird path: /tests/test_main/test_base/models.py #-*- utf-8 -*- from django.db import models <|fim_middle|> class FieldsTest(models.Model): date_field = models.DateTimeField()
code_fim
medium
{ "lang": "python", "repo": "tsouvarev/django-firebird", "path": "/tests/test_main/test_base/models.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def get_points_from_city(cities): points_list = [] for value in keys.values(): for city in cities: if city in value: val = value.split('-') points_list.append(int(val[0])) return sum(points_list) '''def get_point_city_from_learned...
code_fim
medium
{ "lang": "python", "repo": "saikiran278/website-for-event-and-team-management", "path": "/index.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saikiran278/website-for-event-and-team-management path: /index.py keys = { 'if-statement': '5-Paris', 'comparison': '10-New York', 'match': '8-Sydney', 'boolean': '7-Barcelona', 'list': '2-London', 'slice': '10-Rome', 'iterable': '3-San Francisco', 'languag...
code_fim
hard
{ "lang": "python", "repo": "saikiran278/website-for-event-and-team-management", "path": "/index.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aschnapp/TheHaloMod path: /halomod_app/views.py import datetime # import logging import io import logging import zipfile from collections import OrderedDict import numpy as np from django.conf import settings from django.core.mail import send_mail from django.http import HttpResponse, HttpRespo...
code_fim
hard
{ "lang": "python", "repo": "aschnapp/TheHaloMod", "path": "/halomod_app/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class ContactFormView(FormView): form_class = forms.ContactForm template_name = "email_form.html" success_url = "/email-sent/" def form_valid(self, form): message = "{name} / {email} said: ".format( name=form.cleaned_data.get("name"), email=form.cleaned_data.get("emai...
code_fim
hard
{ "lang": "python", "repo": "aschnapp/TheHaloMod", "path": "/halomod_app/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ripssr/Code-Combat path: /1_Kithgard_Dungeon/042-Tactical_Strike/tactical_strike.py # You need the Elemental codex 1+ to cast "Haste<|fim_suffix|>.moveRight(2) hero.moveDown(0.1) hero.manaBlast()<|fim_middle|>" # You need an unique hero to perform "Mana Blast" hero.cast("haste", hero) hero.moveD...
code_fim
medium
{ "lang": "python", "repo": "ripssr/Code-Combat", "path": "/1_Kithgard_Dungeon/042-Tactical_Strike/tactical_strike.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.moveRight(2) hero.moveDown(0.1) hero.manaBlast()<|fim_prefix|># repo: ripssr/Code-Combat path: /1_Kithgard_Dungeon/042-Tactical_Strike/tactical_strike.py # You need the Elemental codex 1+ to cast "Haste<|fim_middle|>" # You need an unique hero to perform "Mana Blast" hero.cast("haste", hero) hero.moveD...
code_fim
medium
{ "lang": "python", "repo": "ripssr/Code-Combat", "path": "/1_Kithgard_Dungeon/042-Tactical_Strike/tactical_strike.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _learn(self, state): """update Q-value for the last taken action""" p_state, p_action = self.prev if p_state is None: return self.Q[p_state][p_action] = self.learning_rate * (self.R(state) + self.discount * max(self.Q[state].values())) - self.Q[p_state][...
code_fim
medium
{ "lang": "python", "repo": "frnsys/cess", "path": "/cess/agent/learn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frnsys/cess path: /cess/agent/learn.py import random class QLearner(): def __init__(self, states_actions, rewards, discount=0.5, explore=0.0, learning_rate=0.5): """basic Q-learning. given an environment where actions result in uncertain states, Q-learning allows the agent t...
code_fim
hard
{ "lang": "python", "repo": "frnsys/cess", "path": "/cess/agent/learn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return 1 - classifierlabelandprobability[classifierlabelandprobability[0]+1] def calculateUncertaintyMarginSampling(classifierlabelandprobability): prob = classifierlabelandprobability[1:] best = prob[classifierlabelandprobability[0]] second = 0 for p in prob: if p < best and ...
code_fim
hard
{ "lang": "python", "repo": "Ichaelus/Github-Classifier", "path": "/Application/Models/ClassificationModules/ActiveLearningSpecific.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ichaelus/Github-Classifier path: /Application/Models/ClassificationModules/ActiveLearningSpecific.py #!/usr/bin/env python # -*- coding: utf-8 -*- from math import log def calculateUncertaintyEntropyBased(classifierlabelandprobability): prob = classifierlabelandprobability[1:] sum = 0 ...
code_fim
medium
{ "lang": "python", "repo": "Ichaelus/Github-Classifier", "path": "/Application/Models/ClassificationModules/ActiveLearningSpecific.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># The number of processes to spawn of in multiprocessing. PROCESSES = cpu_count() - 1 # We need to pass pieces of the array to each process so it can do some work; # however, pieces that are too large cannot be passed. SPLITS determines how # arrays as subspliced to reduce their size. SPLITS = int(100 * ...
code_fim
hard
{ "lang": "python", "repo": "crcresearch/GOS", "path": "/examples/migration/constants.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: crcresearch/GOS path: /examples/migration/constants.py from multiprocessing import cpu_count # The minimum size of a country (in population) to be added to the model. MIN_POPULATION = 1900000 <|fim_suffix|># Any income above this level multiplied by the country's GDP is brought # down to this l...
code_fim
hard
{ "lang": "python", "repo": "crcresearch/GOS", "path": "/examples/migration/constants.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># We need to pass pieces of the array to each process so it can do some work; # however, pieces that are too large cannot be passed. SPLITS determines how # arrays as subspliced to reduce their size. SPLITS = int(100 * POPULATION_SCALE) if POPULATION_SCALE > 1 / 100 else 1<|fim_prefix|># repo: crcresearch...
code_fim
medium
{ "lang": "python", "repo": "crcresearch/GOS", "path": "/examples/migration/constants.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def remove_double_curly(text): while True: before = len(text) text = re.sub('{{[^{]*?}}', '', text) after = len(text) if before == after: return text body = remove_double_curly(body) def remove_double_brackets(text): while True: before = ...
code_fim
hard
{ "lang": "python", "repo": "deadbranch-forkarchive/EncyclopedicRecall", "path": "/dewiki.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def remove_double_curly(text): while True: before = len(text) text = re.sub('{{[^{]*?}}', '', text) after = len(text) if before == after: return text body = remove_double_curly(body) def remove_double_brackets(text): while True: before =...
code_fim
hard
{ "lang": "python", "repo": "deadbranch-forkarchive/EncyclopedicRecall", "path": "/dewiki.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: deadbranch-forkarchive/EncyclopedicRecall path: /dewiki.py import re from ast import literal_eval with open('wiki.txt', 'r', encoding='utf-8') as infile: #body = infile.read() body = literal_eval(f'"""{infile.read()}"""') <|fim_suffix|>body = remove_double_curly(body) def remove_dou...
code_fim
hard
{ "lang": "python", "repo": "deadbranch-forkarchive/EncyclopedicRecall", "path": "/dewiki.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: print( "\n" "This script provides the ability to work with test sets\n" "You can enter:\n" "0 - exit from the script\n" "1 - create a test set\n" "2 - add some tests to an existing test set\n" ...
code_fim
hard
{ "lang": "python", "repo": "dmitriyklebanov/tsp", "path": "/scripts/test_gen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmitriyklebanov/tsp path: /scripts/test_gen.py import sys import re import os from subprocess import call import random test_sets_folder = os.path.join("..", "test_sets") inputs_folder_name = "inputs" test_set_log_file = "test_set.log" def readInt(var_name, check_func): while True: ...
code_fim
hard
{ "lang": "python", "repo": "dmitriyklebanov/tsp", "path": "/scripts/test_gen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> number_of_tests = int(log[i]); i += 1 number_of_points = [int(t) for t in log[i].split(" ")]; i += 1 x = [int(t) for t in log[i].split(" ")]; i += 1 y = [int(t) for t in log[i].split(" ")]; i += 1 generateTests(folder_name, number_of_tests, number_of_points, x, y) ...
code_fim
hard
{ "lang": "python", "repo": "dmitriyklebanov/tsp", "path": "/scripts/test_gen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yangkang779/WSNet path: /WS-Faster-RCNN/ResNet.py import torch.nn as nn import torch import torchvision import torch.backends.cudnn as cudnn import torch.utils.data as data import math class Bottleneck(nn.Module): <|fim_suffix|> """ :param inplanes: 输入通道维数 :param planes: 输...
code_fim
medium
{ "lang": "python", "repo": "yangkang779/WSNet", "path": "/WS-Faster-RCNN/ResNet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ :param inplanes: 输入通道维数 :param planes: 输出通道纬数 :param baseWidth: 基本宽度 :param cardinality: 卷积组数量 :param stride: 步副 :param dawnsample:是否下采样 """ super(Bottleneck,self).__init__() D=int(math.floor(planes*(basewidth/64))) ...
code_fim
medium
{ "lang": "python", "repo": "yangkang779/WSNet", "path": "/WS-Faster-RCNN/ResNet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def FtVspcGetFraming(port_handle): result = c_uint(0) ret = api.FtVspcGetFraming(port_handle, byref(result)) if ret == 0: print_api_error() return None return result.value def FtVspcGetInQueueBytes(port_handle): result = c_ulong(0) ret = api.FtVspcGetInQueueBytes...
code_fim
hard
{ "lang": "python", "repo": "thingsroot/power_vsp", "path": "/vspc/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thingsroot/power_vsp path: /vspc/__init__.py spcPortEventInX = 28 # fInX SERIAL_AUTO_RECEIVE ftvspcPortEventNull = 29 # fNull SERIAL_NULL_STRIPPING ftvspcPortEventRtsControl = 30 # fRtsControl SERIAL_RTS_MASK = SERIAL_RTS_CONTROL | SERIAL_RTS_H...
code_fim
hard
{ "lang": "python", "repo": "thingsroot/power_vsp", "path": "/vspc/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thingsroot/power_vsp path: /vspc/__init__.py 3) # FtVspc_DataBits (ftvspcDataBits5, ftvspcDataBits6, ftvspcDataBits7, ftvspcDataBits8) = (0, 1, 2, 3) # FtVspc_Parity (ftvspcParityNone, ftvspcParityOdd, ftvspcParityEven, ftvspcParityMark, ftvspcParitySpace) = (0, 1, 2, 3, 4) # FtVspc_StopBits (...
code_fim
hard
{ "lang": "python", "repo": "thingsroot/power_vsp", "path": "/vspc/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gracetian-11/ketchup path: /backend/sentiment.py import argparse from google.cloud import language_v1 # export GOOGLE_APPLICATION_CREDENTIALS="/Users/gracetian/Desktop/hackduke2020/backend/google-app-cred.json" def get_sentiment(text_content): """ Analyzing Sentiment in a String A...
code_fim
hard
{ "lang": "python", "repo": "gracetian-11/ketchup", "path": "/backend/sentiment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># print( # "Overall Sentiment: score of {} with magnitude of {}".format(score, magnitude) # ) # return 0 # if __name__ == "__main__": # text_content = 'I am so happy and joyful.' # annotations = sample_analyze_sentiment(text_content) # print_result(annotations)<|fim_prefix...
code_fim
hard
{ "lang": "python", "repo": "gracetian-11/ketchup", "path": "/backend/sentiment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maurosilber/donkeykong path: /donkeykong/target/tifffile.py from tifffile import TiffFile from .local_target import LocalTarget class LocalTiff(LocalTarget): tif = None <|fim_suffix|> self.tif = TiffFile(self.path) return self def close(self): if self.tif is no...
code_fim
hard
{ "lang": "python", "repo": "maurosilber/donkeykong", "path": "/donkeykong/target/tifffile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return (len(self), *self.tif.pages[0].shape) def __getitem__(self, item): if isinstance(item, tuple): if isinstance(item[0], int): return self[item[0]][item[1:]] else: return self[item[0]][item] else: out = se...
code_fim
hard
{ "lang": "python", "repo": "maurosilber/donkeykong", "path": "/donkeykong/target/tifffile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: corbinsmart/metan path: /python/metan/exception.py # -*- coding:utf-8 -*- __all__ = [u"MayaCommandError", u"MetanRuntimeError", u"MetanObjectNotFoundError", u"MetanAttributeError", u"MetanTypeError", u"MetanArgumentError"] class MayaCommandError(RuntimeError):pass <|fim_suffix|> clas...
code_fim
medium
{ "lang": "python", "repo": "corbinsmart/metan", "path": "/python/metan/exception.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class MetanAttributeError(AttributeError):pass class MetanTypeError(TypeError):pass class MetanArgumentError(TypeError):pass<|fim_prefix|># repo: corbinsmart/metan path: /python/metan/exception.py # -*- coding:utf-8 -*- __all__ = [u"MayaCommandError", u"MetanRuntimeError", u"MetanObjectNotFoundError", u...
code_fim
hard
{ "lang": "python", "repo": "corbinsmart/metan", "path": "/python/metan/exception.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wenhui1008/ML_KEDF path: /pbcpy_new/src/pbcpy/semilocal_xc.py # Drivers for LibXC import numpy as np from .field import DirectField from .functionals import * import pylibxc from pylibxc.functional import LibXCFunctional def Get_LibXC_Input(density,do_sigma=True): if not isinstance(density...
code_fim
hard
{ "lang": "python", "repo": "Wenhui1008/ML_KEDF", "path": "/pbcpy_new/src/pbcpy/semilocal_xc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return XC(density=density,x_str='gga_x_pbe',c_str='gga_c_pbe',polarization='unpolarized') def LDA(density,polarization): return XC(density=density,x_str='lda_x',c_str='lda_c_pz',polarization='unpolarized') def KEDF(density,k_str,polarization): ''' Output: - Functional_KEDF: a...
code_fim
hard
{ "lang": "python", "repo": "Wenhui1008/ML_KEDF", "path": "/pbcpy_new/src/pbcpy/semilocal_xc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ok = True for i in range(count): if not generator.available(True): print("No pointcloud available?") break pc = generator.get() assert pc cwipc.cwipc_write_debugdump(f"{outdir}/pointcloud-{i}.cwipcdump", pc) pc.free() generator.f...
code_fim
medium
{ "lang": "python", "repo": "cwi-dis/cwipc_util", "path": "/python/examples/record.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cwi-dis/cwipc_util path: /python/examples/record.py import sys import cwipc def main(): if len(sys.argv) != 3: print(f"Usage: {sys.argv[0]} count dir", file=sys.stderr) print("Capture pointclouds store them in a directory", file=sys.stderr) sys.exit(2) <|fim_suff...
code_fim
medium
{ "lang": "python", "repo": "cwi-dis/cwipc_util", "path": "/python/examples/record.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: webclinic017/TradingEvolved path: /examples/old/zipline_model5.py from zipline.api import order_target_percent, order_target, symbol, record from pandas_datareader import data as pdr import matplotlib.pyplot as plt from datetime import datetime import numpy as np import pandas as pd aapl = pdr.g...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/TradingEvolved", "path": "/examples/old/zipline_model5.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> short_mavg = data.history(context.sym, 'price', 100, '1d').mean() long_mavg = data.history(context.sym, 'price', 300, '1d').mean() if short_mavg > long_mavg: order_target(context.sym, 100) elif short_mavg < long_mavg: order_target(context.sym, 0) record(AAPL=data.curre...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/TradingEvolved", "path": "/examples/old/zipline_model5.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Plot the buy signals ax1.plot(signals.loc[signals.positions == 1.0].index, signals.short_mavg[signals.positions == 1.0], '^', markersize=10, color='m') # Plot the sell signals ax1.plot(signals.loc[signals.positions == -1.0].index, signals.short_mavg[signals.positions == -1.0]...
code_fim
hard
{ "lang": "python", "repo": "webclinic017/TradingEvolved", "path": "/examples/old/zipline_model5.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': os.chdir(build_dir) run_setup('setup.py', script_args=['sdist', 'bdist'])<|fim_prefix|># repo: abeusher/fastapi-crudrouter path: /scripts/build.py import os import pathlib <|fim_middle|>from distutils.core import run_setup build_dir = pathlib.Path(__file__).parent.par...
code_fim
medium
{ "lang": "python", "repo": "abeusher/fastapi-crudrouter", "path": "/scripts/build.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abeusher/fastapi-crudrouter path: /scripts/build.py import os import pathlib <|fim_suffix|>build_dir = pathlib.Path(__file__).parent.parent if __name__ == '__main__': os.chdir(build_dir) run_setup('setup.py', script_args=['sdist', 'bdist'])<|fim_middle|>from distutils.core import run_se...
code_fim
easy
{ "lang": "python", "repo": "abeusher/fastapi-crudrouter", "path": "/scripts/build.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "3x3 convolution with padding" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBlock(nn.Module): expansion = 1 def __init__(self, inplanes, planes, stride=1, downsample=None): super(BasicBlock, self).__init__() self...
code_fim
hard
{ "lang": "python", "repo": "alisure-fork/BASNet", "path": "/src/MyTrain2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def cam(feature_for_clustering, feature_for_cam, k=5): top_k_value, top_k_index = torch.topk(feature_for_clustering, k, 1) cam = torch.cat([feature_for_cam[i:i+1, top_k_index[i], :, :].mean( 1, keepdim=True) for i in range(feature_for_cam.size()[0])]) ...
code_fim
hard
{ "lang": "python", "repo": "alisure-fork/BASNet", "path": "/src/MyTrain2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alisure-fork/BASNet path: /src/MyTrain2.py import os import glob import torch import numpy as np import torch.nn as nn from PIL import Image import torch.optim as optim from torchvision import models import torch.nn.functional as F from skimage import io, transform from torchvision import transfo...
code_fim
hard
{ "lang": "python", "repo": "alisure-fork/BASNet", "path": "/src/MyTrain2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> collectiveArgs.MMout = torch.mm(collectiveArgs.MMin1, collectiveArgs.MMin2) # Memory related def get_mem_size(self, collectiveArgs): return ( collectiveArgs.ipTensor.nelement() * collectiveArgs.ipTensor.element_size() ) def alloc_random(self, sizeArr, curR...
code_fim
hard
{ "lang": "python", "repo": "andrei-pokrovsky/param", "path": "/train/comms/pt/pytorch_tpu_backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrei-pokrovsky/param path: /train/comms/pt/pytorch_tpu_backend.py #!/usr/bin/env python3 import torch import os import torch_xla.core.xla_model as xm import torch_xla.distributed.xla_multiprocessing as xmp import torch.nn as nn import numpy as np from comms_utils import backendFunctions class...
code_fim
hard
{ "lang": "python", "repo": "andrei-pokrovsky/param", "path": "/train/comms/pt/pytorch_tpu_backend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass def get_groups(self): pass # Init functions def __init__(self, comms_world_info, commsParams): self.comms_world_info = comms_world_info self.commsParams = commsParams def initialize_backend(self, master_ip, master_port, backend="gloo"): pass ...
code_fim
hard
{ "lang": "python", "repo": "andrei-pokrovsky/param", "path": "/train/comms/pt/pytorch_tpu_backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>or j in range(1, i+1): print("#", end="") print("")<|fim_prefix|># repo: thembones79/cs50x path: /pset6/mario/less/mario.py height = 0 while height < 1 or height > 8: height = int(in<|fim_middle|>put("Height: ")) for i in range(1, height+1): k = height while k > i: print(...
code_fim
medium
{ "lang": "python", "repo": "thembones79/cs50x", "path": "/pset6/mario/less/mario.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thembones79/cs50x path: /pset6/mario/less/mario.py height = 0 while height < 1 or height > 8: height = int(in<|fim_suffix|> while k > i: print(" ", end="") k -= 1 for j in range(1, i+1): print("#", end="") print("")<|fim_middle|>put("Height: ")) for i in ran...
code_fim
medium
{ "lang": "python", "repo": "thembones79/cs50x", "path": "/pset6/mario/less/mario.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kingpin007/SC-Lab path: /plot-functions.py # -*- coding: utf-8 -*- """ Created on Thu Jul 26 09:34:42 2018 @author: Kingpin007 Equation: 1/(1+x^2) """ import matplotlib.pyplot as plt import numpy as np from scipy.special import gamma as Gamma from scipy import signal from scipy.integrate import ...
code_fim
hard
{ "lang": "python", "repo": "Kingpin007/SC-Lab", "path": "/plot-functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return signal.triang(x) def trapezoidal(f, a, b, n): h = float(b - a) / n s = 0.0 s += f(a)/2.0 for i in range(1, n): s += f(a + i*h) s += f(b)/2.0 return s * h def sigmoid(x): a = [] for item in x: #(the sigmoid function) a.appen...
code_fim
hard
{ "lang": "python", "repo": "Kingpin007/SC-Lab", "path": "/plot-functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: heyestom/CD4ML-Scenarios path: /cd4ml/pipeline_helpers.py from cd4ml.run_ml import run_all from cd4ml.download_data import run_download_data <|fim_suffix|> def train_and_validate_model(pipeline_params): print('Training and validating model') run_all(pipeline_params) print('Done train...
code_fim
medium
{ "lang": "python", "repo": "heyestom/CD4ML-Scenarios", "path": "/cd4ml/pipeline_helpers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def train_and_validate_model(pipeline_params): print('Training and validating model') run_all(pipeline_params) print('Done training and validating model')<|fim_prefix|># repo: heyestom/CD4ML-Scenarios path: /cd4ml/pipeline_helpers.py from cd4ml.run_ml import run_all from cd4ml.download_data ...
code_fim
medium
{ "lang": "python", "repo": "heyestom/CD4ML-Scenarios", "path": "/cd4ml/pipeline_helpers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YangZhou1997/openwhisk-lambda-mpi path: /CS260Tests/func-data-transferal.py import socket import os import time import sys from builtins import bytes import random import string import struct PORT = 65432 def get_peerips(): f = open("/addrMap/addrMap.txt", 'r') idipStr = f.readline().s...
code_fim
hard
{ "lang": "python", "repo": "YangZhou1997/openwhisk-lambda-mpi", "path": "/CS260Tests/func-data-transferal.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> else: # server print("server: ") s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((selfip, PORT)) s.listen() conn, addr = s.accept() print('Connected by', addr) while True: data = recv_msg(conn) # print(data) ...
code_fim
hard
{ "lang": "python", "repo": "YangZhou1997/openwhisk-lambda-mpi", "path": "/CS260Tests/func-data-transferal.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> selfid = args.get("instanceID") # myname0 or myname1: String if selfid == "myname0": peerid = "myname1" else: peerid = "myname0" idipMap = get_peerips() peerip = idipMap[peerid] selfip = idipMap[selfid] socket_type = selfid if socket_type == "myname1": # ...
code_fim
hard
{ "lang": "python", "repo": "YangZhou1997/openwhisk-lambda-mpi", "path": "/CS260Tests/func-data-transferal.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _do_additional_simulations( target, radiuses, surface_index, cluster_index, cluster_centers, cluster_labels, propagated_points, statistics_from_propagation, inner, outer, num_trials, time_step, use_parallel, n_split, ): surfaces = _get_surfa...
code_fim
hard
{ "lang": "python", "repo": "StannisZhou/entropic_barrier", "path": "/golf_course/estimate/capacity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StannisZhou/entropic_barrier path: /golf_course/estimate/capacity.py ner, outer, num_points, num_clusters, num_trials, time_step, use_parallel, n_split, ) middle_index = outer + 1 cluster_labels = cluster_labels[middle_index] ...
code_fim
hard
{ "lang": "python", "repo": "StannisZhou/entropic_barrier", "path": "/golf_course/estimate/capacity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('Doing additional simulations.') # Do more simulations and update statistics_from_propagation for ii in range(1, num_surfaces - 1): for jj in range(num_clusters): print('Doing simulations for surface {}, cluster {}.'.format(ii, jj)) _do_additional_simulati...
code_fim
hard
{ "lang": "python", "repo": "StannisZhou/entropic_barrier", "path": "/golf_course/estimate/capacity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> outputs = generator(input_data) output_values = self.evaluate(outputs) self.assertLen(outputs, 3) for index, output_value in enumerate(output_values): self.assertSequenceEqual(output_value.shape, (batch_size, 2**(index + 2), 2**(index + 2), 3)) def ...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/graphics", "path": "/tensorflow_graphics/projects/gan/architectures_progressive_gan_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/graphics path: /tensorflow_graphics/projects/gan/architectures_progressive_gan_test.py # Copyright 2020 The TensorFlow Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy ...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/graphics", "path": "/tensorflow_graphics/projects/gan/architectures_progressive_gan_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcowurth/w2w_ensembleplots path: /historical/contourplot_example_tot_prec.py import numpy as np import eccodes import netCDF4 as nc import Ngl def main(): ######################################################################## ### settings ...
code_fim
hard
{ "lang": "python", "repo": "marcowurth/w2w_ensembleplots", "path": "/historical/contourplot_example_tot_prec.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> resources.cnFillOn = True resources.cnFillMode = 'CellFill' #resources.cnCellFillEdgeColor = 'black' # uncomment this for plotting the cell edges resources.cnMissingValFillColor = 'black' resources.cnFillPalette = 'WhiteBlueGr...
code_fim
hard
{ "lang": "python", "repo": "marcowurth/w2w_ensembleplots", "path": "/historical/contourplot_example_tot_prec.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def update(self, obj, data): obj.title = data.get('title', data.title) obj.code = data.get('code', data.code) obj.lineos = data.get('lineos', data.lineos) obj.language = data.get('language', data.language) obj.style = data.get('style', data.style) obj.sa...
code_fim
hard
{ "lang": "python", "repo": "flaviogf/examples", "path": "/tutorial_django_rest/api/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: flaviogf/examples path: /tutorial_django_rest/api/serializers.py from rest_framework import serializers from api.models import LANGUAGE_CHOICES, STYLE_CHOICES, Snippet """ class SnippetSerializer(serializers.Serializer): <|fim_suffix|> class SnippetSerializer(serializers.ModelSerializer): ...
code_fim
hard
{ "lang": "python", "repo": "flaviogf/examples", "path": "/tutorial_django_rest/api/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def generate_content(self): self.add_title("EVENTS") events={} cur="" lines = f_readlines('events') for line in lines: line = line.decode("utf-8") line = line.strip("\n") if line != "": if line[0] == "#": ...
code_fim
hard
{ "lang": "python", "repo": "mscroggs/KLBFAX", "path": "/pages/103.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mscroggs/KLBFAX path: /pages/103.py import os from os.path import join,expanduser from page import Page from file_handler import f_readlines class EventPage(Page): def __init__(self): <|fim_suffix|> for date in sorted(events): event = events[date] self.add_text...
code_fim
hard
{ "lang": "python", "repo": "mscroggs/KLBFAX", "path": "/pages/103.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.add_title("EVENTS") events={} cur="" lines = f_readlines('events') for line in lines: line = line.decode("utf-8") line = line.strip("\n") if line != "": if line[0] == "#": line = line.strip...
code_fim
hard
{ "lang": "python", "repo": "mscroggs/KLBFAX", "path": "/pages/103.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def list_gliders(bounding_box): """ """ advanced_search = { 'institution': 'ooi_coastal_endurance', 'min_lat': bounding_box[0], 'max_lat': bounding_box[1], 'min_lon': bounding_box[2], 'max_lon': bounding_box[3], } search_url = GLIDER_DAC.get_se...
code_fim
hard
{ "lang": "python", "repo": "cwingard/ooi-data-explorations", "path": "/python/ooi_data_explorations/qartod/endurance/qartod_ce_gliders.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param latitude: :param longitude: :return: """ # based on the bounding box, create a list of glider datasets to download bounding_box = create_box(latitude, longitude) gliders = list_gliders(bounding_box) # download the data for each of the datasets partial_glider = p...
code_fim
hard
{ "lang": "python", "repo": "cwingard/ooi-data-explorations", "path": "/python/ooi_data_explorations/qartod/endurance/qartod_ce_gliders.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cwingard/ooi-data-explorations path: /python/ooi_data_explorations/qartod/endurance/qartod_ce_gliders.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ @author Christopher Wingard @brief Load Coastal Endurance glider data from the IOOS GilderDAC for use in creating QARTOD test values for d...
code_fim
hard
{ "lang": "python", "repo": "cwingard/ooi-data-explorations", "path": "/python/ooi_data_explorations/qartod/endurance/qartod_ce_gliders.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sentenceMatrix = np.array(sentenceMatrix, dtype='int32') positionMatrix_e = np.array(positionMatrix_e, dtype='int32') positionMatrix_t = np.array(positionMatrix_t, dtype='int32') return {'labels': labels, 'event':eventMatrix, 'time':timeMatrix, ...
code_fim
hard
{ "lang": "python", "repo": "xinyi1214/tacl2017-event-time-extraction", "path": "/1_CreatePKLFiles.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> f = open('pkl/embeddings.pkl', 'rb') embeddings = pkl.load(f) word2Idx = pkl.load(f) f.close() aspectMapping = {} typeMapping = {} tenseMapping = {} eventClassMapping = {} distanceMapping = {'PADDING': 0, 'LowerMin': 1, 'GreaterMax': 2} minDistan...
code_fim
hard
{ "lang": "python", "repo": "xinyi1214/tacl2017-event-time-extraction", "path": "/1_CreatePKLFiles.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xinyi1214/tacl2017-event-time-extraction path: /1_CreatePKLFiles.py import numpy as np import cPickle as pkl import gzip import os def createEmbeddingsFile(): folder = 'input/' embeddingsPath = '0_Preprocessing/embeddings/levy_dependency_based.words.vocab.gz' words = {} ...
code_fim
hard
{ "lang": "python", "repo": "xinyi1214/tacl2017-event-time-extraction", "path": "/1_CreatePKLFiles.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }