text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: burrowsej/SurPyval path: /surpyval/parametric/fitters/mle.py import autograd.numpy as np from autograd import jacobian, hessian from autograd.numpy.linalg import inv from scipy.optimize import minimize, approx_fprime import sys import copy def _create_censor_flags(x_mle, gamma, c, dist): if...
code_fim
hard
{ "lang": "python", "repo": "burrowsej/SurPyval", "path": "/surpyval/parametric/fitters/mle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, alpha=0.3, **kwargs): super(layers.LeakyReLU, self).__init__(**kwargs) self.__name__ = 'LeakyReLU2' self.supports_masking = True self.alpha = K.cast_to_floatx(alpha)<|fim_prefix|># repo: mariussterling/LOBDeepPP_code path: /LOBDeepPP/LOBDeepPP_model/...
code_fim
medium
{ "lang": "python", "repo": "mariussterling/LOBDeepPP_code", "path": "/LOBDeepPP/LOBDeepPP_model/__activations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mariussterling/LOBDeepPP_code path: /LOBDeepPP/LOBDeepPP_model/__activations.py from keras import layers, constraints from keras import backend as K class PReLU2(layers.PReLU): def __init__(self, alpha_initializer='zeros', alpha_regularizer=None, <|fim_suffix|>class LeakyReLU2(layers.LeakyR...
code_fim
hard
{ "lang": "python", "repo": "mariussterling/LOBDeepPP_code", "path": "/LOBDeepPP/LOBDeepPP_model/__activations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GreaterGoodCorp/SuperHelper path: /src/SuperHelper/Core/core_cli.py # This module defines the entry Click CLI function # All modules of SuperHelper should define its own group, which can imported by this module. import logging import platform import sys from typing import NoReturn try: impor...
code_fim
hard
{ "lang": "python", "repo": "GreaterGoodCorp/SuperHelper", "path": "/src/SuperHelper/Core/core_cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from SuperHelper.Core import load_added_modules as _load_added_modules for module in _load_added_modules(): try: cli.add_command(module[0]) except Exception or BaseException: logger.exception(f"Unable to load module {module[1]}") else: lo...
code_fim
hard
{ "lang": "python", "repo": "GreaterGoodCorp/SuperHelper", "path": "/src/SuperHelper/Core/core_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def load_added_modules(): from SuperHelper.Core import load_added_modules as _load_added_modules for module in _load_added_modules(): try: cli.add_command(module[0]) except Exception or BaseException: logger.exception(f"Unable to load module {module[1]}") ...
code_fim
hard
{ "lang": "python", "repo": "GreaterGoodCorp/SuperHelper", "path": "/src/SuperHelper/Core/core_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LSSTDESC/TJPCov path: /tjpcov/covariance_fourier_gaussian_nmt.py h.isfile(fnames[0]): cw.write_to(fnames[0]) for fn, isf in zip(fnames[1:], isfiles[1:]): if isf and os.path.isfile(fn): # Remove old covariance workspac...
code_fim
hard
{ "lang": "python", "repo": "LSSTDESC/TJPCov", "path": "/tjpcov/covariance_fourier_gaussian_nmt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_workspaces_dict( self, tracer_names, bins, cache=None, fields=None, masks=None, **kwargs ): """Return a dictionary with the workspaces for the given tracers. Args: tracer_names (dict): Dictionary of the masks names assotiated to the fie...
code_fim
hard
{ "lang": "python", "repo": "LSSTDESC/TJPCov", "path": "/tjpcov/covariance_fourier_gaussian_nmt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return cw def get_fields_dict(self, tracer_names, cache=None, masks=None, **kwargs): """Return a dictionary with the fields assotiated to the given tracers. Args: tracer_names (dict): Dictionary of the tracer names of the same form as mask_name. I...
code_fim
hard
{ "lang": "python", "repo": "LSSTDESC/TJPCov", "path": "/tjpcov/covariance_fourier_gaussian_nmt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pierobot/protonfixes path: /gamefixes/340170.py """ FINAL FANTASY TYPE-0 HD """ #pylint: disable=C0103 <|fim_suffix|> util.protontricks('mf_install')<|fim_middle|>from protonfixes import util def main(): """ Requires media foundation dlls """
code_fim
medium
{ "lang": "python", "repo": "pierobot/protonfixes", "path": "/gamefixes/340170.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> util.protontricks('mf_install')<|fim_prefix|># repo: pierobot/protonfixes path: /gamefixes/340170.py """ FINAL FANTASY TYPE-0 HD """ #pylint: disable=C0103 from protonfixes import util <|fim_middle|>def main(): """ Requires media foundation dlls """
code_fim
medium
{ "lang": "python", "repo": "pierobot/protonfixes", "path": "/gamefixes/340170.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jbruce12000/septic-tank path: /septic_tank/scripts/celery.test.client.py #!/usr/bin/env python import logging import socket from pipeline import Pipeline from inputs import FileInput, ZeroMQInput, StdInput from parsers import RegexParser from filters import ZuluDateFilter, RemoveFieldsFilter, Gr...
code_fim
hard
{ "lang": "python", "repo": "jbruce12000/septic-tank", "path": "/septic_tank/scripts/celery.test.client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dw = DirWatcher(folder = "/localfs/celery/", regex = '.*.log', last_lines=0, multiline = True, multiline_regex = '^(\s+|Traceback|ValueError|UnboundLocalError|IntegrityError)') add_server = AddFieldsFilter({'server' ...
code_fim
medium
{ "lang": "python", "repo": "jbruce12000/septic-tank", "path": "/septic_tank/scripts/celery.test.client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.__attachTextControl( data, prop, unoControl, "Time", field, 0) @classmethod def attachNumericControl(self, data, prop, unoControl, field): return self.__attachTextControl( data, prop, unoControl, "Value", field, float(0)) @classmethod d...
code_fim
hard
{ "lang": "python", "repo": "zhangxiaoxiao9527/kkFileView", "path": "/office-plugin/windows-office/program/wizards/ui/event/UnoDataAware.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhangxiaoxiao9527/kkFileView path: /office-plugin/windows-office/program/wizards/ui/event/UnoDataAware.py # # This file is part of the LibreOffice project. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this...
code_fim
hard
{ "lang": "python", "repo": "zhangxiaoxiao9527/kkFileView", "path": "/office-plugin/windows-office/program/wizards/ui/event/UnoDataAware.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async def _read(consumed_thing, name): try: _logger.debug("Reading: %s", name) val = await consumed_thing.properties[name].read() _logger.debug("Read %s = %s", name, val) except Exception as ex: _logger.warning("Error reading %s: %s", name, ex) async def app(wot,...
code_fim
medium
{ "lang": "python", "repo": "agmangas/wotemu", "path": "/wotemu/apps/reader.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: agmangas/wotemu path: /wotemu/apps/reader.py """ Reads all the properties from the Thing passed as argument in a periodic fashion. """ import asyncio import logging from wotemu.utils import consume_from_catalogue, wait_node _logger = logging.getLogger(__name__) <|fim_suffix|> while True: ...
code_fim
hard
{ "lang": "python", "repo": "agmangas/wotemu", "path": "/wotemu/apps/reader.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jecki/MetaInductionSim path: /InductionApplet.py # -*- coding: cp1252 -*- #!/usr/bin/jython import copy, pawt, java # , re from javax.swing import JApplet, JLabel, JList, JTextArea, JButton, JRadioButton, \ ButtonGroup, JTextPane, JPanel, JOptionPane, \ ...
code_fim
hard
{ "lang": "python", "repo": "jecki/MetaInductionSim", "path": "/InductionApplet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def destroy(self): pass def refresh(self): if self.graph != None: self.graph.redraw() def valueChanged(self, e): global exampleList newSelection = self.examples[self.exampleSelector.getSelectedIndex()] if newSelection != self.touched: self....
code_fim
hard
{ "lang": "python", "repo": "jecki/MetaInductionSim", "path": "/InductionApplet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jarusified/CallFlow path: /callflow/operations/process.py # Copyright 2017-2020 Lawrence Livermore National Security, LLC and other # CallFlow Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: MIT import numpy as np import pandas as pd from scipy.stats ...
code_fim
hard
{ "lang": "python", "repo": "jarusified/CallFlow", "path": "/callflow/operations/process.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.gf.df["module"] = self.gf.df["module"].apply( lambda name: callflow.utils.sanitize_name(name) ) return self def add_module_name_caliper(self, module_map): self.gf.df["module"] = self.gf.df["name"].apply( lambda n...
code_fim
hard
{ "lang": "python", "repo": "jarusified/CallFlow", "path": "/callflow/operations/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if ( "time" not in self.gf.df.columns and "sum#sum#time.duration" in self.gf.df.columns ): self.gf.df["time"] = self.gf.df["sum#sum#time.duration"] return self def create_name_module_map(self): if "mod...
code_fim
hard
{ "lang": "python", "repo": "jarusified/CallFlow", "path": "/callflow/operations/process.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dpakpdl/NepaliNLP path: /ClassicalModels/HMM/model.py # -*- coding: utf-8 -*- """ @author: dpak """ from collections import Counter, defaultdict import prepare_data from pomegranate import State, HiddenMarkovModel, DiscreteDistribution import re class NepaliHMM(object): def __init__(self, ...
code_fim
hard
{ "lang": "python", "repo": "dpakpdl/NepaliNLP", "path": "/ClassicalModels/HMM/model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def simplify_decoding(self, sequence): _, state_path = self.basic_model.viterbi(self.replace_unknown(sequence)) return [state[1].name for state in state_path[1:-1]] def accuracy(self, sequences, labels): correct = total_predictions = 0 for observations, actual_tags...
code_fim
hard
{ "lang": "python", "repo": "dpakpdl/NepaliNLP", "path": "/ClassicalModels/HMM/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aroberge/ideas path: /ideas/utils.py """utils.py ============ A few utility functions for this project. """ import os import uuid import token_utils # to find the path of site-packages PYTHON = os.path.dirname(os.__file__).lower() SITE_PACKAGES = os.path.dirname(token_utils.__file__).lower()...
code_fim
hard
{ "lang": "python", "repo": "aroberge/ideas", "path": "/ideas/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> If there is a single line, it is prefixed by ``header: `. Otherwise, it is surrounded by dividers. ``header`` is usually either ``"Original"`` or ``"New"`` """ lines = source.split("\n") if len(lines) > 1: shortened_source_indicator = "\n..." if len(lines) > 10 else "" ...
code_fim
hard
{ "lang": "python", "repo": "aroberge/ideas", "path": "/ideas/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Utility function used to reduce the length of the path shown to a user, including removing the extension. For example, a path for a module in the Python standard library might be shown as:: PYTHON:/module whereas a file found in the user's root directory might be shown ...
code_fim
hard
{ "lang": "python", "repo": "aroberge/ideas", "path": "/ideas/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if result["status"] != 0: raise ValueError(f"The command failed with status code {result['status']}")<|fim_prefix|># repo: ottogroup/clash path: /examples/job.py from pyclash.clash import JobConfigBuilder, Job import os JOB_CONFIG = ( JobConfigBuilder() .project_id(os.environ['GCP_PROJECT_ID...
code_fim
medium
{ "lang": "python", "repo": "ottogroup/clash", "path": "/examples/job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>result = Job(job_config=JOB_CONFIG, name_prefix="myjob").run( ["echo", "hello world"], wait_for_result=True ) if result["status"] != 0: raise ValueError(f"The command failed with status code {result['status']}")<|fim_prefix|># repo: ottogroup/clash path: /examples/job.py from pyclash.clash impor...
code_fim
hard
{ "lang": "python", "repo": "ottogroup/clash", "path": "/examples/job.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ottogroup/clash path: /examples/job.py from pyclash.clash import JobConfigBuilder, Job import os JOB_CONFIG = ( JobConfigBuilder() .project_id(os.environ['GCP_PROJECT_ID']) .image("google/cloud-sdk:latest") .machine_type("n1-standard-1") .subnetwork("default") .preemptibl...
code_fim
medium
{ "lang": "python", "repo": "ottogroup/clash", "path": "/examples/job.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Read stock data (close) for given symbols for given period of time :type symbols: char array :type dates: DatetimeIndex :type base_dir: String :rtype: DataFrame """ df = pd.DataFrame(index=dates) if 'SPY' not in symbols: symbols.insert(0, 'SPY') for sym...
code_fim
hard
{ "lang": "python", "repo": "kmalhan/ml_trade", "path": "/ml_trade/utility.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Plot given DataFrame :type df: DataFrame :type title: String """ ax = df.plot(title=title, fontsize=10) ax.set_xlabel("Date") ax.set_ylabel("Price") plt.show()<|fim_prefix|># repo: kmalhan/ml_trade path: /ml_trade/utility.py import pandas as pd import pandas_datare...
code_fim
medium
{ "lang": "python", "repo": "kmalhan/ml_trade", "path": "/ml_trade/utility.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kmalhan/ml_trade path: /ml_trade/utility.py import pandas as pd import pandas_datareader.data as web import datetime as dt import matplotlib.pyplot as plt import os def symbol_to_path(symbol, base_dir="../data/"): """ Return CSV path to specified symbol :type symbol: char :type ...
code_fim
medium
{ "lang": "python", "repo": "kmalhan/ml_trade", "path": "/ml_trade/utility.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DistributedSystemsAnalysis/horus-tracer path: /falcon/core/protocol/fbs/SocketEventData.py # automatically generated by the FlatBuffers compiler, do not modify # namespace: fbs <|fim_suffix|> NONE = 0 SocketConnect = 1 SocketAccept = 2 SocketSend = 3 SocketReceive = 4<|fim_mi...
code_fim
easy
{ "lang": "python", "repo": "DistributedSystemsAnalysis/horus-tracer", "path": "/falcon/core/protocol/fbs/SocketEventData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class SocketEventData(object): NONE = 0 SocketConnect = 1 SocketAccept = 2 SocketSend = 3 SocketReceive = 4<|fim_prefix|># repo: DistributedSystemsAnalysis/horus-tracer path: /falcon/core/protocol/fbs/SocketEventData.py # automatically generated by the FlatBuffers compiler, do not mod...
code_fim
easy
{ "lang": "python", "repo": "DistributedSystemsAnalysis/horus-tracer", "path": "/falcon/core/protocol/fbs/SocketEventData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Get the gradients of the jastrow values of a given orbital terms Args: r (torch.tensor): matrix of the e-e distances Nbatch x Nelec_pair Returns: torch.tensor: gradients of the values wrt to ee distance """ ...
code_fim
hard
{ "lang": "python", "repo": "NLESC-JCER/QMCTorch", "path": "/qmctorch/wavefunction/jastrows/elec_elec/orbital_dependent_jastrow_kernel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> jhess = jhess.unsqueeze(0) if out is None: out = jhess else: out = torch.cat((out, jhess)) return out @staticmethod def _grads(val, r): """Get the gradients of the jastrow values of a...
code_fim
hard
{ "lang": "python", "repo": "NLESC-JCER/QMCTorch", "path": "/qmctorch/wavefunction/jastrows/elec_elec/orbital_dependent_jastrow_kernel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NLESC-JCER/QMCTorch path: /qmctorch/wavefunction/jastrows/elec_elec/orbital_dependent_jastrow_kernel.py import torch from torch import nn from torch.autograd import grad from .kernels.jastrow_kernel_electron_electron_base import JastrowKernelElectronElectronBase class OrbitalDependentJastrowKe...
code_fim
hard
{ "lang": "python", "repo": "NLESC-JCER/QMCTorch", "path": "/qmctorch/wavefunction/jastrows/elec_elec/orbital_dependent_jastrow_kernel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> resp = await aiohttp.ClientSession().request( "post", 'http://localhost:8080/multipart', data=writer, headers=writer.headers) print(resp) assert 200 == resp.status async def req2(): with aiohttp.MultipartWriter() as writer: writer.append('test') writer.app...
code_fim
medium
{ "lang": "python", "repo": "pythoneer/examples", "path": "/multipart/client.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pythoneer/examples path: /multipart/client.py #!/usr/bin/env python3 # This script could be used for actix-web multipart example test # just start server and run client.py <|fim_suffix|>async def req1(): with aiohttp.MultipartWriter() as writer: writer.append('test') writer....
code_fim
medium
{ "lang": "python", "repo": "pythoneer/examples", "path": "/multipart/client.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vladimirshkoda/redis-bindings path: /tests/test_redis_list/test_descriptor.py def test_set_empty_list(r, redis_list, model_with_redis_field): """Should remove existing key in Redis.""" test_object = model_with_redis_field() assert test_object.redis_field == redis_list <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "vladimirshkoda/redis-bindings", "path": "/tests/test_redis_list/test_descriptor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_object.redis_field = another_str_list assert list(test_object.redis_field) == another_str_list def test_set_new_value_without_pickling( str_list, bytes_list, model_with_redis_field_without_pickling ): """Should set str_list and return bytes_list.""" test_object = model_w...
code_fim
hard
{ "lang": "python", "repo": "vladimirshkoda/redis-bindings", "path": "/tests/test_redis_list/test_descriptor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # using @user syntax the msg page will be rendered # if nothing is added, then the index will be rendered as normal @self.app.route("/") @self.app.route("/@<uuid>") def index(uuid: str = "") -> HttpResponse: if uuid: return self.shimon.ms...
code_fim
hard
{ "lang": "python", "repo": "dosisod/SHIMON", "path": "/SHIMON/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dosisod/SHIMON path: /SHIMON/app.py from werkzeug.exceptions import HTTPException from flask import Flask, Response from SHIMON.shimon import Shimon from typing import Union from SHIMON import HttpResponse class App: IP = "127.0.0.1" PORT = 1717 <|fim_suffix|> return self....
code_fim
hard
{ "lang": "python", "repo": "dosisod/SHIMON", "path": "/SHIMON/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if uuid: return self.shimon.msg(uuid) return self.shimon.index() @self.app.route("/settings") def settings() -> HttpResponse: return self.shimon.settings() @self.app.route("/account") def account() -> HttpResponse: ...
code_fim
hard
{ "lang": "python", "repo": "dosisod/SHIMON", "path": "/SHIMON/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>parser = argparse.ArgumentParser() parser.add_argument('-in', dest="INPUT_FILE", default="projects/global_lives/data/ia_globallives_subset.csv", help="Input video csv file") parser.add_argument('-single', dest="SINGLE", action="store_true", help="Display single line?") a = parser.parse_args() headings, r...
code_fim
medium
{ "lang": "python", "repo": "beefoo/media-tools", "path": "/projects/global_lives/viz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: beefoo/media-tools path: /projects/global_lives/viz.py # -*- coding: utf-8 -*- import argparse import inspect from matplotlib import pyplot as plt import numpy as np import os from pprint import pprint import sys # add parent directory to sys path to import relative modules currentdir = os.path...
code_fim
hard
{ "lang": "python", "repo": "beefoo/media-tools", "path": "/projects/global_lives/viz.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rafalmp/shareapp path: /shareapp/main/api/serializers.py from hashid_field.rest import HashidSerializerCharField from rest_framework import serializers from shareapp.main.models import Retrieval, SharedItem class FileWithoutPathField(serializers.FileField): def to_representation(self, valu...
code_fim
hard
{ "lang": "python", "repo": "rafalmp/shareapp", "path": "/shareapp/main/api/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def create(self, validated_data): if validated_data.get("url") and validated_data.get("file"): raise serializers.ValidationError( detail="Submit either 'file' or 'url', not both." ) return super().create(validated_data) class Meta: m...
code_fim
medium
{ "lang": "python", "repo": "rafalmp/shareapp", "path": "/shareapp/main/api/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> id = HashidSerializerCharField(source_field=SharedItem.id, read_only=True) file = FileWithoutPathField(required=False) def create(self, validated_data): if validated_data.get("url") and validated_data.get("file"): raise serializers.ValidationError( detail="...
code_fim
hard
{ "lang": "python", "repo": "rafalmp/shareapp", "path": "/shareapp/main/api/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: safisher/ngs path: /ancillary/combineGeneCounts.py #!/usr/bin/env python # Copyright (c) 2015, Stephen Fisher and Junhyong Kim, University of # Pennsylvania. All Rights Reserved. # # You may not use this file except in compliance with the Kim Lab License # located at # # http://kim.bio.upen...
code_fim
hard
{ "lang": "python", "repo": "safisher/ngs", "path": "/ancillary/combineGeneCounts.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> # remove gene from list, so we can test if all genes from first # file are in the second file. geneCounts.pop(geneID) # combine the counts and output based on boolean operator finalCount = 0 if BOOLEAN == 'and': # for AND both files must have a non-zero count f...
code_fim
hard
{ "lang": "python", "repo": "safisher/ngs", "path": "/ancillary/combineGeneCounts.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>firstLine = True for line in file2: # skip header line if firstLine: firstLine = False continue gene = line.split('\t') geneID = gene[0] readCnt_2 = int(gene[1]) if DEBUG: print geneID, readCnt_2 # make sure the gene exists in first file. If not then treat as...
code_fim
hard
{ "lang": "python", "repo": "safisher/ngs", "path": "/ancillary/combineGeneCounts.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmsfltchr/kglib path: /kglib/kgcn/models/embedding_test.py # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses t...
code_fim
hard
{ "lang": "python", "repo": "jmsfltchr/kglib", "path": "/kglib/kgcn/models/embedding_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> features = np.array([[1, 0, 0.7], [1, 2, 0.7], [0, 1, 0.5]]) mock_instance = Mock(return_value=tf.convert_to_tensor(np.array([[1, 0.7], [1, 0.7], [0, 0.5]]))) mock = Mock(return_value=mock_instance) patcher = patch('kglib.kgcn.models.embedding.TypewiseEncoder', spec=True, ...
code_fim
medium
{ "lang": "python", "repo": "jmsfltchr/kglib", "path": "/kglib/kgcn/models/embedding_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jaredLunde/cargo-orm path: /unit_tests/fields/AuthKey.py #!/usr/bin/python3 -S # -*- coding: utf-8 -*- import unittest import string from math import ceil from cargo.fields.extras import * from cargo.exceptions import IncorrectPasswordError from vital.security import chars_in, bits_in from uni...
code_fim
hard
{ "lang": "python", "repo": "jaredLunde/cargo-orm", "path": "/unit_tests/fields/AuthKey.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def base(self): return self.orm.enc_key def test_init(self): pass def test_type_name(self): self.assertEqual(self.base.type_name, 'text') self.assertEqual(self.base_array.type_name, 'text[]') self.base.new() def test_deepcopy(self): ...
code_fim
hard
{ "lang": "python", "repo": "jaredLunde/cargo-orm", "path": "/unit_tests/fields/AuthKey.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_array_select(self): arr = [Key.generate(), Key.generate()] self.base_array(arr) val = getattr(self.orm.new().insert(self.base_array), self.base_array.field_name) val_b = getattr(self.orm.new().desc(self.orm.uid).get(), ...
code_fim
hard
{ "lang": "python", "repo": "jaredLunde/cargo-orm", "path": "/unit_tests/fields/AuthKey.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rpatrik96/nl-causal-representations path: /care_nl_ica/cl_ica/tools/3dident/generate_clevr_dataset_images.py """Generate image renderings for 3DIdent dataset.""" import os import numpy as np import argparse import pathlib import colorsys import sys import site def main(args): args.output_f...
code_fim
hard
{ "lang": "python", "repo": "rpatrik96/nl-causal-representations", "path": "/care_nl_ica/cl_ica/tools/3dident/generate_clevr_dataset_images.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i, (shape_name, material_name) in enumerate(zip(shape_names, material_names)): print("Adding object", i, shape_name, material_name) # add object object_name = render_utils.add_object( shapes_path, f"Shape{shape_name}", f"Object_{i}", 1.5, (0.0, 0.0, 0.0) ...
code_fim
hard
{ "lang": "python", "repo": "rpatrik96/nl-causal-representations", "path": "/care_nl_ica/cl_ica/tools/3dident/generate_clevr_dataset_images.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self._get_base_info(node) self.gui.highlight_document(self._token_kinds) self.gui.set_loaded(True) return class Highlighter(QtGui.QSyntaxHighlighter): '''Implements C/C++ syntax highligher.''' def __init__(self, parent, config_theme, keywords): super(Highl...
code_fim
hard
{ "lang": "python", "repo": "AldonzaUrielArmend/hrdev", "path": "/hrdev_plugin/include/syntax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if token.spelling == '{': self._formatting_context.opened_brackets += 1 self._formatting_context.last_indent_num += 1 return self._get_tabs() + '' if token.spelling == '}': self._formatting_context.closed_brackets += 1 if self._f...
code_fim
hard
{ "lang": "python", "repo": "AldonzaUrielArmend/hrdev", "path": "/hrdev_plugin/include/syntax.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AldonzaUrielArmend/hrdev path: /hrdev_plugin/include/syntax.py #!c:\\python27\python.exe # -*- coding: utf-8 -*- '''This file contains all classes related to parsing and highlighting.''' try: from PySide import QtCore, QtGui except: from PyQt5 import QtCore, QtGui import clang.cindex i...
code_fim
hard
{ "lang": "python", "repo": "AldonzaUrielArmend/hrdev", "path": "/hrdev_plugin/include/syntax.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_DataTransformationFailureMode_no_duplicates(): """Test that only unique indices are returned.""" dataset = smlb.TabularData(data=np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])) fails = [] failmode = smlb.DataTransformationFailureMode(("index", fails), dataset.num_samples) failmode...
code_fim
hard
{ "lang": "python", "repo": "kyawlin/smlb", "path": "/tests/test_transformations.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyawlin/smlb path: /tests/test_transformations.py """DataTransformation tests. Scientific Machine Learning Benchmark: A benchmark of regression models in chem- and materials informatics. """ import pytest import numpy as np import smlb ########################### # InverseTransformation #...
code_fim
hard
{ "lang": "python", "repo": "kyawlin/smlb", "path": "/tests/test_transformations.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Transforms strings back to integers.""" def fit(self, data): return self def apply(self, data): return smlb.TabularData(data=np.array([[int(i)] for i in data])) class TestTransformation(smlb.DataTransformation, smlb.InvertibleTransformation): ...
code_fim
medium
{ "lang": "python", "repo": "kyawlin/smlb", "path": "/tests/test_transformations.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print(f'running task {self.name} with priority {self.priority}') order.append(self.priority) return [f'{self.name}_test.nc'] monkeypatch.setattr(BaseTask, '_run', _run) monkeypatch.setattr(esmvalcore._task, 'Pool', ThreadPool) runner(example_tasks) print(order) ...
code_fim
hard
{ "lang": "python", "repo": "aperezpredictia/ESMValCore", "path": "/tests/integration/test_task.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aperezpredictia/ESMValCore path: /tests/integration/test_task.py import os from functools import partial from multiprocessing.pool import ThreadPool import pytest import esmvalcore from esmvalcore._task import (BaseTask, _run_tasks_parallel, _run_tasks_sequential, ...
code_fim
hard
{ "lang": "python", "repo": "aperezpredictia/ESMValCore", "path": "/tests/integration/test_task.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Number of generations NUMBER_OF_GENERATIONS = 5000 # Random weights random values range INPUT_LAYER_WEIGHTS_RANGE = [-0.1, 0.1] HIDDEN_LAYER_WEIGHTS_RANGE = [-0.1, 0.1] INPUT_LAYER_BIAS_RANGE = [-0, 0] # Mutation rate MUTATION_RATE = 0.0001 # Mutation random values range MUTATION_VALUE_RANGE = [-0.1...
code_fim
medium
{ "lang": "python", "repo": "SamirWeAli/DLProject", "path": "/src/configs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SamirWeAli/DLProject path: /src/configs.py # The path of saved weights for initialization TOP_SCORE_WEIGHTS_LOAD_FILE_PATH = '/Users/ASamir/FreeTime/DLProject/best_records/topscore.txt' TOP_SCORE_WEIGHTS_SAVE_FILE_PATH = '/Users/ASamir/FreeTime/DLProject/topscore.txt' WEIGHTS_SAVE_FILE_PATH = '/U...
code_fim
medium
{ "lang": "python", "repo": "SamirWeAli/DLProject", "path": "/src/configs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mjwestcott/fennel path: /tests/unit/test_job.py import pytest from fennel.job import Job from fennel.status import EXECUTING, SUCCESS from fennel.utils import base64uuid @pytest.fixture def uuid(): return base64uuid() @pytest.fixture def job(uuid): return Job( task="test", ...
code_fim
hard
{ "lang": "python", "repo": "mjwestcott/fennel", "path": "/tests/unit/test_job.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_serialise(job, as_dict): assert job.serialise() == as_dict def test_deserialise(job, as_dict): assert Job.deserialise(as_dict) == job def test_result(job): assert job.result == '{"return_value": null, "exception": {}}'<|fim_prefix|># repo: mjwestcott/fennel path: /tests/unit/test...
code_fim
hard
{ "lang": "python", "repo": "mjwestcott/fennel", "path": "/tests/unit/test_job.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def test_replace(job): assert job.status == EXECUTING assert job.replace(status=SUCCESS).status == SUCCESS assert job.replace(task="foo").task == "foo" def test_to_json(job, as_json): assert job.to_json() == as_json def test_from_json(job, as_json): assert Job.from_json(as_json) ==...
code_fim
hard
{ "lang": "python", "repo": "mjwestcott/fennel", "path": "/tests/unit/test_job.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['gentlewoman']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_gentlewomen.py #calss header class _GENTLEWOMEN(): def __init__(self,): <|fim_middle|> self.name = "GENTLEWOMEN...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_gentlewomen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.basic = ['gentlewoman']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_gentlewomen.py #calss header class _GENTLEWOMEN(): def __init__(self,): <|fim_middle|> self.name = "GENTLEWOMEN" self.definitions = gentlewoman self.parents = [] self.childen = [] self.pro...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_gentlewomen.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_gentlewomen.py #calss header class _GENTLEWOMEN(): <|fim_suffix|> self.name = "GENTLEWOMEN" self.definitions = gentlewoman self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['gentlewoman']<...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_gentlewomen.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Start SSH session ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(ip, port=port, username=user, password=pw) print('Opening SSH Connection') # Copy files to remove server sftp = ssh.open_sftp() check_for_remote_folder(sft...
code_fim
hard
{ "lang": "python", "repo": "livestock3d/livestock3d", "path": "/livestock3d/ssh.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: livestock3d/livestock3d path: /livestock3d/ssh.py __author__ = "Christian Kongsgaard" __license__ = "MIT" # -------------------------------------------------------------------------------------------------------------------- # # Imports # Module imports import os import paramiko # ------------...
code_fim
hard
{ "lang": "python", "repo": "livestock3d/livestock3d", "path": "/livestock3d/ssh.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: farooq-teqniqly/blog-databricks-parallelism path: /piserial.py from random import random from time import time import sys def throw_dart(): x = random() y = random() if (x * x) + (y * y) <= 1: return 1 return 0 def main(iterations: int): <|fim_suffix|>if __name__ == ...
code_fim
hard
{ "lang": "python", "repo": "farooq-teqniqly/blog-databricks-parallelism", "path": "/piserial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> end = time() pi = (4 * hits) / iterations print(pi) print(f"Execution time: {end - start} seconds.") if __name__ == "__main__": main(int(sys.argv[1]))<|fim_prefix|># repo: farooq-teqniqly/blog-databricks-parallelism path: /piserial.py from random import random from time import time ...
code_fim
hard
{ "lang": "python", "repo": "farooq-teqniqly/blog-databricks-parallelism", "path": "/piserial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> outputfile = open(filename, 'w') outputfile.write(self.firstline+"\n") for line in self.filestuff: line = line.strip() contents = line.split('\t') m = float(len(contents))-1 nonzerocount = 0.0 for j in range(1, len(content...
code_fim
hard
{ "lang": "python", "repo": "movingpictures83/TSVFilter", "path": "/TSVFilterPlugin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: movingpictures83/TSVFilter path: /TSVFilterPlugin.py import PyPluMA class TSVFilterPlugin: def input(self, filename): self.inputfile = open(filename, 'r') def run(self): <|fim_suffix|> def output(self, filename): outputfile = open(filename, 'w') outputfile.writ...
code_fim
hard
{ "lang": "python", "repo": "movingpictures83/TSVFilter", "path": "/TSVFilterPlugin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: resource-watch/data-pre-processing path: /ocn_007_coral_bleaching_monitoring/ocn_007_coral_bleaching_monitoring_processing.py # # RW Data Script: ocn_007_coral_bleaching_monitoring # [Info](https://coralreefwatch.noaa.gov/product/5km/index.php) # [Sources](ftp://ftp.star.nesdis.noaa.gov/pub/s...
code_fim
hard
{ "lang": "python", "repo": "resource-watch/data-pre-processing", "path": "/ocn_007_coral_bleaching_monitoring/ocn_007_coral_bleaching_monitoring_processing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # baa original: -5=No Data (land); 0=No Stress; 1=Watch; 2=Warning; 3=Alert Level 1; 4=Alert Level 2 # valid range [0,4] # fill value -5 # scalefactor = 1 # hs original: from low negatives up to about 10(C). scale bar from 0-5. nodata=nodata(land) # valid range [-1500,1500] # fill val...
code_fim
hard
{ "lang": "python", "repo": "resource-watch/data-pre-processing", "path": "/ocn_007_coral_bleaching_monitoring/ocn_007_coral_bleaching_monitoring_processing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kittttttan/pe path: /py/pe/pe15.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ Starting in the top left corner in a 20 by 20 grid, how many routes are there to the bottom right corner? """ <|fim_suffix|> p = perm(m + n, m) f = factorial(n) # print("%d / %d = %d" % (p, f, p // f)...
code_fim
medium
{ "lang": "python", "repo": "kittttttan/pe", "path": "/py/pe/pe15.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: while True: s = input('m> ') m = int(s) s = input('n> ') n = int(s) print(pe15(m, n)) except (SyntaxError, EOFError, KeyboardInterrupt, NameError): pass<|fim_prefix|># repo: kittttttan/pe path: /py/pe/pe15.py #!/usr/...
code_fim
hard
{ "lang": "python", "repo": "kittttttan/pe", "path": "/py/pe/pe15.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: log2timeline/dfvfs path: /dfvfs/path/location_path_spec.py # -*- coding: utf-8 -*- """The location-based path specification implementation.""" from dfvfs.path import path_spec class LocationPathSpec(path_spec.PathSpec): """Base class for location-based path specifications. Attributes: ...
code_fim
hard
{ "lang": "python", "repo": "log2timeline/dfvfs", "path": "/dfvfs/path/location_path_spec.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def comparable(self): """str: comparable representation of the path specification.""" return self._GetComparable(sub_comparable_string=( f'location: {self.location:s}'))<|fim_prefix|># repo: log2timeline/dfvfs path: /dfvfs/path/location_path_spec.py # -*- coding: utf-8 -*- "...
code_fim
medium
{ "lang": "python", "repo": "log2timeline/dfvfs", "path": "/dfvfs/path/location_path_spec.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rdbv/cisol path: /Instructions.py from capstone import * from capstone.x86 import * from Operand import * # Overflow flag mask ofMask = { 1 : 0x80, 2 : 0x8000, 4 : 0x80000000, 8 : 0x8000000000000000 } ''' Instructions in C implementation ''' def mov(left, right, inst, cg):...
code_fim
hard
{ "lang": "python", "repo": "rdbv/cisol", "path": "/Instructions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def xor(left, right, inst, cg): pass def cmp(left, right, inst, cg): # cmp is sub without setting value sub(left, right, inst, cg, True) def jmp(op, inst, cg): cg.emit('goto _%x' % (int(op.value)), comment = (inst.mnemonic + ' ' + inst.op_str)); def jne(op, inst, cg): cg...
code_fim
hard
{ "lang": "python", "repo": "rdbv/cisol", "path": "/Instructions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Edouard360/text-mining-challenge path: /main.py """ Module docstring """ from time import localtime, strftime import pandas as pd from sklearn import metrics from classifier import Classifier from featureEngineering.FeatureExporter import FeatureExporter from featureEngineering.FeatureImporter...
code_fim
hard
{ "lang": "python", "repo": "Edouard360/text-mining-challenge", "path": "/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>testing_features = FeatureImporter.importFromFile(df_dict["test"]["filename"], features=features, **parameters) # testing_features = testing_features[:,5].reshape(-1,1) # testing_features_1 = testing_features[:,0:2].reshape(-1,2) # testing_features_2 = testing_features[:,3:] # testing_features = np.concat...
code_fim
hard
{ "lang": "python", "repo": "Edouard360/text-mining-challenge", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>training_features = FeatureImporter.importFromFile(df_dict["train"]["filename"], features=features, **parameters) # training_features = training_features[:,5].reshape(-1,1) # training_features_1 = training_features[:,0:2].reshape(-1,2) # training_features_2 = training_features[:,3:] # training_features = ...
code_fim
hard
{ "lang": "python", "repo": "Edouard360/text-mining-challenge", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_file_check_file_created_deleted(self): absolute_path='testfiles/octova.stl' response=self.create_simple_upload_file(absolute_path) self.assertEqual(response.status_code, status.HTTP_200_OK) class TestModel(TestCase): def setUp(self): self.myfile=FileMode...
code_fim
hard
{ "lang": "python", "repo": "sahin88/Django_React_Stlviewer_App", "path": "/backend/stlViwerApp/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sahin88/Django_React_Stlviewer_App path: /backend/stlViwerApp/tests.py from django.urls import reverse, resolve from django.core.files.uploadedfile import SimpleUploadedFile import numpy as np from rest_framework import status from django.test import SimpleTestCase, TestCase from .models import ...
code_fim
hard
{ "lang": "python", "repo": "sahin88/Django_React_Stlviewer_App", "path": "/backend/stlViwerApp/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scy-phy/minicps path: /minicps/protocols.py start_server(cls, address, tags): """Start a cpppo enip server. The command used to start the server is generated by ``_start_server_cmd``. Notice that the client has to manage the new process, eg:kill it after ...
code_fim
hard
{ "lang": "python", "repo": "scy-phy/minicps", "path": "/minicps/protocols.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Supported tag data types: - CO (1-bit, coil, read and write) - DI (1-bit, discrete input, read only) - HR (16-bit, holding register, read and write) - IR (16-bit, input register, read only) """ # server ports _TCP_PORT = ':502' # _UDP_PORT = ':TODO ...
code_fim
hard
{ "lang": "python", "repo": "scy-phy/minicps", "path": "/minicps/protocols.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name: modbus Tag is a generic name to manage modbus datatypes: coils, discrete inputs, holding registers, and input registers. The servers will init all the tags to 0, and they will use pymodbus's ModbusSequentialDataBlock. The addressing is the default one (zero_mode=False). The cont...
code_fim
hard
{ "lang": "python", "repo": "scy-phy/minicps", "path": "/minicps/protocols.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arsen3d/platform-client-python path: /neuromation/api/utils.py import sys from types import TracebackType from typing import ( Any, Awaitable, Coroutine, Generator, Generic, Optional, Type, TypeVar, ) if sys.version_info >= (3, 7): # pragma: no cover from co...
code_fim
hard
{ "lang": "python", "repo": "arsen3d/platform-client-python", "path": "/neuromation/api/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class _ContextManager(Generic[_T], Awaitable[_T], AsyncContextManager[_T]): __slots__ = ("_coro", "_ret") def __init__(self, coro: Coroutine[Any, Any, _T]) -> None: self._coro = coro self._ret: Optional[_T] = None def __await__(self) -> Generator[Any, None, _T]: retu...
code_fim
medium
{ "lang": "python", "repo": "arsen3d/platform-client-python", "path": "/neuromation/api/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }