text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> # alist = [54,26,45,32,87,23,55,3,67,23,23] # bubble_sort(alist) # print alist alist=[20,30,40,90,50,60,70,80,100,110] short_bubble_sort(alist) print(alist)<|fim_prefix|># repo: jsz1/algorithms-and-data-structures path: /search/bubblesort.py def bubble_sort(alist): for num in range(len(alist)-1,0,-...
code_fim
hard
{ "lang": "python", "repo": "jsz1/algorithms-and-data-structures", "path": "/search/bubblesort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># alist = [54,26,45,32,87,23,55,3,67,23,23] # bubble_sort(alist) # print alist alist=[20,30,40,90,50,60,70,80,100,110] short_bubble_sort(alist) print(alist)<|fim_prefix|># repo: jsz1/algorithms-and-data-structures path: /search/bubblesort.py def bubble_sort(alist): for num in range(len(alist)-1,0,-1...
code_fim
hard
{ "lang": "python", "repo": "jsz1/algorithms-and-data-structures", "path": "/search/bubblesort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jsz1/algorithms-and-data-structures path: /search/bubblesort.py def bubble_sort(alist): for num in range(len(alist)-1,0,-1): for i in range(num): if alist[i] > alist[i+1]: temp = alist[i] alist[i] = alist[i+1] alist[i+1] = te...
code_fim
hard
{ "lang": "python", "repo": "jsz1/algorithms-and-data-structures", "path": "/search/bubblesort.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wurunduk/crashday-trk-blender-io path: /props/props.py import bpy class CDTRKProps(bpy.types.PropertyGroup): author : bpy.props.StringProperty ( name = 'Author', default = 'Author' ) comment : bpy.props.StringProperty ( name ...
code_fim
hard
{ "lang": "python", "repo": "wurunduk/crashday-trk-blender-io", "path": "/props/props.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> width : bpy.props.IntProperty ( name = 'Width', default = 5, min = 3, max = 90, soft_max = 40 ) height : bpy.props.IntProperty ( name = 'Height', default = 5, min ...
code_fim
hard
{ "lang": "python", "repo": "wurunduk/crashday-trk-blender-io", "path": "/props/props.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KorewaLidesu/VoiceLab path: /Voicelab/toolkits/Voicelab/ScaleIntensityNode.py from Voicelab.pipeline.Node import Node from parselmouth.praat import call from Voicelab.toolkits.Voicelab.VoicelabNode import VoicelabNode # MANIPULATE PITCH NODE # WARIO pipeline node for manipulating the pitch of a...
code_fim
medium
{ "lang": "python", "repo": "KorewaLidesu/VoiceLab", "path": "/Voicelab/toolkits/Voicelab/ScaleIntensityNode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.args = { "value": 70, # Positive number "method": ("RMS (dB)", ["RMS (dB)", "Peak (-1, 1)"]) # todo check for legal values } # process: WARIO hook called once for each voice file. def process(self): value = self.args["value"] ...
code_fim
medium
{ "lang": "python", "repo": "KorewaLidesu/VoiceLab", "path": "/Voicelab/toolkits/Voicelab/ScaleIntensityNode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NVIDIA/apex path: /apex/contrib/test/layer_norm/test_fast_layer_norm.py import unittest import torch SKIP_TEST = None try: from apex.contrib.layer_norm.layer_norm import FastLayerNorm import fast_layer_norm as fln except ImportError as e: SKIP_TEST = e class GPUTimer: def __in...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/apex", "path": "/apex/contrib/test/layer_norm/test_fast_layer_norm.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_run_benchmark(self): for (S, B, hidden_size, runs) in ( (512, 32, 768, 1000), (512, 32, 1024, 1000), (512, 8, 4096, 1000), (512, 8, 5120, 1000), (512, 8, 6144, 1000), (256, 2, 20480, 500), (256, 2, 256...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/apex", "path": "/apex/contrib/test/layer_norm/test_fast_layer_norm.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> stream = torch.cuda.Stream() with torch.cuda.stream(stream): timer = GPUTimer(stream) # warmup for r in range(runs): z, mu, rsigma = fln.ln_fwd(x, gamma, beta, epsilon) timer.start() for r in range(runs): z, mu, rsigma = fln.ln_fwd...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/apex", "path": "/apex/contrib/test/layer_norm/test_fast_layer_norm.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Finally, define the route. route = aws.apigatewayv2.Route("route", api_id=api.id, route_key="POST /uploads", target=integration.id.apply(lambda id: f"integrations/{id}"), ) # Define a role and policy allowing Lambda functions to log to CloudWatch. lambda_role = aws.iam.Role("lambda-role", ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/examples", "path": "/aws-py-apigatewayv2-eventbridge/__main__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Create an EventBridge target associating the event rule with the function. lambda_target = aws.cloudwatch.EventTarget("lambda-target", arn=lambda_function.arn, rule=rule.name, event_bus_name=bus.name, ) # Give EventBridge permission to invoke the function. lambda_permission = aws.lambda_.Pe...
code_fim
hard
{ "lang": "python", "repo": "pulumi/examples", "path": "/aws-py-apigatewayv2-eventbridge/__main__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/examples path: /aws-py-apigatewayv2-eventbridge/__main__.py # Copyright 2016-2022, Pulumi Corporation. All rights reserved. import json import pulumi import pulumi_aws as aws # Create an HTTP API. api = aws.apigatewayv2.Api("example", protocol_type="HTTP" ) # Create a stage and set...
code_fim
hard
{ "lang": "python", "repo": "pulumi/examples", "path": "/aws-py-apigatewayv2-eventbridge/__main__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Coldwave96/PentestingTools path: /padding.py 2Db3Db4Db5Db6Db7Db8Db9" "Dc0Dc1Dc2Dc3Dc4Dc5Dc6Dc7Dc8Dc9Dd0Dd1Dd2Dd3Dd4Dd5Dd6Dd7Dd8Dd9De0De1De2De3De4De5De" "6De7De8De9Df0Df1Df2Df3Df4Df5Df6Df7Df8Df9Dg0Dg1Dg2Dg3Dg4Dg5Dg6Dg7Dg8Dg9Dh0Dh1Dh2D" "h3Dh4Dh5Dh6Dh7Dh8Dh9Di0Di1Di2Di3Di4Di5Di6Di7Di8Di...
code_fim
hard
{ "lang": "python", "repo": "Coldwave96/PentestingTools", "path": "/padding.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>2Vr3Vr4Vr5Vr6Vr7Vr8Vr9Vs0Vs1Vs2Vs3Vs4Vs5Vs6Vs7Vs8Vs9Vt0Vt1Vt2V" "t3Vt4Vt5Vt6Vt7Vt8Vt9Vu0Vu1Vu2Vu3Vu4Vu5Vu6Vu7Vu8Vu9Vv0Vv1Vv2Vv3Vv4Vv5Vv6Vv7Vv8Vv9" "Vw0Vw1Vw2Vw3Vw4Vw5Vw6Vw7Vw8Vw9Vx0Vx1Vx2Vx3Vx4Vx5Vx6Vx7Vx8Vx9Vy0Vy1Vy2Vy3Vy4Vy5Vy" "6Vy7Vy8Vy9Vz0Vz1Vz2Vz3Vz4Vz5Vz6Vz7Vz8Vz9Wa0Wa1Wa2Wa3Wa4Wa5Wa6Wa...
code_fim
hard
{ "lang": "python", "repo": "Coldwave96/PentestingTools", "path": "/padding.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Coldwave96/PentestingTools path: /padding.py e4Ee5Ee6Ee7Ee8Ee9Ef0Ef1Ef2E" "f3Ef4Ef5Ef6Ef7Ef8Ef9Eg0Eg1Eg2Eg3Eg4Eg5Eg6Eg7Eg8Eg9Eh0Eh1Eh2Eh3Eh4Eh5Eh6Eh7Eh8Eh9" "Ei0Ei1Ei2Ei3Ei4Ei5Ei6Ei7Ei8Ei9Ej0Ej1Ej2Ej3Ej4Ej5Ej6Ej7Ej8Ej9Ek0Ek1Ek2Ek3Ek4Ek5Ek" "6Ek7Ek8Ek9El0El1El2El3El4El5El6El7El8El9Em0E...
code_fim
hard
{ "lang": "python", "repo": "Coldwave96/PentestingTools", "path": "/padding.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def sort_numbers(numbers: List[Number]) -> List[Number]: return sorted(numbers, key=lambda n: (n.rem, -n.remBy2, n.secondaryValue)) def solve_problem(): size, div = read_configuration() while size != 0 and div != 0: numbers = read_list(size, div) result = [number.value for n...
code_fim
medium
{ "lang": "python", "repo": "hiroshisiq/problem_solving", "path": "/problems/urionlinejudge/uri_1252_sort_sort_and_sort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hiroshisiq/problem_solving path: /problems/urionlinejudge/uri_1252_sort_sort_and_sort.py #!/usr/bin/env python3 from typing import Tuple, List class Number: def __init__(self, value: int, div: int): self.value = str(value) # true value self....
code_fim
medium
{ "lang": "python", "repo": "hiroshisiq/problem_solving", "path": "/problems/urionlinejudge/uri_1252_sort_sort_and_sort.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lahwran/tree-of-life path: /treeoflife/test/test_parseutil.py from __future__ import unicode_literals, print_function from treeoflife import parseutil import parsley def test_grammar(): <|fim_suffix|> grammar = """ source :arg = othergrammar.target(arg):t ' derp' -> t + 10 ...
code_fim
medium
{ "lang": "python", "repo": "lahwran/tree-of-life", "path": "/treeoflife/test/test_parseutil.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> grammar = """ source :arg = othergrammar.target(arg):t ' derp' -> t + 10 """ bindings = { "othergrammar": MyOtherGrammar } assert MyGrammar("herp derp").source(1000) == 1110 assert MyGrammar("herk derk").source(1000, optional=True) is None ...
code_fim
medium
{ "lang": "python", "repo": "lahwran/tree-of-life", "path": "/treeoflife/test/test_parseutil.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: # Create new Container in the Service await container_client.create_container() # Get the BlobClient blob_client = container_client.get_blob_client("myappendblob") # Upload content to the append blob with open(SOURCE_FI...
code_fim
hard
{ "lang": "python", "repo": "elraikhm/azure-sdk-for-python", "path": "/sdk/storage/azure-storage-blob/tests/test_blob_samples_hello_world_async.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: elraikhm/azure-sdk-for-python path: /sdk/storage/azure-storage-blob/tests/test_blob_samples_hello_world_async.py # coding: utf-8 # ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT Licens...
code_fim
hard
{ "lang": "python", "repo": "elraikhm/azure-sdk-for-python", "path": "/sdk/storage/azure-storage-blob/tests/test_blob_samples_hello_world_async.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @record def test_block_blob_sample_async(self): if TestMode.need_recording_file(self.test_mode): return loop = asyncio.get_event_loop() loop.run_until_complete(self._test_block_blob_sample_async()) async def _test_page_blob_sample_async(self): # Ins...
code_fim
hard
{ "lang": "python", "repo": "elraikhm/azure-sdk-for-python", "path": "/sdk/storage/azure-storage-blob/tests/test_blob_samples_hello_world_async.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>?P<id_classifield>\d+)/$', viewClassifield), )<|fim_prefix|># repo: saraivaufc/Journal path: /newspaper/urls/user/classifield.py from django.conf.urls import patterns, include, url from newspaper.views.user import viewCla<|fim_middle|>ssifield urlpatterns = patterns('', url(r'^(
code_fim
easy
{ "lang": "python", "repo": "saraivaufc/Journal", "path": "/newspaper/urls/user/classifield.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saraivaufc/Journal path: /newspaper/urls/user/classifield.py from django.conf.urls import patterns, include<|fim_suffix|>ssifield urlpatterns = patterns('', url(r'^(?P<id_classifield>\d+)/$', viewClassifield), )<|fim_middle|>, url from newspaper.views.user import viewCla
code_fim
easy
{ "lang": "python", "repo": "saraivaufc/Journal", "path": "/newspaper/urls/user/classifield.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aimini/hm-51 path: /test/generate/autotest/56_57_ANL_A_Ri.py ######################################################### # 2020-01-23 12:41:37 # AI # ins: ANL A, @Ri ######################################################### from .common.INS_XXX_A_Ri import XXX_A_Ri from ..asmconst import * class...
code_fim
easy
{ "lang": "python", "repo": "Aimini/hm-51", "path": "/test/generate/autotest/56_57_ANL_A_Ri.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def op_func(self, B): A = self.ram.get_direct(SFR_A.x) self.ram.set_direct(SFR_A.x, A & B) p = ANL_A_Ri().gen(0xFF, 15, 1)<|fim_prefix|># repo: Aimini/hm-51 path: /test/generate/autotest/56_57_ANL_A_Ri.py ######################################################### # 2020-01-23...
code_fim
medium
{ "lang": "python", "repo": "Aimini/hm-51", "path": "/test/generate/autotest/56_57_ANL_A_Ri.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_complete(self): left = Node(data=2, left=Node(data=1), right=Node(data=3)) right = Node(data=6, left=Node(data=5), right=Node(data=7)) tree = Node(data=4, left=left, right=right) is_balanced, tree_min, tree_max = balanced(tree) self.assertTrue(is_balanc...
code_fim
hard
{ "lang": "python", "repo": "jpventura/Craftsman", "path": "/ctci/ctci-is-binary-search-tree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpventura/Craftsman path: /ctci/ctci-is-binary-search-tree.py #!/usr/bin/env python3 import math import unittest class Node: def __init__(self, data, left=None, right=None): self.data = data self.left = left self.right = right def balanced(tree): if tree is No...
code_fim
hard
{ "lang": "python", "repo": "jpventura/Craftsman", "path": "/ctci/ctci-is-binary-search-tree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chardorn/unc-racecar path: /src/pure_pursuit/src/obstacle_bloating.py #!/usr/bin/env python # This script probably won't end up being used--it still doesn't guarantee # a straight-line path that avoids obstacles, and it's too slow. However, we'll # preserve it for reference. import rospy import ...
code_fim
hard
{ "lang": "python", "repo": "chardorn/unc-racecar", "path": "/src/pure_pursuit/src/obstacle_bloating.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while not rospy.core.is_shutdown_requested(): laser_data = rospy.client.wait_for_message('scan', LaserScan) prev_time = time.clock() # calculate loop time print "Got " + str(len(laser_data.ranges)) + " laser points" start = time.time() bloated_data = get_all_bl...
code_fim
hard
{ "lang": "python", "repo": "chardorn/unc-racecar", "path": "/src/pure_pursuit/src/obstacle_bloating.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> html = ClassificationSummary(df, None)._repr_html_() # render html http://htmledit.squarefree.com/ print(html) self.assertIn("data:image/png;base64", html) def test_regression_summary(self): df = pd.DataFrame({"a": np.random.random(10), "b": np.random.random(...
code_fim
hard
{ "lang": "python", "repo": "jcoffi/pandas-ml-quant", "path": "/pandas-ml-utils/pandas_ml_utils_test/ml/data/test__summary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> html = RegressionSummary(df, None)._repr_html_() # render html http://htmledit.squarefree.com/ print(html) self.assertIn("data:image/png;base64", html)<|fim_prefix|># repo: jcoffi/pandas-ml-quant path: /pandas-ml-utils/pandas_ml_utils_test/ml/data/test__summary.py from u...
code_fim
medium
{ "lang": "python", "repo": "jcoffi/pandas-ml-quant", "path": "/pandas-ml-utils/pandas_ml_utils_test/ml/data/test__summary.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jcoffi/pandas-ml-quant path: /pandas-ml-utils/pandas_ml_utils_test/ml/data/test__summary.py from unittest import TestCase import pandas as pd from pandas_ml_utils import ClassificationSummary, RegressionSummary import numpy as np from pandas_ml_utils.constants import * class TestSummary(TestCas...
code_fim
medium
{ "lang": "python", "repo": "jcoffi/pandas-ml-quant", "path": "/pandas-ml-utils/pandas_ml_utils_test/ml/data/test__summary.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: esslushy/Cheat path: /Deck.py from Card import Card import random suits = ['Hearts', 'Clubs', 'Diamonds', 'Spades'] class Deck(): def __init__(self, empty=False): <|fim_suffix|> def shuffle(self): random.shuffle(self.cards) def draw(self, num=1): drawnCards = [] ...
code_fim
hard
{ "lang": "python", "repo": "esslushy/Cheat", "path": "/Deck.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> random.shuffle(self.cards) def draw(self, num=1): drawnCards = [] for i in range(num): drawnCards.append(self.cards[i]) self.cards.remove(self.cards[i]) if(len(drawnCards) == 1): return drawnCards[0] else: return ...
code_fim
hard
{ "lang": "python", "repo": "esslushy/Cheat", "path": "/Deck.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> drawnCards = [] for i in range(num): drawnCards.append(self.cards[i]) self.cards.remove(self.cards[i]) if(len(drawnCards) == 1): return drawnCards[0] else: return drawnCards def __str__(self): return self.cards<|f...
code_fim
hard
{ "lang": "python", "repo": "esslushy/Cheat", "path": "/Deck.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # optional lowercase if lower: corpus = map(lambda x: x.lower(), corpus) return corpus def get_vocab_counts(corpus): ''' Reads in a list of sentences, returns a list of tuples of (word, probability, count) sorted by descending frequency. This is a reimplementation of 'amitta...
code_fim
hard
{ "lang": "python", "repo": "shamilcm/cynical", "path": "/python_cynical_wrapper.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shamilcm/cynical path: /python_cynical_wrapper.py e're also expecting that this data is already tokenized (unless you want to run selection on non-tokenized data for some weird reason.) ''' #Check that the cyncial_perl_script exists and can be executed. # Uncomment if you're us...
code_fim
hard
{ "lang": "python", "repo": "shamilcm/cynical", "path": "/python_cynical_wrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shamilcm/cynical path: /python_cynical_wrapper.py _lines, seed_lines=[], batch_mode=False, keep_boring=True, save_memory=True, lower=True, debug=True, min_count=3, max_count=10000, num_lines=0, outdir='/tmp/cynical_out', save_ou...
code_fim
hard
{ "lang": "python", "repo": "shamilcm/cynical", "path": "/python_cynical_wrapper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ccj5351/hmr_rgbd path: /src/datasets/surreal_to_tfrecords.py 'Number of shards in training TFRecord files.') tf.app.flags.DEFINE_integer('validation_shards', 1000, 'Number of shards in validation TFRecord files.') """ # save to h5 file or sa...
code_fim
hard
{ "lang": "python", "repo": "ccj5351/hmr_rgbd", "path": "/src/datasets/surreal_to_tfrecords.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for d in subdirs: # for each sequence, e.g., d = ppl_num_valid = 0 cur_dir = join(img_dir, d) sequences = [s for s in listdir(cur_dir) if isfile(join(cur_dir,s)) and ".mp4" in s] for s in sequences: # for each video in the sequence s_name = s.split(".")[0] ...
code_fim
hard
{ "lang": "python", "repo": "ccj5351/hmr_rgbd", "path": "/src/datasets/surreal_to_tfrecords.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #do_transform = False do_transform = True # already test, this value must be TRUE; if do_transform: # <========= LOAD SMPL MODEL BASED ON GENDER if info_dict['gender'][0] == 0: # f m = load_model('/...
code_fim
hard
{ "lang": "python", "repo": "ccj5351/hmr_rgbd", "path": "/src/datasets/surreal_to_tfrecords.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rjleveque/shoaling_paper_figures path: /japan2011/maketopo.py """ Need to edit based on /Users/rjl/git/GeoClaw_MOST_comparisons/topo/PacificDEMs/*4min.tt3 """ from __future__ import print_function from pylab import * from clawpack.geoclaw import topotools from clawpack.clawutil.data import ge...
code_fim
hard
{ "lang": "python", "repo": "rjleveque/shoaling_paper_figures", "path": "/japan2011/maketopo.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>etopo1_url = 'https://www.ngdc.noaa.gov/thredds/dodsC/global/ETOPO1_Ice_g_gmt4.nc' extent = [-180, -110, 20, 60] print('Attempting to read etopo1 data from\n %s' % etopo1_url) etopo = topotools.read_netcdf(path=etopo1_url, extent=extent, coarsen=1, verbose=True) fname = 'eto...
code_fim
medium
{ "lang": "python", "repo": "rjleveque/shoaling_paper_figures", "path": "/japan2011/maketopo.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def main(): clf = KMeans(3) train_x = [ [1, 1], [0.9, 1.2], [1.3, 0.8], [8, 8], [8.1, 7.9], [8.2, 7.8], [9, 0], [9, 0.2], [9.2, 0.3] ] train_x = np.array(train_x) clf.fit(train_x) print(clf.clusters) print(clf.predict_one(np.array([9, 9]))) if __name__...
code_fim
easy
{ "lang": "python", "repo": "KLabp/ML-by-Python", "path": "/tests/test_kmeans.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KLabp/ML-by-Python path: /tests/test_kmeans.py import os import sys sys.path.insert(0, os.path.abspath('.')) <|fim_suffix|> def main(): clf = KMeans(3) train_x = [ [1, 1], [0.9, 1.2], [1.3, 0.8], [8, 8], [8.1, 7.9], [8.2, 7.8], [9, 0], [9, 0.2], [9.2, 0.3] ] ...
code_fim
easy
{ "lang": "python", "repo": "KLabp/ML-by-Python", "path": "/tests/test_kmeans.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): clf = KMeans(3) train_x = [ [1, 1], [0.9, 1.2], [1.3, 0.8], [8, 8], [8.1, 7.9], [8.2, 7.8], [9, 0], [9, 0.2], [9.2, 0.3] ] train_x = np.array(train_x) clf.fit(train_x) print(clf.clusters) print(clf.predict_one(np.array([9, 9]))) if __name_...
code_fim
easy
{ "lang": "python", "repo": "KLabp/ML-by-Python", "path": "/tests/test_kmeans.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sourabhv/FlapPyBird path: /src/utils/sounds.py import sys import pygame class Sounds: die: pygame.mixer.Sound hit: pygame.mixer.Sound point: pygame.mixer.Sound swoosh: pygame.mixer.Sound wing: pygame.mixer.Sound <|fim_suffix|> self.die = pygame.mixer.Sound(f"assets/...
code_fim
medium
{ "lang": "python", "repo": "sourabhv/FlapPyBird", "path": "/src/utils/sounds.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.die = pygame.mixer.Sound(f"assets/audio/die.{ext}") self.hit = pygame.mixer.Sound(f"assets/audio/hit.{ext}") self.point = pygame.mixer.Sound(f"assets/audio/point.{ext}") self.swoosh = pygame.mixer.Sound(f"assets/audio/swoosh.{ext}") self.wing = pygame.mixer.Sou...
code_fim
medium
{ "lang": "python", "repo": "sourabhv/FlapPyBird", "path": "/src/utils/sounds.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uvenil/PythonKurs201806 path: /___Python/Angela/PyKurs/p02_datenstrukturen/m04_worterbuch_invertieren.py d = {"Tisch": "table", "Stuhl": "chair", "Schreibtisch": "desk"} # Ziel: Weiteres Woerterbuch aufbauen, das als Schluessel englische Begriffe enthaelt # print(d.items()) <|f...
code_fim
hard
{ "lang": "python", "repo": "uvenil/PythonKurs201806", "path": "/___Python/Angela/PyKurs/p02_datenstrukturen/m04_worterbuch_invertieren.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># 3. Ansatz e = {} for key, value in d.items(): e[value] = key<|fim_prefix|># repo: uvenil/PythonKurs201806 path: /___Python/Angela/PyKurs/p02_datenstrukturen/m04_worterbuch_invertieren.py d = {"Tisch": "table", "Stuhl": "chair", "Schreibtisch": "desk"} # Ziel: Weiteres Woerterbuch ...
code_fim
medium
{ "lang": "python", "repo": "uvenil/PythonKurs201806", "path": "/___Python/Angela/PyKurs/p02_datenstrukturen/m04_worterbuch_invertieren.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vokal/s3same path: /s3same/iam.py import json from botocore.exceptions import ClientError IAMName = 's3same_travis' def _policy_string(bucket): return json.dumps({ "Version": "2012-10-17", "Statement": [ { "Action": [ "s3:ListB...
code_fim
hard
{ "lang": "python", "repo": "vokal/s3same", "path": "/s3same/iam.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: users = list(_users_in_group(iam)) except ClientError as e: if e.response['Error']['Code'] != 'NoSuchEntity': raise users = [] for user in users: username = user.get('UserName') if not username: continue for key in _k...
code_fim
hard
{ "lang": "python", "repo": "vokal/s3same", "path": "/s3same/iam.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def credentials_for_new_user(iam, username, bucket=IAMName): _create_group_if_needed(iam, bucket) try: iam.create_user(UserName=username) except ClientError as e: if e.response['Error']['Code'] != 'EntityAlreadyExists': raise iam.add_user_to_group(UserName=usern...
code_fim
hard
{ "lang": "python", "repo": "vokal/s3same", "path": "/s3same/iam.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlgig/sktime path: /sktime/base/tests/test_base_sktime.py # -*- coding: utf-8 -*- # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Tests for BaseObject universal base class that require sktime or sklearn imports.""" __author__ = ["fkiraly"] def test_get_fitted_params_...
code_fim
hard
{ "lang": "python", "repo": "mlgig/sktime", "path": "/sktime/base/tests/test_base_sktime.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> from sktime.datasets import load_airline from sktime.forecasting.trend import TrendForecaster y = load_airline() pipe = make_pipeline(StandardScaler(), LinearRegression()) f = TrendForecaster(pipe) f.fit(y) params = f.get_fitted_params() assert "regressor" in params.keys...
code_fim
hard
{ "lang": "python", "repo": "mlgig/sktime", "path": "/sktime/base/tests/test_base_sktime.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Raises ------ AssertionError if logic behind get_fitted_params is incorrect, logic tested: calling get_fitted_params on obj sktime component returns expected nested params """ from sklearn.linear_model import LinearRegression from sklearn.pipeline import make_pipeline f...
code_fim
hard
{ "lang": "python", "repo": "mlgig/sktime", "path": "/sktime/base/tests/test_base_sktime.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: nodejs/node-addon-api path: /test/addon_build/tpl/binding.gyp { 'target_defaults': { 'include_dirs': [ "<!(node -p \"require('node-addon-api').include_dir\")" ], 'variables': { 'NAPI_VERSION%': "<!(node -p \"process.versions.napi\")", 'disable_deprecated': "<!(no...
code_fim
hard
{ "lang": "python", "repo": "nodejs/node-addon-api", "path": "/test/addon_build/tpl/binding.gyp", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_DISABLE_CPP_EXCEPTIONS' ], 'cflags': [ '-fno-exceptions' ], 'cflags_cc': [ '-fno-exceptions' ], 'msvs_settings': { 'VCCLCompilerTool': { 'ExceptionHandling': 0, 'EnablePREfast': 'true', }, }, 'xcode_settings': { 'CLANG_CXX_LIBRARY'...
code_fim
hard
{ "lang": "python", "repo": "nodejs/node-addon-api", "path": "/test/addon_build/tpl/binding.gyp", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: livsik/strawberry_py path: /xcode/xc_build.py import re from os import getcwd from datetime import datetime from calendar import timegm from time import sleep from commander import Commander from command_output_pipe_base import CommandOutputPipeBase from pretty_output_pipe import PrettyOutputPip...
code_fim
hard
{ "lang": "python", "repo": "livsik/strawberry_py", "path": "/xcode/xc_build.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def build(self, clean, run, device, result_formatter): if self.verbose: pipe_type = PrettyOutputPipe else: pipe_type = ProgressOutputPipe if clean: pipe = pipe_type() if result_formatter: result_formatter.start(pipe) Log.msg("Cleaning \"{0}\"".format(sel...
code_fim
hard
{ "lang": "python", "repo": "livsik/strawberry_py", "path": "/xcode/xc_build.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: forkode/ok_kafka path: /ok_kafka/default_serializer.py import json from datetime import date, datetime from decimal import Decimal from typing import Any, Union from uuid import UUID from ok_kafka.local_types import JSONType __all__ = ['serialize', 'deserialize'] class UniversalEncoder(json.J...
code_fim
hard
{ "lang": "python", "repo": "forkode/ok_kafka", "path": "/ok_kafka/default_serializer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def deserialize(value, topic): # type: (bytes, str) -> JSONType return json.loads(value, parse_float=Decimal)<|fim_prefix|># repo: forkode/ok_kafka path: /ok_kafka/default_serializer.py import json from datetime import date, datetime from decimal import Decimal from typing import Any, Union from uui...
code_fim
hard
{ "lang": "python", "repo": "forkode/ok_kafka", "path": "/ok_kafka/default_serializer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: edouard-lopez/parlr path: /tests/test_learner.py # -*- coding: utf-8 -*- import logging from parlr import Learner import server import json import unittest logger = logging.getLogger(__name__) class LearnerTestCase(unittest.TestCase): def setUp(self): self.app = server.app.test_cl...
code_fim
hard
{ "lang": "python", "repo": "edouard-lopez/parlr", "path": "/tests/test_learner.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> response = self.app.put('/learners/1', data=json.dumps({'username': 'Édouard Lopez', 'level': 1, 'known_characters': [1,2]}), content_type='application/json') self.assertEqual(200, response.status_code)<|fim_prefix|># repo: ed...
code_fim
hard
{ "lang": "python", "repo": "edouard-lopez/parlr", "path": "/tests/test_learner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: maxbates/molecular-design-toolkit path: /moldesign/helpers/logs.py from __future__ import print_function, absolute_import, division from future.builtins import * from future import standard_library standard_library.install_aliases() # Copyright 2017 Autodesk Inc. # # Licensed under the Apache Lic...
code_fim
hard
{ "lang": "python", "repo": "maxbates/molecular-design-toolkit", "path": "/moldesign/helpers/logs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ke = kinetic_energy(properties['momenta'], mol.masses) t = kinetic_temperature(ke, mol.dynamic_dof) print(self.ROW_FORMAT.format(properties['time'].defunits_value(), properties['potential_energy'].defunits_value(), ...
code_fim
hard
{ "lang": "python", "repo": "maxbates/molecular-design-toolkit", "path": "/moldesign/helpers/logs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if os.path.exists(dest): logger.info( 'Project {0} already available locally in {1}, performing an update.'.format(slug, dest)) try: RepoCloner.pull(dest) RepoCloner.update_submodules(dest) ...
code_fim
hard
{ "lang": "python", "repo": "collab-uniba/szz-mpi", "path": "/githubutils/clone_projects.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: collab-uniba/szz-mpi path: /githubutils/clone_projects.py import getopt import logging import os import sys from gitutils.repo import RepoCloner from loggingcfg import initialize_logger from utils import utility def start(argv): project_file = 'project-list.txt' destination_dir = './gi...
code_fim
hard
{ "lang": "python", "repo": "collab-uniba/szz-mpi", "path": "/githubutils/clone_projects.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return { "$gte": value } def get_value(self, field, value): return field.to_son(value)<|fim_prefix|># repo: parthi82/tailow path: /tailow/operators/gt.py from tailow.operators.base import Operator class GTOperator(Operator): """ Greater than operator """ ...
code_fim
hard
{ "lang": "python", "repo": "parthi82/tailow", "path": "/tailow/operators/gt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: parthi82/tailow path: /tailow/operators/gt.py from tailow.operators.base import Operator class GTOperator(Operator): """ Greater than operator """ def to_query(self, field_name, value): return { "$gt": value } def get_value(self, field, value): <|fim_su...
code_fim
medium
{ "lang": "python", "repo": "parthi82/tailow", "path": "/tailow/operators/gt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # combine the info files data_list = [pd.read_csv(os.path.join(input_dir, read + '.csv')) for read in read_list] compiled_data = pd.concat(data_list) compiled_data['name'] = compiled_data['name'].apply(str.lower) compiled_data = compiled_data[['name', 'latitude', 'longitude']] compiled_data...
code_fim
medium
{ "lang": "python", "repo": "garygsw/twitter-crowd-flow", "path": "/compile_places_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: garygsw/twitter-crowd-flow path: /compile_places_info.py '''compile_places_info.py. Compile the places latitude and longitudes. ''' import os import math import pandas as pd # Input parameters read_list = ['sg_factual_places', 'sg_manual_names', 'sg_mrt_names'] input_dir = 'places-info' output...
code_fim
hard
{ "lang": "python", "repo": "garygsw/twitter-crowd-flow", "path": "/compile_places_info.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexge50/Matrix-API path: /web-api/main.py from flask import Flask, request, jsonify import matrix app = Flask(__name__) @app.route('/') def hello(): return 'Hello, World!' <|fim_suffix|> return jsonify(matrix.multiply(first_matrix, second_matrix))<|fim_middle|>@app.route('/multiply',...
code_fim
hard
{ "lang": "python", "repo": "alexge50/Matrix-API", "path": "/web-api/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return jsonify(matrix.multiply(first_matrix, second_matrix))<|fim_prefix|># repo: alexge50/Matrix-API path: /web-api/main.py from flask import Flask, request, jsonify import matrix app = Flask(__name__) @app.route('/') def hello(): return 'Hello, World!' @app.route('/multiply', methods=['POS...
code_fim
hard
{ "lang": "python", "repo": "alexge50/Matrix-API", "path": "/web-api/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>d(int(input('введите число: '))) print(array[n] ** n)<|fim_prefix|># repo: MakarFadeev/PythonTasks path: /LISTS2/NUMBER4.py numbers = int(input('сколько чисел вы хотите ввести?<|fim_middle|> ')) n = int(input('введите число (любое!): ')) - 1 array = [] for i in range(0, numbers): array.appen
code_fim
medium
{ "lang": "python", "repo": "MakarFadeev/PythonTasks", "path": "/LISTS2/NUMBER4.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MakarFadeev/PythonTasks path: /LISTS2/NUMBER4.py numbers = int(input('сколько чисел вы хотите ввести?<|fim_suffix|>rray = [] for i in range(0, numbers): array.append(int(input('введите число: '))) print(array[n] ** n)<|fim_middle|> ')) n = int(input('введите число (любое!): ')) - 1 a
code_fim
easy
{ "lang": "python", "repo": "MakarFadeev/PythonTasks", "path": "/LISTS2/NUMBER4.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>0.07}, 5: {'A': -0.017, 'C': -0.179, 'E': -0.012, 'D': 0.11, 'G': -0.028, 'F': -0.033, 'I': -0.01, 'H': 0.079, 'K': -0.036, 'M': 0.0, 'L': -0.151, 'N': 0.135, 'Q': 0.221, 'P': -0.01, 'S': -0.013, 'R': -0.136, 'T': 0.256, 'W': -0.023, 'V': -0.121, 'Y': -0.031}, 6: {'A': -0.001, 'C': -0.0, 'E': 0.0, 'D': 0....
code_fim
hard
{ "lang": "python", "repo": "FRED-2/Fred2", "path": "/Fred2/Data/pssms/smm/mat/B_45_01_10.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>002, 'N': 0.011, 'Q': 0.037, 'P': 0.001, 'S': 0.013, 'R': -0.024, 'T': -0.009, 'W': -0.019, 'V': 0.001, 'Y': -0.025}, 8: {'A': -0.028, 'C': 0.015, 'E': -0.062, 'D': 0.097, 'G': 0.088, 'F': -0.008, 'I': -0.011, 'H': 0.046, 'K': 0.051, 'M': 0.114, 'L': -0.087, 'N': -0.044, 'Q': -0.017, 'P': -0.066, 'S': -0....
code_fim
hard
{ "lang": "python", "repo": "FRED-2/Fred2", "path": "/Fred2/Data/pssms/smm/mat/B_45_01_10.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: FRED-2/Fred2 path: /Fred2/Data/pssms/smm/mat/B_45_01_10.py B_45_01_10 = {0: {'A': -0.639, 'C': -0.412, 'E': -0.297, 'D': 0.548, 'G': 0.267, 'F': 0.132, 'I': -0.105, 'H': 0.19, 'K': 0.169, 'M': -0.566, 'L': 0.327, 'N': -0.066, 'Q': -0.356, 'P': 0.695, 'S': -0.341, 'R': -0.106, 'T': -0.06, 'W': 0.2...
code_fim
hard
{ "lang": "python", "repo": "FRED-2/Fred2", "path": "/Fred2/Data/pssms/smm/mat/B_45_01_10.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: KarboniteKream/advent-of-code path: /2019/04.py import util def part1(low, high): def is_valid(number): digits = str(number) valid = False for i in range(5): if digits[i] > digits[i + 1]: return False if digits[i] == digits[i...
code_fim
hard
{ "lang": "python", "repo": "KarboniteKream/advent-of-code", "path": "/2019/04.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return valid return sum(is_valid(num) for num in range(low, high + 1)) def part2(low, high): def is_valid(number): digits = str(number) count = [0] * 10 count[int(digits[5])] = 1 for i in range(5): if digits[i] > digits[i + 1]: ...
code_fim
medium
{ "lang": "python", "repo": "KarboniteKream/advent-of-code", "path": "/2019/04.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stickwithjosh/hypodrical path: /apps/podcast/admin.py from apps.podcast.models import Podcast, Contributor, Episode, Category from django.contrib import admin <|fim_suffix|> class EpisodeAdmin(admin.ModelAdmin): list_display = ('title', 'episode_number', 'pub_date') prepopulated_fields =...
code_fim
medium
{ "lang": "python", "repo": "stickwithjosh/hypodrical", "path": "/apps/podcast/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class EpisodeAdmin(admin.ModelAdmin): list_display = ('title', 'episode_number', 'pub_date') prepopulated_fields = {"slug": ("title",)} date_hierarchy = 'pub_date' admin.site.register(Episode, EpisodeAdmin)<|fim_prefix|># repo: stickwithjosh/hypodrical path: /apps/podcast/admin.py from apps...
code_fim
medium
{ "lang": "python", "repo": "stickwithjosh/hypodrical", "path": "/apps/podcast/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ('title', 'episode_number', 'pub_date') prepopulated_fields = {"slug": ("title",)} date_hierarchy = 'pub_date' admin.site.register(Episode, EpisodeAdmin)<|fim_prefix|># repo: stickwithjosh/hypodrical path: /apps/podcast/admin.py from apps.podcast.models import Podcast, Contri...
code_fim
medium
{ "lang": "python", "repo": "stickwithjosh/hypodrical", "path": "/apps/podcast/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: modin-project/modin path: /modin/core/dataframe/algebra/__init__.py # Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licen...
code_fim
medium
{ "lang": "python", "repo": "modin-project/modin", "path": "/modin/core/dataframe/algebra/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from .operator import Operator from .map import Map from .tree_reduce import TreeReduce from .reduce import Reduce from .fold import Fold from .binary import Binary from .groupby import GroupByReduce __all__ = [ "Operator", "Map", "TreeReduce", "Reduce", "Fold", "Binary", "Gro...
code_fim
medium
{ "lang": "python", "repo": "modin-project/modin", "path": "/modin/core/dataframe/algebra/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return (self.asn, self_node_id) < (other.asn, other_node_id) @property def _node_data(self): return self.nidb.raw_graph().node[self.node_id] def dump(self): # return str(self._node_data) import pprint pprint.pprint(self._node_data) def __nonzero__...
code_fim
hard
{ "lang": "python", "repo": "plucena24/autonetkit", "path": "/autonetkit/nidb/node.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: plucena24/autonetkit path: /autonetkit/nidb/node.py import functools import logging import string import autonetkit.log as log from autonetkit.log import CustomAdapter from autonetkit.nidb.config_stanza import ConfigStanza from autonetkit.nidb.interface import DmInterface import autonetkit.log a...
code_fim
hard
{ "lang": "python", "repo": "plucena24/autonetkit", "path": "/autonetkit/nidb/node.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Public function to view interfaces Temporary function name until Compiler/DeviceModel/Templates move to using "proper" interfaces""" def filter_func(interface): """Filter based on args and kwargs""" return ( all(getattr(interface,...
code_fim
hard
{ "lang": "python", "repo": "plucena24/autonetkit", "path": "/autonetkit/nidb/node.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mandarjoshi90/pair2vec path: /embeddings/representation.py import numpy as np import torch from torch.nn import Module, Linear, Dropout, Sequential, LSTM, Embedding, GRU, ReLU, Parameter from embeddings.util import masked_softmax from torch.autograd import Variable from torch.nn.init import xavie...
code_fim
hard
{ "lang": "python", "repo": "mandarjoshi90/pair2vec", "path": "/embeddings/representation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.contextualizer = LSTMContextualizer(config) if config.n_lstm_layers > 0 else lambda x : x self.dropout = Dropout(p=config.dropout) self.head_attention = Sequential(self.dropout, Linear(2 * config.d_lstm_hidden, 1)) self.head_transform = Sequential(self.dropout, Linear...
code_fim
hard
{ "lang": "python", "repo": "mandarjoshi90/pair2vec", "path": "/embeddings/representation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>sub(r'([%s])' % escape_chars, r'\\\1', text)<|fim_prefix|># repo: codebam/telegram-bot path: /modules/escape_markdown.py def escape_markdown(text): """Helper fu<|fim_middle|>nction to escape telegram markup symbols""" escape_chars = '\*_`\[' return re.
code_fim
medium
{ "lang": "python", "repo": "codebam/telegram-bot", "path": "/modules/escape_markdown.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: codebam/telegram-bot path: /modules/escape_markdown.py def escape_markdown(text): """Helper fu<|fim_suffix|> escape_chars = '\*_`\[' return re.sub(r'([%s])' % escape_chars, r'\\\1', text)<|fim_middle|>nction to escape telegram markup symbols"""
code_fim
easy
{ "lang": "python", "repo": "codebam/telegram-bot", "path": "/modules/escape_markdown.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: anhquannguyen21/Image-Processing path: /Source/FreiChen.py import numpy as np import cv2 from matplotlib import pyplot as plt from convolve_np import convolve_np img = cv2.imread('images/jet.jpg', cv2.IMREAD_GRAYSCALE) height = img.shape[0] width = img.shape[1] Hx = 1.0/(2+np.sqrt(2)...
code_fim
medium
{ "lang": "python", "repo": "anhquannguyen21/Image-Processing", "path": "/Source/FreiChen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>img_out = np.sqrt(np.power(img_x, 2) + np.power(img_y, 2)) img_out = (img_out / np.max(img_out)) * 255 cv2.imwrite('images/edge_FreiChen.jpg', img_out) plt.imshow(img_out, cmap = 'gray', interpolation = 'bicubic') plt.xticks([]), plt.yticks([]) plt.show()<|fim_prefix|># repo: anhquannguyen21/Image-Pr...
code_fim
hard
{ "lang": "python", "repo": "anhquannguyen21/Image-Processing", "path": "/Source/FreiChen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Hy = 1.0/(2+np.sqrt(2))*np.array([[-1, -np.sqrt(2), -1], [0, 0, 0], [1, np.sqrt(2), 1]]) img_x = convolve_np(img, Hx) img_y = convolve_np(img, Hy) img_out = np.sqrt(np.power(img_x, 2) + np.power(img_y, 2)) img_out = (img_out / np.max(img_out)) * 255 cv2.imwrite('...
code_fim
medium
{ "lang": "python", "repo": "anhquannguyen21/Image-Processing", "path": "/Source/FreiChen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_user_username'), table_name='user') op.alter_column( 'user', 'username', existing_type=mysql.VARCHAR(length=64), nullable=True ) op.alter_column( 'user', 'sex', existing_type=mysql.VARC...
code_fim
hard
{ "lang": "python", "repo": "chinese-bbb/web-backend", "path": "/migration-dev/versions/2c3c245b5ea6_add_flask_user_required_field.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chinese-bbb/web-backend path: /migration-dev/versions/2c3c245b5ea6_add_flask_user_required_field.py """ add flask_user required field. Revision ID: 2c3c245b5ea6 Revises: Create Date: 2019-09-08 18:06:57.170638 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import mys...
code_fim
hard
{ "lang": "python", "repo": "chinese-bbb/web-backend", "path": "/migration-dev/versions/2c3c245b5ea6_add_flask_user_required_field.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }