text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> """Getting information about an object. Called for directories and unknown paths.""" elog("getting info on {}".format(cloud_path)) def got_info(self, cloud_obj): """Got information about an object.""" def creating_directory(self, cloud_folder): """Creating a directory.""" elog("creating dire...
code_fim
hard
{ "lang": "python", "repo": "jpn--/pines", "path": "/pines/egnyte.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpn--/pines path: /pines/egnyte.py ess_callbacks.upload_start("dictionary", file_obj, buffer.tell()) for i in range(retries): try: file_obj.upload(buffer) except egnyte.exc.NotAuthorized: elog('upload NotAuthorized: '+str(file_obj).replace('{','[').replace('}',']')) time.sleep(inter...
code_fim
hard
{ "lang": "python", "repo": "jpn--/pines", "path": "/pines/egnyte.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def pip_install_1(egnyte_python_package_file): import pip from .temporary import TemporaryDirectory tempdir = TemporaryDirectory() download_file(egnyte_python_package_file, tempdir.name, overwrite=True, mkdir=False) base_filename = os.path.basename(egnyte_python_package_file) pip.main(['install', os...
code_fim
hard
{ "lang": "python", "repo": "jpn--/pines", "path": "/pines/egnyte.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># "filtered_models" dataset summary: # 30 rows x 8 columns # model_name feature_count bac_test rec_test bac_train rec_train time_fit time_score # 17 SGD feature_set_1 StdScale 7 0.949 0.915 0.950 0.916 0.330 0.038 # 18 SGD featu...
code_fim
hard
{ "lang": "python", "repo": "TeamEpicProjects/Customer-Prioritization-for-Marketing", "path": "/solution/development/model_experiments/2.f_filter_candidate_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TeamEpicProjects/Customer-Prioritization-for-Marketing path: /solution/development/model_experiments/2.f_filter_candidate_models.py # This script filters models based on the bac and recall scores # given by the domain expert import pandas as pd import os base_path = os.path.dirname(os.path.rea...
code_fim
hard
{ "lang": "python", "repo": "TeamEpicProjects/Customer-Prioritization-for-Marketing", "path": "/solution/development/model_experiments/2.f_filter_candidate_models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class CurrentSiteMiddleware(object): def process_request(self, request): request.__class__.site = LazySite() return None<|fim_prefix|># repo: jess3/django path: /django/contrib/sites/middleware.py class LazySite(object): def __get__(self, request, obj_type=None): <|fim_middle|> ...
code_fim
hard
{ "lang": "python", "repo": "jess3/django", "path": "/django/contrib/sites/middleware.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> request.__class__.site = LazySite() return None<|fim_prefix|># repo: jess3/django path: /django/contrib/sites/middleware.py class LazySite(object): def __get__(self, request, obj_type=None): if not hasattr(request, '_cached_site'): from django.contrib.sites.models ...
code_fim
easy
{ "lang": "python", "repo": "jess3/django", "path": "/django/contrib/sites/middleware.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jess3/django path: /django/contrib/sites/middleware.py class LazySite(object): def __get__(self, request, obj_type=None): <|fim_suffix|>class CurrentSiteMiddleware(object): def process_request(self, request): request.__class__.site = LazySite() return None<|fim_middle|> ...
code_fim
hard
{ "lang": "python", "repo": "jess3/django", "path": "/django/contrib/sites/middleware.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ojhowribeiro/PythonProjects path: /exercicios/PycharmProjects/exepython/ex005.py n = int(input('digite um numero: ')) print('o antecessor de {} é {} e o sucessor é {}'.format(n, n-1, n+1)) <|fim_suffix|>#2**(1/2) calcular a raiz quadrada'''<|fim_middle|> '''n1 = int(input('digite um numero:...
code_fim
medium
{ "lang": "python", "repo": "Ojhowribeiro/PythonProjects", "path": "/exercicios/PycharmProjects/exepython/ex005.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#2**(1/2) calcular a raiz quadrada'''<|fim_prefix|># repo: Ojhowribeiro/PythonProjects path: /exercicios/PycharmProjects/exepython/ex005.py n = int(input('digite um numero: ')) print('o antecessor de {} é {} e o sucessor é {}'.format(n, n-1, n+1)) <|fim_middle|> '''n1 = int(input('digite um numero:...
code_fim
medium
{ "lang": "python", "repo": "Ojhowribeiro/PythonProjects", "path": "/exercicios/PycharmProjects/exepython/ex005.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' Expects input vocab indices as (batch, seq_len). Also requires a list of lengths for dynamic batching. ''' q = Last_QA ql = Last_QA_lengths c = tar cl = tar_lengths h = hist hl = hist_lengths # write history embedding to mem...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/CMN.pytorch", "path": "/tasks/NDH/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '''Initialize layer.''' super(SoftDotAttention, self).__init__() self.linear_in = nn.Linear(query_dim, ctx_dim, bias=False) self.sm = nn.Softmax() self.linear_out = nn.Linear(query_dim + ctx_dim, query_dim, bias=False) self.tanh = nn.Tanh() def forward(...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/CMN.pytorch", "path": "/tasks/NDH/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mfkiwl/CMN.pytorch path: /tasks/NDH/model.py import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from param import args from DAN_modules.refer_find_modules import REFER, FI...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/CMN.pytorch", "path": "/tasks/NDH/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tridungduong16/research-phd-uts path: /fliptest/exact-ot/optimize_gurobi.py import numpy as np from gurobipy import Model, quicksum def optimize(X1, X2, dists, counts1=None, counts2=None, decimals=6, verbose=True): ''' Finds the optimal transport mapping between the people in Groups 1 an...
code_fim
hard
{ "lang": "python", "repo": "tridungduong16/research-phd-uts", "path": "/fliptest/exact-ot/optimize_gurobi.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #organize the result into dicts r12 = np.round(result * num_ppl1, decimals=decimals) forward = {} for i in range(num_rows1): forward[i] = {j: r12[i,j] for j in range(num_rows2) if r12[i,j] != 0} r21 = np.round(result.T * num_ppl2, decimals=decimals) reverse = {} for j i...
code_fim
medium
{ "lang": "python", "repo": "tridungduong16/research-phd-uts", "path": "/fliptest/exact-ot/optimize_gurobi.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qtdemo1/acme-freight-controller path: /server/__init__.py """ Parent application that loads any child applications at their proper paths. If we end up doing the static parts completely separately, this can just load the API app directly. """ from server.exceptions import AuthenticationException ...
code_fim
medium
{ "lang": "python", "repo": "qtdemo1/acme-freight-controller", "path": "/server/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Wires the flask applications together into one wsgi app :return: A flask/wsgi app that is composed of multiple sub apps """ from server.web import create_app # If we do a static javascript app via flask, add it here # from server.web import create_app as create_web_...
code_fim
medium
{ "lang": "python", "repo": "qtdemo1/acme-freight-controller", "path": "/server/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rjw57/streamkinect2 path: /test/testzeroconf.py """ Test ZeroConf service discovery. """ from logging import getLogger from tornado.testing import AsyncTestCase from zmq.eventloop.ioloop import ZMQIOLoop from streamkinect2.server import Server, ServerBrowser from streamkinect2.common import Endp...
code_fim
hard
{ "lang": "python", "repo": "rjw57/streamkinect2", "path": "/test/testzeroconf.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for s in listener.servers: if s.name == server.name: log.info('Discovered server has endpoint {0} which should be {1}'.format( s.endpoint, server.endpoints[EndpointType.control])) assert s.endpoint == server.endpoi...
code_fim
hard
{ "lang": "python", "repo": "rjw57/streamkinect2", "path": "/test/testzeroconf.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MisinformedDNA/pulumi-azure-native path: /sdk/python/pulumi_azure_native/web/v20150801/server_farm.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pul...
code_fim
hard
{ "lang": "python", "repo": "MisinformedDNA/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/web/v20150801/server_farm.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> __props__ = dict() __props__["admin_site_name"] = None __props__["geo_region"] = None __props__["hosting_environment_profile"] = None __props__["kind"] = None __props__["location"] = None __props__["maximum_number_of_workers"] = None __props...
code_fim
hard
{ "lang": "python", "repo": "MisinformedDNA/pulumi-azure-native", "path": "/sdk/python/pulumi_azure_native/web/v20150801/server_farm.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: athrn/kognitivo path: /task_widgets/find_in_table/find_in_table.py import random from kivy.app import App from kivy.properties import StringProperty from task_widgets.task_base.mixins import StartImmediatelyMixin from answer_widgets import TableButtonsAnswerWidget, DisappearOnCorrectAnswerButto...
code_fim
medium
{ "lang": "python", "repo": "athrn/kognitivo", "path": "/task_widgets/find_in_table/find_in_table.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> values = list(self.point_set * self.SIZE) random.shuffle(values) widget = super(FindInTable, self).get_answer_widget(rows=self.SIZE, cols=self.SIZE) widget.add_variants(values, self._check_answer) return widget def on_correct_answer(self, button): App.g...
code_fim
hard
{ "lang": "python", "repo": "athrn/kognitivo", "path": "/task_widgets/find_in_table/find_in_table.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> raise NotImplementedError() def get_description_widget(self, **kwargs): alpha = list(self.generate_alphabet()) random.shuffle(alpha) self.point_set = tuple(alpha[:self.SIZE]) self.correct_answer = random.choice(self.point_set) widget = super(FindInTable...
code_fim
hard
{ "lang": "python", "repo": "athrn/kognitivo", "path": "/task_widgets/find_in_table/find_in_table.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Calculates the classification for each output layer. Parameters ---------- y_true: tensor raw_prediction: tensor object_mask: tensor batch_size: integer Returns ------- class_loss: float """ true_class_probabilities = y_true[..., 5:] predicted_...
code_fim
hard
{ "lang": "python", "repo": "timoSchma/Paprika_Kiwi_Object_Detector", "path": "/src/model_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: timoSchma/Paprika_Kiwi_Object_Detector path: /src/model_utils.py 1]) grid_x = K.tile(K.reshape(K.arange(0, stop=grid_shape[1]), [1, -1, 1, 1]), [grid_shape[0], 1, 1, 1]) grid = K.concatenate([grid_x, grid_y]) grid = K.cast(grid, K.dtype(features)) return grid,...
code_fim
hard
{ "lang": "python", "repo": "timoSchma/Paprika_Kiwi_Object_Detector", "path": "/src/model_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: timoSchma/Paprika_Kiwi_Object_Detector path: /src/model_utils.py _base(features, anchors, num_classes, input_shape): """ Reshape anchors and features and adjust predictions to each spatial grid point and anchor size. Parameters ---------- features: tensor anchors: numpy.n...
code_fim
hard
{ "lang": "python", "repo": "timoSchma/Paprika_Kiwi_Object_Detector", "path": "/src/model_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): print("[+] COLLECTING EXCHANGES DATA...") scheduler = Scheduler().get_scheduler() scheduler.add_job(collect, "cron", hour="*") # scheduler.add_job(collect, "cron", minute="*/1") scheduler.start() if __name__ == "__main__": main()<|fim_prefix|># repo: otrenav/cvest-back...
code_fim
hard
{ "lang": "python", "repo": "otrenav/cvest-backend", "path": "/batch/markets/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: otrenav/cvest-backend path: /batch/markets/main.py # FIX BEGIN # Python 3 imports fix import sys sys.path.append("../../") # FIX END import logging from datetime import datetime from scheduler import Scheduler from databases import MongoDatabase from assets.exchanges import Exchange logging...
code_fim
medium
{ "lang": "python", "repo": "otrenav/cvest-backend", "path": "/batch/markets/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: squishykid/solax path: /solax/inverters/x3_mic_pro_g2.py import voluptuous as vol from solax.inverter import Inverter from solax.units import Total, Units from solax.utils import div10, div100, pack_u16, to_signed, to_signed32, twoway_div10 class X3MicProG2(Inverter): """X3MicProG2 v3.008....
code_fim
hard
{ "lang": "python", "repo": "squishykid/solax", "path": "/solax/inverters/x3_mic_pro_g2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return { "Grid 1 Voltage": (0, Units.V, div10), "Grid 2 Voltage": (1, Units.V, div10), "Grid 3 Voltage": (2, Units.V, div10), "Grid 1 Current": (3, Units.A, twoway_div10), "Grid 2 Current": (4, Units.A, twoway_div10), "Grid 3 ...
code_fim
hard
{ "lang": "python", "repo": "squishykid/solax", "path": "/solax/inverters/x3_mic_pro_g2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> setup_responses() source = SourceConvex() streams = source.streams( { "deployment_url": "https://murky-swan-635.convex.cloud", "access_key": "test_api_key", } ) assert len(streams) == 2 streams.sort(key=lambda stream: stream.table_name) a...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/dts/airbyte/airbyte-integrations/connectors/source-convex/unit_tests/test_source.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alldatacenter/alldata path: /dts/airbyte/airbyte-integrations/connectors/source-convex/unit_tests/test_source.py # # Copyright (c) 2023 Airbyte, Inc., all rights reserved. # from unittest.mock import MagicMock import responses from source_convex.source import SourceConvex def setup_responses(...
code_fim
hard
{ "lang": "python", "repo": "alldatacenter/alldata", "path": "/dts/airbyte/airbyte-integrations/connectors/source-convex/unit_tests/test_source.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wuxiaodong1014/easydl2paddlex-det path: /utils.py import os import os.path as osp import json def get_file_name(file_path): _, fullflname = os.path.split(file_path) return fullflname def mkdir_p(folder_path): <|fim_suffix|> js_dicts = dict() with open(json_path, "r", ...
code_fim
medium
{ "lang": "python", "repo": "wuxiaodong1014/easydl2paddlex-det", "path": "/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not osp.exists(folder_path): os.mkdir(folder_path) def read_json(json_path): js_dicts = dict() with open(json_path, "r", encoding="utf-8")as f: js_dicts = json.load(f) return js_dicts<|fim_prefix|># repo: wuxiaodong1014/easydl2paddlex-det path: /utils.py import ...
code_fim
medium
{ "lang": "python", "repo": "wuxiaodong1014/easydl2paddlex-det", "path": "/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print rcgn.recognize(test) return [thresh, hud, test] def cnt_to_img(self, img, cnt): rect = cv2.minAreaRect(cnt) x,y,w,h = cv2.boundingRect(cnt) angle = rect[2] if (rect[1][0] > rect[1][1]): angle = 90 + angle mask = np.zeros_lik...
code_fim
hard
{ "lang": "python", "repo": "ncos/checkq", "path": "/normalize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> good_cnt.append(cnt) return good_cnt def postprocess(self, img): d1 = cv2.getTrackbarPos('d1', self.windowname) S1 = cv2.getTrackbarPos('S1', self.windowname) S2 = cv2.getTrackbarPos('S2', self.windowname) dilated = self.dilate(cv2.bitwise_not(img)...
code_fim
hard
{ "lang": "python", "repo": "ncos/checkq", "path": "/normalize.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ncos/checkq path: /normalize.py #!/usr/bin/python import cv2 import numpy as np import tflow_recognize as rcgn class ImageDisplay: def __init__(self, windowname): self.windowname = windowname cv2.namedWindow(windowname, cv2.WINDOW_NORMAL) def show_blend(self, images...
code_fim
hard
{ "lang": "python", "repo": "ncos/checkq", "path": "/normalize.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # new candidate model, with PF inputs + pfImpactParameterTagInfos * pfSecondaryVertexTagInfos * pfCombinedSecondaryVertexBJetTags )<|fim_prefix|># repo: wouf/cmssw path: /RecoBTag/Configuration/python/RecoBTag_cff.py import FWCore.ParameterSet.Config as cms # define the b-tag squences f...
code_fim
hard
{ "lang": "python", "repo": "wouf/cmssw", "path": "/RecoBTag/Configuration/python/RecoBTag_cff.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wouf/cmssw path: /RecoBTag/Configuration/python/RecoBTag_cff.py import FWCore.ParameterSet.Config as cms # define the b-tag squences for offline reconstruction from RecoBTag.SoftLepton.softLepton_cff import * from RecoBTag.ImpactParameter.impactParameter_cff import * from RecoBTag.SecondaryVerte...
code_fim
hard
{ "lang": "python", "repo": "wouf/cmssw", "path": "/RecoBTag/Configuration/python/RecoBTag_cff.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ddierschow/cab984 path: /bin/prints.py drawing, A MOKO LESNEY (capitals) in scroll, 1958-59', 'B4': 'B4: line drawing, A MOKO LESNEY (capitals) in scroll, 1959', 'B5': 'B5: line drawing, A MOKO LESNEY (capitals) in scroll, 1960', 'C': 'C: line drawing, A LESNEY in scroll, 1961', 'D1': 'D1: c...
code_fim
hard
{ "lang": "python", "repo": "ddierschow/cab984", "path": "/bin/prints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def show_model(pif, mod, compact=False): img = '' if compact else pif.render.format_image_required(mod['casting.id'], pdir=config.IMG_DIR_MAN, largest=mbdata.IMG_SIZ_SMALL) url = "single.cgi?id=" + mod['casting.id'] ostr = '<center><a href="%s">%s<br>%s<br>' % (url, mod['id'], img) ostr ...
code_fim
hard
{ "lang": "python", "repo": "ddierschow/cab984", "path": "/bin/prints.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ddierschow/cab984 path: /bin/prints.py AT BRITAIN', 'W6': 'white &copy; 1974 LESNEY PRODUCTS &amp; CO. LTD. PRINTED AND MADE IN GREAT BRITAIN', 'W7': 'white &copy; 1974 LESNEY PRODUCTS &amp; CO. LTD. LONDON ENGLAND', 'BLK': 'black "TM"', 'RED': 'red "TM"', 'Sup': '"Superfast" in script', 'S...
code_fim
hard
{ "lang": "python", "repo": "ddierschow/cab984", "path": "/bin/prints.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: junaid340/UrduChatBot-using-Seq2Seq-Model path: /app.py # -*- coding: utf-8 -*- """ Created on Tue Apr 15 23:48:28 2019 @author: IrfanDanish """ from flask import Flask, render_template, request from flask import jsonify from chatbot_serving import chat_fun_english, chat_fun_urdu, model_loading...
code_fim
hard
{ "lang": "python", "repo": "junaid340/UrduChatBot-using-Seq2Seq-Model", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route('/message_english', methods=['POST']) def reply_english(): question = request.form['msg'] answer = chat_fun_english(question, model, chat_settings, chatlog_filepath) write_response(question, answer, acs_point='Web App', language='english') return jsonify( { 'text': answer} ) @...
code_fim
hard
{ "lang": "python", "repo": "junaid340/UrduChatBot-using-Seq2Seq-Model", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Erodibility (units depend on m_sp).""" return self._K @K.setter def K(self, new_val): self._K = return_array_at_node(self._grid, new_val) def run_one_step(self, dt): """A simple, explicit implementation of a stream power algorithm. If you are routi...
code_fim
hard
{ "lang": "python", "repo": "landlab/landlab", "path": "/landlab/components/stream_power/stream_power.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # m and n will always be set, but care needs to be taken to include Q # and W directly if appropriate self._stream_power_erosion = self._grid.zeros(centering="node") self._alpha = self._grid.zeros("node") @property def K(self): """Erodibility (units depend...
code_fim
hard
{ "lang": "python", "repo": "landlab/landlab", "path": "/landlab/components/stream_power/stream_power.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: landlab/landlab path: /landlab/components/stream_power/stream_power.py permits longer timesteps than a traditional explicit solver under such conditions, it is still possible to create numerical instability through use of too long a timestep while using this component. The user is ca...
code_fim
hard
{ "lang": "python", "repo": "landlab/landlab", "path": "/landlab/components/stream_power/stream_power.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: artas90/django-static-preprocessors path: /static_preprocessors/preprocessors/base.py from abc import ABCMeta, abstractmethod class AbstractPreprocessor(object): __metaclass__ = ABCMeta EXTENSIONS = [] <|fim_suffix|> @abstractmethod def post_collect_static(self): pass<|...
code_fim
medium
{ "lang": "python", "repo": "artas90/django-static-preprocessors", "path": "/static_preprocessors/preprocessors/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> EXTENSIONS = [] @abstractmethod def compile_url(self, source_url): pass @abstractmethod def post_collect_static(self): pass<|fim_prefix|># repo: artas90/django-static-preprocessors path: /static_preprocessors/preprocessors/base.py from abc import ABCMeta, abstractmet...
code_fim
medium
{ "lang": "python", "repo": "artas90/django-static-preprocessors", "path": "/static_preprocessors/preprocessors/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: m-star18/atcoder path: /submissions/abc062/a.py import sys input = sys.stdin.readline x, y = map(int, input().split()) gloup<|fim_suffix|> gloup_c) and (y in gloup_c)): ans = 'Yes' else: ans = 'No' print(ans)<|fim_middle|>_a = [1, 3, 5, 7, 8, 10, 12] gloup_b = [4, 6, 9, 11] gloup_c = [2]...
code_fim
medium
{ "lang": "python", "repo": "m-star18/atcoder", "path": "/submissions/abc062/a.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> gloup_c) and (y in gloup_c)): ans = 'Yes' else: ans = 'No' print(ans)<|fim_prefix|># repo: m-star18/atcoder path: /submissions/abc062/a.py import sys input = sys.stdin.readline x, y = map(int, input().split()) gloup_a = [1, 3, 5, 7, 8, 10, 12] gloup_b = [4, 6, 9, 11] gloup_c = [2] if ((x in <|f...
code_fim
medium
{ "lang": "python", "repo": "m-star18/atcoder", "path": "/submissions/abc062/a.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: susanow/ssnpy path: /ssnctl #!/usr/bin/env python3 # -*- coding: utf-8 -*- # # MIT License # Copyright (c) 2017 Susanow # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Softwar...
code_fim
hard
{ "lang": "python", "repo": "susanow/ssnpy", "path": "/ssnctl", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> argc = len(sys.argv) argv = sys.argv if (argc < 2): usage() exit(-1) option = argv[1] if (option == "nfvi"): nfvi.main (argc-1, argv[1:]) elif (option == "vnf" ): vnf.main (argc-1, argv[1:]) elif (option == "port"): port.main (argc-1, argv[1:]) eli...
code_fim
hard
{ "lang": "python", "repo": "susanow/ssnpy", "path": "/ssnctl", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> option = argv[1] if (option == "nfvi"): nfvi.main (argc-1, argv[1:]) elif (option == "vnf" ): vnf.main (argc-1, argv[1:]) elif (option == "port"): port.main (argc-1, argv[1:]) elif (option == "ppp" ): ppp.main (argc-1, argv[1:]) elif (option == "d2" ): d2.main (arg...
code_fim
medium
{ "lang": "python", "repo": "susanow/ssnpy", "path": "/ssnctl", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shrank/networking-scripts path: /scripts/grep-server.py # Python 3 server example from http.server import BaseHTTPRequestHandler, HTTPServer import time from urllib import parse import subprocess import re import os hostName = '' serverPort = 80 MAC_File="/data/ALL_DEVICES_MAC-PORT_LIST.txt" data...
code_fim
hard
{ "lang": "python", "repo": "shrank/networking-scripts", "path": "/scripts/grep-server.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": webServer = HTTPServer((hostName, serverPort), MyServer) print("Server started http://%s:%s" % (hostName, serverPort)) try: webServer.serve_forever() except KeyboardInterrupt: pass webServer.server_close() print("Server stopped."...
code_fim
hard
{ "lang": "python", "repo": "shrank/networking-scripts", "path": "/scripts/grep-server.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> requestDeny = "/json/api/request-deny.php" requestCancel = "/json/api/request-cancel.php" requestSend = "/json/api/request-send.php" # flist_reportSubmit = "/json/api/report-submit.php" class requestsConstants: userAgent = "python-flist-client/0.01"<|fim_prefix|># repo: FurtiveFox/fch...
code_fim
hard
{ "lang": "python", "repo": "FurtiveFox/fchat_mod", "path": "/fchat/constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FurtiveFox/fchat_mod path: /fchat/constants.py class flistEndpoints: """ https://toys.in.newtsin.space/api-docs/ """ domain = "https://f-list.net" getApiTicket = "/json/getApiTicket.php" mappingList = "/json/api/mapping-list.php" characterData = "/json/api/character-data.php"...
code_fim
hard
{ "lang": "python", "repo": "FurtiveFox/fchat_mod", "path": "/fchat/constants.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: intelsdi-x/snap-plugin-lib-py path: /snap_plugin/v1/tests/test_config_map.py # -*- coding: utf-8 -*- # http://www.apache.org/licenses/LICENSE-2.0.txt # # Copyright 2016 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in comp...
code_fim
hard
{ "lang": "python", "repo": "intelsdi-x/snap-plugin-lib-py", "path": "/snap_plugin/v1/tests/test_config_map.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> del(cfg["bool"]) assert len(cfg) == 2 assert "bool" not in cfg.keys() cfg.clear() assert len(cfg) == 0 assert len(cfg.keys()) == 0 assert len(cfg.values()) == 0 def test_update(self): cfg = ConfigMap(("int", 1), ("string", "asdf"), ("bo...
code_fim
hard
{ "lang": "python", "repo": "intelsdi-x/snap-plugin-lib-py", "path": "/snap_plugin/v1/tests/test_config_map.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from snap_plugin.v1.config_map import ConfigMap class TestConfigMap(object): def test_constructor(self): # empty cfg = ConfigMap() assert len(cfg) == 0 # kwargs cfg = ConfigMap(int=1, string="asdf", bool=True, float=1.1) assert len(cfg) == 4 a...
code_fim
hard
{ "lang": "python", "repo": "intelsdi-x/snap-plugin-lib-py", "path": "/snap_plugin/v1/tests/test_config_map.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chris48s/UK-Polling-Stations path: /polling_stations/apps/whitelabel/urls.py from django.conf.urls import patterns, include, url from django.conf import settings <|fim_suffix|>urlpatterns = patterns( '', url(r'', include(core_patterns)), )<|fim_middle|>from polling_stations.urls import c...
code_fim
easy
{ "lang": "python", "repo": "chris48s/UK-Polling-Stations", "path": "/polling_stations/apps/whitelabel/urls.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = patterns( '', url(r'', include(core_patterns)), )<|fim_prefix|># repo: chris48s/UK-Polling-Stations path: /polling_stations/apps/whitelabel/urls.py from django.conf.urls import patterns, include, url from django.conf import settings <|fim_middle|>from polling_stations.urls import c...
code_fim
easy
{ "lang": "python", "repo": "chris48s/UK-Polling-Stations", "path": "/polling_stations/apps/whitelabel/urls.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sethah/allencv path: /allencv/tests/predictors/object_detection/region_proposal_network.py from allencv.common.testing import AllenCvTestCase from allencv.data.dataset_readers import ImageAnnotationReader from allencv.predictors import ImagePredictor from allencv.models.object_detection import RP...
code_fim
medium
{ "lang": "python", "repo": "sethah/allencv", "path": "/allencv/tests/predictors/object_detection/region_proposal_network.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_predictor(self): backbone = ResnetEncoder('resnet18') fpn_out_channels = 256 fpn_backbone = FPN(backbone, fpn_out_channels) anchor_sizes = [[32], [64], [128], [256], [512]] anchor_aspect_ratios = [[0.5, 1.0, 2.0], [0.5, 1.0, 2.0], [0.5, 1.0, 2.0], ...
code_fim
medium
{ "lang": "python", "repo": "sethah/allencv", "path": "/allencv/tests/predictors/object_detection/region_proposal_network.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PRBonn/semantic-kitti-api path: /content.py #!/usr/bin/env python3 # This file is covered by the LICENSE file in the root of this project. import argparse import os import yaml import numpy as np import collections from auxiliary.laserscan import SemLaserScan if __name__ == '__main__': parse...
code_fim
hard
{ "lang": "python", "repo": "PRBonn/semantic-kitti-api", "path": "/content.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> seq_accum = collections.OrderedDict( sorted(seq_accum.items(), key=lambda t: t[0])) # print and send to total total += seq_total print("seq ", seqstr, "total", seq_total) for key, data in seq_accum.items(): accum[key] += data print(data) # print content to fill ...
code_fim
hard
{ "lang": "python", "repo": "PRBonn/semantic-kitti-api", "path": "/content.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def enum_processes(process_name=None): procs = [(pid, None) for pid in wproc.EnumProcesses()] return _filter_processes(procs, search_name=process_name)<|fim_prefix|># repo: Useems/TrydRPC path: /src/utils/process.py # Credits: https://stackoverflow.com/a/31280850/9190858 import sys import os imp...
code_fim
hard
{ "lang": "python", "repo": "Useems/TrydRPC", "path": "/src/utils/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if search_name is None: return processes filtered = [] for pid, _ in processes: try: proc = wapi.OpenProcess(wcon.PROCESS_ALL_ACCESS, 0, pid) except: continue try: file_name = wproc.GetModuleFileNameEx(proc, None) exce...
code_fim
medium
{ "lang": "python", "repo": "Useems/TrydRPC", "path": "/src/utils/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Useems/TrydRPC path: /src/utils/process.py # Credits: https://stackoverflow.com/a/31280850/9190858 import sys import os import traceback import win32con as wcon import win32api as wapi import win32gui as wgui import win32process as wproc <|fim_suffix|> param = { "pid": pid, "...
code_fim
hard
{ "lang": "python", "repo": "Useems/TrydRPC", "path": "/src/utils/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mysql_5_6 = topologies[str(self.mysql_5_6)] self.assertEqual(1, len(mysql_5_6)) self.assertIn(self.foxha_topology, mysql_5_6) mysql_5_7 = topologies[str(self.mysql_5_7)] self.assertEqual(1, len(mysql_5_7)) self.assertIn(self.foxha_topology, mysql_5_7) ...
code_fim
hard
{ "lang": "python", "repo": "TiagoDanin-Forks/database-as-a-service", "path": "/dbaas/physical/tests/test_plan_replication_topologies.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: TiagoDanin-Forks/database-as-a-service path: /dbaas/physical/tests/test_plan_replication_topologies.py # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from django.test import TestCase from django.contrib.admin.sites import AdminSite from ..models import Plan, Eng...
code_fim
hard
{ "lang": "python", "repo": "TiagoDanin-Forks/database-as-a-service", "path": "/dbaas/physical/tests/test_plan_replication_topologies.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: LuzieH/pytpt path: /examples/triplewell_example.py from pytpt import stationary from pytpt import periodic from pytpt import finite import numpy as np import os.path # define directories path to save the data and figures my_path = os.path.abspath(os.path.dirname(__file__)) data_path = os.path...
code_fim
hard
{ "lang": "python", "repo": "LuzieH/pytpt", "path": "/examples/triplewell_example.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return T_small_noise # T_m[np.mod(m,M),:,:].squeeze() # compute stationary density of triple well with small noise to get initial density well3_small_noise = stationary.tpt(T_small_noise, ind_A, ind_B, ind_C) stat_dens_small_noise = well3_small_noise.stationary_density() init_dens_triple_bif = stat_d...
code_fim
hard
{ "lang": "python", "repo": "LuzieH/pytpt", "path": "/examples/triplewell_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gatech-sysml/cwcf path: /config_datasets/mb_fakehpc.py DATASET = "mb" CLASSES = 2 FEATURES = 50 NN_SIZE = 128 DIFFICULTY = 1000 <|fim_suffix|>override = Override()<|fim_middle|> class Override: def __init__(self): self.HPC_FILE = "../data/" + DATASET + "-hpc-fake"
code_fim
medium
{ "lang": "python", "repo": "gatech-sysml/cwcf", "path": "/config_datasets/mb_fakehpc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> override = Override()<|fim_prefix|># repo: gatech-sysml/cwcf path: /config_datasets/mb_fakehpc.py DATASET = "mb" CLASSES = 2 FEATURES = 50 <|fim_middle|>NN_SIZE = 128 DIFFICULTY = 1000 class Override: def __init__(self): self.HPC_FILE = "../data/" + DATASET + "-hpc-fake"
code_fim
medium
{ "lang": "python", "repo": "gatech-sysml/cwcf", "path": "/config_datasets/mb_fakehpc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pasha369/Points path: /points/appls/points/urls.py # -*- coding: utf-8 -*- from django.conf.urls import url app_path = 'appls.points.views.' urlpatterns = [ # place url(r'^add/$', app_path+'place.add_place', name='add'), url(r'^remove/$', app_path+'place.remove_place', ...
code_fim
hard
{ "lang": "python", "repo": "pasha369/Points", "path": "/points/appls/points/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ame='save_route'), # trip url(r'^add-trip/$', app_path+'trip.create_trip', name='add_trip'), url(r'^get-all/$', app_path+'trip.get_all', name='get_all'), url(r'^subscribe-trip/$', app_path+'trip.subscribe_trip', name='subscribe_trip'), url(r'^...
code_fim
hard
{ "lang": "python", "repo": "pasha369/Points", "path": "/points/appls/points/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> script += _BASE_CLUSTER_SCRIPT_END script = script.format(**opts) if (scheduler == "pbs") and len(opts["batch_ids"]) == 1: # PBS can't handle arrays jobs of size 1... script = script.replace("#PBS -J 1-1\n", "").replace( "$PBS_ARRAY_INDEX", "1" ) retur...
code_fim
hard
{ "lang": "python", "repo": "jcmgray/xyzpy", "path": "/xyzpy/gen/cropping.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jcmgray/xyzpy path: /xyzpy/gen/cropping.py ts. constants : mapping, optional Provide additional constant function values to use when sowing. shuffle : bool or int, optional If given, sow the combos in a random order (using ``random.seed`` and ``...
code_fim
hard
{ "lang": "python", "repo": "jcmgray/xyzpy", "path": "/xyzpy/gen/cropping.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Class for retrieving the batched, flat, 'grown' results. Parameters ---------- crop : xyzpy.Crop Description of where and how to store the cases and results. """ self.crop = crop files = ( os.path.join(self.crop.location,...
code_fim
hard
{ "lang": "python", "repo": "jcmgray/xyzpy", "path": "/xyzpy/gen/cropping.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>y.image import vipy.linalg import vipy.math import vipy.object import vipy.util import vipy.version import vipy.video import vipy.videosearch import vipy.visualize<|fim_prefix|># repo: fangyang1996212/vipy path: /vipy/__init__.py # Import all subpackages import vipy.show # matplotlib first import vipy.a...
code_fim
medium
{ "lang": "python", "repo": "fangyang1996212/vipy", "path": "/vipy/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fangyang1996212/vipy path: /vipy/__init__.py # Import all subpackages import vipy.show # matplotlib first import vipy.annotation import vipy.calibration import vipy.downloader import vipy.geometry import vip<|fim_suffix|>mport vipy.version import vipy.video import vipy.videosearch import vipy.vi...
code_fim
medium
{ "lang": "python", "repo": "fangyang1996212/vipy", "path": "/vipy/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @main.route('/post/comment/<int:posts_id>', methods=['GET', 'POST']) @login_required def post_comment(posts_id): post = Post.query.get_or_404(posts_id) form = CommentForm() if form.validate_on_submit(): comment = request.form.get('comment') comment = Comment(comment=comment, ...
code_fim
hard
{ "lang": "python", "repo": "inziani/blog", "path": "/app/main/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: inziani/blog path: /app/main/views.py from datetime import datetime from flask import render_template, session, redirect, url_for, request, flash from flask_login import login_user, login_required, current_user from .forms import PostForm, CommentForm from app.models import Post, User, Comment fr...
code_fim
hard
{ "lang": "python", "repo": "inziani/blog", "path": "/app/main/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: djanekovic/ekspertni path: /strategy.py from abc import ABC from cassowary import SimplexSolver, Variable from random import choice, randint from pysat.solvers import Solver as SATSolver from pysat.card import CardEnc, EncType class Strategy(ABC): def get_random_field(self): pass ...
code_fim
hard
{ "lang": "python", "repo": "djanekovic/ekspertni", "path": "/strategy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if field in self.current_adjacent_fields: self.current_adjacent_fields.remove(field) return boundary_list def make_constraint(self, row_index, col_index): """ Compute equations for field (row_index, col_index) """ adjacent_fields = ...
code_fim
hard
{ "lang": "python", "repo": "djanekovic/ekspertni", "path": "/strategy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vaibhavantil/here-location-services-python path: /here_location_services/ls.py ocation_services.config.routing_config.AVOID_FEATURES>` :param avoid_areas: A list of areas to avoid during route calculation. To define avoid area. :param exclude: A comma separated list of three-lette...
code_fim
hard
{ "lang": "python", "repo": "vaibhavantil/here-location-services-python", "path": "/here_location_services/ls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def lookup(self, location_id: str, lang: Optional[str] = None) -> LookupResponse: """ Get search results by providing ``location_id``. :param location_id: A string representing id. :param lang: A string to represent language to be used for result rendering from ...
code_fim
hard
{ "lang": "python", "repo": "vaibhavantil/here-location-services-python", "path": "/here_location_services/ls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :class:`AutoCircleRegion <here_location_services.config.matrix_routing_config.AutoCircleRegion>` :class:`WorldRegion <here_location_services.config.matrix_routing_config.WorldRegion>` :param async_req: If set to True reuqests will be sent to asynchronous matrix routing API...
code_fim
hard
{ "lang": "python", "repo": "vaibhavantil/here-location-services-python", "path": "/here_location_services/ls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': if len(sys.argv) != 2: _usage(sys.argv) action = sys.argv[1] if action not in _ACTIONS: _usage(sys.argv) if action == 'prepare': prepare_data(_DATA_FILE, _ENCODING) if action == 'file': file = input('Enter file: data/') ...
code_fim
hard
{ "lang": "python", "repo": "salceson/PJN", "path": "/lab7/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: salceson/PJN path: /lab7/main.py # coding: utf-8 import pickle import sys from functools import reduce from flection import basic_form from utils import prepare_data, cosine_metric __author__ = "Michał Ciołczyk" _DATA_FILE = 'data/pap.txt' _ENCODING = 'utf-8' _ACTIONS = ['prepare', 'file', 'se...
code_fim
hard
{ "lang": "python", "repo": "salceson/PJN", "path": "/lab7/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': if len(sys.argv) != 2: _usage(sys.argv) action = sys.argv[1] if action not in _ACTIONS: _usage(sys.argv) if action == 'prepare': prepare_data(_DATA_FILE, _ENCODING) if action == 'file': file = input('Enter file: data/') ...
code_fim
hard
{ "lang": "python", "repo": "salceson/PJN", "path": "/lab7/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mask, func_filenames = get_hcp_data(raw=True) masker = NiftiMasker(mask_img=mask, smoothing_fwhm=None, standardize=False) masker.fit() rsn70 = fetch_atlas_smith_2009().rsn70 components = masker.transform(rsn70) print(components.shape) enet_scale(compo...
code_fim
hard
{ "lang": "python", "repo": "justinbuzzni/modl", "path": "/examples/experimental/fmri/hcp_analysis.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def main(output_dir, n_jobs): dir_list = [join(output_dir, f) for f in os.listdir(output_dir) if os.path.isdir(join(output_dir, f))] mask, func_filenames = get_hcp_data(raw=True) masker = NiftiMasker(mask_img=mask, smoothing_fwhm=None, standardize=Fal...
code_fim
hard
{ "lang": "python", "repo": "justinbuzzni/modl", "path": "/examples/experimental/fmri/hcp_analysis.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: justinbuzzni/modl path: /examples/experimental/fmri/hcp_analysis.py import fnmatch import json import os from os.path import expanduser, join import numpy as np from nilearn.datasets import fetch_atlas_smith_2009 from nilearn.input_data import NiftiMasker from sklearn.externals.joblib import del...
code_fim
hard
{ "lang": "python", "repo": "justinbuzzni/modl", "path": "/examples/experimental/fmri/hcp_analysis.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mosquito/aio-pika path: /aio_pika/queue.py sage, AbstractQueue, AbstractQueueIterator, ConsumerTag, TimeoutType, get_exchange_name, ) from .exceptions import QueueEmpty from .exchange import ExchangeParamType from .log import get_logger from .message import IncomingMessage from .tools import ...
code_fim
hard
{ "lang": "python", "repo": "mosquito/aio-pika", "path": "/aio_pika/queue.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self._amqp_queue.channel.is_closed: log.warning( "Message %r lost when queue iterator %r channel closed", msg, self, ) return if self._consume_kwargs.get("no_ack", False)...
code_fim
hard
{ "lang": "python", "repo": "mosquito/aio-pika", "path": "/aio_pika/queue.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return QueueIterator(self, **kwargs) class QueueIterator(AbstractQueueIterator): DEFAULT_CLOSE_TIMEOUT = 5 @property def consumer_tag(self) -> Optional[ConsumerTag]: return getattr(self, "_consumer_tag", None) async def close(self, *_: Any) -> Any: log.debug("Ca...
code_fim
hard
{ "lang": "python", "repo": "mosquito/aio-pika", "path": "/aio_pika/queue.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }