text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID" os.environ['CUDA_VISIBLE_DEVICES']='0,1,2,3,4,5,6,7,8' # load train dataset data = load_coco_data(data_path='./data', split='train') word_to_idx = data['word_to_idx'] # load val dataset to print out bleu scores every epoch val_dat...
code_fim
hard
{ "lang": "python", "repo": "Mogbo/image-caption", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucasdavid/unicamp-ia004-neural-networks-2 path: /tasks/assignment-1/algorithms/extreme.py import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from sklearn.utils import check_random_state <|fim_suffix|> return self.n_features_ def fit(self, X, y=None, **fit_pa...
code_fim
hard
{ "lang": "python", "repo": "lucasdavid/unicamp-ia004-neural-networks-2", "path": "/tasks/assignment-1/algorithms/extreme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.W_ = random.randn(n_input, n_output) return self def transform(self, X): return np.dot(X, self.W_)<|fim_prefix|># repo: lucasdavid/unicamp-ia004-neural-networks-2 path: /tasks/assignment-1/algorithms/extreme.py import numpy as np from sklearn.base import BaseEstimator, T...
code_fim
hard
{ "lang": "python", "repo": "lucasdavid/unicamp-ia004-neural-networks-2", "path": "/tasks/assignment-1/algorithms/extreme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.n_features_ is not None: return self.n_features_ if self.n_features == 'auto': self.n_features_ = 128 * n_input_features elif isinstance(self.n_features, int): self.n_features_ = self.n_features elif isinstance(self.n_features, f...
code_fim
hard
{ "lang": "python", "repo": "lucasdavid/unicamp-ia004-neural-networks-2", "path": "/tasks/assignment-1/algorithms/extreme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lpschaub/rasa path: /examples/utils.py from pprint import pprint import glob def concat_nlu(files, out): intents = {} for fic in files: streamin = open(fic,encoding="utf-8") current = "" for line <|fim_suffix|>pen('nlu.md','w', encoding='utf-8') intents = concat_nlu(files,out) for elem...
code_fim
hard
{ "lang": "python", "repo": "lpschaub/rasa", "path": "/examples/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> intents[current].append(line) return intents if __name__ == '__main__': files = ['trainpmc/data/nlu.md','testpmc/data/nlu.md','evalpmc/data/nlu.md'] out = open('nlu.md','w', encoding='utf-8') intents = concat_nlu(files,out) for elem in intents : out.write('\n'+elem) for intent in intents...
code_fim
medium
{ "lang": "python", "repo": "lpschaub/rasa", "path": "/examples/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pen('nlu.md','w', encoding='utf-8') intents = concat_nlu(files,out) for elem in intents : out.write('\n'+elem) for intent in intents[elem]: out.write(intent)<|fim_prefix|># repo: lpschaub/rasa path: /examples/utils.py from pprint import pprint import glob def concat_nlu(files, out): intents = ...
code_fim
medium
{ "lang": "python", "repo": "lpschaub/rasa", "path": "/examples/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Solution(object): def findNumberOfLIS(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: return 0 l = [1 for i in xrange(len(nums))] c = [1 for i in xrange(len(nums))] max_l = 1 for i in...
code_fim
hard
{ "lang": "python", "repo": "sugia/leetcode", "path": "/Number of Longest Increasing Subsequence.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sugia/leetcode path: /Number of Longest Increasing Subsequence.py ''' Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Input: [1,3,5,4,7] Output: 2 Explanation: The two longest increasing subsequence are [1, 3, 4, 7] and [1, 3, 5, 7]. Example ...
code_fim
hard
{ "lang": "python", "repo": "sugia/leetcode", "path": "/Number of Longest Increasing Subsequence.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> res = 0 for i in xrange(len(nums)): if l[i] == max_l: res += c[i] return res<|fim_prefix|># repo: sugia/leetcode path: /Number of Longest Increasing Subsequence.py ''' Given an unsorted array of integers, find the number of longest inc...
code_fim
hard
{ "lang": "python", "repo": "sugia/leetcode", "path": "/Number of Longest Increasing Subsequence.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>command( 'reset_user_pin', "Sets the user PIN and unblocks it (if blocked) as well as resets the " "retry counter." ) class CmdLoop(cmd.Cmd): """ ykneo-bitcoin command line utility. """ intro = "ykneo-bitcoin command line utility." def __init__(self, neo): cmd....
code_fim
hard
{ "lang": "python", "repo": "paycoin-com/yubico-bitcoin-python", "path": "/scripts/ykneo-bitcoin-cli", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def do_set_pin(self, line): args = commands['set_pin'].parse_args(line.split()) print "Set %s PIN." % ('admin' if args.admin else 'user') old_pin = getpass("Enter current PIN:") new_pin = getpass("Enter new PIN:") ver_pin = getpass("Re-enter new PIN:") i...
code_fim
hard
{ "lang": "python", "repo": "paycoin-com/yubico-bitcoin-python", "path": "/scripts/ykneo-bitcoin-cli", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: paycoin-com/yubico-bitcoin-python path: /scripts/ykneo-bitcoin-cli #!/usr/bin/python # Copyright (c) 2013 Yubico AB # All rights reserved. # # Redistribution and use in source and binary forms, with or # without modification, are permitted provided that the following # conditions are met: #...
code_fim
hard
{ "lang": "python", "repo": "paycoin-com/yubico-bitcoin-python", "path": "/scripts/ykneo-bitcoin-cli", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _generate_fun(self, name, specstr, resname, specnames, docodeinserts=False): """Generate string with Python code for function `name`""" fdef = self._fn_template.format( name=name, start=self._format_user_code(self.opts['start']) if docodeinserts else '', ...
code_fim
hard
{ "lang": "python", "repo": "mdlama/pydstool", "path": "/PyDSTool/core/codegenerators/python.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdlama/pydstool path: /PyDSTool/core/codegenerators/python.py 'xjac', specvars) # check Jacobian m = n = len(specvars) specdict_check = {}.fromkeys(specvars) for specname in specvars: ...
code_fim
hard
{ "lang": "python", "repo": "mdlama/pydstool", "path": "/PyDSTool/core/codegenerators/python.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __generate_builtin_aux(self): # Deal with built-in auxiliary functions (don't make their names unique) # In this version, the textual code here doesn't get executed. Only # the function names in the second position of the tuple are needed. # Later, the text will pro...
code_fim
hard
{ "lang": "python", "repo": "mdlama/pydstool", "path": "/PyDSTool/core/codegenerators/python.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: youngjung/TTUR path: /precalc_stats_folder.py #!/usr/bin/env python3 import os import glob import numpy as np from scipy.misc import imread import tensorflow as tf import fid def run_for_folder(dir_images, fname_output): # if you have downloaded and extracted # http://download.tens...
code_fim
hard
{ "lang": "python", "repo": "youngjung/TTUR", "path": "/precalc_stats_folder.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with tf.Session() as sess: sess.run(tf.global_variables_initializer()) mu, sigma = fid.calculate_activation_statistics(images, sess, batch_size=100) np.savez_compressed(fname_output, mu=mu, sigma=sigma) if __name__ == '__main__': import fire fire.Fire(run_for_folder)<...
code_fim
hard
{ "lang": "python", "repo": "youngjung/TTUR", "path": "/precalc_stats_folder.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>"""%s %z""" % ("hello", "world") # [bad-format-character] """%s""" """%z""" % ("hello", "world") # [bad-format-character] ## New style formatting "{:s} {:y}".format("hello", "world") # [bad-format-character] "{:*^30s}".format("centered") ## f-strings H, W = "hello", "world" f"{H} {W}" f"{H:s} {W:...
code_fim
medium
{ "lang": "python", "repo": "astral-sh/ruff", "path": "/crates/ruff/resources/test/fixtures/pylint/bad_string_format_character.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: astral-sh/ruff path: /crates/ruff/resources/test/fixtures/pylint/bad_string_format_character.py # pylint: disable=missing-docstring,consider-using-f-string, pointless-statement ## Old style formatting "%s %z" % ("hello", "world") # [bad-format-character] "%s" "%z" % ("hello", "world") # [bad...
code_fim
medium
{ "lang": "python", "repo": "astral-sh/ruff", "path": "/crates/ruff/resources/test/fixtures/pylint/bad_string_format_character.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lpetrovic/graphIK path: /tests/test_spherical_to_revolute.py """ Test the method that converts a spherical chain to a revolute chain. Mostly checking forward kinematics. """ import numpy as np import time import unittest import networkx as nx from graphik.solvers.local_solver import LocalSolver ...
code_fim
hard
{ "lang": "python", "repo": "lpetrovic/graphIK", "path": "/tests/test_spherical_to_revolute.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for _ in range(n_runs): input_list = list(np.random.rand(2 * n)) poses = {} input_pairs = list_to_variable_dict_spherical(input_list, in_pairs=True) for key in input_pairs: poses[key] = robot.get_pose(input_pairs, key) # ...
code_fim
hard
{ "lang": "python", "repo": "lpetrovic/graphIK", "path": "/tests/test_spherical_to_revolute.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DaphneHB/IdentitesNommees path: /src/pdf_ocr_img.py # -*- coding: utf-8 -*- """ Created on Thu Jun 23 10:14:57 2016 @author: daphnehb """ """ Tests de lecture de PDF avec le traitement d'image """ IMNAME = "data/input/img-160302152757.png" FNAME = "data/input/air france.pdf" import sys def ro...
code_fim
hard
{ "lang": "python", "repo": "DaphneHB/IdentitesNommees", "path": "/src/pdf_ocr_img.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def usage_exit(): sys.exit("Usage: %s png_resolution pdffile1 pdffile2 ..." % os.path.basename(sys.argv[0])) def gs_pdf_to_png(pdffilepath, resolution): if not os.path.isfile(pdffilepath): print "'%s' is not a file. Skip." % pdffilepath pdffiledir = os.path.dirname(p...
code_fim
hard
{ "lang": "python", "repo": "DaphneHB/IdentitesNommees", "path": "/src/pdf_ocr_img.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kgermando/e-s path: /produits/urls.py from django.urls import path from produits.views import produits_view, products_detail <|fim_suffix|>urlpatterns = [ path('', produits_view, name='produits'), path('produit_detail/<slug:slug>/', products_detail, name='product_detail'), path('pro...
code_fim
easy
{ "lang": "python", "repo": "Kgermando/e-s", "path": "/produits/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ path('', produits_view, name='produits'), path('produit_detail/<slug:slug>/', products_detail, name='product_detail'), path('produit_detail/<int:id>/', products_detail, name='product_detail_id'), ]<|fim_prefix|># repo: Kgermando/e-s path: /produits/urls.py from django.urls imp...
code_fim
easy
{ "lang": "python", "repo": "Kgermando/e-s", "path": "/produits/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bung87/nim-pymod path: /examples/002-PyArrayIterators-addValToEach/test_addval.py # Copyright (c) 2015 SnapDisco Pty Ltd, Australia. # All rights reserved. # # This source code is licensed under the terms of the MIT license # found in the "LICENSE" file in the root directory of this source tree....
code_fim
medium
{ "lang": "python", "repo": "bung87/nim-pymod", "path": "/examples/002-PyArrayIterators-addValToEach/test_addval.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> FUNCS_TO_RUN2 = [ ("addValEachDelta1", av.addValEachDelta1), ("addValEachDelta2", av.addValEachDelta2), ("addValEachDelta3", av.addValEachDelta3), ("addValEachDelta4", av.addValEachDelta4), ] for name, func in FUNCS_TO_RUN2: print("\n%s:\nInput array =" % name) a ...
code_fim
hard
{ "lang": "python", "repo": "bung87/nim-pymod", "path": "/examples/002-PyArrayIterators-addValToEach/test_addval.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arpruss/raspberryjammod-minetest path: /raspberryjammod/mcpipy/stuffaboutcode_bridge.py #!/usr/bin/env python #www.stuffaboutcode.com #Raspberry Pi, Minecraft - auto bridge # mcpipy.com retrieved from URL below, written by stuffaboutcode # http://www.stuffaboutcode.com/2013/02/raspberry-pi-mine...
code_fim
hard
{ "lang": "python", "repo": "arpruss/raspberryjammod-minetest", "path": "/raspberryjammod/mcpipy/stuffaboutcode_bridge.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Find the difference between the player's position and the last position movementX = lastPlayerPos.x - playerPos.x movementZ = lastPlayerPos.z - playerPos.z #Has the player moved more than 0.2 in any horizontal (x,z) direction if ((movementX < -0.2) or (movementX ...
code_fim
hard
{ "lang": "python", "repo": "arpruss/raspberryjammod-minetest", "path": "/raspberryjammod/mcpipy/stuffaboutcode_bridge.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> frontier = extract_important_words(dicgtionary[word]) #firest level for element in frontier: path = [] if element == root: return [word] found = find_path(dictionary,root,path) if len(found) > 0: print("found", found.join('->')) def find_all...
code_fim
hard
{ "lang": "python", "repo": "ChuckCottrill/CodeSamples", "path": "/python/alexa-ai-test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for word,_ in dictionary: found = find_circular(dictionary,word) if len(found) > 0: circular[word] = found # 1. ['oak -> acorn -> oak'] # 2. number of circular definitions<|fim_prefix|># repo: ChuckCottrill/CodeSamples path: /python/alexa-ai-test.py ''' Prompt: A circula...
code_fim
hard
{ "lang": "python", "repo": "ChuckCottrill/CodeSamples", "path": "/python/alexa-ai-test.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ChuckCottrill/CodeSamples path: /python/alexa-ai-test.py ''' Prompt: A circular definition is one that uses the term being defined as part of the definition. For example, define “oak” : “a tree that grows from an acorn” “acorn” : “the nut produced by an oak tree”. acorn = nut, produced, oak-...
code_fim
hard
{ "lang": "python", "repo": "ChuckCottrill/CodeSamples", "path": "/python/alexa-ai-test.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def confluence_url(agency_cd, content_type): """ Return confluence url containing information for the agency and content type :param str agency_cd: :param str content_type: :rtype str """ return '{0}createrssfeed.action?types=page&spaces=GWDataPortal&title=X&labelString=ngwmn_p...
code_fim
hard
{ "lang": "python", "repo": "abriggs-usgs/ngwmn-ui", "path": "/server/ngwmn/services/confluence.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abriggs-usgs/ngwmn-ui path: /server/ngwmn/services/confluence.py """ Functions for accessing information from a confluence RSS feed """ from bs4 import BeautifulSoup import feedparser from ngwmn import app def pull_feed(feed_url): """ pull page data from a my.usgs.gov confluence wiki f...
code_fim
hard
{ "lang": "python", "repo": "abriggs-usgs/ngwmn-ui", "path": "/server/ngwmn/services/confluence.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Return confluence url containing information for the agency and content type :param str agency_cd: :param str content_type: :rtype str """ return '{0}createrssfeed.action?types=page&spaces=GWDataPortal&title=X&labelString=ngwmn_provider_{1}_{2}&amp;excludedSpaceKeys%3D&sort...
code_fim
medium
{ "lang": "python", "repo": "abriggs-usgs/ngwmn-ui", "path": "/server/ngwmn/services/confluence.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bobenzym/isaac-consensus-protocol path: /src/bos_consensus/common/message.py import copy import lorem import json from bos_consensus.util import get_uuid class Message: message_id = None data = None def __init__(self, message_id, data): self.message_id = message_id ...
code_fim
medium
{ "lang": "python", "repo": "Bobenzym/isaac-consensus-protocol", "path": "/src/bos_consensus/common/message.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return cls( get_uuid(), data=data, ) @classmethod def from_string(cls, s): o = json.loads(s) return cls( o['message_id'], o['data'], ) @classmethod def from_dict(cls, o): return cls( ...
code_fim
hard
{ "lang": "python", "repo": "Bobenzym/isaac-consensus-protocol", "path": "/src/bos_consensus/common/message.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print(f'asdfs{name}') @my_decorator def test2(name): print(f'asdfs{name}') namens_laenge = tester(name='bwu') print(namens_laenge) namens_laenge = tester(name='wu') print(namens_laenge) 'asdfsadf' "asd'fasd'f"<|fim_prefix|># repo: foosinn/slides path: /python-starter/addons/decora...
code_fim
hard
{ "lang": "python", "repo": "foosinn/slides", "path": "/python-starter/addons/decorator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: foosinn/slides path: /python-starter/addons/decorator.py from functools import wraps def my_decorator(my_func): print(f'starting for {my_func.__name__}') @wraps(my_func) def wrapper(*args, **kwargs): kwargs['name'] = "w_" + kwargs['name'] if not kwargs['name'].startsw...
code_fim
medium
{ "lang": "python", "repo": "foosinn/slides", "path": "/python-starter/addons/decorator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lebrice/SimpleParsing path: /simple_parsing/helpers/hparams/priors.py import math import random from abc import abstractmethod from dataclasses import dataclass from typing import ( Any, Generic, List, Optional, Sequence, Tuple, TypeVar, Union, overload, ) imp...
code_fim
hard
{ "lang": "python", "repo": "lebrice/SimpleParsing", "path": "/simple_parsing/helpers/hparams/priors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def sample(self) -> float: # TODO: Might not be 100% numerically stable. assert self.min > 0, "min of LogUniform can't be negative!" assert self.min < self.max, "max should be greater than min!" if self.shape: assert isinstance(self.shape, int), "only suppor...
code_fim
hard
{ "lang": "python", "repo": "lebrice/SimpleParsing", "path": "/simple_parsing/helpers/hparams/priors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: github/incubator-airflow path: /tests/api_connexion/schemas/test_event_log_schema.py # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership....
code_fim
hard
{ "lang": "python", "repo": "github/incubator-airflow", "path": "/tests/api_connexion/schemas/test_event_log_schema.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class TestEventLogSchema(TestEventLogSchemaBase): @provide_session def test_serialize(self, session): event_log_model = Log(event="TEST_EVENT", task_instance=self._create_task_instance()) session.add(event_log_model) session.commit() event_log_model.dttm = timezone...
code_fim
hard
{ "lang": "python", "repo": "github/incubator-airflow", "path": "/tests/api_connexion/schemas/test_event_log_schema.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def save_project(self): self.save() @classmethod def search_project(cls,search_term): projects = cls.objects.filter(title__icontains=search_term) return projects class Rating(models.Model): design = models.IntegerField(blank=True,default=0) usability = m...
code_fim
hard
{ "lang": "python", "repo": "markmumba/Awards", "path": "/award/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: markmumba/Awards path: /award/models.py from django.db import models from django.contrib.auth.models import User from tinymce.models import HTMLField import datetime as dt # Create your models here. class Profile(models.Model): profpic = models.ImageField(upload_to='profpics/') bio = HTM...
code_fim
medium
{ "lang": "python", "repo": "markmumba/Awards", "path": "/award/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> design = models.IntegerField(blank=True,default=0) usability = models.IntegerField(blank=True,default=0) content = models.IntegerField(blank=True,default=0) overall_rating = models.IntegerField(blank=True,default=0) project = models.ForeignKey(Project,on_delete=models.CASCADE) prof...
code_fim
hard
{ "lang": "python", "repo": "markmumba/Awards", "path": "/award/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for x in range(360): fred.pu() fred.goto(0,0) fred.pd() for y in range(200): fred.fd(y) fred.left(x)<|fim_prefix|># repo: jeremiahmarks/dangerzone path: /scripts/python/turtleRelated/fvh1.py import turtle import fvh <|fim_middle|> fred=turtle.Turtle() def a(fred):
code_fim
easy
{ "lang": "python", "repo": "jeremiahmarks/dangerzone", "path": "/scripts/python/turtleRelated/fvh1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jeremiahmarks/dangerzone path: /scripts/python/turtleRelated/fvh1.py import turtle import fvh <|fim_suffix|> for x in range(360): fred.pu() fred.goto(0,0) fred.pd() for y in range(200): fred.fd(y) fred.left(x)<|fim_middle|> fred=turtle.Turtle() def a(fred):
code_fim
easy
{ "lang": "python", "repo": "jeremiahmarks/dangerzone", "path": "/scripts/python/turtleRelated/fvh1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aswolf/xtalsim path: /xtalsim/eos.py """ eos - xtalsim subpackage for evaluating equations of state """ import numpy as np from scipy import optimize as optim import const <|fim_suffix|> def inv_log_eos_P(P, eos_coeff, logVref): Vbnds = np.exp(logVref+np.array([-.3, .3])) def calcPdif...
code_fim
hard
{ "lang": "python", "repo": "aswolf/xtalsim", "path": "/xtalsim/eos.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Vbnds = np.exp(logVref+np.array([-.3, .3])) def calcPdiff(V): return log_eos_P(V, eos_coeff, logVref)-P return optim.brentq(calcPdiff, Vbnds[0], Vbnds[1])<|fim_prefix|># repo: aswolf/xtalsim path: /xtalsim/eos.py """ eos - xtalsim subpackage for evaluating equations of state """ <|fim_mid...
code_fim
hard
{ "lang": "python", "repo": "aswolf/xtalsim", "path": "/xtalsim/eos.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Anurag810/frappe path: /frappe/utils/jinja_globals.py # Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE def resolve_class(classes): if classes is None: return "" if isinstance(classes, str): return classes if isinstance(classes, (list, tup...
code_fim
hard
{ "lang": "python", "repo": "Anurag810/frappe", "path": "/frappe/utils/jinja_globals.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def bundled_asset(path, rtl=None): from frappe.utils import get_assets_json from frappe.website.utils import abs_url if ".bundle." in path and not path.startswith("/assets"): bundled_assets = get_assets_json() if path.endswith('.css') and is_rtl(rtl): path = f"rtl_{path}" path = bundled_asset...
code_fim
hard
{ "lang": "python", "repo": "Anurag810/frappe", "path": "/frappe/utils/jinja_globals.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mibBuilder.loadTexts: zyIgmpSnoopingRecordPort.setStatus('current') zyIgmpSnoopingRecordGroup = MibTableColumn((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 31, 2, 1, 1, 4), IpAddress()) if mibBuilder.loadTexts: zyIgmpSnoopingRecordGroup.setStatus('current') zyIgmpSnoopingRecordTimeout = MibTableColumn((1, 3, 6, 1, ...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/ZYXEL-IGMP-SNOOPING-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/ZYXEL-IGMP-SNOOPING-MIB.py 3, 31, 2, 4, 1), ).setIndexNames((0, "ZYXEL-IGMP-SNOOPING-MIB", "zyIgmpSnoopingCountVlanVid")) if mibBuilder.loadTexts: zyxelIgmpSnoopingCountVlanEntry.setStatus('current') zyIgmpSnoopingCountVlanVid = MibTableColumn((1, 3, 6...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/ZYXEL-IGMP-SNOOPING-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>1, 890, 1, 15, 3, 31, 2, 2), ) if mibBuilder.loadTexts: zyxelIgmpSnoopingInfoVlanTable.setStatus('current') zyxelIgmpSnoopingInfoVlanEntry = MibTableRow((1, 3, 6, 1, 4, 1, 890, 1, 15, 3, 31, 2, 2, 1), ).setIndexNames((0, "ZYXEL-IGMP-SNOOPING-MIB", "zyIgmpSnoopingInfoVlanVid")) if mibBuilder.loadTexts: zyx...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/ZYXEL-IGMP-SNOOPING-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MKuranowski/WarsawGTFS path: /static/shapes/const.py from ..const import _BASE_GIST # Shape-generation external data GIST_OVERRIDE_RATIOS = _BASE_GIST + "shapes_override_ratios.json" GIST_FORCE_VIA = _BASE_GIST + "shapes_force_via.json" # Bus router settings BUS_ROUTER_SETTINGS = { "weights...
code_fim
hard
{ "lang": "python", "repo": "MKuranowski/WarsawGTFS", "path": "/static/shapes/const.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>OVERPASS_BUS_GRAPH = f''' [bbox:51.9144,20.4438,52.5007,21.4844][out:xml]; ( way["highway"="motorway"]; way["highway"="motorway_link"]; way["highway"="trunk"]; way["highway"="trunk_link"]; way["highway"="primary"]; way["highway"="primary_link"]; way["highway"="secondary"]; ...
code_fim
hard
{ "lang": "python", "repo": "MKuranowski/WarsawGTFS", "path": "/static/shapes/const.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: semplea/characters-meta path: /python/alchemy/examples/relationship_extraction_v1_beta.py import json from watson_developer_cloud import RelationshipExtractionV1Beta <|fim_suffix|>print(json.dumps(relationship_extraction.extract("Hello from IBM Watson", return_type='json'), indent=2))<|fim_midd...
code_fim
medium
{ "lang": "python", "repo": "semplea/characters-meta", "path": "/python/alchemy/examples/relationship_extraction_v1_beta.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(json.dumps(relationship_extraction.extract("Hello from IBM Watson", return_type='json'), indent=2))<|fim_prefix|># repo: semplea/characters-meta path: /python/alchemy/examples/relationship_extraction_v1_beta.py import json from watson_developer_cloud import RelationshipExtractionV1Beta <|fim_middl...
code_fim
medium
{ "lang": "python", "repo": "semplea/characters-meta", "path": "/python/alchemy/examples/relationship_extraction_v1_beta.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def m_menuItem_file_playernameOnMenuSelection(self, event): # TODO: Add dialog box to enter a new player name self.user_settings = blrtk.get_user_config() event.Skip() def m_menuItem_file_clearloadoutsOnMenuSelection(self, event): # TODO: Add dialog box to confirm ...
code_fim
hard
{ "lang": "python", "repo": "daakru/BLReLM", "path": "/blrevive_loadout_manager.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daakru/BLReLM path: /blrevive_loadout_manager.py the Muzzles self.listctrl_load_columns(self.muzzle_columns) # Load Items for idx, item in enumerate(self.temp_muzzles): self.m_listCtrl_blrlm_selector.Append([item]) self.m_listCtrl_blrlm_selector.S...
code_fim
hard
{ "lang": "python", "repo": "daakru/BLReLM", "path": "/blrevive_loadout_manager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daakru/BLReLM path: /blrevive_loadout_manager.py g.GetValue(): self.handle_gear_toggle('m_bmToggleBtn_blrlm_tag') else: self.m_bmToggleBtn_blrlm_tag.SetValue(True) event.Skip() def m_bmToggleBtn_blrlm_camoOnToggleButton(self, event): if self.m_...
code_fim
hard
{ "lang": "python", "repo": "daakru/BLReLM", "path": "/blrevive_loadout_manager.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.data<|fim_prefix|># repo: rueedlinger/vue-connect path: /vue-connect-api/tests/__init__.py class MockResp: def __init__(self, data=[], status_code=200): self.data = data self.status_code = status_code <|fim_middle|> def json(self):
code_fim
easy
{ "lang": "python", "repo": "rueedlinger/vue-connect", "path": "/vue-connect-api/tests/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rueedlinger/vue-connect path: /vue-connect-api/tests/__init__.py class MockResp: def __init__(self, data=[], status_code=200): <|fim_suffix|> return self.data<|fim_middle|> self.data = data self.status_code = status_code def json(self):
code_fim
medium
{ "lang": "python", "repo": "rueedlinger/vue-connect", "path": "/vue-connect-api/tests/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # disable pytest warnings plugin in order to keep our own warning logging # we might want to remove this one config.pluginmanager.set_blocked('warnings') # also disable the pytest logging system since its triggering issues with our own config.pluginmanager.set_blocked('logging-plugin')...
code_fim
medium
{ "lang": "python", "repo": "Kiali-QE/kiali-qe-python", "path": "/kiali_qe/tests/conftest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kiali-QE/kiali-qe-python path: /kiali_qe/tests/conftest.py import urllib3 # disable InsecureRequestWarning, # https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings urllib3.disable_warnings(category=urllib3.exceptions.InsecureRequestWarning) <|fim_suffix|>pytest_plugins = ( ...
code_fim
hard
{ "lang": "python", "repo": "Kiali-QE/kiali-qe-python", "path": "/kiali_qe/tests/conftest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if tag == "tr": r = [el.strip() for el in self.row] if self.debug: print("Leaving the row :", tag) print(r) d = dict(zip(EVENT_COLUMNS, r)) self.all_rows.append(d) self.row = None def handle_data(self,...
code_fim
hard
{ "lang": "python", "repo": "robandrews/owgr_client", "path": "/src/owgr_client/html_parsers/events_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: robandrews/owgr_client path: /src/owgr_client/html_parsers/events_parser.py from html.parser import HTMLParser from owgr_client.constants import EVENT_COLUMNS from owgr_client.helpers import is_str_blank from owgr_client.helpers import get_id_from_player_url from owgr_client.helpers import clean...
code_fim
hard
{ "lang": "python", "repo": "robandrews/owgr_client", "path": "/src/owgr_client/html_parsers/events_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nemec/Automaton path: /automaton/lib/autoplatform.py import platform as pl import os # pylint: disable-msg=C0103 # This module deals with platform-specific paths # Set the platform we are currently running on if pl.system().lower().startswith('windows'): platform = 'windows' elif pl.system()....
code_fim
hard
{ "lang": "python", "repo": "nemec/Automaton", "path": "/automaton/lib/autoplatform.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_existing_file(filename, strict=False): """ Searches through the directory hierarchy for a file/path named "filename" If 'strict' is false, it returns a path where the file can be placed if there is no existing file. If 'strict' is true, returns None there is no existing file. """ pa...
code_fim
hard
{ "lang": "python", "repo": "nemec/Automaton", "path": "/automaton/lib/autoplatform.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return contract(contract_address) return fn @pytest.fixture def deploy_tester_contract_txhash( web3: Web3, contracts_manager: ContractManager, deploy_contract_txhash: Callable ) -> Callable: """Returns a function that can be used to deploy a named contract, but returning txhash ...
code_fim
hard
{ "lang": "python", "repo": "LefterisJP/raiden-contracts", "path": "/raiden_contracts/tests/fixtures/contracts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> web3: Web3, contracts_manager: ContractManager, deploy_contract_txhash: Callable ) -> Callable: """Returns a function that can be used to deploy a named contract, but returning txhash only""" def f(contract_name: str, **kwargs: Dict) -> str: json_contract = contracts_manager.get_c...
code_fim
hard
{ "lang": "python", "repo": "LefterisJP/raiden-contracts", "path": "/raiden_contracts/tests/fixtures/contracts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LefterisJP/raiden-contracts path: /raiden_contracts/tests/fixtures/contracts.py import logging from typing import Callable, Dict, List import pytest from eth_tester.exceptions import TransactionFailed from eth_typing import HexAddress from web3 import Web3 from web3.contract import Contract fro...
code_fim
hard
{ "lang": "python", "repo": "LefterisJP/raiden-contracts", "path": "/raiden_contracts/tests/fixtures/contracts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scottjr632/trump-twitter-bot path: /app/bot.py import json import logging import re from typing import List import requests from apscheduler.schedulers.background import BackgroundScheduler from bs4 import BeautifulSoup from .models import Tweet from .auth import Authentication JSON_MATCHER =...
code_fim
hard
{ "lang": "python", "repo": "scottjr632/trump-twitter-bot", "path": "/app/bot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__(*args, **kwargs) class TrumpBotScheduler(TrumpBot, BackgroundScheduler): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def __add_trump_bot_jobs__(self, seconds, **kwargs): """ Adds the jobs for the trump bot. Ca...
code_fim
hard
{ "lang": "python", "repo": "scottjr632/trump-twitter-bot", "path": "/app/bot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Can be overwriten to include other jobs. """ self.add_job(self.send_latest_tweets, 'interval', seconds=seconds, max_instances=1, **kwargs) self.add_job(self.resend_bad_tweets, 'interval', seconds=seconds*2, max_instances=1, **kwargs) logging.info('Added send_latest_tweets ...
code_fim
hard
{ "lang": "python", "repo": "scottjr632/trump-twitter-bot", "path": "/app/bot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def check_os_version(): """ Check the RHEL minor version and inhibit the upgrade if it does not match the supported ones """ if not version.is_supported_version(): supported_releases = [] for rel in version.SUPPORTED_VERSIONS: for ver in version.SUPPORTED_VERSIONS[rel]:...
code_fim
hard
{ "lang": "python", "repo": "oamg/leapp-repository", "path": "/repos/system_upgrade/common/actors/checkosrelease/libraries/checkosrelease.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: oamg/leapp-repository path: /repos/system_upgrade/common/actors/checkosrelease/libraries/checkosrelease.py import os from leapp import reporting from leapp.libraries.common.config import version COMMON_REPORT_TAGS = [reporting.Groups.SANITY] related = [reporting.RelatedResource('file', '/etc/o...
code_fim
hard
{ "lang": "python", "repo": "oamg/leapp-repository", "path": "/repos/system_upgrade/common/actors/checkosrelease/libraries/checkosrelease.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return True return False def check_os_version(): """ Check the RHEL minor version and inhibit the upgrade if it does not match the supported ones """ if not version.is_supported_version(): supported_releases = [] for rel in version.SUPPORTED_VERSIONS: for ...
code_fim
hard
{ "lang": "python", "repo": "oamg/leapp-repository", "path": "/repos/system_upgrade/common/actors/checkosrelease/libraries/checkosrelease.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert type(fit_dist_all()) is pandas.core.frame.DataFrame<|fim_prefix|># repo: jJasonWang/mousestyles path: /mousestyles/tests/test_est_power_param.py from __future__ import (absolute_import, division, print_function, unicode_literals) import pandas from mousestyles.est_powe...
code_fim
medium
{ "lang": "python", "repo": "jJasonWang/mousestyles", "path": "/mousestyles/tests/test_est_power_param.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jJasonWang/mousestyles path: /mousestyles/tests/test_est_power_param.py from __future__ import (absolute_import, division, print_function, unicode_literals) import pandas from mousestyles.est_power_param import (fit_powerlaw, fit_exponential, ...
code_fim
medium
{ "lang": "python", "repo": "jJasonWang/mousestyles", "path": "/mousestyles/tests/test_est_power_param.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def test_fit_dist_all(): assert type(fit_dist_all()) is pandas.core.frame.DataFrame<|fim_prefix|># repo: jJasonWang/mousestyles path: /mousestyles/tests/test_est_power_param.py from __future__ import (absolute_import, division, print_function, unicode_literals) import pandas ...
code_fim
medium
{ "lang": "python", "repo": "jJasonWang/mousestyles", "path": "/mousestyles/tests/test_est_power_param.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/iosxe/tests/ShowSdwanPolicyAccessListAssociations/cli/equal/golden_output_expected.py expected_output={'name': {'acl-v4': {'interface_direction': {'in': {'interface_name': ['TenGigabitEthernet0/0/2.1<|fim_suffix|>, 'acl-v4-app...
code_fim
hard
{ "lang": "python", "repo": "CiscoTestAutomation/genieparser", "path": "/src/genie/libs/parser/iosxe/tests/ShowSdwanPolicyAccessListAssociations/cli/equal/golden_output_expected.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> 'out': {'interface_name': ['TenGigabitEthernet0/0/0.1002']}}}}}<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/iosxe/tests/ShowSdwanPolicyAccessListAssociations/cli/equal/golden_output_expected.py expected_output={'name...
code_fim
hard
{ "lang": "python", "repo": "CiscoTestAutomation/genieparser", "path": "/src/genie/libs/parser/iosxe/tests/ShowSdwanPolicyAccessListAssociations/cli/equal/golden_output_expected.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('app', '0004_app_push_key'), ] operations = [ migrations.CreateModel( name='ResponseLog', fields=[ ('id', models.AutoField(auto_created=True, verbose_name='ID', serialize=False, primary_key=True)), ('pla...
code_fim
hard
{ "lang": "python", "repo": "mobdim/vialer-middleware", "path": "/app/migrations/0005_responselog.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mobdim/vialer-middleware path: /app/migrations/0005_responselog.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations <|fim_suffix|> dependencies = [ ('app', '0004_app_push_key'), ] operations = [ migrations.Crea...
code_fim
hard
{ "lang": "python", "repo": "mobdim/vialer-middleware", "path": "/app/migrations/0005_responselog.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("command", help='train/train_mix/eval_mismatch/eval_pic') parser.add_argument("-ct", '--channel_type', help="awgn/slow_fading/slow_fading_eq") parser.add_argument("-md", '--model_dir', help="dir for model", d...
code_fim
hard
{ "lang": "python", "repo": "qlstn9150/ADJSCC", "path": "/bdjscc_imagenet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qlstn9150/ADJSCC path: /bdjscc_imagenet.py from util_channel import Channel from util_module import Basic_Encoder, Basic_Decoder from tensorflow.keras.layers import Input, Lambda from tensorflow.keras import Model from tensorflow.keras.optimizers import Adam from tensorflow.keras.callbacks import...
code_fim
hard
{ "lang": "python", "repo": "qlstn9150/ADJSCC", "path": "/bdjscc_imagenet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: o19s/hello-ltr path: /ltr/helpers/solr_escape.py def esc_kw(kw): """ Take a keyword and escape all the Solr parts we want to escape!""" kw = kw.replace('\\', '\\\\') # be sure to do<|fim_suffix|>*', '\*') kw = kw.replace('?', '\?') kw = kw.replace('{', '\{') kw = kw.re...
code_fim
hard
{ "lang": "python", "repo": "o19s/hello-ltr", "path": "/ltr/helpers/solr_escape.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>*', '\*') kw = kw.replace('?', '\?') kw = kw.replace('{', '\{') kw = kw.replace('}', '\}') kw = kw.replace('~', '\~') return kw<|fim_prefix|># repo: o19s/hello-ltr path: /ltr/helpers/solr_escape.py def esc_kw(kw): """ Take a keyword and escape all the Solr parts we want ...
code_fim
medium
{ "lang": "python", "repo": "o19s/hello-ltr", "path": "/ltr/helpers/solr_escape.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wilbertgeng/LintCode_exercise path: /Tree_Divide&Conquer/88.py """88. Lowest Common Ancestor of a Binary Tree Assume two nodes are exist in tree.""" """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ cla...
code_fim
hard
{ "lang": "python", "repo": "wilbertgeng/LintCode_exercise", "path": "/Tree_Divide&Conquer/88.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ## if not root: return None if root == A or root == B: return root left = self.lowestCommonAncestor(root.left, A, B) right = self.lowestCommonAncestor(root.right, A, B) if left and right: return root if left or ...
code_fim
hard
{ "lang": "python", "repo": "wilbertgeng/LintCode_exercise", "path": "/Tree_Divide&Conquer/88.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if left and right: return node return left or right ## if not root: return None if root == A or root == B: return root left = self.lowestCommonAncestor(root.left, A, B) right = self.lowestCommonAncestor(r...
code_fim
hard
{ "lang": "python", "repo": "wilbertgeng/LintCode_exercise", "path": "/Tree_Divide&Conquer/88.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GDGCapeTown/Projector path: /projector/main.py #!/usr/bin/env python # Python Libs import webapp2 from webapp2_extras import routes import jinja2 import os import urllib # Setup the Handlers from projector.handlers.home import HomepageHandler <|fim_suffix|> ('/', HomepageHandler) ], debug=Tru...
code_fim
hard
{ "lang": "python", "repo": "GDGCapeTown/Projector", "path": "/projector/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ('/', HomepageHandler) ], debug=True, config=config)<|fim_prefix|># repo: GDGCapeTown/Projector path: /projector/main.py #!/usr/bin/env python # Python Libs import webapp2 from webapp2_extras import routes import jinja2 import os import urllib # Setup the Handlers from projector.handlers.home import ...
code_fim
hard
{ "lang": "python", "repo": "GDGCapeTown/Projector", "path": "/projector/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "share_count": "1", "nexthop": "192.168.9.2", "merge_labels": False, "prefer_non_rib_labels": False, } }, } }, "total_prefixes": 1, }<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src...
code_fim
hard
{ "lang": "python", "repo": "CiscoTestAutomation/genieparser", "path": "/src/genie/libs/parser/ios/tests/ShowIpRouteWord/cli/equal/golden_output_with_route_expected.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CiscoTestAutomation/genieparser path: /src/genie/libs/parser/ios/tests/ShowIpRouteWord/cli/equal/golden_output_with_route_expected.py expected_output = { "entry": { "192.168.234.0/24": { "mask": "24", "type": "internal", "known_via": "eigrp 1", ...
code_fim
hard
{ "lang": "python", "repo": "CiscoTestAutomation/genieparser", "path": "/src/genie/libs/parser/ios/tests/ShowIpRouteWord/cli/equal/golden_output_with_route_expected.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /tests/components/mqtt/test_select.py s, topic, "milk") await hass.async_block_till_done() state = hass.states.get("select.test_select") assert state.state == "milk" async_fire_mqtt_message(hass, topic, "beer") await hass.async_block_till_done() ...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/tests/components/mqtt/test_select.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> state = hass.states.get("select.test_select") assert state.attributes.get(ATTR_OPTIONS) == options @pytest.mark.parametrize( "hass_config", [ { mqtt.DOMAIN: { select.DOMAIN: { "state_topic": "test/select_stat", "...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/tests/components/mqtt/test_select.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }