text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>class PlayerClassesViewSet(viewsets.ModelViewSet): queryset = PlayerClasses.objects.all() serializer_class = PlayerClassesSerializer permission_classes = (permissions.IsAuthenticatedOrReadOnly,) class UserViewSet(viewsets.ReadOnlyModelViewSet): """ This viewset automatically provides...
code_fim
hard
{ "lang": "python", "repo": "nigelmathes/GAME", "path": "/world/character/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> queryset = PlayerClasses.objects.all() serializer_class = PlayerClassesSerializer permission_classes = (permissions.IsAuthenticatedOrReadOnly,) class UserViewSet(viewsets.ReadOnlyModelViewSet): """ This viewset automatically provides `list` and `detail` actions. """ queryset ...
code_fim
hard
{ "lang": "python", "repo": "nigelmathes/GAME", "path": "/world/character/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eggfly/gosms path: /chat/pysms.py #!/usr/bin/env python # -*- coding: utf-8 -*- from socket import * from time import ctime import select import sys HOST='' PORT=21569 BUFSIZ=1024 ADDR=(HOST,PORT) tcpSerSock=socket(AF_INET,SOCK_STREAM) tcpSerSock.bind(ADDR) tcpSerSock.listen(5) input=[tcpSerSoc...
code_fim
medium
{ "lang": "python", "repo": "eggfly/gosms", "path": "/chat/pysms.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>while True: print 'waiting for connection...' tcpCliSock,addr=tcpSerSock.accept() print '...connected from:',addr input.append(tcpCliSock) #不同的就在这里,当有客户端连接时,要把他加进input while True: readyInput,readyOutput,readyException=select.select(input,[],[]) #每次循环都会阻塞在这里,只有当有数据输入时才会执行下面的操作 for indata in ready...
code_fim
medium
{ "lang": "python", "repo": "eggfly/gosms", "path": "/chat/pysms.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: stochasticnetworkcontrol/snc path: /tests/snc/agents/activity_rate_to_mpc_actions/test_no_mpc_policy.py import numpy as np import pytest from snc.agents.activity_rate_to_mpc_actions.no_mpc_policy \ import NoMPCPolicy def test_no_binary_activity_rates(): <|fim_suffix|> def test_violate_const...
code_fim
hard
{ "lang": "python", "repo": "stochasticnetworkcontrol/snc", "path": "/tests/snc/agents/activity_rate_to_mpc_actions/test_no_mpc_policy.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> z_star = np.array([[0.1], [0.8]]) constituency_matrix = np.eye(2) mpc_policy = NoMPCPolicy(constituency_matrix) with pytest.raises(AssertionError): mpc_policy.obtain_actions(z_star=z_star) def test_approx_binary_activity_rates(): z_star = np.array([[1-1e-7], [0+1e-7]]) co...
code_fim
medium
{ "lang": "python", "repo": "stochasticnetworkcontrol/snc", "path": "/tests/snc/agents/activity_rate_to_mpc_actions/test_no_mpc_policy.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Get the system information from the openmm system forces = {self.system.getForce(index).__class__.__name__: self.system.getForce(index) for index in range(self.system.getNumForces())} # Use the nondonded_force to get the same rules nonbonded_force = forc...
code_fim
hard
{ "lang": "python", "repo": "boyuezhong/QUBEKit", "path": "/QUBEKit/engines/openmm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(3 * len(self.molecule.atoms)): for j in range(i, 3 * len(self.molecule.atoms)): # Mutate the atomic coords # Do less energy evaluations on the diagonal of the matrix if i == j: coords = deepcopy(input_co...
code_fim
hard
{ "lang": "python", "repo": "boyuezhong/QUBEKit", "path": "/QUBEKit/engines/openmm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: boyuezhong/QUBEKit path: /QUBEKit/engines/openmm.py #!/usr/bin/env python3 from QUBEKit.utils import constants from QUBEKit.utils.decorators import timer_logger import numpy as np from simtk.openmm import app import simtk.openmm as mm from simtk import unit import xml.etree.ElementTree as ET ...
code_fim
hard
{ "lang": "python", "repo": "boyuezhong/QUBEKit", "path": "/QUBEKit/engines/openmm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> f = super(ResumableFileField, self).clean(data, initial) if self.allowed_mimes is not None and \ f.content_type not in self.allowed_mimes: raise ValidationError(self.error_messages['invalid_mime']) return f @property def upload_url(self): ...
code_fim
medium
{ "lang": "python", "repo": "jirikadlec2/django-jquery-file-upload", "path": "/src/resumable/fields.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jirikadlec2/django-jquery-file-upload path: /src/resumable/fields.py # -*- coding: utf-8 -*- from django.forms.fields import FileField from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from .widgets import ResumableFileInput <|fim_suffix...
code_fim
hard
{ "lang": "python", "repo": "jirikadlec2/django-jquery-file-upload", "path": "/src/resumable/fields.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @chunks_dir.setter def chunks_dir(self, chunks_dir): self.widget.chunks_dir = chunks_dir def clean(self, data, initial): f = super(ResumableFileField, self).clean(data, initial) if self.allowed_mimes is not None and \ f.content_type not in self.allowed_...
code_fim
medium
{ "lang": "python", "repo": "jirikadlec2/django-jquery-file-upload", "path": "/src/resumable/fields.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p = Path(__file__).parent.parent.parent / "lib" / "python" sys.path = [p.as_posix()] + sys.path<|fim_prefix|># repo: bloomberg/bde-tools path: /bin/pylibinit/addlibpath.py import os import sys from pathlib import Path <|fim_middle|>def add_lib_path():
code_fim
easy
{ "lang": "python", "repo": "bloomberg/bde-tools", "path": "/bin/pylibinit/addlibpath.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bloomberg/bde-tools path: /bin/pylibinit/addlibpath.py import os import sys <|fim_suffix|> p = Path(__file__).parent.parent.parent / "lib" / "python" sys.path = [p.as_posix()] + sys.path<|fim_middle|>from pathlib import Path def add_lib_path():
code_fim
easy
{ "lang": "python", "repo": "bloomberg/bde-tools", "path": "/bin/pylibinit/addlibpath.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bloomberg/bde-tools path: /bin/pylibinit/addlibpath.py import os import sys from pathlib import Path <|fim_suffix|> p = Path(__file__).parent.parent.parent / "lib" / "python" sys.path = [p.as_posix()] + sys.path<|fim_middle|>def add_lib_path():
code_fim
easy
{ "lang": "python", "repo": "bloomberg/bde-tools", "path": "/bin/pylibinit/addlibpath.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aws/aws-sam-cli path: /tests/functional/commands/init/test_interactive_init_flow.py import json import tempfile import shutil import os from time import time from unittest.mock import MagicMock, patch from unittest import TestCase from pathlib import Path from samcli.commands.init.init_templates...
code_fim
hard
{ "lang": "python", "repo": "aws/aws-sam-cli", "path": "/tests/functional/commands/init/test_interactive_init_flow.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): self.prompt_patch = patch("samcli.commands.init.interactive_init_flow.click.prompt") self.prompt_mock = self.prompt_patch.start() self.addCleanup(self.prompt_patch.stop) self.confirm_patch = patch("samcli.commands.init.interactive_init_flow.click.confi...
code_fim
medium
{ "lang": "python", "repo": "aws/aws-sam-cli", "path": "/tests/functional/commands/init/test_interactive_init_flow.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AussieSeaweed/math2 path: /math2/tests/test_linear.py empty_vector, full_matrix, full_vector, i, identity_matrix, j, k, norm, one_matrix, one_vector, random_matrix, random_vector, row, rows, singleton_matri...
code_fim
hard
{ "lang": "python", "repo": "AussieSeaweed/math2", "path": "/math2/tests/test_linear.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AussieSeaweed/math2 path: /math2/tests/test_linear.py l( rows((range(3), range(3, 6))) + rows((range(6, 9), range(9, 12))), rows(((6, 8, 10), (12, 14, 16)))) self.assertEqual(row(range(5, -1, -1)) + row(range(6)), row((5,) * 6)) self.assertEqual(column(range(5, -1, -1)...
code_fim
hard
{ "lang": "python", "repo": "AussieSeaweed/math2", "path": "/math2/tests/test_linear.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_abs(self) -> None: self.assertAlmostEqual(abs(rows((range(3), range(3, 6)))), 7.416198487095663) self.assertAlmostEqual(abs(row(range(6))), 7.416198487095663) self.assertAlmostEqual(abs(column(range(6))), 7.416198487095663) def test_getitem(self) -> None: ...
code_fim
hard
{ "lang": "python", "repo": "AussieSeaweed/math2", "path": "/math2/tests/test_linear.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@jit(nopython=True) def correlate(x,prn,chips,frac,incr,c): n = len(x) p = 0.0j cp = (chips+frac)%code_length for i in range(n): p += x[i]*(1.0-2.0*c[int(cp)]) cp = (cp+incr)%code_length return p # test if __name__=='__main__': print(b3i_code(1)[0:20]) print(b3i_code(2)[0:20])<|fim...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/GNSS-DSP-tools", "path": "/gnsstools/beidou/b3i.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mfkiwl/GNSS-DSP-tools path: /gnsstools/beidou/b3i.py # Beidou B3I code construction # # Copyright 2018 Peter Monta import numpy as np chip_rate = 10230000 code_length = 10230 secondary_code = np.array([0,0,0,0,0,1,0,0,1,1,0,1,0,1,0,0,1,1,1,0]) secondary_code = 1.0 - 2.0*secondary_code b3i_g2_...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/GNSS-DSP-tools", "path": "/gnsstools/beidou/b3i.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if prn not in codes: codes[prn] = b3i(prn) return codes[prn] def code(prn,chips,frac,incr,n): c = b3i_code(prn) idx = (chips%code_length) + frac + incr*np.arange(n) idx = np.floor(idx).astype('int') idx = np.mod(idx,code_length) x = c[idx] return 1.0 - 2.0*x try: from numba import ...
code_fim
hard
{ "lang": "python", "repo": "mfkiwl/GNSS-DSP-tools", "path": "/gnsstools/beidou/b3i.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> req = Request('url', 'auth') dispatcher = MagicMock(name='dispatcher', ) # make 5 pages with 5 items on each page pages = make_pages(5, 5, key=key, af=af) # initial the paged object with the first page paged = body(req, mock_http_response(json=next(pages)), dispatcher) # the r...
code_fim
hard
{ "lang": "python", "repo": "granduke/planet-client-python", "path": "/tests/test_models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: granduke/planet-client-python path: /tests/test_models.py # Copyright 2017 Planet Labs, Inc. # # 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 # # http://www.apache.or...
code_fim
hard
{ "lang": "python", "repo": "granduke/planet-client-python", "path": "/tests/test_models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Get the maximum key length #max_len = 0 #for key in rtt_params.keys(): # if len(key) > max_len: # max_len = len(key) # Print the tuning values in a pretty format for key in sorted(rtt_params.keys()): print('{0:<22}: {1}'.format(key, rtt_params[key])) # TODO: print the various sized floats, lists, ...
code_fim
medium
{ "lang": "python", "repo": "emmertex/openpilot", "path": "/selfdrive/rtt_pickle_print.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: emmertex/openpilot path: /selfdrive/rtt_pickle_print.py # Quick and dirty tool to print the real-time tuning data from the command line # Will only work once controlsd has had a chance to write the real-time tuning carparams the first time. # # v0.02 James-T1: Pretty(er) print format # v0.01 ...
code_fim
medium
{ "lang": "python", "repo": "emmertex/openpilot", "path": "/selfdrive/rtt_pickle_print.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Print the tuning values in a pretty format for key in sorted(rtt_params.keys()): print('{0:<22}: {1}'.format(key, rtt_params[key])) # TODO: print the various sized floats, lists, lists of floats, etc differently so they are more human readable and can be directy pasted into the tuning files. print('...
code_fim
medium
{ "lang": "python", "repo": "emmertex/openpilot", "path": "/selfdrive/rtt_pickle_print.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ailitonia/nonebot_miya path: /omega_miya/plugins/Roll/__init__.py import re import random import datetime from nonebot import on_command, CommandSession, permission, log from nonebot.command.argfilter import validators, controllers from omega_miya.plugins.Group_manage.group_permissions import * ...
code_fim
hard
{ "lang": "python", "repo": "Ailitonia/nonebot_miya", "path": "/omega_miya/plugins/Roll/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for user_info in group_user_list: __user_qq = user_info['user_id'] __user_group_info = await session.bot.get_group_member_info(group_id=group_id, user_id=__user_qq) __user_group_nickmane = __user_group_info['card'] if not __user_group_nickmane: __user_group_...
code_fim
hard
{ "lang": "python", "repo": "Ailitonia/nonebot_miya", "path": "/omega_miya/plugins/Roll/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @lottery.args_parser async def _(session: CommandSession): group_id = session.event.group_id session_type = session.event.detail_type if session_type == 'group': if not has_command_permissions(group_id): return elif session_type == 'private': return else: ...
code_fim
hard
{ "lang": "python", "repo": "Ailitonia/nonebot_miya", "path": "/omega_miya/plugins/Roll/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: charlie-coleman/auvsi_communications path: /camera/rpi.py import os import datetime import _thread import time import socket import sys host = socket.gethostname() if (len(sys.argv) > 1): port = sys.argv[0] else: port = 3141 def download_thread(lfs): try: while True: file...
code_fim
hard
{ "lang": "python", "repo": "charlie-coleman/auvsi_communications", "path": "/camera/rpi.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def input_thread(a_list): input() a_list.append(True) a_list = [] last_file_sent = ''; _thread.start_new_thread(input_thread, (a_list,)) _thread.start_new_thread(download_thread, (last_file_sent,)) while not a_list: os.system('gphoto2 --capture-image-and-download -q -F 4 -I 1 --no-keep --force-overwri...
code_fim
hard
{ "lang": "python", "repo": "charlie-coleman/auvsi_communications", "path": "/camera/rpi.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def safeMakeDirs(tdir): if not os.path.isdir(tdir): os.makedirs(tdir)<|fim_prefix|># repo: CuongNguyen218/ObjectDetection-OneStageDet path: /yolo/utils/fileproc.py import os def safeMakeDir(tdir): <|fim_middle|> if not os.path.isdir(tdir): os.mkdir(tdir)
code_fim
easy
{ "lang": "python", "repo": "CuongNguyen218/ObjectDetection-OneStageDet", "path": "/yolo/utils/fileproc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not os.path.isdir(tdir): os.makedirs(tdir)<|fim_prefix|># repo: CuongNguyen218/ObjectDetection-OneStageDet path: /yolo/utils/fileproc.py import os def safeMakeDir(tdir): <|fim_middle|> if not os.path.isdir(tdir): os.mkdir(tdir) def safeMakeDirs(tdir):
code_fim
medium
{ "lang": "python", "repo": "CuongNguyen218/ObjectDetection-OneStageDet", "path": "/yolo/utils/fileproc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: CuongNguyen218/ObjectDetection-OneStageDet path: /yolo/utils/fileproc.py import os def safeMakeDir(tdir): if not os.path.isdir(tdir): os.mkdir(tdir) <|fim_suffix|> if not os.path.isdir(tdir): os.makedirs(tdir)<|fim_middle|>def safeMakeDirs(tdir):
code_fim
easy
{ "lang": "python", "repo": "CuongNguyen218/ObjectDetection-OneStageDet", "path": "/yolo/utils/fileproc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rsreds/LogSimulator path: /sample.py import logging from src.utils import OptionParser from src.utils import config_loggers from src.generator import generate_log logger = logging.getLogger(__name__) <|fim_suffix|>if __name__ == "__main__": """Main Function""" optmgr = OptionParser('sa...
code_fim
easy
{ "lang": "python", "repo": "rsreds/LogSimulator", "path": "/sample.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run(): generate_log() if __name__ == "__main__": """Main Function""" optmgr = OptionParser('sample') opts = optmgr.parser.parse_args() level = logging.DEBUG if opts.debug else logging.INFO config_loggers(level) run()<|fim_prefix|># repo: rsreds/LogSimulator path: /sampl...
code_fim
easy
{ "lang": "python", "repo": "rsreds/LogSimulator", "path": "/sample.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TransferState(enum.IntEnum): """ Represents data transfer run state. Attributes: TRANSFER_STATE_UNSPECIFIED (int): State placeholder. PENDING (int): Data transfer is scheduled and is waiting to be picked up by data transfer backend. RUNNING (int): Data transfer i...
code_fim
hard
{ "lang": "python", "repo": "tswast/google-cloud-python", "path": "/bigquery_datatransfer/google/cloud/bigquery_datatransfer_v1/gapic/enums.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Attributes: DATA_REFRESH_TYPE_UNSPECIFIED (int): The data source won't support data auto refresh, which is default value. SLIDING_WINDOW (int): The data source supports data auto refresh, and runs will be scheduled for the past few days. Does not allow custom values t...
code_fim
hard
{ "lang": "python", "repo": "tswast/google-cloud-python", "path": "/bigquery_datatransfer/google/cloud/bigquery_datatransfer_v1/gapic/enums.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tswast/google-cloud-python path: /bigquery_datatransfer/google/cloud/bigquery_datatransfer_v1/gapic/enums.py # -*- coding: utf-8 -*- # # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License....
code_fim
hard
{ "lang": "python", "repo": "tswast/google-cloud-python", "path": "/bigquery_datatransfer/google/cloud/bigquery_datatransfer_v1/gapic/enums.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: guilhermegoesgarcia/API_REST_contratacao_de_frete path: /cadastro_frete/migrations/0001_initial.py # Generated by Django 3.0.8 on 2021-10-28 18:32 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependenc...
code_fim
hard
{ "lang": "python", "repo": "guilhermegoesgarcia/API_REST_contratacao_de_frete", "path": "/cadastro_frete/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>el( name='CadastroOferta', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('from_de', models.CharField(max_length=20)), ('to_para', models.CharField(max_length=20)), ...
code_fim
hard
{ "lang": "python", "repo": "guilhermegoesgarcia/API_REST_contratacao_de_frete", "path": "/cadastro_frete/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MagmaLabs/mongorm path: /mongorm/fields/BaseField.py class BaseField(object): _resyncAtSave = False def __init__( self, default=None, unique=False, dbField=None, primaryKey=False ): self.default = default self.unique = unique self.dbField = dbField self.primaryKey = primaryKey if pr...
code_fim
medium
{ "lang": "python", "repo": "MagmaLabs/mongorm", "path": "/mongorm/fields/BaseField.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def setOwnerDocument( self, ownerDocument ): self.ownerDocument = ownerDocument def optimalIndex( self ): return self.dbField def getSearchKey( self, dbField, dereferences ): return dbField<|fim_prefix|># repo: MagmaLabs/mongorm path: /mongorm/fields/BaseField.py class BaseField(object): _r...
code_fim
medium
{ "lang": "python", "repo": "MagmaLabs/mongorm", "path": "/mongorm/fields/BaseField.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: bayespy/bayespy path: /bayespy/inference/vmp/nodes/gaussian_markov_chain.py Parameters ---------- u_parents : list of list of arrays List of parents' lists of moments. Returns ------- phi : list of arrays Natural parameters. ...
code_fim
hard
{ "lang": "python", "repo": "bayespy/bayespy", "path": "/bayespy/inference/vmp/nodes/gaussian_markov_chain.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> The node models a sequence of Gaussian variables :math:`\mathbf{x}_0,\ldots,\mathbf{x}_{N-1}` with linear Markovian dynamics. The time variability of the dynamics is obtained by modelling the state dynamics matrix as a linear combination of a set of matrices with time-varying linear co...
code_fim
hard
{ "lang": "python", "repo": "bayespy/bayespy", "path": "/bayespy/inference/vmp/nodes/gaussian_markov_chain.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bayespy/bayespy path: /bayespy/inference/vmp/nodes/gaussian_markov_chain.py # (...,N,D) # m0: (...,N,K) m0 = np.einsum('...nji,...ijk,...ni->...nk', XpXn, B, np.atleast_2d(v)) # ...
code_fim
hard
{ "lang": "python", "repo": "bayespy/bayespy", "path": "/bayespy/inference/vmp/nodes/gaussian_markov_chain.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fuku-ys/earthquake path: /example/not-so-much-useful/OLD.zk-wip.ryu_pyeq/zk_inspector.py #!/usr/bin/env python ## FIXME: move these ones to the config file ZMQ_ADDR='ipc:///tmp/eq/ether_inspector' import colorama from scapy.all import * import pyearthquake from pyearthquake.inspector.ether impo...
code_fim
hard
{ "lang": "python", "repo": "fuku-ys/earthquake", "path": "/example/not-so-much-useful/OLD.zk-wip.ryu_pyeq/zk_inspector.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _map_ZkFLEPacket_to_event(self, pkt): event = pkt[ZkFLEPacket].event self._print_packet_as(pkt, ZkFLEPacket, colorama.Back.CYAN + colorama.Fore.BLACK) return event def _map_ZkPacket_to_event(self, pkt): event = pkt[ZkPacket].event msg = event.op...
code_fim
hard
{ "lang": "python", "repo": "fuku-ys/earthquake", "path": "/example/not-so-much-useful/OLD.zk-wip.ryu_pyeq/zk_inspector.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>setup_kws = dict( ((k, k) for k in 'name version license description classifiers'.split()), url='Homepage', install_requires='dependencies' ) setup_kws = dict((k1, toml_str(k2)[0]) for k1, k2 in setup_kws.items()) setup_kws['keywords'] = toml_str('keywords') setup_kws['author'], setup_kws['author_email...
code_fim
hard
{ "lang": "python", "repo": "mk-fg/pretty-yaml", "path": "/setup.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: mk-fg/pretty-yaml path: /setup.py # For compatibility - pyproject.toml should work instead # ...but it does not atm, so ends up being parsed to setup() values here anyway import setuptools, re, pathlib as pl toml_lines = (pl.Path(__file__).parent / 'pyproject.toml').read_text().split('\n') <|f...
code_fim
hard
{ "lang": "python", "repo": "mk-fg/pretty-yaml", "path": "/setup.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: mpolatcan/airflow-docker path: /src/utils/config_loader_generator/config_loader_generator.py # Written by Mutlu Polatcan # 21.10.2019 import yaml import sys import re class Constants: KEY_CONFIG_FILES = "config_files" KEY_BASE_DOCKERFILE_TEMPLATE = "base_dockerfile_template" KEY_CO...
code_fim
hard
{ "lang": "python", "repo": "mpolatcan/airflow-docker", "path": "/src/utils/config_loader_generator/config_loader_generator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> load_fn_calls = [] for property, value in data.items(): env_var_name = env_var_prefix + "_" + property if env_var_prefix else property property_name = property_prefix + "_" + property \ if property_prefix and not Constants.CONFIGURATION_...
code_fim
hard
{ "lang": "python", "repo": "mpolatcan/airflow-docker", "path": "/src/utils/config_loader_generator/config_loader_generator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BFriedland/word-search-solvers path: /word_search_solver.py # Word Search Solver by Ben Friedland # The goal of this program is to solve word search puzzles. # Specifications: # "Given a collection of letters which contain hidden words # (in the file 'word_search.txt'), find all of the words i...
code_fim
hard
{ "lang": "python", "repo": "BFriedland/word-search-solvers", "path": "/word_search_solver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> This implementation accepts lists of lists composed of any type of element that supports the equality operator and assignment as a dictionary key. It also works for arbitrary lengths of both top-level lists and sub-lists. ''' self.coordinates = collections....
code_fim
hard
{ "lang": "python", "repo": "BFriedland/word-search-solvers", "path": "/word_search_solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>g i think that interp a generator f = interpolate.interp1d(x,y) f1 = x = np.l x1 = np.linspace(0,10) plt.plot(x,y) plt.plot(x1,f) plt.show()<|fim_prefix|># repo: fsbr/se3-path-planner path: /modularPlanner/interrrpolate.py import matplotlib.pyplot as plt from scipy import interpolate import n<|fim_middle...
code_fim
medium
{ "lang": "python", "repo": "fsbr/se3-path-planner", "path": "/modularPlanner/interrrpolate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fsbr/se3-path-planner path: /modularPlanner/interrrpolate.py import matplotlib.pyplot as plt from scipy import interpolate import n<|fim_suffix|>g i think that interp a generator f = interpolate.interp1d(x,y) f1 = x = np.l x1 = np.linspace(0,10) plt.plot(x,y) plt.plot(x1,f) plt.show()<|fim_middle...
code_fim
medium
{ "lang": "python", "repo": "fsbr/se3-path-planner", "path": "/modularPlanner/interrrpolate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wang-Clark/gdsfactory path: /gdsfactory/drc/check_duplicate_cells.py import gdspy from gdsfactory.types import PathType def check_duplicate_cells(gdspath: PathType): """ FIXME at gdspy level """ gdsii_lib = gdspy.GdsLibrary() gdsii_lib.read_gds(gdspath) # component = gf...
code_fim
medium
{ "lang": "python", "repo": "Wang-Clark/gdsfactory", "path": "/gdsfactory/drc/check_duplicate_cells.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> gdspath = "gds.gds" gdsii_lib = gdspy.GdsLibrary() gdsii_lib.read_gds(gdspath)<|fim_prefix|># repo: Wang-Clark/gdsfactory path: /gdsfactory/drc/check_duplicate_cells.py import gdspy from gdsfactory.types import PathType def check_duplicate_cells(gdspath: PathType): """ FIXME at gds...
code_fim
medium
{ "lang": "python", "repo": "Wang-Clark/gdsfactory", "path": "/gdsfactory/drc/check_duplicate_cells.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': main()<|fim_prefix|># repo: flaviovdf/delete-me path: /main.py # -*- coding: utf8 <|fim_middle|> from manga_search import linsearch def main(): data = [8, 7, 2, 1, 2, 0] print(linsearch(data, 8))
code_fim
medium
{ "lang": "python", "repo": "flaviovdf/delete-me", "path": "/main.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: flaviovdf/delete-me path: /main.py # -*- coding: utf8 <|fim_suffix|> if __name__ == '__main__': main()<|fim_middle|> from manga_search import linsearch def main(): data = [8, 7, 2, 1, 2, 0] print(linsearch(data, 8))
code_fim
medium
{ "lang": "python", "repo": "flaviovdf/delete-me", "path": "/main.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: willshiao/brgan path: /src/main.py #!/usr/bin/env python # coding: utf-8 # In[1]: import wandb from training import Trainer from torch.utils.data.sampler import RandomSampler from ggan import ModelZoo from torch.utils.data import Dataset from dsloader.graphrnn_creator import create import netw...
code_fim
hard
{ "lang": "python", "repo": "willshiao/brgan", "path": "/src/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __getitem__(self, idx): return (self.cube[:, :, :, idx], 0) # ## Start main stuff # In[6]: print('Saving input matrices') with open(path.join(PATH_PREFIX, 'input_mats.pkl'), 'wb') as f: pickle.dump(everything, f) # In[8]: zoo = ModelZoo() # In[9]: # Loss functions adversar...
code_fim
hard
{ "lang": "python", "repo": "willshiao/brgan", "path": "/src/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # In[8]: zoo = ModelZoo() # In[9]: # Loss functions adversarial_loss = torch.nn.MSELoss() auxiliary_loss = torch.nn.CrossEntropyLoss() print(f"Using {opt['gen_class']} for generator") print(f"Using {opt['disc_class']} for discriminator") # Initialize generator and discriminator gen_class = zoo.ge...
code_fim
hard
{ "lang": "python", "repo": "willshiao/brgan", "path": "/src/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WYishai/gtfs.py path: /src/gtfspy/data_objects/agency.py import gtfspy from gtfspy.data_objects.base_object import BaseGtfsObjectCollection from gtfspy.data_objects.line import LineCollection from gtfspy.utils.validating import not_none_or_empty class Agency(object): def __init__(self, tra...
code_fim
hard
{ "lang": "python", "repo": "WYishai/gtfs.py", "path": "/src/gtfspy/data_objects/agency.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if recursive: for line in list(agency.lines): agency.lines.remove(line, recursive=True, clean_after=False) fare_rules_to_remove = [fare_attribute for fare_attribute in self._transit_data.fare_attributes if fare_attribute....
code_fim
hard
{ "lang": "python", "repo": "WYishai/gtfs.py", "path": "/src/gtfspy/data_objects/agency.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @property def default_redirect_uri(self): return self.redirect_uris[0] @property def default_scopes(self): if self._default_scopes: return self._default_scopes.split() return [] class Token(Document): client = ReferenceField(Client) user = Str...
code_fim
hard
{ "lang": "python", "repo": "Entromorgan/GIoTTo", "path": "/BuildingDepot-v3.2.8/buildingdepot/DataService/app/auth/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> client = ReferenceField(Client) user = StringField() token_type = StringField() access_token = StringField(unique=True) refresh_token = StringField(unique=True) expires = DateTimeField() _scopes = StringField() email = StringField() @property def scopes(self): ...
code_fim
hard
{ "lang": "python", "repo": "Entromorgan/GIoTTo", "path": "/BuildingDepot-v3.2.8/buildingdepot/DataService/app/auth/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Entromorgan/GIoTTo path: /BuildingDepot-v3.2.8/buildingdepot/DataService/app/auth/views.py """ DataService.auth.views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Functions for user login and logout from the DataService @copyright: (c) 2016 SynergyLabs @license: UCSD License. See License file for details. """ ...
code_fim
hard
{ "lang": "python", "repo": "Entromorgan/GIoTTo", "path": "/BuildingDepot-v3.2.8/buildingdepot/DataService/app/auth/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> = 1 newcount = 9.09 while count < 200: print( count, " ", format(count * 2.2, ".2f"), " | ", format(newcount, ".2f"), " ", format(newcount * 2.2, ".2f"), ) count = count + 1 newcount += 3.27<|fim_prefix...
code_fim
medium
{ "lang": "python", "repo": "ywyz/IntroducingToProgrammingUsingPython", "path": "/Exercise05/5-5.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ywyz/IntroducingToProgrammingUsingPython path: /Exercise05/5-5.py ''' @Date: 2019-09-02 20:14:41 @Author: ywyz @LastModifiedBy: ywyz @Github: https://github.com/ywyz @LastEditors: ywyz @LastEditTime: 2019-09-04 2<|fim_suffix|> = 1 newcount = 9.09 while count < 200: print( count, ...
code_fim
medium
{ "lang": "python", "repo": "ywyz/IntroducingToProgrammingUsingPython", "path": "/Exercise05/5-5.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ebranlard/matlab2python path: /smop/backend.py # smop -- Simple Matlab to Python compiler # Copyright 2011-2016 Victor Leikehman """ Calling conventions: call site: nargout=N is passed if and only if N > 1 func decl: nargout=1 must be declared if function may return more than one ...
code_fim
hard
{ "lang": "python", "repo": "ebranlard/matlab2python", "path": "/smop/backend.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fmt = "%s[%s]" return fmt % (self.func_expr._backend(), self.args._backend()) @extend(node.break_stmt) def _backend(self,level=0): return "break" @extend(node.builtins) def _backend(self,level=0): #if not self.ret: return "%s(%s)" % (self.__class__.__name...
code_fim
hard
{ "lang": "python", "repo": "ebranlard/matlab2python", "path": "/smop/backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s = self.value.strip() if not s: return "" if s[0] in "%#": return s.replace("%","#") return self.value @extend(node.concat_list) def _backend(self,level=0): #import pdb; pdb.set_trace() return ",".join(["[%s]"%t._backend() for t in self]) @extend(node.continue...
code_fim
hard
{ "lang": "python", "repo": "ebranlard/matlab2python", "path": "/smop/backend.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> x_emb.weight.data *= 1e-3 y_emb.weight.data *= 1e-3 kernel = GaussianKernel(slope=slope) a = kernel(x_emb.weight, y_emb.weight) b = kernel(x_emb.weight, x_emb.weight) c = kernel.pairwise(x_emb.weight, y_emb.weight) d = kernel.pairwise(x_emb.weight...
code_fim
hard
{ "lang": "python", "repo": "uclnlp/ctp", "path": "/tests/kbcr/kernels/test_kernels.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uclnlp/ctp path: /tests/kbcr/kernels/test_kernels.py # -*- coding: utf-8 -*- import numpy as np import torch from torch import nn from ctp.kernels import GaussianKernel <|fim_suffix|> a_np = a.numpy() b_np = b.numpy() c_np = c.numpy() d_np = d.numpy() n...
code_fim
hard
{ "lang": "python", "repo": "uclnlp/ctp", "path": "/tests/kbcr/kernels/test_kernels.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: allenai/allennlp path: /tests/models/model_test.py import torch import pytest from allennlp.common.testing.test_case import AllenNlpTestCase from allennlp.models import load_archive, Model from allennlp.nn.regularizers import RegularizerApplicator class TestModel(AllenNlpTestCase): def tes...
code_fim
hard
{ "lang": "python", "repo": "allenai/allennlp", "path": "/tests/models/model_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class FakeModel(Model): def forward(self, **kwargs): return {} class FakeRegularizerApplicator(RegularizerApplicator): def __call__(self, module): return 2.0 with pytest.raises(RuntimeError): regularizer = FakeRe...
code_fim
hard
{ "lang": "python", "repo": "allenai/allennlp", "path": "/tests/models/model_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rich-dtk/openapi-python-client path: /end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py import datetime from io import BytesIO from typing import Any, Dict, List, Type, TypeVar, cast import attr from dateutil.parser import isoparse ...
code_fim
hard
{ "lang": "python", "repo": "rich-dtk/openapi-python-client", "path": "/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> file_properties_ref = [] _file_properties_ref = d.pop("file_properties_ref") for componentsschemas_an_other_array_of_file_item_data in _file_properties_ref: componentsschemas_an_other_array_of_file_item = File( payload=BytesIO(componentsschemas_an_other_...
code_fim
hard
{ "lang": "python", "repo": "rich-dtk/openapi-python-client", "path": "/end_to_end_tests/golden-record/my_test_api_client/models/a_model_with_properties_reference_that_are_not_object.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stammler/simframe path: /tests/frame/test_abstractgroup.py # Tests for AbstractGroup class import pytest from simframe.frame import AbstractGroup def test_abstract_group_init_attributes(): <|fim_suffix|> def test_abstractgroup_repr_str(): ag = AbstractGroup() assert isinstance(repr(ag...
code_fim
medium
{ "lang": "python", "repo": "stammler/simframe", "path": "/tests/frame/test_abstractgroup.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def test_abstractgroup_repr_str(): ag = AbstractGroup() assert isinstance(repr(ag), str) assert isinstance(str(ag), str)<|fim_prefix|># repo: stammler/simframe path: /tests/frame/test_abstractgroup.py # Tests for AbstractGroup class import pytest from simframe.frame import AbstractGroup d...
code_fim
medium
{ "lang": "python", "repo": "stammler/simframe", "path": "/tests/frame/test_abstractgroup.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> print("".join(day)) # print the very last line print( "╰────┴─" + "".join( "─" * number_of_intervals + ("─" if i != number_of_intervals - 1 else "╯") for i in range(number_of_intervals) ) ...
code_fim
hard
{ "lang": "python", "repo": "knut0815/Education-Scripts", "path": "/school/course.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: knut0815/Education-Scripts path: /school/course.py invalid_abbreviation_error = ( f"The course abbreviation '{abbreviation}' in '{name}' is not valid." ) # abbreviation not surrounded by brackets if not abbreviation.startswith("(") or not abbreviation.ends...
code_fim
hard
{ "lang": "python", "repo": "knut0815/Education-Scripts", "path": "/school/course.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: knut0815/Education-Scripts path: /school/course.py (table) == 0: exit_with_error("No courses matching the criteria found!") print_table(table) def finals(self, short=False, **kwargs): """Lists dates of all finals.""" # get courses that have finals records...
code_fim
hard
{ "lang": "python", "repo": "knut0815/Education-Scripts", "path": "/school/course.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Princessgladys/googleresourcefinder path: /app/model.py or default if it does not exist.""" return hasattr(self, '%s__' % attribute_name) def get_value(self, attribute_name, default=None): """Returns the value of the Attribute with the given key_name, or d...
code_fim
hard
{ "lang": "python", "repo": "Princessgladys/googleresourcefinder", "path": "/app/model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Princessgladys/googleresourcefinder path: /app/model.py ns attribute "foo" has never # existed on this subject at any point in the past. # 2. If subject.foo__ is None, that means some user actually set the # attribute to "(unspecified)". # 3. All six fields are always writte...
code_fim
hard
{ "lang": "python", "repo": "Princessgladys/googleresourcefinder", "path": "/app/model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return '%s__' % attribute_name def has_value(self, attribute_name): """Returns the value of the Attribute with the given key_name, or default if it does not exist.""" return hasattr(self, '%s__' % attribute_name) def get_value(self, attribute_name, default=None...
code_fim
hard
{ "lang": "python", "repo": "Princessgladys/googleresourcefinder", "path": "/app/model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BenjaminBradshaw/synth path: /super_simple_synth.py import math import pyaudio import itertools import numpy as np from pygame import midi BUFFER_SIZE = 256 SAMPLE_RATE = 44100 NOTE_AMP = 0.1 # -- HELPER FUNCTIONS -- def get_sin_oscillator(freq=55, amp=1, sample_rate=SAMPLE_RATE): increment...
code_fim
hard
{ "lang": "python", "repo": "BenjaminBradshaw/synth", "path": "/super_simple_synth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># -- INITIALIZION -- midi.init() default_id = midi.get_default_input_id() midi_input = midi.Input(device_id=default_id) stream = pyaudio.PyAudio().open( rate=SAMPLE_RATE, channels=1, format=pyaudio.paInt16, output=True, frames_per_buffer=BUFFER_SIZE ) # -- RUN THE SYNTH -- try: ...
code_fim
medium
{ "lang": "python", "repo": "BenjaminBradshaw/synth", "path": "/super_simple_synth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class ChannelMultiple(ReprMixin): """Create a channel multiple. Items put on the input channel will be copied to all output channels. If no output channels are present then items put on input will be dropped. """ def __init__(self, src, *, _start=_start, _create_tas...
code_fim
hard
{ "lang": "python", "repo": "comex/asyncio-channel", "path": "/asyncio_channel/_create_multiple.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: comex/asyncio-channel path: /asyncio_channel/_create_multiple.py __all__ = ('create_multiple',) from asyncio import create_task from ._mixin import ReprMixin from ._util import wait_all async def _put(ch, x): if ch.full(): await ch.put(x) else: ch.offer(x) <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "comex/asyncio-channel", "path": "/asyncio_channel/_create_multiple.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> If no output channels are present then items put on input will be dropped. """ def __init__(self, src, *, _start=_start, _create_task=create_task): self._outs = outs = [] self._done = False _create_task(_start(src, outs, self._notify)) def add_out...
code_fim
hard
{ "lang": "python", "repo": "comex/asyncio-channel", "path": "/asyncio_channel/_create_multiple.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sofroniewn/napari path: /napari/settings/_shortcuts.py from typing import Dict, List from pydantic import Field, validator from ..utils.events.evented_model import EventedModel from ..utils.shortcuts import default_shortcuts from ..utils.translations import trans <|fim_suffix|> @validator(...
code_fim
hard
{ "lang": "python", "repo": "sofroniewn/napari", "path": "/napari/settings/_shortcuts.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Napari specific configuration preferences_exclude = ['schema_version'] @validator('shortcuts') def shortcut_validate(cls, v): for name, value in default_shortcuts.items(): if name not in v: v[name] = value return v<|fim_prefix|># repo:...
code_fim
medium
{ "lang": "python", "repo": "sofroniewn/napari", "path": "/napari/settings/_shortcuts.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def downgrade(migrate_engine): try: meta = MetaData(bind=migrate_engine) server = Table('server', meta, autoload=True) server.c.read_only.drop() except: pass try: meta = MetaData(bind=migrate_engine) server = Table('peer', meta, autoload=True) ...
code_fim
hard
{ "lang": "python", "repo": "omegachyll/wg-manager", "path": "/wg_dashboard_backend/migrations/versions/007_create_read_only_client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: omegachyll/wg-manager path: /wg_dashboard_backend/migrations/versions/007_create_read_only_client.py from sqlalchemy import * from migrate import * def upgrade(migrate_engine): try: meta = MetaData(bind=migrate_engine) server = Table('server', meta, autoload=True) re...
code_fim
hard
{ "lang": "python", "repo": "omegachyll/wg-manager", "path": "/wg_dashboard_backend/migrations/versions/007_create_read_only_client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: meta = MetaData(bind=migrate_engine) server = Table('server', meta, autoload=True) server.c.read_only.drop() except: pass try: meta = MetaData(bind=migrate_engine) server = Table('peer', meta, autoload=True) server.c.read_only.drop()...
code_fim
hard
{ "lang": "python", "repo": "omegachyll/wg-manager", "path": "/wg_dashboard_backend/migrations/versions/007_create_read_only_client.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Command to build SageMaker app """ logger.info(ASCII_LOGO) logger.info("Started building SageMaker Docker image. It will take some minutes...\n") try: config_file_path = os.path.join('.sagify.json') if not os.path.isfile(config_file_path): raise Val...
code_fim
medium
{ "lang": "python", "repo": "Kenza-AI/sagify", "path": "/sagify/commands/build.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }