text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: Semprini/cbe-sport path: /sport/compete/motorsport/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-02-20 05:41 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Mi...
code_fim
hard
{ "lang": "python", "repo": "Semprini/cbe-sport", "path": "/sport/compete/motorsport/migrations/0001_initial.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>, models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='codriver', to='party.Individual')), ('current_lap', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='race_entry_current_lap', to='motorsp...
code_fim
hard
{ "lang": "python", "repo": "Semprini/cbe-sport", "path": "/sport/compete/motorsport/migrations/0001_initial.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GeorgiStavrev/tensorflow-examples path: /m4_image_transpose.py import tensorflow as tf import matplotlib.image as mp_img import matplotlib.pyplot as plot import os filename = './DandelionFlower.jpg' <|fim_suffix|> transpose = tf.transpose(x, perm=[1,0,2]) result = sess.run(transpose) ...
code_fim
hard
{ "lang": "python", "repo": "GeorgiStavrev/tensorflow-examples", "path": "/m4_image_transpose.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with tf.Session() as sess: sess.run(init) transpose = tf.transpose(x, perm=[1,0,2]) result = sess.run(transpose) plot.imshow(result) plot.show()<|fim_prefix|># repo: GeorgiStavrev/tensorflow-examples path: /m4_image_transpose.py import tensorflow as tf import matplotlib.image as mp_...
code_fim
easy
{ "lang": "python", "repo": "GeorgiStavrev/tensorflow-examples", "path": "/m4_image_transpose.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for x in range(m): for y in range(n): if obstacleGrid[x][y] == 1: dp[x][y] = 0 for p in range(1, m): if obstacleGrid[p][0] != 1: dp[p][0] = dp[p-1][0] for q in range(1, n): if obstacleGrid[0][...
code_fim
hard
{ "lang": "python", "repo": "Coalin/Daily-LeetCode-Exercise", "path": "/63_Unique-Paths-II.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for p in range(1, m): if obstacleGrid[p][0] != 1: dp[p][0] = dp[p-1][0] for q in range(1, n): if obstacleGrid[0][q] != 1: dp[0][q] = dp[0][q-1] for i in range(1, m): for j in range(1, n): ...
code_fim
hard
{ "lang": "python", "repo": "Coalin/Daily-LeetCode-Exercise", "path": "/63_Unique-Paths-II.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Coalin/Daily-LeetCode-Exercise path: /63_Unique-Paths-II.py class Solution(object): def uniquePathsWithObstacles(self, obstacleGrid): """ :type obstacleGrid: List[List[int]] :rtype: int """ m = len(obstacleGrid) n = len(obstacleGrid[0]) ...
code_fim
hard
{ "lang": "python", "repo": "Coalin/Daily-LeetCode-Exercise", "path": "/63_Unique-Paths-II.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nickmvincent/SerpScrap path: /scrapcore/parser/parser.py # -*- coding: utf-8 -*- import logging import pprint import re from cssselect import HTMLTranslator import lxml.html from lxml.html.clean import Cleaner logger = logging.getLogger(__name__) class Parser(): """Default Parse""" ...
code_fim
hard
{ "lang": "python", "repo": "nickmvincent/SerpScrap", "path": "/scrapcore/parser/parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # only add items that have not None links. # Avoid duplicates. Detect them by the link. # If statement below: Lazy evaluation. # The more probable case first. found_container = False se...
code_fim
hard
{ "lang": "python", "repo": "nickmvincent/SerpScrap", "path": "/scrapcore/parser/parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>te from .is_not_in import IsNotInAttribute from .not_equals import NotEqualsAttribute<|fim_prefix|># repo: phenobarbital/py-abac path: /py_abac/policy/conditions/attribute/__init__.py """ Attribute conditions """ from .all_in import AllInAttribute from .all_not_i<|fim_middle|>n import AllNotInAttrib...
code_fim
medium
{ "lang": "python", "repo": "phenobarbital/py-abac", "path": "/py_abac/policy/conditions/attribute/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: phenobarbital/py-abac path: /py_abac/policy/conditions/attribute/__init__.py """ Attribute conditions """ from .all_in import AllInAttribute from .all_not_in import AllNotInAttribute from .any_in import AnyInAttribute from .any_not_in import<|fim_suffix|>te from .is_not_in import IsNotInAttr...
code_fim
medium
{ "lang": "python", "repo": "phenobarbital/py-abac", "path": "/py_abac/policy/conditions/attribute/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: avi1mizrahi/AdaptiveBatchingBlockchain path: /requestGenerator.py import http.client import json from time import sleep # payload = "{\n \"amount\": 50\n}" # # # # res = self.conn.getresponse() # data = res.read() # print(data.decode("utf-8")) # # j = json.loads(data) class Client: def...
code_fim
hard
{ "lang": "python", "repo": "avi1mizrahi/AdaptiveBatchingBlockchain", "path": "/requestGenerator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>c1.transfer(acc11, acc12, 70) c2.transfer(acc11, acc12, 70) c2.transfer(acc21, acc12, 70) print("c11 amount = ", c1.getAmount(acc11)) print("c11 amount = ", c2.getAmount(acc11)) print("c12 amount = ", c1.getAmount(acc12)) print("c12 amount = ", c2.getAmount(acc12)) print("c21 amount = ", c1.getAmount(a...
code_fim
hard
{ "lang": "python", "repo": "avi1mizrahi/AdaptiveBatchingBlockchain", "path": "/requestGenerator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danielmuthama/mindmeld path: /mindmeld/components/entity_resolver.py logging.getLogger(__name__) class EntityResolver: """An entity resolver is used to resolve entities in a given query to their canonical values (usually linked to specific entries in a knowledge base). """ # pr...
code_fim
hard
{ "lang": "python", "repo": "danielmuthama/mindmeld", "path": "/mindmeld/components/entity_resolver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _construct_phonetic_match_query(entity, weight=1): return [ { "match": { "cname.double_metaphone": { "query": entity.text, "boost": 2 * weight, ...
code_fim
hard
{ "lang": "python", "repo": "danielmuthama/mindmeld", "path": "/mindmeld/components/entity_resolver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: danielmuthama/mindmeld path: /mindmeld/components/entity_resolver.py docs): for doc in docs: action = {} # id if doc.get("id"): action["_id"] = doc["id"] else: # generate hash fro...
code_fim
hard
{ "lang": "python", "repo": "danielmuthama/mindmeld", "path": "/mindmeld/components/entity_resolver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ErrCode = MibTableColumn((1, 3, 6, 1, 4, 1, 1774, 4, 7, 1, 18), DisplayString().subtype(subtypeSpec=ValueSizeConstraint(1, 65))).setMaxAccess("readonly") if mibBuilder.loadTexts: otxPrev3ErrCode.setStatus('mandatory') otxPrev4Time = MibTableColumn((1, 3, 6, 1, 4, 1, 1774, 4, 7, 1, 19), TimeTicks()).setMax...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/AUDITEC2-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/AUDITEC2-MIB.py ss("readonly") if mibBuilder.loadTexts: ordTime.setStatus('mandatory') ordValue = MibTableColumn((1, 3, 6, 1, 4, 1, 1774, 4, 6, 1, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 2147483647))).setMaxAccess("readonly") if mi...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/AUDITEC2-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/AUDITEC2-MIB.py , 1, 4, 1, 1774, 4, 5, 1, 9), TimeTicks()).setMaxAccess("readonly") if mibBuilder.loadTexts: sceStartTime.setStatus('mandatory') sceAccumulationMeasureDuration = MibTableColumn((1, 3, 6, 1, 4, 1, 1774, 4, 5, 1, 10), Counter32()).setMaxA...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/AUDITEC2-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: linyuxuanlin/Resources_for_Robotics path: /大一下/嵌入式系统设计(二)/资料/python 视觉资源/opencv001.py # -*- coding: utf-8 -*- import cv2 # from matplotlib import pyplot as plt from pylab import * <|fim_suffix|># 载入图像 im = cv2.imread('cat.jpg') # 颜色空间转换 gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) # 显示原始图像...
code_fim
medium
{ "lang": "python", "repo": "linyuxuanlin/Resources_for_Robotics", "path": "/大一下/嵌入式系统设计(二)/资料/python 视觉资源/opencv001.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># 显示原始图像 fig = plt.figure() subplot(121) plt.gray() imshow(im) title(u'彩色图') axis('off') # 显示灰度化图像 plt.subplot(122) plt.gray() imshow(gray) title(u'灰度图') axis('off') show()<|fim_prefix|># repo: linyuxuanlin/Resources_for_Robotics path: /大一下/嵌入式系统设计(二)/资料/python 视觉资源/opencv001.py # -*- coding: utf-8 -*-...
code_fim
hard
{ "lang": "python", "repo": "linyuxuanlin/Resources_for_Robotics", "path": "/大一下/嵌入式系统设计(二)/资料/python 视觉资源/opencv001.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mewzyk/stephen_AI path: /graph_code/stephen_graph_test.py from graph_code.stephen_graph import Graph from graph_code.stephen_dfs import dfs if __name__ == "__main__": main_graph = Graph() vertices = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'] edges = [['a', 'b'], ['a', 'c'], ['b',...
code_fim
medium
{ "lang": "python", "repo": "Mewzyk/stephen_AI", "path": "/graph_code/stephen_graph_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> start = main_graph.graph_dict['i'] end = main_graph.graph_dict['f'] print('\nPrinting Path: ') print(dfs(start, end))<|fim_prefix|># repo: Mewzyk/stephen_AI path: /graph_code/stephen_graph_test.py from graph_code.stephen_graph import Graph from graph_code.stephen_dfs import dfs <|fim_mi...
code_fim
hard
{ "lang": "python", "repo": "Mewzyk/stephen_AI", "path": "/graph_code/stephen_graph_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from yoyo import step __depends__ = {"20210621_01_IRyiT-rename-qa-f1"} steps = [ step( "UPDATE rounds SET url = REPLACE(url, 'fhcxpbltv0', 'obws766r82')", "UPDATE rounds SET url = REPLACE(url, 'obws766r82', 'fhcxpbltv0')", ) ]<|fim_prefix|># repo: vontell/dynabench path: /api/m...
code_fim
easy
{ "lang": "python", "repo": "vontell/dynabench", "path": "/api/migrations/20210630_01_s8Xod-update-model-url-to-authorized-endpoint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vontell/dynabench path: /api/migrations/20210630_01_s8Xod-update-model-url-to-authorized-endpoint.py # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. <|fim_suffix|>steps ...
code_fim
medium
{ "lang": "python", "repo": "vontell/dynabench", "path": "/api/migrations/20210630_01_s8Xod-update-model-url-to-authorized-endpoint.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>__depends__ = {"20210621_01_IRyiT-rename-qa-f1"} steps = [ step( "UPDATE rounds SET url = REPLACE(url, 'fhcxpbltv0', 'obws766r82')", "UPDATE rounds SET url = REPLACE(url, 'obws766r82', 'fhcxpbltv0')", ) ]<|fim_prefix|># repo: vontell/dynabench path: /api/migrations/20210630_01_s8...
code_fim
easy
{ "lang": "python", "repo": "vontell/dynabench", "path": "/api/migrations/20210630_01_s8Xod-update-model-url-to-authorized-endpoint.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: winsphinx/Kindle path: /kindle.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ This is a ... """ from __future__ import unicode_literals import codecs import os import re import shutil import sys import tkinter as T def get_path(): """ get Kindle path """ if sys.platform == "win3...
code_fim
hard
{ "lang": "python", "repo": "winsphinx/Kindle", "path": "/kindle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def show_clip(path): """ Show clipper """ try: f = codecs.open((os.path.join(path, "My Clippings.txt")), "r", "utf-8") t = f.readlines() f.close() except IOError: return "No Clipper File Found!" else: return format_text(t) def format_text(text): ...
code_fim
hard
{ "lang": "python", "repo": "winsphinx/Kindle", "path": "/kindle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.btn1 = T.Button(self.frm2, width=15, text="Clean") self.btn1.grid(row=0, column=0, padx=20, pady=10) self.btn1.config(command=self.cleanup) self.btn2 = T.Button(self.frm2, width=15, text="Clipper") self.btn2.grid(row=0, column=1, padx=20, pady=10) self...
code_fim
hard
{ "lang": "python", "repo": "winsphinx/Kindle", "path": "/kindle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nge(1, n + 1): for j in range(1, k + 1): dp[j] += dp[j - 1] for j in range(k, -1, -1): if j - (i - 1) > 0: dp[j] -= dp[j - (i - 1) - 1] mod = 1000000007 return dp[-1] % mod<|fim_prefix|># repo: wyaadarsh/LeetCode-S...
code_fim
hard
{ "lang": "python", "repo": "wyaadarsh/LeetCode-Solutions", "path": "/Python3/0629-K-Inverse-Pairs-Array/soln.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/0629-K-Inverse-Pairs-Array/soln.py class Solution: def kInversePairs(self, n: int, k: int) -> int: # 1 to n # exact k inverse # f(n, k) = f(n - 1, j) i in [max(k - (n - 1), 0), k] # f(0, k) = 0 # f(n, 0) = 1 ...
code_fim
hard
{ "lang": "python", "repo": "wyaadarsh/LeetCode-Solutions", "path": "/Python3/0629-K-Inverse-Pairs-Array/soln.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if j - (i - 1) > 0: dp[j] -= dp[j - (i - 1) - 1] mod = 1000000007 return dp[-1] % mod<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/0629-K-Inverse-Pairs-Array/soln.py class Solution: def kInversePairs(self, n: int, k: int) -> int: ...
code_fim
hard
{ "lang": "python", "repo": "wyaadarsh/LeetCode-Solutions", "path": "/Python3/0629-K-Inverse-Pairs-Array/soln.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: suomichain/suomi-core path: /trx_libs/settings/suomi_settings/processor/handler.py # Copyright 2017 Suomi 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 License at # ...
code_fim
hard
{ "lang": "python", "repo": "suomichain/suomi-core", "path": "/trx_libs/settings/suomi_settings/processor/handler.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: entries_list = context.get_state([address], timeout=STATE_TIMEOUT_SEC) except FutureTimeoutError: LOGGER.warning('Timeout occured on context.get_state([%s])', address) raise InternalError('Unable to get {}'.format(address)) if entries_list: setting.ParseFr...
code_fim
hard
{ "lang": "python", "repo": "suomichain/suomi-core", "path": "/trx_libs/settings/suomi_settings/processor/handler.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: choonho/python-core path: /src/spaceone/core/logger/filters/exclude.py # -*- coding: utf-8 -*- import logging class ExcludeFilter(logging.Filter): def __init__(self, rules): <|fim_suffix|> def filter(self, record): for _rule in self.rules: if getattr(record, _rule, No...
code_fim
easy
{ "lang": "python", "repo": "choonho/python-core", "path": "/src/spaceone/core/logger/filters/exclude.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.rules = rules def filter(self, record): for _rule in self.rules: if getattr(record, _rule, None) in self.rules[_rule]: return False return True<|fim_prefix|># repo: choonho/python-core path: /src/spaceone/core/logger/filters/exclude.py # -*- ...
code_fim
easy
{ "lang": "python", "repo": "choonho/python-core", "path": "/src/spaceone/core/logger/filters/exclude.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, rules): self.rules = rules def filter(self, record): for _rule in self.rules: if getattr(record, _rule, None) in self.rules[_rule]: return False return True<|fim_prefix|># repo: choonho/python-core path: /src/spaceone/core/l...
code_fim
easy
{ "lang": "python", "repo": "choonho/python-core", "path": "/src/spaceone/core/logger/filters/exclude.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Update the new site updated_site_config = copy.deepcopy(new_site_config) updated_site_config["store_backend"]["base_directory"] = "/my_updated_site/" ephemeral_context_with_defaults.update_data_docs_site( new_site_name, updated_site_config ) ...
code_fim
hard
{ "lang": "python", "repo": "great-expectations/great_expectations", "path": "/tests/data_context/abstract_data_context/test_data_docs_config_crud.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: great-expectations/great_expectations path: /tests/data_context/abstract_data_context/test_data_docs_config_crud.py import copy from unittest import mock import pytest import great_expectations.exceptions as gx_exceptions from great_expectations.data_context import EphemeralDataContext @pytes...
code_fim
hard
{ "lang": "python", "repo": "great-expectations/great_expectations", "path": "/tests/data_context/abstract_data_context/test_data_docs_config_crud.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.unit def test_delete_data_docs_site_persists( self, ephemeral_context_with_defaults: EphemeralDataContext ): # Check fixture configuration existing_site_name = "local_site" assert existing_site_name in ephemeral_context_with_defaults.get_site_names(...
code_fim
hard
{ "lang": "python", "repo": "great-expectations/great_expectations", "path": "/tests/data_context/abstract_data_context/test_data_docs_config_crud.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tfqKR/prevision-quantum path: /examples/iris/load_iris.py import numpy as np import pandas as pd from sklearn import datasets <|fim_suffix|>if __name__ == "__main__": application_params = "iris_params.json" model_weights = "iris_weights_10.npz" preprocessor_file = "iris_preprocessor...
code_fim
medium
{ "lang": "python", "repo": "tfqKR/prevision-quantum", "path": "/examples/iris/load_iris.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": application_params = "iris_params.json" model_weights = "iris_weights_10.npz" preprocessor_file = "iris_preprocessor.obj" application = qnn.load_application(application_params, model_weights=model_weights, ...
code_fim
medium
{ "lang": "python", "repo": "tfqKR/prevision-quantum", "path": "/examples/iris/load_iris.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nadirhamid/django-oscar-wagtail path: /tests/project/apps/catalogue/migrations/0010_oscar_wagtail.py # -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2016-08-03 07:38 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import wa...
code_fim
hard
{ "lang": "python", "repo": "nadirhamid/django-oscar-wagtail", "path": "/tests/project/apps/catalogue/migrations/0010_oscar_wagtail.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('wagtailcore', '0028_merge'), ('catalogue', '0009_slugfield_noop'), ] operations = [ migrations.AlterModelOptions( name='category', options={}, ), migrations.RemoveField( model_name='category', ...
code_fim
hard
{ "lang": "python", "repo": "nadirhamid/django-oscar-wagtail", "path": "/tests/project/apps/catalogue/migrations/0010_oscar_wagtail.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Message = Message WantList = Message.Wantlist WantType = Message.Wantlist.WantType BlockPresenceType = Message.BlockPresenceType<|fim_prefix|># repo: VladislavSufyanov/py-bitswap path: /bitswap/message/proto_buff.py from .pb.message_pb2 import Message <|fim_middle|>class ProtoBuff:
code_fim
easy
{ "lang": "python", "repo": "VladislavSufyanov/py-bitswap", "path": "/bitswap/message/proto_buff.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VladislavSufyanov/py-bitswap path: /bitswap/message/proto_buff.py from .pb.message_pb2 import Message <|fim_suffix|> Message = Message WantList = Message.Wantlist WantType = Message.Wantlist.WantType BlockPresenceType = Message.BlockPresenceType<|fim_middle|>class ProtoBuff:
code_fim
easy
{ "lang": "python", "repo": "VladislavSufyanov/py-bitswap", "path": "/bitswap/message/proto_buff.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return tf.nn.max_pool(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding="SAME") def max_pool_3x1_2_v(x): return tf.nn.max_pool(x, ksize=[1, 3, 1, 1], strides=[1, 2, 1, 1], padding="VALID") def avg_pool_2x2(x): return tf.nn.avg_pool(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding="SAM...
code_fim
medium
{ "lang": "python", "repo": "fakeface-mmc/fakeface-mmc", "path": "/shared/train/SYN/model/Networks_Functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def max_pool_3x1_2_v(x): return tf.nn.max_pool(x, ksize=[1, 3, 1, 1], strides=[1, 2, 1, 1], padding="VALID") def avg_pool_2x2(x): return tf.nn.avg_pool(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding="SAME") def FC(x,W): return tf.matmul(x,W) def ReLU(x): return tf.nn.relu(x)<|fim_...
code_fim
hard
{ "lang": "python", "repo": "fakeface-mmc/fakeface-mmc", "path": "/shared/train/SYN/model/Networks_Functions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fakeface-mmc/fakeface-mmc path: /shared/train/SYN/model/Networks_Functions.py import tensorflow as tf import numpy as np import math #caclulate DCT basis def cal_scale(p,q): if p==0: ap = 1/(math.sqrt(8)) else: ap = math.sqrt(0.25) if q==0: aq = 1/(math.sqrt(8...
code_fim
hard
{ "lang": "python", "repo": "fakeface-mmc/fakeface-mmc", "path": "/shared/train/SYN/model/Networks_Functions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mmr12/DeepBlueSea path: /models/utils_model.py import tensorflow as tf import numpy as np def create_weights(shape): return tf.Variable(tf.truncated_normal(shape, stddev=0.05)) def create_biases(size): return tf.Variable(tf.constant(0.05, shape=[size])) def create_convolutional_layer...
code_fim
hard
{ "lang": "python", "repo": "mmr12/DeepBlueSea", "path": "/models/utils_model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def create_convolution(input, num_input_channels, conv_filter_size, num_filters, stride=1, data_format="NHWC"): ''' Simplified version of create_convolutional_layer that doesn't inc...
code_fim
hard
{ "lang": "python", "repo": "mmr12/DeepBlueSea", "path": "/models/utils_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> layer = tf.matmul(input, weights) + biases if use_relu: layer = tf.nn.relu(layer) return layer def create_convolution(input, num_input_channels, conv_filter_size, num_filters, stride=1, ...
code_fim
hard
{ "lang": "python", "repo": "mmr12/DeepBlueSea", "path": "/models/utils_model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ArminD93/Django_test path: /podstrony/views.py from django.shortcuts import render from django.views.generic import ListView, DetailView #Zawiera widoki generyczne, które zostały przygotowane przez twórców Django do obsługi najpopularniejszych obiektów from .models import Budowa, Teoria, Przepis...
code_fim
hard
{ "lang": "python", "repo": "ArminD93/Django_test", "path": "/podstrony/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>################################################ class PrzepisyDetailView(DetailView): model = Przepisy class PrzepisyListView(ListView): model = Przepisy ################################################ class ImageDetailView(DetailView): model = Image class ImageListView(ListView): ...
code_fim
hard
{ "lang": "python", "repo": "ArminD93/Django_test", "path": "/podstrony/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return 'Name : {}\n'\ 'Controller : {}\n'\ 'Swapped : {}\n'\ 'Left Diff : {}\n'\ 'Right Diff : {}\n'\ 'Type : {}\n'\ 'Display : {}\n'\ 'ROM Size : {}\n'\ 'RA...
code_fim
hard
{ "lang": "python", "repo": "NVlabs/cule", "path": "/torchcule/atari/rom.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self): return 'Name : {}\n'\ 'Controller : {}\n'\ 'Swapped : {}\n'\ 'Left Diff : {}\n'\ 'Right Diff : {}\n'\ 'Type : {}\n'\ 'Display : {}\n'\ 'ROM Size : {...
code_fim
hard
{ "lang": "python", "repo": "NVlabs/cule", "path": "/torchcule/atari/rom.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: NVlabs/cule path: /torchcule/atari/rom.py """CuLE (CUda Learning Environment module) This module provides access to several RL environments that generate data on the CPU or GPU. """ import atari_py import gym import os <|fim_suffix|> def __repr__(self): return 'Name : {}\n'\ ...
code_fim
hard
{ "lang": "python", "repo": "NVlabs/cule", "path": "/torchcule/atari/rom.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def print_detailed_score_log(self): logger.info("--------------------") logger.info("Detailed Tag-Based Score") for tag in self.macro_f1: logger.info("Tag: {} - Precision: {:.4f} - Recall: {:.4f} - F1: {:.4f}".format(self.ner_vocab.itos[tag], ...
code_fim
hard
{ "lang": "python", "repo": "SunYanCN/nlp-experiments-in-pytorch", "path": "/scorer/ner_scorer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SunYanCN/nlp-experiments-in-pytorch path: /scorer/ner_scorer.py import logging.config logging.config.fileConfig(fname='./config/config.logger', disable_existing_loggers=False) logger = logging.getLogger("NerScorer") class NerScorer(object): def __init__(self, ner_vocab): super(NerSc...
code_fim
hard
{ "lang": "python", "repo": "SunYanCN/nlp-experiments-in-pytorch", "path": "/scorer/ner_scorer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> precision = {} recall = {} for tag in tp: precision[tag] = tp[tag] / (tp[tag] + fp[tag] + 1e-16) recall[tag] = tp[tag] / (tp[tag] + fn[tag] + 1e-16) f1[tag] = (2 * precision[tag] * recall[tag] / (precision[tag] + recall[tag] + 1e-16)) * 100 ...
code_fim
hard
{ "lang": "python", "repo": "SunYanCN/nlp-experiments-in-pytorch", "path": "/scorer/ner_scorer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stasvorosh/pythonintask path: /PINp/2014/Valkovskey_M_A/task_9_49.py # Задача 9. Вариант 49. #Создайте игру, в которой компьютер выбирает какое-либо слово, а игрок должен его отгадать. Компьютер сообщает игроку, сколько букв в слове, и дает пять попыток узнать, есть ли какая-либо буква в слове, п...
code_fim
hard
{ "lang": "python", "repo": "stasvorosh/pythonintask", "path": "/PINp/2014/Valkovskey_M_A/task_9_49.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> else: print("/nПопытка №",i) print("К сожалению, это не так.") helpk = input("\nВам нужна подсказка?") if helpk =="да": vopr = input("\nНаличие какой буквы вы хотите узнать?") if vopr in word: print("В слове есть эта буква") ...
code_fim
hard
{ "lang": "python", "repo": "stasvorosh/pythonintask", "path": "/PINp/2014/Valkovskey_M_A/task_9_49.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if len(fileFilters) == 0: _usage() sys.exit(2) p4 = p4lib.P4() changes = p4.changes(files=fileFilters) changeNums = [c['change'] for c in changes] for change in changeNums: details = p4.describe(change=change, shortForm=True) print changeHeader(details...
code_fim
hard
{ "lang": "python", "repo": "edgauthier/p4changelog", "path": "/p4cl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: edgauthier/p4changelog path: /p4cl.py #!/usr/bin/env python import sys import p4lib import getopt def changeHeader(details): summary = changeSummary(details['description']) return "[%s|CL:%s (%s)] - %s" % (details['date'], details['change'], details['user'], summary) def changeSummary...
code_fim
hard
{ "lang": "python", "repo": "edgauthier/p4changelog", "path": "/p4cl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ########### # FUNCTIONS ########### def concatenate_one(strip, logfile = os.path.join(constants.LOGDIR, 'concatenation.log')): with log.log_to_file(logfile): # Strips are defined by the start longitude log.info('Concatenating L={0}'.format(strip)) for mode...
code_fim
hard
{ "lang": "python", "repo": "barentsen/iphas-dr2", "path": "/dr2/concatenating.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return status ########### # FUNCTIONS ########### def concatenate_one(strip, logfile = os.path.join(constants.LOGDIR, 'concatenation.log')): with log.log_to_file(logfile): # Strips are defined by the start longitude log.info('Concatenating L={0}'.format(s...
code_fim
hard
{ "lang": "python", "repo": "barentsen/iphas-dr2", "path": "/dr2/concatenating.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: barentsen/iphas-dr2 path: /dr2/concatenating.py import Pool from astropy import log import constants from constants import IPHASQC import util __author__ = 'Geert Barentsen' __copyright__ = 'Copyright, The Authors' __credits__ = ['Geert Barentsen', 'Hywel Farnhill', 'Janet Drew'] ###########...
code_fim
hard
{ "lang": "python", "repo": "barentsen/iphas-dr2", "path": "/dr2/concatenating.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> TWITTER_AUTH.set_access_token(config('TWITTER_ACCESS_TOKEN'), config('TWITTER_ACCESS_TOKEN_SECRET')) TWITTER = tweepy.API(TWITTER_AUTH) BASILICA = basilica.Connection(config('BASILICA_KEY'))<|fim_prefix|># repo: nwilliams030/twitoff path: /TWITOFF/templates/twitter.py """ Retrieve tweets, embedd...
code_fim
medium
{ "lang": "python", "repo": "nwilliams030/twitoff", "path": "/TWITOFF/templates/twitter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nwilliams030/twitoff path: /TWITOFF/templates/twitter.py """ Retrieve tweets, embedding, save into database """ <|fim_suffix|> TWITTER = tweepy.API(TWITTER_AUTH) BASILICA = basilica.Connection(config('BASILICA_KEY'))<|fim_middle|> import basilica import tweepy from decouple import conf...
code_fim
hard
{ "lang": "python", "repo": "nwilliams030/twitoff", "path": "/TWITOFF/templates/twitter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: macecurb/IdeaBot path: /reactions/retry.py from reactions import reactioncommand class RetryCommand(reactioncommand.AdminReactionAddCommand): def matches(self, reaction, user): <|fim_suffix|> yield from client.on_message(reaction.message)<|fim_middle|> return reaction.emoji ==...
code_fim
hard
{ "lang": "python", "repo": "macecurb/IdeaBot", "path": "/reactions/retry.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return reaction.emoji == (self.matchemoji(self.emoji) or False) and user == reaction.message.author # (None or False) = False ; this prevents returning a NoneType when expecting a bool def action(self, reaction, user, client): yield from client.on_message(reaction.message)<|fi...
code_fim
easy
{ "lang": "python", "repo": "macecurb/IdeaBot", "path": "/reactions/retry.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def action(self, reaction, user, client): yield from client.on_message(reaction.message)<|fim_prefix|># repo: macecurb/IdeaBot path: /reactions/retry.py from reactions import reactioncommand class RetryCommand(reactioncommand.AdminReactionAddCommand): <|fim_middle|> def matches(self, rea...
code_fim
hard
{ "lang": "python", "repo": "macecurb/IdeaBot", "path": "/reactions/retry.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jcazallasc/lana-python-challenge path: /app/tests/checkout_backend/test_commands.py import csv from django.core.management import call_command from django.test import TestCase from checkout_backend.adapters.django.offer_repository import DjangoOfferRepository from checkout_backend.adapters.djan...
code_fim
hard
{ "lang": "python", "repo": "jcazallasc/lana-python-challenge", "path": "/app/tests/checkout_backend/test_commands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> offers_rates = len(DjangoOfferRepository().all()) self.assertEqual( offers_rates + 1, self._get_num_lines_from_csv('offers.csv'), ) def test_load_offers_from_csv_twice(self): """Test load offers from CSV file twice to check no errors raise""" ...
code_fim
hard
{ "lang": "python", "repo": "jcazallasc/lana-python-challenge", "path": "/app/tests/checkout_backend/test_commands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, _text: str, _subtype: str = ..., _charset: Optional[str] = ..., *, policy: Optional[Policy] = ... ) -> None: ... else: def __init__(self, _text: str, _subtype: str = ..., _charset: Optional[str] = ...) -> None: ...<|fim_prefix|># repo: aghasyedbilal/intellij-community...
code_fim
medium
{ "lang": "python", "repo": "aghasyedbilal/intellij-community", "path": "/python/helpers/typeshed/stdlib/3/email/mime/text.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aghasyedbilal/intellij-community path: /python/helpers/typeshed/stdlib/3/email/mime/text.pyi # Stubs for email.mime.text (Python 3.4) import sys from email.mime.nonmultipart import MIMENonMultipart from email.policy import Policy from typing import Optional class MIMEText(MIMENonMultipart): <|f...
code_fim
medium
{ "lang": "python", "repo": "aghasyedbilal/intellij-community", "path": "/python/helpers/typeshed/stdlib/3/email/mime/text.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kokellab/klgists path: /klgists/misc/colored_notifications.py from typing import Iterable, Mapping, Callable, Optional from enum import Enum from colorama import Fore, Style class NotificationLevel(Enum): INFO = 1 SUCCESS = 2 NOTICE = 3 WARNING = 4 FAILURE = 5 class ColorMessages: DEFA...
code_fim
hard
{ "lang": "python", "repo": "kokellab/klgists", "path": "/klgists/misc/colored_notifications.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def cl(text: str): print(str(color) + sides + text.center(line_length - 2 * len(sides)) + sides) print(str(color) + top * line_length) self._log(top * line_length) for line in lines: self._log(line) cl(line) print(str(color) + bottom * line_length) self._log(bottom * line_length) def _...
code_fim
hard
{ "lang": "python", "repo": "kokellab/klgists", "path": "/klgists/misc/colored_notifications.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _print(self, lines: Iterable[str], color: int, top: str = '_', bottom: str = '_', sides: str = '', line_length: int = 100): def cl(text: str): print(str(color) + sides + text.center(line_length - 2 * len(sides)) + sides) print(str(color) + top * line_length) self._log(top * line_length) for l...
code_fim
hard
{ "lang": "python", "repo": "kokellab/klgists", "path": "/klgists/misc/colored_notifications.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>Torch. Note well that we provide no BC guarantees for torchgen. If you're interested in using torchgen and want the PyTorch team to be aware, please reach out on GitHub. """<|fim_prefix|># repo: pytorch/pytorch path: /torchgen/__init__.py """torchgen This module contains codegeneration utilities for Py...
code_fim
medium
{ "lang": "python", "repo": "pytorch/pytorch", "path": "/torchgen/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pytorch/pytorch path: /torchgen/__init__.py """torchgen This module contains codegeneration utilities for PyTorch. It is used to <|fim_suffix|>Torch. Note well that we provide no BC guarantees for torchgen. If you're interested in using torchgen and want the PyTorch team to be aware, please rea...
code_fim
medium
{ "lang": "python", "repo": "pytorch/pytorch", "path": "/torchgen/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.value = 0.0 def f(self) -> float: self.value += 1.0 return torch.tensor(self.value) def test_ensemble_mean(): f = F() result = ensemble_mean(f.f, n_times=10) expect = torch.tensor(5.5) assert result == expect<|fim_prefix|># repo: rileymattr/pfhedge path...
code_fim
easy
{ "lang": "python", "repo": "rileymattr/pfhedge", "path": "/tests/_utils/test_operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> f = F() result = ensemble_mean(f.f, n_times=10) expect = torch.tensor(5.5) assert result == expect<|fim_prefix|># repo: rileymattr/pfhedge path: /tests/_utils/test_operations.py import torch from pfhedge._utils.operations import ensemble_mean <|fim_middle|> class F: def __init__(sel...
code_fim
medium
{ "lang": "python", "repo": "rileymattr/pfhedge", "path": "/tests/_utils/test_operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rileymattr/pfhedge path: /tests/_utils/test_operations.py import torch from pfhedge._utils.operations import ensemble_mean class F: def __init__(self): self.value = 0.0 def f(self) -> float: self.value += 1.0 return torch.tensor(self.value) <|fim_suffix|> ...
code_fim
easy
{ "lang": "python", "repo": "rileymattr/pfhedge", "path": "/tests/_utils/test_operations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LanguageAndIntelligence/v20-python-samples path: /m_src/account/summary.py import sys sys.path.append("/Users/thieut/Exercises/v20-python-samples/src") import argparse import common.config from account.account import Account <|fim_suffix|> parser=argparse.ArgumentParser() common.config.a...
code_fim
easy
{ "lang": "python", "repo": "LanguageAndIntelligence/v20-python-samples", "path": "/m_src/account/summary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): parser=argparse.ArgumentParser() common.config.add_argument(parser) args=parser.parse_args() account_id=args.config.active_account api=args.config.create_context() response=api.account.summary(account_id) account=Account(response.get("account","200")) account.du...
code_fim
medium
{ "lang": "python", "repo": "LanguageAndIntelligence/v20-python-samples", "path": "/m_src/account/summary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jfleonUOC/Alpyne path: /alpyne/data/model_data.py import math from typing import Dict, Any from alpyne.data.constants import InputTypes class ModelData: """ Represents a single data element with a name, type, value, and (optional) units. This class is what each of the collection t...
code_fim
hard
{ "lang": "python", "repo": "jfleonUOC/Alpyne", "path": "/alpyne/data/model_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # def to_jsonable(self) -> Dict[str, Any]: # return {"name": self.name, "type": self.type_, "value": self.value, "units": self.units} @staticmethod def from_json(data: Dict[str, Any]) -> 'ModelData': """ Expands the values in a parsed JSON entry (a dictionary). ...
code_fim
hard
{ "lang": "python", "repo": "jfleonUOC/Alpyne", "path": "/alpyne/data/model_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahelm/cython_oracle path: /tests/test_oracle.py def test_direct_import(): """Check calling function after direct import""" from cython_oracle.oracle import answer_to_all_questions assert answer_to_all_questions() == 42 def test_parent_module_import(): """Check calling function ...
code_fim
medium
{ "lang": "python", "repo": "ahelm/cython_oracle", "path": "/tests/test_oracle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert oracle.answer_to_all_questions() == 42 def test_root_module_import(): """Check calling function after import of root module""" import cython_oracle assert cython_oracle.oracle.answer_to_all_questions() == 42<|fim_prefix|># repo: ahelm/cython_oracle path: /tests/test_oracle.py de...
code_fim
medium
{ "lang": "python", "repo": "ahelm/cython_oracle", "path": "/tests/test_oracle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_root_module_import(): """Check calling function after import of root module""" import cython_oracle assert cython_oracle.oracle.answer_to_all_questions() == 42<|fim_prefix|># repo: ahelm/cython_oracle path: /tests/test_oracle.py def test_direct_import(): """Check calling functi...
code_fim
medium
{ "lang": "python", "repo": "ahelm/cython_oracle", "path": "/tests/test_oracle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for idx in res["group"]: select_dict[int(systems[idx])] = [] score = db[idx] for i in range(len(act_list)): if score[i] == optim_score[i]: select_dict[int(systems[idx])].append(act_list[i]) print(systems[idx]) json_str = json.dumps(select_dict,indent=4) with open("./se...
code_fim
hard
{ "lang": "python", "repo": "KevinQian97/diva_toolbox", "path": "/scorer/select_combine.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KevinQian97/diva_toolbox path: /scorer/select_combine.py import csv import os from itertools import combinations import numpy as np import pandas as pd import json sys_num = 20 select_num = 3 class_num = 37 target = "metric_value" csv_path = "/home/kevinq/repos/diva_toolbox/scorer/scores_by_acti...
code_fim
hard
{ "lang": "python", "repo": "KevinQian97/diva_toolbox", "path": "/scorer/select_combine.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @type_check def defuzz(self, x, mfx, method:str='centroid', **kwargs) -> float: """ Defuzzification of the aggregated membership functions. Parameters ---------- x: numpy.ndarray universe of discourse ...
code_fim
hard
{ "lang": "python", "repo": "ErikSargsyann/FcmBci", "path": "/fcmpy/expert_fcm/expert_based_fcm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ErikSargsyann/FcmBci path: /fcmpy/expert_fcm/expert_based_fcm.py import numpy as np import pandas as pd import functools import collections from abc import ABC, abstractmethod from fcmpy.expert_fcm.input_validator import type_check from fcmpy.store.methodsStore import EntropyStore from fcmpy.sto...
code_fim
hard
{ "lang": "python", "repo": "ErikSargsyann/FcmBci", "path": "/fcmpy/expert_fcm/expert_based_fcm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @type_check def build(self, data: collections.OrderedDict, implication_method:str='Mamdani', aggregation_method:str='fMax', defuzz_method:str='centroid') -> pd.DataFrame: """ Build an FCM based on qualitative input data. Parameters ...
code_fim
hard
{ "lang": "python", "repo": "ErikSargsyann/FcmBci", "path": "/fcmpy/expert_fcm/expert_based_fcm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_run_sambamba_missing(tmpdir, reset_path, bed_path, bam_path): out_path = tmpdir.join('ccds.coverage.bed') with pytest.raises(OSError): run_sambamba(bam_path, bed_path, outfile=str(out_path), cov_thresholds=THRESHOLDS)<|fim_prefix|># repo: Clinical-Genomics/cha...
code_fim
hard
{ "lang": "python", "repo": "Clinical-Genomics/chanjo", "path": "/tests/test_sambamba.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Clinical-Genomics/chanjo path: /tests/test_sambamba.py # -*- coding: utf-8 -*- import pytest from chanjo.sambamba import run_sambamba THRESHOLDS = (10, 20) <|fim_suffix|> out_path = tmpdir.join('ccds.coverage.bed') with pytest.raises(OSError): run_sambamba(bam_path, bed_path, o...
code_fim
hard
{ "lang": "python", "repo": "Clinical-Genomics/chanjo", "path": "/tests/test_sambamba.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(count + 1): tag = TagFactory.build() db.session.add(tag) try: db.session.commit() except IntegrityError: db.session.rollback() def posts(count=100): user_count = User.query.count() category_count = Category.query.count() tag_count = ...
code_fim
medium
{ "lang": "python", "repo": "techouse/nordend", "path": "/app/fake.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: techouse/nordend path: /app/fake.py from random import randint from sqlalchemy.exc import IntegrityError from . import db from .factories import UserFactory, PostFactory, CategoryFactory, TagFactory from .models import User, Category, Role, Tag, PostCategory, PostAuthor, PostTag <|fim_suffix|>...
code_fim
medium
{ "lang": "python", "repo": "techouse/nordend", "path": "/app/fake.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }