text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>if __name__ == "__main__": parser = argparse.ArgumentParser(description='Set item category and item name') parser.parse_args() if len(sys.argv) == 1: item_category()<|fim_prefix|># repo: Findspire/workflow path: /scripts/item_category.py #!/usr/bin/env python # -*- coding: utf-8 -*- i...
code_fim
hard
{ "lang": "python", "repo": "Findspire/workflow", "path": "/scripts/item_category.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Findspire/workflow path: /scripts/item_category.py #!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import django import argparse <|fim_suffix|>from workflow.apps.workflow.models import Item, ItemCategory, Workflow def item_category(): for item in Item.objects.all(): ...
code_fim
medium
{ "lang": "python", "repo": "Findspire/workflow", "path": "/scripts/item_category.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jimmy-INL/google-research path: /jaxraytrace/main.py # coding=utf-8 # Copyright 2022 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/jaxraytrace/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> rendering_config = configuration.get_config() rendering_config = ml_collections.FrozenConfigDict(rendering_config) aspect_ratio = rendering_config.aspect_ratio height = rendering_config.height width = int(aspect_ratio * height) scene_camera = build_camera(rendering_config, aspect_ratio) wor...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/google-research", "path": "/jaxraytrace/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: debuggerpk/django-stubs path: /django-stubs/views/generic/list.pyi from typing import Any, Dict, List, Optional, Tuple, Union from django.core.handlers.wsgi import WSGIRequest from django.core.paginator import Page, Paginator from django.db.models.query import QuerySet from django.template.respo...
code_fim
hard
{ "lang": "python", "repo": "debuggerpk/django-stubs", "path": "/django-stubs/views/generic/list.pyi", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> allow_empty: bool = ... queryset: Any = ... model: Any = ... paginate_by: Any = ... paginate_orphans: int = ... context_object_name: Any = ... paginator_class: Any = ... page_kwarg: str = ... ordering: Any = ... def get_queryset(self) -> Union[List[Dict[str, str]], ...
code_fim
medium
{ "lang": "python", "repo": "debuggerpk/django-stubs", "path": "/django-stubs/views/generic/list.pyi", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self, *, object_list: Optional[Any] = ..., **kwargs: Any ) -> Dict[str, Any]: ... class BaseListView(MultipleObjectMixin, View): object_list: Any = ... def get( self, request: WSGIRequest, *args: Any, **kwargs: Any ) -> TemplateResponse: ... class MultipleObjectTemplateRe...
code_fim
hard
{ "lang": "python", "repo": "debuggerpk/django-stubs", "path": "/django-stubs/views/generic/list.pyi", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MercerBinaryBears/Slides path: /2016/slides/GraphTheory/graph.py class Graph: def __init__(self): self.adjacency = {} def connect(self, vertex1, vertex2, weight=None): if vertex1 not in self.adjacency: self.adjacency[vertex1] = {} self.adjacency[verte...
code_fim
medium
{ "lang": "python", "repo": "MercerBinaryBears/Slides", "path": "/2016/slides/GraphTheory/graph.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def are_connected(self, vertex1, vertex2): return self.is_vertex(vertex1) and vertex2 in self.adjacency[vertex1] def weight(self, vertex1, vertex2): return self.adjacency[vertex1][vertex2] def neighbors(self, vertex1): return self.adjacency[vertex1].keys() # Test Cod...
code_fim
medium
{ "lang": "python", "repo": "MercerBinaryBears/Slides", "path": "/2016/slides/GraphTheory/graph.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> generate_out['fake_image'] = self.net['netG'](input_semantics, warp_out=CBN_in) generate_out = {**generate_out, **coor_out} return generate_out def inference(self, input_semantics, ref_semantics=None, ref_image=None, self_ref=None): generate_out = {} coor_out ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/CoCosNet", "path": "/models/pix2pix_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not self.opt.no_ganFeat_loss: num_D = len(pred_fake) GAN_Feat_loss = self.FloatTensor(1).fill_(0) for i in range(num_D): # for each discriminator # last output is the final prediction, so we exclude it num_intermediate_outputs...
code_fim
hard
{ "lang": "python", "repo": "microsoft/CoCosNet", "path": "/models/pix2pix_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/CoCosNet path: /models/pix2pix_model.py n generated_out else generated_out['warp_mask'] out['adaptive_feature_seg'] = None if 'adaptive_feature_seg' not in generated_out else generated_out['adaptive_feature_seg'] out['adaptive_feature_img'] = None if 'adaptive_fe...
code_fim
hard
{ "lang": "python", "repo": "microsoft/CoCosNet", "path": "/models/pix2pix_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kemitche/indextank-service path: /gen-py/flaptor/indextank/rpc/Indexer-remote #!/usr/bin/env python # # Autogenerated by Thrift # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # import sys import pprint from urlparse import urlparse from thrift.transport import TTransport fr...
code_fim
hard
{ "lang": "python", "repo": "kemitche/indextank-service", "path": "/gen-py/flaptor/indextank/rpc/Indexer-remote", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>elif cmd == 'removeScoreFunction': if len(args) != 1: print 'removeScoreFunction requires 1 args' sys.exit(1) pp.pprint(client.removeScoreFunction(eval(args[0]),)) elif cmd == 'listScoreFunctions': if len(args) != 0: print 'listScoreFunctions requires 0 args' sys.exit(1) pp.pprint...
code_fim
hard
{ "lang": "python", "repo": "kemitche/indextank-service", "path": "/gen-py/flaptor/indextank/rpc/Indexer-remote", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if sys.argv[argi] == '-u': url = urlparse(sys.argv[argi+1]) parts = url[1].split(':') host = parts[0] if len(parts) > 1: port = int(parts[1]) else: port = 80 uri = url[2] if url[4]: uri += '?%s' % url[4] http = True argi += 2 if sys.argv[argi] == '-f' or sys.argv[argi] == '-...
code_fim
hard
{ "lang": "python", "repo": "kemitche/indextank-service", "path": "/gen-py/flaptor/indextank/rpc/Indexer-remote", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: siddharthSharma102/HandCricket-OpenCV path: /test.py from keras.models import load_model import cv2 import numpy as np import sys <|fim_suffix|># PREDICTION pred = model.predict(np.array([img])) move_code = np.argmax(pred[0]) move_name = mapper(move_code) print("\n\nPridcted: {}".form...
code_fim
hard
{ "lang": "python", "repo": "siddharthSharma102/HandCricket-OpenCV", "path": "/test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return rev_class_map[val] # LOADNG TRAINED MODEL model = load_model("Hand-Cricket-model.h5") # PREPARING IMAGE img = cv2.imread(filepath) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) img = cv2.resize(img, (227, 227)) # PREDICTION pred = model.predict(np.array([img])) move_code = np.argmax...
code_fim
medium
{ "lang": "python", "repo": "siddharthSharma102/HandCricket-OpenCV", "path": "/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #todo get the result below using pandas def df_sessions_registered_participants(self): results = {} for key, value in self.hugo.df_participants().to_dict(orient='index').items(): title = value.get('title') sessions = value.get('sessions') for ses...
code_fim
hard
{ "lang": "python", "repo": "OpenSecuritySummit/jp-2020", "path": "/notebooks/api/oss_hugo/OSS_Schedule.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenSecuritySummit/jp-2020 path: /notebooks/api/oss_hugo/OSS_Schedule.py import pandas as pd from oss_hugo.API_Hugo_OSS import API_Hugo_OSS class OSS_Schedule: def __init__(self): self.hugo = API_Hugo_OSS() def sessions_mapped_by_size(self): mapping = [] for pat...
code_fim
hard
{ "lang": "python", "repo": "OpenSecuritySummit/jp-2020", "path": "/notebooks/api/oss_hugo/OSS_Schedule.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> results = {} for key, value in self.hugo.df_participants().to_dict(orient='index').items(): title = value.get('title') sessions = value.get('sessions') for session in sessions: if results.get(session) is None: results[session] = [] ...
code_fim
hard
{ "lang": "python", "repo": "OpenSecuritySummit/jp-2020", "path": "/notebooks/api/oss_hugo/OSS_Schedule.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ipavlopoulos/lm path: /run_mlm.py """ import unittest class MyTestCase(unittest.TestCase): def test_something(self): self.assertEqual(True, False) if __name__ == '__main__': unittest.main() """ import pandas as pd from sklearn.model_selection import train_test_split from marko...
code_fim
hard
{ "lang": "python", "repo": "ipavlopoulos/lm", "path": "/run_mlm.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for K in kappas: print(f"Micro Accuracy({K}-GLM) & {100 * np.mean(accs[K]):.2f} ± {100*sem(accs[K]):.2f} \\\\") print(f"Keystrokes({K}-GLM) & {100 * np.mean(keys[K]):.2f} ± {100*sem(keys[K]):.2f} \\\\") print() if FLAGS.method in {"lstm", "gru"}: pr...
code_fim
hard
{ "lang": "python", "repo": "ipavlopoulos/lm", "path": "/run_mlm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_register_should_set_request_handler_for_service_actions(self): self._service_provider.server.set_request_handler.assert_called() def test_update_cell_with_no_active_session(self): update_cell_request = UpdateCellRequest() update_cell_request.owner_uri = 'test_own...
code_fim
hard
{ "lang": "python", "repo": "microsoft/pgtoolsservice", "path": "/tests/edit_data/test_edit_data_service.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/pgtoolsservice path: /tests/edit_data/test_edit_data_service.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project roo...
code_fim
hard
{ "lang": "python", "repo": "microsoft/pgtoolsservice", "path": "/tests/edit_data/test_edit_data_service.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> request = RevertRowRequest() request.owner_uri = 'test_owner_uri' request.row_id = 1 self._validate_row_operations(self._service_under_test._revert_row, 'revert_row', request, request.row_id) def test_revert_cell_operation(self): request = RevertCellRequest()...
code_fim
hard
{ "lang": "python", "repo": "microsoft/pgtoolsservice", "path": "/tests/edit_data/test_edit_data_service.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wmww/wayland-debug path: /core/persistent_ui_state.py from interfaces import UIState class PersistentUIState(UIState.Listener): '''Keeps track of a UI state UIState.Listener methods can be called directly to set the state without other listeners being notified''' <|fim_suffix|> '...
code_fim
hard
{ "lang": "python", "repo": "wmww/wayland-debug", "path": "/core/persistent_ui_state.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def quit_requested(self) -> None: '''Overrides a method in UIState.Listener''' self._should_quit = True<|fim_prefix|># repo: wmww/wayland-debug path: /core/persistent_ui_state.py from interfaces import UIState class PersistentUIState(UIState.Listener): '''Keeps track of a UI stat...
code_fim
hard
{ "lang": "python", "repo": "wmww/wayland-debug", "path": "/core/persistent_ui_state.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Overrides a method in UIState.Listener''' self._paused = False def quit_requested(self) -> None: '''Overrides a method in UIState.Listener''' self._should_quit = True<|fim_prefix|># repo: wmww/wayland-debug path: /core/persistent_ui_state.py from interfaces import ...
code_fim
hard
{ "lang": "python", "repo": "wmww/wayland-debug", "path": "/core/persistent_ui_state.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NAIST-SD-PBL-PAL/Teddy-plus path: /evaluation/nor-manim_10.py def get_stroke_rgbas(self, vmobject, background=False): return self.modi<|fim_suffix|>ct.get_stroke_rgbas(background) )<|fim_middle|>fied_rgbas( vmobject, vmobje
code_fim
easy
{ "lang": "python", "repo": "NAIST-SD-PBL-PAL/Teddy-plus", "path": "/evaluation/nor-manim_10.py", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>ct.get_stroke_rgbas(background) )<|fim_prefix|># repo: NAIST-SD-PBL-PAL/Teddy-plus path: /evaluation/nor-manim_10.py def get_stroke_rgbas(self, vmobject, bac<|fim_middle|>kground=False): return self.modified_rgbas( vmobject, vmobje
code_fim
medium
{ "lang": "python", "repo": "NAIST-SD-PBL-PAL/Teddy-plus", "path": "/evaluation/nor-manim_10.py", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> nonlocal num_fails func_name = func.__name__ try: return func(*args, **kwargs) except Exception as e: num_fails += 1 if num_fails == 1: print(('Something went wrong in `{}`. ' + 'The process will con...
code_fim
hard
{ "lang": "python", "repo": "DavitAbgaryan/aim", "path": "/aim/sdk/session/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: DavitAbgaryan/aim path: /aim/sdk/session/utils.py import os from functools import wraps from aim.engine.configs import ( AIM_BRANCH_ENV_VAR, AIM_COMMIT_ENV_VAR, AIM_AUTOMATED_EXEC_ENV_VAR, ) <|fim_suffix|> nonlocal num_fails func_name = func.__name__ try: ...
code_fim
hard
{ "lang": "python", "repo": "DavitAbgaryan/aim", "path": "/aim/sdk/session/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RomeoV/pyomo-MINLP-benchmarking path: /models/tls2.py # MINLP written by GAMS Convert at 05/15/20 00:51:26 # # Equation counts # Total E G L N X C B # 25 7 0 18 0 0 0 0 # # Variabl...
code_fim
hard
{ "lang": "python", "repo": "RomeoV/pyomo-MINLP-benchmarking", "path": "/models/tls2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>m.c19 = Constraint(expr= m.x8 - 3*m.b35 - 8*m.b36 - 15*m.b37 == 1) m.c20 = Constraint(expr= m.b24 + m.b25 + m.b26 + m.b27 <= 1) m.c21 = Constraint(expr= m.b28 + m.b29 + m.b30 + m.b31 <= 1) m.c22 = Constraint(expr= m.b32 + m.b33 + m.b34 <= 1) m.c23 = Constraint(expr= m.b35 + m.b36 + m.b37 <= ...
code_fim
hard
{ "lang": "python", "repo": "RomeoV/pyomo-MINLP-benchmarking", "path": "/models/tls2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>m.c24 = Constraint(expr=-(sqrt(m.i3*m.x5) + sqrt(m.i4*m.x6)) + m.b9 + 2*m.b10 + 3*m.b11 + 4*m.b12 + 5*m.b13 + 6*m.b14 + 7*m.b15 + 8*m.b16 + m.b17 + 2*m.b18 + 3*m.b19 + 4*m.b20 + 5*m.b21 + 6*m.b22 + 7*m.b23 + m.b24 + 2*m.b25 + 3*m.b26 + 4*m.b27 + m.b28 + 2*...
code_fim
hard
{ "lang": "python", "repo": "RomeoV/pyomo-MINLP-benchmarking", "path": "/models/tls2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: atakan-tr/fmeca-1 path: /app/api/components.py from flask import jsonify, request from . import api from .. import db from ..models import Area, Component from ..decorators import json, paginate @api.route("/areas/<int:id>/components/", methods=['GET']) @json @paginate('components') def get_are...
code_fim
hard
{ "lang": "python", "repo": "atakan-tr/fmeca-1", "path": "/app/api/components.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@api.route("/components/<int:id>", methods=["DELETE"]) @json def component_delete(id): component = Component.query.get_or_404(id) db.session.delete(component) db.session.commit() return {}<|fim_prefix|># repo: atakan-tr/fmeca-1 path: /app/api/components.py from flask import jsonify, reque...
code_fim
hard
{ "lang": "python", "repo": "atakan-tr/fmeca-1", "path": "/app/api/components.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> candidate_samples = [] for i in range(1, len(existing_samples)): candidate_sample = 0.5 * (existing_samples[i] - existing_samples[i-1]) gradient = gradients[i-1] if i > 2: score += # Sort the candidate...
code_fim
hard
{ "lang": "python", "repo": "jskinn/robot-vision-experiment-framework", "path": "/metadata/parameter.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jskinn/robot-vision-experiment-framework path: /metadata/parameter.py # Copyright (c) 2017, John Skinner import operator import database.entity class ContinuousParameter(database.entity.Entity): def __init__(self, name, min_ = None, max_ = None, id_ = None, **kwargs): super().__ini...
code_fim
hard
{ "lang": "python", "repo": "jskinn/robot-vision-experiment-framework", "path": "/metadata/parameter.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> :param existing_results: A map of existing sample values to a numeric score which we're sampling against. :param num_samples: The upper limit on the desired samples/ :return: """ new_samples = set() existing_samples = list(existing_results.keys()) ...
code_fim
hard
{ "lang": "python", "repo": "jskinn/robot-vision-experiment-framework", "path": "/metadata/parameter.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>items(): d1[value]=d1.get(value,0)+1 for x in d1.items(): print(x)<|fim_prefix|># repo: inwk6312fall2017/programming-task-2-gansiva path: /code.py import string import csv d=dict() d1=dict() with open("Crime.csv", 'r') as myfile: reader = csv.reader(myfile) for row in reader: d[row[2<|fim_middle...
code_fim
medium
{ "lang": "python", "repo": "inwk6312fall2017/programming-task-2-gansiva", "path": "/code.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: inwk6312fall2017/programming-task-2-gansiva path: /code.py import string import csv d=dict() d1=dict() with open("Crime.csv", 'r'<|fim_suffix|>items(): d1[value]=d1.get(value,0)+1 for x in d1.items(): print(x)<|fim_middle|>) as myfile: reader = csv.reader(myfile) for row in reader: d[row...
code_fim
medium
{ "lang": "python", "repo": "inwk6312fall2017/programming-task-2-gansiva", "path": "/code.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: helena-network/gnosisdb path: /gnosisdb/restapi/tests/test_views.py n/json') self.assertEqual(market_response_data.status_code, status.HTTP_200_OK) self.assertEqual(len(json.loads(market_response_data.content).get('results')), len(markets)) market_search_response = self.c...
code_fim
hard
{ "lang": "python", "repo": "helena-network/gnosisdb", "path": "/gnosisdb/restapi/tests/test_views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: helena-network/gnosisdb path: /gnosisdb/restapi/tests/test_views.py json.loads(events_response.content).get('results')[0].get('contract').get('address'), add_0x_prefix(event.address)) def test_markets(self): # test empty events response empty_markets_response = self.client.ge...
code_fim
hard
{ "lang": "python", "repo": "helena-network/gnosisdb", "path": "/gnosisdb/restapi/tests/test_views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> trades_response = self.client.get(url, content_type='application/json') trades_data = json.loads(trades_response.content) self.assertEqual(trades_response.status_code, status.HTTP_200_OK) self.assertEqual(len(trades_data.get('results')), 1) self.assertEqual(trades_d...
code_fim
hard
{ "lang": "python", "repo": "helena-network/gnosisdb", "path": "/gnosisdb/restapi/tests/test_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: slalom/slaloms-and-dragons path: /game/animations.py import emoji import sys import time import pyfiglet from colorama import Fore, Back, Style title = "slaloms & dragons" subtitle = "Let's play SLALOMS & DRAGONS :dragon:" <|fim_suffix|> color = Fore.MAGENTA font_bold = Style.BRIGHT ...
code_fim
medium
{ "lang": "python", "repo": "slalom/slaloms-and-dragons", "path": "/game/animations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> color = Fore.MAGENTA font_bold = Style.BRIGHT result = pyfiglet.figlet_format(" ".join(list(title.upper())), font="mini") print(color + font_bold + result) animation = emoji.emojize(color + font_bold + subtitle) for i in animation: time.sleep(0.03) sys.stdout.writ...
code_fim
medium
{ "lang": "python", "repo": "slalom/slaloms-and-dragons", "path": "/game/animations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> os.system("./conflictAnalyzer.sh test/example3.c > /dev/null 2> /dev/null") with open('result.txt') as rf: data = rf.readlines() correctStr = "[E_orange, E_orange, E_orange, E_purple, E_purple, E_purple, E_orange, E_orange, E_purple, E_orange, E_orange, E_purple, E_purple, E_purple...
code_fim
hard
{ "lang": "python", "repo": "gaps-closure/capo", "path": "/C/formal/ontology/deprecated/regressionTest.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gaps-closure/capo path: /C/formal/ontology/deprecated/regressionTest.py #!/usr/bin/python3 import os if __name__ == '__main__': os.system("./conflictAnalyzer.sh test/example1.c > /dev/null 2> /dev/null") with open('result.txt') as rf: data = rf.readlines() correctStr = "...
code_fim
hard
{ "lang": "python", "repo": "gaps-closure/capo", "path": "/C/formal/ontology/deprecated/regressionTest.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jart/cosmopolitan path: /third_party/python/Tools/scripts/which.py #! /usr/bin/env python3 # Variant of "which". # On stderr, near and total misses are reported. # '-l<flags>' argument adds ls -l<flags> of each file found. import sys if sys.path[0] in (".", ""): del sys.path[0] <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "jart/cosmopolitan", "path": "/third_party/python/Tools/scripts/which.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pathlist = os.environ['PATH'].split(os.pathsep) sts = 0 longlist = '' if sys.argv[1:] and sys.argv[1][:2] == '-l': longlist = sys.argv[1] del sys.argv[1] for prog in sys.argv[1:]: ident = () for dir in pathlist: filename = os.path.join(dir...
code_fim
hard
{ "lang": "python", "repo": "jart/cosmopolitan", "path": "/third_party/python/Tools/scripts/which.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.drivers[side].sendCalibrate() self.storedCommand[side] = None def dropClicked(self): if self.widget.handSelect.leftButton.checked: side = 'left' else: side = 'right' self.drivers[side].sendDrop() self.storedCommand[side] = ...
code_fim
hard
{ "lang": "python", "repo": "mlab-upenn/arch-apex", "path": "/APEX-S/Libraries/drake-v0.9.11-mac/build/lib/python2.7/dist-packages/ddapp/handcontrolpanel.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlab-upenn/arch-apex path: /APEX-S/Libraries/drake-v0.9.11-mac/build/lib/python2.7/dist-packages/ddapp/handcontrolpanel.py import PythonQt from PythonQt import QtCore, QtGui, QtUiTools from ddapp import lcmUtils from ddapp import applogic as app from ddapp.utime import getUtime from ddapp.timerca...
code_fim
hard
{ "lang": "python", "repo": "mlab-upenn/arch-apex", "path": "/APEX-S/Libraries/drake-v0.9.11-mac/build/lib/python2.7/dist-packages/ddapp/handcontrolpanel.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wajdi-Mabroukeh/CvStudio path: /view/widgets/image_viewer/image_viewer.py ,value): self._curr_channel=value def build_toolbox(self): icon_size=QSize(28,28) self._toolbox = [ ImageButton(icon=GUIUtilities.get_icon("polygon.png"),size=icon_size, tag="polygon...
code_fim
hard
{ "lang": "python", "repo": "Wajdi-Mabroukeh/CvStudio", "path": "/view/widgets/image_viewer/image_viewer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @dask.delayed def load_image_label(self): return self._ann_dao.get_label(self.tag.id) @dask.delayed def load_image_annotations(self): return self._ann_dao.fetch_all(self.tag.id) def load_image(self): @work_exception def do_work(): return da...
code_fim
hard
{ "lang": "python", "repo": "Wajdi-Mabroukeh/CvStudio", "path": "/view/widgets/image_viewer/image_viewer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @dask.delayed def load_labels(self): dataset_id=self.tag.dataset return self._labels_dao.fetch_all(dataset_id) @gui_exception def image_list_sel_changed_slot(self,curr: CustomListWidgetItem,prev: CustomListWidgetItem): self.image, self.tag = cv2.imread(curr.tag.fi...
code_fim
hard
{ "lang": "python", "repo": "Wajdi-Mabroukeh/CvStudio", "path": "/view/widgets/image_viewer/image_viewer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LeoneBacciu/django-email-verification path: /django_email_verification/urls.py from django.urls import path from django.views.decorators.csrf import csrf_exempt <|fim_suffix|>urlpatterns = [ path('email/<str:token>', csrf_exempt(verify_email_page)), path('password/<str:token>', csrf_exem...
code_fim
medium
{ "lang": "python", "repo": "LeoneBacciu/django-email-verification", "path": "/django_email_verification/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ path('email/<str:token>', csrf_exempt(verify_email_page)), path('password/<str:token>', csrf_exempt(verify_password_page)), ]<|fim_prefix|># repo: LeoneBacciu/django-email-verification path: /django_email_verification/urls.py from django.urls import path from django.views.decorato...
code_fim
medium
{ "lang": "python", "repo": "LeoneBacciu/django-email-verification", "path": "/django_email_verification/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: muraria/graviton2-workshop path: /scripts/elasticsearch-generate-data.py #!/usr/bin/env python # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: MIT-0 # # This script inserts random data into an index named "people" within an Amazon # Elasticsearch clu...
code_fim
hard
{ "lang": "python", "repo": "muraria/graviton2-workshop", "path": "/scripts/elasticsearch-generate-data.py", "mode": "psm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_suffix|> try: result = es.index(index="people", doc_type="_doc", body=document) print("Indexed with ID '%s'" % result['_id']) time.sleep(0.25) except ConnectionTimeout as e: print("Connection to the ES cluster timed out: %s" % str(e)) tim...
code_fim
hard
{ "lang": "python", "repo": "muraria/graviton2-workshop", "path": "/scripts/elasticsearch-generate-data.py", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_suffix|> region = os.environ['AWS_REGION'] service = 'es' credentials = boto3.Session().get_credentials() awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, region, service, session_token=credentials.token) fake = Faker() es = Elasticsearch( hosts = [{...
code_fim
hard
{ "lang": "python", "repo": "muraria/graviton2-workshop", "path": "/scripts/elasticsearch-generate-data.py", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_suffix|> length = int(data.strip(), 16) if length == 0: resp = self.current_response if resp._decompressor: resp.body += resp._decompressor.flush() del resp._decompressor self._stream.on_read = self._read_additional_headers ...
code_fim
hard
{ "lang": "python", "repo": "ixokai/pants", "path": "/pants/contrib/http/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if headers is None: headers = {} if headers.get('Content-Type', '') == 'application/x-www-form-urlencoded' and files: raise ValueError("Cannot send files with Content-Type " "'application/x-www-form-urlencoded'.") if files: ...
code_fim
hard
{ "lang": "python", "repo": "ixokai/pants", "path": "/pants/contrib/http/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ixokai/pants path: /pants/contrib/http/client.py if response_handler is not None: if not callable(response_handler): raise ValueError("response handler must be callable.") self.on_response = response_handler # Internal State self._s...
code_fim
hard
{ "lang": "python", "repo": "ixokai/pants", "path": "/pants/contrib/http/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Camiloasc1/AlgorithmsUNAL path: /SPOJ/TSORT.py import sys n = input() data = sys.stdin.read().splitlines() sortedList = [] for i in data: sortedList.append(int(i)) sortedList.sort() for i in sortedList: print i # V2 <|fim_suffix|>import sys raw_input() print ...
code_fim
hard
{ "lang": "python", "repo": "Camiloasc1/AlgorithmsUNAL", "path": "/SPOJ/TSORT.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sortedList.sort() for i in sortedList: print i # V2 import sys m = int(1E6 + 1) count = [0] * m n = int(raw_input()) for _ in xrange(n): count[int(sys.stdin.readline())] += 1 for i in xrange(m): # if(count[i]>0): # print "\n".join(map(str, [i] * count[i])) f...
code_fim
medium
{ "lang": "python", "repo": "Camiloasc1/AlgorithmsUNAL", "path": "/SPOJ/TSORT.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in xrange(m): # if(count[i]>0): # print "\n".join(map(str, [i] * count[i])) for _ in xrange(count[i]): print i # V3 import sys raw_input() print "\n".join(map(str, sorted(map(int, sys.stdin.read().splitlines()))))<|fim_prefix|># repo: Camiloasc1/AlgorithmsUNAL pat...
code_fim
medium
{ "lang": "python", "repo": "Camiloasc1/AlgorithmsUNAL", "path": "/SPOJ/TSORT.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sarvex/composer path: /composer/callbacks/checkpoint_saver.py "Callback to save checkpoints. .. note:: If the ``folder`` argument is specified when constructing the :class:`.Trainer`, then the :class:`.CheckpointSaver` callback need not be constructed manually. However, for ...
code_fim
hard
{ "lang": "python", "repo": "sarvex/composer", "path": "/composer/callbacks/checkpoint_saver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sarvex/composer path: /composer/callbacks/checkpoint_saver.py ck): # noqa: D101 __doc__ = f"""Callback to save checkpoints. .. note:: If the ``folder`` argument is specified when constructing the :class:`.Trainer`, then the :class:`.CheckpointSaver` callback need not be...
code_fim
hard
{ "lang": "python", "repo": "sarvex/composer", "path": "/composer/callbacks/checkpoint_saver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> When DeepSpeed is not being used, the rank zero process will save the checkpoint to ``'awesome-training-run/checkpoints/ep1-ba42-rank0'``, and a symlink will be created at ``'awesome-training-run/checkpoints/latest-rank0' -> 'awesome-training-run/checkpoints...
code_fim
hard
{ "lang": "python", "repo": "sarvex/composer", "path": "/composer/callbacks/checkpoint_saver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>se: 2**(49-1).", ), pytest.param( 2 ** (53 + 1), True, id="True case: 2**(53+1).", ), ], ) def test_power_of_2(value: int, expected_result: bool): """ Passes test if `check_power_of_2`(`value`) is equal to `expected_result`. "...
code_fim
hard
{ "lang": "python", "repo": "mag-id/epam_python_autumn_2020", "path": "/homework_1/sample_project/tests/test_calculator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mag-id/epam_python_autumn_2020 path: /homework_1/sample_project/tests/test_calculator.py """ Unit tests for `calculator` module. """ import pytest from homework_1.sample_project.calculator.calc import check_power_of_2 @pytest.mark.parametrize( ["value", "expected_result"], [ p...
code_fim
hard
{ "lang": "python", "repo": "mag-id/epam_python_autumn_2020", "path": "/homework_1/sample_project/tests/test_calculator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> time_delta = 0.1 distance = calc_distance(start_point, end_point) return distance / time_delta def calc_distance(start_point, end_point): distance = math.sqrt( (start_point[0] - end_point[0]) ** 2 + (start_point[1] - end_point[1]) ** 2 + (start_point[2] - end_poin...
code_fim
hard
{ "lang": "python", "repo": "goldarte/blender-csv-animation", "path": "/addon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for second_drone_obj in drone_objects: if second_drone_obj is not drone_obj: x2, y2, z2 = second_drone_obj.matrix_world.to_translation() distance = calc_distance((x, y, z), (x2, y2, z2)) ...
code_fim
hard
{ "lang": "python", "repo": "goldarte/blender-csv-animation", "path": "/addon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: goldarte/blender-csv-animation path: /addon.py import os import csv import math import bpy from bpy_extras.io_utils import ExportHelper from bpy.types import Operator from bpy.props import StringProperty, BoolProperty, FloatProperty, IntProperty bl_info = { "name": "Export > CSV Drone Swarm...
code_fim
hard
{ "lang": "python", "repo": "goldarte/blender-csv-animation", "path": "/addon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mmuldo/palette-cleanser path: /tests/test_template.py from palettecleanser import template from palettecleanser import theme from palettecleanser import palette from palettecleanser import config import yaml import os import jinja2 as j2 class TestTemplateFile: def test_generate_signature_hs...
code_fim
hard
{ "lang": "python", "repo": "mmuldo/palette-cleanser", "path": "/tests/test_template.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> monkeypatch.setattr(os, 'environ', os.environ | {'HOME': os.path.join(os.path.dirname(__file__), 'test_data', 'fake_home')}) assert template.TemplateFile('test_template_template1').is_templated() def test_is_templated_shebang(self, monkeypatch): monkeypatch.setattr(os, 'enviro...
code_fim
hard
{ "lang": "python", "repo": "mmuldo/palette-cleanser", "path": "/tests/test_template.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ToolSvc.L1TriggerTowerTool.BaselineCorrection = _doPC from TrigBunchCrossingTool.BunchCrossingTool import BunchCrossingTool bct = BunchCrossingTool() if not hasattr(ToolSvc, bct.getName()): ToolSvc += bct else: bct = getattr(ToolSvc, bct.getName()) if _doPC and not hasattr(ToolSvc, 'L1Dynami...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/Trigger/TrigT1/TrigT1CaloSim/share/TrigT1CaloSimJobOptions_Run2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: strigazi/athena path: /Trigger/TrigT1/TrigT1CaloSim/share/TrigT1CaloSimJobOptions_Run2.py # Import the configurable algorithms for TrigT1Calo from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.Logging import logging # loads logger log = logging.getLogger( "TrigT1CaloSimJobOption...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/Trigger/TrigT1/TrigT1CaloSim/share/TrigT1CaloSimJobOptions_Run2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># autoconfigure pedestal correction based on the input file if _doPC and _bunchSpacing not in (25,50): log.warning('Only 25ns intra train bunch spacing currently supported. Dynamic pedestal correction is disabled!') _doPC = False ToolSvc.L1TriggerTowerTool.BaselineCorrection = _doPC from TrigBun...
code_fim
hard
{ "lang": "python", "repo": "strigazi/athena", "path": "/Trigger/TrigT1/TrigT1CaloSim/share/TrigT1CaloSimJobOptions_Run2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alanag13/adventofcode2020 path: /9_encoding_error/solution.py from os import path this_dir = path.dirname(path.realpath(__file__)) input_file = path.join(this_dir, "input.txt") rolling_sum = 0 contiguous_nums = [] PART_ONE_SOLUTION = 70639851 def has_sum_pair_in_range(input_list, value, start,...
code_fim
hard
{ "lang": "python", "repo": "alanag13/adventofcode2020", "path": "/9_encoding_error/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with open(input_file) as f: input_list = [int(entry.strip()) for entry in f] for i in range(len(input_list)): num = input_list[i] if i > 24 and not has_sum_pair_in_range(input_list, num, i - 25, i): print(f"Part one: {num}") if len(contiguous_nums) > 1 ...
code_fim
hard
{ "lang": "python", "repo": "alanag13/adventofcode2020", "path": "/9_encoding_error/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> checked = set() for i in range(start, end): item = input_list[i] diff = value - item if diff in checked: return True checked.add(item) with open(input_file) as f: input_list = [int(entry.strip()) for entry in f] for i in range(len(input_list)): ...
code_fim
medium
{ "lang": "python", "repo": "alanag13/adventofcode2020", "path": "/9_encoding_error/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cfalguiere/morse-challenge path: /version-9/test_node.py import pytest from node import NodeState, Node @pytest.fixture def sentence1(): sentence = '..-.--.' return sentence @pytest.fixture def sentence2(): sentence = '..--' return sentence def test_root_node(sentence1): ...
code_fim
hard
{ "lang": "python", "repo": "cfalguiere/morse-challenge", "path": "/version-9/test_node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_next_done_completed(sentence2): # node_0 = Node('', 0, sentence2, state=NodeState.ROOT) node_0 = Node('', 0, len(sentence2), state=NodeState.ROOT) node_1 = Node('..', 0, len('--'), parent=node_0) node_2 = Node('--', 2, len(''), parent=node_1) assert node_2.is_done is True d...
code_fim
hard
{ "lang": "python", "repo": "cfalguiere/morse-challenge", "path": "/version-9/test_node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mcmero/SVclone path: /SVclone/SVprocess/svp_dtypes.py import numpy as np ##################################################################### # Data dtypes ##################################################################### bp_dtype = [('chrom','<U20'),('start', int), ('end', int), ('dir', '...
code_fim
hard
{ "lang": "python", "repo": "mcmero/SVclone", "path": "/SVclone/SVprocess/svp_dtypes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># Output from count step sv_out_dtype = [('ID', 'int64'), ('chr1', '<U20'), ('pos1', 'int64'), ('dir1', '<U1'), ('chr2', '<U20'), ('pos2', 'int64'), ('dir2', '<U1'), ('classification', '<U100'), ('split_norm1',...
code_fim
hard
{ "lang": "python", "repo": "mcmero/SVclone", "path": "/SVclone/SVprocess/svp_dtypes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: romadm/LibRecommender path: /examples/pure_rating_example.py import time import numpy as np import pandas as pd from libreco.data import split_by_ratio_chrono, DatasetPure from libreco.algorithms import SVD, SVDpp, NCF, ALS, UserCF, ItemCF, RNN4Rec # remove unnecessary tensorflow logging import ...
code_fim
hard
{ "lang": "python", "repo": "romadm/LibRecommender", "path": "/examples/pure_rating_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> reset_state("ALS") als = ALS(task="rating", data_info=data_info, embed_size=16, n_epochs=2, reg=5.0, alpha=10, seed=42) als.fit(train_data, verbose=2, use_cg=False, n_threads=1, eval_data=eval_data, metrics=["rmse", "mae", "r2"]) print("prediction: ", als.predict(...
code_fim
hard
{ "lang": "python", "repo": "romadm/LibRecommender", "path": "/examples/pure_rating_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: angr/rex path: /rex/utils/curl2rexaction.py import argparse import os import time import signal import psutil import nclib from rex.exploit.actions import RexWaitAction, RexOpenChannelAction, RexSendAction, RexCloseChannelAction def timeout(seconds_before_timeout): def decorate(f): ...
code_fim
hard
{ "lang": "python", "repo": "angr/rex", "path": "/rex/utils/curl2rexaction.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> data = b'' while True: try: data += recv_once(r) except Exception: #pylint:disable=broad-except return data def force_kill(r): r.close() proc = psutil.Process(r.pid) for child in proc.children(): os.system("kill -9 %d" % child.pid) o...
code_fim
hard
{ "lang": "python", "repo": "angr/rex", "path": "/rex/utils/curl2rexaction.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: StevenTagawa/treehouse-python-project-3 path: /logentry.py """ Contains the specification of a LogEntry object. This object containing information on a single task within the WorkLog object. Class Definitions: - LogEntry -- the log entry object. Private Functi...
code_fim
hard
{ "lang": "python", "repo": "StevenTagawa/treehouse-python-project-3", "path": "/logentry.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _validate_dict_entry(self, dict_entry): """ Validates the types of a dictionary's items. Arguments: - dict_entry -- the dictionary to validate. Returns: True if the types are valid, else False. --------------------------...
code_fim
hard
{ "lang": "python", "repo": "StevenTagawa/treehouse-python-project-3", "path": "/logentry.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Returns a pre-defined model by name. Parameters ---------- name : str Name of the model. dataset_name : str or None, default None The dataset name on which the pre-trained model is trained. For language model, options are 'wikitext-2'. For ELMo, Opti...
code_fim
hard
{ "lang": "python", "repo": "MoisesHer/gluon-nlp", "path": "/src/gluonnlp/model/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: MoisesHer/gluon-nlp path: /src/gluonnlp/model/__init__.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. The ASF licenses this fil...
code_fim
hard
{ "lang": "python", "repo": "MoisesHer/gluon-nlp", "path": "/src/gluonnlp/model/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def get_model(name, **kwargs): """Returns a pre-defined model by name. Parameters ---------- name : str Name of the model. dataset_name : str or None, default None The dataset name on which the pre-trained model is trained. For language model, options are 'wiki...
code_fim
hard
{ "lang": "python", "repo": "MoisesHer/gluon-nlp", "path": "/src/gluonnlp/model/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_initialize_post_save_double_import_error_caught(monkeypatch, caplog, capsys, jupyter_app): """Test that both missing nbautoexport error and missing jupyer_core are caught and properly logged.""" real_import = __builtins__["__import__"] def mock_import(name, globals=None, locals...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/nbautoexport", "path": "/tests/test_jupyter_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jimmy-INL/nbautoexport path: /tests/test_jupyter_config.py import builtins import logging from pkg_resources import parse_version from pkg_resources.extern.packaging.version import Version import sys import textwrap from notebook.services.contents.filemanager import FileContentsManager from trai...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/nbautoexport", "path": "/tests/test_jupyter_config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def mock_import(name, globals=None, locals=None, fromlist=(), level=0): if name == "nbautoexport": raise ModuleNotFoundError("No module named 'nbautoexport'") if name == "jupyter_core.application": raise ModuleNotFoundError("No module named 'jupyter_core.applica...
code_fim
hard
{ "lang": "python", "repo": "Jimmy-INL/nbautoexport", "path": "/tests/test_jupyter_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zzerain/ppSCAN path: /paper/deprecated/scalability/scalability_figure_paper.py import matplotlib.pyplot as plt thread_str_lst = ['1', '4', '8', '16', '24', '32', '40'] pscan_runtime_lst = [164.248, 63.705, 2487.317, 3726.302] def accumulate_for_bar_char(breakdown_time_lst): for idx in xran...
code_fim
hard
{ "lang": "python", "repo": "zzerain/ppSCAN", "path": "/paper/deprecated/scalability/scalability_figure_paper.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }