text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> self.assertEqual(uf.find(1), 1)
self.assertEqual(uf.find(2), 1)
self.assertEqual(uf.find(3), 1)
self.assertEqual(uf.find(4), 1)
self.assertEqual(uf.find(5), 1)
if __name__ == '__main__':
unittest.main()<|fim_prefix|># repo: santoshpy/algorithms-1 path: /test_u... | code_fim | medium | {
"lang": "python",
"repo": "santoshpy/algorithms-1",
"path": "/test_union_find.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @strawberry.field
def pages(self, info, code: str) -> List[PageType]:
return Page.published_pages.filter(conference__code=code)
@strawberry.field
def page(self, info, code: str, slug: str) -> Optional[PageType]:
return Page.published_pages.by_slug(slug).filter(conference__... | code_fim | hard | {
"lang": "python",
"repo": "pythonitalia/pycon",
"path": "/backend/api/pages/schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pythonitalia/pycon path: /backend/api/pages/schema.py
from typing import List, Optional
import strawberry
from pages.models import Page
<|fim_suffix|> @strawberry.field
def page(self, info, code: str, slug: str) -> Optional[PageType]:
return Page.published_pages.by_slug(slug).fil... | code_fim | hard | {
"lang": "python",
"repo": "pythonitalia/pycon",
"path": "/backend/api/pages/schema.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return Page.published_pages.by_slug(slug).filter(conference__code=code).first()<|fim_prefix|># repo: pythonitalia/pycon path: /backend/api/pages/schema.py
from typing import List, Optional
import strawberry
from pages.models import Page
from .types import Page as PageType
@strawberry.type
cla... | code_fim | hard | {
"lang": "python",
"repo": "pythonitalia/pycon",
"path": "/backend/api/pages/schema.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: congge666/starkex-for-spot-trading path: /src/starkware/python/random_test.py
import functools
import inspect
import os
import random
import sys
from typing import Callable, List, Optional
import pytest
from mypy_extensions import NamedArg
def _get_seeds(n_nightly_runs: int, seed: Optional[int... | code_fim | hard | {
"lang": "python",
"repo": "congge666/starkex-for-spot-trading",
"path": "/src/starkware/python/random_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> The test will print the seed upon failure.
Can also receive a seed to fixate the test with. If it got a seed, it will run the test once
with that seed even on nightly runs.
The seed can also be fixed by setting the `RANDOM_TEST_SEED` environment variable to the desired
seed. If it is ... | code_fim | hard | {
"lang": "python",
"repo": "congge666/starkex-for-spot-trading",
"path": "/src/starkware/python/random_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rainzhop/cumulus-tank path: /coolshell-puzzle-answers/8-Excel Column.py
cha = 'A'
chalist = []
numlist = []
chadic = {}
for i in range(0, 26):
C = chr(ord(cha)+i)
chalist.append(C)
numlist.append(i+1)
chadic[C] = i+1
up = "COOLSHELL"
down = "SHELL"
<|fim_suffix|>upn = str2num(u... | code_fim | medium | {
"lang": "python",
"repo": "rainzhop/cumulus-tank",
"path": "/coolshell-puzzle-answers/8-Excel Column.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = ''
while(n != 0):
a = n % 26
s = chr(ord('A') + a - 1) + s
n = int(n / 26)
return s
print(num2str(res))<|fim_prefix|># repo: rainzhop/cumulus-tank path: /coolshell-puzzle-answers/8-Excel Column.py
cha = 'A'
chalist = []
numlist = []
chadic = {}
for i in range(0, ... | code_fim | medium | {
"lang": "python",
"repo": "rainzhop/cumulus-tank",
"path": "/coolshell-puzzle-answers/8-Excel Column.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: comodit/comodit-client path: /comodit_client/api/entity.py
# coding: utf-8
"""
Provides entities base class (L{Entity}).
"""
from __future__ import print_function
import os
from comodit_client.util.json_wrapper import JsonWrapper
import comodit_client.util.path as path
class Entity(JsonWrapper... | code_fim | hard | {
"lang": "python",
"repo": "comodit/comodit-client",
"path": "/comodit_client/api/entity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @rtype: string
"""
return self._get_field("description")
@description.setter
def description(self, description):
"""
Sets the description of this entity.
@param description: The new description.
@type description: string
"""
... | code_fim | hard | {
"lang": "python",
"repo": "comodit/comodit-client",
"path": "/comodit_client/api/entity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greenkidneybean/BASIC path: /BASIC.py
def extend_right(s, d, verb, rl):
while 1:
table = splitread(s, rl)
edges = [sys.maxsize]
best_c = 0
best_k = ''
try:
cache_dict = {k: v for (k, v) in d.iteritems() if table[-1] in k}
except Attri... | code_fim | hard | {
"lang": "python",
"repo": "greenkidneybean/BASIC",
"path": "/BASIC.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if single == 1:
if results.VERBOSE == True: print('Using Bowtie2 to find initial seeds:')
try:
cmd = results.bowtie + "/bowtie2 --very-sensitive --quiet --norc --no-hd -x " + database + results.genome + "_ighv " + \
"--threads " + results.constant_value + " -U " + results.FA... | code_fim | hard | {
"lang": "python",
"repo": "greenkidneybean/BASIC",
"path": "/BASIC.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
cmd = results.bowtie + "/bowtie2 --very-sensitive --quiet --norc --no-hd -x " + database + results.genome + "_iglv " + \
"--threads " + results.constant_value + " -U " + results.FASTQ + " | awk -F'\t' '{print $10\"\t\"$3\"\t\"$6\"\t\"$4}' >" + output_location + "/" + tmp_... | code_fim | hard | {
"lang": "python",
"repo": "greenkidneybean/BASIC",
"path": "/BASIC.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = "Read Write Multiple Exception"
fields_desc = [XByteField("funcCode", 0x97),
ByteEnumField("exceptCode", 1, _modbus_exceptions)]
class ModbusPDU18ReadFIFOQueueRequest(Packet):
name = "Read FIFO Queue"
fields_desc = [XByteField("funcCode", 0x18),
... | code_fim | hard | {
"lang": "python",
"repo": "i2tResearch/Ciberseguridad_web",
"path": "/Botnets/App/App Web/PDG-env/lib/python3.6/site-packages/scapy/contrib/modbus.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># テキストを処理する
doc = ____
# docの固有表現を表示
print(____)<|fim_prefix|># repo: matsurih/spacy-course path: /exercises/ja/exc_03_16_02.py
import spacy
nlp = spacy.load("ja_core_news_sm")
text = (
"チックフィレイはジョージア州カレッジパークに本社を置く、"
"チキンサンドを専門とするアメリカのファス<|fim_middle|>トフードレストランチェーンです。"
)
# parserを無効... | code_fim | medium | {
"lang": "python",
"repo": "matsurih/spacy-course",
"path": "/exercises/ja/exc_03_16_02.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matsurih/spacy-course path: /exercises/ja/exc_03_16_02.py
import spacy
nlp = spacy.load("ja_core_news_sm")
text = (
"チックフィレイはジョージア州カレッジパークに本社を置く、"
"チキンサンドを専門とするアメリカのファス<|fim_suffix|># テキストを処理する
doc = ____
# docの固有表現を表示
print(____)<|fim_middle|>トフードレストランチェーンです。"
)
# parserを無効... | code_fim | medium | {
"lang": "python",
"repo": "matsurih/spacy-course",
"path": "/exercises/ja/exc_03_16_02.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>トフードレストランチェーンです。"
)
# parserを無効化
with ____.____(____):
# テキストを処理する
doc = ____
# docの固有表現を表示
print(____)<|fim_prefix|># repo: matsurih/spacy-course path: /exercises/ja/exc_03_16_02.py
import spacy
nlp = spacy.load("ja_core_news_sm")
text = (
<|fim_middle|> "チックフィレイはジョージア州カレッジパークに本社を置く... | code_fim | medium | {
"lang": "python",
"repo": "matsurih/spacy-course",
"path": "/exercises/ja/exc_03_16_02.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>p = kkrparams(params_type='kkr')
p.read_keywords_from_inputcard()<|fim_prefix|># repo: sailfish009/masci-tools path: /tests/files/kkr/import_calc_old_style/test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: skip-file
<|fim_middle|>from __future__ import absolute_import
from masci_tools.io.k... | code_fim | medium | {
"lang": "python",
"repo": "sailfish009/masci-tools",
"path": "/tests/files/kkr/import_calc_old_style/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sailfish009/masci-tools path: /tests/files/kkr/import_calc_old_style/test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: skip-file
<|fim_suffix|>p = kkrparams(params_type='kkr')
p.read_keywords_from_inputcard()<|fim_middle|>from __future__ import absolute_import
from masci_tools.io.k... | code_fim | medium | {
"lang": "python",
"repo": "sailfish009/masci-tools",
"path": "/tests/files/kkr/import_calc_old_style/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.force and os.path.exists(f'{DATA_ROOT}/metrics/S3'):
shutil.rmtree(f'{DATA_ROOT}/metrics/S3')
commands = [
f'mkdir -p {DATA_ROOT}/metrics',
f'cd {DATA_ROOT}/metrics',
f'git clone https://github.com/danieldeutsch/S3',
f'cd... | code_fim | hard | {
"lang": "python",
"repo": "artidoro/sacrerouge",
"path": "/sacrerouge/metrics/s3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> metrics_list = []
index = 0
for summaries in summaries_list:
metrics_list.append([])
for _ in summaries:
metrics_list[-1].append(MetricsDict({
's3': {
'pyr': scores[i... | code_fim | hard | {
"lang": "python",
"repo": "artidoro/sacrerouge",
"path": "/sacrerouge/metrics/s3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: artidoro/sacrerouge path: /sacrerouge/metrics/s3.py
import argparse
import logging
import os
import shutil
from overrides import overrides
from subprocess import Popen, PIPE
from typing import List
from sacrerouge.commands import MetricSetupSubcommand
from sacrerouge.common import DATA_ROOT, Tem... | code_fim | hard | {
"lang": "python",
"repo": "artidoro/sacrerouge",
"path": "/sacrerouge/metrics/s3.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # run it all to verify correctness
self.pg_enable_capture()
self.src_if.add_stream(fragments)
self.pg_start()
packets = self.dst_if.get_capture(len(self.pkt_infos))
self.verify_capture(packets)
self.src_if.assert_nothing_captured()
def test_tim... | code_fim | hard | {
"lang": "python",
"repo": "FDio/vpp",
"path": "/test/test_reassembly.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FDio/vpp path: /test/test_reassembly.py
"""Create input packet stream
:param list packet_sizes: Required packet sizes.
"""
for i in range(0, packet_count):
info = cls.create_packet_info(cls.src_if, cls.src_if)
payload = cls.info_to_payload(info... | code_fim | hard | {
"lang": "python",
"repo": "FDio/vpp",
"path": "/test/test_reassembly.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> packets = self.dst_if.get_capture(len(self.pkt_infos))
self.verify_capture(packets)
self.src_if.assert_nothing_captured()
def test_random(self):
"""random order reassembly"""
fragments = list(self.fragments_400)
shuffle(fragments)
self.pg_enab... | code_fim | hard | {
"lang": "python",
"repo": "FDio/vpp",
"path": "/test/test_reassembly.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.errorhandler(401)
def page_not_found(e):
return jsonResponse(False, 'auth_error')
@app.route('/api', methods=['GET', 'POST'])
def api_actions():
if not Utils.validate_key():
raise abort(401)
action = request.args.get('action', '')
if action == 'public-handle':
... | code_fim | hard | {
"lang": "python",
"repo": "425776024/Learn",
"path": "/pythonlearn/Third-Module/Flask/web_api/api/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 425776024/Learn path: /pythonlearn/Third-Module/Flask/web_api/api/server.py
# -*- coding: utf-8 -*-
import gevent.monkey
import gevent.pywsgi
gevent.monkey.patch_all()
import os
from flask import Flask, abort, request
from lib import (
_settings as Settings,
_dbkit as DBkit,... | code_fim | medium | {
"lang": "python",
"repo": "425776024/Learn",
"path": "/pythonlearn/Third-Module/Flask/web_api/api/server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@app.route('/mongo', methods=['POST', 'GET'])
def mongo_actions():
if not Utils.validate_key():
raise abort(401)
action = request.args.get('action', '')
if action == 'search':
return Mongo.search()
if action == 'delete':
return Mongo.delete()
if actio... | code_fim | hard | {
"lang": "python",
"repo": "425776024/Learn",
"path": "/pythonlearn/Third-Module/Flask/web_api/api/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> host_email = select_host(values['email'], my_window)
print('Configuração de porta de conexão foi um sucesso! Host: {}'.format(host_email))
my_window.Refresh()
# tentativa de coleta de dados da... | code_fim | hard | {
"lang": "python",
"repo": "Joselacerdajunior/csv-converter-and-email-sender",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Joselacerdajunior/csv-converter-and-email-sender path: /main.py
# https://wordtohtml.net/
# https://www.python.org/downloads/
# pip install PySimpleGUI
# pip install python-dotenv
import PySimpleGUI as sg # graphic
import time # timer
import csv # read and write csv
import smtplib # email
f... | code_fim | hard | {
"lang": "python",
"repo": "Joselacerdajunior/csv-converter-and-email-sender",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # tentativa de coleta de dados da planila .csv
try:
print('Iniciando coleta dos dados da tabela .csv')
my_window.Refresh()
with open(name_form) as csv_fil... | code_fim | hard | {
"lang": "python",
"repo": "Joselacerdajunior/csv-converter-and-email-sender",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CMPUT404F16Project/cmput404-project path: /web_api/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-27 19:49
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletio... | code_fim | hard | {
"lang": "python",
"repo": "CMPUT404F16Project/cmput404-project",
"path": "/web_api/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>odels.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='request_sent', to='web_api.Author')),
],
),
migrations.CreateModel(
name='Image',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key... | code_fim | hard | {
"lang": "python",
"repo": "CMPUT404F16Project/cmput404-project",
"path": "/web_api/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scottstout/azure-cli-extensions path: /src/internet-analyzer/azext_internet_analyzer/tests/latest/test_internet-analyzer_scenario.py
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# License... | code_fim | hard | {
"lang": "python",
"repo": "scottstout/azure-cli-extensions",
"path": "/src/internet-analyzer/azext_internet_analyzer/tests/latest/test_internet-analyzer_scenario.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.cmd('internet-analyzer test delete --resource-group "rg1" --profile-name "Profile1" --name "Experiment1"', checks=[
])
self.cmd('internet-analyzer test delete --resource-group "rg1" --profile-name "Profile1" --name "Experiment1"', checks=[
])
# list_by_profile -- l... | code_fim | hard | {
"lang": "python",
"repo": "scottstout/azure-cli-extensions",
"path": "/src/internet-analyzer/azext_internet_analyzer/tests/latest/test_internet-analyzer_scenario.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.cmd('internet-analyzer profile show --name "rg1" --profile-name "Profile1"', checks=[
])
# list -- list
# create_or_update -- create
self.cmd('internet-analyzer test create --resource-group "rg1" --profile-name "Profile1" --name "Experiment1" --description "this is my first... | code_fim | hard | {
"lang": "python",
"repo": "scottstout/azure-cli-extensions",
"path": "/src/internet-analyzer/azext_internet_analyzer/tests/latest/test_internet-analyzer_scenario.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>g import hasher
from judo.functions.random import random_state<|fim_prefix|># repo: Guillemdb/judo path: /judo/functions/__init__.py
"""Functions that define a common api for numpy and pytorch functionality."""
from judo.functions import batching, fractala<|fim_middle|>i, images, notebook, numpy, pytorch... | code_fim | medium | {
"lang": "python",
"repo": "Guillemdb/judo",
"path": "/judo/functions/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Guillemdb/judo path: /judo/functions/__init__.py
"""Functions that define a common api for numpy and pytorch functionality."""
from judo.functions import batching, fractala<|fim_suffix|>g import hasher
from judo.functions.random import random_state<|fim_middle|>i, images, notebook, numpy, pytorch... | code_fim | medium | {
"lang": "python",
"repo": "Guillemdb/judo",
"path": "/judo/functions/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Cria um novo registro
@classmethod
@transaction.atomic
def registrar(cls, aluno=None, eletiva=None):
check_all_errors(cls, aluno, eletiva)
registro = cls.objects.create(aluno=aluno, eletiva=eletiva)
registro.eletiva.vagas_usadas = F('vagas_usadas') + 1
re... | code_fim | hard | {
"lang": "python",
"repo": "flavioVitoriano/EletivasPro",
"path": "/eletivaspro/backend/models/eletiva.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Registro(models.Model):
class Meta:
ordering = ["aluno__nome", "aluno__serie", "aluno__turma"]
aluno = models.ForeignKey(Aluno, on_delete=models.CASCADE, related_name="registros")
eletiva = models.ForeignKey(Eletiva, on_delete=models.CASCADE, related_name="registros")
data ... | code_fim | hard | {
"lang": "python",
"repo": "flavioVitoriano/EletivasPro",
"path": "/eletivaspro/backend/models/eletiva.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flavioVitoriano/EletivasPro path: /eletivaspro/backend/models/eletiva.py
from django.db import models, transaction
from django.db.models import F
from gestao.errors import check_all_errors
from .aluno import Aluno
dias = (
("0", "Dia não definido"),
("1", "Segunda"),
("2", "Terça"),
... | code_fim | hard | {
"lang": "python",
"repo": "flavioVitoriano/EletivasPro",
"path": "/eletivaspro/backend/models/eletiva.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bratah123/v203.4 path: /scripts/quest/q17601s.py
# Created by MechAviv
# Quest ID :: 17601
# [Commerci Republic] In the Name of the Empress
sm.setNpcOverrideBoxChat(1540450)
sm.sendNext("Ah, #e#b#h0##k#n you've come! My apologies for bringing you here on such short notice. Tell me, have you hear... | code_fim | hard | {
"lang": "python",
"repo": "Bratah123/v203.4",
"path": "/scripts/quest/q17601s.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Unhandled Message [47] Packet: 2F 01 00 00 00 B0 83 08 00 00 00 00 00 2E 02 00 00 00 00 00 80 05 BB 46 E6 17 02 00 00
# Unhandled Message [INC_COMMITMENT_MESSAGE] Packet: 09 01 00 00 00 00
sm.startQuest(17601)
sm.completeQuest(17601)
# Unhandled Stat Changed [EXP] Packet: 00 00 00 00... | code_fim | hard | {
"lang": "python",
"repo": "Bratah123/v203.4",
"path": "/scripts/quest/q17601s.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ludica-squamata/BehaviourTreeEditor_v2 path: /backend/__init__.py
from .util import salir
from .eventhandler impo<|fim_suffix|> .Selected import Selected
from .textrect import render_textrect
from .group import WidgetGroup<|fim_middle|>rt EventHandler
from .system import System
from | code_fim | easy | {
"lang": "python",
"repo": "ludica-squamata/BehaviourTreeEditor_v2",
"path": "/backend/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> .Selected import Selected
from .textrect import render_textrect
from .group import WidgetGroup<|fim_prefix|># repo: ludica-squamata/BehaviourTreeEditor_v2 path: /backend/__init__.py
from .util import salir
from .eventhandler impo<|fim_middle|>rt EventHandler
from .system import System
from | code_fim | easy | {
"lang": "python",
"repo": "ludica-squamata/BehaviourTreeEditor_v2",
"path": "/backend/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def validate(self, value):
return len(value) >= self.minimum and len(value) <= self.maximum
class EmailValidator(StringSizeValidator):
def __init__(self):
super(EmailValidator, self).__init__(minimum=8, maximum=100)
def validate(self, value):
return ("@" in value) and... | code_fim | medium | {
"lang": "python",
"repo": "rubbieKelvin/pyput",
"path": "/pyput/validators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return (upper >= self.minupper) and (number >= self.minnumber) and (special >= self.minspecial) and super(PasswordValidator, self).validate(value)
class RangeValidator(Validator):
def __init__(self, from_=0, to=100):
super(RangeValidator, self).__init__()
self.from_ = from_
... | code_fim | hard | {
"lang": "python",
"repo": "rubbieKelvin/pyput",
"path": "/pyput/validators.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rubbieKelvin/pyput path: /pyput/validators.py
from string import ascii_uppercase, punctuation, digits
class Validator:
def validate(self, value) -> bool:
return True
class StringSizeValidator(Validator):
def __init__(self, minimum=0, maximum=20):
super(StringSizeValidato... | code_fim | hard | {
"lang": "python",
"repo": "rubbieKelvin/pyput",
"path": "/pyput/validators.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x1 = Variable(1, name='x1')
x2 = Variable(1, name='x2')
x3 = Variable(1, name='x3')
x4 = AutoDiff.sinh(x1) + AutoDiff.cosh(x2) + AutoDiff.tanh(x3)
assert x4.val == 3.4798759844148099
assert x4.der == {'x1': 1.5430806348152437,
'x2': 1.1752011936... | code_fim | hard | {
"lang": "python",
"repo": "XVQD/cs207-FinalProject",
"path": "/tests/test_elementary_functions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x1 = Variable(1, name='x1')
x2 = AutoDiff.sqrt(x1)
assert x2.val == 1
assert x2.der == {'x1': 0.5}
def test_sigmoid(self):
x1 = Variable(0, name='x1')
x2 = AutoDiff.sigmoid(x1)
assert x2.val == 0.5
assert x2.der == {'x1': 0.25}<|fim_pref... | code_fim | hard | {
"lang": "python",
"repo": "XVQD/cs207-FinalProject",
"path": "/tests/test_elementary_functions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XVQD/cs207-FinalProject path: /tests/test_elementary_functions.py
import pytest
import numpy as np
from AutoDiff.AutoDiff import Variable
from AutoDiff import AutoDiff
class Test_Elementary_functions():
def test_exp(self):
x1 = Variable(1, name='x1')
x2 = Variable(1, name='x... | code_fim | hard | {
"lang": "python",
"repo": "XVQD/cs207-FinalProject",
"path": "/tests/test_elementary_functions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: molly-giddings/curation path: /data_steward/analytics/table_metrics/unioned_ehr_scripts/end_before_begin.py
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_vers... | code_fim | hard | {
"lang": "python",
"repo": "molly-giddings/curation",
"path": "/data_steward/analytics/table_metrics/unioned_ehr_scripts/end_before_begin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>temporal_df['failure_rate'] = round(
100 * temporal_df['wrong_date_rows'] / temporal_df['total_rows'], 1)
temporal_df
condition_occurrence = temporal_df.rename(
columns={"failure_rate": "condition_occurrence"})
condition_occurrence = condition_occurrence[[
"src_hpo_id", "condition_occurrence"... | code_fim | hard | {
"lang": "python",
"repo": "molly-giddings/curation",
"path": "/data_steward/analytics/table_metrics/unioned_ehr_scripts/end_before_begin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif difference_analys == "Good" and value_analys != "Good":
return value_analys
elif value_analys != "Good" and difference_analys != "Good":
text = "%s %s" % (value_analys, difference_analys)
return text<|fim_prefix|># repo: Kvm99/Telegram-Pressurebot path: /helpers/ana... | code_fim | hard | {
"lang": "python",
"repo": "Kvm99/Telegram-Pressurebot",
"path": "/helpers/analytics.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kvm99/Telegram-Pressurebot path: /helpers/analytics.py
def analysis_pressure_value(systolic, diastolic):
"""
take systolic and diastolic and makes recomendation
based on values
"""
systolic, diastolic = int(systolic), int(diastolic)
if systolic > 100 and systolic < 140:
... | code_fim | hard | {
"lang": "python",
"repo": "Kvm99/Telegram-Pressurebot",
"path": "/helpers/analytics.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif difference >= 65:
text = ('''
You shold go to cardiologist,
because your difference between systolic
and diastolic pressure is dangerous
''')
return text
def analysis_result(systolic, diastolic):
# TODO make less inclusion
... | code_fim | hard | {
"lang": "python",
"repo": "Kvm99/Telegram-Pressurebot",
"path": "/helpers/analytics.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>if settings.DEBUG:
import debug_toolbar
urlpatterns += [url(r'^__debug__/', include(debug_toolbar.urls)),]
else:
urlpatterns += [
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT})
]
urlpatterns += [
(r'^static/(?P<path>.*)$', 'django.views.static.serve... | code_fim | medium | {
"lang": "python",
"repo": "LinuxOSsk/Shakal-NG",
"path": "/web/urls_local.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LinuxOSsk/Shakal-NG path: /web/urls_local.py
# -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.conf.urls import include, url
from web.urls import urlpatterns as original_urls
urlpatterns = []
<|fim_suffix|>urlpatterns += original_urls
if not settings.DEBUG:
handle... | code_fim | hard | {
"lang": "python",
"repo": "LinuxOSsk/Shakal-NG",
"path": "/web/urls_local.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _dump_multipart_encoder(body: MultipartEncoder) -> str:
"""Dump MultipartEncoder multipart/form-data Content-Type post_data.
Arguments:
body: MultipartEncoder multipart/formdata post data.
Returns:
String of multipart/form-data post data for logging.
"""
lines =... | code_fim | hard | {
"lang": "python",
"repo": "luyao77/tensorbay-python-sdk",
"path": "/tensorbay/client/log.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def _dump_response(response: Response) -> str:
"""Dump http response.
Arguments:
response: Http response.
Returns:
String of http response for logging.
"""
headers = _dump_headers(response.headers)
content = "N/A"
if "Content-Type" in response.headers:
... | code_fim | hard | {
"lang": "python",
"repo": "luyao77/tensorbay-python-sdk",
"path": "/tensorbay/client/log.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: luyao77/tensorbay-python-sdk path: /tensorbay/client/log.py
# !/usr/bin/env python3
#
# Copyright 2021 Graviti. Licensed under MIT License.
#
"""Logging utility functions.
:meth:`Dump_request_and_response <dump_request_and_response>` dumps http request and response.
"""
import json
from typin... | code_fim | hard | {
"lang": "python",
"repo": "luyao77/tensorbay-python-sdk",
"path": "/tensorbay/client/log.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FranzDiebold/project-euler-solutions path: /test/test_p028_number_spiral_diagonals.py
"""
Problem 28: Number spiral diagonals
https://projecteuler.net/problem=28
Starting with the number 1 and moving to the right
in a clockwise direction a 5 by 5 spiral is formed as follows:
*21*22 23 24*25*... | code_fim | hard | {
"lang": "python",
"repo": "FranzDiebold/project-euler-solutions",
"path": "/test/test_p028_number_spiral_diagonals.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> *21*22 23 24*25*
20 *7* 8 *9*10
19 6 *1* 2 11
18 *5* 4 *3*12
*17*16 15 14*13*
It can be verified that the sum of the numbers on the diagonals is 101.
What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?
"""
def test_get_spiral_diagonal_val... | code_fim | medium | {
"lang": "python",
"repo": "FranzDiebold/project-euler-solutions",
"path": "/test/test_p028_number_spiral_diagonals.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: farizrahman4u/skil-python path: /skil/__init__.py
from skil.base import *
from skil.deployme<|fim_suffix|>spaces import *
from skil.context import *<|fim_middle|>nts import *
from skil.experiments import *
from skil.models import *
from skil.work | code_fim | medium | {
"lang": "python",
"repo": "farizrahman4u/skil-python",
"path": "/skil/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: farizrahman4u/skil-python path: /skil/__init__.py
from skil.base import *
from skil.deployments import *
from skil.experiments import <|fim_suffix|>spaces import *
from skil.context import *<|fim_middle|>*
from skil.models import *
from skil.work | code_fim | easy | {
"lang": "python",
"repo": "farizrahman4u/skil-python",
"path": "/skil/__init__.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>spaces import *
from skil.context import *<|fim_prefix|># repo: farizrahman4u/skil-python path: /skil/__init__.py
from skil.base import *
from skil.deployme<|fim_middle|>nts import *
from skil.experiments import *
from skil.models import *
from skil.work | code_fim | medium | {
"lang": "python",
"repo": "farizrahman4u/skil-python",
"path": "/skil/__init__.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leohuang4977/tvb-ukbb path: /bb_pipeline_tools/bb_UKBB_to_BIDS_converter.py
#!/bin/env python
#
# Script name: bb_UKBB_to_BIDS_converter.py
#
# Description: Script to convert a dataset with Biobank structure into BIDS.
#
# Authors: Fidel Alfaro-Almagro, Stephen M. Smith & Mark Jenkinson
#
# Copyr... | code_fim | hard | {
"lang": "python",
"repo": "leohuang4977/tvb-ukbb",
"path": "/bb_pipeline_tools/bb_UKBB_to_BIDS_converter.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for directory in directories:
directory=directory.replace("@SUBJECT@", subject)
if not os.path.isdir(directory):
logger.info("Creating directory " + directory)
os.makedirs(directory)
else:
logger.info("Directory " + directory + " alr... | code_fim | hard | {
"lang": "python",
"repo": "leohuang4977/tvb-ukbb",
"path": "/bb_pipeline_tools/bb_UKBB_to_BIDS_converter.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: timswyzen/discordTCG path: /cards/Maul.py
#!/user/bin/env python
from cardList import addCard
import mechanics
<|fim_suffix|>#What happens when you play it
async def playFunc(ply, enemy, target):
await mechanics.damage( enemy, 5 )
addCard( NAME, COST, RARITY, DESC, TARGETS, TYPE, playFunc )<... | code_fim | medium | {
"lang": "python",
"repo": "timswyzen/discordTCG",
"path": "/cards/Maul.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#What happens when you play it
async def playFunc(ply, enemy, target):
await mechanics.damage( enemy, 5 )
addCard( NAME, COST, RARITY, DESC, TARGETS, TYPE, playFunc )<|fim_prefix|># repo: timswyzen/discordTCG path: /cards/Maul.py
#!/user/bin/env python
from cardList import addCard
import mechanics
<... | code_fim | medium | {
"lang": "python",
"repo": "timswyzen/discordTCG",
"path": "/cards/Maul.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # if user reached route via GET, return register page
if request.method == "GET":
return render_template("register.html")
# otherwise, if reached via POST i.e. submitting a form...
elif request.method == "POST":
# ensure username was submitted
if not request.fo... | code_fim | hard | {
"lang": "python",
"repo": "Caleb-Ellis/CS50x",
"path": "/pset7/finance/application.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Caleb-Ellis/CS50x path: /pset7/finance/application.py
from cs50 import SQL
from flask import Flask, flash, redirect, render_template, request, session, url_for
from flask_session import Session
from passlib.apps import custom_app_context as pwd_context
from tempfile import gettempdir
from datetim... | code_fim | hard | {
"lang": "python",
"repo": "Caleb-Ellis/CS50x",
"path": "/pset7/finance/application.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ensure password and confirmation are equal
elif request.form.get("password") != request.form.get("confirmPassword"):
return apology("password fields do not match")
# encrypt password
hash = pwd_context.encrypt(request.form.get("password"))
... | code_fim | hard | {
"lang": "python",
"repo": "Caleb-Ellis/CS50x",
"path": "/pset7/finance/application.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benjaminaaron/GO_DILab path: /src/visualize/add_rand_id_to_db.py
import sqlite3
import pandas as pd
import numpy as np
from tqdm import tqdm
DB_PATH = 'data/db.sqlite'
conn = sqlite3.connect(DB_PATH)
c = conn.cursor()
print('[#1] Get number of rows')
c.execute('''SELECT count(*)
F... | code_fim | medium | {
"lang": "python",
"repo": "benjaminaaron/GO_DILab",
"path": "/src/visualize/add_rand_id_to_db.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>i = 1
bar = tqdm(range(nrows//rows_each_time + 1))
for i in bar:
print('Iteration', i)
print('[{}] Get data'.format(i))
data = pd.read_sql_query('''SELECT *
FROM elo_ordered_games
LIMIT ?, ?''',
conn,
... | code_fim | hard | {
"lang": "python",
"repo": "benjaminaaron/GO_DILab",
"path": "/src/visualize/add_rand_id_to_db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('[{}] Write table'.format(i))
data.to_sql(
'games_to_use', con=conn,
if_exists='replace' if i==0 else 'append')
start, end = end, end+rows_each_time<|fim_prefix|># repo: benjaminaaron/GO_DILab path: /src/visualize/add_rand_id_to_db.py
import sqlite3
import pandas as pd
... | code_fim | hard | {
"lang": "python",
"repo": "benjaminaaron/GO_DILab",
"path": "/src/visualize/add_rand_id_to_db.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> regional_summary = PEPPER_VARIANT.RegionalSummaryGenerator(self.chromosome_name, region_start, region_end, ref_seq)
regional_summary.generate_max_insert_summary(all_reads)
candidate_image_summary = regional_summary.generate_summary(all_reads,
... | code_fim | hard | {
"lang": "python",
"repo": "kishwarshafin/pepper",
"path": "/pepper_variant/modules/python/AlignmentSummarizer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kishwarshafin/pepper path: /pepper_variant/modules/python/AlignmentSummarizer.py
from pepper_variant.build import PEPPER_VARIANT
import numpy as np
from pysam import VariantFile
from pepper_variant.modules.python.Options import ImageSizeOptions, AlingerOptions, ConsensCandidateFinder
class Alig... | code_fim | hard | {
"lang": "python",
"repo": "kishwarshafin/pepper",
"path": "/pepper_variant/modules/python/AlignmentSummarizer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # break audio into half-second chunks (to allows keyboard interrupts)
for chunk in make_chunks(seg, 500):
stream.write(chunk._data)
stream.stop_stream()
stream.close()
p.terminate()
def play(audio_segment):
try:
import pyaudio
_play_with_pyaudio(audio_segment)
except ImportError:
... | code_fim | hard | {
"lang": "python",
"repo": "anisridhar/Raga-Identification-Program",
"path": "/pydubtest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anisridhar/Raga-Identification-Program path: /pydubtest.py
import os
import pyaudio
import pydub
from pydub import AudioSegment
"""
Support for playing AudioSegments. Pyaudio will be used if it's installed,
otherwise will fallback to ffplay. Pyaudio is a *much* nicer solution, but
is tricky to in... | code_fim | hard | {
"lang": "python",
"repo": "anisridhar/Raga-Identification-Program",
"path": "/pydubtest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MrKrautee/casper-python-sdk path: /pycspr/serialisation/byte_array/decoder/cl.py
import typing
from pycspr.types import CLType
from pycspr.types import CLType_ByteArray
from pycspr.types import CLType_List
from pycspr.types import CLType_Map
from pycspr.types import CLType_Option
from pycspr.typ... | code_fim | hard | {
"lang": "python",
"repo": "MrKrautee/casper-python-sdk",
"path": "/pycspr/serialisation/byte_array/decoder/cl.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def decode_u256(as_bytes: typing.List[int]) -> int:
"""Decodes an unsigned 256 bit integer.
"""
size = as_bytes[0]
if size <= NUMERIC_CONSTRAINTS[CLTypeKey.U8].LENGTH:
return decode_u8(as_bytes[1:])
elif size <= NUMERIC_CONSTRAINTS[CLTypeKey.U32].LENGTH:
return de... | code_fim | hard | {
"lang": "python",
"repo": "MrKrautee/casper-python-sdk",
"path": "/pycspr/serialisation/byte_array/decoder/cl.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Decodes a public key.
"""
raise NotImplementedError()
def decode_result(as_bytes: typing.List[int]):
"""Decodes a smart contract execution result.
"""
raise NotImplementedError()
def decode_string(as_bytes: typing.List[int]) -> str:
"""Decodes a string.
... | code_fim | hard | {
"lang": "python",
"repo": "MrKrautee/casper-python-sdk",
"path": "/pycspr/serialisation/byte_array/decoder/cl.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yasserglez/pytiger2c path: /packages/pytiger2c/ast/recordliteralexpressionnode.py
# -*- coding: utf-8 -*-
"""
Clase C{RecordLiteralExpressionNode} del árbol de sintáxis abstracta.
"""
from pytiger2c.ast.valuedexpressionnode import ValuedExpressionNode
from pytiger2c.types.recordtype import Reco... | code_fim | hard | {
"lang": "python",
"repo": "yasserglez/pytiger2c",
"path": "/packages/pytiger2c/ast/recordliteralexpressionnode.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @type type_name: C{str}
@param type_name: Nombre del tipo record que se quiere crear.
@type fields_names: C{list}
@param fields_names: Lista con los nombres de los campos del record, en
el mismo orden en que aparecen en el programa.
... | code_fim | hard | {
"lang": "python",
"repo": "yasserglez/pytiger2c",
"path": "/packages/pytiger2c/ast/recordliteralexpressionnode.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: oms1226/20180811_mstrading path: /Event/OPT10079.py
# coding:utf-8
'''
주식 틱차트 조회 요청
'''
class OPT10079:
def receiveTrData(self, screenNo, requestName, trCode, recordName, inquiry, deprecated1, deprecated2, deprecated3, deprecated4):
# getCommDataEx로 한번에 받아오는 방법
data = self.ge... | code_fim | medium | {
"lang": "python",
"repo": "oms1226/20180811_mstrading",
"path": "/Event/OPT10079.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(type(self.data))
print(self.data.head(5))
""" commGetData
cnt = self.getRepeatCnt(trCode, requestName)
for i in range(cnt):
date = self.commGetData(trCode, "", requestName, i, "일자")
open = self.commGetData(trCode, "", requestName, i, ... | code_fim | hard | {
"lang": "python",
"repo": "oms1226/20180811_mstrading",
"path": "/Event/OPT10079.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rstms/pycloudsigma path: /src/testing/acceptance/test_subscriptions.py
import os
import unittest
from nose.plugins.attrib import attr
import cloudsigma.resource as cr
from testing.utils import DumpResponse
<|fim_suffix|> client = cr.Subscriptions()
with DumpResponse(clients=[cli... | code_fim | hard | {
"lang": "python",
"repo": "rstms/pycloudsigma",
"path": "/src/testing/acceptance/test_subscriptions.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with DumpResponse(clients=[client])('subscription_schema'):
client.get_schema()
def test_subscription_create(self):
if os.environ.get('TURLO_MANUAL_TESTS', '0') == '0':
raise unittest.SkipTest(
"Subscriptions cannot be deleted by the user so thi... | code_fim | hard | {
"lang": "python",
"repo": "rstms/pycloudsigma",
"path": "/src/testing/acceptance/test_subscriptions.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@bp.route('/zones/<string:zone>/records/<int:id>', methods=['POST'])
@api_auth
def zone_records_update(zone, id):
user_id = None if current_user.admin else current_user.id
domain = None
zone_id = None
if zone.isdigit():
zone_id = int(zone)
else:
domain = zone
ret... | code_fim | hard | {
"lang": "python",
"repo": "Excloudx6/SnitchDNS",
"path": "/app/controllers/api/records.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Excloudx6/SnitchDNS path: /app/controllers/api/records.py
from . import bp
from app.lib.base.decorators import api_auth
from app.lib.api.records import ApiRecords
from flask_login import current_user
@bp.route('/zones/<string:zone>/records', methods=['GET'])
@api_auth
def zone_records(zone):
... | code_fim | hard | {
"lang": "python",
"repo": "Excloudx6/SnitchDNS",
"path": "/app/controllers/api/records.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print 'Calculating verb frequencies...'
database.execute_sql("""
UPDATE """+Frame._meta.db_table+""" AS f
SET """+Frame.verbFrequency.db_column+""" =
(SELECT """+Verb.frequency.db_column+"""
FROM """+Verb._meta.db_table+""" AS v
WHERE v."""+Verb.id.d... | code_fim | medium | {
"lang": "python",
"repo": "adzanette/scf-extractor",
"path": "/scf-extractor/statistics/VerbFrequency.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adzanette/scf-extractor path: /scf-extractor/statistics/VerbFrequency.py
from models.scf import Frame, Verb, database
## This class calculates verb frequency for each frame
# @author Adriano Zanette
# @version 1.0
class VerbFrequency:
<|fim_suffix|> print 'Calculating verb frequencies...'
... | code_fim | medium | {
"lang": "python",
"repo": "adzanette/scf-extractor",
"path": "/scf-extractor/statistics/VerbFrequency.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>imageArray=([img,imgGray,imgBlur,imgCanny],
[imgCounters,imageBlank,imageBlank,imageBlank])
imgStacked=hp.stackImages(imageArray,0.5)
#cv2.imshow("Original",img)
#cv2.imshow("Gray",imgGray)
#cv2.imshow("Blur",imgBlur)
#cv2.imshow("Canny",imgCanny)
cv2.imshow("Stacked Images",imgStacked)
cv2.... | code_fim | hard | {
"lang": "python",
"repo": "6895mahfuzgit/MCQ_Automated_Grading_App",
"path": "/Main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>imageBlank=np.zeros_like(img)
imageArray=([img,imgGray,imgBlur,imgCanny],
[imgCounters,imageBlank,imageBlank,imageBlank])
imgStacked=hp.stackImages(imageArray,0.5)
#cv2.imshow("Original",img)
#cv2.imshow("Gray",imgGray)
#cv2.imshow("Blur",imgBlur)
#cv2.imshow("Canny",imgCanny)
cv2.imshow("S... | code_fim | hard | {
"lang": "python",
"repo": "6895mahfuzgit/MCQ_Automated_Grading_App",
"path": "/Main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 6895mahfuzgit/MCQ_Automated_Grading_App path: /Main.py
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 15 22:31:29 2021
@author: Mahfuz_Shazol
"""
import cv2
import helper as hp
import numpy as np
path='1.jpg'
wigthImg=700
heightImg=700
<|fim_suffix|>imgCounters=img.copy()
imgGray=cv2.cvtCol... | code_fim | medium | {
"lang": "python",
"repo": "6895mahfuzgit/MCQ_Automated_Grading_App",
"path": "/Main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
"""
What to do if the script is executed at command line.
Note that sys.argv is a list of the tokens typed at the command line.
"""
import sys
print "sys.argv is ",sys.argv
if len(sys.argv) > 1:
try:
n = int(sys.argv[1])
prin... | code_fim | medium | {
"lang": "python",
"repo": "eda-ricercatore/Calabria-Digital-Bio",
"path": "/reads-dna-seq/script3.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eda-ricercatore/Calabria-Digital-Bio path: /reads-dna-seq/script3.py
#!/usr/bin/python
"""
$UWHPSC/codes/python/script3.py
Modification of script2.py that allows a command line argument telling how
many points to plot in the table.
<|fim_suffix|>if __name__ == "__main__":
"""
What t... | code_fim | hard | {
"lang": "python",
"repo": "eda-ricercatore/Calabria-Digital-Bio",
"path": "/reads-dna-seq/script3.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> res = minimize(fun, init, args=(offset, lfp, zi, True),
method='Newton-CG', jac=jac, hess=hess)
if (res.success is False) or (np.isnan(res.x).any()):
res = minimize(fun, init, args=(offset, lfp, zi, True),
method='BFGS', jac=jac)
if (res.succ... | code_fim | hard | {
"lang": "python",
"repo": "burrowsej/SurPyval",
"path": "/surpyval/parametric/fitters/mle.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if offset:
results['gamma'] = p_hat[0]
params = p_hat[1:]
parameters_for_hessian = copy.copy(params)
else:
results['gamma'] = 0
params = p_hat
parameters_for_hessian = copy.copy(params)
if zi:
results['f0'] = params[-1]
params = ... | code_fim | hard | {
"lang": "python",
"repo": "burrowsej/SurPyval",
"path": "/surpyval/parametric/fitters/mle.py",
"mode": "spm",
"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.