text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> tls = Tools() cr = redis.StrictRedis(host='192.168.99.100', port=6379, db=0) tojsde_json = str(json) cr.set('cr_task_0',tojsde_json)<|fim_prefix|># repo: galena503/SCR path: /flask/flask_controller.py from manipulator.tools import Tools import redis <|fim_middle|>class F...
code_fim
easy
{ "lang": "python", "repo": "galena503/SCR", "path": "/flask/flask_controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: galena503/SCR path: /flask/flask_controller.py from manipulator.tools import Tools import redis <|fim_suffix|> def timer_change(self,json): tls = Tools() cr = redis.StrictRedis(host='192.168.99.100', port=6379, db=0) tojsde_json = str(json) cr.set('cr_task_0'...
code_fim
easy
{ "lang": "python", "repo": "galena503/SCR", "path": "/flask/flask_controller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def encode(self, detections: List[Detection], img: np.ndarray): imgs = [] for detection in detections: box = detection.box patch = crop(img, (box[0] + box[2]) / 2, (box[1] + box[3]) / 2, int(max(box[2] - box[0], box[3] - box[1]))) patch = cv2.resize(...
code_fim
hard
{ "lang": "python", "repo": "linkinpark213/online-mot-by-detection", "path": "/mot/encode/patch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, resize_to: Tuple[int, int], name: str = 'patch', **kwargs): super(ImagePatchEncoder, self).__init__() self.resize_to: Tuple[int, int] = resize_to self.name: str = name def encode(self, detections: List[Detection], img: np.ndarray): imgs = [] ...
code_fim
medium
{ "lang": "python", "repo": "linkinpark213/online-mot-by-detection", "path": "/mot/encode/patch.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: linkinpark213/online-mot-by-detection path: /mot/encode/patch.py import cv2 import numpy as np from typing import List, Tuple from mot.utils import crop from mot.structures import Detection from .encode import Encoder, ENCODER_REGISTRY <|fim_suffix|> super(ImagePatchEncoder, self).__init...
code_fim
medium
{ "lang": "python", "repo": "linkinpark213/online-mot-by-detection", "path": "/mot/encode/patch.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return transport.source.type == fis_types[name] is_identify = Signal() is_dma_activate = Signal() read_ndwords = Signal(max=sectors2dwords(2**16)) dwords_counter = Counter(max=sectors2dwords(2**16)) self.submodules += dwords_counter read_done = Signal() self.sync += \ If(from_tx.read...
code_fim
hard
{ "lang": "python", "repo": "mogorman/misoc", "path": "/misoclib/mem/litesata/core/command/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> d2h_error = Signal() clr_d2h_error = Signal() set_d2h_error = Signal() self.sync += \ If(clr_d2h_error, d2h_error.eq(0) ).Elif(set_d2h_error, d2h_error.eq(1) ) read_error = Signal() clr_read_error = Signal() set_read_error = Signal() self.sync += \ If(clr_read_error, ...
code_fim
hard
{ "lang": "python", "repo": "mogorman/misoc", "path": "/misoclib/mem/litesata/core/command/__init__.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mogorman/misoc path: /misoclib/mem/litesata/core/command/__init__.py from misoclib.mem.litesata.common import * tx_to_rx = [ ("write", 1), ("read", 1), ("identify", 1), ("count", 16) ] rx_to_tx = [ ("dma_activate", 1), ("d2h_error", 1) ] class LiteSATACommandTX(Module): def __init__(sel...
code_fim
hard
{ "lang": "python", "repo": "mogorman/misoc", "path": "/misoclib/mem/litesata/core/command/__init__.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/o...
code_fim
hard
{ "lang": "python", "repo": "elephant-track/elephant-server", "path": "/elephant-core/elephant/util/ellipsoid.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: elephant-track/elephant-server path: /elephant-core/elephant/util/ellipsoid.py # Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redi...
code_fim
hard
{ "lang": "python", "repo": "elephant-track/elephant-server", "path": "/elephant-core/elephant/util/ellipsoid.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> bounding_shape = lower_right_top - upper_left_bottom + 1 d_lim, r_lim, c_lim = np.ogrid[0:float(bounding_shape[0]), 0:float(bounding_shape[1]), 0:float(bounding_shape[2])] d_org, r_org, c_org = scaled_ce...
code_fim
hard
{ "lang": "python", "repo": "elephant-track/elephant-server", "path": "/elephant-core/elephant/util/ellipsoid.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaostoolkit-attic/chaosplatform-auth path: /tests/fixtures/fake_storage.py from typing import Any, Dict, NoReturn <|fim_suffix|> class MyAuthStorage(BaseAuthStorage): def __init__(self, config: Dict[str, Any]): self.some_flag = True def release(self) -> NoReturn: self.s...
code_fim
medium
{ "lang": "python", "repo": "chaostoolkit-attic/chaosplatform-auth", "path": "/tests/fixtures/fake_storage.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.some_flag = True def release(self) -> NoReturn: self.some_flag = False<|fim_prefix|># repo: chaostoolkit-attic/chaosplatform-auth path: /tests/fixtures/fake_storage.py from typing import Any, Dict, NoReturn from chaosplt_auth.storage.interface import BaseAuthStorage __all__ = ...
code_fim
medium
{ "lang": "python", "repo": "chaostoolkit-attic/chaosplatform-auth", "path": "/tests/fixtures/fake_storage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def release(self) -> NoReturn: self.some_flag = False<|fim_prefix|># repo: chaostoolkit-attic/chaosplatform-auth path: /tests/fixtures/fake_storage.py from typing import Any, Dict, NoReturn from chaosplt_auth.storage.interface import BaseAuthStorage <|fim_middle|>__all__ = ["MyAuthStorage"]...
code_fim
medium
{ "lang": "python", "repo": "chaostoolkit-attic/chaosplatform-auth", "path": "/tests/fixtures/fake_storage.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Signals that a message or object failed to validate.""" pass<|fim_prefix|># repo: SecConNet/mahiru path: /mahiru/definitions/errors.py """Different kinds of errors that may occur.""" <|fim_middle|> class ValidationError(Exception):
code_fim
easy
{ "lang": "python", "repo": "SecConNet/mahiru", "path": "/mahiru/definitions/errors.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SecConNet/mahiru path: /mahiru/definitions/errors.py """Different kinds of errors that may occur.""" <|fim_suffix|> """Signals that a message or object failed to validate.""" pass<|fim_middle|>class ValidationError(Exception):
code_fim
easy
{ "lang": "python", "repo": "SecConNet/mahiru", "path": "/mahiru/definitions/errors.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aurule/npc path: /legacy/npc/npc/linters/human.py """ Linter for verifying human character files Checks for a number of problems that are specific to human characters. The only public entry point is the lint function. """ <|fim_suffix|> """ Verify the more complex elements in a human she...
code_fim
medium
{ "lang": "python", "repo": "aurule/npc", "path": "/legacy/npc/npc/linters/human.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: character (dict): Character data to lint fix (bool): Whether to automatically correct certain problems strict (bool): Whether to report non-critical errors and omissions Returns: List of problem descriptions. If no problems were found, the list will b...
code_fim
medium
{ "lang": "python", "repo": "aurule/npc", "path": "/legacy/npc/npc/linters/human.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check that they have a vice and a virtue if strict: problems.extend(nwod.lint_vice_virtue(data)) if dirty and data: with open(character.path, 'w', newline='\n') as char_file: char_file.write(data) return problems<|fim_prefix|># repo: aurule/npc path: /legac...
code_fim
hard
{ "lang": "python", "repo": "aurule/npc", "path": "/legacy/npc/npc/linters/human.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danielyoung/pancake-hipchat-bot path: /src/bot.py import requests import re import random import inspect import json from time import time,sleep from ec2_helper import EC2Helper from simple_hipchat import HipChat from urllib2 import HTTPError # For Arnold from _arnold_phrases import ARNOLD_PHRAS...
code_fim
hard
{ "lang": "python", "repo": "danielyoung/pancake-hipchat-bot", "path": "/src/bot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.postMessage(room_name, 'Something went wrong') def __cmdGetRandomChuckPhrase(self, room_name): message = "Can't connect to Chuck API =(" params = {'limitTo': '[nerdy]'} r = requests.get('http://api.icndb.com/jokes/random', params=params) if r.stat...
code_fim
hard
{ "lang": "python", "repo": "danielyoung/pancake-hipchat-bot", "path": "/src/bot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.postMessage(room_name, message) def __cmdGetRandomCatGIF(self, room_name): message = "Can't connect to cat API =(" params = {'format': 'xml', 'type': 'gif'} r = requests.get('http://thecatapi.com/api/images/get', params=params) if r.status_code == 200: ...
code_fim
hard
{ "lang": "python", "repo": "danielyoung/pancake-hipchat-bot", "path": "/src/bot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmeg/cwltool path: /mypy-stubs/networkx/algorithms/flow/maxflow.pyi # Stubs for networkx.algorithms.flow.maxflow (Python 3.5) # # NOTE: This dynamically typed stub was automatically generated by stubgen. from typing import Any, Optional from .preflowpush import preflow_push <|fim_suffix|> f...
code_fim
hard
{ "lang": "python", "repo": "bmeg/cwltool", "path": "/mypy-stubs/networkx/algorithms/flow/maxflow.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def minimum_cut_value( flowG, _s, _t, capacity: str = ..., flow_func: Optional[Any] = ..., **kwargs ): ...<|fim_prefix|># repo: bmeg/cwltool path: /mypy-stubs/networkx/algorithms/flow/maxflow.pyi # Stubs for networkx.algorithms.flow.maxflow (Python 3.5) # # NOTE: This dynamically typed stub was autom...
code_fim
hard
{ "lang": "python", "repo": "bmeg/cwltool", "path": "/mypy-stubs/networkx/algorithms/flow/maxflow.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: flaurencin/UbiquitiManager path: /UbiquitiManager/UbiConfigManager.py import time import string import random from io import StringIO from crypt import crypt from functools import reduce from UbiquitiManager.UbiExceptions import UbiConfigTest from UbiquitiManager.UbiExceptions import UbiBadFirmwa...
code_fim
hard
{ "lang": "python", "repo": "flaurencin/UbiquitiManager", "path": "/UbiquitiManager/UbiConfigManager.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return reduce(lambda data, key: data[key], k_list, self.config_dict) def _set_to_dict(self, k_list, value): self._get_from_dict(k_list[:-1])[k_list[-1]] = value def config_text_to_dict(self): ''' Takes the text configuation and convert it to dict. ''' ...
code_fim
hard
{ "lang": "python", "repo": "flaurencin/UbiquitiManager", "path": "/UbiquitiManager/UbiConfigManager.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: City-of-Helsinki/parkkihubi path: /parkings/migrations/0025_parking_check.py # -*- coding: utf-8 -*- # Generated by Django 1.11.22 on 2019-07-13 07:49 from __future__ import unicode_literals from django.contrib.gis.db.models.fields import PointField from django.contrib.postgres.fields.jsonb impo...
code_fim
hard
{ "lang": "python", "repo": "City-of-Helsinki/parkkihubi", "path": "/parkings/migrations/0025_parking_check.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('parkings', '0024_permitlookupitem_index'), ] operations = [ migrations.CreateModel( name='ParkingCheck', fields=[ ('id', models.AutoField( auto_created=True, primary_key=True, se...
code_fim
hard
{ "lang": "python", "repo": "City-of-Helsinki/parkkihubi", "path": "/parkings/migrations/0025_parking_check.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Assuming model_checkpoint_path looks something like: # /my-favorite-path/eye_train/model.ckpt-0, # extract global_step from it. global_step = ckpt.model_checkpoint_path.split('/')[-1].split('-')[-1] else: print('No checkpoint file found') _, top_indices = sess.ru...
code_fim
hard
{ "lang": "python", "repo": "callofdutyops/YXH2016724098982", "path": "/predict_one.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: callofdutyops/YXH2016724098982 path: /predict_one.py from PIL import Image import tensorflow as tf import eye_model_predict FLAGS = tf.app.flags.FLAGS tf.app.flags.DEFINE_string('checkpoint_dir', '/tmp/eye_train', """Directory where to read model checkpoints.""") width...
code_fim
hard
{ "lang": "python", "repo": "callofdutyops/YXH2016724098982", "path": "/predict_one.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@tingbot.every(seconds=5) def refresh(): reqUrl = baseUrl response = urllib.urlopen(reqUrl) state['stats'] = json.loads(response.read()) def showMain(): screen.fill(color=(26,26,26)) screen.rectangle( xy=(0,16), align='left', size=(320,31), color...
code_fim
hard
{ "lang": "python", "repo": "tlk999/tingbot", "path": "/sabnzb.tingapp/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tlk999/tingbot path: /sabnzb.tingapp/main.py # coding: utf-8 # v1.0.1 import tingbot from tingbot import * import urllib, json from datetime import datetime import time state = {} screenList = { 0: 'main' } currentScreen = 0 state['screen'] = screenList[currentScreen] baseUrl = "http://" ...
code_fim
hard
{ "lang": "python", "repo": "tlk999/tingbot", "path": "/sabnzb.tingapp/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> reqUrl = baseUrl response = urllib.urlopen(reqUrl) state['stats'] = json.loads(response.read()) def showMain(): screen.fill(color=(26,26,26)) screen.rectangle( xy=(0,16), align='left', size=(320,31), color=(255,165,0), ) screen.text(...
code_fim
hard
{ "lang": "python", "repo": "tlk999/tingbot", "path": "/sabnzb.tingapp/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # # Reshape for simplicity. Merge first two dimensions into one. # target_c_i = i_true # predicted_c_i = i_pred # target_shape = tf.shape(target_c_i) # pred_shape = tf.shape(predicted_c_i) # # print("t shape", target_c_i) # print("p shape", predicted_c_i) # # # Permute pred...
code_fim
hard
{ "lang": "python", "repo": "GianKiMoon/Mask_RCNN", "path": "/synthpod/loss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # # Reshape for simplicity. Merge first two dimensions into one. # target_c_i = i_true # predicted_c_i = i_pred # target_shape = tf.shape(target_c_i) # pred_shape = tf.shape(predicted_c_i) # # print("t shape", target_c_i) # print("p shape", predicted_c_i) # # # Permu...
code_fim
hard
{ "lang": "python", "repo": "GianKiMoon/Mask_RCNN", "path": "/synthpod/loss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GianKiMoon/Mask_RCNN path: /synthpod/loss.py import keras.backend as K import keras import tensorflow as tf from keras.utils import to_categorical def m_loss(x_true, x_pred): return K.mean(K.categorical_crossentropy(x_true, x_pred)) def i_loss(i_true, i_pred): # # Flat tensors # i...
code_fim
hard
{ "lang": "python", "repo": "GianKiMoon/Mask_RCNN", "path": "/synthpod/loss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == 'gsdl2.tests': from gsdl2.tests.test_utils.run_tests import run elif __name__ == '__main__': import os import sys pkg_dir = os.path.split(os.path.abspath(__file__))[0] parent_dir, pkg_name = os.path.split(pkg_dir) is_pygame_pkg = (pkg_name == 'tests' and ...
code_fim
hard
{ "lang": "python", "repo": "Yardanico/gsdl2", "path": "/test/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Yardanico/gsdl2 path: /test/__init__.py """gsdl2 unit test suite package Exports function run() A quick way to run the test suite package from the command line is by importing the go submodule: python -m "import gsdl2.tests" [<test options>] Command line option --help displays a usage message...
code_fim
hard
{ "lang": "python", "repo": "Yardanico/gsdl2", "path": "/test/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>""" if __name__ == 'gsdl2.tests': from gsdl2.tests.test_utils.run_tests import run elif __name__ == '__main__': import os import sys pkg_dir = os.path.split(os.path.abspath(__file__))[0] parent_dir, pkg_name = os.path.split(pkg_dir) is_pygame_pkg = (pkg_name == 'tests' and ...
code_fim
hard
{ "lang": "python", "repo": "Yardanico/gsdl2", "path": "/test/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>9m/xGk5W01jSpYc8NMZI2x9ArD9a73wH8DdL8LX0OqardDU9QiIeFfL2xRN64OSxHYnGPTODXrGc0tACYrlvGnw+0LxzZLFqkLLcRAiG6hOJI/bPcexzXVUUAfNV3+zf4iSU/YtZ0qaPs03mRn8grfzq5p37NmoPIp1TxDbRJnkW0LSE/i23H5GvonFFADXdY0Z3IVVGSSeAK+CrW1lvbuG1t1LzTyLHGo/iZiAB+Zr7j8R6Odf8ADt/pIu5LQXkJhaaNQWVTwRg+oyPoa8v+H/wSk8I+MxrF/qNvfQ28bfZQkZRhI...
code_fim
hard
{ "lang": "python", "repo": "fabioued/imageme", "path": "/imageme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fabioued/imageme path: /imageme.py PER_ROW = 3 ## Width in pixels of thumnbails generated with PIL THUMBNAIL_WIDTH = 800 ## Base64 data for an image notifying user of an unsupported image type UNSUPPORTED_IMAGE_TYPE_DATA = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJ...
code_fim
hard
{ "lang": "python", "repo": "fabioued/imageme", "path": "/imageme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fabioued/imageme path: /imageme.py rs, force_no_processing=False): """ Create an index file in the given location, supplying known lists of present image files and subdirectories. @param {String} root_dir - The root directory of the entire crawl. Used to ascertain whether...
code_fim
hard
{ "lang": "python", "repo": "fabioued/imageme", "path": "/imageme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>)) hh3cAFCNotifyPrefix = MibIdentifier((1, 3, 6, 1, 4, 1, 25506, 2, 85, 2, 0)) hh3cDDosAttackStart = NotificationType((1, 3, 6, 1, 4, 1, 25506, 2, 85, 2, 0, 1)).setObjects(("HH3C-AFC-MIB", "hh3cDDosAttackTargetIP"), ("HH3C-AFC-MIB", "hh3cDDosAttackType"), ("HH3C-AFC-MIB", "hh3cDDosAttackPolicy"), ("HH3C-A...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp-with-texts/HH3C-AFC-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp-with-texts/HH3C-AFC-MIB.py # # PySNMP MIB module HH3C-AFC-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-AFC-MIB # Produced by pysmi-0.3.4 at Wed May 1 13:25:34 2019 # On host DAVWANG4-M-1475 plat...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp-with-texts/HH3C-AFC-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> emat = exp_mat.todense() l1 = np.sum(emat, axis=1) l2 = np.sqrt(np.sum(np.square(emat), axis=1)) del(emat) weight_est = (1/(mz_range**0.5))*np.sum(gradient_time**0.5 - (l1/(l2+1e-6)))/(gradient_time**0.5 -1) return np.around(weight_est, 5)<|fim_prefix|># repo: pasrawin/ProteomicMSD path: /mNMF...
code_fim
hard
{ "lang": "python", "repo": "pasrawin/ProteomicMSD", "path": "/mNMF07_WeightEstimation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pasrawin/ProteomicMSD path: /mNMF07_WeightEstimation.py from __future__ import division import numpy as np def weight_estimation(exp_mat, prot_peptcount, globalparam_list): <|fim_suffix|> emat = exp_mat.todense() l1 = np.sum(emat, axis=1) l2 = np.sqrt(np.sum(np.square(emat), axis=1)) d...
code_fim
hard
{ "lang": "python", "repo": "pasrawin/ProteomicMSD", "path": "/mNMF07_WeightEstimation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fake_logits = discriminator_fn(fake_data) if isinstance(fake_logits, (list, tuple)): fake_logits = fake_logits[0] fake_loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits( logits=fake_logits, labels=tf.zeros_like(fake_logits))) d_loss = real_loss + fake_loss ...
code_fim
hard
{ "lang": "python", "repo": "arita37/texar", "path": "/texar/tf/losses/adv_losses.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: arita37/texar path: /texar/tf/losses/adv_losses.py # Copyright 2018 The Texar Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # htt...
code_fim
hard
{ "lang": "python", "repo": "arita37/texar", "path": "/texar/tf/losses/adv_losses.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Returns: A tuple `(generator_loss, discriminator_loss)` each of which is a scalar Tensor, loss to be minimized. """ real_logits = discriminator_fn(real_data) if isinstance(real_logits, (list, tuple)): real_logits = real_logits[0] real_loss = tf.reduce_mean(tf.nn...
code_fim
hard
{ "lang": "python", "repo": "arita37/texar", "path": "/texar/tf/losses/adv_losses.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def vm_start(self, params: dict) -> Tuple["Status", dict]: """ Start a VM. Parameters ---------- params : dict Flat dictionary of (key, value) pairs of tunable parameters. Returns ------- result : (Status, dict={}) ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/MLOS", "path": "/mlos_bench/mlos_bench/services/types/vm_provisioner_type.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/MLOS path: /mlos_bench/mlos_bench/services/types/vm_provisioner_type.py # # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # """ Protocol interface for VM provisioning operations. """ from typing import Tuple, Protocol, runtime_checkable, TYPE_CHECKING if TYPE_...
code_fim
hard
{ "lang": "python", "repo": "microsoft/MLOS", "path": "/mlos_bench/mlos_bench/services/types/vm_provisioner_type.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Get the portfolio weights for hierarachical risk parity method. @param covariance: list/ndarray The covariance matrix. @param order: list The order represented by the linkage matrix. @return weights: ndarray portfolio weights for hierar...
code_fim
hard
{ "lang": "python", "repo": "Karagul/Hierarchical-Portfolio-Construction", "path": "/Supplied code/Hierarchical_Risk_Parity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Karagul/Hierarchical-Portfolio-Construction path: /Supplied code/Hierarchical_Risk_Parity.py # Standard imports. import numpy as np import pandas as pd from matplotlib import pyplot as plt from scipy import stats from scipy.cluster.hierarchy import dendrogram, linkage from scipy.spatial.distance ...
code_fim
hard
{ "lang": "python", "repo": "Karagul/Hierarchical-Portfolio-Construction", "path": "/Supplied code/Hierarchical_Risk_Parity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert host.package('ansible').is_installed<|fim_prefix|># repo: ssato/ansible-role-nw-backup-config path: /molecule/default/tests/test_default.py import os import testinfra.utils.ansible_runner <|fim_middle|>testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_I...
code_fim
hard
{ "lang": "python", "repo": "ssato/ansible-role-nw-backup-config", "path": "/molecule/default/tests/test_default.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ssato/ansible-role-nw-backup-config path: /molecule/default/tests/test_default.py import os import testinfra.utils.ansible_runner <|fim_suffix|> assert host.package('ansible').is_installed<|fim_middle|>testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_I...
code_fim
hard
{ "lang": "python", "repo": "ssato/ansible-role-nw-backup-config", "path": "/molecule/default/tests/test_default.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>## TODO: change the imports in jupyer notebook<|fim_prefix|># repo: keli95566/svd-with-threshold path: /setup.py from setuptools import setup from Cython.Build import cythonize eigen_path = ['/usr/local/include/eigen3'] <|fim_middle|>setup( name="tSVD", version=" 0.1 ", ext_modules=cythoniz...
code_fim
medium
{ "lang": "python", "repo": "keli95566/svd-with-threshold", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: keli95566/svd-with-threshold path: /setup.py from setuptools import setup from Cython.Build import cythonize eigen_path = ['/usr/local/include/eigen3'] <|fim_suffix|>## TODO: change the imports in jupyer notebook<|fim_middle|>setup( name="tSVD", version=" 0.1 ", ext_modules=cythoniz...
code_fim
medium
{ "lang": "python", "repo": "keli95566/svd-with-threshold", "path": "/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pabigot/pyxb path: /pyxb/__init__.py http://www.w3.org/XML/Schema>} Bindings, and is pronounced "pixbee". It enables translation between XML instance documents and Python objects following rules specified by an XML Schema document. This is the top-level entrypoint to the PyXB system. Importing...
code_fim
hard
{ "lang": "python", "repo": "pabigot/pyxb", "path": "/pyxb/__init__.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pabigot/pyxb path: /pyxb/__init__.py translation between XML instance documents and Python objects following rules specified by an XML Schema document. This is the top-level entrypoint to the PyXB system. Importing this gets you all the L{exceptions<pyxb.exceptions_.PyXBException>}, and L{pyxb...
code_fim
hard
{ "lang": "python", "repo": "pabigot/pyxb", "path": "/pyxb/__init__.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """C{True} iff validation should be performed when creating a document from a binding instance. This applies at invocation of L{toDOM()<pyxb.binding.basis._TypeBinding_mixin.toDOM>}. L{toxml()<pyxb.binding.basis._TypeBinding_mixin.toDOM>} invokes C{toDOM()}.""" ...
code_fim
hard
{ "lang": "python", "repo": "pabigot/pyxb", "path": "/pyxb/__init__.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bsc-wdc/compss path: /compss/programming_model/bindings/python/src/pycompss/tests/unittests/runtime/test_object_tracker.py #!/usr/bin/python # # Copyright 2002-2022 Barcelona Supercomputing Center (www.bsc.es) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not us...
code_fim
hard
{ "lang": "python", "repo": "bsc-wdc/compss", "path": "/compss/programming_model/bindings/python/src/pycompss/tests/unittests/runtime/test_object_tracker.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_clean_object_tracker(): object_tracker = ObjectTracker() do = DummyObject() _, _ = object_tracker.track(do) object_tracker.clean_object_tracker() assert len(object_tracker.pending_to_synchronize) == 0 assert len(object_tracker.file_names) == 0 assert len(object_tracke...
code_fim
hard
{ "lang": "python", "repo": "bsc-wdc/compss", "path": "/compss/programming_model/bindings/python/src/pycompss/tests/unittests/runtime/test_object_tracker.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_pending_to_synchronize(): object_tracker = ObjectTracker() do = DummyObject() do_id, _ = object_tracker.track(do) # The object is being tracked pending = object_tracker.is_pending_to_synchronize(do_id) assert ( pending is True ), "The object must be pending to...
code_fim
hard
{ "lang": "python", "repo": "bsc-wdc/compss", "path": "/compss/programming_model/bindings/python/src/pycompss/tests/unittests/runtime/test_object_tracker.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>### convert sources into objects def Automatic_Object_Helper(env,source,libraries): if type(source)!=str: return source # assume it's already an object cppdefines_reversed=env['CPPDEFINES'][::-1] cpppath_reversed=env['CPPPATH_HIDDEN'][::-1] for lib in libraries: if lib['filter'].s...
code_fim
hard
{ "lang": "python", "repo": "alekamca/mgpcg-poisson", "path": "/src/Scripts/scons/SConstruct", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: alekamca/mgpcg-poisson path: /src/Scripts/scons/SConstruct nment.Clone,'Copy') ## override platform specific library names if env['PLATFORM'].startswith('win32'): env.Replace(compile_headers=0) ### platform if env['ARCH']=='': if os.environ.has_key('PLATFORM'): env['ARCH']=os.environ['P...
code_fim
hard
{ "lang": "python", "repo": "alekamca/mgpcg-poisson", "path": "/src/Scripts/scons/SConstruct", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> b,d=os.path.abspath(base).split(os.sep),os.path.abspath(directory).split(os.sep) i=0 while i<len(b) and i<len(d) and b[i]==d[i]: i+=1 path=map(lambda x:'..',b[i:])+d[i:] if len(path)==0: return "." return os.path.join(*path) template_file,binary,paths=so...
code_fim
hard
{ "lang": "python", "repo": "alekamca/mgpcg-poisson", "path": "/src/Scripts/scons/SConstruct", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>image = utils.get_env('ISO', os.path.join(consts.IMAGE_FOLDER, f'{env_variables["cluster_name"]}-installer-image.iso')).strip() env_variables["iso_download_path"] = image env_variables["num_nodes"] = env_variables["num_workers"] + env_variables["num_masters"] @pytest.fixture(scope...
code_fim
hard
{ "lang": "python", "repo": "skramling/assisted-test-infra", "path": "/discovery-infra/tests/conftest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: skramling/assisted-test-infra path: /discovery-infra/tests/conftest.py import logging import os from distutils import util from pathlib import Path import pytest from test_infra import assisted_service_api, consts, utils qe_env = False # TODO changes it if os.environ.get('NODE_ENV') == 'QE_VM'...
code_fim
hard
{ "lang": "python", "repo": "skramling/assisted-test-infra", "path": "/discovery-infra/tests/conftest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.fixture(scope="session") def api_client(): logging.info(f'--- SETUP --- api_client\n') yield get_api_client() def get_api_client(offline_token=env_variables['offline_token'], **kwargs): url = env_variables['remote_service_url'] if not url: url = utils.get_local_assisted_...
code_fim
medium
{ "lang": "python", "repo": "skramling/assisted-test-infra", "path": "/discovery-infra/tests/conftest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_save_image(self): self.image.save_image() images = Image.objects.all() self.assertTrue(len(images) > 0) def test_delete_image(self): self.image.save_image() self.image.delete_image() images = Image.objects.all() ...
code_fim
hard
{ "lang": "python", "repo": "Anabella1109/MyGram", "path": "/mygram/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): self.profile=Profile(id=123,photo='Rwanda',bio='Kigali') self.image=Image(id=1,image='@heroo',name='koko',caption="koko koko koko okruuuuuu",likes=2,profile=self.profile) self.comment=Comment(id=1,comment='food',image=self.image) ...
code_fim
hard
{ "lang": "python", "repo": "Anabella1109/MyGram", "path": "/mygram/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Anabella1109/MyGram path: /mygram/tests.py from django.test import TestCase from .models import Image,Profile,Comment class ImageTestClass(TestCase): def setUp(self): self.profile=Profile(id=1,photo='Rwanda',bio='Kigali') self.image=Image(id=1,image='@heroo'...
code_fim
hard
{ "lang": "python", "repo": "Anabella1109/MyGram", "path": "/mygram/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> eval_results.append( [eval_game.total_positive_reward, eval_game.total_step_to_positive_reward]) eval_logs.append(eval_log_in_episode) eval_res = self.agg_eval_results(eval_results) # collect and save evaluation results np.s...
code_fim
hard
{ "lang": "python", "repo": "yinxusen/dqn-zork", "path": "/python/deepdnd/agent.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # start training t = start_t cnt_action = np.zeros(self.hp.n_actions) # count visited room during whole training process self.debug("master room name: {}".format(room_name)) assert room_name != "", "initial room name is empty" if self.visited_rooms i...
code_fim
hard
{ "lang": "python", "repo": "yinxusen/dqn-zork", "path": "/python/deepdnd/agent.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yinxusen/dqn-zork path: /python/deepdnd/agent.py trainable_vars) else: pass else: pass for variable in trainable_vars: # shape is an array of tf.Dimension shape = variable.get_s...
code_fim
hard
{ "lang": "python", "repo": "yinxusen/dqn-zork", "path": "/python/deepdnd/agent.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self._entries[signature] def signatures_by_last_lemma(self, lemma): return self._bylast.get(lemma) or () def shortest_path_decoding(self, sentence_lemmas, start=0, in_gap=False, max_gap_length=None): ''' Use Dijkstra's algorithm to search a sentence...
code_fim
hard
{ "lang": "python", "repo": "nelson-liu/lexical-semantic-recognition", "path": "/scripts/streusle2.0_scripts/pyutil/corpus/mwe_lexicons.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def load(self, entries): iln = 1 for entry in entries: self._read_entry(entry) iln += 1 self._bylast = dict(self._bylast) # convert from defaultdict def loadJSON(self, jsonF, more=False): iln = 1 for ln in jsonF: en...
code_fim
hard
{ "lang": "python", "repo": "nelson-liu/lexical-semantic-recognition", "path": "/scripts/streusle2.0_scripts/pyutil/corpus/mwe_lexicons.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nelson-liu/lexical-semantic-recognition path: /scripts/streusle2.0_scripts/pyutil/corpus/mwe_lexicons.py ''' Created on Jul 19, 2013 @author: Nathan Schneider (nschneid) ''' from __future__ import print_function, division, absolute_import import sys, os, re, fileinput, codecs, json from collecti...
code_fim
hard
{ "lang": "python", "repo": "nelson-liu/lexical-semantic-recognition", "path": "/scripts/streusle2.0_scripts/pyutil/corpus/mwe_lexicons.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert len(data) == 7 assert list(data.x.size()) == [data.num_nodes, 3703] assert list(data.y.size()) == [data.num_nodes] assert data.y.max() + 1 == 6 assert data.train_mask.sum() == 6 * 20 assert data.val_mask.sum() == 500 assert data.test_mask.sum(...
code_fim
hard
{ "lang": "python", "repo": "Cyanogenoid/fspool", "path": "/graphs/test/datasets/test_planetoid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert data.contains_isolated_nodes() assert not data.contains_self_loops() assert data.is_undirected() shutil.rmtree(root)<|fim_prefix|># repo: Cyanogenoid/fspool path: /graphs/test/datasets/test_planetoid.py import sys import random import os.path as osp import shutil from...
code_fim
hard
{ "lang": "python", "repo": "Cyanogenoid/fspool", "path": "/graphs/test/datasets/test_planetoid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cyanogenoid/fspool path: /graphs/test/datasets/test_planetoid.py import sys import random import os.path as osp import shutil from torch_geometric.datasets import Planetoid from torch_geometric.data import DataLoader <|fim_suffix|> root = osp.join('/', 'tmp', str(random.randrange(sys.maxsiz...
code_fim
medium
{ "lang": "python", "repo": "Cyanogenoid/fspool", "path": "/graphs/test/datasets/test_planetoid.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheEagerLearner/Simple-Programs path: /Python-Programs/Internshala-course-data-scraper/program.py from bs4 import BeautifulSoup import requests data=requests.get("https://trainings.internshala.com/?utm_source=is_web_internshala-menu-dropdown1").text <|fim_suffix|>div=soup.find_all("div",class_=...
code_fim
easy
{ "lang": "python", "repo": "TheEagerLearner/Simple-Programs", "path": "/Python-Programs/Internshala-course-data-scraper/program.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in div: print(i.find("h4").text+" - "+i.find("p").text) print()<|fim_prefix|># repo: TheEagerLearner/Simple-Programs path: /Python-Programs/Internshala-course-data-scraper/program.py from bs4 import BeautifulSoup import requests <|fim_middle|>data=requests.get("https://trainings.internshal...
code_fim
medium
{ "lang": "python", "repo": "TheEagerLearner/Simple-Programs", "path": "/Python-Programs/Internshala-course-data-scraper/program.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NVIDIA/aistore path: /python/tests/botocore_common.py # # Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved. # # pylint: disable=missing-module-docstring import io import logging import unittest import boto3 from moto import mock_s3 from botocore.exceptions import ClientError fr...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/aistore", "path": "/python/tests/botocore_common.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with MightRedirect(self.redirect_errors_expected): stream_str = io.BytesIO() self.s3.download_fileobj( self.control_bucket, self.control_object, stream_str ) self.assertEqual( stream_str.getvalue().decode(UTF_ENCODING)...
code_fim
hard
{ "lang": "python", "repo": "NVIDIA/aistore", "path": "/python/tests/botocore_common.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Args: topo_file: """ try: with open(topo_file) as jfile: self._topology = json.loads(jfile.read()) except Exception as error: print("Error %s " % error) return for switch in self._...
code_fim
hard
{ "lang": "python", "repo": "amlight/ofp_sniffer", "path": "/libs/core/topo_reader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amlight/ofp_sniffer path: /libs/core/topo_reader.py """ Class to read the topology.json file in use at AmLight """ import json from libs.core.singleton import Singleton class TopoReader(metaclass=Singleton): """ Under construction """ def __init__(self): self....
code_fim
hard
{ "lang": "python", "repo": "amlight/ofp_sniffer", "path": "/libs/core/topo_reader.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_link_aliases(self, dp_a, port_a, dp_z, port_z, option="Full"): """ :param dp_a: :param port_a: :param dp_z: :param port_z: :param option: :return: """ dp_a = self.clear_dpid(dp_a) dp_z = self.clear_dpid(dp_z) ...
code_fim
hard
{ "lang": "python", "repo": "amlight/ofp_sniffer", "path": "/libs/core/topo_reader.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ClydeSpace-GroundStation/GroundStation path: /GNURadio/Test_Files/Message_Test/top_block.py #!/usr/bin/env python2 ################################################## # GNU Radio Python Flow Graph # Title: Top Block # Generated: Tue Mar 29 15:54:19 2016 ############################################...
code_fim
hard
{ "lang": "python", "repo": "ClydeSpace-GroundStation/GroundStation", "path": "/GNURadio/Test_Files/Message_Test/top_block.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ################################################## # Blocks ################################################## self.ccsds_asm_deframer_pdu_0 = ccsds.asm_deframer_pdu(0, 1, False, 255) self.blocks_vector_source_x_0_0 = blocks.vector_source_b(range(255)+range(255), Fa...
code_fim
hard
{ "lang": "python", "repo": "ClydeSpace-GroundStation/GroundStation", "path": "/GNURadio/Test_Files/Message_Test/top_block.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in data: try: if int(i) > 16777215: addr = socket.inet_ntoa(struct.pack("!I", int(i))) else: raise except: continue orig_data = orig_data.replace(i, addr) print orig_data<|fim_prefix|># repo: vesche/snippets path: /python/cw/intip.py #!/usr/bin/...
code_fim
medium
{ "lang": "python", "repo": "vesche/snippets", "path": "/python/cw/intip.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: vesche/snippets path: /python/cw/intip.py #!/usr/bin/env python import re import socket import struct import sys <|fim_suffix|> orig_data = orig_data.replace(i, addr) print orig_data<|fim_middle|>with open(sys.argv[1]) as f: orig_data = f.read() data = orig_data.split() for i in da...
code_fim
hard
{ "lang": "python", "repo": "vesche/snippets", "path": "/python/cw/intip.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> orig_data = orig_data.replace(i, addr) print orig_data<|fim_prefix|># repo: vesche/snippets path: /python/cw/intip.py #!/usr/bin/env python import re import socket import struct import sys with open(sys.argv[1]) as f: orig_data = f.read() data = orig_data.split() <|fim_middle|>for i in da...
code_fim
medium
{ "lang": "python", "repo": "vesche/snippets", "path": "/python/cw/intip.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: french-ai/reinforcement path: /blobrl/networks/base_dueling_network.py import abc from blobrl.networks import BaseNetwork class BaseDuelingNetwork(BaseNetwork): @abc.abstractmethod def __init__(self, network): """ :param network: network when we add Value head ...
code_fim
medium
{ "lang": "python", "repo": "french-ai/reinforcement", "path": "/blobrl/networks/base_dueling_network.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(layers, list): return [map_forward(layers, last_tensor, value_outputs) for layers in layers] advantage = layers(last_tensor) value = value_outputs(last_tensor) return value + advantage - advantage.mean() return map_forw...
code_fim
medium
{ "lang": "python", "repo": "french-ai/reinforcement", "path": "/blobrl/networks/base_dueling_network.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.last_range = new_range def on_set_action(self, action_name, entities): action = getattr(self, action_name, None) result = None if action is not None: result = action(entities) return result def on_action(self, action_name, entities):...
code_fim
hard
{ "lang": "python", "repo": "Veides/veidesbot_ros_example", "path": "/veidesbot_platform/src/veidesbot_platform/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Veides/veidesbot_ros_example path: /veidesbot_platform/src/veidesbot_platform/__init__.py import rospy from geometry_msgs.msg import Twist from veides_agent_ros.msg import Fact, Action, Trail from veides_agent_ros.srv import ( TrailsRequest, EventRequest, ) from veidesbot_platform.states ...
code_fim
hard
{ "lang": "python", "repo": "Veides/veidesbot_ros_example", "path": "/veidesbot_platform/src/veidesbot_platform/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # TODO: reimplement to be odometry based self.stop() speed = self.speed_level * 200 angular_speed = speed * PI / 180 msg = self._create_twist() msg.angular.z = direction * angular_speed start_time = rospy.Time.now() current_angle = 0 ...
code_fim
hard
{ "lang": "python", "repo": "Veides/veidesbot_ros_example", "path": "/veidesbot_platform/src/veidesbot_platform/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class CreateLinkedRightFold(bpy.types.Operator, CreateFoldMixin): """Create right-side fold on selected edge (linked to previous fold)""" bl_idname = "object.create_fold_linked_right" bl_label = "Create Linked Right Fold" @classmethod def poll(cls, context): return context.obj...
code_fim
hard
{ "lang": "python", "repo": "Olliebrown/blender-origami-fold", "path": "/foldOps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Olliebrown/blender-origami-fold path: /foldOps.py # Import system and blender modules import bpy # Import our own custom modules from . import foldUtils class CreateFoldMixin: """Create Fold Mixin Base""" # Static class level variable foldBones = [] foldCount = 0 def getSe...
code_fim
hard
{ "lang": "python", "repo": "Olliebrown/blender-origami-fold", "path": "/foldOps.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }