text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> # Check to see if we got a represent lambda and run it, otherwise return the
# string value of the Field
repLambda = eval("table.%s.represent" % attr)
if repLambda != None and callable(repLambda):
return str(repLambda(row[attr]))
... | code_fim | hard | {
"lang": "python",
"repo": "kheiss/ece517_Project2_SA22",
"path": "/modules/timeline/event.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kheiss/ece517_Project2_SA22 path: /modules/timeline/event.py
class Event(object):
def __init__(self, title=None, start=None, **kwargs):
if title == None or start == None:
raise TypeError
self.title = title
self.start = start
class EventSource(object):
... | code_fim | hard | {
"lang": "python",
"repo": "kheiss/ece517_Project2_SA22",
"path": "/modules/timeline/event.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DenisOstr/PythonPractice path: /FTPClient/FTPApp.py
import wx
import FTPStatusBar
import FTPFrame
class FtpApp(wx.App):
<|fim_suffix|> frame = FTPFrame.FtpFrame(None, -1, 'Ftp Client')
frame.Show(True)
return True
app = FtpApp(0)
app.MainLoop()<|fim_middle|> def OnInit(self):
| code_fim | easy | {
"lang": "python",
"repo": "DenisOstr/PythonPractice",
"path": "/FTPClient/FTPApp.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>app = FtpApp(0)
app.MainLoop()<|fim_prefix|># repo: DenisOstr/PythonPractice path: /FTPClient/FTPApp.py
import wx
import FTPStatusBar
import FTPFrame
class FtpApp(wx.App):
def OnInit(self):
<|fim_middle|> frame = FTPFrame.FtpFrame(None, -1, 'Ftp Client')
frame.Show(True)
return True
| code_fim | medium | {
"lang": "python",
"repo": "DenisOstr/PythonPractice",
"path": "/FTPClient/FTPApp.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.file_handler = logging.FileHandler(config['LOG_PATH'])
self.file_handler.setFormatter(self.formatter)
self.logger.addHandler(self.stdout_handler)
self.logger.addHandler(self.file_handler)
def debug(self, message):
"""
Custom DEBUG message
... | code_fim | hard | {
"lang": "python",
"repo": "MichaelSchmidt82/sound-count",
"path": "/logger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> check_size()
self.logger.info('WARNING: %s', message)
def error(self, message):
"""
Custom ERROR message
:message: str() message to log
:returns: None
"""
check_size()
self.logger.info('ERROR: %s', message)
def cr... | code_fim | hard | {
"lang": "python",
"repo": "MichaelSchmidt82/sound-count",
"path": "/logger.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MichaelSchmidt82/sound-count path: /logger.py
"""
MIT License
Copyright (c) 2018 Michael Schmidt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, includ... | code_fim | hard | {
"lang": "python",
"repo": "MichaelSchmidt82/sound-count",
"path": "/logger.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: miguelagustin/silver-waffle-trading-bot path: /silver_waffle/exceptions.py
class not_enough_balance(Exception):
pass
<|fim_suffix|> pass
class not_supported(Exception):
def __init__(self, message):
self.message = message
def __repr__(self):
return f"not_supporte... | code_fim | medium | {
"lang": "python",
"repo": "miguelagustin/silver-waffle-trading-bot",
"path": "/silver_waffle/exceptions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return f"not_supported({self.message})"<|fim_prefix|># repo: miguelagustin/silver-waffle-trading-bot path: /silver_waffle/exceptions.py
class not_enough_balance(Exception):
pass
class amount_must_be_greater(Exception):
pass
class stuck_order(Exception):
pass
class server_error(E... | code_fim | medium | {
"lang": "python",
"repo": "miguelagustin/silver-waffle-trading-bot",
"path": "/silver_waffle/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
class stuck_order(Exception):
pass
class server_error(Exception):
pass
class currency_doesnt_exist(Exception):
pass
class not_supported(Exception):
def __init__(self, message):
self.message = message
def __repr__(self):
return f"not_supported({self.mes... | code_fim | easy | {
"lang": "python",
"repo": "miguelagustin/silver-waffle-trading-bot",
"path": "/silver_waffle/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rumiachang/keras-examples path: /lstm/alphabet_lstm.py
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import LSTM
from keras.utils import np_utils
# http://machinelearningmastery.com/understanding-stateful-lstm-recurrent-neural-networks-py... | code_fim | hard | {
"lang": "python",
"repo": "Rumiachang/keras-examples",
"path": "/lstm/alphabet_lstm.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # demonstrate a random starting point
letter = 'K'
seed = [char_to_int[letter]]
print("New start:", letter)
for i in range(0, 5):
x = np.reshape(seed, (1, len(seed), 1))
x = x / float(len(alphabet))
prediction = model.predict(x, verbose=0)
index = np.arg... | code_fim | hard | {
"lang": "python",
"repo": "Rumiachang/keras-examples",
"path": "/lstm/alphabet_lstm.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if index == 0:
return Piece.I
elif index == 1:
return Piece.T
elif index == 2:
return Piece.O
elif index == 3:
return Piece.J
elif index == 4:
return Piece.L
elif index == 5:
return Piece.S
elif index == 6:
return Piece.Z<|fim_prefix|># repo: Life4gal/Tetris-AI path: /E... | code_fim | hard | {
"lang": "python",
"repo": "Life4gal/Tetris-AI",
"path": "/ExampleTetris/Piece.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Life4gal/Tetris-AI path: /ExampleTetris/Piece.py
import enum
import random
import AI.StandardType as StandardType
def bin_to_dec(binary: str) -> int:
return int(binary, 2)
class Piece(enum.Enum):
TOTAL_PIECES = 7
I = [
# O
# O
# O
# O
StandardType.StandardDataFormat([1,... | code_fim | hard | {
"lang": "python",
"repo": "Life4gal/Tetris-AI",
"path": "/ExampleTetris/Piece.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sdv-dev/SDMetrics path: /sdmetrics/multi_table/statistical/cardinality_shape_similarity.py
"""The CardinalityShapeSimilarity metric."""
import numpy as np
from scipy.stats import ks_2samp
from sdmetrics.goal import Goal
from sdmetrics.multi_table.base import MultiTableMetric
from sdmetrics.util... | code_fim | hard | {
"lang": "python",
"repo": "sdv-dev/SDMetrics",
"path": "/sdmetrics/multi_table/statistical/cardinality_shape_similarity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
real_data (dict[str, pandas.DataFrame]):
The tables from the real dataset, passed as a dictionary of
table names and pandas.DataFrames.
synthetic_data (dict[str, pandas.DataFrame]):
The tables from the synthetic dataset,... | code_fim | hard | {
"lang": "python",
"repo": "sdv-dev/SDMetrics",
"path": "/sdmetrics/multi_table/statistical/cardinality_shape_similarity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: microsoft/ADBench path: /tools/Autograd/Autograd_gmm_split.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import sys
import time as t
from scipy import special as scipy_special
# import numpy as np
import autograd.numpy as np
from autograd import value_and_grad
sy... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/ADBench",
"path": "/tools/Autograd/Autograd_gmm_split.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def add_grad(g1, g2):
return (g1[0] + g2[0], [g1[1][0] + g2[1][0], g1[1][1] + g2[1][1], g1[1][2] + g2[1][2]])
dir_in = sys.argv[1]
dir_out = sys.argv[2]
fn = sys.argv[3]
nruns_f = int(sys.argv[4])
nruns_J = int(sys.argv[5])
time_limit = int(sys.argv[6]) if len(sys.argv) >= 7 else float("inf")
repli... | code_fim | hard | {
"lang": "python",
"repo": "microsoft/ADBench",
"path": "/tools/Autograd/Autograd_gmm_split.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alsor62/micropython-micro-gui path: /gui/widgets/led.py
# led.py Extension to ugui providing the LED class
# Released under the MIT License (MIT). See LICENSE.
# Copyright (c) 2021 Peter Hinch
from gui.core.ugui import Widget, display
from gui.core.colors import *
<|fim_suffix|> if supe... | code_fim | hard | {
"lang": "python",
"repo": "alsor62/micropython-micro-gui",
"path": "/gui/widgets/led.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super().__init__(writer, row, col, height, height, fgcolor, bgcolor, bdcolor, False)
self._value = False
self._color = color
self.radius = self.height // 2
self.x = col + self.radius
self.y = row + self.radius
def show(self):
if super().show(): ... | code_fim | medium | {
"lang": "python",
"repo": "alsor62/micropython-micro-gui",
"path": "/gui/widgets/led.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Arkham32/cmpt395 path: /realCaraway/caraway/login/migrations/0015_auto_20180328_2340.py
# Generated by Django 2.0.2 on 2018-03-28 23:40
from django.db import migrations
<|fim_suffix|> dependencies = [
('login', '0014_auto_20180320_1509'),
]
operations = [
migrations.... | code_fim | easy | {
"lang": "python",
"repo": "Arkham32/cmpt395",
"path": "/realCaraway/caraway/login/migrations/0015_auto_20180328_2340.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RenameField(
model_name='parentcreation',
old_name='curent_hours',
new_name='current_hours',
),
]<|fim_prefix|># repo: Arkham32/cmpt395 path: /realCaraway/caraway/login/migrations/0015_auto_20180328_2340.py
# Generated ... | code_fim | medium | {
"lang": "python",
"repo": "Arkham32/cmpt395",
"path": "/realCaraway/caraway/login/migrations/0015_auto_20180328_2340.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OpenCourseProject/OpenCourse path: /course/migrations/0002_auto_20151223_2335.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils import timezone
# This migration updates course-related items to indicate when they were cr... | code_fim | hard | {
"lang": "python",
"repo": "OpenCourseProject/OpenCourse",
"path": "/course/migrations/0002_auto_20151223_2335.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('course', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='followentry',
name='time_created',
field=models.DateTimeField(default=timezone.now(), auto_now_add=True),
preserve_default=False,
... | code_fim | hard | {
"lang": "python",
"repo": "OpenCourseProject/OpenCourse",
"path": "/course/migrations/0002_auto_20151223_2335.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('course', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='followentry',
name='time_created',
field=models.DateTimeField(default=timezone.now(), auto_now_add=True),
preserve_default=False,
... | code_fim | hard | {
"lang": "python",
"repo": "OpenCourseProject/OpenCourse",
"path": "/course/migrations/0002_auto_20151223_2335.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IACT-Medical-Image-Processing/ivadomed path: /ivadomed/testing.py
import os
import nibabel as nib
import numpy as np
import torch
import torch.backends.cudnn as cudnn
from torch.utils.data import DataLoader
from tqdm import tqdm
from ivadomed import metrics as imed_metrics
from ivadomed import ... | code_fim | hard | {
"lang": "python",
"repo": "IACT-Medical-Image-Processing/ivadomed",
"path": "/ivadomed/testing.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def run_inference(test_loader, model, model_params, testing_params, ofolder, cuda_available,
i_monte_carlo=None):
"""Run inference on the test data and save results as nibabel files.
Args:
test_loader (torch DataLoader):
model (nn.Module):
model_params (... | code_fim | hard | {
"lang": "python",
"repo": "IACT-Medical-Image-Processing/ivadomed",
"path": "/ivadomed/testing.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> warnings.filterwarnings("ignore", module='tensorflow')
warnings.filterwarnings("ignore", module='gym')
is_failed = instructions['-OPEN COND-FAIL']
fail_type = instructions['fail_type']
init_alt = float(instructions['init_alt'])
init_speed = float(instructions['init_speed'])
i... | code_fim | hard | {
"lang": "python",
"repo": "linqingbh/fault-tolerant-flight-control-drl",
"path": "/tests/test_all.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linqingbh/fault-tolerant-flight-control-drl path: /tests/test_all.py
import os
import warnings
import PySimpleGUI as sg
def GUI():
section1 = [[sg.T('Initial Flight Conditions :')],
[sg.Text('Initial Altitude [m]:'),
sg.InputCombo(values=('2000', '5000'), au... | code_fim | hard | {
"lang": "python",
"repo": "linqingbh/fault-tolerant-flight-control-drl",
"path": "/tests/test_all.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if event == 'ATM':
window['init_alt'].update(disabled=True, value='2000')
window['init_speed'].update(disabled=True, value='90')
if not instructions['ATM']:
window['init_alt'].update(disabled=False)
window['init_speed'].update(disabled=False)... | code_fim | hard | {
"lang": "python",
"repo": "linqingbh/fault-tolerant-flight-control-drl",
"path": "/tests/test_all.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: waustin/django-store-locator path: /store_locator/migrations/0001_initial.py
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(s... | code_fim | hard | {
"lang": "python",
"repo": "waustin/django-store-locator",
"path": "/store_locator/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Deleting model 'ZipCodeLocation'
db.delete_table(u'store_locator_zipcodelocation')
# Deleting model 'Location'
db.delete_table(u'store_locator_location')
models = {
u'store_locator.location': {
'Meta': {'ordering': "('name',)", 'object_name': 'L... | code_fim | hard | {
"lang": "python",
"repo": "waustin/django-store-locator",
"path": "/store_locator/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dtwm/django-robokassa path: /robokassa/migrations/0001_initial.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-04-26 12:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
... | code_fim | hard | {
"lang": "python",
"repo": "dtwm/django-robokassa",
"path": "/robokassa/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert p.input_shape is not None
conv_output_shape = p.input_shape
for i in range(p.num_cnn_layers):
conv_output_shape = self.conv[i].OutShape(conv_output_shape)
assert len(conv_output_shape) == 4 # batch, height, width, channel.
feat_dim = conv_output_shape[-1] * conv_output_s... | code_fim | hard | {
"lang": "python",
"repo": "Ciroye/peoples-speech",
"path": "/lingvo/tasks/asr/blocks.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ciroye/peoples-speech path: /lingvo/tasks/asr/blocks.py
# Lint as: python3
# Copyright 2018 The TensorFlow Authors. 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": "Ciroye/peoples-speech",
"path": "/lingvo/tasks/asr/blocks.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bainco/bainco.github.io path: /course-files/lectures/lecture19/02_reading_files/00_opening_files.py
# if we just use open, then we get a IOWrapper object that the computer only reads
# through one line at a time.
my_file_1 = open("m<|fim_suffix|>nts))
print(the_contents[1337])
my_file_2.close()
#... | code_fim | hard | {
"lang": "python",
"repo": "bainco/bainco.github.io",
"path": "/course-files/lectures/lecture19/02_reading_files/00_opening_files.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>nts))
print(the_contents[1337])
my_file_2.close()
# This second one is especially useful if you only want to look at particular lines<|fim_prefix|># repo: bainco/bainco.github.io path: /course-files/lectures/lecture19/02_reading_files/00_opening_files.py
# if we just use open, then we get a IOWrapper obj... | code_fim | hard | {
"lang": "python",
"repo": "bainco/bainco.github.io",
"path": "/course-files/lectures/lecture19/02_reading_files/00_opening_files.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.terrain_shadow = TerrainMeshRenderer()
self.terrain_shadow.set_heightfield_size(8192)
self.terrain_shadow.load_chunk_mesh("core/resources/Chunk32.bam")
self.terrain_shadow.set_focus(base.cam, base.camLens)
self.terrain_shadow.set_target_triangle_width(7.0)
... | code_fim | hard | {
"lang": "python",
"repo": "2lost4u/P3DFramework",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for material in ['rock', 'grass', 'gravel', 'snow', 'moss']:
for i in xrange(2):
tex = loader.loadTexture("data/terrain/Materials/" + material + "_" + str(i+1) + ".png")
tex.set_wrap_u(Texture.WM_repeat)
tex.set_wrap_v(Texture.WM_repeat)
... | code_fim | hard | {
"lang": "python",
"repo": "2lost4u/P3DFramework",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 2lost4u/P3DFramework path: /main.py
from __future__ import print_function
import math
from os.path import isfile
import sys
# Change the path to your render pipeline installation here
sys.path.insert(0, "../RenderPipeline")
sys.path.insert(0, "../RenderPipeline/rpcore/external/six")
from pa... | code_fim | hard | {
"lang": "python",
"repo": "2lost4u/P3DFramework",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AbinavRavi/OODCancer path: /model/distillation_model.py
import numpy as np
import torch
import torch.nn as nn
import pdb
import torch.nn.functional as F
<|fim_suffix|> def __init__(self, input_size,num_classes):
super().__init__()
self.conv1 = nn.Conv2d(input_size,16,kernel_s... | code_fim | medium | {
"lang": "python",
"repo": "AbinavRavi/OODCancer",
"path": "/model/distillation_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = self.conv1(x)
x = self.relu(x)
x = self.conv2(x)
x = self.relu(x)
x = self.conv3(x)
x = self.relu(x)
x = self.conv4(x)
x = self.relu(x)
x = self.conv5(x)
x = self.relu(x)
# pdb.set_trace()
x = x.view(x.size... | code_fim | hard | {
"lang": "python",
"repo": "AbinavRavi/OODCancer",
"path": "/model/distillation_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, input_size,num_classes):
super().__init__()
self.conv1 = nn.Conv2d(input_size,16,kernel_size=2)
self.conv2 = nn.Conv2d(16,32,kernel_size=2)
self.conv3 = nn.Conv2d(32,64,kernel_size=2)
self.conv4 = nn.Conv2d(64,128,kernel_size=2)
self.... | code_fim | medium | {
"lang": "python",
"repo": "AbinavRavi/OODCancer",
"path": "/model/distillation_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, root):
resource.Resource.__init__(self)
self.root = root
def render_GET(self, txrequest):
args = txrequest.args
txrequest.responseHeaders.addRawHeader(b"content-type", b"application/json")
try:
sd = args.get(b'sd')
... | code_fim | hard | {
"lang": "python",
"repo": "tungpd/scrapyd",
"path": "/scrapyd/website.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tungpd/scrapyd path: /scrapyd/website.py
from datetime import datetime, timedelta
import socket
from twisted.web import resource, static
from twisted.application.service import IServiceCollection
from scrapy.utils.misc import load_object
from .interfaces import IPoller, IEggStorage, ISpiderSc... | code_fim | hard | {
"lang": "python",
"repo": "tungpd/scrapyd",
"path": "/scrapyd/website.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> resource.Resource.__init__(self)
self.root = root
def render_GET(self, txrequest):
args = txrequest.args
txrequest.responseHeaders.addRawHeader(b"content-type", b"application/json")
try:
sd = args.get(b'sd')
ed = args.get(b'ed')
... | code_fim | hard | {
"lang": "python",
"repo": "tungpd/scrapyd",
"path": "/scrapyd/website.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def forward(self, x):
x = x.view(x.size(0), -1)
out = self.layers(x)
return out
#-------------------------------------------------
# Tensorboard implementation
#-------------------------------------------------
model = MultiLayerPerceptron(input_size, hidden_size, num_classes... | code_fim | hard | {
"lang": "python",
"repo": "EgonFerri/Ex2_NN_backpropr",
"path": "/Assignment/Pytorch_improvements/Tensorboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = x.view(x.size(0), -1)
out = self.layers(x)
return out
#-------------------------------------------------
# Tensorboard implementation
#-------------------------------------------------
model = MultiLayerPerceptron(input_size, hidden_size, num_classes).to(device)
lr = learning... | code_fim | hard | {
"lang": "python",
"repo": "EgonFerri/Ex2_NN_backpropr",
"path": "/Assignment/Pytorch_improvements/Tensorboard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EgonFerri/Ex2_NN_backpropr path: /Assignment/Pytorch_improvements/Tensorboard.py
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torchvision.transforms as transforms
from torchbeare... | code_fim | hard | {
"lang": "python",
"repo": "EgonFerri/Ex2_NN_backpropr",
"path": "/Assignment/Pytorch_improvements/Tensorboard.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MoonSangJin/CodingTest path: /BaekJoon/11050.py
from math import factorial
<|fim_suffix|>if k<0 or k>n :
print(0)
else :
print(int(factorial(n)/(factorial(k)*(factorial(n-k)))))<|fim_middle|>n,k = map(int,input().split())
| code_fim | easy | {
"lang": "python",
"repo": "MoonSangJin/CodingTest",
"path": "/BaekJoon/11050.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if k<0 or k>n :
print(0)
else :
print(int(factorial(n)/(factorial(k)*(factorial(n-k)))))<|fim_prefix|># repo: MoonSangJin/CodingTest path: /BaekJoon/11050.py
from math import factorial
<|fim_middle|>n,k = map(int,input().split())
| code_fim | easy | {
"lang": "python",
"repo": "MoonSangJin/CodingTest",
"path": "/BaekJoon/11050.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pcastellazzi/tauon path: /tests/fixtures.py
from textwrap import dedent
from tauon import Command, expose
__all__ = (
"ExampleProgram0",
"ExampleProgram1",
"ExampleProgram2",
"ExampleProgram3",
"ExampleProgram4",
"ExampleProgram5",
"ExampleProgram6",
)
class Exampl... | code_fim | hard | {
"lang": "python",
"repo": "pcastellazzi/tauon",
"path": "/tests/fixtures.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ExampleProgram4(Command):
EXPECTED_DESCRIPTION = "banana"
class Config:
help = "banana" # noqa: A003
label = "banana"
description = "banana"
class ExampleProgram5(Command):
EXPECTED_DESCRIPTION = dedent(
"""
Usage: exampleprogram5 [commands]
... | code_fim | hard | {
"lang": "python",
"repo": "pcastellazzi/tauon",
"path": "/tests/fixtures.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>## Time Complexity: O( n )
#
# The major overhead in time is the for loop iterating on (i, p), which is of O( n ).
## Space Complexity: O( 1 )
#
# The major overhead in space is the variables for price computation, which is of O( 1 ).
def test_bench():
test_data = [
[7,1,5,3,6... | code_fim | hard | {
"lang": "python",
"repo": "brianchiang-tw/leetcode",
"path": "/No_0121_Best Time to Buy and Sell Stock/best_time_to_buy_and_sell_stock_by_valley_and_peak.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brianchiang-tw/leetcode path: /No_0121_Best Time to Buy and Sell Stock/best_time_to_buy_and_sell_stock_by_valley_and_peak.py
'''
Description:
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (... | code_fim | hard | {
"lang": "python",
"repo": "brianchiang-tw/leetcode",
"path": "/No_0121_Best Time to Buy and Sell Stock/best_time_to_buy_and_sell_stock_by_valley_and_peak.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tehsurfer/mapclientplugins.ecgstep path: /mapclientplugins/ecgstep/view/ui_addprofile.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui\addprofile.ui'
#
# Created: Mon Jul 9 16:05:49 2018
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All cha... | code_fim | hard | {
"lang": "python",
"repo": "Tehsurfer/mapclientplugins.ecgstep",
"path": "/mapclientplugins/ecgstep/view/ui_addprofile.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> AddProfileDialog.setWindowTitle(QtGui.QApplication.translate("AddProfileDialog", "Add Profile", None, QtGui.QApplication.UnicodeUTF8))
self.profileName_label.setText(QtGui.QApplication.translate("AddProfileDialog", "Profile name:", None, QtGui.QApplication.UnicodeUTF8))
self.apiTok... | code_fim | hard | {
"lang": "python",
"repo": "Tehsurfer/mapclientplugins.ecgstep",
"path": "/mapclientplugins/ecgstep/view/ui_addprofile.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>rfect Number")
else:
print("the number is not a perfect Number")<|fim_prefix|># repo: patricphinehas/Basic-Programs-in-python path: /perfectNumber.py
num = int(input(" enter the number to check for perfect Number"))
sum = 0
for i in range(1,num):
if(num%i==0):
sum = sum+i
#<|fim_middle|> ... | code_fim | medium | {
"lang": "python",
"repo": "patricphinehas/Basic-Programs-in-python",
"path": "/perfectNumber.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: patricphinehas/Basic-Programs-in-python path: /perfectNumber.py
num = int(input(" enter the number to check for perfect Number"))
sum = 0
for i in range(1,num):
if(num%i==0):
sum = sum+i
#<|fim_suffix|>rfect Number")
else:
print("the number is not a perfect Number")<|fim_middle|> ... | code_fim | medium | {
"lang": "python",
"repo": "patricphinehas/Basic-Programs-in-python",
"path": "/perfectNumber.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> real_ref_values, complex_ref_values = get_ref_values(sbf)
real_values = f(real_points['n'], real_points['z'])
complex_values = [f(x['n'], x['z']) for x in complex_points]
make_accuracy_plot(real_points, real_values, real_ref_values,
atol, rtol, "{}_real.png".format... | code_fim | hard | {
"lang": "python",
"repo": "tpudlik/sbf",
"path": "/accuracy/accuracy_plot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tpudlik/sbf path: /accuracy/accuracy_plot.py
"""Create accuracy plots for the given algorithm.
Usage: python accuracy_plot.py sbf algo
"""
import sys
from os import path
from itertools import izip
import numpy as np
from matplotlib import pyplot as plt
# Path hack
sys.path.append( path.dirna... | code_fim | hard | {
"lang": "python",
"repo": "tpudlik/sbf",
"path": "/accuracy/accuracy_plot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bakulrujak/hookcommander path: /main.py
from utils.config import Config, main
from repo import aws, jaguar
from urllib import parse
from flask import Flask, request, jesonify
app = Flask('__name__')
@app.route('/')
@app.route('/index')
def index():
return "Hello home!"
@app.route('/get-instan... | code_fim | hard | {
"lang": "python",
"repo": "bakulrujak/hookcommander",
"path": "/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
app.run(
host=main.host,
port=main.port,
debug=main.debug
)<|fim_prefix|># repo: bakulrujak/hookcommander path: /main.py
from utils.config import Config, main
from repo import aws, jaguar
from urllib import parse
from flask import Flask, request, jesonify
app = Flask('... | code_fim | hard | {
"lang": "python",
"repo": "bakulrujak/hookcommander",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "pong"
@app.route('/deploy/ec2/<string:commit>', methods=['GET'])
def deploy_ec2(commit):
return jsonify(aws.do_deploy(commit))
if __name__ == '__main__':
app.run(
host=main.host,
port=main.port,
debug=main.debug
)<|fim_prefix|># repo: bakulrujak/hookcommander path: /main.py
from util... | code_fim | hard | {
"lang": "python",
"repo": "bakulrujak/hookcommander",
"path": "/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dtklinh/Protein-Rigid-Domains-Estimation path: /mainPackage/PathAndDir.py
import os, sys
from pathlib import Path
#import pathlib
from GraphPackage.Graph_Config import CutOffContact
#Dir2Base = '../MyDataSet/DynDom/Perfect/BackUp/WithoutScaler_10.5'
Root_Dir = Path(__file__).parent.parent.absolu... | code_fim | hard | {
"lang": "python",
"repo": "dtklinh/Protein-Rigid-Domains-Estimation",
"path": "/mainPackage/PathAndDir.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>Path2ViterbiJar = os.path.join(str(Root_Dir),'Script/ViterbiJar/ViterbiAlgorithm.jar')
Dir2ClusterGraph = os.path.join(Dir2Base, 'ClusterGraph') #'../MyDataSet/DynDom/Perfect/Graph'
Dir2LineGraph = os.path.join(Dir2Base, 'LineGraph') #'../MyDataSet/DynDom/Perfect/LineGraph'
Dir2Vi... | code_fim | hard | {
"lang": "python",
"repo": "dtklinh/Protein-Rigid-Domains-Estimation",
"path": "/mainPackage/PathAndDir.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AniruddhaHumane/AirlineDelaysPrediction path: /Code/analysis.py
#-----Read data from 2008
flt2008=pd.read_csv('2008.csv')
print("shape of dataset : ", flt2008.shape)
print("Features in dataset : ", flt2008.columns)
print("No of features in dataset : ", flt2008.columns.shape)
# shape of datas... | code_fim | hard | {
"lang": "python",
"repo": "AniruddhaHumane/AirlineDelaysPrediction",
"path": "/Code/analysis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#-----Average Departure Delay by Carrier in 2008, Chicago
plt.figure(figsize =(12,8))
flt2008ORD[['UniqueCarrier','ArrDelay']].groupby('UniqueCarrier').mean().plot(kind='bar', figsize =(12,8), color=colorLib[0])
plt.xticks(rotation=0)
plt.xlabel('Carrier')
plt.ylabel('Average Delay in Min')
plt.titl... | code_fim | hard | {
"lang": "python",
"repo": "AniruddhaHumane/AirlineDelaysPrediction",
"path": "/Code/analysis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>er('sip.tc.sdp_logger')
__all__ = [
'__subsystem__',
'__service_name__',
'__version__',
'__service_id__',
'LOG'
]<|fim_prefix|># repo: SKA-ScienceDataProcessor/integration-prototype path: /sip/tango_control/tango_logger/app/release.py
# -*- coding: utf-8 -*-
"""SIP Tango Logger Device... | code_fim | hard | {
"lang": "python",
"repo": "SKA-ScienceDataProcessor/integration-prototype",
"path": "/sip/tango_control/tango_logger/app/release.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SKA-ScienceDataProcessor/integration-prototype path: /sip/tango_control/tango_logger/app/release.py
# -*- coding: utf-8 -*-
"""SIP Tango Logger Device package."""
import logging
__subsystem__ = 'TangoControl'
__service_name__ = 'SDP<|fim_suffix|>er('sip.tc.sdp_logger')
__all__ = [
'__subsyste... | code_fim | hard | {
"lang": "python",
"repo": "SKA-ScienceDataProcessor/integration-prototype",
"path": "/sip/tango_control/tango_logger/app/release.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ministryofjustice/money-to-prisoners-api path: /mtp_api/apps/notification/models.py
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import gettext_lazy as _
... | code_fim | hard | {
"lang": "python",
"repo": "ministryofjustice/money-to-prisoners-api",
"path": "/mtp_api/apps/notification/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class EmailNotificationPreferences(models.Model):
"""
Indicates that a user wishes to receive notifications by email
NB: only DAILY is currently supported in noms-ops and email-sending management command
"""
user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCAD... | code_fim | hard | {
"lang": "python",
"repo": "ministryofjustice/money-to-prisoners-api",
"path": "/mtp_api/apps/notification/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class SenderProfileEvent(models.Model):
"""
Links a notification to a sender profile
"""
event = models.OneToOneField(
Event, on_delete=models.CASCADE, related_name='sender_profile_event'
)
sender_profile = models.ForeignKey(SenderProfile, on_delete=models.CASCADE)
class ... | code_fim | hard | {
"lang": "python",
"repo": "ministryofjustice/money-to-prisoners-api",
"path": "/mtp_api/apps/notification/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if args.provider == "fake":
cloud_config = load_cloud_config(provider="fake")
cloud = create_cloud()
prefix = "testmap"
@atexit.register
def cleanup():
print "cleanup"
fname = "/tmp/fakeclusters/testmap.json"
if osp.exists(fna... | code_fim | hard | {
"lang": "python",
"repo": "SFPD/rlreloaded",
"path": "/maintenance/tests_old/test_map.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pool = ClusterPool(cloud, cluster, start_mode = "tabula_rasa")
else:
raise RuntimeError
time.sleep(1)
for i in xrange(10):
result = pool.map(math.sqrt, range(100))
print "result:", result<|fim_prefix|># repo: SFPD/rlreloaded path: /maintenance/tests_old/test_m... | code_fim | hard | {
"lang": "python",
"repo": "SFPD/rlreloaded",
"path": "/maintenance/tests_old/test_map.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SFPD/rlreloaded path: /maintenance/tests_old/test_map.py
#!/usr/bin/env python
from cloud.cloud_interface import *
import os,atexit
import os.path as osp
from cloud.cluster_pool import ClusterPool
import time
from control3.common import setup_logging
import math
if __name__ == "__main__":
im... | code_fim | hard | {
"lang": "python",
"repo": "SFPD/rlreloaded",
"path": "/maintenance/tests_old/test_map.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> row = box.row()
col = row.column(align=True)
col.prop(r, "object1", icon_only=True)
col.enabled = False
col = row.column(align=True)
col.prop(r, "object2", icon_only=True)
col.enabled = False
op = layout... | code_fim | hard | {
"lang": "python",
"repo": "Taremin/TareminPoseChecker",
"path": "/lib/dialog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Taremin/TareminPoseChecker path: /lib/dialog.py
import bpy
from . import exclude, util, pose_checker, result
class TareminPoseChecker_OT_SelectPoseDialog(bpy.types.Operator):
bl_idname = "taremin.pose_checker_select_pose_dialog"
bl_label = "TareminPoseChecker_OT_SelectPoseDialog... | code_fim | hard | {
"lang": "python",
"repo": "Taremin/TareminPoseChecker",
"path": "/lib/dialog.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> op = col.operator(
exclude.TareminPoseChecker_OT_ExcludeList_Add.bl_idname, text="", icon="X")
op.target_index = self.target_index
op.test_index = self.test_index
op.result_index = i
op = col.operator(
pose... | code_fim | hard | {
"lang": "python",
"repo": "Taremin/TareminPoseChecker",
"path": "/lib/dialog.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pprint(rows)
return render_template("main.html", day=day, timeslots=timeslots, form=form)
def round_time(time):
return time - timedelta(minutes=time.minute % 15, seconds=time.second)
def slot(day, index, hours=0):
day = datetime(day.year, day.month, day.day)
day = d... | code_fim | hard | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/MY_REPOS/web-dev-notes-resource-site/core-site/other-pages/blog-posts/0-projects/calendar-this-solution/calendar-this/solution/app/routes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@bp.route("/<int:year>/<int:month>/<int:day>", methods=["GET", "POST"])
def daily(year, month, day):
form = AppointmentForm()
if form.validate_on_submit():
with psycopg2.connect(**CONNECTION_PARAMETERS) as conn:
with conn.cursor() as insert:
sql = """
... | code_fim | hard | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/MY_REPOS/web-dev-notes-resource-site/core-site/other-pages/blog-posts/0-projects/calendar-this-solution/calendar-this/solution/app/routes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bgoonz/UsefulResourceRepo2.0 path: /MY_REPOS/web-dev-notes-resource-site/core-site/other-pages/blog-posts/0-projects/calendar-this-solution/calendar-this/solution/app/routes.py
from datetime import datetime, timedelta
from flask import Blueprint, redirect, render_template, url_for
from app.forms ... | code_fim | hard | {
"lang": "python",
"repo": "bgoonz/UsefulResourceRepo2.0",
"path": "/MY_REPOS/web-dev-notes-resource-site/core-site/other-pages/blog-posts/0-projects/calendar-this-solution/calendar-this/solution/app/routes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pattern = '^a...s$'
test_string = 'abyss'
result = re.match(pattern, test_string)<|fim_prefix|># repo: pabmar68hotmail/betca-python path: /language/snippet/regular_expresion.py
import re
pattern = '^miw-(betca|spring|python)$'
test_string = 'miw-spring'
result = re.match(pattern, test_string)
<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "pabmar68hotmail/betca-python",
"path": "/language/snippet/regular_expresion.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pabmar68hotmail/betca-python path: /language/snippet/regular_expresion.py
import re
pattern = '^miw-(betca|spring|python)$'
test_string = 'miw-spring'
result = re.match(pattern, test_string)
<|fim_suffix|>pattern = '^a...s$'
test_string = 'abyss'
result = re.match(pattern, test_string)<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "pabmar68hotmail/betca-python",
"path": "/language/snippet/regular_expresion.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># In[23]:
plot_training_results(sarsa_df, "Sarsa", f"sarsa_training_scores_alpha_{alpha}_gamma_{gamma}")
# ## Q-Learning
# In[24]:
qlearning = QLearning(action_space=env.action_space, alpha=alpha, gamma=gamma)
# In[25]:
q_learning_scores = []
for i_episode in range(1, n_episodes + 1):
env ... | code_fim | hard | {
"lang": "python",
"repo": "brunobelluomini/flappy_bird_with_TD_learning",
"path": "/Flappy Bird Training.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: brunobelluomini/flappy_bird_with_TD_learning path: /Flappy Bird Training.py
.game_score)
if i_episode % 100 == 0:
print("\rEpisode {}/{} - Max Score {}".format(i_episode, n_episodes, np.array(sarsa_scores).max()), end="")
sys.stdout.flush()
sarsa.epsilon = get_ep... | code_fim | hard | {
"lang": "python",
"repo": "brunobelluomini/flappy_bird_with_TD_learning",
"path": "/Flappy Bird Training.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>pd.DataFrame(
{
'Sarsa': sarsa_final_score,
'Q-Learning': qlearning_final_score,
'Expected Sarsa': expected_sarsa_final_score,
'Benchmark Model': 675,
'AvgScore100': 'AvgScore100'
}
).set_index("AvgScore100")
# ---
# # $\alpha = 0.15$ ; $\gamma = 1.00$
#... | code_fim | hard | {
"lang": "python",
"repo": "brunobelluomini/flappy_bird_with_TD_learning",
"path": "/Flappy Bird Training.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: newcraftgroup/nci-python-commands path: /commandable/commands/create_command.py
# Copyright 2017 NEWCRAFT GROUP B.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License ... | code_fim | hard | {
"lang": "python",
"repo": "newcraftgroup/nci-python-commands",
"path": "/commandable/commands/create_command.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> namespaces = Config.get("Commands") or {}
choice = self.list_options(namespaces)
if choice == 0:
namespace = self.create_namespace()
namespaces[namespace[0]] = namespace[1]
self.register_namespace(namespace[0], namespace[1].replace("./", "").r... | code_fim | hard | {
"lang": "python",
"repo": "newcraftgroup/nci-python-commands",
"path": "/commandable/commands/create_command.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def _file_to_word_ids(filename, word_to_id, min_sentence_length, max_sentence_length):
raw_data = _read_words(filename)
buffer = []
sentences = []
for word in raw_data:
buffer.append(word)
if word == '<eos>':
if min_sentence_length < len(buffer) < max_sentence_... | code_fim | hard | {
"lang": "python",
"repo": "menajosep/models",
"path": "/tutorials/rnn/ptb/reader_cloze.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return random.randint(0, len(sentence)-1)
def ptb_producer(raw_data, batch_size, num_steps, word_to_id):
"""Iterate on the raw PTB data.
This chunks up raw_data into batches of examples and returns these batches.
Args:
raw_data: one of the raw data outputs from ptb_raw_data.
... | code_fim | hard | {
"lang": "python",
"repo": "menajosep/models",
"path": "/tutorials/rnn/ptb/reader_cloze.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: menajosep/models path: /tutorials/rnn/ptb/reader_cloze.py
# Copyright 2015 The TensorFlow Authors. 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 of the License at
... | code_fim | hard | {
"lang": "python",
"repo": "menajosep/models",
"path": "/tutorials/rnn/ptb/reader_cloze.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aosingh/sqlite_rx path: /sqlite_rx/cli/server.py
import logging.config
import typing
import platform
from pprint import pformat
import click
import rich.console
import rich.markup
import rich.progress
import rich.syntax
import rich.table
from sqlite_rx import get_default_logger_settings, __ve... | code_fim | hard | {
"lang": "python",
"repo": "aosingh/sqlite_rx",
"path": "/sqlite_rx/cli/server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@click.command(add_help_option=False)
@click.version_option(__version__, '-v', '--version', message='%(version)s')
@click.option('--log-level',
'-l',
default='INFO',
help="Logging level",
type=click.Choice("CRITICAL FATAL ERROR WARN WARNING INFO DEBU... | code_fim | hard | {
"lang": "python",
"repo": "aosingh/sqlite_rx",
"path": "/sqlite_rx/cli/server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if len(sys.argv) not in (1, 3, 4):
quit(1)
else:
app.start()
LOGGER.info("Simple chatbot written using the pyrogram library.\nUses Intellivoid's Coffeehouse API.\n")
LOGGER.info("Your bot is now online.")
app.idle()<|fim_prefix|># repo: thatshowitworks/Chatbot path: /chatbot/__main__.... | code_fim | easy | {
"lang": "python",
"repo": "thatshowitworks/Chatbot",
"path": "/chatbot/__main__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thatshowitworks/Chatbot path: /chatbot/__main__.py
import sys
from chatbot import app, LOGGER
<|fim_suffix|>if len(sys.argv) not in (1, 3, 4):
quit(1)
else:
app.start()
LOGGER.info("Simple chatbot written using the pyrogram library.\nUses Intellivoid's Coffeehouse API.\n")
LOGGER... | code_fim | easy | {
"lang": "python",
"repo": "thatshowitworks/Chatbot",
"path": "/chatbot/__main__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> >>> from os import environ
>>> note = GitLabComment(GitLabOAuthToken(environ['GITLAB_TEST_TOKEN']),
... 'gitmate-test-user/test', 1,
... CommentType.ISSUE, 31500135)
>>> note.updated
datetime.datetime(2017, 6, 5, 6, ... | code_fim | hard | {
"lang": "python",
"repo": "theendsofinvention/igit",
"path": "/IGitt/GitLab/GitLabComment.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: theendsofinvention/igit path: /IGitt/GitLab/GitLabComment.py
"""
Represents a comment (or note) on GitLab.
"""
from typing import Union
from urllib.parse import quote_plus
from datetime import datetime
from IGitt.GitLab import GitLabMixin
from IGitt.GitLab import GitLabOAuthToken, GitLabPrivateT... | code_fim | hard | {
"lang": "python",
"repo": "theendsofinvention/igit",
"path": "/IGitt/GitLab/GitLabComment.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>##Query id, query start, query end, qurey length, Subject id, subject start, subject end, alignment length, % identity, e-value,bit score
d = {}
for lines in open(sys.argv[1], 'r'):
lexemes = lines.strip().split('\t')
asv_id = lexemes[0]
asv_len = float(lexemes[3])
matching_contig = lexemes[4]
aln_l... | code_fim | medium | {
"lang": "python",
"repo": "fandemonium/code",
"path": "/parsers/blast_parser_b_multi.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fandemonium/code path: /parsers/blast_parser_b_multi.py
#! /usr/bin/env python
#Parser for blast -m 8 or blast+ -m 6 and 7 output file with description inserted
import sys
import numpy
import re
##Query id, query start, query end, qurey length, Subject id, subject start, subject end, alignment... | code_fim | hard | {
"lang": "python",
"repo": "fandemonium/code",
"path": "/parsers/blast_parser_b_multi.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.