text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> def estimate_lower_quartile(self) -> int:
sample_count = 7
step = Dictionary.MAX_SYMBOL // (sample_count + 1)
if step == 0:
return self._token_usage_by_symbol[Dictionary.MAX_SYMBOL // 2].count
j = step - 1
samples = list()
for i in range(samp... | code_fim | hard | {
"lang": "python",
"repo": "bidfx/bidfx-api-py",
"path": "/bidfx/pricing/_puffin/token_dictionary.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_queueOverflow(self, *args, **kw):
import aio
# overflow the queue with too many chunks
q = aio.Queue(1)
fd = os.open(TEST_FILENAME, os.O_DIRECT)
q.scheduleRead(fd, 0, 1, 10)
self.assertRaises(aio.QueueError, q.scheduleRead, fd, 0, 1, 10)
... | code_fim | hard | {
"lang": "python",
"repo": "jakm/twisted-linux-aio",
"path": "/aio/test_aio.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jakm/twisted-linux-aio path: /aio/test_aio.py
import os, sys, time
from twisted.python.failure import Failure
from twisted.trial import unittest
from twisted.internet import reactor, task
from twisted.internet.threads import deferToThread
from twisted.internet.defer import Deferred
from twisted.p... | code_fim | hard | {
"lang": "python",
"repo": "jakm/twisted-linux-aio",
"path": "/aio/test_aio.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: willu47/energy_demand path: /energy_demand/profiles/load_factors.py
"""Load factor calculations
#TODO: DOCUMENTATION
"""
import numpy as np
def calc_load_factor_h(data, fuels_tot_enduses_h, rs_fuels_peak_h):
"""Calculate load factor of a h in a year from peak data (peak hour compared to al... | code_fim | hard | {
"lang": "python",
"repo": "willu47/energy_demand",
"path": "/energy_demand/profiles/load_factors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Parameters
-----------
data
Retrn
------
lf_d : array
Array with load factor for every fuel type in %
Note
-----
- Load factor = average load / maximum load in given time period
- https://en.wikipedia.org/wiki/Load_factor_(electrical)
"""
lf_d... | code_fim | hard | {
"lang": "python",
"repo": "willu47/energy_demand",
"path": "/energy_demand/profiles/load_factors.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ensure_file_downloaded(source_url=repo_url, target_path=repo_path, unpack=True)
# We will use the summaries, and the corresponding question and answer pairs.
summaries_file: str = os.path.join(repo_path, "third_party", "wikipedia", "summaries.csv")
qaps_file: str = os.path... | code_fim | hard | {
"lang": "python",
"repo": "closerforever/helm",
"path": "/src/helm/benchmark/scenarios/narrativeqa_scenario.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: closerforever/helm path: /src/helm/benchmark/scenarios/narrativeqa_scenario.py
import os
import random
import csv
from typing import List, Dict
from helm.common.general import ensure_file_downloaded, ensure_directory_exists
from .scenario import (
Scenario,
Instance,
Reference,
A... | code_fim | hard | {
"lang": "python",
"repo": "closerforever/helm",
"path": "/src/helm/benchmark/scenarios/narrativeqa_scenario.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(summaries_file, encoding="utf-8") as f:
reader = csv.DictReader(f)
for row in reader:
if row["set"] != split:
continue
split_summaries[row["document_id"]] = row
doc_id_to_question_rows: Dict[str, List[Di... | code_fim | hard | {
"lang": "python",
"repo": "closerforever/helm",
"path": "/src/helm/benchmark/scenarios/narrativeqa_scenario.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: encore-zhou/mmdetection3d path: /mmdet3d/datasets/scannet_dataset.py
import numpy as np
from os import path as osp
from mmdet3d.core import show_result
from mmdet3d.core.bbox import DepthInstance3DBoxes
from mmdet.datasets import DATASETS
from .custom_3d import Custom3DDataset
@DATASETS.regist... | code_fim | hard | {
"lang": "python",
"repo": "encore-zhou/mmdetection3d",
"path": "/mmdet3d/datasets/scannet_dataset.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
results (list[dict]): List of bounding boxes results.
out_dir (str): Output directory of visualization result.
"""
assert out_dir is not None, 'Expect out_dir, got none.'
for i, result in enumerate(results):
data_info = self.data_in... | code_fim | hard | {
"lang": "python",
"repo": "encore-zhou/mmdetection3d",
"path": "/mmdet3d/datasets/scannet_dataset.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EduardoArgenti/Python path: /CursoEmVideo/ex054.py
# Crie um programa que leia o ano de nascimento de
# sete pessoas. No final, mostre quantas pessoas
# ainda não atingiram a maioridade e quantas já são maiores.
from datetime import datetime
<|fim_suffix|>for i in range(1,8):
ano_nasc = int... | code_fim | medium | {
"lang": "python",
"repo": "EduardoArgenti/Python",
"path": "/CursoEmVideo/ex054.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f'\nMenores de idade: {jovens} pessoas')
print(f'Maiores de idade: {adultos} pessoas')<|fim_prefix|># repo: EduardoArgenti/Python path: /CursoEmVideo/ex054.py
# Crie um programa que leia o ano de nascimento de
# sete pessoas. No final, mostre quantas pessoas
# ainda não atingiram a maioridade e qua... | code_fim | medium | {
"lang": "python",
"repo": "EduardoArgenti/Python",
"path": "/CursoEmVideo/ex054.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
for i in range(1,8):
ano_nasc = int(input(f'Ano de nascimento {i}: '))
idade = ano_atual - ano_nasc
if idade < 18:
jovens += 1
else:
adultos += 1
print(f'\nMenores de idade: {jovens} pessoas')
print(f'Maiores de idade: {adultos} pessoas')<|fim_prefix|># repo: EduardoArgen... | code_fim | medium | {
"lang": "python",
"repo": "EduardoArgenti/Python",
"path": "/CursoEmVideo/ex054.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bshishov/DeepIRL path: /deepirl/models/gail.py
import tensorflow as tf
import numpy as np
def log_sigmoid(a):
"""Equivalent to tf.log(tf.sigmoid(a))"""
return -tf.nn.softplus(-a)
def logit_bernoulli_entropy(logits):
""" Reference: https://github.com/openai/imitation/blob/99fbccf3e... | code_fim | hard | {
"lang": "python",
"repo": "bshishov/DeepIRL",
"path": "/deepirl/models/gail.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> inputs = tf.concat((observations, actions), axis=1, name='Inputs')
dense_1 = tf.layers.dense(inputs, hidden_size, name='Dense1', activation=tf.nn.tanh,
kernel_initializer=weights_initializer(1.4))
dense_2 = tf.layers.dense(dense_1, hidden_size, nam... | code_fim | hard | {
"lang": "python",
"repo": "bshishov/DeepIRL",
"path": "/deepirl/models/gail.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: evolvIQ/railgun path: /railgun/host_providers/local.py
from ..site import *
class LocalHostProvider(HostProvider):
"Manages the local machine as a site's host"
def __init__(self, name, cluster, root, qualifier, parent):
super(LocalHostProvider, self).__init__(name, cluster, root,... | code_fim | hard | {
"lang": "python",
"repo": "evolvIQ/railgun",
"path": "/railgun/host_providers/local.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def start_shell(self):
"Starts an interactive shell on this host"
shell = self.root.get("shell")
if not shell: shell = "bash"
_call(shell)
HostProvider = LocalHostProvider<|fim_prefix|># repo: evolvIQ/railgun path: /railgun/host_providers/local.py
fro... | code_fim | hard | {
"lang": "python",
"repo": "evolvIQ/railgun",
"path": "/railgun/host_providers/local.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def from_bitarray(instr, processor):
rt = instr[16:20]
rn = instr[12:16]
imm32 = zeros(32)
if rn.uint == 15 or rt.uint == 15:
print "unpredictable"
else:
return LdrexA1(instr, **{"imm32": imm32, "t": rt.uint, "n": rn.uin... | code_fim | medium | {
"lang": "python",
"repo": "doronz88/armulator",
"path": "/armulator/armv6/opcodes/arm_instruction_set/arm_data_processing_and_miscellaneous_instructions/arm_synchronization_primitives/ldrex_a1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return False
@staticmethod
def from_bitarray(instr, processor):
rt = instr[16:20]
rn = instr[12:16]
imm32 = zeros(32)
if rn.uint == 15 or rt.uint == 15:
print "unpredictable"
else:
return LdrexA1(instr, **{"imm32": imm32, "t"... | code_fim | hard | {
"lang": "python",
"repo": "doronz88/armulator",
"path": "/armulator/armv6/opcodes/arm_instruction_set/arm_data_processing_and_miscellaneous_instructions/arm_synchronization_primitives/ldrex_a1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: doronz88/armulator path: /armulator/armv6/opcodes/arm_instruction_set/arm_data_processing_and_miscellaneous_instructions/arm_synchronization_primitives/ldrex_a1.py
from armulator.armv6.opcodes.abstract_opcodes.ldrex import Ldrex
from armulator.armv6.opcodes.opcode import Opcode
from armulator.arm... | code_fim | hard | {
"lang": "python",
"repo": "doronz88/armulator",
"path": "/armulator/armv6/opcodes/arm_instruction_set/arm_data_processing_and_miscellaneous_instructions/arm_synchronization_primitives/ldrex_a1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: henu/bigjson path: /tests/test_basics.py
from io import BytesIO
from unittest import TestCase
import bigjson
JSON_FILE = b"""
{
"string": "blah",
"number": 123,
"true": true,
"false": false,
"null": null,
"array": [1, 2, 3],
"object": {
"x": "y"
}
}
"""
... | code_fim | medium | {
"lang": "python",
"repo": "henu/bigjson",
"path": "/tests/test_basics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(len(data), 7)
self.assertEqual(data['string'], 'blah')
self.assertEqual(data['number'], 123)
self.assertEqual(data['true'], True)
self.assertEqual(data['false'], False)
self.assertEqual(data['null'], None)
self.assertEqual(len(data['... | code_fim | medium | {
"lang": "python",
"repo": "henu/bigjson",
"path": "/tests/test_basics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> file = BytesIO(JSON_FILE)
data = bigjson.load(file)
self.assertEqual(len(data), 7)
self.assertEqual(data['string'], 'blah')
self.assertEqual(data['number'], 123)
self.assertEqual(data['true'], True)
self.assertEqual(data['false'], False)
sel... | code_fim | medium | {
"lang": "python",
"repo": "henu/bigjson",
"path": "/tests/test_basics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: accelleratorcloud/shelmet path: /tests/test_reljoin.py
from pathlib import Path
import typing as t
import pytest
from pytest import param
import shelmet as sh
<|fim_suffix|>
@parametrize(
"paths, expected",
[
param(["a"], "a"),
param(["a/"], "a"),
param(["a", "b... | code_fim | medium | {
"lang": "python",
"repo": "accelleratorcloud/shelmet",
"path": "/tests/test_reljoin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@parametrize(
"paths, expected",
[
param(["a"], "a"),
param(["a/"], "a"),
param(["a", "b", "c/d"], "a/b/c/d"),
param(["a", "/b", "/c/d"], "a/b/c/d"),
param(["/a", "b", "c/d"], "/a/b/c/d"),
param(["/a/", "/b/", "/c/d/"], "/a/b/c/d"),
param([P... | code_fim | medium | {
"lang": "python",
"repo": "accelleratorcloud/shelmet",
"path": "/tests/test_reljoin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Takes in a pubsub message and invokes a POST based on the message"""
pub_sub_message = base64.b64decode(event['data']).decode('utf-8')
if pub_sub_message == 'executor':
LOGGER.debug('POST: %s', EVENTS_EXECUTION_ENDPOINT)
response = requests.post(EVENTS_EXECUTION_ENDPOINT, json={'type': '... | code_fim | medium | {
"lang": "python",
"repo": "GoogleCloudPlatform/storage-sdrs",
"path": "/sample-client/cloudfunctions/scheduler/main.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GoogleCloudPlatform/storage-sdrs path: /sample-client/cloudfunctions/scheduler/main.py
# Copyright 2019 Google LLC. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License.
# You may obtain a copy o... | code_fim | hard | {
"lang": "python",
"repo": "GoogleCloudPlatform/storage-sdrs",
"path": "/sample-client/cloudfunctions/scheduler/main.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
play next animation
"""
self.animation_idx += 1
self.current_playing_animation = self.animation_list[self.animation_idx]
self.animation_list[self.animation_idx].reset()
def __loop(self):
"""
loop in animation list
"""
... | code_fim | hard | {
"lang": "python",
"repo": "juankhusuma/Pygin",
"path": "/pygin/components/animator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __loop(self):
"""
loop in animation list
"""
if self.loops is "inf":
self.play()
else:
if self.loops > self.current_loop:
self.current_loop += 1
self.play()
else:
self.stop()... | code_fim | hard | {
"lang": "python",
"repo": "juankhusuma/Pygin",
"path": "/pygin/components/animator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: juankhusuma/Pygin path: /pygin/components/animator.py
from pygin.component import Component
class Animator(Component):
def __init__(self, game_object, animation_list):
"""
Initiate Animator with the animation list
:param game_object: the list of animations for this ... | code_fim | hard | {
"lang": "python",
"repo": "juankhusuma/Pygin",
"path": "/pygin/components/animator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
@return: a list of tuple,the tuple contain the match start and end index
'''
p = self.__root
result = []
startWordIndex = 0
endWordIndex = -1
currentPosition = 0
while currentPosition < len(content):
word = content[currentPosition]
# 检索状态机,直到匹配
while (word in... | code_fim | hard | {
"lang": "python",
"repo": "waywaywayw/pyAhocorasick",
"path": "/pyAhocorasick/pyAhocorasick.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> currentPosition += 1
return result
def replace(self, content):
'''
'''
replacepos = self.search(content)
result = content
for i in replacepos:
result = result[0:i[0]] + (i[1] - i[0] + 1) * u'*' + content[i[1] + 1:]
return result
if __name__ == '__main__':
ah = ... | code_fim | hard | {
"lang": "python",
"repo": "waywaywayw/pyAhocorasick",
"path": "/pyAhocorasick/pyAhocorasick.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: waywaywayw/pyAhocorasick path: /pyAhocorasick/pyAhocorasick.py
# -*- encoding=utf-8 -*-
'''
Created on Mar 15, 2014
@author: tonyzhang
'''
__all__ = ['Ahocorasick', ]
class Node(object):
def __init__(self):
self.next = {}
self.fail = None
self.isWord = False
class ... | code_fim | hard | {
"lang": "python",
"repo": "waywaywayw/pyAhocorasick",
"path": "/pyAhocorasick/pyAhocorasick.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>v1 = routers.DefaultRouter()
# 系统
v1.register("users", UserViewSet, basename='users')
v1.register("forget_password", ForgetPasswordViewSet, basename='forget_password')
v1.register("change_password", ChangePassword, basename='change_password')
v1.register("change_password_validate", ChangePasswordPage, bas... | code_fim | medium | {
"lang": "python",
"repo": "Curiou/classify_email",
"path": "/classify_email/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Curiou/classify_email path: /classify_email/urls.py
"""classify_email URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import vie... | code_fim | hard | {
"lang": "python",
"repo": "Curiou/classify_email",
"path": "/classify_email/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('cluster', '0002_logicalcluster_partial_reload'),
]
operations = [
migrations.AddField(
model_name='logicalcluster',
name='service_mesh_routing',
field=models.BooleanField(default=False),
),
]<|fim_prefix|># rep... | code_fim | easy | {
"lang": "python",
"repo": "allegro/vaas",
"path": "/vaas/vaas/cluster/migrations/0003_logicalcluster_service_mesh_routing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: allegro/vaas path: /vaas/vaas/cluster/migrations/0003_logicalcluster_service_mesh_routing.py
# Generated by Django 3.1.8 on 2021-05-19 11:34
from django.db import migrations, models
<|fim_suffix|>
dependencies = [
('cluster', '0002_logicalcluster_partial_reload'),
]
operat... | code_fim | easy | {
"lang": "python",
"repo": "allegro/vaas",
"path": "/vaas/vaas/cluster/migrations/0003_logicalcluster_service_mesh_routing.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='logicalcluster',
name='service_mesh_routing',
field=models.BooleanField(default=False),
),
]<|fim_prefix|># repo: allegro/vaas path: /vaas/vaas/cluster/migrations/0003_logicalcluster_service_mesh_r... | code_fim | medium | {
"lang": "python",
"repo": "allegro/vaas",
"path": "/vaas/vaas/cluster/migrations/0003_logicalcluster_service_mesh_routing.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def parse_block(request):
machine_id = request.POST['machine']
if machine_id == 'all':
machines = WashingMachine.objects.filter(is_active=True)
else:
machines = WashingMachine.objects.filter(id=machine_id)
date = request.POST['date']
return machines, date
class Block... | code_fim | hard | {
"lang": "python",
"repo": "IlyaGusev/DIHT",
"path": "/DIHT/apps/washing/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class BlockDayView(VirtualBlockDayView):
permission_required = "washing.add_nonworkingday"
@method_decorator(transaction.atomic)
def post(self, request, *args, **kwargs):
machines, date = parse_block(request)
for machine in machines:
NonWorkingDay.objects.create(da... | code_fim | hard | {
"lang": "python",
"repo": "IlyaGusev/DIHT",
"path": "/DIHT/apps/washing/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IlyaGusev/DIHT path: /DIHT/apps/washing/views.py
import datetime as dt
import logging
from collections import OrderedDict
from django.shortcuts import render
from django.views.generic import View, TemplateView
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth.models i... | code_fim | hard | {
"lang": "python",
"repo": "IlyaGusev/DIHT",
"path": "/DIHT/apps/washing/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert vault.balanceOf(erin) == prior_alcx_balance
assert alcx.balanceOf(erin) == 0
assert alcx_pool.getPoolTotalDeposited(POOL_ID) == prior_pool_tvl + prior_alcx_balance
assert vault.totalSupply() == prior_alcx_balance<|fim_prefix|># repo: benber86/alcom_contracts path: /tests/units/Vaul... | code_fim | hard | {
"lang": "python",
"repo": "benber86/alcom_contracts",
"path": "/tests/units/Vault/test_deposit_all.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: benber86/alcom_contracts path: /tests/units/Vault/test_deposit_all.py
import brownie
POOL_ID = 1
def test_deposit_all(erin, vault, ss_compounder, alcx, alcx_pool):
<|fim_suffix|> assert vault.balanceOf(erin) == prior_alcx_balance
assert alcx.balanceOf(erin) == 0
assert alcx_pool.get... | code_fim | hard | {
"lang": "python",
"repo": "benber86/alcom_contracts",
"path": "/tests/units/Vault/test_deposit_all.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: melvincabatuan/KarelCraft path: /tests/test_actions.py
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 9 04:34:29 2021
@author: ECE
"""
<|fim_suffix|>if __name__ == "__main__":
run_karel_program()<|fim_middle|>from karelcraft.karelcraft import *
def main():
'''
Write your code solu... | code_fim | hard | {
"lang": "python",
"repo": "melvincabatuan/KarelCraft",
"path": "/tests/test_actions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
run_karel_program()<|fim_prefix|># repo: melvincabatuan/KarelCraft path: /tests/test_actions.py
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 9 04:34:29 2021
@author: ECE
"""
from karelcraft.karelcraft import *
<|fim_middle|>def main():
'''
Write your code solu... | code_fim | hard | {
"lang": "python",
"repo": "melvincabatuan/KarelCraft",
"path": "/tests/test_actions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> outputs_vocab, outputs_ptr, decoded_fine, decoded_coarse = self.decoder.forward(
self.extKnow,
story.size(),
data['context_arr_lengths'],
copy_list,
encoded_hidden,
data['sketch_response'],
max_target_length,
... | code_fim | hard | {
"lang": "python",
"repo": "ravis3011/dialogue-models",
"path": "/GLMP/src/models/GLMP.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ravis3011/dialogue-models path: /GLMP/src/models/GLMP.py
import torch
import torch.nn as nn
import random
import numpy as np
import os
from src.utils.evaluation import calc_f1, calc_bleu, calc_distinct
from src.models.loss import masked_cross_entropy
from src.models.modules import ContextRNN, Ex... | code_fim | hard | {
"lang": "python",
"repo": "ravis3011/dialogue-models",
"path": "/GLMP/src/models/GLMP.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return reverse("post_list")
def __str__(self):
return self.title<|fim_prefix|># repo: johlcar/django-mysite path: /mysite/blog/models.py
from django.db import models
from django.utils import timezone
from django.core.urlresolvers import reverse
# Models
<|fim_middle|>class Post(mod... | code_fim | hard | {
"lang": "python",
"repo": "johlcar/django-mysite",
"path": "/mysite/blog/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: johlcar/django-mysite path: /mysite/blog/models.py
from django.db import models
from django.utils import timezone
from django.core.urlresolvers import reverse
<|fim_suffix|> def __str__(self):
return self.title<|fim_middle|># Models
class Post(models.Model):
title = models.CharFi... | code_fim | hard | {
"lang": "python",
"repo": "johlcar/django-mysite",
"path": "/mysite/blog/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @commands.command()
async def hug(self, ctx, member: discord.Member):
file = random.choice(List.hugs)
embed_ = embed(desc=f":hugging: {ctx.author.mention} hugged "
f"{member.mention}!", image=file)
await ctx.send(embed=embed_, file=file)
def s... | code_fim | hard | {
"lang": "python",
"repo": "iGaming2/rammus-discord-bot",
"path": "/bot/cogs/fun.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iGaming2/rammus-discord-bot path: /bot/cogs/fun.py
import random
import discord
from discord.ext import commands
import bot.checks
from bot.resources import List
from bot.utils import embed
class Fun:
def __init__(self, bot):
self.bot = bot
@commands.command()
@bot.checks... | code_fim | hard | {
"lang": "python",
"repo": "iGaming2/rammus-discord-bot",
"path": "/bot/cogs/fun.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get preprocessed column based on data frame and internal variables
def _get_values(self, inputs:list) ->list:
"""
calculate if a tweet contains any photos
:param inputs:
:return: a list of bool, whether a tweet contains any photos
"""
result = inpu... | code_fim | hard | {
"lang": "python",
"repo": "zqirui/MLinPractice",
"path": "/code/feature_extraction/check_photos_existence.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zqirui/MLinPractice path: /code/feature_extraction/check_photos_existence.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Preprocessor that checks if photo(s) exists or not
@return: 0 for no photos, 1 for photo(s) included
<|fim_suffix|>from code.feature_extraction.feature_extractor import... | code_fim | medium | {
"lang": "python",
"repo": "zqirui/MLinPractice",
"path": "/code/feature_extraction/check_photos_existence.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # constructor
def __init__(self, input_column: str):
super().__init__([input_column], COLUMN_PHOTO_EXISTENCE)
# get preprocessed column based on data frame and internal variables
def _get_values(self, inputs:list) ->list:
"""
calculate if a tweet contains any pho... | code_fim | medium | {
"lang": "python",
"repo": "zqirui/MLinPractice",
"path": "/code/feature_extraction/check_photos_existence.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asd249180/similarity_and_matching path: /src/comparators/compare_functions/bn_running_var_split.py
# import numpy as np
# from src.comparators.general import ActivationComparator
# class BnActivation(ActivationComparator):
# def __init__(self, dataset, batch_size=50, n_epochs=1, n_iters=-... | code_fim | hard | {
"lang": "python",
"repo": "asd249180/similarity_and_matching",
"path": "/src/comparators/compare_functions/bn_running_var_split.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># x1 = np.mean([x[0] for x in similarities])
# x2 = np.mean([x[1] for x in similarities])
# return x1, x2
# def _rearrange_activations(self, activations):
# if len(activations.shape) > 2:
# activations = np.transpose(activations, axes=[0, 2, 3, 1])
# ... | code_fim | hard | {
"lang": "python",
"repo": "asd249180/similarity_and_matching",
"path": "/src/comparators/compare_functions/bn_running_var_split.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>f = open(path() + "/list.txt","w+")<|fim_prefix|># repo: gadhagod/TerminalToDo path: /createlist.py
from os import environ
def path():
<|fim_middle|> home = environ.get("HOME")
dir = home + '/' + 'TerminalToDo'
return dir
| code_fim | medium | {
"lang": "python",
"repo": "gadhagod/TerminalToDo",
"path": "/createlist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gadhagod/TerminalToDo path: /createlist.py
from os import environ
def path():
<|fim_suffix|>f = open(path() + "/list.txt","w+")<|fim_middle|> home = environ.get("HOME")
dir = home + '/' + 'TerminalToDo'
return dir
| code_fim | medium | {
"lang": "python",
"repo": "gadhagod/TerminalToDo",
"path": "/createlist.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>_CMD_NOMATCH = cmdhandler.CMD_NOMATCH
_CMD_NOINPUT = cmdhandler.CMD_NOINPUT
# we need to use NAWS for this
_SCREEN_WIDTH = settings.CLIENT_DEFAULT_WIDTH
_SCREEN_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT
# text
_DISPLAY = \
"""{text}
({{wmore{{n [{pageno}/{pagemax}] retur{{wn{{n|{{wb{{nack|{{wt{{nop|{{we{... | code_fim | hard | {
"lang": "python",
"repo": "Pinacolada64/evennia",
"path": "/evennia/utils/evmore.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pinacolada64/evennia path: /evennia/utils/evmore.py
# -*- coding: utf-8 -*-
"""
EvMore - pager mechanism
This is a pager for displaying long texts and allows stepping up and
down in the text (the name comes from the traditional 'more' unix
command).
To use, simply pass the text through the EvMo... | code_fim | hard | {
"lang": "python",
"repo": "Pinacolada64/evennia",
"path": "/evennia/utils/evmore.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class EvMore(object):
"""
The main pager object
"""
def __init__(self, caller, text, always_page=False, **kwargs):
"""
Initialization of the text handler.
Args:
caller (Object or Player): Entity reading the text.
text (str): The text to put ... | code_fim | hard | {
"lang": "python",
"repo": "Pinacolada64/evennia",
"path": "/evennia/utils/evmore.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 'EOR'
@classmethod
def unpack_message (cls,data,negotiated):
header_length = len(EOR.NLRI.PREFIX)
return cls(AFI(data[header_length]),SAFI(data[header_length+1:header_length+3]))<|fim_prefix|># repo: dwcarder/sdn-ix-demo path: /exabgp-3.4.3/lib/exabgp/bgp/message/update/eor.py
# encoding:... | code_fim | hard | {
"lang": "python",
"repo": "dwcarder/sdn-ix-demo",
"path": "/exabgp-3.4.3/lib/exabgp/bgp/message/update/eor.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dwcarder/sdn-ix-demo path: /exabgp-3.4.3/lib/exabgp/bgp/message/update/eor.py
# encoding: utf-8
"""
eor.py
Created by Thomas Mangin on 2010-01-16.
Copyright (c) 2009-2013 Exa Networks. All rights reserved.
"""
# from struct import unpack
from exabgp.protocol.family import AFI
from exabgp.prot... | code_fim | medium | {
"lang": "python",
"repo": "dwcarder/sdn-ix-demo",
"path": "/exabgp-3.4.3/lib/exabgp/bgp/message/update/eor.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: valermor/galen-api-ports path: /py/galenpy/galen_api.py
############################################################################
# Copyright 2015 Valerio Morsella #
# #
# Licensed... | code_fim | hard | {
"lang": "python",
"repo": "valermor/galen-api-ports",
"path": "/py/galenpy/galen_api.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> #TODO add multiple specs.
"""
Main validation method.
:param driver: An instance of GalenWebDriver.
:param spec: Specs to be run on the page under test.
:param included_tags: list of tags included in the check.
:param excluded_tags: list of tags excl... | code_fim | medium | {
"lang": "python",
"repo": "valermor/galen-api-ports",
"path": "/py/galenpy/galen_api.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Returns a list of channel IDs for the channel databases that exist in a content database directory.
"""
db_list = fnmatch.filter(os.listdir(content_database_dir), '*.sqlite3')
db_names = [db.split('.sqlite3', 1)[0] for db in db_list]
valid_db_names = [name for name in db_names ... | code_fim | hard | {
"lang": "python",
"repo": "swapnil106111/kolibri",
"path": "/kolibri/content/utils/channels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swapnil106111/kolibri path: /kolibri/content/utils/channels.py
import fnmatch
import logging as logger
import os
import uuid
logging = logger.getLogger(__name__)
def _is_valid_hex_uuid(uuid_to_test):
<|fim_suffix|> """
Returns a list of channel IDs for the channel databases that exist in... | code_fim | hard | {
"lang": "python",
"repo": "swapnil106111/kolibri",
"path": "/kolibri/content/utils/channels.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_channel_id_list_from_scanning_content_database_dir(content_database_dir):
"""
Returns a list of channel IDs for the channel databases that exist in a content database directory.
"""
db_list = fnmatch.filter(os.listdir(content_database_dir), '*.sqlite3')
db_names = [db.split('.s... | code_fim | medium | {
"lang": "python",
"repo": "swapnil106111/kolibri",
"path": "/kolibri/content/utils/channels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alperkesen/codecarbon path: /tests/test_cpu.py
import os
import sys
import unittest
from unittest import mock
import pytest
from codecarbon.core.cpu import TDP, IntelPowerGadget, IntelRAPL
from codecarbon.core.units import Energy, Power
from codecarbon.external.hardware import CPU
from codecarb... | code_fim | hard | {
"lang": "python",
"repo": "alperkesen/codecarbon",
"path": "/tests/test_cpu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_get_matching_cpu(self):
tdp = TDP()
cpu_data = DataSource().get_cpu_power_data()
# ======= WORKING AS EXPECTED ========
# Exact match
model = "AMD Ryzen 3 1200"
self.assertEqual(
tdp._get_matching_cpu(model, cpu_data, greedy=False)... | code_fim | hard | {
"lang": "python",
"repo": "alperkesen/codecarbon",
"path": "/tests/test_cpu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Match although have lot of missing parts
model = "5800K"
self.assertEqual(
tdp._get_matching_cpu(model, cpu_data, greedy=False),
"AMD A10-5800K",
)
# Match although have a missing part (tricky!)
model = "AMD Ryzen 1950x"
se... | code_fim | hard | {
"lang": "python",
"repo": "alperkesen/codecarbon",
"path": "/tests/test_cpu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: changguanghua/sina-automator path: /demo/follow-machine-learning-watchers/follow.py
import time
import sys
if len(sys.argv) < 2:
print "usage follow.py {file_name_to_id_list}"
sys.exit(-1)
<|fim_suffix|>from wauto import WeiboAutomator
wa = WeiboAutomator()
# Get ID list to follow
ids... | code_fim | medium | {
"lang": "python",
"repo": "changguanghua/sina-automator",
"path": "/demo/follow-machine-learning-watchers/follow.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|># The the difference: only follow new IDs
new_ids = list(set(ids) - set(cur_ids))
print new_ids
print "Cur IDs:", len(cur_ids)
print "Intended IDs:", len(ids)
print "New IDs:", len(new_ids)
# Invoke the follow action for all IDs simultaneously.
# Don't worry about the quota limitation, we'll manage it au... | code_fim | hard | {
"lang": "python",
"repo": "changguanghua/sina-automator",
"path": "/demo/follow-machine-learning-watchers/follow.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|># Invoke the follow action for all IDs simultaneously.
# Don't worry about the quota limitation, we'll manage it automatically.
map(wa.follow, new_ids)
# Loop until all users are followed.
# You can call `wa.run()` at any frequency.
# `wa` will check for quotas and only issue request if there is enough ... | code_fim | hard | {
"lang": "python",
"repo": "changguanghua/sina-automator",
"path": "/demo/follow-machine-learning-watchers/follow.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|># Recorded output.
# clear set00 rot+90 set00 rot-90 set00
# 00000 #0000 0000# 0000# #000# 00000
# 00000 00000 00000 00000 00000 00000
# 00000 -> 00000 -> 00000 -> 00000 -> 00000 -> 00000
# 00000 00000 00000 00000 00000 00000
# 00000 00000 00... | code_fim | hard | {
"lang": "python",
"repo": "cscovino/spike-prime",
"path": "/simulator/scripts/bug-display.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cscovino/spike-prime path: /simulator/scripts/bug-display.py
from hub import display
from utime import sleep
display.clear()
sleep(1)
display.pixel(0,0,100)
sleep(1)
display.rotation(90)
sleep(1)
display.pixel(0,0,100)
sleep(1)
display.rotation(-90)
sleep(1)
display.pixel(0,0,0)
# Expected out... | code_fim | hard | {
"lang": "python",
"repo": "cscovino/spike-prime",
"path": "/simulator/scripts/bug-display.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'generic_16s_rRNAs': ['RNA_b3851', 'RNA_b3968', 'RNA_b3756',
'RNA_b3278', 'RNA_b4007', 'RNA_b2591',
'RNA_b0201'],
'generic_23s_rRNAs': ['RNA_b3854', 'RNA_b3970', 'RNA_b3758',
... | code_fim | hard | {
"lang": "python",
"repo": "coltonlloyd/ecolime",
"path": "/ecolime/generics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'RNA_b3275', 'RNA_b4009', 'RNA_b2589',
'RNA_b0204'],
'generic_5s_rRNAs': ['RNA_b3855', 'RNA_b3971', 'RNA_b3759',
'RNA_b3274', 'RNA_b4010', 'RNA_b2588',
'RNA_b0205', 'RNA_... | code_fim | hard | {
"lang": "python",
"repo": "coltonlloyd/ecolime",
"path": "/ecolime/generics.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: coltonlloyd/ecolime path: /ecolime/generics.py
generic_dict = {'generic_16Sm4Cm1402': ['RsmH_mono', 'RsmI_mono'],
'generic_LYSINEaaRS': ['LysI_RS_dim',
'LysII_RS_dim_mod_6:mg2'],
'generic_Dus': ['DusA_mono', 'DusB_mono', 'DusC... | code_fim | hard | {
"lang": "python",
"repo": "coltonlloyd/ecolime",
"path": "/ecolime/generics.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mie-lab/trackintel path: /tests/preprocessing/test_staypoints.py
1-02 09:20:00", tz="utc")
list_dict = [
{"id": 1, "user_id": 0, "started_at": t1, "finished_at": t2, "geom": p1, "location_id": 1},
{"id": 5, "user_id": 0, "started_at": t2, "finished_at": t2, "geom": p1, "locat... | code_fim | hard | {
"lang": "python",
"repo": "mie-lab/trackintel",
"path": "/tests/preprocessing/test_staypoints.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mie-lab/trackintel path: /tests/preprocessing/test_staypoints.py
mp("1971-01-02 08:00:00", tz="utc")
t5 = pd.Timestamp("1971-01-02 09:00:00", tz="utc")
t6 = pd.Timestamp("1971-01-02 10:00:00", tz="utc")
list_dict = [
{"id": 1, "user_id": 0, "started_at": t1, "finished_at": t2... | code_fim | hard | {
"lang": "python",
"repo": "mie-lab/trackintel",
"path": "/tests/preprocessing/test_staypoints.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # group_by_user_id and check that no two different user ids share a common location id
grouped = list(non_noise_sp.groupby(["user_id"])["location_id"].unique())
loc_set = []
for loc_list in grouped:
loc_set.append(set(loc_list))
# we assert that the cou... | code_fim | hard | {
"lang": "python",
"repo": "mie-lab/trackintel",
"path": "/tests/preprocessing/test_staypoints.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# the ONLY sequence allowed is a = sequence, which assings the right value to all, FROM LEFT
# test that a = b = 2 sets both to 2 AND that a += anywhere fails AND that its not an expr AND that a=2 in arg has 1 parse
# disable expr_code, disable invalid lvalues
# ; sep not working
# test crements... | code_fim | hard | {
"lang": "python",
"repo": "MrCoft/twocode",
"path": "/tests/test_code.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MrCoft/twocode path: /tests/test_code.py
from .testdefs import *
name_tests(
# file indent
# - making code indent itself indents the entire file
file_indent = cmp("0"),
file_strip = cmp("\n0\n", "0"),
file_empty_line = cmp("1\n\n2", "1\n2"),
line_ws = cmp("1\n2 \n... | code_fim | hard | {
"lang": "python",
"repo": "MrCoft/twocode",
"path": "/tests/test_code.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: litlw/litlw.github.io path: /portfolio/Vis/py/script.py
import pandas as pd
import operator
term_frequency = {}
desired_terms = ['3d', 'old', 'new', 'nintendo', 'computer', 'windows', 'apple', 'why', 'how', 'me', 'we', 'anyone']
count = 1
if __name__ == '__main__':
<|fim_suffix|> for... | code_fim | hard | {
"lang": "python",
"repo": "litlw/litlw.github.io",
"path": "/portfolio/Vis/py/script.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print(csv_filtered)
import glob, os
os.chdir("../data/Analysis")
writer = pd.ExcelWriter('data-analyzed.xlsx')
os.chdir("../data")
for file in glob.glob("*.csv"):
count += 1
#csv = pd.read_csv('../data/' + file)
csv = pd.read_csv(file)
csv_parsed ... | code_fim | hard | {
"lang": "python",
"repo": "litlw/litlw.github.io",
"path": "/portfolio/Vis/py/script.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> import glob, os
os.chdir("../data/Analysis")
writer = pd.ExcelWriter('data-analyzed.xlsx')
os.chdir("../data")
for file in glob.glob("*.csv"):
count += 1
#csv = pd.read_csv('../data/' + file)
csv = pd.read_csv(file)
csv_parsed = file.split('.')
c... | code_fim | hard | {
"lang": "python",
"repo": "litlw/litlw.github.io",
"path": "/portfolio/Vis/py/script.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_transport_1(base_settings):
"""No. 1 tests collection for Transport.
Test File: transport-example.json
"""
filename = base_settings["unittest_data_dir"] / "transport-example.json"
inst = transport.Transport.parse_file(
filename, content_type="application/json", encodin... | code_fim | hard | {
"lang": "python",
"repo": "nazrulworld/fhir.resources",
"path": "/fhir/resources/tests/test_transport.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nazrulworld/fhir.resources path: /fhir/resources/tests/test_transport.py
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Transport
Release: R5
Version: 5.0.0
Build ID: 2aecd53
Last updated: 2023-03-26T15:21:02.749+11:00
"""
from pydantic.validators import bytes_valida... | code_fim | hard | {
"lang": "python",
"repo": "nazrulworld/fhir.resources",
"path": "/fhir/resources/tests/test_transport.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brendane/miscellaneous_bioinfo_scripts path: /extract_gff_annot.py
#!/usr/bin/env python3
"""
Given a column in a tab-delimited file, extract certain gff
formatted annotations. Prints the entire row with the extracted
annotations substituted.
extract_gff_annot.py <column number> ... | code_fim | medium | {
"lang": "python",
"repo": "brendane/miscellaneous_bioinfo_scripts",
"path": "/extract_gff_annot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>c = int(sys.argv[1])
fields = sys.argv[2].split(',')
if len(sys.argv) > 3:
handle = open(sys.argv[3], 'rt')
else:
handle = sys.stdin
with handle as ih:
for line in ih:
if line.startswith('#'):
continue
row = line.strip().split('\t')
if '=' in row[c-1]:
... | code_fim | medium | {
"lang": "python",
"repo": "brendane/miscellaneous_bioinfo_scripts",
"path": "/extract_gff_annot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>floodFill(graph, I, J)
for i in range(N):
print("".join(graph[i]))<|fim_prefix|># repo: gorel/hscc2016 path: /cleaning/cleaning.py
import sys
def floodFill(gr, I, J):
if I >= 0 and I < len(gr) and J >= 0 and J < len(gr[0]) and gr[I][J] == 'D':
gr[I][J] = 'C'
floodFill(gr, I - 1,... | code_fim | medium | {
"lang": "python",
"repo": "gorel/hscc2016",
"path": "/cleaning/cleaning.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gorel/hscc2016 path: /cleaning/cleaning.py
import sys
def floodFill(gr, I, J):
if I >= 0 and I < len(gr) and J >= 0 and J < len(gr[0]) and gr[I][J] == 'D':
gr[I][J] = 'C'
floodFill(gr, I - 1, J)
floodFill(gr, I + 1, J)
floodFill(gr, I, J - 1)
floodFill... | code_fim | medium | {
"lang": "python",
"repo": "gorel/hscc2016",
"path": "/cleaning/cleaning.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: philpot/tocayo path: /tocayoproj/tocayoapp/urls.py
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
# ex: /tocayoapp/5/
url(r'^author/(?P<author_id>[0-9]+)/$', views.author, name='author'),
url(r'^gender/(?P<gender_id>[0... | code_fim | hard | {
"lang": "python",
"repo": "philpot/tocayo",
"path": "/tocayoproj/tocayoapp/urls.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> url(r'^scope/(?P<scope_id>[0-9]+)/$', views.scope, name='scope'),
url(r'^utter/(?P<utter_id>[0-9]+)/$', views.utter, name='utter'),
url(r'^pronounce/(?P<pronounce_id>[0-9]+)/$', views.pronounce, name='pronounce'),
url(r'^survey/(?P<survey_id>[0-9]+)/$', views.survey, name='survey'),
url... | code_fim | hard | {
"lang": "python",
"repo": "philpot/tocayo",
"path": "/tocayoproj/tocayoapp/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>urvey'),
url(r'^freq/(?P<freq_id>[0-9]+)/$', views.freq, name='freq'),
url(r'^idea/(?P<idea_id>[0-9]+)/$', views.idea, name='idea'),
url(r'^meaning/(?P<meaning_id>[0-9]+)/$', views.meaning, name='meaning'),
url(r'^onto/(?P<onto_id>[0-9]+)/$', views.onto, name='onto'),
]<|fim_prefix|># ... | code_fim | hard | {
"lang": "python",
"repo": "philpot/tocayo",
"path": "/tocayoproj/tocayoapp/urls.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cangothic/2D-Platformer path: /controlled_character.py
import game
import pygame
from character import *
from pygame.locals import *
from constants import *
<<<<<<< HEAD
from resources import *
=======
>>>>>>> origin/master
class ControlledCharacter(Character):
def on_left(self):
se... | code_fim | hard | {
"lang": "python",
"repo": "cangothic/2D-Platformer",
"path": "/controlled_character.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def on_start(self):
self.direction = True
<<<<<<< HEAD
self.right = True
self.jump=False
self.color=False
def saltar(self):
self.jump=not self.jump
def colorear(self):
resources = Resources('graphics/arc22.png')
self.color=not self.colo... | code_fim | hard | {
"lang": "python",
"repo": "cangothic/2D-Platformer",
"path": "/controlled_character.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_archaeology.py
#calss header
class _ARCHAEOLOGY():
def __init__(self,):
self.name = "ARCHAEOLOGY"
self.definitions = [u'the study of the buildings, graves, tools, and other objects that belonged to people who lived in the past, in order to lea... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/nouns/_archaeology.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/start')
def start():
logger.info('Initializing API')
gmail_api.start()
return str(200)
app.gmail_api.sub_to_topic()
app.gmail_api.stop()
app.gmail_api.watch()
if __name__ == '__main__':
logger.info('Starting App Manually')
app.run(host='0.0.0.0', port=1337)<|fim_prefix|... | code_fim | hard | {
"lang": "python",
"repo": "jamesboone/gmail_reader",
"path": "/main_app.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.