text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> if isinstance(config, list):
for idx, val in enumerate(config):
if is_variable(val):
config[idx] = resolve_variable(val)
elif isinstance(val, dict):
config[idx] = parse_config(val, env_vars=env_vars, global_vars=global_vars)
elif isin... | code_fim | hard | {
"lang": "python",
"repo": "nikkkkhil/modelshare",
"path": "/src/nest/parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nikkkkhil/modelshare path: /src/nest/parser.py
import os
import re
from typing import Any, Dict, Union, Optional
from datetime import datetime
from copy import deepcopy
import nest.utils as U
from nest.modules import module_manager
from nest.settings import settings
from nest.logger import logge... | code_fim | hard | {
"lang": "python",
"repo": "nikkkkhil/modelshare",
"path": "/src/nest/parser.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(resolved_config, list):
for v in resolved_config:
check_all_resolved(v)
elif isinstance(resolved_config, dict):
for v in resolved_config.values():
check_all_resolved(v)
elif type(resolved_config).__name__ == 'Nes... | code_fim | hard | {
"lang": "python",
"repo": "nikkkkhil/modelshare",
"path": "/src/nest/parser.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mickey1982/alerta path: /bin/alert-aws.py
#!/usr/bin/env python
########################################
#
# alert-aws.py - Amazon Web Service Alerter
#
########################################
import os
import sys
import time
import urllib
import urllib2
try:
import json
except ImportError... | code_fim | hard | {
"lang": "python",
"repo": "mickey1982/alerta",
"path": "/bin/alert-aws.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> logging.basicConfig(level=logging.INFO, format="%(asctime)s alert-aws[%(process)d] %(levelname)s - %(message)s", filename=LOGFILE)
logging.info('Starting up Alert Amazon Web Services EC2 version %s', __version__)
# Write pid file if not already running
if os.path.isfile(PIDFILE):
... | code_fim | hard | {
"lang": "python",
"repo": "mickey1982/alerta",
"path": "/bin/alert-aws.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
global _redis_client
if not _redis_client:
_redis_client = StrictRedis.from_url(**REDIS_CONF)
return _redis_client<|fim_prefix|># repo: hust-sh/hookhub path: /app/common/cache.py
# coding: utf-8
from redis import StrictRedis
from common.config import REDIS_CONF
_redis_client = None... | code_fim | easy | {
"lang": "python",
"repo": "hust-sh/hookhub",
"path": "/app/common/cache.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hust-sh/hookhub path: /app/common/cache.py
# coding: utf-8
from redis import StrictRedis
from common.config import REDIS_CONF
_redis_client = None
<|fim_suffix|> global _redis_client
if not _redis_client:
_redis_client = StrictRedis.from_url(**REDIS_CONF)
return _redis_clie... | code_fim | easy | {
"lang": "python",
"repo": "hust-sh/hookhub",
"path": "/app/common/cache.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def pytest_addoption(parser):
parser.addoption("--fast-only", action="store_true", help="Run fast tests only")
@pytest.fixture
def fastonly(request):
return request.config.getoption("--fast-only")<|fim_prefix|># repo: AdRoll/python-hll path: /conftest.py
# This file is here to add the project r... | code_fim | medium | {
"lang": "python",
"repo": "AdRoll/python-hll",
"path": "/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return request.config.getoption("--fast-only")<|fim_prefix|># repo: AdRoll/python-hll path: /conftest.py
# This file is here to add the project root to the sys.path to prevent
# import errors when running a single test. See https://stackoverflow.com/a/50610630/378457
# It also defines the --fast-onl... | code_fim | easy | {
"lang": "python",
"repo": "AdRoll/python-hll",
"path": "/conftest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AdRoll/python-hll path: /conftest.py
# This file is here to add the project root to the sys.path to prevent
# import errors when running a single test. See https://stackoverflow.com/a/50610630/378457
# It also defines the --fast-only command-line option below.
import pytest
<|fim_suffix|> ... | code_fim | easy | {
"lang": "python",
"repo": "AdRoll/python-hll",
"path": "/conftest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: l-a-motta/talehub path: /catalog/views.py
# Django imports
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.urls import reverse
# Internal imports
from .models import Book, Chapter
# External imports
from django.utils import timez... | code_fim | hard | {
"lang": "python",
"repo": "l-a-motta/talehub",
"path": "/catalog/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
# The book needs the right ID, and to be published before now().
book = Book.objects.get(pk=book_id, published_at__lte=timezone.now())
# This is just one chapter so it needs the ID to differentiate from the others in the
# book's chapter_set, and also the publishi... | code_fim | hard | {
"lang": "python",
"repo": "l-a-motta/talehub",
"path": "/catalog/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yangmqglobe/komim path: /komim/result.py
# -*- coding:utf-8 -*-
"""
@author: 杨满球
@file: result.py
@time: 2016/11/5 19:25
"""
class Text:
def __init__(self, resp):
self.text = resp.text
class Entry:
def __init__(self, obj, version=None):
if isinstance(obj, dict):
... | code_fim | hard | {
"lang": "python",
"repo": "yangmqglobe/komim",
"path": "/komim/result.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class EntryList:
def __init__(self, resps):
resp0 = resps.pop()
self.resp = resp0.json()
for resp in resps:
self.resp['omim']['entryList'].extend(resp.json()['omim']['entryList'])
self.text = str(self.resp)
self.version = self.resp['omim']['version']... | code_fim | medium | {
"lang": "python",
"repo": "yangmqglobe/komim",
"path": "/komim/result.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __getitem__(self, key):
return self.entry[key]
def __repr__(self):
return '<Entry mimNumber={}>'.format(self.mimNumber)
class EntryList:
def __init__(self, resps):
resp0 = resps.pop()
self.resp = resp0.json()
for resp in resps:
self.re... | code_fim | hard | {
"lang": "python",
"repo": "yangmqglobe/komim",
"path": "/komim/result.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jhhuang96/AIC_Weather_Forecasting path: /result/caculate_score.py
import pandas as pd
import numpy as np
from sklearn.metrics import mean_squared_error
import json
import os
from datetime import datetime
from collections import OrderedDict
def datelist(beginDate, endDate):
date_l=[datetime.st... | code_fim | hard | {
"lang": "python",
"repo": "jhhuang96/AIC_Weather_Forecasting",
"path": "/result/caculate_score.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> score_rh2m_lgb = (rmse_rh2m_M - rmse_rh2m_lgb) / rmse_rh2m_M
score_rh2m_lgb_q = (rmse_rh2m_M - rmse_rh2m_lgb_q) / rmse_rh2m_M
score_rh2m_catboost = (rmse_rh2m_M - rmse_rh2m_catboost) / rmse_rh2m_M
score_rh2m_catboost_q = (rmse_rh2m_M - rmse_rh2m_catboost_q) / rmse_rh2m_M
... | code_fim | hard | {
"lang": "python",
"repo": "jhhuang96/AIC_Weather_Forecasting",
"path": "/result/caculate_score.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> score_t2m_lgb=(rmse_t2m_M-rmse_t2m_lgb)/rmse_t2m_M
score_t2m_lgb_q=(rmse_t2m_M-rmse_t2m_lgb_q)/rmse_t2m_M
score_t2m_catboost=(rmse_t2m_M-rmse_t2m_catboost)/rmse_t2m_M
score_t2m_catboost_q=(rmse_t2m_M-rmse_t2m_catboost_q)/rmse_t2m_M
score_t2m_lgb_global=(rmse_t2m_M-r... | code_fim | hard | {
"lang": "python",
"repo": "jhhuang96/AIC_Weather_Forecasting",
"path": "/result/caculate_score.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ifalanrocha/Conversor-Medidas path: /MedidasConv.py
print('===== Conversor de Medidas =====')
m = float(input('Digite um valor em metros: '))
print('O valor de {:.0f}m em Decimetros é {:.1f}dm!'.format(<|fim_suffix|>/1609))
print('O valor de {:.0f}m em Quilometros é {:.1f}km!'.format(m, m/1000))
... | code_fim | hard | {
"lang": "python",
"repo": "ifalanrocha/Conversor-Medidas",
"path": "/MedidasConv.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>0))
print('O valor de {:.0f}m em Decametros é {:.1f}dam!'.format(m, m/10))
print('O valor de {:.0f}m em Milhas é aproximadamente {:.2f}mi!'.format(m, m/1609))
print('O valor de {:.0f}m em Quilometros é {:.1f}km!'.format(m, m/1000))
print('O valor de {:.0f}m em Ectometros é {:.1f}hm!'.format(m, m/100))<|fi... | code_fim | medium | {
"lang": "python",
"repo": "ifalanrocha/Conversor-Medidas",
"path": "/MedidasConv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>/1609))
print('O valor de {:.0f}m em Quilometros é {:.1f}km!'.format(m, m/1000))
print('O valor de {:.0f}m em Ectometros é {:.1f}hm!'.format(m, m/100))<|fim_prefix|># repo: ifalanrocha/Conversor-Medidas path: /MedidasConv.py
print('===== Conversor de Medidas =====')
m = float(input('Digite um valor em me... | code_fim | medium | {
"lang": "python",
"repo": "ifalanrocha/Conversor-Medidas",
"path": "/MedidasConv.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: erjan/coding_exercises path: /largest_palindromic_number.py
'''
You are given a string num consisting of digits only.
Return the largest palindromic integer (in the form of a string) that can be formed using digits taken from num. It should not contain leading zeroes.
Notes:
You do not need to... | code_fim | hard | {
"lang": "python",
"repo": "erjan/coding_exercises",
"path": "/largest_palindromic_number.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def largestPalindromic(self, num: str) -> str:
c = Counter(num)
if len(c)==1 and c['0']>=1:
return "0"
m = -1 #storing the mid of the number
res1 = ''
res2 = ''
for i in range(9,-1,-1):
while c[str(i)]:
if not re... | code_fim | hard | {
"lang": "python",
"repo": "erjan/coding_exercises",
"path": "/largest_palindromic_number.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>------------------------------------------------------------------------
class Solution:
def largestPalindromic(self, num: str) -> str:
c = Counter(num)
if len(c)==1 and c['0']>=1:
return "0"
m = -1 #storing the mid of the number
res1 = ''
res2 = '... | code_fim | hard | {
"lang": "python",
"repo": "erjan/coding_exercises",
"path": "/largest_palindromic_number.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kantel/nodebox-pyobjc path: /examples/Extended Application/sklearn/examples/neighbors/plot_digits_kde_sampling.py
"""
=========================
Kernel Density Estimation
=========================
This example shows how kernel density estimation (KDE), a powerful
non-parametric density estimation... | code_fim | hard | {
"lang": "python",
"repo": "kantel/nodebox-pyobjc",
"path": "/examples/Extended Application/sklearn/examples/neighbors/plot_digits_kde_sampling.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("best bandwidth: {0}".format(grid.best_estimator_.bandwidth))
# use the best estimator to compute the kernel density estimate
kde = grid.best_estimator_
# sample 44 new points from the data
new_data = kde.sample(44, random_state=0)
new_data = pca.inverse_transform(new_data)
# turn data into a 4x1... | code_fim | hard | {
"lang": "python",
"repo": "kantel/nodebox-pyobjc",
"path": "/examples/Extended Application/sklearn/examples/neighbors/plot_digits_kde_sampling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tulip-control/tulip-control path: /contrib/fmu/poly2str.py
import numpy
def matrix2str(A):
"""Convert a matrix A into a string
@param A: a numpy.array matrix
@rtype string
"""
s = ""
for x in numpy.nditer(A, order='F'):
s = s + str(x) + ","
return s
def p... | code_fim | medium | {
"lang": "python",
"repo": "tulip-control/tulip-control",
"path": "/contrib/fmu/poly2str.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Convert a polytope into C code
@param p: a polytope.polytope.Polytope
@param name: the name of the polytope in C code
@rtype string
"""
k = p.A.shape[0]
l = p.A.shape[1]
# pik=k
s = "idxint "+name+"k = "+str(k)+";\n"
# pil=l
s = s+"idxint "+name+"l = "+str(l... | code_fim | medium | {
"lang": "python",
"repo": "tulip-control/tulip-control",
"path": "/contrib/fmu/poly2str.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peterhinch/micropython-nano-gui path: /drivers/sh1106/sh1106.py
# Copied from https://github.com/robert-hh/SH1106
#
# MicroPython SH1106 OLED driver, I2C and SPI interfaces
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Radomir Dopieralski (@deshipu),
# 2017-2021 Robert Hammelrath... | code_fim | hard | {
"lang": "python",
"repo": "peterhinch/micropython-nano-gui",
"path": "/drivers/sh1106/sh1106.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().fill(color)
self.pages_to_update = (1 << self.pages) - 1
def blit(self, fbuf, x, y, key=-1, palette=None):
super().blit(fbuf, x, y, key, palette)
self.register_updates(y, y + self.height)
def scroll(self, x, y):
# my understanding is that scroll() ... | code_fim | hard | {
"lang": "python",
"repo": "peterhinch/micropython-nano-gui",
"path": "/drivers/sh1106/sh1106.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> _logits = tf.nn.relu(logits) + eps
_logits = _logits ** exponent if exponent is not None else _logits
normalizer = tf.reduce_sum(_logits, axis=axis)
res = tf.einsum('cr,c->cr', _logits, 1.0 / normalizer)
res = tf.where(tf.is_nan(res), tf.zeros_like(res), res)
return res<|fim_prefix... | code_fim | hard | {
"lang": "python",
"repo": "BayLee001/gntp",
"path": "/gntp/attention.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BayLee001/gntp path: /gntp/attention.py
# -*- coding: utf-8 -*-
import tensorflow as tf
def attention(logits, mask):
<|fim_suffix|> _logits = tf.nn.relu(logits) + eps
_logits = _logits ** exponent if exponent is not None else _logits
normalizer = tf.reduce_sum(_logits, axis=axis)
... | code_fim | hard | {
"lang": "python",
"repo": "BayLee001/gntp",
"path": "/gntp/attention.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> now = datetime.utcnow() + timedelta(hours=9)
locations = [
'({} | {})\n\n'.format(routes[route_id], route_id) + location
for route_id, location in {route_id: bus_location.fetch(route_id) for route_id in routes}.items()
if location is not None
]
result = '[버스 위치 정보... | code_fim | hard | {
"lang": "python",
"repo": "luaneyed/bus",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luaneyed/bus path: /app.py
from datetime import datetime, timedelta
import bus_location
from slack import log
def run(debug: bool = True):
routes = {
'241449005': '15-1 | 고양,양주',
'241449011': '15-1구파발 | 고양,서울,양주',
'241449007': '15-1막차 | 고양,서울,양주',
... | code_fim | hard | {
"lang": "python",
"repo": "luaneyed/bus",
"path": "/app.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(result)
if not debug:
log(result)
else:
result += ' - 결과 없음'
print(result)
if __name__ == '__main__':
run()<|fim_prefix|># repo: luaneyed/bus path: /app.py
from datetime import datetime, timedelta
import bus_location
from slack import log
de... | code_fim | medium | {
"lang": "python",
"repo": "luaneyed/bus",
"path": "/app.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reddit/baseplate.py path: /tests/unit/sidecars/live_data_watcher_tests.py
import grp
import json
import os
import pwd
import tempfile
import unittest
from pathlib import Path
import boto3
from moto import mock_s3
from baseplate.sidecars.live_data_watcher import NodeWatcher
class NodeWatcher... | code_fim | hard | {
"lang": "python",
"repo": "reddit/baseplate.py",
"path": "/tests/unit/sidecars/live_data_watcher_tests.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> dest = self.output_dir.joinpath("data.txt")
inst = NodeWatcher(str(dest), os.getuid(), os.getgid(), 777)
new_content = None
inst.on_change(new_content, None)
self.assertEqual(False, os.path.exists(dest))
def test_on_change_new_dir(self):
dest = self.ou... | code_fim | hard | {
"lang": "python",
"repo": "reddit/baseplate.py",
"path": "/tests/unit/sidecars/live_data_watcher_tests.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Creates a PACKAGE_NAME for distribution on the current directory from the given PLUGIN_DIR for the project.
If --dst-path is not provide, the PACKAGE_NAME will be created inside the PLUGIN_DIR folder.
SPECS_PATH Path to where the hook_specs.py file is located.
PACKAGE_NAME Th... | code_fim | hard | {
"lang": "python",
"repo": "ESSS/hookman",
"path": "/hookman/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ESSS/hookman path: /hookman/__main__.py
# -*- coding: utf-8 -*-
"""Console script for hookman."""
import sys
from pathlib import Path
import click
from hookman.hookman_generator import HookManGenerator
@click.group()
def cli():
pass
@cli.command()
@click.argument("specs_path", type=clic... | code_fim | hard | {
"lang": "python",
"repo": "ESSS/hookman",
"path": "/hookman/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class AdversarialNet(Model, CollectionMixin):
def __init__(self, generator, discriminator, n_hidden):
self.generator = generator
self.discriminator = discriminator
self.n_hidden = n_hidden
self.eps = 1e-4
self.collection = [generator, discriminator]
def se... | code_fim | medium | {
"lang": "python",
"repo": "zhengkaifu/deeppy",
"path": "/deeppy/model/adversarial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.generator.params, self.discriminator.params
def update(self, x):
self.x_src.out = x
self._graph.fprop()
self._graph.bprop()
gan_loss = -np.array(self._loss.out)
batch_size = x.shape[0]
d_x_loss = np.mean(gan_loss[:batch_size])
... | code_fim | hard | {
"lang": "python",
"repo": "zhengkaifu/deeppy",
"path": "/deeppy/model/adversarial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zhengkaifu/deeppy path: /deeppy/model/adversarial.py
import numpy as np
import cudarray as ca
from ..base import Model, CollectionMixin
from ..expr.base import UnaryElementWise
from ..input import Input
from .. import expr
class NegativeGradient(UnaryElementWise):
def fprop(self):
s... | code_fim | hard | {
"lang": "python",
"repo": "zhengkaifu/deeppy",
"path": "/deeppy/model/adversarial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def choices(population, weights=None, cum_weights=None, k=1):
if cum_weights is None:
if weights is None:
total = len(population)
return [population[int(random.random() * total)] for i in range(k)]
cum_weights = list(accumulate(weights))
elif weights is not... | code_fim | hard | {
"lang": "python",
"repo": "mgree/smoosh-fuzz",
"path": "/src/scriptGeneration/myrandom.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mgree/smoosh-fuzz path: /src/scriptGeneration/myrandom.py
import random
def accumulate(iterator):
total = 0
for item in iterator:
total += item
yield total
def bisect(a, x, lo=0, hi=None):
<|fim_suffix|> if cum_weights is None:
if weights is None:
... | code_fim | hard | {
"lang": "python",
"repo": "mgree/smoosh-fuzz",
"path": "/src/scriptGeneration/myrandom.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Exit a parse tree produced by propositionalParser#formula.
def exitFormula(self, ctx:propositionalParser.FormulaContext):
pass<|fim_prefix|># repo: ajvarela/amadeus-exploit path: /astLogic/propositionalListener.py
# Generated from astLogic/propositional.g4 by ANTLR 4.7.2
from antlr4 imp... | code_fim | hard | {
"lang": "python",
"repo": "ajvarela/amadeus-exploit",
"path": "/astLogic/propositionalListener.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajvarela/amadeus-exploit path: /astLogic/propositionalListener.py
# Generated from astLogic/propositional.g4 by ANTLR 4.7.2
from antlr4 import *
if __name__ is not None and "." in __name__:
from .propositionalParser import propositionalParser
else:
from propositionalParser import proposit... | code_fim | medium | {
"lang": "python",
"repo": "ajvarela/amadeus-exploit",
"path": "/astLogic/propositionalListener.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elcaminoreal/seashore path: /src/seashore/tests/test_executor.py
# Copyright (c) Shopkick 2017
# See LICENSE for details.
# pragma pylint: disable=too-many-boolean-expressions
# pragma pylint: disable=too-many-return-statements
# pragma pylint: disable=too-many-branches
# pragma pylint: disable=t... | code_fim | hard | {
"lang": "python",
"repo": "elcaminoreal/seashore",
"path": "/src/seashore/tests/test_executor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_none(self):
"""prepare with None option gives undecorated"""
output, _err = self.executor.prepare('do-stuff', 'special', verbose=None).batch()
self.assertEqual(output, 'doing stuff slightly more verbosely')
def test_int(self):
"""prepare with int option st... | code_fim | hard | {
"lang": "python",
"repo": "elcaminoreal/seashore",
"path": "/src/seashore/tests/test_executor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> develop_plugin("%s/data/test_build_plugin" % TEST_DIRECTORY,
"bar", plugins_base_dir=self.base_path)
tmp = get_plugin_info("bar", mode="name",
plugins_base_dir=self.base_path)
self.assertTrue(tmp is not None)
self.assertE... | code_fim | hard | {
"lang": "python",
"repo": "metwork-framework/mfcom",
"path": "/layers/layer1_python3/0100_mfutil/tests/test_plugins.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: metwork-framework/mfcom path: /layers/layer1_python3/0100_mfutil/tests/test_plugins.py
import os
import shutil
from unittest import TestCase
from mfutil.plugins import init_plugins_base, is_plugins_base_initialized, \
get_installed_plugins, get_plugins_base_dir, get_plugin_info, \
build_... | code_fim | hard | {
"lang": "python",
"repo": "metwork-framework/mfcom",
"path": "/layers/layer1_python3/0100_mfutil/tests/test_plugins.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> d = get_plugins_base_dir()
self.assertTrue(d is not None)
def test_empty_installed_plugins(self):
tmp = get_installed_plugins(self.base_path)
self.assertEquals(len(tmp), 0)
def test_not_installed_plugin_info(self):
tmp = get_plugin_info("foo", mode="name",... | code_fim | hard | {
"lang": "python",
"repo": "metwork-framework/mfcom",
"path": "/layers/layer1_python3/0100_mfutil/tests/test_plugins.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_logger.assert_any_call(
logging.INFO,
"received http request with method={}, url={} and body={!r}".format(
incoming_message.method, incoming_message.url, incoming_message.body
),
)
# _handle_post
message = self.get_m... | code_fim | hard | {
"lang": "python",
"repo": "fetchai/agents-aea",
"path": "/tests/test_packages/test_skills/test_http_echo/test_handlers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Test the _handle_invalid method of the http_echo handler."""
# setup
http_dialogue = self.prepare_skill_dialogue(
dialogues=self.http_dialogues,
messages=self.list_of_messages[:1],
)
incoming_message = cast(
HttpMessage,
... | code_fim | hard | {
"lang": "python",
"repo": "fetchai/agents-aea",
"path": "/tests/test_packages/test_skills/test_http_echo/test_handlers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fetchai/agents-aea path: /tests/test_packages/test_skills/test_http_echo/test_handlers.py
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2023 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "... | code_fim | hard | {
"lang": "python",
"repo": "fetchai/agents-aea",
"path": "/tests/test_packages/test_skills/test_http_echo/test_handlers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def rpm_eval(macro):
"""Get value of given macro using rpm tool"""
try:
value = subprocess.Popen(
['rpm', '--eval', macro],
stdout=subprocess.PIPE).communicate()[0].strip()
except OSError:
logger.error('Failed to get value of {0} rpm macro'.format(
... | code_fim | hard | {
"lang": "python",
"repo": "fedora-python/pyp2rpm",
"path": "/pyp2rpm/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def runtime_to_build(runtime_deps):
"""Adds all runtime deps to build deps"""
build_deps = copy.deepcopy(runtime_deps)
for dep in build_deps:
if len(dep) > 0:
dep[0] = 'BuildRequires'
return build_deps
def unique_deps(deps):
"""Remove duplicities from deps list of... | code_fim | hard | {
"lang": "python",
"repo": "fedora-python/pyp2rpm",
"path": "/pyp2rpm/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fedora-python/pyp2rpm path: /pyp2rpm/utils.py
import contextlib
import functools
import locale
import logging
import os
import subprocess
import sys
import re
import copy
import itertools
try:
import rpm
except ImportError:
rpm = None
logger = logging.getLogger(__name__)
PY3 = sys.vers... | code_fim | hard | {
"lang": "python",
"repo": "fedora-python/pyp2rpm",
"path": "/pyp2rpm/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: craigderington/Beacon path: /radio/admin.py
from django.contrib import admin
from radio.models import Radio, Channel
# Register your models here.
class RadioStack(admin.StackedInline):
model = Channel
fk_name = 'radio_channel'
extra = 1
class RadioAdmin(admin.ModelAdmin):
fields... | code_fim | medium | {
"lang": "python",
"repo": "craigderington/Beacon",
"path": "/radio/admin.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> verbose_name = 'Channel'
verbose_name_plural = 'Channels'
ordering = ['-radio_channel_call_sign']
admin.site.register(Radio, RadioAdmin)
admin.site.register(Channel, ChannelAdmin)<|fim_prefix|># repo: craigderington/Beacon path: /radio/admin.py
from django.contrib import admin
fr... | code_fim | medium | {
"lang": "python",
"repo": "craigderington/Beacon",
"path": "/radio/admin.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: underflow101/code-example path: /ps/shortest_path/futureCity.py
# futureCity.py
# book p.259
import sys
from collections import deque
from heapq import heappush, heappop
input = sys.stdin.readline
INF = int(1e9)
n, m = map(int, input().split())
graph = [[INF] * (n+1) for _ in range(n+1)]
<|fim... | code_fim | medium | {
"lang": "python",
"repo": "underflow101/code-example",
"path": "/ps/shortest_path/futureCity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>for k in range(1, n+1):
for a in range(1, n+1):
for b in range(1, n+1):
graph[a][b] = min(graph[a][b], graph[a][k] + graph[k][b])
distance = graph[1][k] + graph[k][x]
if distance >= INF:
print('-1')
else:
print(distance)<|fim_prefix|># repo: underflow101/code-example pat... | code_fim | medium | {
"lang": "python",
"repo": "underflow101/code-example",
"path": "/ps/shortest_path/futureCity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>shots = [
(2, 3),
(5, 4),
(6, 4),
(1, 5),
(7, 5),
(9, 5),
(3, 6),
(9, 6),
(0, 7),
(1, 7),
(7, 7),
]
#for shot in shots:
#board.process_hit(*shot)
p1 = 'xXx_meme_lol_420_xXx'
p2 = '.:n0sc0p3r0b1n:.'
gimma = Game(p1, p2)
gimma.setup_board(p1, ships)
gimma.s... | code_fim | medium | {
"lang": "python",
"repo": "RobinSikkens/pybattleships",
"path": "/testboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#for shot in shots:
#board.process_hit(*shot)
p1 = 'xXx_meme_lol_420_xXx'
p2 = '.:n0sc0p3r0b1n:.'
gimma = Game(p1, p2)
gimma.setup_board(p1, ships)
gimma.setup_board(p2, deepcopy(ships))
assert gimma.start_game()<|fim_prefix|># repo: RobinSikkens/pybattleships path: /testboard.py
from copy import ... | code_fim | hard | {
"lang": "python",
"repo": "RobinSikkens/pybattleships",
"path": "/testboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RobinSikkens/pybattleships path: /testboard.py
from copy import deepcopy
from bottleships.ship import Ship, ShotResult
from bottleships.board import Board
from bottleships.game import Game
#s = Ship.parse_notation('(B3, H, 3)')
#fields = s.fields
#for field in s.fields:
#print(s.process_hit... | code_fim | hard | {
"lang": "python",
"repo": "RobinSikkens/pybattleships",
"path": "/testboard.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.trace()
code = code.replace( '-', '_' )
domain = domain.replace( 'http://', '' )
self.wikis[code + family] = (code, family, domain, special, locked, private)
self.domains[domain] = code + family
if family not in self.families:
self.families.append( family )
###################
... | code_fim | hard | {
"lang": "python",
"repo": "reviforks/stewbot",
"path": "/stewbot/components/Wikimedia.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: reviforks/stewbot path: /stewbot/components/Wikimedia.py
#######################################################
## Wikimedia.Browser
## Extends Browser with methods for listing or linking to Wikimedia wikis,
## converting between prefixes and URL, and checking whether a wiki is locked
## or inte... | code_fim | hard | {
"lang": "python",
"repo": "reviforks/stewbot",
"path": "/stewbot/components/Wikimedia.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.trace()
super( Browser, self ).reset()
self.loadWikis( from_cache = False )
###################
## Store wiki data
###################
def storeWiki( self, code, family, domain, special = False, locked = False, private = False ):
self.trace()
code = code.replace( '-', '_' )
domain... | code_fim | hard | {
"lang": "python",
"repo": "reviforks/stewbot",
"path": "/stewbot/components/Wikimedia.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: subburajs/Udacity-Deep-Learning-ND101 path: /02_Neural_Networks/L2_16_Implementing_Backpropagation_my.py
import numpy as np
from data_prep import features, targets, features_test, targets_test
np.random.seed(21)
# Activation function
def sigmoid(x):
return 1./(1. + np.exp(-x))
# Neural Net... | code_fim | hard | {
"lang": "python",
"repo": "subburajs/Udacity-Deep-Learning-ND101",
"path": "/02_Neural_Networks/L2_16_Implementing_Backpropagation_my.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Calculate accuracy on test data
hidden_out = sigmoid(np.dot(features_test, weights_input_hidden))
output_out = sigmoid(np.dot(hidden_out, weights_hidden_output))
predictions = output_out > 0.5 # When sigmoid > 0.5, that is logical "1"; below 0.5 is logical "0".
accuracy = np.mean(predictions == tar... | code_fim | hard | {
"lang": "python",
"repo": "subburajs/Udacity-Deep-Learning-ND101",
"path": "/02_Neural_Networks/L2_16_Implementing_Backpropagation_my.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: michielkauwatjoe/flat path: /flat/scene.py
from math import cos, pi, sin, sqrt
from multiprocessing import Pool
from random import choice, random
from time import time
from .image import raw
def _vector(x, y, z):
return float(x), float(y), float(z)
def _vector_neg(a):
x, y, z = a
... | code_fim | hard | {
"lang": "python",
"repo": "michielkauwatjoe/flat",
"path": "/flat/scene.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.reflectance = _vector(*reflectance)
self.emittance = _vector(*emittance) if emittance else _zero
self.max = max(reflectance)
def scatter(self, direction, tangent, leg, normal, u0, u1):
phi = 2.0*pi*u0
r = sqrt(u1)
x = r*cos(phi)
y = r*s... | code_fim | hard | {
"lang": "python",
"repo": "michielkauwatjoe/flat",
"path": "/flat/scene.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # checkt for overlay/schedule option
if self.getSchedule():
try:
def generate(event):
''' return all available insert names for event '''
# get list of persons from event
persons = event.findall("perso... | code_fim | hard | {
"lang": "python",
"repo": "CybernetiX-S3C/voctomix",
"path": "/voctocore/lib/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CybernetiX-S3C/voctomix path: /voctocore/lib/config.py
#!/usr/bin/env python3
import os.path
import logging
from configparser import DuplicateSectionError
from lib.args import Args
from vocto.config import VocConfigParser
import xml.etree.ElementTree as ET
from datetime import date, datetime, tim... | code_fim | hard | {
"lang": "python",
"repo": "CybernetiX-S3C/voctomix",
"path": "/voctocore/lib/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> except cloudwatch_client.exceptions.DataAlreadyAcceptedException as e:
return e.response['Error']['Message'].rsplit(maxsplit=1)[1]
def try_put_log_events(group_name: str, stream_name: str, log_events: typing.List[dict], sequence_token: typing.Optional[str]) -> str:
kwargs = {}
if seq... | code_fim | hard | {
"lang": "python",
"repo": "nelsestu/thing-expert",
"path": "/cloud/src/baseline_cloud/ingest/clients/log.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nelsestu/thing-expert path: /cloud/src/baseline_cloud/ingest/clients/log.py
import traceback
import typing
import boto3
import baseline_cloud.core.aws.redis
import baseline_cloud.core.mqtt
from baseline_cloud import core
from baseline_cloud.core import aws
from baseline_cloud.core.config import... | code_fim | hard | {
"lang": "python",
"repo": "nelsestu/thing-expert",
"path": "/cloud/src/baseline_cloud/ingest/clients/log.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WolfwithSword/WWS-Cogs path: /HungerGames/enums.py
from enum import Enum
class GenderEnum(Enum):
MALE: str = "he"
FEMALE: str = "she"
OTHER: str = "they"
<|fim_suffix|> NO_GAME = 0x0
GAME_EXISTS = 0x1
GAME_STARTED = 0x2
GAME_FULL = 0x3
PLAYER_EXISTS = 0x4
CHAR... | code_fim | medium | {
"lang": "python",
"repo": "WolfwithSword/WWS-Cogs",
"path": "/HungerGames/enums.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> NO_GAME = 0x0
GAME_EXISTS = 0x1
GAME_STARTED = 0x2
GAME_FULL = 0x3
PLAYER_EXISTS = 0x4
CHAR_LIMIT = 0x5
NOT_OWNER = 0x6
INVALID_GROUP = 0x7
NOT_ENOUGH_PLAYERS = 0x8
GAME_NOT_STARTED = 0x9
PLAYER_DOES_NOT_EXIST = 0xA<|fim_prefix|># repo: WolfwithSword/WWS-Cogs p... | code_fim | medium | {
"lang": "python",
"repo": "WolfwithSword/WWS-Cogs",
"path": "/HungerGames/enums.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>site = Site(None)
builder = SiteBuilder(site)
a = builder.hasChanged(__file__)
b = builder.hasChanged(__file__)
c = builder.hasChanged(__file__)
d = builder.hasChanged(os.path.abspath(__file__))
print a
print b
print c
print d
assert a == b == c == d == True
builder.changed = {}
a = builder.hasChanged(_... | code_fim | medium | {
"lang": "python",
"repo": "gsdu8g9/tahchee",
"path": "/Tests/S001-Change.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>assert a == b == c == d == True
builder.changed = {}
a = builder.hasChanged(__file__)
b = builder.hasChanged(__file__)
c = builder.hasChanged(__file__)
d = builder.hasChanged(os.path.abspath(__file__))
print a
print b
print c
print d
assert a == b == c == d == False
print "OK"
# EOF<|fim_prefix|># repo... | code_fim | hard | {
"lang": "python",
"repo": "gsdu8g9/tahchee",
"path": "/Tests/S001-Change.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gsdu8g9/tahchee path: /Tests/S001-Change.py
#!/usr/bin/env python
# vim: tw=80 ts=4 sw=4 noet
# -----------------------------------------------------------------------------
# Project : Tahchee
# -----------------------------------------------------------------------------
import sys, os
sys.p... | code_fim | hard | {
"lang": "python",
"repo": "gsdu8g9/tahchee",
"path": "/Tests/S001-Change.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>db.bind('sqlite', 'example_relations.sqlite', create_db=True)
db.generate_mapping(create_tables=True)<|fim_prefix|># repo: matiaslee/pony_orm path: /relations.py
from pony.orm import Database, Required, Optional, Set
db = Database()
class Materia(db.Entity):
<|fim_middle|> nombre = Required(str)
... | code_fim | medium | {
"lang": "python",
"repo": "matiaslee/pony_orm",
"path": "/relations.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matiaslee/pony_orm path: /relations.py
from pony.orm import Database, Required, Optional, Set
<|fim_suffix|> nombre = Required(str)
materias = Set(Materia)
db.bind('sqlite', 'example_relations.sqlite', create_db=True)
db.generate_mapping(create_tables=True)<|fim_middle|>db = Database()
... | code_fim | medium | {
"lang": "python",
"repo": "matiaslee/pony_orm",
"path": "/relations.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matiaslee/pony_orm path: /relations.py
from pony.orm import Database, Required, Optional, Set
db = Database()
class Materia(db.Entity):
nombre = Required(str)
profesores = Set("Profesor")
<|fim_suffix|> nombre = Required(str)
materias = Set(Materia)
db.bind('sqlite', 'example... | code_fim | easy | {
"lang": "python",
"repo": "matiaslee/pony_orm",
"path": "/relations.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: avkhadiev/bbtoDijet path: /SimpleHLTAnalyzer/test/crab_config_bTagDijetV11.py
############################
# #
# JetHT Run 2016B #
# #
############################
from CRABClient.UserUtilities import config, getUsernameFromSiteDB
config... | code_fim | medium | {
"lang": "python",
"repo": "avkhadiev/bbtoDijet",
"path": "/SimpleHLTAnalyzer/test/crab_config_bTagDijetV11.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># section JobType
config.JobType.pluginName = 'Analysis'
config.JobType.psetName = 'hlt_bTagDijetV11.py'
config.JobType.outputFiles = ['hlt_bTagDijetV11.root']
config.JobType.numCores = 16
# section Data
config.Data.inputDataset = '/JetHT/Run2016B-PromptReco-v2/AOD' # '/HLTPhysics/Run2016B-PromptReco-v2/A... | code_fim | hard | {
"lang": "python",
"repo": "avkhadiev/bbtoDijet",
"path": "/SimpleHLTAnalyzer/test/crab_config_bTagDijetV11.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># For information on config parameters, see
# https://twiki.cern.ch/twiki/bin/view/CMSPublic/CRAB3ConfigurationFile
# section General
config.General.requestName = name
config.General.workArea = 'crab_test_' + name
config.General.transferOutputs = True
config.General.transferLogs = True
# section JobType... | code_fim | medium | {
"lang": "python",
"repo": "avkhadiev/bbtoDijet",
"path": "/SimpleHLTAnalyzer/test/crab_config_bTagDijetV11.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> class LayerMock:
def group_send(self):
pass
def test_build_status_message_is_sent_to_the_channel_layer(self):
sync_call = Mock()
layer = self.LayerMock()
with freeze_time(), patch('src.server.oasisapi.queues.consumers.get_channel_layer', return_value=l... | code_fim | medium | {
"lang": "python",
"repo": "OasisLMF/OasisPlatform",
"path": "/src/server/oasisapi/queues/tests/test_send_task_status_message.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OasisLMF/OasisPlatform path: /src/server/oasisapi/queues/tests/test_send_task_status_message.py
from unittest.mock import Mock, patch
from django.test import TestCase
from freezegun import freeze_time
from src.server.oasisapi.queues.consumers import build_task_status_message, send_task_status_m... | code_fim | medium | {
"lang": "python",
"repo": "OasisLMF/OasisPlatform",
"path": "/src/server/oasisapi/queues/tests/test_send_task_status_message.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jatinarora2409/scout-scripts path: /scoutcli/utils/aws.py
import math
from executor import execute
class Instance:
@staticmethod
def get_private_ip():
# not sure what will happen to the case with multiple network interfaces
return execute('curl http://169.254.169.254/la... | code_fim | hard | {
"lang": "python",
"repo": "jatinarora2409/scout-scripts",
"path": "/scoutcli/utils/aws.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mem_gb = int(math.ceil(float(execute('cat /proc/meminfo | grep -i memtotal', capture=True, silent=True).split(' ')[-2]) / 1048576))
return mem_gb<|fim_prefix|># repo: jatinarora2409/scout-scripts path: /scoutcli/utils/aws.py
import math
from executor import execute
class Instance:
... | code_fim | hard | {
"lang": "python",
"repo": "jatinarora2409/scout-scripts",
"path": "/scoutcli/utils/aws.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def get_instance_type():
return execute('curl http://169.254.169.254/latest/meta-data/instance-type', capture=True, silent=True)
@staticmethod
def get_instance_id():
return execute('curl http://169.254.169.254/latest/meta-data/instance-id', capture=True, sile... | code_fim | medium | {
"lang": "python",
"repo": "jatinarora2409/scout-scripts",
"path": "/scoutcli/utils/aws.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bedia-tv/lippy path: /Lipreading_PyTorch/models/conv_backend.py
from torch import max as t_max
from torch.nn import (
BatchNorm1d, Conv1d, CrossEntropyLoss, Linear, MaxPool1d, Module)
from torch.nn.functional import relu
def _validate(model_output, labels):
_maxvalues, maxindices = t_ma... | code_fim | hard | {
"lang": "python",
"repo": "bedia-tv/lippy",
"path": "/Lipreading_PyTorch/models/conv_backend.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> transposed = forward_input.transpose(1, 2).contiguous()
output = self.conv1(transposed)
output = self.norm1(output)
output = relu(output)
output = self.pool1(output)
output = self.conv2(output)
output = self.norm2(output)
output = relu(outpu... | code_fim | hard | {
"lang": "python",
"repo": "bedia-tv/lippy",
"path": "/Lipreading_PyTorch/models/conv_backend.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> path('client/', views.client_list, name='client_list'),
path('client/add/', views.client_add, name='client_add'),
path('client/<int:pk>/', views.ClientDetailView.as_view(), name='client_view'),
path('client/<int:pk>/edit/', views.client_edit, name='client_edit'),
path('client/<int:pk>/... | code_fim | hard | {
"lang": "python",
"repo": "nahidsaikat/scrumate",
"path": "/scrumate/people/urls.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nahidsaikat/scrumate path: /scrumate/people/urls.py
from django.urls import path
from scrumate.people import views
urlpatterns = [
# Accounts
path('profile/', views.profile, name='profile'),
path('change_password/', views.change_password, name='change_password'),
# Settings
... | code_fim | hard | {
"lang": "python",
"repo": "nahidsaikat/scrumate",
"path": "/scrumate/people/urls.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dsfb/bjorncrm path: /contacts/migrations/0005_auto_20180716_1029.py
# Generated by Django 2.0.7 on 2018-07-16 13:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contacts', '0004_auto_20180713_1659'),
]
operations = [
... | code_fim | hard | {
"lang": "python",
"repo": "dsfb/bjorncrm",
"path": "/contacts/migrations/0005_auto_20180716_1029.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>, verbose_name='Ocupação'),
),
migrations.AlterField(
model_name='endereco',
name='cep',
field=models.CharField(blank=True, max_length=9, null=True, verbose_name='CEP'),
),
migrations.AlterField(
model_name='endereco',
... | code_fim | hard | {
"lang": "python",
"repo": "dsfb/bjorncrm",
"path": "/contacts/migrations/0005_auto_20180716_1029.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Julikins/orb path: /orb_core.py
"""
Use the following link to add the bot:
https://discordapp.com/oauth2/authorize?client_id=569758271930368010&scope=bot&permissions=64
"""
# Get prefixes
def get_prefix(bot, message):
PREFIXES = ["orb.", "o."]
return bot_commands.when_mentioned_or(*PREFI... | code_fim | hard | {
"lang": "python",
"repo": "Julikins/orb",
"path": "/orb_core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Awoo react
elif re.search(r"\b(awoo+)\b", message.content, re.IGNORECASE):
await message.add_reaction("🇦")
await message.add_reaction("🇼")
await message.add_reaction("🇴")
await message.add_reaction("🅾")
print("Reacted with 'awoo' to message '" + messag... | code_fim | hard | {
"lang": "python",
"repo": "Julikins/orb",
"path": "/orb_core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luhn/limited path: /limited/backend/__init__.py
import importlib
from typing import Dict, Type
from .backend import Backend
BUILTIN_BACKENDS: Dict[str, str] = {
'memory': '.memory.MemoryBackend',
'redis': '.redis.RedisBackend',
'dynamodb': '.dynamodb.DynamoDBBackend',
}
<|fim_suff... | code_fim | hard | {
"lang": "python",
"repo": "luhn/limited",
"path": "/limited/backend/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.