text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: mozilla/addons-server path: /src/olympia/api/tests/test_pagination.py from unittest import mock from django.conf import settings from rest_framework import generics, serializers, status from rest_framework.test import APIRequestFactory from olympia.amo.tests import TestCase from olympia.api.pa...
code_fim
hard
{ "lang": "python", "repo": "mozilla/addons-server", "path": "/src/olympia/api/tests/test_pagination.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hashtrip/backend path: /app/api/api_v1/endpoints/post.py from typing import Optional from fastapi import APIRouter, Body, Depends, Path, Query from slugify import slugify from starlette.exceptions import HTTPException from starlette.status import ( HTTP_201_CREATED, HTTP_204_NO_CONTENT, ...
code_fim
hard
{ "lang": "python", "repo": "hashtrip/backend", "path": "/app/api/api_v1/endpoints/post.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dbpost = await update_post_by_slug(db, slug, post, user.username) return create_aliased_response(PostInResponse(post=dbpost)) @router.delete("/posts/{slug}", tags=["posts"], status_code=HTTP_204_NO_CONTENT) async def delete_post( slug: str = Path(..., min_length=1), user: User = Depends(...
code_fim
hard
{ "lang": "python", "repo": "hashtrip/backend", "path": "/app/api/api_v1/endpoints/post.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ValRCS/Py_2018_KP path: /pq/widgets/save_search.py from PySide2 import QtCore from PySide2.QtWidgets import ( QWidget, QFormLayout, QLabel, QLineEdit, QPushButton, QHBoxLayout, ) from pq.db import Database class SaveSearchWidget(QWidget): <|fim_suffix|> self.form...
code_fim
medium
{ "lang": "python", "repo": "ValRCS/Py_2018_KP", "path": "/pq/widgets/save_search.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__() self._db = Database() self.form = QFormLayout() row_1 = QHBoxLayout() row_2 = QHBoxLayout() row_3 = QHBoxLayout() row_4 = QHBoxLayout() self.name = QLineEdit() row_1.addWidget(QLabel("Name:")) row_1.addWi...
code_fim
medium
{ "lang": "python", "repo": "ValRCS/Py_2018_KP", "path": "/pq/widgets/save_search.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZM-NEU/RadarLoc path: /datasets/quantization.py import numpy as np from typing import List from abc import ABC, abstractmethod import torch import MinkowskiEngine as ME class Quantizer(ABC): @abstractmethod def __call__(self, pc): pass class PolarQuantizer(Quantizer): def ...
code_fim
hard
{ "lang": "python", "repo": "ZM-NEU/RadarLoc", "path": "/datasets/quantization.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Converts to polar coordinates and quantizes with different step size for each coordinate # pc: (N, 3) point cloud with Cartesian coordinates (X, Y, Z) assert pc.shape[1] == 3 quantized_pc, ndx = ME.utils.sparse_quantize(pc, quantization_size=self.quant_step, return_index=...
code_fim
medium
{ "lang": "python", "repo": "ZM-NEU/RadarLoc", "path": "/datasets/quantization.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: module_name (str): Name of module to import. Returns: module: an imported module name Raises: error.NotFound: If module cannot be imported. """ try: module = resolve_name(module_name) except ImportError: raise error.NotFound(msg=modul...
code_fim
hard
{ "lang": "python", "repo": "panoptes/panoptes-utils", "path": "/src/panoptes/utils/library.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Raises: pocs.utils.error.NotFound: raised if library_path not given & find_library fails to locate the library. OSError: raises if the ctypes.CDLL loader cannot load the library. """ if mode is None: # Interpret a value of None as the default. mode =...
code_fim
hard
{ "lang": "python", "repo": "panoptes/panoptes-utils", "path": "/src/panoptes/utils/library.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: panoptes/panoptes-utils path: /src/panoptes/utils/library.py import ctypes import ctypes.util from astropy.utils import resolve_name from loguru import logger from panoptes.utils import error def load_c_library(name, path=None, mode=ctypes.DEFAULT_MODE, **kwargs): """Utility function to lo...
code_fim
hard
{ "lang": "python", "repo": "panoptes/panoptes-utils", "path": "/src/panoptes/utils/library.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: z80dev/ape path: /tests/integration/cli/test_misc.py import pytest from tests.integration.cli.utils import run_once <|fim_suffix|> result = runner.invoke(ape_cli, args) assert result.exit_code == 0, result.output<|fim_middle|># NOTE: test all the things without a direct test elsewhere @...
code_fim
hard
{ "lang": "python", "repo": "z80dev/ape", "path": "/tests/integration/cli/test_misc.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> result = runner.invoke(ape_cli, args) assert result.exit_code == 0, result.output<|fim_prefix|># repo: z80dev/ape path: /tests/integration/cli/test_misc.py import pytest from tests.integration.cli.utils import run_once <|fim_middle|># NOTE: test all the things without a direct test elsewhere @...
code_fim
hard
{ "lang": "python", "repo": "z80dev/ape", "path": "/tests/integration/cli/test_misc.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print(cups.index(1) + 1, cups.index(2) + 1, sep='\n') if __name__ == '__main__': main()<|fim_prefix|># repo: xCrypt0r/Baekjoon path: /src/13/13698.py """ 13698. Hawk eyes 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 64 ms 해결 날짜: 2020년 9월 22일 """ def main(): cups = [1, 0, 0, 2] <|fi...
code_fim
hard
{ "lang": "python", "repo": "xCrypt0r/Baekjoon", "path": "/src/13/13698.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xCrypt0r/Baekjoon path: /src/13/13698.py """ 13698. Hawk eyes 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 64 ms 해결 날짜: 2020년 9월 22일 """ def main(): cups = [1, 0, 0, 2] <|fim_suffix|> print(cups.index(1) + 1, cups.index(2) + 1, sep='\n') if __name__ == '__main__': main()<|fi...
code_fim
hard
{ "lang": "python", "repo": "xCrypt0r/Baekjoon", "path": "/src/13/13698.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> abbreviation = ... # type: typing___Text name = ... # type: typing___Text object_id = ... # type: typing___Text instance_id = ... # type: typing___Text _hierarchy = ... # type: builtin___int @property def depend_services(self) -> google___protobuf___internal___containers___Rep...
code_fim
hard
{ "lang": "python", "repo": "easyopsapis/easyops-api-python", "path": "/capacity_admin_sdk/model/cmdb_extend/app_dependency_pb2.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: easyopsapis/easyops-api-python path: /capacity_admin_sdk/model/cmdb_extend/app_dependency_pb2.pyi # @generated by generate_proto_mypy_stubs.py. Do not edit! import sys from google.protobuf.descriptor import ( Descriptor as google___protobuf___descriptor___Descriptor, ) from google.protobuf....
code_fim
hard
{ "lang": "python", "repo": "easyopsapis/easyops-api-python", "path": "/capacity_admin_sdk/model/cmdb_extend/app_dependency_pb2.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.fixture def query(): inst = Query( and_=frozenset(['and_this', 'and_that']), or_=frozenset(['or_this', 'or_that']), not_=frozenset(['not_this']), include=frozenset(['only this']), exclude=frozenset(['except_this']), flags=frozenset(), ) ...
code_fim
hard
{ "lang": "python", "repo": "IgorZyktin/MediaStorageSystem", "path": "/tests/core/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.fixture def query(): inst = Query( and_=frozenset(['and_this', 'and_that']), or_=frozenset(['or_this', 'or_that']), not_=frozenset(['not_this']), include=frozenset(['only this']), exclude=frozenset(['except_this']), flags=frozenset(), ) r...
code_fim
hard
{ "lang": "python", "repo": "IgorZyktin/MediaStorageSystem", "path": "/tests/core/conftest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: IgorZyktin/MediaStorageSystem path: /tests/core/conftest.py # -*- coding: utf-8 -*- """Tests. """ import pytest from mss import constants from mss.core import ( QueryBuilder, Query, ThemeStatistics, Synonyms, TagsOnDemand, Theme ) @pytest.fixture def valid_metarecord_dict(): retur...
code_fim
hard
{ "lang": "python", "repo": "IgorZyktin/MediaStorageSystem", "path": "/tests/core/conftest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument("-c", "--bk_cloud_id", type=int, help="cloud id") parser.add_argument("-b", "--bk_biz_id", type=int, help="biz id") def handle(self, *args, **kwargs): bk_biz_maintainer = ( client...
code_fim
medium
{ "lang": "python", "repo": "TencentBlueKing/bk-nodeman", "path": "/apps/node_man/management/commands/migrate_cloud_creator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TencentBlueKing/bk-nodeman path: /apps/node_man/management/commands/migrate_cloud_creator.py # coding: utf-8 """ TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available. Copyright (C) 2017-2022 THL A29 Limited, a Tencent company. All righ...
code_fim
hard
{ "lang": "python", "repo": "TencentBlueKing/bk-nodeman", "path": "/apps/node_man/management/commands/migrate_cloud_creator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bk_biz_maintainer = ( client_v2.cc.search_business( { "fields": ["bk_biz_id", "bk_biz_name", "bk_biz_maintainer"], "condition": {"bk_biz_id": kwargs["bk_biz_id"]}, } )["info"][0] .get("bk_bi...
code_fim
medium
{ "lang": "python", "repo": "TencentBlueKing/bk-nodeman", "path": "/apps/node_man/management/commands/migrate_cloud_creator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaeplin/dashmnb path: /dashlib/mnb_start.py import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), '.')) import re from mnb_makemnb import * from mnb_misc import * from mnb_rpc import * import simplejson as json def start_masternode( mns_to_start, protoco...
code_fim
hard
{ "lang": "python", "repo": "chaeplin/dashmnb", "path": "/dashlib/mnb_start.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> decoded = {} decoded['success'] = match1.group(1) decoded['failed'] = match1.group(2) decoded['total'] = match1.group(3) print('\n---> verify(decoding mnb)') print('\t---> total : ' + decoded['total']) print('\t---> success : ' + decoded['success'...
code_fim
hard
{ "lang": "python", "repo": "chaeplin/dashmnb", "path": "/dashlib/mnb_start.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('\n---> relay(announcing mnb)') print('\t---> total : ' + relayed['total']) print('\t---> success : ' + relayed['success']) print('\t---> failed : ' + relayed['failed']) print() if relayed['success'] != relayed['total']: ...
code_fim
hard
{ "lang": "python", "repo": "chaeplin/dashmnb", "path": "/dashlib/mnb_start.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>tribution_plot('') # pca variance elif plot == 'figure_3': generate_pca_variance('', 'loan') generate_pca_variance('', 'cardio') # distributions elif plot == 'figure_4_and_5': pca_cardio_distribution_plot('') pca_loan_distribu...
code_fim
hard
{ "lang": "python", "repo": "travisMichael/unsupervisedLearning", "path": "/generate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: travisMichael/unsupervisedLearning path: /generate.py import sys from cluster.kmeans.cluster_plot import generate_cardio_elbow_plot, generate_loan_elbow_plot from decomposition.pca import pca_cardio_scatter_plot, pca_loan_scatter_plot from decomposition.ica import ica_cardio_scatter_plot, ica_loa...
code_fim
hard
{ "lang": "python", "repo": "travisMichael/unsupervisedLearning", "path": "/generate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with Time() as t: for _ in range(10): loop.run_until_complete(place_orders(500))<|fim_prefix|># repo: gshklover/async_v20 path: /perftests/creating_orders.py import asyncio from perftests.helpers import Time, client print('Running creating_dataframe benchmark with async_v20 version', client...
code_fim
hard
{ "lang": "python", "repo": "gshklover/async_v20", "path": "/perftests/creating_orders.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gshklover/async_v20 path: /perftests/creating_orders.py import asyncio from perftests.helpers import Time, client print('Running creating_dataframe benchmark with async_v20 version', client.version) loop = asyncio.get_event_loop() # This will test the speed of the _formatting_order_requests he...
code_fim
hard
{ "lang": "python", "repo": "gshklover/async_v20", "path": "/perftests/creating_orders.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.cache_time != 0: if self.cache_time is None or self.cache_time == 'None': logger.debug("Caching %s for the cache's default timeout" % (real_slug,)) cache.set(cache_key, flatblock) ...
code_fim
hard
{ "lang": "python", "repo": "renyi/mezzanine-blocks", "path": "/mezzanine_blocks/templatetags/block_tags.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: renyi/mezzanine-blocks path: /mezzanine_blocks/templatetags/block_tags.py import logging from django import template from django.template import loader from django.db import models from django.core.cache import cache from mezzanine.conf import settings from mezzanine.utils.urls import slugify fro...
code_fim
hard
{ "lang": "python", "repo": "renyi/mezzanine-blocks", "path": "/mezzanine_blocks/templatetags/block_tags.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>do_get_flatblock = BasicFlatBlockWrapper() do_rich_flatblock = RichFlatBlockWrapper() do_image_flatblock = ImageFlatBlockWrapper() class FlatBlockNode(template.Node): def __init__(self, slug, is_variable, cache_time=0, with_template=True, template_name=None, tpl_is_variable=False, is_rich...
code_fim
hard
{ "lang": "python", "repo": "renyi/mezzanine-blocks", "path": "/mezzanine_blocks/templatetags/block_tags.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> app = Flask(__name__, instance_relative_config=True) app.config.from_pyfile(config_filename) initialize_extensions(app) register_blueprints(app) return app def initialize_extensions(application): # Since the application instance is now created, pass it to each Flask # extensio...
code_fim
medium
{ "lang": "python", "repo": "ludwejacobs/flaskappteam", "path": "/src/flaskbasic/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ludwejacobs/flaskappteam path: /src/flaskbasic/__init__.py # -*- coding: utf-8 -*- from pkg_resources import get_distribution, DistributionNotFound import os from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager, login_user, logout_user, login_requir...
code_fim
hard
{ "lang": "python", "repo": "ludwejacobs/flaskappteam", "path": "/src/flaskbasic/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Zakher21/macroeco path: /macroeco/misc/misc.py """ Miscellaneous functions """ import sys import os import traceback import threading as thread import logging import decorator import time def _thread_excepthook(): """ Make threads use sys.excepthook from parent process http://bugs...
code_fim
hard
{ "lang": "python", "repo": "Zakher21/macroeco", "path": "/macroeco/misc/misc.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for tstr in strs: start = content.find(tstr) while start != -1: cols_str = "".join(content[start:].split("\n")[0].split("=")[-1].split(" ")) semis = cols_str.count(";") # Get line number line_end = content.find("\n", start) ...
code_fim
hard
{ "lang": "python", "repo": "Zakher21/macroeco", "path": "/macroeco/misc/misc.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: scooter23/grins path: /mm/pytools/tog2/FileCache.py __version__ = "$Id$" from stat import * import os class FileCache: def __init__(self, func, rm = None, check = None): self.func = func self.rm = rm self.check = check self.cache = {} def __repr__(self)...
code_fim
hard
{ "lang": "python", "repo": "scooter23/grins", "path": "/mm/pytools/tog2/FileCache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def flushall(self): if self.rm: for file in self.cache.keys(): self.rm(file, self.cache[file][2]) self.cache = {} def flush(self, file): if self.cache.has_key(file): if self.rm: self.rm(file, self.cache[file][2]) ...
code_fim
hard
{ "lang": "python", "repo": "scooter23/grins", "path": "/mm/pytools/tog2/FileCache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> defaults = { 'memory_limit': 60000000, # ~56MB 'run_timeout': 5, # 5 secs } def __init__(self, *args, **kwargs): # Set default values first then eventually override them. self.update(SensorConfig.defaults) super(SensorConfig, self).__init__(*a...
code_fim
hard
{ "lang": "python", "repo": "whitehats/monitowl-agent", "path": "/whmonit/common/types.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: whitehats/monitowl-agent path: /whmonit/common/types.py # -*- encoding: utf-8 -*- ''' Base definitions for types flowing in the system. .. _primitives: Primitives ========== *Primitives* are basic types to represent most of data in system and all data gathered from :ref:`sensors`. Specificat...
code_fim
hard
{ "lang": "python", "repo": "whitehats/monitowl-agent", "path": "/whmonit/common/types.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#: Type representing ``config entry``. Pylint thinks this is a constant and argues #: it should be uppercase [C0103]. LogDBConfigEntry = namedtuple("LogDBConfigEntry", ["config_id", "target_id", "agent_id", "sensor_name", "timestamp", "config"]) class ID(unicode): ''' ...
code_fim
hard
{ "lang": "python", "repo": "whitehats/monitowl-agent", "path": "/whmonit/common/types.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>OL_VEC3 = 0x8B58 GL_BOOL_VEC4 = 0x8B59 GL_FLOAT_MAT2 = 0x8B5A GL_FLOAT_MAT3 = 0x8B5B GL_FLOAT_MAT4 = 0x8B5C GL_SAMPLER_2D = 0x8B5E GL_SAMPLER_CUBE = 0x8B60 GL_DELETE_STATUS = 0x8B80 GL_COMPILE_STATUS = 0x8B81 GL_LINK_STATUS = 0x8B82 GL_VALIDATE_STATUS = 0x8B83 GL_INFO_LOG_LENGTH = 0x8B84 GL_ATTACHED_SHADE...
code_fim
hard
{ "lang": "python", "repo": "cydenix/OpenGLCffi", "path": "/OpenGLCffi/GLES2/const.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cydenix/OpenGLCffi path: /OpenGLCffi/GLES2/const.py GL_DEPTH_BUFFER_BIT = 0x00000100 GL_STENCIL_BUFFER_BIT = 0x00000400 GL_COLOR_BUFFER_BIT = 0x00004000 GL_FALSE = 0 GL_NO_ERROR = 0 GL_ZERO = 0 GL_NONE = 0 GL_TRUE = 1 GL_ONE = 1 GL_POINTS = 0x0000 GL_LINES = 0x0001 GL_LINE_LOOP = 0x0002 GL_LINE_S...
code_fim
hard
{ "lang": "python", "repo": "cydenix/OpenGLCffi", "path": "/OpenGLCffi/GLES2/const.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> labs = glob.glob(labdir + '/*.lab') labs.sort() f = open(output, 'w') f.write('<document>\n') for l in labs: stem = os.path.splitext(os.path.split(l)[1])[0] fileid_element = document.createElement("fileid") doc_element.appendChild(fileid_element) fileid...
code_fim
hard
{ "lang": "python", "repo": "zweiein/kaldi", "path": "/sandbox/idlak/idlak-voice-build/modules/align_def.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def write_as_statelabs(kaldialign, frameshift, nstates, wavdurations, labdir, dirout): lines = open(kaldialign).readlines() for l in lines: ll = l.split() uttid = ll[0] plabs = open(os.path.join(labdir, uttid + '.lab')).readlines() fp = open(dirout + '/' + uttid + '...
code_fim
hard
{ "lang": "python", "repo": "zweiein/kaldi", "path": "/sandbox/idlak/idlak-voice-build/modules/align_def.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zweiein/kaldi path: /sandbox/idlak/idlak-voice-build/modules/align_def.py Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # THIS CODE IS PROV...
code_fim
hard
{ "lang": "python", "repo": "zweiein/kaldi", "path": "/sandbox/idlak/idlak-voice-build/modules/align_def.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #matches = re.findall (unaryRule1, parsedSent) #print matches unaryRules = ["\(NP (.*)\)", "\(ADJP [A-Za-z0-9]*\)"] for unaryRule in unaryRules: unaryMatches = re.findall( unaryRule, parsedSent) print "Unary:",unaryMatches binaryRules = ["\(VBZ [A-Za-z0-9]*\)", "\(IN [A-Za-z0-9]*\)"] for binaryRule ...
code_fim
hard
{ "lang": "python", "repo": "Shagunaawasthi/BobGoesToJail", "path": "/helpers/RulesStuff/predicateFinder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>binaryRules = ["\(VBZ [A-Za-z0-9]*\)", "\(IN [A-Za-z0-9]*\)"] for binaryRule in binaryRules: binaryMatches = re.findall(binaryRule, parsedSent) print "Binary:",binaryMatches<|fim_prefix|># repo: Shagunaawasthi/BobGoesToJail path: /helpers/RulesStuff/predicateFinder.py parsedSent = """(ROOT (S (NP...
code_fim
medium
{ "lang": "python", "repo": "Shagunaawasthi/BobGoesToJail", "path": "/helpers/RulesStuff/predicateFinder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shagunaawasthi/BobGoesToJail path: /helpers/RulesStuff/predicateFinder.py parsedSent = """(ROOT (S (NP (NP (DT A) (NN child)) (PP (IN under) (ADJP (NP (CD 10) (NNS years)) (JJ old)))) (VP (VBZ is) (RB not) (ADJP (RB criminally) (JJ responsi...
code_fim
hard
{ "lang": "python", "repo": "Shagunaawasthi/BobGoesToJail", "path": "/helpers/RulesStuff/predicateFinder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: barentsen/iphas-dr2 path: /paper/figures/diagrams/plot.py """Plots example colour/magnitude diagrams along different sightlines.""" import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator from matplotlib import colors import numpy as np from astropy....
code_fim
hard
{ "lang": "python", "repo": "barentsen/iphas-dr2", "path": "/paper/figures/diagrams/plot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> plt.xlabel('$r$ - $i$') plt.ylabel('$r$ - $\\rm H\\alpha$') plt.xlim([-0.3, 3.]) plt.ylim([-0.1, 1.3]) plt.text(0.06, 0.92, '$(\ell,b)=({0}^\circ, {1}^\circ)$'.format(l, b), horizontalalignment='left', verticalalignment='top', transform=ax.transA...
code_fim
hard
{ "lang": "python", "repo": "barentsen/iphas-dr2", "path": "/paper/figures/diagrams/plot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model_group = parser.add_mutually_exclusive_group() model_group.add_argument("-mi", "--mean_impute", help="perform mean imputation (default option)", action="store_true") model_group.add_argument("-sg", "--single_gaussian", help="impute using a single multivariate ...
code_fim
hard
{ "lang": "python", "repo": "JamesAllingham/AutoImpute", "path": "/auto_impute/auto_impute.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JamesAllingham/AutoImpute path: /auto_impute/auto_impute.py # James Allingham # Feb 2018 # auto_impute.py # Main file for AutoImpute CLI import argparse import numpy as np from sys import stdout import csv_reader import mi import sg import gmm import dp import mixed from utilities import print...
code_fim
hard
{ "lang": "python", "repo": "JamesAllingham/AutoImpute", "path": "/auto_impute/auto_impute.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Write the output to file # if there was no name supplied then write to std out if args.file_name == None: ofile = stdout print_err("Repaired file(s) written to std out.") print_err("") else: ofile = args.file_name # either sample the results or get th...
code_fim
hard
{ "lang": "python", "repo": "JamesAllingham/AutoImpute", "path": "/auto_impute/auto_impute.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cvmfs/cvmfs-monitor path: /backend/binding.gyp { "targets": [ { "target_name": "libcvmfs_node", "cflags!": [ "-fno-exceptions" ], "cflags_c<|fim_suffix|>b64/libcvmfs.a", "-lcurl", "-luuid"], 'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ], } ] }<|f...
code_fim
hard
{ "lang": "python", "repo": "cvmfs/cvmfs-monitor", "path": "/backend/binding.gyp", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>b64/libcvmfs.a", "-lcurl", "-luuid"], 'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ], } ] }<|fim_prefix|># repo: cvmfs/cvmfs-monitor path: /backend/binding.gyp { "targets": [ { "target_name": "libcvmfs_node", "cflags!": [ "-fno-exceptions" ], "cflags_c<|f...
code_fim
hard
{ "lang": "python", "repo": "cvmfs/cvmfs-monitor", "path": "/backend/binding.gyp", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/verbs/_preside.py #calss header class _PRESIDE(): def __init__(self,): <|fim_suffix|> def run(self, obj1 = [], obj2 = []): return self.jsondata<|fim_middle|> self.name = "PRESIDE" self.definitions = [u'to be in charge of a formal meeting, ceremony, ...
code_fim
hard
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/verbs/_preside.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = __import__(self.model, fromlist=['*']) cls = getattr(model, self.cls) obj = self.session.query(cls).get(action.id) if self.geom_rel and self.geom_col: geom_obj = getattr(obj, self.geom_rel) if isinstance(geom_obj, (tuple, list, dict, set)): ...
code_fim
hard
{ "lang": "python", "repo": "probins/featureserver", "path": "/FeatureServer/DataSource/GeoAlchemy.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: probins/featureserver path: /FeatureServer/DataSource/GeoAlchemy.py from FeatureServer.DataSource import DataSource from vectorformats.Feature import Feature from vectorformats.Formats import WKT from sqlalchemy import create_engine, and_, func from sqlalchemy.orm import sessionmaker import copy...
code_fim
hard
{ "lang": "python", "repo": "probins/featureserver", "path": "/FeatureServer/DataSource/GeoAlchemy.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print("\nDrone State for : " + self.vehicle_id ) #Get some vehicle attributes (state) print "Autopilot_version: %s" % self.vehicle.version print "Get some vehicle attribute values:" print "GPS: %s" % self.vehicle.gps_0 print "Battery: %s" % self.vehicle.bat...
code_fim
hard
{ "lang": "python", "repo": "jhoeksem/SE_with_drones", "path": "/04_multidrones/multidrone1/copter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ################################################################################################ # Connect to the Vehicle ################################################################################################ print 'Connecting to vehicle on: %s' % connection_strin...
code_fim
hard
{ "lang": "python", "repo": "jhoeksem/SE_with_drones", "path": "/04_multidrones/multidrone1/copter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jhoeksem/SE_with_drones path: /04_multidrones/multidrone1/copter.py # Import DroneKit-Python from dronekit import connect, VehicleMode, time import dronekit_sitl import os import thread #Setup option parsing to get connection string import argparse class UAV_Copter: #######################...
code_fim
hard
{ "lang": "python", "repo": "jhoeksem/SE_with_drones", "path": "/04_multidrones/multidrone1/copter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Show ori and undistorted image if 0: image_show = np.concatenate((img, undistort_image), axis=1) cv2.imshow('image_show', image_show) cv2.waitKey(1000) assert undistort_image.shape[0]==img.shape[0] and undistort_image.shape[1]==img.shape[1] cv2.imwrite(OUTPUT_FO...
code_fim
hard
{ "lang": "python", "repo": "KMS-TEAM/vi_slam", "path": "/tools/undistort_all_images.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KMS-TEAM/vi_slam path: /tools/undistort_all_images.py import numpy as np import cv2 import glob, os if 1: # fr1 dataset INPUT_FOLDER = '/home/lacie/Github/data/rgbd_dataset_freiburg1_desk/rgb' OUTPUT_FOLDER = '/home/lacie/Github/data/rgbd_dataset_freiburg1_desk/undist/' <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "KMS-TEAM/vi_slam", "path": "/tools/undistort_all_images.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: picrin/PredictiveCollision path: /src/track_and_log.py from global_values import * import random, math import ABCLogger, Circles, Circle import yaml class CollisionLogger(ABCLogger.ABCLogger): def writeHeader(self): return "---\n" + yaml.dump({'simulation':{'width': width, 'height': height, '...
code_fim
hard
{ "lang": "python", "repo": "picrin/PredictiveCollision", "path": "/src/track_and_log.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return {'circle': {'counter': self.counter,'position': [float(number) for number in self.position], 'velocity': [float(number) for number in self.velocity], 'time': self.time}} def dictAllRelevant(self): return {'circle': {'counter': self.counter,'position': [float(number) for number in self.position...
code_fim
medium
{ "lang": "python", "repo": "picrin/PredictiveCollision", "path": "/src/track_and_log.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def batch_iter(X, *tensors, batch_size=256): r"""Creates iterator over tensors. Args: X (torch.tensor): Feature tensor (shape: num_instances x num_features). tensors (torch.tensor): Target tensors (shape: num_instances). batch_size (int, Optional): Batch size. (default: :...
code_fim
hard
{ "lang": "python", "repo": "36000/myow", "path": "/self_supervised/data/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Args: X (torch.tensor): Feature tensor (shape: num_instances x num_features). tensors (torch.tensor): Target tensors (shape: num_instances). batch_size (int, Optional): Batch size. (default: :obj:`256`) """ idxs = torch.randperm(X.size(0)) if X.is_cuda: idx...
code_fim
medium
{ "lang": "python", "repo": "36000/myow", "path": "/self_supervised/data/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: 36000/myow path: /self_supervised/data/utils.py import numpy as np import torch def diagu_indices(n, k_min=1, k_max=None): if k_max is None: return np.array(np.triu_indices(n, 1)).T else: all_pairs = set(zip(*map(np.ndarray.tolist, np.triu_indices(n, k_min)))) rm...
code_fim
medium
{ "lang": "python", "repo": "36000/myow", "path": "/self_supervised/data/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: morefreeze/LuckyNumberBoardGame path: /lucky_number/model.py from enum import IntEnum from typing import List, Union, NewType class Color(IntEnum): EMPTY = 0 RED = 1 BLUE = 2 GREEN = 3 YELLOW = 4 TOTAL = 5 class Card(object): c: Color n: int def __init__(self,...
code_fim
hard
{ "lang": "python", "repo": "morefreeze/LuckyNumberBoardGame", "path": "/lucky_number/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def CardsIsSorted(cards: List[Card]) -> bool: if len(cards) > 0: for j in range(len(cards)-1): if not cards[j] < cards[j+1]: return False return True class Move(object): card: Card x: int y: int def __init__(self, c: Card, x, y:int): sel...
code_fim
medium
{ "lang": "python", "repo": "morefreeze/LuckyNumberBoardGame", "path": "/lucky_number/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return f"m {self.card.n} {self.x} {self.y}" def __repr__(self): return self.ToCmd() class Draw(object): def ToCmd(self) -> str: return f"d" def __repr__(self): return self.ToCmd() class Pass(object): def ToCmd(self) -> str: return f"p" ...
code_fim
hard
{ "lang": "python", "repo": "morefreeze/LuckyNumberBoardGame", "path": "/lucky_number/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> File must contain single dictionary on single row for each song. For example:: {"title: "mysong 1", difficulty: 1, level: 5} {"title: "mysong 2", difficulty: 2, level: 6} ... :filename: Path to JSON file :returns: None """ with open(filename) as infile: ...
code_fim
medium
{ "lang": "python", "repo": "surfmikko/anthology", "path": "/anthology/dbimport.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: surfmikko/anthology path: /anthology/dbimport.py """Import data to songs database""" import sys from json import loads from pymongo import TEXT from anthology.database import db_songs <|fim_suffix|> index_fields = [ ('title', TEXT), ('artist', TEXT)] if text_index: ...
code_fim
hard
{ "lang": "python", "repo": "surfmikko/anthology", "path": "/anthology/dbimport.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pwais/au2018 path: /au/test/fixtures/test_nnmodel.py from au import conf from au.fixtures import dataset from au.fixtures import nnmodel from au.test import testconf from au.test import testutils import os import unittest import pytest import tensorflow as tf class Sobel(nnmodel.INNModel): ...
code_fim
hard
{ "lang": "python", "repo": "pwais/au2018", "path": "/au/test/fixtures/test_nnmodel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert sobel_y_bytes == open(SOBEL_Y_TEST_IMG_PATH).read() assert sobel_x_bytes == open(SOBEL_X_TEST_IMG_PATH).read() # For debugging visible_path = row.to_debug() imageio.imwrite(visible_path + '.sobel_x.png', sobel_x) imageio.imwrite(visible_path + '.sobel_y.png'...
code_fim
hard
{ "lang": "python", "repo": "pwais/au2018", "path": "/au/test/fixtures/test_nnmodel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>Msg = Union[Ping, IndirectPingReq, AckResp, NackResp, Alive, Suspect, Dead, PushPull] PING_MSG = 1 INDIRECT_PING_MSG = 2 ACK_RESP_MSG = 3 SUSPECT_MSG = 4 ALIVE_MSG = 5 DEAD_MSG = 6 PUSH_PULL_MSG = 7 COMPOUND_MSG = 8 USER_MSG = 9 COMPRESS_MSG = 10 ENCRYPT_MSG = 11 NACK_RESP_MSG = 12 def deco...
code_fim
hard
{ "lang": "python", "repo": "jettify/aioc", "path": "/aioc/state.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jettify/aioc path: /aioc/state.py import struct import cbor from collections import namedtuple from enum import Enum from typing import Any, Union, List class EventType(str, Enum): JOIN = 'JOIN' UPDATE = 'UPDATE' LEAVE = 'LEAVE' class NodeStatus(int, Enum): ALIVE = 1 DEAD...
code_fim
hard
{ "lang": "python", "repo": "jettify/aioc", "path": "/aioc/state.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rileyannis/CSE841-pycparser path: /generate_coverage_841.py """============================= THIS IS CURRENTLY VERY UNFINISHED AND UNEXTENSIBLE. I MADE IT TO IMMEDIATELY TACKLE THE PROBLEM I HAD TO SOLVE. IT ACTUALLY ONLY WORKS FROM THE DIRECTORY ABOVE (OOPS). I'LL MODIFY IT TO MAKE IT MORE USEF...
code_fim
hard
{ "lang": "python", "repo": "rileyannis/CSE841-pycparser", "path": "/generate_coverage_841.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #try: # pass#subprocess.run(["rm", "-r", "replace/outputs/v*"]) #except: # pass #for each version in the given range... start() cov_lines = open("jfmc.db", 'r').readlines() for version in range(1, 33): out_file = open("coverage_small" + str(version) + ".db", ...
code_fim
hard
{ "lang": "python", "repo": "rileyannis/CSE841-pycparser", "path": "/generate_coverage_841.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> embedding_dim = 4 layer_class = LayernormSimpleRNN layer = layer_class( 5, use_layernorm=True, return_sequences=False, weights=None, input_shape=(None, embedding_dim), kernel_regularizer=keras.regularizers.l1(0...
code_fim
hard
{ "lang": "python", "repo": "kmedian/keras-layernorm-rnn", "path": "/keras_layernorm_rnn/layernorm_simplernn_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kmedian/keras-layernorm-rnn path: /keras_layernorm_rnn/layernorm_simplernn_test.py import numpy as np import tensorflow as tf import tensorflow.keras as keras from tensorflow.python.keras import testing_utils # from tensorflow.python.framework import test_util # deprecated from layernorm_simple...
code_fim
hard
{ "lang": "python", "repo": "kmedian/keras-layernorm-rnn", "path": "/keras_layernorm_rnn/layernorm_simplernn_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def check(reaction, user): return user == ctx.author and str(reaction) in reaction_list and reaction.message.id == MG.id try: reaction, user = await self.app.wait_for('reaction_add', timeout=60, check=check) ...
code_fim
hard
{ "lang": "python", "repo": "popop098/Taesia-Bot.py", "path": "/cogs/etc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> e5 = discord.Embed(title='태시아봇 서버관리 도움말') e5.add_field(name='ㅌ유저메모 [유저;@user] [내용]', value='지정한 상대에게 간단한 메모를 남겨요', inline=False) e5.add_field(name='ㅌ메모삭제 [유저;@user]', value='지정한 상대에게 남긴 메모를 삭제해요', inline=False) e5.add_field(name='ㅌ유저정보 [유저;@user]', value='지정한 상대의 정보를 확인해...
code_fim
hard
{ "lang": "python", "repo": "popop098/Taesia-Bot.py", "path": "/cogs/etc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: popop098/Taesia-Bot.py path: /cogs/etc.py ti = tit.replace("</b>", "") T = ti.replace("&quot;", "") link = i["originallink"] des = i["description"] d_e = des.replace("</b>", "") ...
code_fim
hard
{ "lang": "python", "repo": "popop098/Taesia-Bot.py", "path": "/cogs/etc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lapd-c/curveball path: /src/python/cb/util/ff_cookies.py #!/usr/bin/env python # # This material is based upon work supported by the Defense Advanced # Research Projects Agency under Contract No. N66001-11-C-4017. # # Copyright 2014 - Raytheon BBN Technologies Corp. # # Licensed under the Apache ...
code_fim
hard
{ "lang": "python", "repo": "lapd-c/curveball", "path": "/src/python/cb/util/ff_cookies.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.cookies = dict() cursor = self.conn.cursor() query = 'SELECT baseDomain, name from moz_cookies ORDER BY id' cursor.execute(query) for (base_domain, cookie_name) in cursor.fetchall(): ascii_cookie = cookie_name.encode('ascii', 'ignore') ...
code_fim
hard
{ "lang": "python", "repo": "lapd-c/curveball", "path": "/src/python/cb/util/ff_cookies.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Launch.__init__(self) def get_args(self): '''Parse the input arguments.''' ap = Launch.get_args(self, parse=False) ap.add_argument('-a', '--annotation', help="Label of annotation (default: '" + self.ANNO_DEFAULT + "')", ...
code_fim
hard
{ "lang": "python", "repo": "jianzuoyi/long-rna-seq-pipeline", "path": "/dnanexus/lrnaLaunch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_args(self): '''Parse the input arguments.''' ap = Launch.get_args(self, parse=False) ap.add_argument('-a', '--annotation', help="Label of annotation (default: '" + self.ANNO_DEFAULT + "')", choices=[self.ANNO_DEFAULT, 'M2...
code_fim
hard
{ "lang": "python", "repo": "jianzuoyi/long-rna-seq-pipeline", "path": "/dnanexus/lrnaLaunch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jianzuoyi/long-rna-seq-pipeline path: /dnanexus/lrnaLaunch.py "star_index": "star_index"}, "results": {"star_genome_bam": "star_genome_bam", "star_anno_bam": "star_anno_bam"} ...
code_fim
hard
{ "lang": "python", "repo": "jianzuoyi/long-rna-seq-pipeline", "path": "/dnanexus/lrnaLaunch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> d = (x1 - xc) / np.sin(gamma * np.pi/180) y1 = yc + d * np.cos(gamma * np.pi/180) # time array for SWAN input time_input = pd.date_range(date_ini, periods=hours, freq='H') # storm track (pd.DataFrame) st = pd.DataFrame(index=time_input, columns=['move', 'vf', 'pn', 'p0', 'lon', '...
code_fim
medium
{ "lang": "python", "repo": "teslakit/teslakit", "path": "/teslakit/numerical_models/swan/storms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: teslakit/teslakit path: /teslakit/numerical_models/swan/storms.py #!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np import pandas as pd from .geo import shoot def track_from_parameters( pmin, vmean, delta, gamma, x0, y0, x1, R, date_ini, hours, great_circle=Fals...
code_fim
medium
{ "lang": "python", "repo": "teslakit/teslakit", "path": "/teslakit/numerical_models/swan/storms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jnecus/ukbiobank-tools path: /ukbiobank/gui/menu_frame.py # -*- coding: utf-8 -*- """ Created on Wed Mar 25 13:33:29 2020 @author: Joe UKBiobank data loading utilities """ import wx import ukbiobank import ukbiobank.filtering from ukbiobank.gui.output_csv import OutputCsvFrame from ukbiobank.g...
code_fim
hard
{ "lang": "python", "repo": "jnecus/ukbiobank-tools", "path": "/ukbiobank/gui/menu_frame.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Function to gather all options selected def selectionsGetter(self, event): wx.MessageDialog(self, message="This function is not yet available").ShowModal() # print(self.ukb_object.SELECTIONS) return # Function to set options selected (options should be submitted as a...
code_fim
hard
{ "lang": "python", "repo": "jnecus/ukbiobank-tools", "path": "/ukbiobank/gui/menu_frame.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>for mon in mar_dec: firsts.append(firsts[-1] + mon) print sum([1 for i in firsts if i%7==6])<|fim_prefix|># repo: branning/euler path: /problems/euler019.py #!/usr/bin/env python firsts = [1] jan = 31 mar_dec = [31, 30, 31, 30, 31, 31, 30, 31, 30, 31]<|fim_middle|> for year in range(1901,2001): ...
code_fim
medium
{ "lang": "python", "repo": "branning/euler", "path": "/problems/euler019.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: branning/euler path: /problems/euler019.py #!/usr/bin/env python firsts = [1] jan = 31 mar_dec = [31, 30, 31, 30, 31, 31, 30, 31, 30, 31]<|fim_suffix|>for mon in mar_dec: firsts.append(firsts[-1] + mon) print sum([1 for i in firsts if i%7==6])<|fim_middle|> for year in range(1901,2001): ...
code_fim
medium
{ "lang": "python", "repo": "branning/euler", "path": "/problems/euler019.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>0 != 0 or year % 400 == 0: feb = 29 else: feb = 28 firsts.append(firsts[-1] + feb) for mon in mar_dec: firsts.append(firsts[-1] + mon) print sum([1 for i in firsts if i%7==6])<|fim_prefix|># repo: branning/euler path: /problems/euler019.py #!/usr/bin/env python firsts = [1] jan = 31 ...
code_fim
medium
{ "lang": "python", "repo": "branning/euler", "path": "/problems/euler019.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _https_send(self, method, url_path, ec_params): #conn = httplib.HTTPSConnection(choice(self._iplist)) method = method.upper() uri = 'https://%s%s' % (choice(self._iplist), url_path) if method == 'GET': if ec_params: dest_url = '%s?%s' % (...
code_fim
hard
{ "lang": "python", "repo": "francisar/ticket", "path": "/common/sns_network.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #conn = httplib.HTTPSConnection(choice(self._iplist)) method = method.upper() uri = 'https://%s%s' % (choice(self._iplist), url_path) if method == 'GET': if ec_params: dest_url = '%s?%s' % (uri, ec_params) else: dest_u...
code_fim
hard
{ "lang": "python", "repo": "francisar/ticket", "path": "/common/sns_network.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: francisar/ticket path: /common/sns_network.py #!/usr/bin/python # -*- coding: utf-8 -*- import socket import copy import urllib,urllib2 from urllib2 import Request from random import choice import httplib try: import json except ImportError: import simplejson as json #from sns_sig im...
code_fim
hard
{ "lang": "python", "repo": "francisar/ticket", "path": "/common/sns_network.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }