text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> output = StringIO.StringIO() sys.stdout = output filepath = self.director.cache_dir + '/realServerWeight.2.1' self.assertTrue(self.director.disable('udp', 'resolver1.opendns.com', 'domain')) # now clean up the file try: os.unlink(filepat...
code_fim
hard
{ "lang": "python", "repo": "wujcheng/lvsm", "path": "/tests/test_keepalived.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> filepath = self.director.cache_dir + '/realServerWeight.2.2' try: # create the file before we continue f = open(filepath, 'w') f.write('1') f.close() self.assertTrue(self.director.enable('udp', 'resolver2.opendns.com', 'domain')) ...
code_fim
hard
{ "lang": "python", "repo": "wujcheng/lvsm", "path": "/tests/test_keepalived.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wujcheng/lvsm path: /tests/test_keepalived.py import unittest import os import sys import StringIO path = os.path.abspath(os.path.dirname(__file__)) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../lvsm'))) from lvsm.modules import keepalived class Keepalived(un...
code_fim
hard
{ "lang": "python", "repo": "wujcheng/lvsm", "path": "/tests/test_keepalived.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(100 - 7 * (8 + 4)) print(sub(100, mul(7, add(8, 4)))) # NOTE: add does NOT allow variadic arguments #print(add(2, 3, 4))<|fim_prefix|># repo: YP-Ye/composing-programs path: /ch1/12.py from fractions import Fraction print(1/2 + 1/4 + 1/8 + 1/16 + 1/32 + 1/64 + 1/128) print( Fraction(1, 2) + ...
code_fim
easy
{ "lang": "python", "repo": "YP-Ye/composing-programs", "path": "/ch1/12.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: YP-Ye/composing-programs path: /ch1/12.py from fractions import Fraction print(1/2 + 1/4 + 1/8 + 1/16 + 1/32 + 1/64 + 1/128) print( Fraction(1, 2) + Fraction(1, 4) + Fraction(1, 8) + Fraction(1, 16) + Fraction(1, 32) + Fraction(1, 64) + Fraction(1, 128)) <|fim_suffix...
code_fim
easy
{ "lang": "python", "repo": "YP-Ye/composing-programs", "path": "/ch1/12.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @register.filter def fake_date_without_day(value): """Fakes `date`. Sets day to `1`.""" return date(year=value[0], month=value[1], day=1)<|fim_prefix|># repo: daGrevis/daGrevis.lv path: /dagrevis_lv/core/templatetags/custom_date.py from datetime import date from django import template <|fim_m...
code_fim
easy
{ "lang": "python", "repo": "daGrevis/daGrevis.lv", "path": "/dagrevis_lv/core/templatetags/custom_date.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> register = template.Library() @register.filter def fake_date_without_day(value): """Fakes `date`. Sets day to `1`.""" return date(year=value[0], month=value[1], day=1)<|fim_prefix|># repo: daGrevis/daGrevis.lv path: /dagrevis_lv/core/templatetags/custom_date.py from datetime import date <|fim...
code_fim
easy
{ "lang": "python", "repo": "daGrevis/daGrevis.lv", "path": "/dagrevis_lv/core/templatetags/custom_date.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: daGrevis/daGrevis.lv path: /dagrevis_lv/core/templatetags/custom_date.py from datetime import date <|fim_suffix|>@register.filter def fake_date_without_day(value): """Fakes `date`. Sets day to `1`.""" return date(year=value[0], month=value[1], day=1)<|fim_middle|>from django import templ...
code_fim
medium
{ "lang": "python", "repo": "daGrevis/daGrevis.lv", "path": "/dagrevis_lv/core/templatetags/custom_date.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ url(r'^(?P<pk>\d+)/buy$', views.ShopPurchaseView.as_view(), name='buy'), url(r'^(?P<pk>\d+)$', views.ShopProdView.as_view(), name='prod'), url(r'^$', views.ShopProdView.as_view(), name='prod'), url(r'^inven/$', views.ShopInvenView.as_view(), name='inven'), url(r'^retrie...
code_fim
easy
{ "lang": "python", "repo": "PLUS-POSTECH/study.plus.or.kr", "path": "/src/shop/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PLUS-POSTECH/study.plus.or.kr path: /src/shop/urls.py from django.conf.urls import url from shop import views <|fim_suffix|>urlpatterns = [ url(r'^(?P<pk>\d+)/buy$', views.ShopPurchaseView.as_view(), name='buy'), url(r'^(?P<pk>\d+)$', views.ShopProdView.as_view(), name='prod'), url(...
code_fim
easy
{ "lang": "python", "repo": "PLUS-POSTECH/study.plus.or.kr", "path": "/src/shop/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_file_rename_pattern(self): return self.__data["file_rename_pattern"] if self.__data["file_rename_pattern"] else self.__default_data["file_rename_pattern"] def get_file_rename_string(self): return self.__data["file_rename_string"] if self.__data["file_rename_string"] else s...
code_fim
hard
{ "lang": "python", "repo": "chxzqw/imagescraper", "path": "/imagescraper/confyaml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.__data["file_rename_pattern"] if self.__data["file_rename_pattern"] else self.__default_data["file_rename_pattern"] def get_file_rename_string(self): return self.__data["file_rename_string"] if self.__data["file_rename_string"] else self.__default_data["file_rename_string"...
code_fim
hard
{ "lang": "python", "repo": "chxzqw/imagescraper", "path": "/imagescraper/confyaml.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chxzqw/imagescraper path: /imagescraper/confyaml.py #!/usr/bin/env python # -*- coding: utf-8 -*- import yaml class ConfYaml(object): def __init__(self, confname): with open('./etc/imagescraper.default.conf.yaml', 'r') as stream: try: self.__default_data...
code_fim
medium
{ "lang": "python", "repo": "chxzqw/imagescraper", "path": "/imagescraper/confyaml.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def handle_item(self, item): """Perform MLT-query on item""" sqs = SearchQuerySet().models(self.model) mlt_results = sqs.more_like_this(item) saved = [] for result in mlt_results: # type: SearchResult rel = self.model_relation(score=result.score) ...
code_fim
medium
{ "lang": "python", "repo": "openlegaldata/oldp", "path": "/oldp/apps/search/processing/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if options['limit'] > 0: items = items[:options['limit']] if options['empty']: self.model_relation.objects.all().delete() if len(items) < 1: logger.info('No content available') for item in items: self.handle_item(item) ...
code_fim
hard
{ "lang": "python", "repo": "openlegaldata/oldp", "path": "/oldp/apps/search/processing/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openlegaldata/oldp path: /oldp/apps/search/processing/__init__.py import logging from django.db.models.base import ModelBase from haystack.models import SearchResult from haystack.query import SearchQuerySet from oldp.apps.laws.models import Law logger = logging.getLogger(__name__) class Rel...
code_fim
hard
{ "lang": "python", "repo": "openlegaldata/oldp", "path": "/oldp/apps/search/processing/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': split_data( sentence_file, slot_file, sentence_training_file, sentence_developing_file, slot_training_file, slot_developing_file)<|fim_prefix|># repo: zuxfoucault/DoctorBot_demo path: /brain/brain_l...
code_fim
hard
{ "lang": "python", "repo": "zuxfoucault/DoctorBot_demo", "path": "/brain/brain_libs/tmp_slot_model/split_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zuxfoucault/DoctorBot_demo path: /brain/brain_libs/tmp_slot_model/split_data.py """Split data set into training and developing data Usage: python3 split_data.py Output: sentence_training.txt sentence_developing.txt slot_training.txt slot_developing.txt """ import random se...
code_fim
hard
{ "lang": "python", "repo": "zuxfoucault/DoctorBot_demo", "path": "/brain/brain_libs/tmp_slot_model/split_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def split_data( sentence_file, slot_file, sentence_training_file, sentence_developing_file, slot_training_file, slot_developing_file): sentence, slot, len_sentence = read_data(sentence_file, slot_file) num_dev = round(len_sentence/200) # Index fo...
code_fim
hard
{ "lang": "python", "repo": "zuxfoucault/DoctorBot_demo", "path": "/brain/brain_libs/tmp_slot_model/split_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mindis/retailhero-recomender-baseline path: /src/nn_models.py import torch from torch import nn class UserModel(nn.Module): <|fim_suffix|>class ItemModel(nn.Module): def __init__(self, num_products, embedding_dim): super(ItemModel, self).__init__() self._embeds = nn.Embeddin...
code_fim
hard
{ "lang": "python", "repo": "mindis/retailhero-recomender-baseline", "path": "/src/nn_models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, num_products, embedding_dim): super(ItemModel, self).__init__() self._embeds = nn.Embedding(num_products, embedding_dim) def forward(self, x): return self._embeds(x)<|fim_prefix|># repo: mindis/retailhero-recomender-baseline path: /src/nn_models.py impo...
code_fim
hard
{ "lang": "python", "repo": "mindis/retailhero-recomender-baseline", "path": "/src/nn_models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#testcase 2: #our_cache = LRU_Cache(-1) #our_cache.set(1, 1); #expected output: # invalid capacity # cache capacity error #testcase 3: #our_cache = LRU_Cache(0) #our_cache.set(1, 1); #expected output: # invalid capacity<|fim_prefix|># repo: arunpsg/Practice path: /LRU/LRU_Cache.py from collections imp...
code_fim
hard
{ "lang": "python", "repo": "arunpsg/Practice", "path": "/LRU/LRU_Cache.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: arunpsg/Practice path: /LRU/LRU_Cache.py from collections import OrderedDict class LRU_Cache(object): def __init__(self, capacity): # Initialize class variables if capacity < 0: print("invalid capacity") self.capacity = None return None ...
code_fim
hard
{ "lang": "python", "repo": "arunpsg/Practice", "path": "/LRU/LRU_Cache.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mingzailao/TFS-toolbox path: /tfs/dataset/cifar10.py from base import FileLists,DataSubset import numpy as np import os def unpickle(file): import cPickle fo = open(file, 'rb') dict = cPickle.load(fo) fo.close() return dict <|fim_suffix|> data = [] labels = [] for f in Fil...
code_fim
hard
{ "lang": "python", "repo": "mingzailao/TFS-toolbox", "path": "/tfs/dataset/cifar10.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = [] labels = [] for f in FileLists(filenames): batch=unpickle(f) data.append(batch['data']) labels.append(batch['labels']) data = np.concatenate(data) labels = np.concatenate(labels) data = data.reshape([-1,self.width,self.height,self.channels]) return D...
code_fim
hard
{ "lang": "python", "repo": "mingzailao/TFS-toolbox", "path": "/tfs/dataset/cifar10.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tsungchih/learning-gcp path: /gcp-bigtable/src/getrows.py #!/usr/bin/env python import argparse import models import time from google.cloud import bigtable from google.cloud import happybase from pydantic import BaseModel from typing import List def get_table_instance( project_id: str, in...
code_fim
hard
{ "lang": "python", "repo": "tsungchih/learning-gcp", "path": "/gcp-bigtable/src/getrows.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return row_model def get_rowkeys( table_instance, rowkeys: List[str], sep: str = "#", ) -> List[models.RowModelOdd]: """Query table with respect to given ``table_instance`` and ``rowkeys``. Given at least one element in `rowkeys`, this function queries the target table in Bigtable ...
code_fim
hard
{ "lang": "python", "repo": "tsungchih/learning-gcp", "path": "/gcp-bigtable/src/getrows.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mf.load("circularlike") with pytest.raises(RecursionError): mf.parse_args([])<|fim_prefix|># repo: sbrodehl/miniflask path: /tests/state/like_expressions/test_circular_definition.py from pathlib import Path import pytest import miniflask # noqa: E402 mf = miniflask.init( module_dir...
code_fim
easy
{ "lang": "python", "repo": "sbrodehl/miniflask", "path": "/tests/state/like_expressions/test_circular_definition.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sbrodehl/miniflask path: /tests/state/like_expressions/test_circular_definition.py from pathlib import Path import pytest import miniflask # noqa: E402 <|fim_suffix|> mf.load("circularlike") with pytest.raises(RecursionError): mf.parse_args([])<|fim_middle|>mf = miniflask.init( ...
code_fim
medium
{ "lang": "python", "repo": "sbrodehl/miniflask", "path": "/tests/state/like_expressions/test_circular_definition.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FCChinen/PPO path: /test.py import gym import numpy as np from ppo_torch import Agent from utils import plot_learning_curve from ppo_torch import ActorNetwork from newmaze import Maze if __name__ == '__main__': #env = gym.make('FrozenLake-v0', is_slippery=False ) env = Maze() N = 20 ...
code_fim
medium
{ "lang": "python", "repo": "FCChinen/PPO", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> observation = env.reset() done = False env.render() while not done: action, prob, val = agent.choose_action(observation) observation_, reward, done, info = env.step(action) env.render()<|fim_prefix|># repo: FCChinen/PPO path: /test.py import gym import numpy as np ...
code_fim
medium
{ "lang": "python", "repo": "FCChinen/PPO", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self, bucket_id, measurement_id, measurement_schema_update_request, **kwargs ): ... async def update_measurement_schema_async(self, bucket_id, measurement_id, measurement_schema_update_request, **kwargs): ...<|fim_prefix|># repo: facebook/pyre-check path: /stubs/typeshed/typeshed/stubs/in...
code_fim
hard
{ "lang": "python", "repo": "facebook/pyre-check", "path": "/stubs/typeshed/typeshed/stubs/influxdb-client/influxdb_client/service/bucket_schemas_service.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def get_measurement_schemas_async(self, bucket_id, **kwargs): ... def update_measurement_schema(self, bucket_id, measurement_id, measurement_schema_update_request, **kwargs): ... def update_measurement_schema_with_http_info( self, bucket_id, measurement_id, measurement_schema_upd...
code_fim
hard
{ "lang": "python", "repo": "facebook/pyre-check", "path": "/stubs/typeshed/typeshed/stubs/influxdb-client/influxdb_client/service/bucket_schemas_service.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: XanaduAI/thewalrus path: /thewalrus/quantum/fock_tensors.py choi_r is None: denom = np.sqrt(np.sqrt(np.linalg.det(Q).real)) else: rescaling = np.concatenate( [np.ones([N // 2]), (1.0 / np.tanh(choi_r)) * np.ones([N // 2])] ) ...
code_fim
hard
{ "lang": "python", "repo": "XanaduAI/thewalrus", "path": "/thewalrus/quantum/fock_tensors.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def update_probabilities_with_loss(etas, probs): """Given a list of transmissivities a tensor of probabilitites, calculate an updated tensor of probabilities after loss is applied. Args: etas (list): List of transmissitivities describing the loss in each of the modes probs (a...
code_fim
hard
{ "lang": "python", "repo": "XanaduAI/thewalrus", "path": "/thewalrus/quantum/fock_tensors.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return psi def density_matrix_element(mu, cov, i, j, include_prefactor=True, tol=1e-10, hbar=2): r"""Returns the :math:`\langle i | \rho | j \rangle` element of the density matrix of a Gaussian state defined by covariance matrix cov. Args: mu (array): length-:math:`2N` quadratur...
code_fim
hard
{ "lang": "python", "repo": "XanaduAI/thewalrus", "path": "/thewalrus/quantum/fock_tensors.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sergei-maertens/discord-bot path: /bot/plugins/reddit/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-02-13 16:10 from __future__ import unicode_literals <|fim_suffix|> initial = True dependencies = [ ] operations = [ migrations.Crea...
code_fim
medium
{ "lang": "python", "repo": "sergei-maertens/discord-bot", "path": "/bot/plugins/reddit/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='RedditCommand', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')...
code_fim
medium
{ "lang": "python", "repo": "sergei-maertens/discord-bot", "path": "/bot/plugins/reddit/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Katakhan/TrabalhosPython2 path: /Aula 37/Controller/linguagem_backend_controller.py import sys sys.path.append(r'C:\Users\900132\Desktop\GitHub\TrabalhosPython2\Aula 37') from Dao.linguagem_backend_dao import BackDao from Model.linguagem_backend import LinguagemBackend <|fim_suffix|> self...
code_fim
hard
{ "lang": "python", "repo": "Katakhan/TrabalhosPython2", "path": "/Aula 37/Controller/linguagem_backend_controller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def alterar(self, linguagemBackend:LinguagemBackend): self.dao.alterar(linguagemBackend) def deletar(self, id): self.dao.deletar(id)<|fim_prefix|># repo: Katakhan/TrabalhosPython2 path: /Aula 37/Controller/linguagem_backend_controller.py import sys sys.path.append(r'C:\Users\9001...
code_fim
medium
{ "lang": "python", "repo": "Katakhan/TrabalhosPython2", "path": "/Aula 37/Controller/linguagem_backend_controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StellarCN/py-stellar-base path: /tests/operation/test_bump_sequence.py import pytest from stellar_sdk import BumpSequence, Operation from . import * class TestBumpSequence: @pytest.mark.parametrize( "bump_to, source, xdr", [ pytest.param( 123456...
code_fim
hard
{ "lang": "python", "repo": "StellarCN/py-stellar-base", "path": "/tests/operation/test_bump_sequence.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pytest.param( 1234567890, muxed1.account_muxed, "AAAAAQAAAQAAAAAAAAAAAWJfPVnD+J5ZGgbaXgjF1uS98NFQOrnDIoFJSesJHl2hAAAACwAAAABJlgLS", id="with_source_muxed_account_strkey", ), pytest.param( 0, ...
code_fim
hard
{ "lang": "python", "repo": "StellarCN/py-stellar-base", "path": "/tests/operation/test_bump_sequence.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexeyDonskikh/petselection path: /api/urls.py from django.urls import include, path from rest_framework.routers import DefaultRouter from api.views import (BreedViewSet, CommentViewSet, GroupViewSet, PetViewSet, PostViewSet, SpeciesViewSet, UserCodeViewSet, ...
code_fim
medium
{ "lang": "python", "repo": "AlexeyDonskikh/petselection", "path": "/api/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ path('v1/auth/', include(auth_urlpatterns)), path('v1/', include(router.urls)), ]<|fim_prefix|># repo: AlexeyDonskikh/petselection path: /api/urls.py from django.urls import include, path from rest_framework.routers import DefaultRouter from api.views import (BreedViewSet, Commen...
code_fim
hard
{ "lang": "python", "repo": "AlexeyDonskikh/petselection", "path": "/api/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> urlpatterns = [ path('v1/auth/', include(auth_urlpatterns)), path('v1/', include(router.urls)), ]<|fim_prefix|># repo: AlexeyDonskikh/petselection path: /api/urls.py from django.urls import include, path from rest_framework.routers import DefaultRouter from api.views import (BreedViewSet, Comme...
code_fim
medium
{ "lang": "python", "repo": "AlexeyDonskikh/petselection", "path": "/api/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bakfu/bakfu path: /bakfu/data/save.py # -*- coding: utf-8 -*- ''' Save/load system ==================== Usage : To save a chain to a pickle file : :: baf.process('pickle.save','file.pkl') To load from a file : :: baf = Chain().load('pickle.load','file.pkl') .. automodule:: .. ...
code_fim
hard
{ "lang": "python", "repo": "bakfu/bakfu", "path": "/bakfu/data/save.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> with open(self.save_path,"wb") as f: pickle.dump(save.data,f) return self @register('pickle.load') class PickleLoader(BaseDataSource): ''' Load chain from a pickle file. baf.data('pickle.load','file.pkl') ''' def __init__(self, *args, **kwargs): ...
code_fim
hard
{ "lang": "python", "repo": "bakfu/bakfu", "path": "/bakfu/data/save.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def create_stamped_temp(*args): return create_temp_dir(*args, get_stamp())<|fim_prefix|># repo: protivinsky/python-utils path: /libs/utils.py import os import tempfile from datetime import datetime os.environ['TEMP'] = 'D:/temp' def logger(msg): print('{} -- {}'.format(datetime.no...
code_fim
medium
{ "lang": "python", "repo": "protivinsky/python-utils", "path": "/libs/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: protivinsky/python-utils path: /libs/utils.py import os import tempfile from datetime import datetime <|fim_suffix|> return datetime.now().strftime('%Y-%m-%d_%H-%M-%S') def create_temp_dir(*args): tempdir = tempfile.gettempdir() path = os.path.join(tempdir, *args) os...
code_fim
medium
{ "lang": "python", "repo": "protivinsky/python-utils", "path": "/libs/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def create_stamped_temp(*args): return create_temp_dir(*args, get_stamp())<|fim_prefix|># repo: protivinsky/python-utils path: /libs/utils.py import os import tempfile from datetime import datetime os.environ['TEMP'] = 'D:/temp' def logger(msg): print('{} -- {}'.format(datetime.now(...
code_fim
hard
{ "lang": "python", "repo": "protivinsky/python-utils", "path": "/libs/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.responses_test([C], [C, D, D, D], [C, C, C, C], attrs={"state": "Nice"}, init_kwargs={"grumpy_threshold": 3, "nice_threshold": 0}) self.responses_test([D], [C, C, D, D, D], [D, D, D, D, D]...
code_fim
hard
{ "lang": "python", "repo": "bstarling/Axelrod", "path": "/axelrod/tests/strategies/test_grumpy.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bstarling/Axelrod path: /axelrod/tests/strategies/test_grumpy.py """Tests for the Grumpy strategy.""" import axelrod from .test_player import TestPlayer C, D = axelrod.Actions.C, axelrod.Actions.D class TestGrumpy(TestPlayer): name = "Grumpy" player = axelrod.Grumpy expected_clas...
code_fim
hard
{ "lang": "python", "repo": "bstarling/Axelrod", "path": "/axelrod/tests/strategies/test_grumpy.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tommccoy1/tommccoy1.github.io path: /metaug_js/load_data.py # Scripts for loading data from saved text files from random import shuffle # Load a list of abstract language descriptors def load_languages(language_file): fi = open(language_file, "r") lang_list = [] for line in fi: ...
code_fim
hard
{ "lang": "python", "repo": "tommccoy1/tommccoy1.github.io", "path": "/metaug_js/load_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Load a language that is just Cs and Vs def load_dataset_cv(dataset_file): fi = open(dataset_file, "r") langs = [] for line in fi: parts = line.strip().split("\t") train_set = [elt.split(",") for elt in parts[0].split()] test_set = [elt.split(",") for elt in ...
code_fim
hard
{ "lang": "python", "repo": "tommccoy1/tommccoy1.github.io", "path": "/metaug_js/load_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Load a language that is just Cs and Vs def load_dataset_cv(dataset_file): fi = open(dataset_file, "r") langs = [] for line in fi: parts = line.strip().split("\t") train_set = [elt.split(",") for elt in parts[0].split()] test_set = [elt.split(",") for elt in...
code_fim
hard
{ "lang": "python", "repo": "tommccoy1/tommccoy1.github.io", "path": "/metaug_js/load_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: intrustd/py-intrustd path: /intrustd/appliance.py import requests from urllib.parse import urljoin def get_appliance_identity(app_endpoint='http://admin.intrustd.com.app.local'): <|fim_suffix|> if r.status_code == 200: return r.json() elif r.status_code == 404: raise NotIm...
code_fim
medium
{ "lang": "python", "repo": "intrustd/py-intrustd", "path": "/intrustd/appliance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if r.status_code == 200: return r.json() elif r.status_code == 404: raise NotImplemented() elif r.status_code == 403: raise Unauthorized() else: raise RuntimeError("Unknown status code while attempting to get public key: {}".format(r.status_code))<|fim_prefi...
code_fim
medium
{ "lang": "python", "repo": "intrustd/py-intrustd", "path": "/intrustd/appliance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: moshthepitt/small-small-hr path: /small_small_hr/migrations/0010_auto_20200626_1313.py # Generated by Django 3.0.7 on 2020-06-26 10:13 # pylint: disable=invalid-name,missing-module-docstring,missing-class-docstring import django.db.models.deletion from django.db import migrations import mptt.fie...
code_fim
medium
{ "lang": "python", "repo": "moshthepitt/small-small-hr", "path": "/small_small_hr/migrations/0010_auto_20200626_1313.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name="staffprofile", name="supervisor", field=mptt.fields.TreeForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_...
code_fim
medium
{ "lang": "python", "repo": "moshthepitt/small-small-hr", "path": "/small_small_hr/migrations/0010_auto_20200626_1313.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ("small_small_hr", "0009_auto_20200607_2244"), ] operations = [ migrations.AlterField( model_name="staffprofile", name="supervisor", field=mptt.fields.TreeForeignKey( blank=True, null=True, ...
code_fim
medium
{ "lang": "python", "repo": "moshthepitt/small-small-hr", "path": "/small_small_hr/migrations/0010_auto_20200626_1313.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vector35/binaryninja-api path: /python/examples/debug_info.py #!/usr/bin/env python3 # If you're here, you're likely looking for boilerplate code. Here it is: # ``` # import binaryninja as bn # # def is_valid(bv: bn.binaryview.BinaryView): # return bv.view_type == "Raw" # # def parse_info(deb...
code_fim
hard
{ "lang": "python", "repo": "Vector35/binaryninja-api", "path": "/python/examples/debug_info.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Adding functions") char_star = bv.parse_type_string("char*")[0] pretty_print_add_function(debug_info, 0x1129, "no_return_type_no_parameters", None, None, bn.types.Type.void(), None) pretty_print_add_function( debug_info, 0x1134, "used_parameter", None, None, bn.types.Type.bool(), [("value", ...
code_fim
hard
{ "lang": "python", "repo": "Vector35/binaryninja-api", "path": "/python/examples/debug_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> char b[4]; uint64_t c; bool d; }; struct test_type_2 { struct test_type_1 a; struct test_type_1* b; struct test_type_2* c; };""" ).types.items(): print(f" Adding type \"{name}\" `{t}` : {debug_info.add_type(str(name), t)}") types.append(t) print("Adding data variable...
code_fim
hard
{ "lang": "python", "repo": "Vector35/binaryninja-api", "path": "/python/examples/debug_info.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: elinesterov/browser-csp-compatibility path: /utils/page_model.py import time from urlparse import urlparse from selenium.common.exceptions import TimeoutException from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from selenium.webdriver...
code_fim
hard
{ "lang": "python", "repo": "elinesterov/browser-csp-compatibility", "path": "/utils/page_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class TestResultPage(BasePage): """ Test result page object model for js tests """ def __init__(self, *args, **kwargs): super(TestResultPage, self).__init__(*args, **kwargs) self.results_id = 'result' def get_test_results(self): """ Method to get test ...
code_fim
hard
{ "lang": "python", "repo": "elinesterov/browser-csp-compatibility", "path": "/utils/page_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :return: The epid of this Product. # noqa: E501 :rtype: str """ return self._epid @epid.setter def epid(self, epid): """Sets the epid of this Product. An EPID is the eBay product identifier of a product from the eBay product catalog. Note: If you ...
code_fim
hard
{ "lang": "python", "repo": "craiga/ebay_rest", "path": "/src/ebay_rest/api/sell_listing/models/product.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: craiga/ebay_rest path: /src/ebay_rest/api/sell_listing/models/product.py # coding: utf-8 """ Listing API <span class=\"tablenote\"><b>Note:</b> This is a <a href=\"https://developer.ebay.com/api-docs/static/versioning.html#limited\" target=\"_blank\"> <img src=\"/cms/img/docs/partners-a...
code_fim
hard
{ "lang": "python", "repo": "craiga/ebay_rest", "path": "/src/ebay_rest/api/sell_listing/models/product.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Natasja1992/ifc-citygml-2-envi path: /conversion_tool/main.py from conversionTool import ConversionTool from emlWriter import EmlWriter import argparse def main(): ################################################################################################################### ...
code_fim
hard
{ "lang": "python", "repo": "Natasja1992/ifc-citygml-2-envi", "path": "/conversion_tool/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ################################################################################################################### conversion_tool = ConversionTool(args.ifc, args.citygml, variables) eml_writer = EmlWriter(conversion_tool) eml_writer.write(args.output) if __name__ == '__main__':...
code_fim
hard
{ "lang": "python", "repo": "Natasja1992/ifc-citygml-2-envi", "path": "/conversion_tool/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while z > target: await car.set_steering(45.0) await car.set_throttle(min_throttle) _, _, z = await gyro.read() target = z_start + 90 _, _, z = await gyro.read() while z < target: await car.set_steering(45.0) awa...
code_fim
hard
{ "lang": "python", "repo": "MasterAI-Inc/libauto", "path": "/auto/resources/bin/calibrate_car_v1", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: await car.set_steering(0.0) _ = await _prompt(console, buttons, [1], CAR_MOTORS_FORWARD_REVERSE_DIRS) await car.set_steering(0.0) await car.set_throttle(max_throttle) await asyncio.sleep(1) await car.set_throttle(min_throttle) await a...
code_fim
hard
{ "lang": "python", "repo": "MasterAI-Inc/libauto", "path": "/auto/resources/bin/calibrate_car_v1", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MasterAI-Inc/libauto path: /auto/resources/bin/calibrate_car_v1 #!/usr/bin/env python3 ############################################################################### # # Copyright (c) 2017-2020 Master AI, Inc. # ALL RIGHTS RESERVED # # Use of this library, in source or binary form, is prohibite...
code_fim
hard
{ "lang": "python", "repo": "MasterAI-Inc/libauto", "path": "/auto/resources/bin/calibrate_car_v1", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def foo(): print(123) time.sleep(1) print("end123") def bar(): print(456) time.sleep(3) print("end456") if __name__ == '__main__': t1=Thread(target=foo) t2=Thread(target=bar) t1.daemon=True t1.start() t2.start() print("main-------") ''' 123 ...
code_fim
medium
{ "lang": "python", "repo": "Strugglingrookie/oldboy2", "path": "/courseware/4第四模块/第四模块课件/01网络编程进阶/02 多线程/04 守护线程.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Strugglingrookie/oldboy2 path: /courseware/4第四模块/第四模块课件/01网络编程进阶/02 多线程/04 守护线程.py # from threading import Thread # import time # # def sayhi(name): # time.sleep(2) # print('%s say hello' %name) # # if __name__ == '__main__': # t=Thread(target=sayhi,args=('egon',)) # # t.setDaemon...
code_fim
medium
{ "lang": "python", "repo": "Strugglingrookie/oldboy2", "path": "/courseware/4第四模块/第四模块课件/01网络编程进阶/02 多线程/04 守护线程.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> t1.daemon=True t1.start() t2.start() print("main-------") ''' 123 456 main------- end123 end456 '''<|fim_prefix|># repo: Strugglingrookie/oldboy2 path: /courseware/4第四模块/第四模块课件/01网络编程进阶/02 多线程/04 守护线程.py # from threading import Thread # import time # # d...
code_fim
medium
{ "lang": "python", "repo": "Strugglingrookie/oldboy2", "path": "/courseware/4第四模块/第四模块课件/01网络编程进阶/02 多线程/04 守护线程.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>sando na sua rua') escreva('ligue carlinha telegás e peça ja o seu') escreva('3541-1096... 3541-1096')<|fim_prefix|># repo: maurovasconcelos/Ola-Mundo path: /Python/ex097.py def escreva(msg): tam = len(msg) + 4 #o tamanho do ~ é igual o len/tamanho da mensagem, caralh<|fim_middle|>o... print('...
code_fim
hard
{ "lang": "python", "repo": "maurovasconcelos/Ola-Mundo", "path": "/Python/ex097.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maurovasconcelos/Ola-Mundo path: /Python/ex097.py def escreva(msg): tam = len(msg) + 4 #o tamanho do ~ é igual o len/tamanho da mensagem, caralh<|fim_suffix|>sando na sua rua') escreva('ligue carlinha telegás e peça ja o seu') escreva('3541-1096... 3541-1096')<|fim_middle|>o... print('...
code_fim
hard
{ "lang": "python", "repo": "maurovasconcelos/Ola-Mundo", "path": "/Python/ex097.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shureby/SpiderUtilLib path: /src/SpiderUtilLib/SpiderUtilLib.py _success': False, 'status_code': request.status_code, 'error_message': What is wrong message} to tell you download failed and help you to identify what is wrong """ __file_url = url __params = {} def get_url_params(url)...
code_fim
hard
{ "lang": "python", "repo": "Shureby/SpiderUtilLib", "path": "/src/SpiderUtilLib/SpiderUtilLib.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shureby/SpiderUtilLib path: /src/SpiderUtilLib/SpiderUtilLib.py character += '0000' elif c_length == 2: character += '01' + '0' * 6 characterToAppend = BASE64MAP[int(character, base=2)] if characterToAppend == '=' and base64_encoding_map == 'RFC3501': characterToAppend...
code_fim
hard
{ "lang": "python", "repo": "Shureby/SpiderUtilLib", "path": "/src/SpiderUtilLib/SpiderUtilLib.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> lines_separator=None, keep_lines_separator=True): if lines_separator is None: lines_separator = (b'\r', b'\n', b'\r\n') lines_splitter = methodcaller(str.splitlines.__name__, keep_lines_separator) else: lines_splitter = functools.partial(split, ...
code_fim
hard
{ "lang": "python", "repo": "Shureby/SpiderUtilLib", "path": "/src/SpiderUtilLib/SpiderUtilLib.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: popcornell/lhotse path: /lhotse/bin/modes/recipes/peoples_speech.py import click from lhotse.bin.modes import prepare from lhotse.recipes.peoples_speech import prepare_peoples_speech from lhotse.utils import Pathlike <|fim_suffix|> corpus_dir: Pathlike, output_dir: Pathlike, ): """Pr...
code_fim
hard
{ "lang": "python", "repo": "popcornell/lhotse", "path": "/lhotse/bin/modes/recipes/peoples_speech.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> corpus_dir: Pathlike, output_dir: Pathlike, ): """Prepare The People's Speech corpus manifests.""" prepare_peoples_speech( corpus_dir, output_dir=output_dir, )<|fim_prefix|># repo: popcornell/lhotse path: /lhotse/bin/modes/recipes/peoples_speech.py import click from l...
code_fim
hard
{ "lang": "python", "repo": "popcornell/lhotse", "path": "/lhotse/bin/modes/recipes/peoples_speech.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>icUnsignedLongEnumeration4, NistschemaSvIvAtomicUnsignedLongEnumeration4Type, ) __all__ = [ "NistschemaSvIvAtomicUnsignedLongEnumeration4", "NistschemaSvIvAtomicUnsignedLongEnumeration4Type", ]<|fim_prefix|># repo: tefra/xsdata-w3c-tests path: /output/models/nist_data/atomic/unsigned_long/sc...
code_fim
medium
{ "lang": "python", "repo": "tefra/xsdata-w3c-tests", "path": "/output/models/nist_data/atomic/unsigned_long/schema_instance/nistschema_sv_iv_atomic_unsigned_long_enumeration_4_xsd/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kingking888/ip_proxy_pool path: /scheduler.py # -*- coding: utf-8 -*- # @Author: lzc # @Time : 2019/9/9 import os from datetime import datetime, timedelta from apscheduler.schedulers.blocking import BlockingScheduler from rm_log import rm_log project_path = os.path.abspath('.') server_path = o...
code_fim
medium
{ "lang": "python", "repo": "kingking888/ip_proxy_pool", "path": "/scheduler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sched = BlockingScheduler() sched.add_job(enable_server, name='Django server') sched.add_job(enable_crawl_spider, 'interval', hours=4, next_run_time=datetime.now() + timedelta(seconds=10), name='定时代理爬取') sched.add_job(enable_verify_spider, 'interval', hours=2, name='定时代理有效性验证') sched.add_job...
code_fim
medium
{ "lang": "python", "repo": "kingking888/ip_proxy_pool", "path": "/scheduler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: spacemanspiff2007/HABApp path: /tests/helpers/inspect/habapp.py import importlib import pkgutil from dataclasses import dataclass from inspect import getmembers from types import ModuleType from typing import List, Any, Iterable, Optional, Tuple, Type import HABApp <|fim_suffix|> @dataclass cl...
code_fim
hard
{ "lang": "python", "repo": "spacemanspiff2007/HABApp", "path": "/tests/helpers/inspect/habapp.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert objs or instances predicates = [] if objs: def is_obj(x): for obj in objs: if obj is x: return True return False predicates.append(is_obj) if instances: predicates.append(lambda x: isinstance(x, in...
code_fim
hard
{ "lang": "python", "repo": "spacemanspiff2007/HABApp", "path": "/tests/helpers/inspect/habapp.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@dataclass class FoundObj: module_name: str obj: Any def find_in_modules(objs: Optional[Iterable[Any]] = None, instances: Optional[Tuple[Type[object], ...]] = None): assert objs or instances predicates = [] if objs: def is_obj(x): for obj in ...
code_fim
hard
{ "lang": "python", "repo": "spacemanspiff2007/HABApp", "path": "/tests/helpers/inspect/habapp.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>2. @register("OP") class XXX 3. @register(a = 3) class XXX ''' def register(op_name=None, **attrs): def decorator(op_name, op): if op_name is None: op_name = op.__name__ op_inst = MobulaOperator(op=op, name=op_name, **attrs) assert op_name not in CUSTOM_OP_L...
code_fim
hard
{ "lang": "python", "repo": "mgno32/MobulaOP", "path": "/mobula/glue/common.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mgno32/MobulaOP path: /mobula/glue/common.py import sys import pickle import inspect import base64 import ctypes import functools def pars_encode(x): return base64.b64encode(pickle.dumps(x)).decode('utf-8') def pars_decode(x): return pickle.loads(base64.b64decode(x.encode('utf-8'))) if sys....
code_fim
hard
{ "lang": "python", "repo": "mgno32/MobulaOP", "path": "/mobula/glue/common.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, op, name, **attrs): self.op = op self.name = name self.attrs = attrs def __call__(self, *args, **kwargs): b = backend.get_args_backend(*args, **kwargs) assert b is not None, ValueError('No explict backend') new_kwargs = kwargs.cop...
code_fim
hard
{ "lang": "python", "repo": "mgno32/MobulaOP", "path": "/mobula/glue/common.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("DISTANCE FROM INPUT TREASURY NOTE : " ,round(close_distances[i][0],5), sep=" ") # KOMŞU BANKNOTUN UZAKLIĞINI YAZDIRDIK.( BUNUN İÇİN CLOSE_DISTANCES LİSTESİNE ERİŞTİK) print("----------------------------------------------------------------------------") for i in range(k_value): if dat...
code_fim
hard
{ "lang": "python", "repo": "eberkeaydin/kNN-algorithm-for-treasury-note-checking", "path": "/codes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: eberkeaydin/kNN-algorithm-for-treasury-note-checking path: /codes.py import math print("************ TREASURY NOTE TESTER PROGRAM WITH USING TREASURY ATTRIBUTE DATA SET AND INPUT NOTE ATTRIBUTES ***********") k_value = int(input("Enter the 'k' value for kNN Method : ")) variant = float(input("E...
code_fim
hard
{ "lang": "python", "repo": "eberkeaydin/kNN-algorithm-for-treasury-note-checking", "path": "/codes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if 'heuristic' in self._conf_attributes: heur_func_name = self._conf_attributes['heuristic'] if self._heuristics and heur_func_name in self._heuristics: ref_heur_function = self._heuristics[heur_func_name] ...
code_fim
hard
{ "lang": "python", "repo": "aleSuglia/YAIEP", "path": "/yaiep/core/InferenceEngine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return "{0}\nRULE LIST: {1}\nAGENDA: {2}\nGOAL STATE: {3}".format(str(self._wm), str(self._list_rules), str(self._agenda), ...
code_fim
hard
{ "lang": "python", "repo": "aleSuglia/YAIEP", "path": "/yaiep/core/InferenceEngine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: aleSuglia/YAIEP path: /yaiep/core/InferenceEngine.py euristiche # per il problema corrente ed inoltre permette di caricare tutte le configurazioni # iniziali per poter scegliere alcune logiche specifiche del motore inferenziale # # @param conf_filename nome del file di configu...
code_fim
hard
{ "lang": "python", "repo": "aleSuglia/YAIEP", "path": "/yaiep/core/InferenceEngine.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dlong96/DS-Unit-3-Sprint-2-SQL-and-Databases path: /module1-introduction-to-sql/P2buddymove_holidayiq.py import sqlite3 import pandas df= pd.read_csv(buddymove_holidayiq.csv) <|fim_suffix|> query= 'SELECT * FROM df;' connection = sqlite3.connect(buddymove_holidayiq.sqlite3) curs...
code_fim
easy
{ "lang": "python", "repo": "dlong96/DS-Unit-3-Sprint-2-SQL-and-Databases", "path": "/module1-introduction-to-sql/P2buddymove_holidayiq.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> query= 'SELECT * FROM df;' connection = sqlite3.connect(buddymove_holidayiq.sqlite3) cursor = connection.cursor() cursor.execute(query) results = cursor.fetchall() cursor.close() connection.close() return results<|fim_prefix|># repo: dlong96/DS-Unit-3-Sprint-2-SQL...
code_fim
easy
{ "lang": "python", "repo": "dlong96/DS-Unit-3-Sprint-2-SQL-and-Databases", "path": "/module1-introduction-to-sql/P2buddymove_holidayiq.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyMrak/pyPPM path: /pyPPM.py # -*- coding: utf-8 -*- """ Created on Fri Oct 25 19:32:25 2019 @author: pyMrak """ from sounddevice import OutputStream from numpy import array, ones, zeros class PPMgenerator(object): LOW_DUR = 0.5 #low pulse duration (in milliseconds) ...
code_fim
hard
{ "lang": "python", "repo": "pyMrak/pyPPM", "path": "/pyPPM.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # self.callback_status = sd.CallbackFlags() self.multiplier = self.outputFreq/1e3 self.zeroPulse = int(self.LOW_DUR*self.multiplier) self.blockSize = int(self.PCK_DUR*self.multiplier) if RCchannelsUsed > self.MAX_CH: self.RCchUsed...
code_fim
medium
{ "lang": "python", "repo": "pyMrak/pyPPM", "path": "/pyPPM.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }