text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> :param obj: input object :return: Serializer """ # 1-NULL serializer if obj is None: return self._null_serializer_adapter obj_type = type(obj) serializer = None # 2-Default serializers, Dataserializable, Portable, primitives, ar...
code_fim
hard
{ "lang": "python", "repo": "mustafaiman/hazelcast-python-client", "path": "/hazelcast/serialization/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mustafaiman/hazelcast-python-client path: /hazelcast/serialization/base.py from threading import RLock from api import * from data import * from hazelcast.core import * from serializer import * EMPTY_PARTITIONING_STRATEGY = lambda key: None def handle_exception(e): if isinstance(e, Memory...
code_fim
hard
{ "lang": "python", "repo": "mustafaiman/hazelcast-python-client", "path": "/hazelcast/serialization/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> serializer_adaptor = create_buffer_serializer_wrapper(serializer) self.register_constant_serializer_adaptor(obj_type, serializer_adaptor) def register_constant_serializer_adaptor(self, obj_type, serializer_adaptor): self._constant_type_dict[obj_type] = serializer_adaptor ...
code_fim
hard
{ "lang": "python", "repo": "mustafaiman/hazelcast-python-client", "path": "/hazelcast/serialization/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Logs epoch level validation metrics.""" self.log_dict(self.val_metrics.compute()) self.val_metrics.reset() def test_step(self, *args: Any, **kwargs: Any) -> None: """Compute test loss. Args: batch: the output of your DataLoader """ ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/torchgeo", "path": "/torchgeo/trainers/segmentation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Logs epoch level test metrics.""" self.log_dict(self.test_metrics.compute()) self.test_metrics.reset() def predict_step(self, *args: Any, **kwargs: Any) -> Tensor: """Compute and return the predictions. By default, this will loop over images in a dataloader...
code_fim
hard
{ "lang": "python", "repo": "microsoft/torchgeo", "path": "/torchgeo/trainers/segmentation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/torchgeo path: /torchgeo/trainers/segmentation.py # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Segmentation tasks.""" import os import warnings from typing import Any, cast import matplotlib.pyplot as plt import segmentation_models_...
code_fim
hard
{ "lang": "python", "repo": "microsoft/torchgeo", "path": "/torchgeo/trainers/segmentation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vmware/network-insight-sdk-generic-datasources path: /network_insight_sdk_generic_datasources/common/import_module_utilities.py # Copyright 2019 VMware, Inc. # SPDX-License-Identifier: BSD-2-Clause import importlib def load_class(class_path): module = importlib.import_module(".".join(clas...
code_fim
hard
{ "lang": "python", "repo": "vmware/network-insight-sdk-generic-datasources", "path": "/network_insight_sdk_generic_datasources/common/import_module_utilities.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def load_class_for_pre_post_parser(device, class_name): module_path = "{0}.{1}.{1}_{2}".format("network_insight_sdk_generic_datasources.routers_and_switches", device, "pre_post_processor") module = importlib.import_module(module_path) return getattr(...
code_fim
hard
{ "lang": "python", "repo": "vmware/network-insight-sdk-generic-datasources", "path": "/network_insight_sdk_generic_datasources/common/import_module_utilities.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def load_class_for_process_table(device, class_name): module_path = "{0}.{1}.{1}_{2}".format("network_insight_sdk_generic_datasources.routers_and_switches", device, "pre_post_processor") module = importlib.import_module(module_path) return getattr(mod...
code_fim
hard
{ "lang": "python", "repo": "vmware/network-insight-sdk-generic-datasources", "path": "/network_insight_sdk_generic_datasources/common/import_module_utilities.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: tnakamura/SilverTask path: /silvertask-web/kay/sessions/middleware.py # -*- coding: utf-8 -*- """ Kay session middleware. :Copyright: (c) 2009 Accense Technology, Inc. All rights reserved. :license: BSD, see LICENSE for more details. """ import kay.sessions from kay.conf import settings from w...
code_fim
medium
{ "lang": "python", "repo": "tnakamura/SilverTask", "path": "/silvertask-web/kay/sessions/middleware.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if hasattr(request, '_cached_session') and \ request.session.should_save and hasattr(response, 'set_cookie'): session_store = import_string(settings.SESSION_STORE)() session_store.save(request.session) response.set_cookie(settings.COOKIE_NAME, sess...
code_fim
hard
{ "lang": "python", "repo": "tnakamura/SilverTask", "path": "/silvertask-web/kay/sessions/middleware.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: great-expectations/great_expectations path: /great_expectations/core/usage_statistics/schemas.py "$schema": SCHEMA, "title": "anonymized-test-yaml-config-payload", "definitions": { "anonymized_string": anonymized_string_schema, "anonymized_class_info": anonymized_class_inf...
code_fim
hard
{ "lang": "python", "repo": "great-expectations/great_expectations", "path": "/great_expectations/core/usage_statistics/schemas.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>anonymized_expectation_configuration_builder_schema = { "$schema": SCHEMA, "title": "anonymized-expectation-configuration-builder", "definitions": { "anonymized_string": anonymized_string_schema, }, "type": "object", "properties": { "parent_class": {"type": "string"...
code_fim
hard
{ "lang": "python", "repo": "great-expectations/great_expectations", "path": "/great_expectations/core/usage_statistics/schemas.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mpavezb/CarND-Advanced-Lane-Lines path: /main.py from src.logger import Log from src.lane_tracker import LaneLinesTracker from examples import * <|fim_suffix|> input_file = "project_video.mp4" output_file = "output_videos/project_video.mp4" tracker = LaneLinesTracker() clip = tra...
code_fim
medium
{ "lang": "python", "repo": "mpavezb/CarND-Advanced-Lane-Lines", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Log.debug_enabled = False # RunCalibrationExample() # RunDistortionCorrectionExample() # RunEdgeDetectionExample() # RunPerspectiveTransformExample() # RunLaneFittingExample() # RunFullPipelineExample() ProcessProjectVideo(subclip_seconds=None) if __name__ == "__main__":...
code_fim
hard
{ "lang": "python", "repo": "mpavezb/CarND-Advanced-Lane-Lines", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>qs = MyModel.objects qs = q.filter(field__regex=r'^(An?|The) +')<|fim_prefix|># repo: andrewp-as-is/django-examples path: /Models/querysets/Field lookups/__regex/tests.py #!/usr/bin/env python from .models import MyModel <|fim_middle|>""" https://docs.djangoproject.com/en/dev/ref/models/querysets/#regex...
code_fim
medium
{ "lang": "python", "repo": "andrewp-as-is/django-examples", "path": "/Models/querysets/Field lookups/__regex/tests.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewp-as-is/django-examples path: /Models/querysets/Field lookups/__regex/tests.py #!/usr/bin/env python from .models import MyModel <|fim_suffix|>qs = MyModel.objects qs = q.filter(field__regex=r'^(An?|The) +')<|fim_middle|>""" https://docs.djangoproject.com/en/dev/ref/models/querysets/#regex...
code_fim
medium
{ "lang": "python", "repo": "andrewp-as-is/django-examples", "path": "/Models/querysets/Field lookups/__regex/tests.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: KKowalewski24/MUM path: /Task4/Program/module/k_means.py from datetime import datetime from typing import List, Tuple import matplotlib.pyplot as plt import numpy as np from sklearn.cluster import KMeans from sklearn.metrics import silhouette_score from module.LatexGenerator import LatexGenerat...
code_fim
hard
{ "lang": "python", "repo": "KKowalewski24/MUM", "path": "/Task4/Program/module/k_means.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> save_latex: bool = False) -> None: scores_clusters_numbers: List[Tuple[List[float], List[float]]] = [] scores_iter_numbers: List[Tuple[List[float], List[float]]] = [] for cluster_value in CLUSTERS_NUMBER: k_means = KMeans( n_clusters=cluster_value ...
code_fim
hard
{ "lang": "python", "repo": "KKowalewski24/MUM", "path": "/Task4/Program/module/k_means.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: r3gh/hackathonRioHeatMap path: /server/tweets/src/stream_twitter.py import tweepy from tweepy import OAuthHandler from tweepy.streaming import StreamListener import numpy as np import json import numpy as np from tweets.src.functions import * class StreamTwitterGenerator: def __init__(self): ...
code_fim
medium
{ "lang": "python", "repo": "r3gh/hackathonRioHeatMap", "path": "/server/tweets/src/stream_twitter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> consumer_key = tokens['consumer_key'] consumer_secret = tokens['consumer_secret'] access_token = tokens['access_token'] access_secret = tokens['access_secret'] auth = OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access_token, access_secret) api = ...
code_fim
medium
{ "lang": "python", "repo": "r3gh/hackathonRioHeatMap", "path": "/server/tweets/src/stream_twitter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> soup = htmlRequest(url) genreList = soup.select('.breadcrumb > li')[1].contents[1] genreName = genreList.contents[0] return genreName """ # Functions which are 3 functions below from here gives exact URL # however it is little bit slower """ def getCatIDLetters(l,url): i = url.rfind("id") catID =...
code_fim
hard
{ "lang": "python", "repo": "ferhatyaman/appStore", "path": "/appReader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ferhatyaman/appStore path: /appReader.py import urllib.request from bs4 import BeautifulSoup import string, sys, sqlite3, time #if connection lost or server waits the program #try to catch error and sleep until error is gone def htmlRequest(url): success= False while not success: tr...
code_fim
hard
{ "lang": "python", "repo": "ferhatyaman/appStore", "path": "/appReader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1748276037/Django path: /bookmanager/book/views.py from django.shortcuts import render <|fim_suffix|> context = { 'name':'想了解更多吗?点击我哦' } # 请求 # 参数2: 模板文件 return render(request,'book/index.html',context=context)<|fim_middle|># Create your views here. from django.http i...
code_fim
medium
{ "lang": "python", "repo": "1748276037/Django", "path": "/bookmanager/book/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> context = { 'name':'想了解更多吗?点击我哦' } # 请求 # 参数2: 模板文件 return render(request,'book/index.html',context=context)<|fim_prefix|># repo: 1748276037/Django path: /bookmanager/book/views.py from django.shortcuts import render <|fim_middle|># Create your views here. from django.http i...
code_fim
medium
{ "lang": "python", "repo": "1748276037/Django", "path": "/bookmanager/book/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Fourier transform fft2 = staticmethod(npa.fft.fft2) backend = NumpyBackend() def set_backend(name): """ Set the backend for the simulations. This function monkey-patches the backend object by changing its class. This way, all methods of the backend object will be replace...
code_fim
hard
{ "lang": "python", "repo": "SiEPIC/legume", "path": "/legume/backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SiEPIC/legume path: /legume/backend.py """ Backend for the simulations. Available backends: - numpy [default] - autograd A backend can be set with the 'set_backend' import legume legume.set_backend("autograd") Numpy is still used with some functionalities; if autograd backend is set, ...
code_fim
hard
{ "lang": "python", "repo": "SiEPIC/legume", "path": "/legume/backend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ably/ably-python path: /ably/types/options.py import random import logging from ably.transport.defaults import Defaults from ably.types.authoptions import AuthOptions log = logging.getLogger(__name__) class Options(AuthOptions): def __init__(self, client_id=None, log_level=0, tls=True, re...
code_fim
hard
{ "lang": "python", "repo": "ably/ably-python", "path": "/ably/types/options.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def loop(self): return self.__loop # RTC1b @property def auto_connect(self): return self.__auto_connect @property def connection_state_ttl(self): return self.__connection_state_ttl @connection_state_ttl.setter def connection_state_tt...
code_fim
hard
{ "lang": "python", "repo": "ably/ably-python", "path": "/ably/types/options.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tiabas/django-forms path: /form_engine/views.py for_field_type(field_type) if not template_field_form: raise HttpResponseNotFound("<p>Invalid field type: </p>" % request.POST.get('qtype')) form_template = get_object_or_404(Survey, pk=form_id) item_forms = forms_for_survey_no_prefix(request, ...
code_fim
hard
{ "lang": "python", "repo": "tiabas/django-forms", "path": "/form_engine/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Displays page for creating or editing a form template """ form_template = get_object_or_404(Survey, pk=form_id) # if form_template.has_answers: # return HttpResponse("Template cannot be edited because it has data attached to it") form_template.update_form = SurveyModelForm(instance=form_templa...
code_fim
hard
{ "lang": "python", "repo": "tiabas/django-forms", "path": "/form_engine/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tiabas/django-forms path: /form_engine/views.py rse('form_template_edit', kwargs={'form_id': form_template.id})) @login_required def question_get(request,form_id): if request.method == "GET": request_get = request.GET.copy() question = Question.objects.get(id=request_get['q_id'], survey=for...
code_fim
hard
{ "lang": "python", "repo": "tiabas/django-forms", "path": "/form_engine/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.parsedstring = unparsedstring self.parsed = False<|fim_prefix|># repo: xl-sec/securityheaders path: /securityheaders/models/xpoweredby/xpoweredby.py from securityheaders.models import Header from securityheaders.models.annotations import * @description('Header describing the server ...
code_fim
medium
{ "lang": "python", "repo": "xl-sec/securityheaders", "path": "/securityheaders/models/xpoweredby/xpoweredby.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, unparsedstring): self.parsedstring = unparsedstring self.parsed = False<|fim_prefix|># repo: xl-sec/securityheaders path: /securityheaders/models/xpoweredby/xpoweredby.py from securityheaders.models import Header from securityheaders.models.annotations import * @de...
code_fim
easy
{ "lang": "python", "repo": "xl-sec/securityheaders", "path": "/securityheaders/models/xpoweredby/xpoweredby.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xl-sec/securityheaders path: /securityheaders/models/xpoweredby/xpoweredby.py from securityheaders.models import Header from securityheaders.models.annotations import * <|fim_suffix|> def __init__(self, unparsedstring): self.parsedstring = unparsedstring self.parsed = False<|f...
code_fim
hard
{ "lang": "python", "repo": "xl-sec/securityheaders", "path": "/securityheaders/models/xpoweredby/xpoweredby.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Load the elevation DEM # Terrainfile is set in config.py dem = xr.open_dataset(terrainfile) dem = dem.rename({'latitude':'lat', 'longitude':'lon'}) demlats = dem['lat'] demlons = dem['lon'] final_lats = prism_grid.lat.values final_lons = prism_grid.lon.values #...
code_fim
hard
{ "lang": "python", "repo": "m-wessler/wxdisco-tools", "path": "/funcs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: m-wessler/wxdisco-tools path: /funcs.py # the old fashioned way first... curlcommand = 'curl -s -m {} -o {} {}'.format(timeout, fpath, url) call(curlcommand, shell=True) try: fsize = stat(fpath).st_size except: print('FILE NOT F...
code_fim
hard
{ "lang": "python", "repo": "m-wessler/wxdisco-tools", "path": "/funcs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: m-wessler/wxdisco-tools path: /funcs.py * pclimo2 return pclimo def downscale_prism(init_time, forecast_time): import warnings warnings.filterwarnings("ignore") from scipy import ndimage from pandas import to_datetime from datetime import datetime, timedelta ...
code_fim
hard
{ "lang": "python", "repo": "m-wessler/wxdisco-tools", "path": "/funcs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SeaWar741/ITC path: /MLH/CursoAWS/eventbrite.py import config # 💡importing our env variables from dotenv from urllib.request import Request, urlopen # 💡open a web url from urllib.parse import quote # 💡get rid of any weird characters in our city string import json # 💡json stands for Javasc...
code_fim
hard
{ "lang": "python", "repo": "SeaWar741/ITC", "path": "/MLH/CursoAWS/eventbrite.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 3. 🆘✨we want to get a JSON response from Eventbrite. # They keep the info we need in the response_body.events. Help us get the data we want! events = json.loads(response_body)["FIX_ME"] # 💡returns a JSON array of events in a city return events<|fim_prefix|># repo: SeaWar741/...
code_fim
hard
{ "lang": "python", "repo": "SeaWar741/ITC", "path": "/MLH/CursoAWS/eventbrite.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openwater/h2o-really path: /openwater/context_processors.py #!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib.sites.models import get_current_site <|fim_suffix|> current_site = get_current_site(request) return { 'site': current_site }<|fim_middle|> def site(req...
code_fim
easy
{ "lang": "python", "repo": "openwater/h2o-really", "path": "/openwater/context_processors.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> current_site = get_current_site(request) return { 'site': current_site }<|fim_prefix|># repo: openwater/h2o-really path: /openwater/context_processors.py #!/usr/bin/env python # -*- coding: utf-8 -*- from django.contrib.sites.models import get_current_site <|fim_middle|>def site(req...
code_fim
easy
{ "lang": "python", "repo": "openwater/h2o-really", "path": "/openwater/context_processors.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: pjanis/funtool path: /funtool/state.py # Defines of a state import collections State = collections.namedtuple('State',['id','data','measures','meta','groupings'] ) # A state is the basic unit of analysis. It can be anything that can be coerced into the given form, # though most measures will a...
code_fim
hard
{ "lang": "python", "repo": "pjanis/funtool", "path": "/funtool/state.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # META #===== # # These are useful meta pairs. They are not neccessary for all states. These are only recommended usages. # #----- # database_id a dict which contains three values that identify the state in a database # The three values are: # table_name the table that identifies t...
code_fim
hard
{ "lang": "python", "repo": "pjanis/funtool", "path": "/funtool/state.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_one_hot_vectorizer(self): """ Asserts ml4ir.base.features.preprocessing.get_one_hot_vectorizer """ feature_info = { "name": "categorical_variable", "feature_layer_info": { "fn": "categorical_indicator_with_vocabulary_...
code_fim
hard
{ "lang": "python", "repo": "salesforce/ml4ir", "path": "/python/ml4ir/base/tests/test_feature_processing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> typ = 'float' label_vector = np.ones(10, dtype=typ) label_vector[0] = 5 label_vector[-1] = 5 label_vector = tf.convert_to_tensor(label_vector) clicks = preprocessing.convert_label_to_clicks(label_vector, typ) assert clicks[0] == 1 and clicks[-1] == 1...
code_fim
hard
{ "lang": "python", "repo": "salesforce/ml4ir", "path": "/python/ml4ir/base/tests/test_feature_processing.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: salesforce/ml4ir path: /python/ml4ir/base/tests/test_feature_processing.py import string from ml4ir.applications.ranking.tests.test_base import RankingTestBase from ml4ir.base.features import preprocessing import tensorflow as tf import numpy as np class RankingModelTest(RankingTestBase): ...
code_fim
hard
{ "lang": "python", "repo": "salesforce/ml4ir", "path": "/python/ml4ir/base/tests/test_feature_processing.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #I am expecting IoU to have dimenssions [n_targets, n_predictions] true_ind = np.arange(IoU.shape[0]) pred_ind = np.argmax(IoU, axis = 1) IoU_matches = IoU[true_ind, pred_ind] ind_sorted = np.argsort(IoU_matches)[::-1] IoU_matches, pred_ind, true_ind = [x[ind_sorted] for x in ...
code_fim
hard
{ "lang": "python", "repo": "ver228/cell_localization", "path": "/cell_localization/evaluation/segmentation_mask.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> chain_approx = cv2.CHAIN_APPROX_SIMPLE if chain_approx else cv2.CHAIN_APPROX_NONE n_labs, seg_mask, stats, centroids = cv2.connectedComponentsWithStats(seg_mask.astype(np.uint8), 4) kernel = cv2.getStructuringElement( cv2.MORPH_ELLIPSE, (kernel_size, kernel_size)) mm = ...
code_fim
hard
{ "lang": "python", "repo": "ver228/cell_localization", "path": "/cell_localization/evaluation/segmentation_mask.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ver228/cell_localization path: /cell_localization/evaluation/segmentation_mask.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: avelinojaver """ import cv2 import numpy as np def get_masks_metrics(true_cells_mask, pred_cells_mask): n_true, true_seg_mask, true_stats, tru...
code_fim
hard
{ "lang": "python", "repo": "ver228/cell_localization", "path": "/cell_localization/evaluation/segmentation_mask.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser() parser.add_argument('--input', type=str, required=True, help='Path to the image.') parser.add_argument('--output_folder', type=str, default='results', help='Path to the output file') parser.add_argument('--o...
code_fim
medium
{ "lang": "python", "repo": "lyx-x/nnimgproc", "path": "/samples/denoising/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lyx-x/nnimgproc path: /samples/denoising/process.py #!/usr/bin/python3 # Noise demonstration: test noise generator import argparse import logging import os from nnimgproc.target_processor.denoising import DenoisingTargetProcessor from nnimgproc.util.image import read, write def main(): <|fim...
code_fim
hard
{ "lang": "python", "repo": "lyx-x/nnimgproc", "path": "/samples/denoising/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> write(image=x, path=os.path.join(args.output_folder, args.output_image)) meta.save(path=os.path.join(args.output_folder, args.output_meta)) logging.info("Finish processing %s" % args.input) if __name__ == '__main__': main()<|fim_prefix|># repo: lyx-x/nnimgproc path: /samples/denoising/p...
code_fim
hard
{ "lang": "python", "repo": "lyx-x/nnimgproc", "path": "/samples/denoising/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> destination, predecessor = initialize(graph, source) for i in range(len(graph)-1): for u in graph: for v in graph[u]: relax(u, v, graph, destination, predecessor) for u in graph: for v in graph[u]: return(retrace_negative_loop(predecessor, source)) return None paths = [] graph = curr...
code_fim
hard
{ "lang": "python", "repo": "solobeton99/forex-arbitrage", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: solobeton99/forex-arbitrage path: /main.py import requests, json, math CURRENCIES = {'GBP', 'USD', 'JPY', 'EUR'} API_KEY = '' class Node(object): def __init__(self, currency_id, CURRENCIES): super(Node, self).__init__() self.id = currency_id self.childs = [] for id in CURRENCIES: i...
code_fim
hard
{ "lang": "python", "repo": "solobeton99/forex-arbitrage", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Imperial-visualizations/Physics-Visualizations path: /visuals_EM/Waves and Dielectrics/plotly_arrows.py import numpy as np import plotly.graph_objs as go def p2c(r, theta, phi): """Convert polar unit vector to cartesians""" return [r * np.sin(theta) * np.cos(phi), r * np.sin(...
code_fim
hard
{ "lang": "python", "repo": "Imperial-visualizations/Physics-Visualizations", "path": "/visuals_EM/Waves and Dielectrics/plotly_arrows.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Finds polar coordinates of arrowhead wing ends""" frac = 0.1 r = 0.5 sin45 = np.sin(np.pi / 4.) if self.out == True: d = r - frac * sin45 elif self.out == False: d = r + frac * sin45 else: raise TypeError("arg:...
code_fim
hard
{ "lang": "python", "repo": "Imperial-visualizations/Physics-Visualizations", "path": "/visuals_EM/Waves and Dielectrics/plotly_arrows.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ephes/django-cast path: /cast/models/theme.py from pathlib import Path from django.conf import settings from django.db import models from django.template import engines from django.template.loaders.base import Loader as BaseLoader from django.utils.translation import gettext_lazy as _ from wagta...
code_fim
hard
{ "lang": "python", "repo": "ephes/django-cast", "path": "/cast/models/theme.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class TemplateName(models.TextChoices): BOOTSTRAP4 = "bootstrap4", _("Bootstrap 4") PLAIN = "plain", _("Just HTML") def get_template_base_dir_choices() -> list[tuple[str, str]]: """ Return a list of choices for the template base directory setting. """ # handle predefined choices ...
code_fim
hard
{ "lang": "python", "repo": "ephes/django-cast", "path": "/cast/models/theme.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @register_setting class TemplateBaseDirectory(BaseSiteSetting): """ The base directory for templates. Makes it possible to use different templates for different sites / change look and feel of the site from the wagtail admin. """ name = models.CharField( choices=get_templ...
code_fim
hard
{ "lang": "python", "repo": "ephes/django-cast", "path": "/cast/models/theme.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Maskime/complex-extract path: /src/database/models.py from peewee import * db = SqliteDatabase("complex_extract.db") def current_db(): <|fim_suffix|> db.create_tables([Torrent]) class Torrent(Model): pk = AutoField() deluge_id = CharField() name = CharField() ...
code_fim
easy
{ "lang": "python", "repo": "Maskime/complex-extract", "path": "/src/database/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: database = db<|fim_prefix|># repo: Maskime/complex-extract path: /src/database/models.py from peewee import * db = SqliteDatabase("complex_extract.db") def current_db(): return db def initialize_db(): db.create_tables([Torrent]) class Torrent(Model): ...
code_fim
medium
{ "lang": "python", "repo": "Maskime/complex-extract", "path": "/src/database/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: barretobrock/slacktools path: /tests/test_db_eng.py from unittest import ( TestCase, main, ) from slacktools.db_engine import ( PSQLClient, SQLiteClient, ) from .common import ( get_test_logger, make_patcher, ) class TestPSQLClient(TestCase): @classmethod def ...
code_fim
hard
{ "lang": "python", "repo": "barretobrock/slacktools", "path": "/tests/test_db_eng.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_session_mgr(self): for eng in [self.ps_eng, self.sl_eng]: # Normal ops with eng.session_mgr(): self.mock_sessionmacher().assert_called() self.mock_sessionmacher()().commit.assert_called() self.mock_sessionmacher()().close...
code_fim
hard
{ "lang": "python", "repo": "barretobrock/slacktools", "path": "/tests/test_db_eng.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @query_id.setter def query_id(self, value): self._query_id = value @property def scene_code(self): return self._scene_code @scene_code.setter def scene_code(self, value): self._scene_code = value @property def search_src(self): return self._...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/IntentQueryRequest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/IntentQueryRequest.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class IntentQueryRequest(object): def __init__(self): self._action_src = None self...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/IntentQueryRequest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #print(o.output_bim) bim.write_pickle(r'../tests/epjson_to_bim_map/detached_house.pickle') bim.write_json(r'../tests/epjson_to_bim_map/detached_house.json') bim.write_graphml(r'../tests/epjson_to_bim_map/detached_house.graphml')<|fim_prefix|># repo: building-energy/uSim2018_Paper29 path: ...
code_fim
medium
{ "lang": "python", "repo": "building-energy/uSim2018_Paper29", "path": "/analysis/openbuilding/epjson_to_bim_map.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: building-energy/uSim2018_Paper29 path: /analysis/openbuilding/epjson_to_bim_map.py # -*- coding: utf-8 -*- import pandas as pd try: from .bim_graph import BimGraph except ImportError: from bim_graph import BimGraph try: from .schedules import YearSchedule,PeriodSchedule,WeekSch...
code_fim
hard
{ "lang": "python", "repo": "building-energy/uSim2018_Paper29", "path": "/analysis/openbuilding/epjson_to_bim_map.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danim1236/JA-POLS path: /2_learning/Alignment/Alignment_learning.py from __future__ import division, print_function import os import shutil import torch import torch.optim as optim import torchvision from Alignment.data import get_datasets from Alignment.nets import initialize_model from Alignmen...
code_fim
hard
{ "lang": "python", "repo": "danim1236/JA-POLS", "path": "/2_learning/Alignment/Alignment_learning.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> feature_extract = config.regress_trans['feature_extract'] # Flag for feature extracting. When False, we finetune the whole model, when True we only update the reshaped layer params # ------- Done Setting Training parameters. ------- # ------- Start running the network: --------------- ...
code_fim
hard
{ "lang": "python", "repo": "danim1236/JA-POLS", "path": "/2_learning/Alignment/Alignment_learning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Create dataloaders dataloaders_dict = {'train': torch.utils.data.DataLoader(train_ds, batch_size=batch_size, shuffle=True), 'val': torch.utils.data.DataLoader(val_ds, batch_size=batch_size, shuffle=True)} # Train model: # Send the model to GPU model_ft = mod...
code_fim
hard
{ "lang": "python", "repo": "danim1236/JA-POLS", "path": "/2_learning/Alignment/Alignment_learning.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bourdenas/troll path: /pytroll/audio.py import pytroll.actions import troll def PlayMusic(track_id, repeat=1): action = pytroll.actions.PlayAudio(track_id=track_id, repeat=repeat) troll.execute(action.SerializeToString()) def StopMusic(): action = pytroll.actions.StopAudio() t...
code_fim
hard
{ "lang": "python", "repo": "bourdenas/troll", "path": "/pytroll/audio.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def PauseSfx(sfx_id): action = pytroll.actions.PauseAudio(sfx_id=sfx_id) troll.execute(action.SerializeToString()) def ResumeSfx(sfx_id): action = pytroll.actions.ResumeAudio(sfx_id=sfx_id) troll.execute(action.SerializeToString())<|fim_prefix|># repo: bourdenas/troll path: /pytroll/aud...
code_fim
medium
{ "lang": "python", "repo": "bourdenas/troll", "path": "/pytroll/audio.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def ResumeSfx(sfx_id): action = pytroll.actions.ResumeAudio(sfx_id=sfx_id) troll.execute(action.SerializeToString())<|fim_prefix|># repo: bourdenas/troll path: /pytroll/audio.py import pytroll.actions import troll def PlayMusic(track_id, repeat=1): action = pytroll.actions.PlayAudio(track_...
code_fim
hard
{ "lang": "python", "repo": "bourdenas/troll", "path": "/pytroll/audio.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nathuffman97/flights path: /src/data_scraping/__apis__/qpx.py import os import json from datetime import date import requests class QPX: def __init__(self, data_path): self.data_path = data_path self._url_api = self._get_api_url() self.header = {'Content-ty...
code_fim
hard
{ "lang": "python", "repo": "nathuffman97/flights", "path": "/src/data_scraping/__apis__/qpx.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def _add_flight_data(self, ret, segment): ret['flight_code'].append(segment['flight']['carrier'] + segment['flight']['number']) leg = segment['leg'][0] ret['airports'].extend([leg['origin'], leg['destination']]) ret['depart_times'].append(leg['departureTime']) ...
code_fim
hard
{ "lang": "python", "repo": "nathuffman97/flights", "path": "/src/data_scraping/__apis__/qpx.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MAECProject/python-maec path: /scripts/maec_4.0.1_to_4.1.py # MAEC 4.0.1 to MAEC 4.1 Converter Script # Translates a MAEC 4.0.1 Package or Bundle into a valid MAEC 4.1 Package or Bundle import sys import os import shutil import argparse import maec from maec.bundle.bundle import Bundle ...
code_fim
hard
{ "lang": "python", "repo": "MAECProject/python-maec", "path": "/scripts/maec_4.0.1_to_4.1.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> args = parser.parse_args() if args.directory: for filename in os.listdir(args.directory): print filename if '.xml' not in filename: pass elif '_report.maec-4.0.1' not in filename: update_maec(os.path.join(args.dir...
code_fim
hard
{ "lang": "python", "repo": "MAECProject/python-maec", "path": "/scripts/maec_4.0.1_to_4.1.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Setup the argument parser parser = argparse.ArgumentParser( description='MAEC 4.0.1 --> MAEC 4.1 XML Converter Utility' ) mutex_group = parser.add_mutually_exclusive_group(required=True) required_name = parser.add_argument_group('required arguments') mutex_group.add...
code_fim
hard
{ "lang": "python", "repo": "MAECProject/python-maec", "path": "/scripts/maec_4.0.1_to_4.1.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get(self, request, *args, **kwargs): "Access aggregate information about entities as they occur in regulations.gov data." results = Entity.objects(id=kwargs['entity_id']) if not results: raise Http404('Docket not found.') entity = results[0] # ...
code_fim
hard
{ "lang": "python", "repo": "LIICornell/sparerib", "path": "/sparerib_api/views.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: LIICornell/sparerib path: /sparerib_api/views.py ': 'RTF', 'wp8': 'Word Perfect'} class DocumentView(APIView): "Regulations.gov document view" def get(self, request, *args, **kwargs): "Access basic metadata about regulations.gov documents." results = list(Doc.objects(id=k...
code_fim
hard
{ "lang": "python", "repo": "LIICornell/sparerib", "path": "/sparerib_api/views.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: LIICornell/sparerib path: /sparerib_api/views.py tedView(APIView): "Regulations.gov docket view" def get(self, request, *args, **kwargs): "Access basic metadata about regulations.gov dockets." results = list(self.aggregation_class.objects(id=kwargs[self.aggregation_field...
code_fim
hard
{ "lang": "python", "repo": "LIICornell/sparerib", "path": "/sparerib_api/views.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> logits_data, _, _ = disc_model(preprocess(samples), WEs, BEs, WFCS, BFCS, WY, BY, WC, BC, False) cost_sample = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=logits_data, labels=tf.constant(1.0, shape=[FLAGS.batch_size, 1]))) contrastive_samples = gen_model(z_vecs, WPJ, BPJ, WGs, BGs...
code_fim
hard
{ "lang": "python", "repo": "stereoboy/generative_adversarial", "path": "/infogan_mnist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stereoboy/generative_adversarial path: /infogan_mnist.py d(relued, WEs[1], strides=[1, 2, 2, 1], padding='SAME') conved = tf.nn.bias_add(conved, BEs[1]) normalized = batch_norm_layer(conved, "discriminator/bne1", reuse) relued = leaky_relu(normalized) # flat 1-d vectors ch_size = FLAG...
code_fim
hard
{ "lang": "python", "repo": "stereoboy/generative_adversarial", "path": "/infogan_mnist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # initialize weights, biases for Generator # shape=[kernel_size, kernel_size, (!)out_ch_size, (!)in_ch_size] for conv2d_transposed kernel_size = 5 WGs = [ tf.get_variable('g_conv_0', shape = [kernel_size, kernel_size, 64, 128], initializer=init_with_normal()), tf.get_variable('g_conv_1...
code_fim
hard
{ "lang": "python", "repo": "stereoboy/generative_adversarial", "path": "/infogan_mnist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmontalb/MarkovModels path: /StochasticModels/ClosedFormModels/CHullWhiteModel.py from math import exp def discount_factor_observed_at(observation_date, valuation_date, maturity, k, sigma, reference_curve): """ :param observation_date: :param valuatio...
code_fim
hard
{ "lang": "python", "repo": "pmontalb/MarkovModels", "path": "/StochasticModels/ClosedFormModels/CHullWhiteModel.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> forward_rate = reference_curve.instantaneous_forward_rate(days_to_maturity) forward_rate_plus = reference_curve.instantaneous_forward_rate(days_to_maturity + 1.0) forward_rate_minus = reference_curve.instantaneous_forward_rate(days_to_maturity - 1.0) one_day = 1.0 / 365 forward_rate_d...
code_fim
hard
{ "lang": "python", "repo": "pmontalb/MarkovModels", "path": "/StochasticModels/ClosedFormModels/CHullWhiteModel.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rimvaliulin/termssrv path: /termssrv/terms/urls.py from rest_framework.routers import Default<|fim_suffix|>ks', BookViewSet) urlpatterns = router.urls<|fim_middle|>Router from .views import BookViewSet router = DefaultRouter() router.register('boo
code_fim
medium
{ "lang": "python", "repo": "rimvaliulin/termssrv", "path": "/termssrv/terms/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ter = DefaultRouter() router.register('books', BookViewSet) urlpatterns = router.urls<|fim_prefix|># repo: rimvaliulin/termssrv path: /termssrv/terms/urls.py from rest_framework.routers import Default<|fim_middle|>Router from .views import BookViewSet rou
code_fim
easy
{ "lang": "python", "repo": "rimvaliulin/termssrv", "path": "/termssrv/terms/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rimvaliulin/termssrv path: /termssrv/terms/urls.py from rest_framework.routers import DefaultRouter from .views import BookViewSet rou<|fim_suffix|>ks', BookViewSet) urlpatterns = router.urls<|fim_middle|>ter = DefaultRouter() router.register('boo
code_fim
easy
{ "lang": "python", "repo": "rimvaliulin/termssrv", "path": "/termssrv/terms/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Solution --> linear reverse travel and save in a array and check in a the reverse --> To linear reverse travel --> recurrsive function or save data in stack Time --> 2O(n) """ llist = createfromlist([1, 2, 3, 4, 5, 6, 5, 4, 3, 2]) def checkpalindrome(head): revlist.append(recsaverev(llist.head)) ...
code_fim
hard
{ "lang": "python", "repo": "RoKu1/cracking-the-coding-interview", "path": "/Linked_Lists/6Palindrome.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: RoKu1/cracking-the-coding-interview path: /Linked_Lists/6Palindrome.py """ Palindrome: Implement a function to check if a linked list is a palindrome, """ class Node: def __init__(self, data): self.data = data self.next = None class LList: def __init__(self): s...
code_fim
hard
{ "lang": "python", "repo": "RoKu1/cracking-the-coding-interview", "path": "/Linked_Lists/6Palindrome.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>""" There are many solutions --> reverse the linkedlist and copy or save the reverse in array/stack(stack makes the linear travesal reverse) or write recuursive function to save reverse --> Solution --> linear reverse travel and save in a array and check in a the reverse --> To linear reverse travel -->...
code_fim
hard
{ "lang": "python", "repo": "RoKu1/cracking-the-coding-interview", "path": "/Linked_Lists/6Palindrome.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: KinglittleQ/GST-Tacotron path: /Synthesis.py from utils import * from Data import get_eval_data from Hyperparameters import Hyperparameters as hp import torch from scipy.io.wavfile import write from Network import * import sys import os # import cv2 device = torch.device(hp.device) def synth...
code_fim
hard
{ "lang": "python", "repo": "KinglittleQ/GST-Tacotron", "path": "/Synthesis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> wav_hat = spectrogram2wav(mag_hat) wav_path = os.path.join(log_dir, 'test_wav/epoch{}-{}.wav'.format(epoch, speaker)) write(wav_path, hp.sr, wav_hat) print('synthesis ' + wav_path) if __name__ == '__main__': argv = sys.argv log_number = int(argv[1]) epoch = in...
code_fim
hard
{ "lang": "python", "repo": "KinglittleQ/GST-Tacotron", "path": "/Synthesis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ## GCN related parser.add_argument('--wup_pos', metavar='FLOAT', default=0.5, type=float, help='threshold for positive relations') parser.add_argument('--wup_neg', metavar='FLOAT', default=0.11, type=float, help='threshold for...
code_fim
hard
{ "lang": "python", "repo": "stevehuanghe/multi_label_zsl", "path": "/utils/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument('--gcn_layers', metavar='STR', default='128 128', help='hidden layers') parser.add_argument('--d_dim', metavar='INT', default=300, type=int, help='dimension for GCN input') parser.add_argument('--h_dim', metavar='INT', default=64, type=int, help='dimension for a...
code_fim
hard
{ "lang": "python", "repo": "stevehuanghe/multi_label_zsl", "path": "/utils/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stevehuanghe/multi_label_zsl path: /utils/config.py import argparse import yaml from pprint import pprint class ArgParser(object): def __init__(self): parser = argparse.ArgumentParser() ################################ Protected ##################################### p...
code_fim
hard
{ "lang": "python", "repo": "stevehuanghe/multi_label_zsl", "path": "/utils/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kowabunga314/lumen path: /lumen/showcase/tests.py from datetime import datetime, timezone from django.test import TestCase from django.urls import resolve, reverse from showcase.models import Photo, Series from showcase.views import index, get_series # Create your tests here. class SeriesModelTe...
code_fim
hard
{ "lang": "python", "repo": "kowabunga314/lumen", "path": "/lumen/showcase/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class SeriesApiTests(TestCase): def test_series_basic_call(self): response = self.client.get('/series/') self.assertEqual(response.status_code, 200) class PhotoApiTests(TestCase): def test_photo_url_resolves(self): response = self.client.get('/photo/') self.asse...
code_fim
hard
{ "lang": "python", "repo": "kowabunga314/lumen", "path": "/lumen/showcase/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }