text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: SherbyRobotics/pyro path: /examples/demos_by_system/mass_spring_damper/three_mass_dynamic.py # -*- coding: utf-8 -*- """ Created on Jun 2 2021 @author: Alex """ from pyro.dynamic import massspringdamper sys = massspringdamper.ThreeMass() <|fim_suffix|>sys.x0[2] = 1 sys.plot_trajectory() sys...
code_fim
easy
{ "lang": "python", "repo": "SherbyRobotics/pyro", "path": "/examples/demos_by_system/mass_spring_damper/three_mass_dynamic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Arguments inputs (tensor): input tensor from input image or previous layer num_filters (int): Conv2D number of filters kernel_size (int): Conv2D square kernel dimensions strides (int): Conv2D square stride dimensions activation (string): activation name ...
code_fim
hard
{ "lang": "python", "repo": "naykun/MusicResearch", "path": "/Music_Text_Generation/convupsample.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: naykun/MusicResearch path: /Music_Text_Generation/convupsample.py from __future__ import print_function from keras.callbacks import LambdaCallback from keras.models import Sequential,Model from keras.layers import Dense, Activation, LSTM, Input, \ Reshape, MaxPooling1D, Conv1D, Dropout,Global...
code_fim
hard
{ "lang": "python", "repo": "naykun/MusicResearch", "path": "/Music_Text_Generation/convupsample.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def resnet_v1(input_shape, depth, num_classes=10,input_tensor=None): """ResNet Version 1 Model builder [a] Stacks of 2 x (3 x 3) Conv2D-BN-ReLU Last ReLU is after the shortcut connection. At the beginning of each stage, the feature map size is halved (downsampled) by a convolutional l...
code_fim
hard
{ "lang": "python", "repo": "naykun/MusicResearch", "path": "/Music_Text_Generation/convupsample.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vsidera/V-Projects path: /projapp/forms.py from django import forms from .models import Post , Rating <|fim_suffix|>class ratingForm(forms.ModelForm): class Meta: model = Rating fields = ['interface', 'experience', 'content']<|fim_middle|>class uploadForm(forms.ModelForm): ...
code_fim
medium
{ "lang": "python", "repo": "vsidera/V-Projects", "path": "/projapp/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Rating fields = ['interface', 'experience', 'content']<|fim_prefix|># repo: vsidera/V-Projects path: /projapp/forms.py from django import forms from .models import Post , Rating class uploadForm(forms.ModelForm): <|fim_middle|> class Meta: model = Post exclude ...
code_fim
medium
{ "lang": "python", "repo": "vsidera/V-Projects", "path": "/projapp/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cahya-wirawan/opentc path: /contrib/icap-server/icap-server-opentc.py #!/bin/env python # -*- coding: utf8 -*- import argparse import json import logging.config import os import re import socketserver import tempfile import traceback import magic import multipart import textract import yaml fro...
code_fim
hard
{ "lang": "python", "repo": "cahya-wirawan/opentc", "path": "/contrib/icap-server/icap-server-opentc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: response = self.server.opentc["client"].command("PING\n") response = json.loads(response.decode('utf-8')) self.logger.debug("REQMOD Ping response: {}".format(response)) except Exception as err: self.logger.error(traceback.format_exc()) ...
code_fim
hard
{ "lang": "python", "repo": "cahya-wirawan/opentc", "path": "/contrib/icap-server/icap-server-opentc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Copy the request body (in case of a POST for example) if not self.has_body: self.set_enc_request(b' '.join(self.enc_req)) self.send_headers(False) return if self.preview: prevbuf = b'' while True: chunk =...
code_fim
hard
{ "lang": "python", "repo": "cahya-wirawan/opentc", "path": "/contrib/icap-server/icap-server-opentc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joelimome/Kestrel path: /kestrel/backend.py ############## class RosterBackend(object): def __init__(self, backend): self.backend = backend self.db = self.backend.db self.query = self.backend.query # --------------------------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "joelimome/Kestrel", "path": "/kestrel/backend.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return self.query(self._unsubscribe, (owner, jid)) def _unsubscribe(self, owner, jid): entry = RosterItem(owner, jid) entry.unsubscribe() self.db.merge(entry) self.db.commit() # ------------------------------------------------------------------ def un...
code_fim
hard
{ "lang": "python", "repo": "joelimome/Kestrel", "path": "/kestrel/backend.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> worker = self.db.query(Worker).filter_by(jid=worker_jid).one() caps = '%'+worker.capabilities.replace(' ', '%') + '%' where = and_(or_(Job.status=='queued', Job.status=='running'), Worker.capabilities.like(Job.requirements), ...
code_fim
hard
{ "lang": "python", "repo": "joelimome/Kestrel", "path": "/kestrel/backend.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: David082/daguan_competition_2021_codes path: /src/classic_models/modules/self_attn_pool.py # -*- coding: utf-8 -*- import torch # from allennlp.nn import util from torch import nn from src.classic_models.utils.model_utils import masked_softmax, weighted_sum class SelfAttnAggregator(nn.Module...
code_fim
hard
{ "lang": "python", "repo": "David082/daguan_competition_2021_codes", "path": "/src/classic_models/modules/self_attn_pool.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, input_tensors: torch.Tensor, mask: torch.Tensor): # pylint: disable=arguments-differ """ Parameters ---------- input_tensors : (batch_size, num_tokens, input_dim). mask : sentence mask, (batch_size, num_tokens). Returns -------...
code_fim
hard
{ "lang": "python", "repo": "David082/daguan_competition_2021_codes", "path": "/src/classic_models/modules/self_attn_pool.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if keypair is not None: raise cherrypy.HTTPError(409, "A keypair with the requested name already exists.") keypair = Keypair() keypair.name = request.name keypair.public_key = request.public_key keypair.project_id = project.id ...
code_fim
hard
{ "lang": "python", "repo": "sandwichcloud/deli-counter", "path": "/deli_counter/http/mounts/root/routes/v1/keypairs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @Route(route='{keypair_id}', methods=[RequestMethods.DELETE]) @cherrypy.tools.project_scope() @cherrypy.tools.model_params(cls=ParamsKeypair) @cherrypy.tools.resource_object(id_param="keypair_id", cls=Keypair) @cherrypy.tools.enforce_policy(policy_name="keypairs:delete") def delete...
code_fim
hard
{ "lang": "python", "repo": "sandwichcloud/deli-counter", "path": "/deli_counter/http/mounts/root/routes/v1/keypairs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sandwichcloud/deli-counter path: /deli_counter/http/mounts/root/routes/v1/keypairs.py import uuid import cherrypy from sqlalchemy.orm import Query from deli_counter.http.mounts.root.routes.v1.validation_models.keypairs import RequestCreateKeypair, \ ParamsListKeypair, ParamsKeypair, Respons...
code_fim
hard
{ "lang": "python", "repo": "sandwichcloud/deli-counter", "path": "/deli_counter/http/mounts/root/routes/v1/keypairs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenUpSA/umibukela path: /umibukela/migrations/0029_auto_20170226_0745.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import umibukela.models class Migration(migrations.Migration): dependencies = [ ('umibukela', '0028_cy...
code_fim
hard
{ "lang": "python", "repo": "OpenUpSA/umibukela", "path": "/umibukela/migrations/0029_auto_20170226_0745.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ), migrations.AlterField( model_name='cycleresultset', name='cycle', field=models.ForeignKey(related_name='cycle_result_sets', to='umibukela.Cycle'), ), migrations.AlterField( model_name='cycleresultset', name='survey'...
code_fim
hard
{ "lang": "python", "repo": "OpenUpSA/umibukela", "path": "/umibukela/migrations/0029_auto_20170226_0745.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param output_npz: Path to output file.npz * Items: ['ids'] int (n, ) ['sents'] str (n, ) ['embs'] float32 (n, 512) :param batch_size: N sent yielded by batch_generator :param m...
code_fim
hard
{ "lang": "python", "repo": "Ljferrer/SimSent", "path": "/SimSent/vectorizer/sentence_vectorizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ljferrer/SimSent path: /SimSent/vectorizer/sentence_vectorizer.py import gc import os import os.path as p import json import requests from pathlib import Path from typing import List, Tuple, Union import numpy as np import tensorflow as tf import tensorflow_hub as hub from .base_vectorizer impor...
code_fim
hard
{ "lang": "python", "repo": "Ljferrer/SimSent", "path": "/SimSent/vectorizer/sentence_vectorizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> minibatch_size: int = 128) -> EMB_BATCH: """ High throughput, GPU-friendly vectorization """ embeddings = list() batched_tensors = list() with self.graph.as_default(): # High throughput vectorization (fast) if len(sents) > minib...
code_fim
hard
{ "lang": "python", "repo": "Ljferrer/SimSent", "path": "/SimSent/vectorizer/sentence_vectorizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openvinotoolkit/nncf path: /nncf/experimental/torch/nas/bootstrapNAS/search/supernet.py # Copyright (c) 2023 Intel Corporation # 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 Licens...
code_fim
hard
{ "lang": "python", "repo": "openvinotoolkit/nncf", "path": "/nncf/experimental/torch/nas/bootstrapNAS/search/supernet.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_search_space(self) -> Dict: """ :return: dictionary with possible values for elastic configurations. """ return self._m_handler.get_search_space() def get_design_vars_info(self) -> Tuple[int, List[int]]: """ :return: number of possible value...
code_fim
hard
{ "lang": "python", "repo": "openvinotoolkit/nncf", "path": "/nncf/experimental/torch/nas/bootstrapNAS/search/supernet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ :param config: subnetwork configuration. :param eval_fn: user's function to evaluate the active subnetwork. :return: value of the user's function used to evaluate the subnetwork. """ self.activate_config(config) return self.eval_active_subnet(eva...
code_fim
hard
{ "lang": "python", "repo": "openvinotoolkit/nncf", "path": "/nncf/experimental/torch/nas/bootstrapNAS/search/supernet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> You can specify the number of points to output. """ c_closeness = nx.closeness_centrality(graph) c_closeness = heapq.nlargest(numberOfPoints, list(c_closeness.values())) return c_closeness def harmonicCentrality(graph, numberOfPoints): """Compute the largest harmonic centralities...
code_fim
hard
{ "lang": "python", "repo": "manoskary/Topological-Descriptors-for-Symbolic-Music-Genre-Classification", "path": "/NetworkX_GraphTranslation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: manoskary/Topological-Descriptors-for-Symbolic-Music-Genre-Classification path: /NetworkX_GraphTranslation.py import heapq import matplotlib.pyplot as plt import networkx as nx import numpy as np from structural_functions import getKeyByValue def CreateVertices(TrajectoryPoints, Graph): ""...
code_fim
hard
{ "lang": "python", "repo": "manoskary/Topological-Descriptors-for-Symbolic-Music-Genre-Classification", "path": "/NetworkX_GraphTranslation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adirdayan/GeoEmbedding path: /geo_embedding/models/baselines/tests/test_coord2Vec.py import os import shutil from unittest import TestCase from coord2vec.common import multiproc_util from coord2vec.config import TEST_CACHE_DIR, TENSORBOARD_DIR, VAL_CACHE_DIR from coord2vec.models.baselines impor...
code_fim
medium
{ "lang": "python", "repo": "adirdayan/GeoEmbedding", "path": "/geo_embedding/models/baselines/tests/test_coord2Vec.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass # cls.embedding_dim = 16 # cls.tb_dir = 'test' # losses = [ScaledLoss() for _ in range(9)] # cls.coord2vec = Coord2Vec(house_price_builder, n_channels=3, losses=losses, embedding_dim=cls.embedding_dim) def test_fit_predict(self): pass # mul...
code_fim
medium
{ "lang": "python", "repo": "adirdayan/GeoEmbedding", "path": "/geo_embedding/models/baselines/tests/test_coord2Vec.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_claims_from_json_with_private_claim_names(self): claims = Claims.from_json( { "iss": "coap://as.example.com", "ext": "foo", }, private_claim_names={"ext": -70001}, ).to_dict() assert len(claims) == 2 ...
code_fim
hard
{ "lang": "python", "repo": "alexj27/python-cwt", "path": "/tests/test_claims.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> claims = Claims.from_json( { "iss": "coap://as.example.com", "ext": "foo", }, private_claim_names={"ext": -70001}, ).to_dict() assert len(claims) == 2 assert claims[1] == "coap://as.example.com" ass...
code_fim
hard
{ "lang": "python", "repo": "alexj27/python-cwt", "path": "/tests/test_claims.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexj27/python-cwt path: /tests/test_claims.py # pylint: disable=R0201, R0904, W0621 # R0201: Method could be a function # R0904: Too many public methods # W0621: Redefined outer name """ Tests for Claims. """ import pytest from cwt import Claims class TestClaims: """ Tests for Claims...
code_fim
hard
{ "lang": "python", "repo": "alexj27/python-cwt", "path": "/tests/test_claims.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bsyoo77/choreograph-git path: /choreograph/servoserial/serial_dummy.py #!/usr/bin/python import re # import smbus # =========================================================================== # from Ah_I2C Class # 2016-08: update from Python 3 # + ... # ======================================...
code_fim
hard
{ "lang": "python", "repo": "bsyoo77/choreograph-git", "path": "/choreograph/servoserial/serial_dummy.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def getPiRevision(): "Gets the version number of the Raspberry Pi board" return 2 @staticmethod def getPiI2CBusNumber(): # Gets the I2C bus number /dev/i2c# return 1 if Ah_I2C.getPiRevision() > 1 else 0 def __init__(self, address, busnum=-1, debug=False): self...
code_fim
hard
{ "lang": "python", "repo": "bsyoo77/choreograph-git", "path": "/choreograph/servoserial/serial_dummy.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> def reverseByteOrder(self, data): "Reverses the byte order of an int (16-bit) or long (32-bit) value" # Courtesy Vishal Sapre byteCount = len(hex(data)[2:].replace('L','')[::2]) val = 0 for i in range(byteCount): val = (val << 8) | (data & 0xff) data >>= 8 re...
code_fim
hard
{ "lang": "python", "repo": "bsyoo77/choreograph-git", "path": "/choreograph/servoserial/serial_dummy.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: jacob-kinzer/pacbot path: /installer/core/terraform/resources/__init__.py from core.config import Settings from core.terraform.utils import get_terraform_resource_path from core.terraform.utils import get_formatted_resource_attr_value from core.log import SysLog from abc import ABCMeta import jso...
code_fim
hard
{ "lang": "python", "repo": "jacob-kinzer/pacbot", "path": "/installer/core/terraform/resources/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> success = True msg_list = [] for arg in self._get_required_arguments(): if getattr(self, arg, None) is None: msg_list.append("Required argument are not provided. Argument: %s" % arg) success = False if self.get_resource_id() is N...
code_fim
hard
{ "lang": "python", "repo": "jacob-kinzer/pacbot", "path": "/installer/core/terraform/resources/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Quantipy/quantipy3 path: /savReaderWriter/__init__.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ savReaderWriter: A cross-platform Python interface to the IBM SPSS Statistics Input Output Module. Read or Write SPSS system files (.sav, .zsav) .. moduleauthor:: Albert-Jan Roskam <fo...
code_fim
hard
{ "lang": "python", "repo": "Quantipy/quantipy3", "path": "/savReaderWriter/__init__.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>MAXLENGTHS = { "SPSS_MAX_VARNAME": (64, "Variable name"), "SPSS_MAX_SHORTVARNAME": (8, "Short (compatibility) variable name"), "SPSS_MAX_SHORTSTRING": (8, "Short string variable"), "SPSS_MAX_IDSTRING": (64, "File label string"), "SPSS_MAX_LONGSTRING": (32767, "Long string variable...
code_fim
hard
{ "lang": "python", "repo": "Quantipy/quantipy3", "path": "/savReaderWriter/__init__.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> loss = self.criterion(outputs, labels) loss.backward() torch.nn.utils.clip_grad_norm_(self.model.parameters(), 1.0) self.optimizer.step() self.scheduler.step() return loss.item(), outputs def _validation(self, data_loader): self.model.eval() ...
code_fim
hard
{ "lang": "python", "repo": "theoseo/kortok", "path": "/tasks/korsts/trainer.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: theoseo/kortok path: /tasks/korsts/trainer.py from logging import Logger import torch from scipy.stats import spearmanr from torch import nn from torch.optim.adamw import AdamW from torch.utils.data.dataloader import DataLoader from torch.utils.tensorboard import SummaryWriter from tqdm import t...
code_fim
hard
{ "lang": "python", "repo": "theoseo/kortok", "path": "/tasks/korsts/trainer.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: esi-neuroscience/syncopy path: /syncopy/tests/test_metadata.py ength exactly 2" in str(err.value) # Test with tuple, 2nd arg is None _, b = parse_cF_returns((np.zeros(3))) assert b is None # Test with ndarray only _, b = parse_cF_returns(np.zeros(3)) ...
code_fim
hard
{ "lang": "python", "repo": "esi-neuroscience/syncopy", "path": "/syncopy/tests/test_metadata.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: esi-neuroscience/syncopy path: /syncopy/tests/test_metadata.py , and values in ndarray are string (but not object). This is fine. a, b = parse_cF_returns((np.zeros(3), {'a': np.array(['apples', 'foobar', 'cowboy'])})) assert 'a' in b def test_parse_backend_metadata(self): ...
code_fim
hard
{ "lang": "python", "repo": "esi-neuroscience/syncopy", "path": "/syncopy/tests/test_metadata.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Test exc: with duplicate key in several nested dicts. md_nested_dupl_key = { 'ap' : { 'ap__0_0': 1, 'ap__0_1': 2}, 'pp': {'ap__0_0': 3, 'pp__0_1': 4}} with pytest.raises(SPYValueError, match="Duplicate key"): _ = metadata_unnest(md_nested_dupl_key) # Test exc...
code_fim
hard
{ "lang": "python", "repo": "esi-neuroscience/syncopy", "path": "/syncopy/tests/test_metadata.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: murodin/MMTtools path: /mmirs_pipeline_taskfile.py S']) object0.append(hdr['OBJECT']) imagetyp.append(hdr['IMAGETYP']) aptype.append(hdr['APTYPE']) aperture.append(hdr['APERTURE']) filter0.append(hdr['FILTER']) disperse.appen...
code_fim
hard
{ "lang": "python", "repo": "murodin/MMTtools", "path": "/mmirs_pipeline_taskfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: murodin/MMTtools path: /mmirs_pipeline_taskfile.py ]) del c_hdr0[col1[vv]] col2 = ['SCI', 'SCI2', 'DITHPOS', 'DITHPOS2'] # + on 24/01/2018 im_dict = get_diff_images(tab0, idx, dither=dither, mylog=mylog) # Only write files if dithering is done | Mod on 29/04/2018 ...
code_fim
hard
{ "lang": "python", "repo": "murodin/MMTtools", "path": "/mmirs_pipeline_taskfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Modified by Chun Ly, 8 June 2018 - Include inter keyword option - Add user prompts to identify telluric star - Bug fix: indexing issue Modified by Chun Ly, 9 June 2018 - Add mmirs_setup0 and target_setup inputs - Require target_setup in telluric selection Modified by...
code_fim
hard
{ "lang": "python", "repo": "murodin/MMTtools", "path": "/mmirs_pipeline_taskfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>variavel_aplicacao = Flask(__name__) # importar o pacote views do pacote app. from aplicacao import visualizacoes<|fim_prefix|># repo: miguel7penteado/python-flask path: /2-flask-templates/aplicacao/__init__.py # -*- coding: utf-8 -*- #!/usr/bin/env python <|fim_middle|>from flask import Flask
code_fim
easy
{ "lang": "python", "repo": "miguel7penteado/python-flask", "path": "/2-flask-templates/aplicacao/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: miguel7penteado/python-flask path: /2-flask-templates/aplicacao/__init__.py # -*- coding: utf-8 -*- #!/usr/bin/env python <|fim_suffix|>variavel_aplicacao = Flask(__name__) # importar o pacote views do pacote app. from aplicacao import visualizacoes<|fim_middle|>from flask import Flask
code_fim
easy
{ "lang": "python", "repo": "miguel7penteado/python-flask", "path": "/2-flask-templates/aplicacao/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openvenues/lieu path: /lib/lieu/spark/utils.py class IDPairRDD(object): @classmethod def join_pairs(cls, pairs, kvs): result = pairs.join(kvs) \ .map(lambda (k1, (k2, v1)): (k2, (k1, v1))) num_partitions = result.getNumPartitions() <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "openvenues/lieu", "path": "/lib/lieu/spark/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> num_partitions = result.getNumPartitions() return result.join(kvs2) \ .map(lambda (k2, ((k1, v1), v2)): ((k1, k2), (v1, v2))) \ .coalesce(num_partitions)<|fim_prefix|># repo: openvenues/lieu path: /lib/lieu/spark/utils.py class IDPairRDD(object...
code_fim
hard
{ "lang": "python", "repo": "openvenues/lieu", "path": "/lib/lieu/spark/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # write the data frame to a dated snapshot and to latest date = datetime.now().strftime('%Y-%m-%d') snapshot = './data/us-tn/tn-edu/raw/districts-'+date+'.csv' df.to_csv(f'{snapshot}', index=False) df.to_csv(f'./data/us-tn/tn-edu/raw/districts-latest.csv', index=False)<|fim_prefix|># r...
code_fim
hard
{ "lang": "python", "repo": "mtna/covid-19", "path": "/data/us-tn/tn-edu/district-parser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mtna/covid-19 path: /data/us-tn/tn-edu/district-parser.py import os import requests import pandas as pd from datetime import datetime if __name__ == "__main__": # get the district info response = requests.get("https://districtinformation.tnedu.gov/api/districts") if response.status_c...
code_fim
medium
{ "lang": "python", "repo": "mtna/covid-19", "path": "/data/us-tn/tn-edu/district-parser.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # add the results to a data frame df = pd.DataFrame(columns = ['district_id', 'district_name', 'region_id', 'region_name', 'student_cases', 'staff_cases', 'date_stamp']) districtArr = response.json() for district in districtArr: region = district['region'] covid = district...
code_fim
medium
{ "lang": "python", "repo": "mtna/covid-19", "path": "/data/us-tn/tn-edu/district-parser.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_kbenv_install_no_version_file( cd_tmp_path: Path, caplog: LogCaptureFixture ) -> None: """Test ``runway kbenv install`` no version file.""" caplog.set_level(logging.WARNING, logger="runway") runner = CliRunner() result = runner.invoke(cli, ["kbenv", "install"]) assert resu...
code_fim
hard
{ "lang": "python", "repo": "onicagroup/runway", "path": "/tests/integration/cli/commands/kbenv/test_install.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: onicagroup/runway path: /tests/integration/cli/commands/kbenv/test_install.py """Test ``runway kbenv install`` command.""" # pylint: disable=unused-argument from __future__ import annotations import logging from pathlib import Path from typing import TYPE_CHECKING import pytest from click.testi...
code_fim
hard
{ "lang": "python", "repo": "onicagroup/runway", "path": "/tests/integration/cli/commands/kbenv/test_install.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ caplog.set_level(logging.DEBUG, logger="runway.cli.commands.kbenv") runner = CliRunner() result = runner.invoke(cli, ["kbenv", "install", "v1.14.0"]) assert result.exit_code == 0 kb_bin = Path(caplog.messages[-1].replace("kubectl path: ", "")) assert kb_bin.exists()<|fim_p...
code_fim
hard
{ "lang": "python", "repo": "onicagroup/runway", "path": "/tests/integration/cli/commands/kbenv/test_install.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for superheros in superheros: print(f"this is my list of data base: {superheros}") else: print("im not read db")<|fim_prefix|># repo: santiagopc/course_python39_sz00 path: /mi_primer_insert.py import db_connection import psycopg2 <|fim_middle|>cursor = db_connection.connection1 if cursor...
code_fim
medium
{ "lang": "python", "repo": "santiagopc/course_python39_sz00", "path": "/mi_primer_insert.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: santiagopc/course_python39_sz00 path: /mi_primer_insert.py import db_connection import psycopg2 <|fim_suffix|> for superheros in superheros: print(f"this is my list of data base: {superheros}") else: print("im not read db")<|fim_middle|>cursor = db_connection.connection1 if cursor...
code_fim
medium
{ "lang": "python", "repo": "santiagopc/course_python39_sz00", "path": "/mi_primer_insert.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lsst-sitcom/spot_motion_monitor path: /spot_motion_monitor/views/base_config_tab.py # This file is part of spot_motion_monitor. # # Developed for LSST System Integration, Test and Commissioning. # # See the LICENSE file at the top-level directory of this distribution # for details of code ownersh...
code_fim
hard
{ "lang": "python", "repo": "lsst-sitcom/spot_motion_monitor", "path": "/spot_motion_monitor/views/base_config_tab.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def getConfiguration(self): """Get the configuration parameter's from the tab's widgets. Raises ------ NotImplementedError """ raise NotImplementedError def setConfiguration(self, config): """Set the configuration parameters into the tab's ...
code_fim
hard
{ "lang": "python", "repo": "lsst-sitcom/spot_motion_monitor", "path": "/spot_motion_monitor/views/base_config_tab.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ """ # construct the operator and test it operator = MaxOperator() self.assertEquals(max(5, 2), operator(5, 2)) self.assertEquals("max_", operator.function_name()) self.assertEquals(""" def max_(x, y): return max(x, y) """, operator.fu...
code_fim
hard
{ "lang": "python", "repo": "paulfjacobs/py-mep", "path": "/tests/mep/genetics/test_operator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paulfjacobs/py-mep path: /tests/mep/genetics/test_operator.py import unittest from mep.genetics.operator import MultiplicationOperator, AdditionOperator, SubtractionOperator from mep.genetics.operator import MinOperator, MaxOperator class TestOperators(unittest.TestCase): """ Test the O...
code_fim
hard
{ "lang": "python", "repo": "paulfjacobs/py-mep", "path": "/tests/mep/genetics/test_operator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return x + y """, operator.function_python_definition()) def test_subtraction_operator(self): """ """ # construct the operator and test it operator = SubtractionOperator() self.assertEquals(5 - 2, operator(5, ...
code_fim
hard
{ "lang": "python", "repo": "paulfjacobs/py-mep", "path": "/tests/mep/genetics/test_operator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def back_driver(self): driver = self.app.driver driver.back() def refresh(self): driver = self.app.driver driver.refresh()<|fim_prefix|># repo: smagdenko/webdriver path: /pages/base_page.py from selenium import webdriver class BasePage: def __init__(self, ap...
code_fim
hard
{ "lang": "python", "repo": "smagdenko/webdriver", "path": "/pages/base_page.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: smagdenko/webdriver path: /pages/base_page.py from selenium import webdriver class BasePage: def __init__(self, app): self.app = app def checkout(self): driver = self.app.driver driver.find_element_by_xpath("//a[contains(.,'Checkout')]").click() return s...
code_fim
medium
{ "lang": "python", "repo": "smagdenko/webdriver", "path": "/pages/base_page.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self.event.command not in self.full_names: raise PWarning("Не задано имя конфы, задайте его командой /конфа (название конфы)") if self.event.args: try: self.check_sender(Role.CONFERENCE_ADMIN) same_chats = self.bot.chat_model.filte...
code_fim
hard
{ "lang": "python", "repo": "FuckBrains/petrovich", "path": "/apps/bot/commands/Conference.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FuckBrains/petrovich path: /apps/bot/commands/Conference.py from apps.bot.classes.Consts import Role, Platform from apps.bot.classes.Exceptions import PWarning from apps.bot.classes.common.CommonCommand import CommonCommand class Conference(CommonCommand): name = "конфа" names = ["конфе...
code_fim
hard
{ "lang": "python", "repo": "FuckBrains/petrovich", "path": "/apps/bot/commands/Conference.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def start(self): if self.event.command not in self.full_names: raise PWarning("Не задано имя конфы, задайте его командой /конфа (название конфы)") if self.event.args: try: self.check_sender(Role.CONFERENCE_ADMIN) same_chats = self...
code_fim
hard
{ "lang": "python", "repo": "FuckBrains/petrovich", "path": "/apps/bot/commands/Conference.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.world = MultiWorld(1) self.world.game[1] = "Minecraft" self.world.worlds[1] = MinecraftWorld(self.world, 1) exclusion_pools = ['hard', 'insane', 'postgame'] for pool in exclusion_pools: setattr(self.world, f"include_{pool}_advancements", [False, Fal...
code_fim
medium
{ "lang": "python", "repo": "adampziegler/Archipelago", "path": "/test/minecraft/TestMinecraft.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _get_items(self, item_pool, all_except): if all_except and len(all_except) > 0: items = self.world.itempool[:] items = [item for item in items if item.name not in all_except and not ("Bottle" in item.name and "AnyBottle" in all_except)] ...
code_fim
hard
{ "lang": "python", "repo": "adampziegler/Archipelago", "path": "/test/minecraft/TestMinecraft.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adampziegler/Archipelago path: /test/minecraft/TestMinecraft.py import worlds.minecraft.Options from test.TestBase import TestBase from BaseClasses import MultiWorld from worlds import AutoWorld from worlds.minecraft import MinecraftWorld from worlds.minecraft.Items import MinecraftItem, item_tab...
code_fim
hard
{ "lang": "python", "repo": "adampziegler/Archipelago", "path": "/test/minecraft/TestMinecraft.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hearen/OnceServer path: /Server/utils/OnceLogging.py import sys, os, fcntl import stat import tempfile import types import inspect import logging import logging.handlers import mkdir MAX_BYTES = 1 << 20 # 1MB BACKUP_COUNT = 5 STDERR_FORMAT = "[%(name)s] %(levelname)s (%(module)s:%(lineno)d) %(...
code_fim
hard
{ "lang": "python", "repo": "Hearen/OnceServer", "path": "/Server/utils/OnceLogging.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Rather unintuitively, getLevelName will get the number corresponding to # a level name, as well as getting the name corresponding to a level # number. setLevel seems to take the number only though, so convert if we # are given a string. if isinstance(level, types.StringType): ...
code_fim
hard
{ "lang": "python", "repo": "Hearen/OnceServer", "path": "/Server/utils/OnceLogging.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thierry-thevenet/did-siop path: /main.py """ Main script to start web server through Gunicorn Arguments of main.py are in gunicornconf.py (global variables) : $ gunicorn -c gunicornconf.py --reload wsgi:app if script is launched without Gunicorn, setup environment variables first : $ export MYC...
code_fim
hard
{ "lang": "python", "repo": "thierry-thevenet/did-siop", "path": "/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Framework Flask and Session setup app = Flask(__name__) app.jinja_env.globals['Version'] = VERSION app.jinja_env.globals['Created'] = time.ctime(os.path.getctime('main.py')) app.jinja_env.globals['Chain'] = mychain.capitalize() app.config['SESSION_PERMANENT'] = True app.config['SESSION_COOKIE_NAME'] = '...
code_fim
hard
{ "lang": "python", "repo": "thierry-thevenet/did-siop", "path": "/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: davehull/OSCPRepo path: /scripts/recon_enum/webrecon.py #!/usr/bin/python import sys import os import subprocess import errno import multiprocessing from multiprocessing import Process import time import argparse #See more: https://github.com/nmap/nmap/tree/master/scripts #NSE Documentation #R...
code_fim
hard
{ "lang": "python", "repo": "davehull/OSCPRepo", "path": "/scripts/recon_enum/webrecon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__=='__main__': parser = argparse.ArgumentParser(description='Rough script to handle Web enumeration, fingerprinting, and other less intensive scans. Usage: webrecon.py {} <http(s)://target url:port>') parser.add_argument('-n', '--nmap', default='true', help="Run all (safe) nmap scripts ...
code_fim
hard
{ "lang": "python", "repo": "davehull/OSCPRepo", "path": "/scripts/recon_enum/webrecon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> parser = argparse.ArgumentParser(description='Rough script to handle Web enumeration, fingerprinting, and other less intensive scans. Usage: webrecon.py {} <http(s)://target url:port>') parser.add_argument('-n', '--nmap', default='true', help="Run all (safe) nmap scripts regarding HTTP scanning") ...
code_fim
hard
{ "lang": "python", "repo": "davehull/OSCPRepo", "path": "/scripts/recon_enum/webrecon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # --- Generating all files in a workdir fastfiles=fastlib.templateReplace(PARAMS,ref_dir,work_dir,RemoveRefSubFiles=True,RemoveAllowed=True,main_file=main_file) # --- Creating a batch script just in case fastlib.writeBatch(os.path.join(work_dir,'_RUN_ALL.bat'), fastfiles,fastExe=FAST_EXE)...
code_fim
hard
{ "lang": "python", "repo": "michalehu/welib", "path": "/welib/fast/_examples/Example_PowerCurve_Parametric.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: michalehu/welib path: /welib/fast/_examples/Example_PowerCurve_Parametric.py import numpy as np import os try: import welib.fast.fastlib as fastlib except: import fastlib def PowerCurveParametricExample1(): """ Example to run a set of FAST simulations to determine a power curve. ...
code_fim
hard
{ "lang": "python", "repo": "michalehu/welib", "path": "/welib/fast/_examples/Example_PowerCurve_Parametric.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def process_file( file, newfile ): import string print( "File: " , file ) f = open(file,"r+") text = f.read() f.close() newtext = text lines = run_program_get_error( file ) if lines: for line in lines.splitlines(): import re matched = re....
code_fim
hard
{ "lang": "python", "repo": "ecmwf/atlas", "path": "/doc/example-grids/update_uid.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ecmwf/atlas path: /doc/example-grids/update_uid.py #!/usr/bin/env python3 # # This script checks all example-grids and updates the uid to a newly calculated uid # The only argument to this script is the path to the "atlas-grids" executable # # !!! WARNING !!! # Execution overwrites existing "...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/atlas", "path": "/doc/example-grids/update_uid.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> f = open(file,"r+") text = f.read() f.close() newtext = text lines = run_program_get_error( file ) if lines: for line in lines.splitlines(): import re matched = re.match( r"Check failed: grid uid (.*) expected to be (.*)$", line ) if ma...
code_fim
hard
{ "lang": "python", "repo": "ecmwf/atlas", "path": "/doc/example-grids/update_uid.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PythonUnited/keyword-extractor path: /api.py from flask import Flask, request from flask_restful import Resource, Api <|fim_suffix|>if __name__ == '__main__': app = create_app() app.run(host ='0.0.0.0', debug=True)<|fim_middle|>from multi_rake import Rake def create_app(): app = Fl...
code_fim
hard
{ "lang": "python", "repo": "PythonUnited/keyword-extractor", "path": "/api.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class KeywordExtractor(Resource): def get(self, language_code=None): rake = Rake(language_code=language_code) text = request.form.get('text') if text: return rake.apply(text) return 'No text given', 400 if __name__ == '__main__': app = create_app() ...
code_fim
hard
{ "lang": "python", "repo": "PythonUnited/keyword-extractor", "path": "/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return 'No text given', 400 if __name__ == '__main__': app = create_app() app.run(host ='0.0.0.0', debug=True)<|fim_prefix|># repo: PythonUnited/keyword-extractor path: /api.py from flask import Flask, request from flask_restful import Resource, Api from multi_rake import Rake def cr...
code_fim
medium
{ "lang": "python", "repo": "PythonUnited/keyword-extractor", "path": "/api.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if message['custid'] not in self.custBalances: self.custBalances[message['custid']] = 0 if message['type'] == 'dep': self.custBalances[message['custid']] += message['amt'] else: self.custBalances[message['custid']] -= mess...
code_fim
hard
{ "lang": "python", "repo": "malbt/Kafka3-Data", "path": "/phase2/limit_consumer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: malbt/Kafka3-Data path: /phase2/limit_consumer.py from kafka import KafkaConsumer, TopicPartition, conn from json import loads class XactionConsumer: def __init__(self): self.consumer = KafkaConsumer('bank-customer-events', bootstrap_servers=['l...
code_fim
hard
{ "lang": "python", "repo": "malbt/Kafka3-Data", "path": "/phase2/limit_consumer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> owner_references_set = "satisfied" if t.test_owner_references_set() else \ "not satisfied" kube_openapi_annotations_on_type_definitions = "satisfied" if \ t.test_kube_openapi_annotations_on_typedefs() else "not satisfied" custom_resource_spec_validation = "satisfied" if \ ...
code_fim
hard
{ "lang": "python", "repo": "cloud-ark/kubeplus", "path": "/operator-analysis/analysis/analysis.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloud-ark/kubeplus path: /operator-analysis/analysis/analysis.py #!/usr/bin/env python3 from logzero import logger from analysis.utils import clone, search_for_key, search_for_file, \ get_repo_name, delete, search_for_folders_with_file import os import traceback import re class Guidelines: ...
code_fim
hard
{ "lang": "python", "repo": "cloud-ark/kubeplus", "path": "/operator-analysis/analysis/analysis.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: iLORESTeam/python-redfish-utility path: /src/extensions/SCALABLE PERSISTENT MEMORY COMMANDS/EnableScalablePmemCommand.py ### # Copyright 2016 Hewlett Packard Enterprise, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file excep...
code_fim
hard
{ "lang": "python", "repo": "iLORESTeam/python-redfish-utility", "path": "/src/extensions/SCALABLE PERSISTENT MEMORY COMMANDS/EnableScalablePmemCommand.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> scalable_pmem_config = ScalablePersistentMemoryConfig(self._restHelpers,\ validator, self._chif_lib) scalable_pmem_config.refresh() # pre-validation self._helpers.validateFeatureIsSupported(scalable_pmem_config) ...
code_fim
hard
{ "lang": "python", "repo": "iLORESTeam/python-redfish-utility", "path": "/src/extensions/SCALABLE PERSISTENT MEMORY COMMANDS/EnableScalablePmemCommand.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self._helpers.noticeRestartRequired(scalable_pmem_config) sys.stdout.write("\n\n") def run(self, line): """ Wrapper function for the Remove logical NVDIMM command :param line: command line input :type line: string. """ LOGGER.info("Scalable PM...
code_fim
hard
{ "lang": "python", "repo": "iLORESTeam/python-redfish-utility", "path": "/src/extensions/SCALABLE PERSISTENT MEMORY COMMANDS/EnableScalablePmemCommand.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: BrownDwarf/welter path: /code/batch_plot_mix.py #!/usr/bin/env python import os import yaml import numpy as np import h5py ms = range(100, 117) #ms = range(72, 94+1) #ms = list(range(72, 94+1)) + list(range(99, 119)) os.chdir(os.path.expandvars('$WELTER/sf/')) os.getcwd() <|fim_suffix|> p...
code_fim
medium
{ "lang": "python", "repo": "BrownDwarf/welter", "path": "/code/batch_plot_mix.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('Plotting results from m{:03d}'.format(m)) os.system('cp temp_emcee_chain.npy emcee_chain.npy') os.system('plot_many_mix_models.py --static') os.system('cp mix_model.png '+ os.path.expandvars('$WELTER/results/fig/mix_models_run02/mix_model_m{:03d}.png'.format(m))) os.chdir(o...
code_fim
medium
{ "lang": "python", "repo": "BrownDwarf/welter", "path": "/code/batch_plot_mix.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.maxLength = currentDepth - 1 print(self.maxLength) self.solutions.append(self.p1soln + self.p2soln) print(self.solutions) elif d > 0: if max(self.table.cpPrune[p[0]], self.table.epPrune[p[1]], self.table.udPrune2[p[...
code_fim
hard
{ "lang": "python", "repo": "ryomakawakami/rubikscube", "path": "/rubikscube/solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.p2soln = [] n = len(self.solutions) while d <= self.maxLength - self.p1Length: self.phase2(p, d, n) d += 1 def phase2(self, p, d, numSolutions): if numSolutions != len(self.solutions): return if self.p1Length + len(sel...
code_fim
hard
{ "lang": "python", "repo": "ryomakawakami/rubikscube", "path": "/rubikscube/solver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ryomakawakami/rubikscube path: /rubikscube/solver.py from rubikscube.tables import Table import rubikscube.cubie_cube.cube as cubie import rubikscube.cubie_cube.constant as constant import copy class Solver: def __init__(self): self.table = Table() def kociemba(self, cube): ...
code_fim
hard
{ "lang": "python", "repo": "ryomakawakami/rubikscube", "path": "/rubikscube/solver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for item in Item.objects.all(): if item.category is None: item.category = item.item_model.category if item.name is None: item.name = item.item_model.name item.save() if __name__ == "__main__": parser = argparse.ArgumentParser(description='Set item c...
code_fim
medium
{ "lang": "python", "repo": "Findspire/workflow", "path": "/scripts/item_category.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }