text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> names.append("LWristYaw") times.append([3, 50]) keys.append([-1.53589, 0.139552]) names.append("RAnklePitch") times.append([3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23.6, 26.2, 28.4, 30.4, 32.4, 34.4, 37, 39.6, 42.2, 44.4, 46.2, 50]) keys.a...
code_fim
hard
{ "lang": "python", "repo": "OpenRoberta/robertalab-naoprogram", "path": "/OpenRobertaNAO/src/main/resources/originalHal.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> names.append("LWristYaw") times.append([1.52, 3.12, 3.8, 4.92]) keys.append([0.386526, 0.386526, 0.386526, 0.386526]) names.append("RElbowRoll") times.append([0.64, 1.36, 2.96, 3.64, 4.2, 4.76]) keys.append([1.28093, 1.39752, 1.57239, 1.24105, 1.22571, 0.84...
code_fim
hard
{ "lang": "python", "repo": "OpenRoberta/robertalab-naoprogram", "path": "/OpenRobertaNAO/src/main/resources/originalHal.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mkenworthy/metis_hci path: /LMS_APP/plot_LMS_APP.py from hcipy import * import numpy as np from matplotlib import pyplot as plt if __name__ == "__main__": amp = read_fits('METIS_APP_20jul2018_amp.fits') phase = read_fits('METIS_APP_20jul2018_phase.fits') # ...
code_fim
hard
{ "lang": "python", "repo": "mkenworthy/metis_hci", "path": "/LMS_APP/plot_LMS_APP.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> aper11 = Field(aper1.ravel(), pupil_grid) aper22 = Field(aper2.ravel(), pupil_grid) aper33 = Field(aper3.ravel(), pupil_grid) # This detector grid is in the units of telescope_focal_length detector_grid = make_focal_grid(pupil_grid, wavelength=wavelength_0, q=...
code_fim
hard
{ "lang": "python", "repo": "mkenworthy/metis_hci", "path": "/LMS_APP/plot_LMS_APP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # make psf A wf1 = Wavefront(aper11, wavelength) wf1_foc = prop.forward(wf1) wf2 = Wavefront(aper22, wavelength) wf2_foc = prop.forward(wf2) wf3 = Wavefront(aper33, wavelength) wf3_foc = p...
code_fim
hard
{ "lang": "python", "repo": "mkenworthy/metis_hci", "path": "/LMS_APP/plot_LMS_APP.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: M3DV/SimTA path: /utils/cuda.py import os import pickle import torch.nn as nn def put_var_on_gpu(var, devices, requires_grad=False): if len(devices) == 1: var = var.cuda(devices[0]) return var <|fim_suffix|> if len(devices) == 1: model = model.cuda(devices[0]) ...
code_fim
easy
{ "lang": "python", "repo": "M3DV/SimTA", "path": "/utils/cuda.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(devices) == 1: model = model.cuda(devices[0]) else: model = nn.DataParallel(model, device_ids=devices) return model<|fim_prefix|># repo: M3DV/SimTA path: /utils/cuda.py import os import pickle import torch.nn as nn def put_var_on_gpu(var, devices, requires_grad=False...
code_fim
medium
{ "lang": "python", "repo": "M3DV/SimTA", "path": "/utils/cuda.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: M3DV/SimTA path: /utils/cuda.py import os import pickle import torch.nn as nn <|fim_suffix|>def put_model_on_gpu(model, devices): if len(devices) == 1: model = model.cuda(devices[0]) else: model = nn.DataParallel(model, device_ids=devices) return model<|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "M3DV/SimTA", "path": "/utils/cuda.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>new_data_list = {} order = 0 for keyword in _data.keys(): order += 1 new_data_list[keyword] = order # 写入数据 with open('数据处理\\输入神经元的数据处理\\6_final_keyword_and_order.json', 'a+', encoding='utf-8') as f: f.write(json.dumps(new_data_list, ensure_ascii=False))<|fim_prefix|># repo: xingyu321/SZU_g...
code_fim
medium
{ "lang": "python", "repo": "xingyu321/SZU_gwt_predict_network", "path": "/数据处理/输入神经元的数据处理/6_GenerateKey-OrderTable.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xingyu321/SZU_gwt_predict_network path: /数据处理/输入神经元的数据处理/6_GenerateKey-OrderTable.py """ 这个脚本的目的是生成最终的数据:关键词与对应的序号,final_keyword_and_order_6.json """ import json # 读取数据 with open('数据处理\\输入神经元的数据处理\\5_final_word_weights.json', 'r', encoding='utf-8') as f: _data = json.loads(f.read()) <|fim_...
code_fim
medium
{ "lang": "python", "repo": "xingyu321/SZU_gwt_predict_network", "path": "/数据处理/输入神经元的数据处理/6_GenerateKey-OrderTable.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># 写入数据 with open('数据处理\\输入神经元的数据处理\\6_final_keyword_and_order.json', 'a+', encoding='utf-8') as f: f.write(json.dumps(new_data_list, ensure_ascii=False))<|fim_prefix|># repo: xingyu321/SZU_gwt_predict_network path: /数据处理/输入神经元的数据处理/6_GenerateKey-OrderTable.py """ 这个脚本的目的是生成最终的数据:关键词与对应的序号,final_keywo...
code_fim
medium
{ "lang": "python", "repo": "xingyu321/SZU_gwt_predict_network", "path": "/数据处理/输入神经元的数据处理/6_GenerateKey-OrderTable.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #build and install driver command = u'cd "%s"; ./install.sh 2mic' % self.TMP_DIR self.logger.debug('Respeaker driver install command: %s' % command) console = EndlessConsole(command, self.__process_status_callback, self.__install_terminated_callback) console.start()...
code_fim
hard
{ "lang": "python", "repo": "tangb/cleepmod-respeaker2mic", "path": "/backend/seeed2micaudiodriver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tangb/cleepmod-respeaker2mic path: /backend/seeed2micaudiodriver.py #!/usr/bin/env python # -*- coding: utf-8 -*- import time import logging import os from raspiot.utils import InvalidParameter, MissingParameter from raspiot.libs.commands.alsa import Alsa from raspiot.libs.commands.lsmod import ...
code_fim
hard
{ "lang": "python", "repo": "tangb/cleepmod-respeaker2mic", "path": "/backend/seeed2micaudiodriver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: callback (function): function called after installation params (dict): additional parameters Returns: bool: True if install succeed """ #clone git repo self._get_repository() #build and install driver ...
code_fim
hard
{ "lang": "python", "repo": "tangb/cleepmod-respeaker2mic", "path": "/backend/seeed2micaudiodriver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parseDict['alignsCmb'] = parser.getCmbFromList(printerFeatures.aligns) parseDict['charStylesCmb'] = parser.getCmbFromList(printerFeatures.charStyles) parseDict['cutsCmb'] = parser.getCmbFromList(printerFeatures.cuts) return parseDict<|fim_prefix|># repo: chaosdorf/labello path: /templa...
code_fim
hard
{ "lang": "python", "repo": "chaosdorf/labello", "path": "/templates/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parseDict['charStylesCmb'] = parser.getCmbFromList(printerFeatures.charStyles) parseDict['cutsCmb'] = parser.getCmbFromList(printerFeatures.cuts) return parseDict<|fim_prefix|># repo: chaosdorf/labello path: /templates/base.py from libs import parser, printerFeatures def getParseDict(): ...
code_fim
hard
{ "lang": "python", "repo": "chaosdorf/labello", "path": "/templates/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaosdorf/labello path: /templates/base.py from libs import parser, printerFeatures def getParseDict(): parseDict = {} parseDict['sizesCmb'] = '<optgroup label="Outline Sizes">' parseDict['sizesCmb'] += parser.getCmbFromList(printerFeatures.sizesOutline) parseDict['sizesCmb'] +...
code_fim
hard
{ "lang": "python", "repo": "chaosdorf/labello", "path": "/templates/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @register.simple_tag(takes_context=True) def or_meta_image_url(context): """If context request is not available use base url""" try: request = context['request'] absolute_url = request.build_absolute_uri(OR_META_IMAGE_URL) except KeyError: absolute_url = BASE_URL + OR_...
code_fim
hard
{ "lang": "python", "repo": "Our-Revolution/site", "path": "/pages/templatetags/pages_tags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Our-Revolution/site path: /pages/templatetags/pages_tags.py from django import template from django.conf import settings from pages.models import AlertLevels, NotificationBanner, SplashModal register = template.Library() BASE_URL = settings.BASE_URL GOOGLE_MAPS_PUBLIC_KEY = settings.GOOGLE_MAPS...
code_fim
hard
{ "lang": "python", "repo": "Our-Revolution/site", "path": "/pages/templatetags/pages_tags.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return BASE_URL @register.simple_tag def candidates_url(): return settings.CANDIDATES_URL @register.simple_tag def endorsement_process_url(): return settings.ENDORSEMENT_PROCESS_URL @register.simple_tag def get_alert_level_class(value): """Pass in alert level value and get back appro...
code_fim
hard
{ "lang": "python", "repo": "Our-Revolution/site", "path": "/pages/templatetags/pages_tags.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lizzij/LCProj path: /sat/code/util.py import argparse import logging import os import pdb import random from collections import namedtuple, defaultdict from os.path import join import numpy as np import scipy.sparse as sparse import torch import yaml logger = logging.getLogger(__name__) DataSa...
code_fim
hard
{ "lang": "python", "repo": "lizzij/LCProj", "path": "/sat/code/util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> log_file = join(config['dir'], 'train.log') logging.basicConfig( handlers=[logging.FileHandler(log_file, mode='w'), logging.StreamHandler()], format='%(asctime)s %(levelname)s %(message)s', datefmt='%H:%M:%S', ) logger.setLevel(getattr(logging, config['log_level'].u...
code_fim
hard
{ "lang": "python", "repo": "lizzij/LCProj", "path": "/sat/code/util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daman2412/iosfu path: /iosfu/backup.py from __future__ import with_statement from os import listdir from os.path import join as join_paths, basename, isdir, isfile from plistlib import readPlist from biplist import readPlist as readBinaryPlist from .conf import BACKUPS_PATH, BACKUP_DEFAULT_SET...
code_fim
hard
{ "lang": "python", "repo": "daman2412/iosfu", "path": "/iosfu/backup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, path): self.path = path self.get_info() self._data_file = self.get_data_file() self.init_check() self.read_data_file() @property def name(self): name = self.data('name') or self.id return name def get_data_file(se...
code_fim
hard
{ "lang": "python", "repo": "daman2412/iosfu", "path": "/iosfu/backup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def parse_response_content(self, response_content): response = super(AlipayOpenRequestBatchSendResponse, self).parse_response_content(response_content) if 'response_body' in response: self.response_body = response['response_body']<|fim_prefix|># repo: alipay/alipay-sdk-pyth...
code_fim
medium
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/response/AlipayOpenRequestBatchSendResponse.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @response_body.setter def response_body(self, value): self._response_body = value def parse_response_content(self, response_content): response = super(AlipayOpenRequestBatchSendResponse, self).parse_response_content(response_content) if 'response_body' in response: ...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/response/AlipayOpenRequestBatchSendResponse.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/response/AlipayOpenRequestBatchSendResponse.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse class AlipayOpenRequestBatchSendResponse(AlipayResponse): def __ini...
code_fim
medium
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/response/AlipayOpenRequestBatchSendResponse.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cmattey/leetcode_problems path: /Python/lc_122_best_time_buy_sell_stock_ii.py # Time: O(n), where n = len(prices) # Space: O(1) # April 5th # Time: O(n) # Space: O(1) class Solution: def maxProfit(self, prices: List[int]) -> int: nums = prices profit = 0 start, e...
code_fim
hard
{ "lang": "python", "repo": "cmattey/leetcode_problems", "path": "/Python/lc_122_best_time_buy_sell_stock_ii.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if prices[index]>min_price: while index<len(prices) and prices[index]>prices[index-1]: index+=1 profit+=(prices[index-1]-min_price) if index<len(prices): min_price = prices[index] index+=1 re...
code_fim
hard
{ "lang": "python", "repo": "cmattey/leetcode_problems", "path": "/Python/lc_122_best_time_buy_sell_stock_ii.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, ctx: RiotGamesApiContext, session: Optional[Session] = None ): self._ctx = ctx self._session = session or Session() def _request( self, path: str, platform: Optional[str] = None, params: ...
code_fim
hard
{ "lang": "python", "repo": "esbraff/riot_games_api", "path": "/src/riot_games_api/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _request( self, path: str, platform: Optional[str] = None, params: Optional[Dict[str, Any]] = None ): try: headers = { "X-Riot-Token": self._ctx.token } base_url = self._ctx.get_base_url...
code_fim
hard
{ "lang": "python", "repo": "esbraff/riot_games_api", "path": "/src/riot_games_api/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: esbraff/riot_games_api path: /src/riot_games_api/base.py from requests import Session, RequestException from typing import Optional, Any, Dict from urllib.parse import urljoin from .exceptions import RiotGamesApiException from .context import RiotGamesApiContext <|fim_suffix|> retur...
code_fim
hard
{ "lang": "python", "repo": "esbraff/riot_games_api", "path": "/src/riot_games_api/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='estudios', name='user', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='estudios', to=settings.AUTH_USER_MODEL), ), ]<|fim_prefix|># repo: JVacca12/FIRST path: ...
code_fim
medium
{ "lang": "python", "repo": "JVacca12/FIRST", "path": "/estudios/migrations/0003_alter_estudios_user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('estudios', '0002_alter_estudios_fecha_fin'), ] operations = [ migrations.AlterField( model_name='estudios', name='user', field=models.ForeignKey(on_delete...
code_fim
medium
{ "lang": "python", "repo": "JVacca12/FIRST", "path": "/estudios/migrations/0003_alter_estudios_user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JVacca12/FIRST path: /estudios/migrations/0003_alter_estudios_user.py # Generated by Django 3.2.7 on 2021-09-30 04:08 from django.conf import settings from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> dependencies = [ migrations.swappable_depen...
code_fim
medium
{ "lang": "python", "repo": "JVacca12/FIRST", "path": "/estudios/migrations/0003_alter_estudios_user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> out_sim_score (boolean): flag to indicate whether similarity score should be included in the output table (defaults to True). Setting this flag to True will add a column named '_sim_score' in the output table. This column will contain the similari...
code_fim
hard
{ "lang": "python", "repo": "anhaidgroup/py_stringsimjoin", "path": "/py_stringsimjoin/join/overlap_join.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: anhaidgroup/py_stringsimjoin path: /py_stringsimjoin/join/overlap_join.py def overlap_join(ltable, rtable, l_key_attr, r_key_attr, l_join_attr, r_join_attr, tokenizer, threshold, comp_op='>=', allow_missing=False, ...
code_fim
hard
{ "lang": "python", "repo": "anhaidgroup/py_stringsimjoin", "path": "/py_stringsimjoin/join/overlap_join.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rsagroup/rsatoolbox path: /src/rsatoolbox/inference/result.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Result object definition """ import numpy as np import scipy.stats import rsatoolbox.model from rsatoolbox.io.hdf5 import read_dict_hdf5, write_dict_hdf5 from rsatoolbox.io.pkl import...
code_fim
hard
{ "lang": "python", "repo": "rsagroup/rsatoolbox", "path": "/src/rsatoolbox/inference/result.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_ci(self, ci_percent, test_type='t-test'): """ returns confidence intervals for the evaluations""" prop_cut = (1 - ci_percent) / 2 if test_type == 'bootstrap': perf = self.evaluations while len(perf.shape) > 2: perf = np.nanmean(pe...
code_fim
hard
{ "lang": "python", "repo": "rsagroup/rsatoolbox", "path": "/src/rsatoolbox/inference/result.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ returns confidence intervals for the evaluations""" prop_cut = (1 - ci_percent) / 2 if test_type == 'bootstrap': perf = self.evaluations while len(perf.shape) > 2: perf = np.nanmean(perf, axis=-1) framed_evals = np.concatenate...
code_fim
hard
{ "lang": "python", "repo": "rsagroup/rsatoolbox", "path": "/src/rsatoolbox/inference/result.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: satyampandeygit/ds-algo-solutions path: /Algorithms/Implementation/Beautiful Days at the Movies/solution.py #!/bin/python3 import math import os import random import re import sys # Complete the beautifulDays function below. def beautifulDays(i, j, k): <|fim_suffix|> ijk = input().split() ...
code_fim
hard
{ "lang": "python", "repo": "satyampandeygit/ds-algo-solutions", "path": "/Algorithms/Implementation/Beautiful Days at the Movies/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result = beautifulDays(i, j, k) fptr.write(str(result) + '\n') fptr.close()<|fim_prefix|># repo: satyampandeygit/ds-algo-solutions path: /Algorithms/Implementation/Beautiful Days at the Movies/solution.py #!/bin/python3 import math import os import random import re import sys # Complete t...
code_fim
hard
{ "lang": "python", "repo": "satyampandeygit/ds-algo-solutions", "path": "/Algorithms/Implementation/Beautiful Days at the Movies/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Removendo tags XML de %s" % caminho) text = re.sub('<[^<]+>', "", open(caminho, mode='r', encoding='utf8').read()) with open(caminho, "w", encoding='utf8') as f: f.write(text) print("Tags XML removidas de %s" % caminho) remover_tags_xml(caminho_arquivo)<|fim_prefix|># ...
code_fim
easy
{ "lang": "python", "repo": "pvcastro/1-billion-word-language-modeling-benchmark", "path": "/scripts/strip_xml.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pvcastro/1-billion-word-language-modeling-benchmark path: /scripts/strip_xml.py import re, sys if len(sys.argv) == 2: caminho_arquivo = sys.argv[1] print(sys.argv) else: print("Usage: python strip_xml.py caminho_arquivo") sys.exit() <|fim_suffix|> print("Removendo tags XML de...
code_fim
easy
{ "lang": "python", "repo": "pvcastro/1-billion-word-language-modeling-benchmark", "path": "/scripts/strip_xml.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> args = self.build_args # check essential arguments for arg in JE_BUILD_ARGS: if arg not in args: return ERR_MISSING_ARGUMENT, f'Missing required argument "{arg}".' # check "format" if 'format' not in args or args['format'] is None: ...
code_fim
hard
{ "lang": "python", "repo": "Teahouse-Studios/memepack-builder", "path": "/memepack_builder/JEPackBuilder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __get_mod_content(self, *mod_files) -> dict: mods = {} for file in mod_files: if file.endswith(".json"): mods |= json.load( open(os.path.join(self.mods_path, file), 'r', encoding='utf8')) elif file.endswith(".lang"): ...
code_fim
hard
{ "lang": "python", "repo": "Teahouse-Studios/memepack-builder", "path": "/memepack_builder/JEPackBuilder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Teahouse-Studios/memepack-builder path: /memepack_builder/JEPackBuilder.py __all__ = [ 'PACK_LEGACY_FORMAT', 'PACK_CURRENT_FORMAT', 'JEPackBuilder' ] import json import os from zipfile import ZipFile, ZIP_DEFLATED from memepack_builder._internal.pack_builder import PackBuilder, LICENSE_FILE f...
code_fim
hard
{ "lang": "python", "repo": "Teahouse-Studios/memepack-builder", "path": "/memepack_builder/JEPackBuilder.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pilliq/balance path: /balance/repay_book.py # AMDG import logging from balance_book import BalanceBook from itertools import islice class RepayBook(object): """ RepayBook keeps track of entries that have been and need to be repaid to other people. It keeps these two types of entrie...
code_fim
hard
{ "lang": "python", "repo": "pilliq/balance", "path": "/balance/repay_book.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _split_entries(self): repay = [] repaid = [] for e in self._raw_entries: if e.category == 'repay': repaid.append(e) else: repay.append(e) return BalanceBook(repay), BalanceBook(repaid) def _parse_eid(sel...
code_fim
hard
{ "lang": "python", "repo": "pilliq/balance", "path": "/balance/repay_book.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _positize_repay(self): """ Make amounts in self.repay positive """ for e in self._repay.entries: e.amount = abs(e.amount) @property def entries(self): return self._repay.entries + self._repaid.entries @property def repay(self): ...
code_fim
hard
{ "lang": "python", "repo": "pilliq/balance", "path": "/balance/repay_book.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if os.path.isfile(FLAT_FILE_W): pkl_file = open(FLAT_FILE_W, 'rb') wflat = pk.load(pkl_file) pkl_file.close() else: fdark = Data1d() wflat = Data1d() fdark.load_dark_from_2D(["Feb09-dark-00.300s_WAXS", "Feb09-dark-01.300s_WAXS", ...
code_fim
hard
{ "lang": "python", "repo": "NSLS-II-LIX/pyXS", "path": "/examples/Example.Sol/exp_setup.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: NSLS-II-LIX/pyXS path: /examples/Example.Sol/exp_setup.py import os try: import cPickle as pk except ImportError: import pickle as pk from pyxs.DetectorConfig import DetectorConfig from pyxs.ext.RQconv import * from pyxs.slnXS import * es = ExpPara() es.wavelength = 0.874 es.bm_ctr_x =...
code_fim
hard
{ "lang": "python", "repo": "NSLS-II-LIX/pyXS", "path": "/examples/Example.Sol/exp_setup.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: darkmatter2222/pathfidner-ML path: /bots/race_to_the_hot_fog_of_war/execute_trained_model.py import tensorflow as tf from tf_agents.agents.dqn import dqn_agent from tf_agents.environments import tf_py_environment from tf_agents.networks import q_network from tf_agents.policies import random_tf_po...
code_fim
hard
{ "lang": "python", "repo": "darkmatter2222/pathfidner-ML", "path": "/bots/race_to_the_hot_fog_of_war/execute_trained_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while not time_step.is_last(): action_step = policy.action(time_step) time_step = environment.step(action_step.action) episode_return += time_step.reward total_return += episode_return history = environment._env.envs[0].score_history fina...
code_fim
hard
{ "lang": "python", "repo": "darkmatter2222/pathfidner-ML", "path": "/bots/race_to_the_hot_fog_of_war/execute_trained_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _eval_py_env = race_to_the_hot(window_name='Testing') _eval_env = tf_py_environment.TFPyEnvironment(_eval_py_env) saved_policy = tf.compat.v2.saved_model.load(_save_policy_dir) avg_return, score = compute_avg_return(_eval_env, saved_policy) print('Average Return = {0:.2f}, score {1}'.format(avg_return,...
code_fim
hard
{ "lang": "python", "repo": "darkmatter2222/pathfidner-ML", "path": "/bots/race_to_the_hot_fog_of_war/execute_trained_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yinruiqing/corpus2graph path: /corpus2graph/applications/networkx_wrapper_test.py import unittest from corpus2graph.applications import wordpair_generator, networkx_wrapper, graph_generator from corpus2graph import FileParser, WordPreprocessor, Tokenizer, WordProcessing, \ SentenceProcessing,...
code_fim
hard
{ "lang": "python", "repo": "yinruiqing/corpus2graph", "path": "/corpus2graph/applications/networkx_wrapper_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> igt = networkx_wrapper.IGraphWrapper('Test') gg = graph_generator.GraphGenerator(window_size=3, file_parser=self.data_type, xml_node_path=None, word_tokenizer='', wtokenizer=Tokenizer.mytok, remove_numb...
code_fim
hard
{ "lang": "python", "repo": "yinruiqing/corpus2graph", "path": "/corpus2graph/applications/networkx_wrapper_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>except KeyboardInterrupt: scrollphathd.fill(0) scrollphathd.show()<|fim_prefix|># repo: pimoroni/scroll-phat-hd path: /examples/tests/scroll-test.py #!/usr/bin/env python import time <|fim_middle|>import scrollphathd scrollphathd.pixel(0, 0, 0.5) try: while True: scrollphathd.scro...
code_fim
medium
{ "lang": "python", "repo": "pimoroni/scroll-phat-hd", "path": "/examples/tests/scroll-test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pimoroni/scroll-phat-hd path: /examples/tests/scroll-test.py #!/usr/bin/env python import time <|fim_suffix|>scrollphathd.pixel(0, 0, 0.5) try: while True: scrollphathd.scroll(1, 1) scrollphathd.show() time.sleep(0.1) except KeyboardInterrupt: scrollphathd.fill...
code_fim
easy
{ "lang": "python", "repo": "pimoroni/scroll-phat-hd", "path": "/examples/tests/scroll-test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> elif args.operator == "f_mult": print "...using fortran mult..." res = f_mult(args.a, args.b) elif args.operator == "c_div": print "...using c++ div..." res = c_div(args.a, args.b) else: raise ValueError("that's wrong") print "result" print re...
code_fim
hard
{ "lang": "python", "repo": "csyhuang/python-fortran-cpp-template", "path": "/scripts/myscript.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: csyhuang/python-fortran-cpp-template path: /scripts/myscript.py #!/usr/bin/env python2.7 """Template script """ import os, sys from mypackage import py_add, f_mult, c_div, __version__ if __name__ == '__main__': import argparse parser = argparse.ArgumentParser(__doc__) parser.add_arg...
code_fim
medium
{ "lang": "python", "repo": "csyhuang/python-fortran-cpp-template", "path": "/scripts/myscript.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kongyew/gpdb path: /src/test/tinc/tincrepo/mpp/gpdb/tests/storage/fts/fts_transitions/test_fts_transitions_03.py """ Copyright (c) 2004-Present Pivotal Software, Inc. This program and the accompanying materials are made available under the terms of the under the Apache License, Version 2.0 (the ...
code_fim
hard
{ "lang": "python", "repo": "kongyew/gpdb", "path": "/src/test/tinc/tincrepo/mpp/gpdb/tests/storage/fts/fts_transitions/test_fts_transitions_03.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tinctest.logger.info("\n ===============================================") tinctest.logger.info("\n Starting New Test: test_mirror_resync_postmaster_reset_with_faults ") tinctest.logger.info("\n ===============================================") self.mirror_resync_postmaster...
code_fim
hard
{ "lang": "python", "repo": "kongyew/gpdb", "path": "/src/test/tinc/tincrepo/mpp/gpdb/tests/storage/fts/fts_transitions/test_fts_transitions_03.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> * The first batch of changed blocks obtained by resync worker from CT log for this relation contains only lower (according to block number) blocks. The higher block with lower LSN is not included in this batch. Another query must be run against CT log...
code_fim
hard
{ "lang": "python", "repo": "kongyew/gpdb", "path": "/src/test/tinc/tincrepo/mpp/gpdb/tests/storage/fts/fts_transitions/test_fts_transitions_03.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(np.asarray(reward).shape) == 1: length = len(reward) reward = [reward] else: length = len(reward[0]) self.assertAllClose( np.squeeze(discount_py(reward, gamma=gamma)), expected) self.assertAllClose( t(array_ops.squeeze(core_ops.dis...
code_fim
hard
{ "lang": "python", "repo": "wenkesj/alchemy", "path": "/alchemy/contrib/rl/core_ops_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_discount(self): t = self.evaluate def test_discount_(reward, gamma, expected): if len(np.asarray(reward).shape) == 1: length = len(reward) reward = [reward] else: length = len(reward[0]) self.assertAllClose( np.squeeze(discount_py(re...
code_fim
hard
{ "lang": "python", "repo": "wenkesj/alchemy", "path": "/alchemy/contrib/rl/core_ops_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wenkesj/alchemy path: /alchemy/contrib/rl/core_ops_test.py # -*- coding: utf-8 -*- from __future__ import absolute_import import numpy as np from tensorflow.python.framework import dtypes from tensorflow.python.platform import test from tensorflow.python.ops import array_ops from alchemy.contr...
code_fim
hard
{ "lang": "python", "repo": "wenkesj/alchemy", "path": "/alchemy/contrib/rl/core_ops_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 18F/tock path: /tock/projects/migrations/0028_auto_20210831_1620.py # Generated by Django 2.2.24 on 2021-08-31 20:20 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterField( model_name='project', name='is_weekly_bill', ...
code_fim
medium
{ "lang": "python", "repo": "18F/tock", "path": "/tock/projects/migrations/0028_auto_20210831_1620.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('projects', '0027_project_is_weekly_bill'), ] operations = [ migrations.AlterField( model_name='project', name='is_weekly_bill', field=models.BooleanField(default=False, help_text='Is this project under weekly billing. Note...
code_fim
medium
{ "lang": "python", "repo": "18F/tock", "path": "/tock/projects/migrations/0028_auto_20210831_1620.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: anujchavan112/Pipeline_in_machine_learning path: /pipeline_in_machine_learning.py #!/usr/bin/env python # coding: utf-8 # In[26]: import pandas as pd import numpy as np import matplotlib.pyplot as plt data = pd.read_csv(r'C:\Users\Anuj\Downloads\Project happiness\Project happiness\2019.csv'...
code_fim
hard
{ "lang": "python", "repo": "anujchavan112/Pipeline_in_machine_learning", "path": "/pipeline_in_machine_learning.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pipe_dict={0:"Random Forest regression",1:"Linear Regression",2:"Decesion Tree Regressor "} # In[146]: for pipe in pipelines: pipe.fit(X_train,y_train) # In[147]: for i,model in enumerate(pipelines): print("{} Test acuuracy:{}".format(pipe_dict[i],model.score(X_test,y_test))) # In[148]:...
code_fim
hard
{ "lang": "python", "repo": "anujchavan112/Pipeline_in_machine_learning", "path": "/pipeline_in_machine_learning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for pipe in pipelines: pipe.fit(X_train,y_train) # In[147]: for i,model in enumerate(pipelines): print("{} Test acuuracy:{}".format(pipe_dict[i],model.score(X_test,y_test))) # In[148]: model_pipeline_rfgr.predict(X_test) # In[149]: model_pipeline_drgr.predict(X_test) # In[150]: mod...
code_fim
hard
{ "lang": "python", "repo": "anujchavan112/Pipeline_in_machine_learning", "path": "/pipeline_in_machine_learning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sohonetlabs/dvbcss-synctiming path: /src/dispersion.py #!/usr/bin/env python # # Copyright 2015 British Broadcasting Corporation # # 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 L...
code_fim
hard
{ "lang": "python", "repo": "sohonetlabs/dvbcss-synctiming", "path": "/src/dispersion.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def clear(self): """\ Clear the recorded history. """ self.changeHistory = [] def start(self): """\ Start recording changes in dispersion. If already recording, then this method call does nothing. """ ...
code_fim
hard
{ "lang": "python", "repo": "sohonetlabs/dvbcss-synctiming", "path": "/src/dispersion.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agrawalprash/enaml path: /enaml/backends/qt/noncomponents/qt_icon.py #------------------------------------------------------------------------------ # Copyright (c) 2012, Enthought, Inc. # All rights reserved. #------------------------------------------------------------------------------ from ...
code_fim
hard
{ "lang": "python", "repo": "agrawalprash/enaml", "path": "/enaml/backends/qt/noncomponents/qt_icon.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> The returned size may be smaller but will never be larger. Parameters ---------- size : (width, height) The size of the requested image. The returned image may be smaller, but will never be larger than this size. mode : string, ...
code_fim
hard
{ "lang": "python", "repo": "agrawalprash/enaml", "path": "/enaml/backends/qt/noncomponents/qt_icon.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> state : string, optional The state of the image. The default is 'on'. """ if not isinstance(image, QtImage): msg = 'Image must be an instance of QtImage. Got %s instead.' raise TypeError(msg % type(image)) qpixmap = image.as_QPix...
code_fim
hard
{ "lang": "python", "repo": "agrawalprash/enaml", "path": "/enaml/backends/qt/noncomponents/qt_icon.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Evaluate log probabilities for given inputs. :param xy: (x, y) pair of numpy arrays, rows are datapoints :param log: whether to return probabilities in the log domain :return: list of log probabilities log p(y|x) """ # compile theano function, i...
code_fim
hard
{ "lang": "python", "repo": "gpapamak/maf", "path": "/ml/models/nvps.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gpapamak/maf path: /ml/models/nvps.py import numpy as np import numpy.random as rng import theano import theano.tensor as tt import ml.models.neural_nets as nn from ml.models.layers import BatchNorm import util dtype = theano.config.floatX class CouplingLayer: """ Coupling layer for R...
code_fim
hard
{ "lang": "python", "repo": "gpapamak/maf", "path": "/ml/models/nvps.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> lprob = self.eval_lprob_f(x.astype(dtype)) return lprob if log else np.exp(lprob) def gen(self, n_samples=1, u=None): """ Generate samples. :param n_samples: number of samples :param u: random numbers to use in generating samples; if None, new random n...
code_fim
hard
{ "lang": "python", "repo": "gpapamak/maf", "path": "/ml/models/nvps.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pass with pytest.raises(ValueError): MockPlugin()<|fim_prefix|># repo: magnologan/detect-secrets path: /tests/plugins/base_test.py from __future__ import absolute_import import pytest from detect_secrets.plugins.base import BasePlugin def test_fails_if_no_secret_type_defined(...
code_fim
medium
{ "lang": "python", "repo": "magnologan/detect-secrets", "path": "/tests/plugins/base_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: magnologan/detect-secrets path: /tests/plugins/base_test.py from __future__ import absolute_import import pytest from detect_secrets.plugins.base import BasePlugin <|fim_suffix|> class MockPlugin(BasePlugin): # pragma: no cover def analyze_string_content(self, *args, **kwargs): ...
code_fim
easy
{ "lang": "python", "repo": "magnologan/detect-secrets", "path": "/tests/plugins/base_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while True: sock, addr = s.accept() t = threading.Thread(target = server, args = (sock, addr)) t.start()<|fim_prefix|># repo: Sherlock-Holo/Python-3.5-learning path: /tcp/server.py import socket import threading def server(sock, addr): print('connection from %s:%s' %addr)...
code_fim
medium
{ "lang": "python", "repo": "Sherlock-Holo/Python-3.5-learning", "path": "/tcp/server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.bind(('127.0.0.1', 8080)) s.listen(5) while True: sock, addr = s.accept() t = threading.Thread(target = server, args = (sock, addr)) t.start()<|fim_prefix|># repo: Sherlock-Holo/Python-3.5-learning path: /...
code_fim
medium
{ "lang": "python", "repo": "Sherlock-Holo/Python-3.5-learning", "path": "/tcp/server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sherlock-Holo/Python-3.5-learning path: /tcp/server.py import socket import threading def server(sock, addr): print('connection from %s:%s' %addr) buffer = [] while True: d = sock.recv(4096) if not d: break buffer.append(d) data = b''.join(buf...
code_fim
medium
{ "lang": "python", "repo": "Sherlock-Holo/Python-3.5-learning", "path": "/tcp/server.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> paths = extracting.get_paths([self.test_files]) data = extracting.extract_data(paths) for node in data: self.assertEqual(node, [])<|fim_prefix|># repo: xenking/lightdataparser path: /lightdataparser/tests/test_extract.py import unittest from unittest.mock import patch ...
code_fim
hard
{ "lang": "python", "repo": "xenking/lightdataparser", "path": "/lightdataparser/tests/test_extract.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xenking/lightdataparser path: /lightdataparser/tests/test_extract.py import unittest from unittest.mock import patch from lightdataparser import extracting class TestExtractProcess(unittest.TestCase): def setUp(self): with open("filepaths.txt", 'r') as f: self.bad_file...
code_fim
hard
{ "lang": "python", "repo": "xenking/lightdataparser", "path": "/lightdataparser/tests/test_extract.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> empty_path = extracting.get_out_path('') paths = [extracting.get_out_path(file) for file in self.bad_files] folder_path = extracting.get_out_path(self.test_files) @patch('lightdataparser.extracting.parse', return_value=({'A': 1, 'B': 0, 'C': 3, 'D': 2}, [3, 2, 1, 4])) @pat...
code_fim
hard
{ "lang": "python", "repo": "xenking/lightdataparser", "path": "/lightdataparser/tests/test_extract.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import *<|fim_prefix|># repo: muteria/muteria path: /muteria/drivers/testgeneration/testcase_formats/python_unittest/__init__.py from muteria.drivers.testgeneration.te<|fim_middle|>stcase_formats.python_unittest.unittest\
code_fim
hard
{ "lang": "python", "repo": "muteria/muteria", "path": "/muteria/drivers/testgeneration/testcase_formats/python_unittest/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: muteria/muteria path: /muteria/drivers/testgeneration/testcase_formats/python_unittest/__init__.py from muteria.drivers.testgeneration.te<|fim_suffix|>\ import *<|fim_middle|>stcase_formats.python_unittest.unittest
code_fim
easy
{ "lang": "python", "repo": "muteria/muteria", "path": "/muteria/drivers/testgeneration/testcase_formats/python_unittest/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: intel/ThenWhatTree path: /ThenWhatTree/lib/twt_node/node_metrics_data.py # Copyright (C) 2018 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause <|fim_suffix|> # Code starts here class NodeMetricsData(object): pass<|fim_middle|>"""Module description here""" # Import built in modul...
code_fim
hard
{ "lang": "python", "repo": "intel/ThenWhatTree", "path": "/ThenWhatTree/lib/twt_node/node_metrics_data.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Import local modules # Module authorship metadata __author__ = "Erik W Berg" __copyright__ = "Copyright 2018, Intel Corporation" __credits__ = [""] __license__ = "BSD-3-Clause" __version__ = "1.0" __maintainer__ = "Erik W Berg" __email__ = "" __status__ = "Production" # Prototype, Development, Product...
code_fim
medium
{ "lang": "python", "repo": "intel/ThenWhatTree", "path": "/ThenWhatTree/lib/twt_node/node_metrics_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tern-tools/tern path: /tern/formats/spdx/spdxjson/consumer.py # -*- coding: utf-8 -*- # # Copyright (c) 2021 VMware, Inc. All Rights Reserved. # SPDX-License-Identifier: BSD-2-Clause """ SPDXJSON document consumer """ import json import logging import os from tern.classes.image_layer import Im...
code_fim
hard
{ "lang": "python", "repo": "tern-tools/tern", "path": "/tern/formats/spdx/spdxjson/consumer.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Given a list of report files in the SPDX JSON format, created by the spdxjson generator, create a total list of image layer objects. We assume the layers are ordered in the order or report files""" layer_list = [] layer_count = 1 for report in reports: ...
code_fim
hard
{ "lang": "python", "repo": "tern-tools/tern", "path": "/tern/formats/spdx/spdxjson/consumer.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kids-first/kf-api-study-creator path: /creator/studies/migrations/0016_add_phenotype_status.py # Generated by Django 2.1.11 on 2020-05-06 21:18 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterModelOptions...
code_fim
medium
{ "lang": "python", "repo": "kids-first/kf-api-study-creator", "path": "/creator/studies/migrations/0016_add_phenotype_status.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterModelOptions( name='study', options={'permissions': [('view_my_study', 'Can list studies that the user belongs to'), ('add_collaborator', 'Can add a collaborator to the study'), ('remove_collaborator', 'Can remove a collaborator to the stu...
code_fim
medium
{ "lang": "python", "repo": "kids-first/kf-api-study-creator", "path": "/creator/studies/migrations/0016_add_phenotype_status.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> aws_accounts.append( { "AccountId": line_items[0], "AccountName": line_items[1].replace("\n", ""), } ) return aws_accounts def get_accounts(account_id_only=True): if watchmen_vars.UseAWSOrganisations: master_linked_a...
code_fim
hard
{ "lang": "python", "repo": "adrianmkng/watchmen", "path": "/python_lib/get_accounts.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: adrianmkng/watchmen path: /python_lib/get_accounts.py # Copyright 2017 Insurance Australia Group Limited # # 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://w...
code_fim
hard
{ "lang": "python", "repo": "adrianmkng/watchmen", "path": "/python_lib/get_accounts.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: skwang/trafficbehavior path: /common/display.py import cv2, sys from trafficbehavior.common import image_util def draw_lanes(img, lanes, color=(0,255,0), thickness=3): for lane in lanes: [pt1, pt2] = lane pt1 = (int(pt1[0]), int(pt1[1])) pt2 = (int(pt2[0]), int(pt2[1]...
code_fim
hard
{ "lang": "python", "repo": "skwang/trafficbehavior", "path": "/common/display.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> toolbar_width = 40 fname = filenames[curr_index] progress = float(curr_index)/len(filenames) percent_str = "{}%".format(int(progress*100)) # setup toolbar sys.stdout.write("\r{}|{}|{}".format(fname, " "*toolbar_width, percent_str)) sys.stdout.flush() # goes back to right be...
code_fim
hard
{ "lang": "python", "repo": "skwang/trafficbehavior", "path": "/common/display.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }