text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> acc = mx.metric.create('acc')
(speed,) = score(load_epoch = args.load_epoch,image_shape = args.image_shape,model=args.pretrained_model, data_val=args.test_rec,rgb_mean='123.68,116.779,103.939', metrics=acc, **kwargs)
r = acc.get()[1]
print('Tested %s, acc = %f, speed = %f img/sec' % (args.... | code_fim | hard | {
"lang": "python",
"repo": "likelyzhao/lightweightcnn",
"path": "/image-classification/test_score.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_jobs_submitter__generate_reports(example_output, cleanup):
ret = JobSubmitter.generate_reports(example_output, True)
assert ret == 0
for filename in ("errors.txt", "results.txt", "stats.txt"):
path = os.path.join(example_output, filename)
assert os.path.exists(path)<|... | code_fim | medium | {
"lang": "python",
"repo": "jgu2/jade",
"path": "/tests/unit/jobs/test_job_submitter.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_jobs_submitter__generate_reports(example_output, cleanup):
ret = JobSubmitter.generate_reports(example_output, True)
assert ret == 0
for filename in ("errors.txt", "results.txt", "stats.txt"):
path = os.path.join(example_output, filename)
assert os.path.exists(path)<|f... | code_fim | hard | {
"lang": "python",
"repo": "jgu2/jade",
"path": "/tests/unit/jobs/test_job_submitter.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jgu2/jade path: /tests/unit/jobs/test_job_submitter.py
import os
import pytest
from jade.jobs.job_submitter import JobSubmitter
def test_jobs_submitter__find_error_log_messages(example_output):
events = list(JobSubmitter.find_error_log_messages(example_output))
assert len(events) == 4... | code_fim | hard | {
"lang": "python",
"repo": "jgu2/jade",
"path": "/tests/unit/jobs/test_job_submitter.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> with tf.variable_scope(scope):
s4, s2 = int(output_dim / 4), int(output_dim / 2)
z_ = layers.linear(x, s4 * s4 * n_filters * 2)
h0 = tf.reshape(z_, [-1, s4, s4, n_filters * 2])
h1 = layers.convolution2d_transpose(h0, n_filters, [5, 5], stride=2)
h1 = tf.nn.elu(h1)
h2 = layers.con... | code_fim | medium | {
"lang": "python",
"repo": "krantirk/GAN",
"path": "/images.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: krantirk/GAN path: /images.py
from functools import partial
import logging
import numpy as np
import scipy.misc
import tensorflow as tf
from tensorflow.contrib import learn
from tensorflow.contrib import layers
import model
import visualization
def linear_generator(x, output_dim, scope='Gene... | code_fim | medium | {
"lang": "python",
"repo": "krantirk/GAN",
"path": "/images.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> db = LocalData(s.root)
db.cur.execute("SELECT COUNT() FROM SyncFiles")
count = db.cur.fetchone()
self.assertEqual(
TestAccount.image_count_2016,
count[0],
"expected {} items in 2016".format(TestAccount.image_co... | code_fim | hard | {
"lang": "python",
"repo": "gilesknap/gphotos-sync",
"path": "/tests/test_system/test_system.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # force an update to the 'most recently scanned file' record
# (this is normally only set for complete scans and was tested in
# test_sys_whole_library)
db.set_scan_date(Utils.string_to_date("2017-01-01"))
db.store()
with ts.SetupDbAndCr... | code_fim | hard | {
"lang": "python",
"repo": "gilesknap/gphotos-sync",
"path": "/tests/test_system/test_system.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gilesknap/gphotos-sync path: /tests/test_system/test_system.py
G_2117.JPG"
date = datetime.fromtimestamp(os.path.getmtime(str(name)))
expected = datetime(2017, 9, 26, 15, 29, 44)
self.assertEqual(
expected, date.replace(microsecond=0), "Modify d... | code_fim | hard | {
"lang": "python",
"repo": "gilesknap/gphotos-sync",
"path": "/tests/test_system/test_system.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: secnot/python-graph-datasets path: /graph_datasets/mazes/pmaze7.py
[41, 23],
[85, 0, 26],
[47, 25],
[3, 28],
[67, 27],
[6, 30],
[7, 29],
[55, 32],
[8, 31],
[34],
[73, 33],
[58, 36],
[17, 35],
[92, 38],
[9, 37],
[20, 40],
[21, 39],
... | code_fim | hard | {
"lang": "python",
"repo": "secnot/python-graph-datasets",
"path": "/graph_datasets/mazes/pmaze7.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Cleanup
pane._cleanup(model)
assert pane._models == {}
@pyvista_available
def test_vtk_pane_more_complex(document, comm):
renWin = pyvista_render_window()
pane = VTK(renWin)
# Create pane
model = pane.get_root(document, comm=comm)
assert isinstance(model, VTKPlot)
... | code_fim | hard | {
"lang": "python",
"repo": "MarcSkovMadsen/panel",
"path": "/panel/tests/pane/test_vtk.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MarcSkovMadsen/panel path: /panel/tests/pane/test_vtk.py
# coding: utf-8
from __future__ import absolute_import
import os
import base64
from io import BytesIO
from zipfile import ZipFile
import pytest
import numpy as np
try:
import vtk
except Exception:
vtk = None
try:
import pyv... | code_fim | hard | {
"lang": "python",
"repo": "MarcSkovMadsen/panel",
"path": "/panel/tests/pane/test_vtk.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Create pane
model = pane.get_root(document, comm=comm)
assert isinstance(model, VTKPlot)
assert pane._models[model.ref['id']][0] is model
assert isinstance(model.data, string_types)
@vtk_available
def test_vtk_pane_from_renwin(document, comm, tmp_path):
renWin = make_render_win... | code_fim | hard | {
"lang": "python",
"repo": "MarcSkovMadsen/panel",
"path": "/panel/tests/pane/test_vtk.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>odd_sq_new = [i**2 for i in range(23) if i% 2==1]
print(odd_sq_new)<|fim_prefix|># repo: Pratham82/Python-Programming path: /Python-easy-tricks/Odd_squares.py
# Get the square of only odd numbers and store it in a list
<|fim_middle|># nomral way
odd_sq = []
for i in range(23):
if i % 2 ==1:
... | code_fim | medium | {
"lang": "python",
"repo": "Pratham82/Python-Programming",
"path": "/Python-easy-tricks/Odd_squares.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pratham82/Python-Programming path: /Python-easy-tricks/Odd_squares.py
# Get the square of only odd numbers and store it in a list
# nomral way
odd_sq = []
for i in range(23):
if i % 2 ==1:
odd_sq.append(i**2)
<|fim_suffix|>odd_sq_new = [i**2 for i in range(23) if i% 2==1]
print(odd... | code_fim | easy | {
"lang": "python",
"repo": "Pratham82/Python-Programming",
"path": "/Python-easy-tricks/Odd_squares.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: scylla/masters_thesis path: /code/seq2seq_graph/src/theanets-0.6.1/test/activations_test.py
import theanets
class TestBuild:
def test_build(self):
a = theanets.layers.Feedforward(
inputs=2, size=3, activation='relu').activate
assert callable(a)
assert a.n... | code_fim | hard | {
"lang": "python",
"repo": "scylla/masters_thesis",
"path": "/code/seq2seq_graph/src/theanets-0.6.1/test/activations_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> l = theanets.layers.Feedforward(
inputs=2, size=3, activation='lgrelu', name='l')
actual = sorted(p.name for p in l.params)
assert actual == ['l.b', 'l.gain', 'l.leak', 'l.w'], actual
def test_maxout(self):
l = theanets.layers.Feedforward(
input... | code_fim | hard | {
"lang": "python",
"repo": "scylla/masters_thesis",
"path": "/code/seq2seq_graph/src/theanets-0.6.1/test/activations_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_prelu(self):
l = theanets.layers.Feedforward(
inputs=2, size=3, activation='prelu', name='l')
actual = sorted(p.name for p in l.params)
assert actual == ['l.b', 'l.leak', 'l.w'], actual
def test_lgrelu(self):
l = theanets.layers.Feedforward(
... | code_fim | medium | {
"lang": "python",
"repo": "scylla/masters_thesis",
"path": "/code/seq2seq_graph/src/theanets-0.6.1/test/activations_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bryceprince0/it-assets path: /webconfig/api_v2.py
from rest_framework import viewsets, serializers
from webconfig.models import Site, Location
class LocationSerializer(serializers.ModelSerializer):
class Meta:
<|fim_suffix|> queryset = Site.objects.order_by('fqdn__name', 'fqdn__domain__n... | code_fim | hard | {
"lang": "python",
"repo": "bryceprince0/it-assets",
"path": "/webconfig/api_v2.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Site
fields = ('fqdn', 'enabled', 'status', 'availability', 'aliases', 'allow_https', 'allow_http', 'rules', 'locations')
class SiteViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Site.objects.order_by('fqdn__name', 'fqdn__domain__name')
serializer_class = SiteSerializ... | code_fim | hard | {
"lang": "python",
"repo": "bryceprince0/it-assets",
"path": "/webconfig/api_v2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = Location
fields = ('path', 'rules', 'auth_level', 'allow_cors', 'allow_websockets')
class SiteSerializer(serializers.ModelSerializer):
locations = LocationSerializer(many=True, read_only=True)
fqdn = serializers.StringRelatedField()
aliases = serialize... | code_fim | medium | {
"lang": "python",
"repo": "bryceprince0/it-assets",
"path": "/webconfig/api_v2.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: home-assistant/core path: /tests/components/esphome/test_media_player.py
"""Test ESPHome media_players."""
from unittest.mock import AsyncMock, Mock, call
from aioesphomeapi import (
APIClient,
MediaPlayerCommand,
MediaPlayerEntityState,
MediaPlayerInfo,
MediaPlayerState,
)
... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/esphome/test_media_player.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> entity_info = [
MediaPlayerInfo(
object_id="mymedia_player",
key=1,
name="my media_player",
unique_id="my_media_player",
supports_pause=True,
)
]
states = [
MediaPlayerEntityState(
key=1, volume=50,... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/esphome/test_media_player.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> mock_client.media_player_command.reset_mock()
client = await hass_ws_client()
await client.send_json(
{
"id": 1,
"type": "media_player/browse_media",
"entity_id": "media_player.test_mymedia_player",
}
)
response = await client.receive... | code_fim | hard | {
"lang": "python",
"repo": "home-assistant/core",
"path": "/tests/components/esphome/test_media_player.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>for i in range(len(arr)):
freq[arr[i]] += 1
print(freq.index(max(freq)))<|fim_prefix|># repo: 0x8b/competitive-programming path: /hackerrank/MigrationBirds.py
arr_count = int(input().strip())
arr = list(map(int, input().rstrip().split()))
<|fim_middle|>freq = [0] * 6
| code_fim | easy | {
"lang": "python",
"repo": "0x8b/competitive-programming",
"path": "/hackerrank/MigrationBirds.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0x8b/competitive-programming path: /hackerrank/MigrationBirds.py
arr_count = int(input().strip())
arr = list(map(int, input().rstrip().split()))
freq = [0] * 6
<|fim_suffix|>print(freq.index(max(freq)))<|fim_middle|>for i in range(len(arr)):
freq[arr[i]] += 1
| code_fim | easy | {
"lang": "python",
"repo": "0x8b/competitive-programming",
"path": "/hackerrank/MigrationBirds.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Forum-Informationsfreiheit/OffenesParlament path: /offenesparlament/op_scraper/subscriptions.py
getLogger('op_scraper.subscriptions.diff')
FIELD_BLACKLIST = ['text', 'ts', 'internal_link', 'index_name']
class JsonDiffer(object):
FIELD_MESSAGES = {}
def __init__(self, _content=None, old... | code_fim | hard | {
"lang": "python",
"repo": "Forum-Informationsfreiheit/OffenesParlament",
"path": "/offenesparlament/op_scraper/subscriptions.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ck in self.changes.keys():
index_name = cur_dict[ck]['index_name']
cd = CATEGORY_DIFFERS.get(index_name)
cd = cd(
old_content=[v for v in self.old_content if v['parl_id']==ck],
cur_content=[v for v in self.cur_content ... | code_fim | hard | {
"lang": "python",
"repo": "Forum-Informationsfreiheit/OffenesParlament",
"path": "/offenesparlament/op_scraper/subscriptions.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Forum-Informationsfreiheit/OffenesParlament path: /offenesparlament/op_scraper/subscriptions.py
tabulate import tabulate
from offenesparlament.constants import LAW, PERSON, DEBATE, EMAIL, SEARCH
current_content = {}
# import the logging library
import logging
# Get an instance of a logger
logg... | code_fim | hard | {
"lang": "python",
"repo": "Forum-Informationsfreiheit/OffenesParlament",
"path": "/offenesparlament/op_scraper/subscriptions.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># %% parse identical lineages, but collapse in one axe
splt5 = SamplePlot(ou, parser.iter_colonies(size=5), parser=parser,
conditions=[condition, ])
splt5.make_plot(report_condition=repr(condition),change_colony_color=True,
superimpose='all', show_markers=False, alpha=.5... | code_fim | hard | {
"lang": "python",
"repo": "sylvinus/tunacell",
"path": "/scripts/plotting-samples.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sylvinus/tunacell path: /scripts/plotting-samples.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
plotting-samples.py
"""
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from tuna import Parser, Observable, FilterSet
from tuna.filters.cells import... | code_fim | hard | {
"lang": "python",
"repo": "sylvinus/tunacell",
"path": "/scripts/plotting-samples.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># %% plot two contiguous colonies from samples with condition
splt2 = SamplePlot(length, parser.iter_colonies(mode='samples', size=2),
parser=parser, conditions=[condition, ])
splt2.make_plot(report_condition=repr(condition), change_colony_color=True)
splt2.save(user_bname='colonies-eve... | code_fim | hard | {
"lang": "python",
"repo": "sylvinus/tunacell",
"path": "/scripts/plotting-samples.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aalfath/eve-inc-waitlist path: /waitlist/blueprints/accounts/commandcore.py
import logging
from flask.blueprints import Blueprint
from waitlist.permissions import perm_manager
from flask_login import login_required
from waitlist import db
from waitlist.storage.database import Account
from flask.t... | code_fim | medium | {
"lang": "python",
"repo": "aalfath/eve-inc-waitlist",
"path": "/waitlist/blueprints/accounts/commandcore.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@bp.route("/", methods=["GET"])
@login_required
@perm_manager.require('commandcore')
def accounts():
# noinspection PyPep8
accs = db.session.query(Account).filter(Account.disabled == False).order_by(Account.username).all()
return render_template("waitlist/tools/commandcore_list.html", account... | code_fim | medium | {
"lang": "python",
"repo": "aalfath/eve-inc-waitlist",
"path": "/waitlist/blueprints/accounts/commandcore.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # noinspection PyPep8
accs = db.session.query(Account).filter(Account.disabled == False).order_by(Account.username).all()
return render_template("waitlist/tools/commandcore_list.html", accounts=accs)<|fim_prefix|># repo: aalfath/eve-inc-waitlist path: /waitlist/blueprints/accounts/commandcore... | code_fim | medium | {
"lang": "python",
"repo": "aalfath/eve-inc-waitlist",
"path": "/waitlist/blueprints/accounts/commandcore.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Website cmd
@commands.command(
aliases = ['web'],
help = ('Visit the website of Denzven-Graphing-Api'),
name = 'Website',
description = 'Visit the website of Denzven-Graphing-Api',
)
async def website(self,ctx):
await ctx.reply(API_BASE_LINK, allow... | code_fim | hard | {
"lang": "python",
"repo": "45i/Denzven-Graphing-Api-Bot",
"path": "/commands/commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 45i/Denzven-Graphing-Api-Bot path: /commands/commands.py
# you can invite the bot here: https://dsc.gg/denzven-graphing-api-bot
# for doubts and queries Join the support/chill server:
# https://dsc.gg/chilly_place
# These are all the "sub-commands" of the bot,
# Like, attr, botinfo, suggest ,vo... | code_fim | hard | {
"lang": "python",
"repo": "45i/Denzven-Graphing-Api-Bot",
"path": "/commands/commands.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # a fancier invite
@commands.command(
aliases = ['inv2'],
help = ('Invite the Bot in your Server! with a fancy link!'),
name = 'Invite2',
description = 'Invite the Bot in your Server! with a fancy link',
)
async def invite2(self,ctx):
await ctx.reply... | code_fim | hard | {
"lang": "python",
"repo": "45i/Denzven-Graphing-Api-Bot",
"path": "/commands/commands.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # we can import .py, .pyc and .pyo file types
extensions = [
'.py',
'.pyc',
'.pyo'
]
if extension not in extensions:
continue
__all__.append( name )<|fim_prefix|># repo: adamlwgriffiths/PyGLy path: /pygly/__init__.py
import pkgutil
import os
# th... | code_fim | medium | {
"lang": "python",
"repo": "adamlwgriffiths/PyGLy",
"path": "/pygly/__init__.py",
"mode": "spm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adamlwgriffiths/PyGLy path: /pygly/__init__.py
import pkgutil
import os
# the version of software
# this is used by the setup.py script
from version import __version__
# make 'from module import *' work dynamically.
# otherwise we have to manually update the __all__ list.
# http://stackoverflow... | code_fim | medium | {
"lang": "python",
"repo": "adamlwgriffiths/PyGLy",
"path": "/pygly/__init__.py",
"mode": "psm",
"license": "BSD-2-Clause-Views",
"source": "the-stack-v2"
} |
<|fim_suffix|> return request_handler.settings.get(setting_name(name),
DEFAULTS.get(name, None))
def load_strategy(request_handler):
strategy = get_helper(request_handler, 'STRATEGY')
storage = get_helper(request_handler, 'STORAGE')
return get_strategy(strategy, ... | code_fim | medium | {
"lang": "python",
"repo": "python-social-auth/social-app-tornado",
"path": "/social_tornado/utils.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: python-social-auth/social-app-tornado path: /social_tornado/utils.py
import warnings
from functools import wraps
from social_core.utils import setting_name, get_strategy
from social_core.backends.utils import get_backend
<|fim_suffix|> strategy = get_helper(request_handler, 'STRATEGY')
... | code_fim | hard | {
"lang": "python",
"repo": "python-social-auth/social-app-tornado",
"path": "/social_tornado/utils.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>reservation = client.createReservation(payload)
print "Reservation created: {id}".format(id=reservation)<|fim_prefix|># repo: torchedplatypi/vra7_rest_wrapper path: /examples/reservation/createReservationsJinja2/createReservation.py
#!/usr/bin/python
import getpass
import json
import os
from jinja2 im... | code_fim | hard | {
"lang": "python",
"repo": "torchedplatypi/vra7_rest_wrapper",
"path": "/examples/reservation/createReservationsJinja2/createReservation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: torchedplatypi/vra7_rest_wrapper path: /examples/reservation/createReservationsJinja2/createReservation.py
#!/usr/bin/python
import getpass
import json
import os
from jinja2 import Environment, FileSystemLoader
from globalconfig import url, usr, passwd
from vraapiclient import reservation
#Get... | code_fim | hard | {
"lang": "python",
"repo": "torchedplatypi/vra7_rest_wrapper",
"path": "/examples/reservation/createReservationsJinja2/createReservation.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: edwinjosegeorge/Hacktoberfest-1 path: /Hackerrank/ClimbingTheLeaderBoard.py
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the climbingLeaderboard function below.
def climbingLeaderboard(scores, alice):
alice.sort(reverse=True)
scores=list(set(scores)... | code_fim | medium | {
"lang": "python",
"repo": "edwinjosegeorge/Hacktoberfest-1",
"path": "/Hackerrank/ClimbingTheLeaderBoard.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
scores_count = int(input())
scores = list(map(int, input().rstrip().split()))
alice_count = int(input())
alice = list(map(int, input().rstrip().split()))
result = climbingLeaderboard(scores, alice)
fpt... | code_fim | hard | {
"lang": "python",
"repo": "edwinjosegeorge/Hacktoberfest-1",
"path": "/Hackerrank/ClimbingTheLeaderBoard.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RCUzzi/BGDVisualizer path: /bgdvisualizer.py
import os, sys, getopt, argparse
import numpy as np
from matplotlib import pyplot as plt
def main(argv):
# initialize parser
parser = argparse.ArgumentParser()
#add optional arguments
parser.add_argument('-d', '--datafile', dest = 'd... | code_fim | hard | {
"lang": "python",
"repo": "RCUzzi/BGDVisualizer",
"path": "/bgdvisualizer.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def batch_gradient_descent(features, values, theta, alpha, iterations, show=False, show_cost=False, wait=False):
m = values.shape[0]
cost_history = []
if(show == True):
figure = plt.figure()
for i in range(iterations):
theta = theta - (alpha / m)*(np.dot(features, theta)-... | code_fim | hard | {
"lang": "python",
"repo": "RCUzzi/BGDVisualizer",
"path": "/bgdvisualizer.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return "Cleanup step"
class TestingStep(Step):
"""
Testing the contents of the output file
"""
def execute(self, execution_context):
checker = BasicChecker()
report = checker.check(execution_context)
sep = '=' * 50
for test_number in report:
... | code_fim | hard | {
"lang": "python",
"repo": "chermehdi/egor",
"path": "/egor/judge/builder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chermehdi/egor path: /egor/judge/builder.py
import sys
from knack.log import get_logger
from egor.judge.verdict import Verdict
from egor.util import print_green_text, print_red_text, print_yellow_text
from .checker import BasicChecker
logger = get_logger(__name__)
class Step:
"""
An ... | code_fim | hard | {
"lang": "python",
"repo": "chermehdi/egor",
"path": "/egor/judge/builder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise NotImplementedError()
def name(self):
return "Cleanup step"
class TestingStep(Step):
"""
Testing the contents of the output file
"""
def execute(self, execution_context):
checker = BasicChecker()
report = checker.check(execution_context)
... | code_fim | hard | {
"lang": "python",
"repo": "chermehdi/egor",
"path": "/egor/judge/builder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>agai
# slot1, slot2, dan slot3. Jika kami menginginkan lebih, kami akan melakukannya
# membutuhkan slot4, slot5, dan sebagainya.
#
# fungsi choice () adalah dari acak yang kita impor
# di atas dan fungsi itu akan mendapatkan satu (dan hanya satu) dari
# elemen yang mungkin pada larik yang kita buat di ata... | code_fim | hard | {
"lang": "python",
"repo": "Myyepz/YSlotMachine",
"path": "/Slot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Myyepz/YSlotMachine path: /Slot.py
#HANYA EXAMPLE
#--------------------------------------------#
print("Selamat datang di slot game mesin!")
#--------------------------------------------#
numOfPlay = ('Berapa anda ingin bermain?')
gamePosisi = ["bar","bar","bar","cherry","crown"]
Kalah = ["/nAnda... | code_fim | hard | {
"lang": "python",
"repo": "Myyepz/YSlotMachine",
"path": "/Slot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HariharasudhanAS/Pancake path: /setup.py
from setuptools import setup
setup(name='PanCake',
version='0.1',
description='Model stacking package',
long_description = open('README.md').read(),
author='Burak Himmetoglu',
packages = ['Pan<|fim_suffix|> 'https://github.com/bhimmetoglu/Pancake',
... | code_fim | medium | {
"lang": "python",
"repo": "HariharasudhanAS/Pancake",
"path": "/setup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'https://github.com/bhimmetoglu/Pancake',
classifier = [ 'Programming Language :: Python :: 3']
)<|fim_prefix|># repo: HariharasudhanAS/Pancake path: /setup.py
from setuptools import setup
setup(name='PanCake',
version='0.1',
description='Model stacking package',
long_description = open('README.md'... | code_fim | medium | {
"lang": "python",
"repo": "HariharasudhanAS/Pancake",
"path": "/setup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return (lambda w: scale * sigmoid(w * speed))<|fim_prefix|># repo: fvinas/elih path: /elih/scoring.py
# -*- coding: utf-8 -*-
<|fim_middle|>import math
def sigmoid(x):
return 1 / (1 + math.exp(-x))
def score(scale=20, speed=1):
| code_fim | medium | {
"lang": "python",
"repo": "fvinas/elih",
"path": "/elih/scoring.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fvinas/elih path: /elih/scoring.py
# -*- coding: utf-8 -*-
import math
def sigmoid(x):
<|fim_suffix|> return (lambda w: scale * sigmoid(w * speed))<|fim_middle|> return 1 / (1 + math.exp(-x))
def score(scale=20, speed=1):
| code_fim | medium | {
"lang": "python",
"repo": "fvinas/elih",
"path": "/elih/scoring.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def score(scale=20, speed=1):
return (lambda w: scale * sigmoid(w * speed))<|fim_prefix|># repo: fvinas/elih path: /elih/scoring.py
# -*- coding: utf-8 -*-
<|fim_middle|>import math
def sigmoid(x):
return 1 / (1 + math.exp(-x))
| code_fim | medium | {
"lang": "python",
"repo": "fvinas/elih",
"path": "/elih/scoring.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with open(os.path.join(FUCHSIA_ROOT,
'out/default/tests.json')) as json_file:
tests_json = json.loads(json_file.read())
url_to_label = {
entry['test']['name']: entry['test']['label']
for entry in tests_json
}
for line i... | code_fim | medium | {
"lang": "python",
"repo": "gnoliyil/fuchsia",
"path": "/scripts/tests/url_to_label.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># Stdin: lines of URLs of tests
# Stdout: lines of corresponding GN labels (empty line for no match)
# Assumes that you called `fx set ...`
def main():
with open(os.path.join(FUCHSIA_ROOT,
'out/default/tests.json')) as json_file:
tests_json = json.loads(json_file.rea... | code_fim | medium | {
"lang": "python",
"repo": "gnoliyil/fuchsia",
"path": "/scripts/tests/url_to_label.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gnoliyil/fuchsia path: /scripts/tests/url_to_label.py
#!/usr/bin/env python3.8
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
<|fim_suffix|>SCRIPT_DIR = os.path.dirname(os.path.abspa... | code_fim | medium | {
"lang": "python",
"repo": "gnoliyil/fuchsia",
"path": "/scripts/tests/url_to_label.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>_Container
from slixmpp.plugins.xep_0335.json_containers import XEP_0335
register_plugin(XEP_0335)<|fim_prefix|># repo: poezio/slixmpp path: /slixmpp/plugins/xep_0335/__init__.py
# Slixmpp: The Slick XMPP Library
# Copyright (C) 2018 Maxime “pep” Buquet
# This file is part of Slixmpp.
# See the file LI... | code_fim | medium | {
"lang": "python",
"repo": "poezio/slixmpp",
"path": "/slixmpp/plugins/xep_0335/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lugin
from slixmpp.plugins.xep_0335 import stanza
from slixmpp.plugins.xep_0335.stanza import JSON_Container
from slixmpp.plugins.xep_0335.json_containers import XEP_0335
register_plugin(XEP_0335)<|fim_prefix|># repo: poezio/slixmpp path: /slixmpp/plugins/xep_0335/__init__.py
# Slixmpp: The Slick XMPP... | code_fim | medium | {
"lang": "python",
"repo": "poezio/slixmpp",
"path": "/slixmpp/plugins/xep_0335/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: poezio/slixmpp path: /slixmpp/plugins/xep_0335/__init__.py
# Slixmpp: The Slick XMPP Library
# Copyright (C) 2018 Maxime “pep” Buquet
# This file is part of <|fim_suffix|>_Container
from slixmpp.plugins.xep_0335.json_containers import XEP_0335
register_plugin(XEP_0335)<|fim_middle|>Slixmpp.
# S... | code_fim | medium | {
"lang": "python",
"repo": "poezio/slixmpp",
"path": "/slixmpp/plugins/xep_0335/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmhobbs/dun-dun-duh path: /dundunduh/util/image.py
# -*- coding: utf-8 -*-
from PIL import ImageFilter
<|fim_suffix|> def filter(self, image):
return image.gaussian_blur(self.radius)
BLUR_FILTER = VariableGaussianBlur(radius=10)<|fim_middle|># HACK
# In PIL 1.1.7 the blur kernel is... | code_fim | hard | {
"lang": "python",
"repo": "jmhobbs/dun-dun-duh",
"path": "/dundunduh/util/image.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, radius=2):
self.radius = radius
def filter(self, image):
return image.gaussian_blur(self.radius)
BLUR_FILTER = VariableGaussianBlur(radius=10)<|fim_prefix|># repo: jmhobbs/dun-dun-duh path: /dundunduh/util/image.py
# -*- coding: utf-8 -*-
from PIL import Imag... | code_fim | hard | {
"lang": "python",
"repo": "jmhobbs/dun-dun-duh",
"path": "/dundunduh/util/image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return image.gaussian_blur(self.radius)
BLUR_FILTER = VariableGaussianBlur(radius=10)<|fim_prefix|># repo: jmhobbs/dun-dun-duh path: /dundunduh/util/image.py
# -*- coding: utf-8 -*-
from PIL import ImageFilter
# HACK
# In PIL 1.1.7 the blur kernel is hard coded small, so we hack it
# http://a... | code_fim | medium | {
"lang": "python",
"repo": "jmhobbs/dun-dun-duh",
"path": "/dundunduh/util/image.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sharan21/vae-exps-3 path: /inference.py
import os
import time
import load_data
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import numpy as np
from models.LSTM2 import LSTMClassifier2
from utils import *
def main():
load_chec... | code_fim | medium | {
"lang": "python",
"repo": "sharan21/vae-exps-3",
"path": "/inference.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model.eval()
samples, z = model.inference(n=num_samples)
print('----------SAMPLES----------')
print(*idx2word(samples, i2w=TEXT.vocab.itos, pad_idx=model.pad_idx), sep='\n')
exit()
z1 = torch.randn([model.latent_size]).numpy()
z2 = torch.randn([model.latent_size]... | code_fim | hard | {
"lang": "python",
"repo": "sharan21/vae-exps-3",
"path": "/inference.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('-------INTERPOLATION-------')
print(*idx2word(samples, i2w=TEXT.vocab.itos, pad_idx=model.pad_idx), sep='\n')
if __name__ == '__main__':
main()<|fim_prefix|># repo: sharan21/vae-exps-3 path: /inference.py
import os
import time
import load_data
import torch
import torch.nn.functional... | code_fim | hard | {
"lang": "python",
"repo": "sharan21/vae-exps-3",
"path": "/inference.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hzitoun/deep-learning-with-rnns path: /talk_creation_helpers/initial_code/model.py
import datetime
import logging
import math
import numpy as np
import os
import time
from typing import Callable, List, Optional
import tensorflow as tf
from tensorflow.contrib import layers
# `rnn` module temporar... | code_fim | hard | {
"lang": "python",
"repo": "hzitoun/deep-learning-with-rnns",
"path": "/talk_creation_helpers/initial_code/model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data: SequenceData,
num_epochs: int,
learning_rate: float,
display_every_n_batches: int,
checkpoint_dir: str,
on_step_complete: Callable[[int], None],... | code_fim | hard | {
"lang": "python",
"repo": "hzitoun/deep-learning-with-rnns",
"path": "/talk_creation_helpers/initial_code/model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nevinia-Github/PyModder path: /Core/Project/Objects/Items.py
from Core.Utils.Constants import ITEMGROUP
class SimpleItem:
def __init__(self, name="Item", texture="", registry_name=None, script="", itemgroup="MATERIALS", stacksize=64):
self.name = name
if registry_name is Non... | code_fim | hard | {
"lang": "python",
"repo": "Nevinia-Github/PyModder",
"path": "/Core/Project/Objects/Items.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.__dict__.items()
def to_json(self):
return {"name": self.name, "registry_name": self.registry_name, "texture": self.texture,
"itemgroup": self.itemgroup, "stacksize": self.stacksize, "type": self.type_, "script": self.script}
@classmethod
def from_... | code_fim | hard | {
"lang": "python",
"repo": "Nevinia-Github/PyModder",
"path": "/Core/Project/Objects/Items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LoopTilingBenchmark/benchmark path: /experiments/jacobi-1d/tmp_files/2312.py
from chill import *
source('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_<|fim_suffix|>chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/experiments/jacobi-1d/tmp_files/2312.c')
procedure('kernel_jacobi_1d')
loop(0... | code_fim | medium | {
"lang": "python",
"repo": "LoopTilingBenchmark/benchmark",
"path": "/experiments/jacobi-1d/tmp_files/2312.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>es/2312.c')
procedure('kernel_jacobi_1d')
loop(0)
tile(0,2,16,2)
tile(1,2,16,2)<|fim_prefix|># repo: LoopTilingBenchmark/benchmark path: /experiments/jacobi-1d/tmp_files/2312.py
from chill import *
source('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_<|fim_middle|>vinu/polybench/polybench-code/ste... | code_fim | medium | {
"lang": "python",
"repo": "LoopTilingBenchmark/benchmark",
"path": "/experiments/jacobi-1d/tmp_files/2312.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: philipgian/synnefo path: /contrib/snf-pithos-tools/pithos/tools/fs.py
#!/usr/bin/env python
# Copyright 2011-2012 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:... | code_fim | hard | {
"lang": "python",
"repo": "philipgian/synnefo",
"path": "/contrib/snf-pithos-tools/pithos/tools/fs.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return {
'st_mode': flags | mode,
'st_nlink': nlink,
'st_uid': uid,
'st_gid': gid,
'st_ctime': epoch,
'st_mtime': modified,
'st_atime': modified,
'st_size': size}
def object_getxattr(self, containe... | code_fim | hard | {
"lang": "python",
"repo": "philipgian/synnefo",
"path": "/contrib/snf-pithos-tools/pithos/tools/fs.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if platform == "darwin":
load_dotenv(dotenv_path='.docker/.env')
else:
load_dotenv()<|fim_prefix|># repo: devXpro/health-check-monitor path: /load_env.py
from dotenv import load_dotenv
from sys import platform
<|fim_middle|>
def load_env():
| code_fim | easy | {
"lang": "python",
"repo": "devXpro/health-check-monitor",
"path": "/load_env.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: devXpro/health-check-monitor path: /load_env.py
from dotenv import load_dotenv
from sys import platform
<|fim_suffix|> if platform == "darwin":
load_dotenv(dotenv_path='.docker/.env')
else:
load_dotenv()<|fim_middle|>def load_env():
| code_fim | easy | {
"lang": "python",
"repo": "devXpro/health-check-monitor",
"path": "/load_env.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 0Jihad/uqhs path: /result/migrations/mig/0022_auto_20190625_1034.py
# Generated by Django 2.1.3 on 2019-06-24 21:34
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|>
dependencies = [
('result', '0021_auto_20190625_0957'),
]
operations... | code_fim | medium | {
"lang": "python",
"repo": "0Jihad/uqhs",
"path": "/result/migrations/mig/0022_auto_20190625_1034.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='term',
name='first',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='first', to='result.QSUBJECT'),
),
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "0Jihad/uqhs",
"path": "/result/migrations/mig/0022_auto_20190625_1034.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rostlab/nalaf path: /nalaf/features/relations/path.py
from nalaf.features.relations import EdgeFeatureGenerator
from nalaf.features.relations import TokenFeatureGenerator
from nltk.stem import PorterStemmer
from nalaf.utils.graph import get_path, build_walks
class PathFeatureGenerator(EdgeFeatu... | code_fim | hard | {
"lang": "python",
"repo": "Rostlab/nalaf",
"path": "/nalaf/features/relations/path.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> for k in range(1, n):
token = edge.same_part.sentences[edge.same_sentence_id][(path[i-(n-1)+k]).features['id']-1]
self.token_feature_generator.token_features(token, 'tok_'+style_gram, edge, feature_set, is_training_mode)
... | code_fim | hard | {
"lang": "python",
"repo": "Rostlab/nalaf",
"path": "/nalaf/features/relations/path.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Get the student name that was passed from the web page
courseNotes = request.POST.get('courseNotes')
courseId = request.POST.get('courseId')
# Create a cursor to execute raw SQL queries.
with connection.cursor() as cursor:
cursor.execute('UPDATE courses '
... | code_fim | hard | {
"lang": "python",
"repo": "itteamforslp/safelife_project",
"path": "/teacher/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: itteamforslp/safelife_project path: /teacher/views.py
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.template import loader
from django.db import co... | code_fim | hard | {
"lang": "python",
"repo": "itteamforslp/safelife_project",
"path": "/teacher/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sevengram/asyncdb path: /asyncdb/mongo/core.py
sh_interval, self.async_refresh)
def async_refresh(self):
greenlet.greenlet(self.refresh).switch()
def start(self):
self.started = True
self.timeout_handle = self._framework.call_later(
self.loop, self._r... | code_fim | hard | {
"lang": "python",
"repo": "sevengram/asyncdb",
"path": "/asyncdb/mongo/core.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sevengram/asyncdb path: /asyncdb/mongo/core.py
be "
"a Motor client, not %r" % connection)
self.connection = connection
delegate = pymongo.database.Database(connection.delegate, name)
super(self.__class__, self).__init__(delegate)
def __ge... | code_fim | hard | {
"lang": "python",
"repo": "sevengram/asyncdb",
"path": "/asyncdb/mongo/core.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return len(self._data())
def __del__(self):
# This MotorCursor is deleted on whatever greenlet does the last
# decref, or (if it's referenced from a cycle) whichever is current
# when the GC kicks in. First, do a quick check whether the cursor
# is still alive ... | code_fim | hard | {
"lang": "python",
"repo": "sevengram/asyncdb",
"path": "/asyncdb/mongo/core.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kaist-plrg/jstar path: /tests/compile/basic/recent/Alternative[1,0].Evaluation.spec
1. Evaluate |Alternative| with argument _direction_ to obtain a Matcher _m1_.
1. Evaluate |Term| with argument _direction_ to obtain a Matcher _m2_.
1. If _direction_ = 1, then
... | code_fim | hard | {
"lang": "python",
"repo": "kaist-plrg/jstar",
"path": "/tests/compile/basic/recent/Alternative[1,0].Evaluation.spec",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> 1. Assert: _c_ is a Continuation.
1. Let _d_ be a new Continuation with parameters (_y_) that captures _c_ and _m1_ and performs the following steps when called:
1. Assert: _y_ is a State.
1. Return _m1_(_y_, _c_).
1. Return _m2_(_x... | code_fim | hard | {
"lang": "python",
"repo": "kaist-plrg/jstar",
"path": "/tests/compile/basic/recent/Alternative[1,0].Evaluation.spec",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tilt-dev/tilt path: /vendor/github.com/tilt-dev/starlark-lsp/pkg/analysis/builtins.py
# This file was generated by `make builtins` based on the spec at:
# https://raw.githubusercontent.com/google/starlark-go/master/doc/spec.md
def abs(x):
"""`abs(x)` returns the absolute value of its argument ... | code_fim | hard | {
"lang": "python",
"repo": "tilt-dev/tilt",
"path": "/vendor/github.com/tilt-dev/starlark-lsp/pkg/analysis/builtins.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """`S.removesuffix(suffix)` returns a copy of string S with the suffix `suffix` removed if S ends with `suffix`, otherwise it returns S."""
pass
def replace(self, old, new) -> String:
"""`S.replace(old, new[, count])` returns a copy of string S with all occurrences of substring `old` replac... | code_fim | hard | {
"lang": "python",
"repo": "tilt-dev/tilt",
"path": "/vendor/github.com/tilt-dev/starlark-lsp/pkg/analysis/builtins.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Reorganize LibriCSS data into Kaldi format.'
' Additionally, use separated wav files.')
parser = argparse.ArgumentParser()
parser.add_argument('--srcpath', metavar='<path>', required=True,
... | code_fim | hard | {
"lang": "python",
"repo": "hhadian/kaldi",
"path": "/egs/libri_css/s5_mono/local/prepare_data_css.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open(os.path.join(args.tgtpath, 'segments'), 'w')
for reco in reco2segments.keys():
segments = reco2segments[reco]
for segment in segments:
f.write('{} {} {} {}\n'.format(segment[0], reco, segment[1], segment[2]))
f.close()
if __name__ == '__main__':
parse... | code_fim | hard | {
"lang": "python",
"repo": "hhadian/kaldi",
"path": "/egs/libri_css/s5_mono/local/prepare_data_css.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hhadian/kaldi path: /egs/libri_css/s5_mono/local/prepare_data_css.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020 Johns Hopkins University (Author: Desh Raj)
# Apache 2.0
import argparse, os, glob, tqdm, zipfile, pathlib
def write_dict_to_file(utt2data, file_path):
f ... | code_fim | hard | {
"lang": "python",
"repo": "hhadian/kaldi",
"path": "/egs/libri_css/s5_mono/local/prepare_data_css.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>s_queue(graph, node, level)
row = [node]
for hop in range(1, level+1):
if len(res) < hop+1:
row.append(0)
else:
row.append(len(res[hop]))
stat.append(row)
results[node] = (res, nodes)
table.add_rows(stat)
print... | code_fim | medium | {
"lang": "python",
"repo": "Matthew-tech/gcn_analysis",
"path": "/utils/statistics.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> row.append(len(res[hop]))
stat.append(row)
results[node] = (res, nodes)
table.add_rows(stat)
print(table.draw())
return results<|fim_prefix|># repo: Matthew-tech/gcn_analysis path: /utils/statistics.py
from bfs import bfs_queue
def statistics(graph, nodes, leve... | code_fim | hard | {
"lang": "python",
"repo": "Matthew-tech/gcn_analysis",
"path": "/utils/statistics.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Matthew-tech/gcn_analysis path: /utils/statistics.py
from bfs import bfs_queue
def statistics(graph, nodes, level=6):
from texttable import Texttable
from tqdm import tqdm
table = Texttable()
table.set_dec<|fim_suffix|> row.append(len(res[hop]))
stat.append(... | code_fim | hard | {
"lang": "python",
"repo": "Matthew-tech/gcn_analysis",
"path": "/utils/statistics.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@dataclass
class Point:
"""
Representation of a coordinate point in the tetris field
"""
x: int
y: int
@property
def is_valid(self) -> bool:
return self.x > 0 and self.y > 0
@property
def as_tuple(self) -> Tuple[int, int]:
return self.x, self.y
... | code_fim | hard | {
"lang": "python",
"repo": "SamuelNLP/nes-ai",
"path": "/nes_ai/tetris/field.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.