text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: monkidea/naive-text-summarizer path: /preprocessor.py
#!/usr/bin/env python3
import re
def process_text(text):
text = text.encode('ascii', errors='ignore').decode()
text = re.sub(r"’", "'", text)
text = re.sub(r"“", ' " ', text)
text = text.lower()
text = re.sub(r'http\S+', '... | code_fim | hard | {
"lang": "python",
"repo": "monkidea/naive-text-summarizer",
"path": "/preprocessor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def main():
text = "there's something i need to know. my name is Paradox. I am Mr. Paradox."
sentences = tokenize_into_sentences(text)
print(sentences)
# print(process_text(text))
if __name__ == "__main__":
main()<|fim_prefix|># repo: monkidea/naive-text-summarizer path: /preprocess... | code_fim | medium | {
"lang": "python",
"repo": "monkidea/naive-text-summarizer",
"path": "/preprocessor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: netravnen/peering-manager path: /peering/migrations/0093_remove_session_enabled_and_rename_router_state.py
# Generated by Django 4.0.6 on 2022-08-09 12:15
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.RemoveF... | code_fim | hard | {
"lang": "python",
"repo": "netravnen/peering-manager",
"path": "/peering/migrations/0093_remove_session_enabled_and_rename_router_state.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.RemoveField(
model_name="directpeeringsession",
name="enabled",
),
migrations.RemoveField(
model_name="internetexchangepeeringsession",
name="enabled",
),
migrations.RenameField(
... | code_fim | hard | {
"lang": "python",
"repo": "netravnen/peering-manager",
"path": "/peering/migrations/0093_remove_session_enabled_and_rename_router_state.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baloda/loco path: /payments/services/transaction.py
from django.db.models import Sum
from payments.models import Transactions
class TransactionService:
@classmethod
def get_all(cls):
records = Transactions.objects.all()
return records
@classmethod
def get(cls, i... | code_fim | medium | {
"lang": "python",
"repo": "baloda/loco",
"path": "/payments/services/transaction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> record: Transactions = cls.get_by_id(id=id)
amount__sum = Transactions.objects.filter(
hierarchy__icontains=cls.join_hierarchy(record.hierarchy, id)
).aggregate(Sum("amount"))
hierarchical_amount_sums = record.amount + amount__sum.get("amount__sum") or 0
... | code_fim | hard | {
"lang": "python",
"repo": "baloda/loco",
"path": "/payments/services/transaction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, rtol=1e-05, atol=1e-08):
self.points = empty([0, 3])
self.rtol = rtol
self.atol = atol
def _add_point(self, point):
self.points = vstack((self.points, asanyarray(point)))
def get_point_id(self, point):
potential_ids = where(all(
... | code_fim | hard | {
"lang": "python",
"repo": "Dr-ZeeD/pysimplevtk",
"path": "/pysimplevtk/utilities/global_point_list.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, rtol=1e-05, atol=1e-08):
self.points = empty([0, 3])
self.rtol = rtol
self.atol = atol
def _add_point(self, point):
self.points = vstack((self.points, asanyarray(point)))
def get_point_id(self, point):
potential_ids = where(all(
... | code_fim | hard | {
"lang": "python",
"repo": "Dr-ZeeD/pysimplevtk",
"path": "/pysimplevtk/utilities/global_point_list.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dr-ZeeD/pysimplevtk path: /pysimplevtk/utilities/global_point_list.py
# -*- coding: utf-8 -*-
from numpy import all, asanyarray, empty, isclose, vstack, where
__all__ = ['GlobalPointList']
class GlobalPointList(object):
def __init__(self, rtol=1e-05, atol=1e-08):
self.points = em... | code_fim | hard | {
"lang": "python",
"repo": "Dr-ZeeD/pysimplevtk",
"path": "/pysimplevtk/utilities/global_point_list.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: win0x86/Fwf path: /fwf/server.py
# coding: utf-8
"""A HTTP server.
"""
import time
import select
import socket
import errno
import logging
import urlparse
import fwf.rawio
import fwf.stream
class HTTPServer(object):
def __init__(self, request_callback, io=None):
self.io = io or ... | code_fim | hard | {
"lang": "python",
"repo": "win0x86/Fwf",
"path": "/fwf/server.py",
"mode": "psm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> h = cls()
for line in headers.splitlines():
if line: h.parse_line(line)
return h
def parse_line(self, line):
name, value = line.split(":", 1)
self.add(name, value.strip())
def add(self, name, value):
self[name] = value
class HTTPR... | code_fim | hard | {
"lang": "python",
"repo": "win0x86/Fwf",
"path": "/fwf/server.py",
"mode": "spm",
"license": "Artistic-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LeHuyHung/BraTS-DMFNet path: /models/csse/DMFNet_csse.py
"""
This model adds MFUnit into each Residual Path, to make the gradient easier in learning. (idea from Unet++ paper)
"""
import torch
from torch import nn
try:
from models.sync_batchnorm import SynchronizedBatchNorm3d
except:
pas... | code_fim | hard | {
"lang": "python",
"repo": "LeHuyHung/BraTS-DMFNet",
"path": "/models/csse/DMFNet_csse.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Encoder
x1 = self.encoder_block1(x)
x1 = self.csse_encoder1(x1)
x2 = self.encoder_block2(x1)
x2 = self.csse_encoder2(x2)
x3 = self.encoder_block3(x2)
x3 = self.csse_encoder3(x3)
x4 = self.encoder_block4(x3)
x4 = self.csse_encoder4(x... | code_fim | hard | {
"lang": "python",
"repo": "LeHuyHung/BraTS-DMFNet",
"path": "/models/csse/DMFNet_csse.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matplotlib/cheatsheets path: /scripts/adjustements.py
# -----------------------------------------------------------------------------
# Matplotlib cheat sheet
# Released under the BSD License
# -----------------------------------------------------------------------------
import pathlib
import nu... | code_fim | hard | {
"lang": "python",
"repo": "matplotlib/cheatsheets",
"path": "/scripts/adjustements.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> p0, p1 = np.asarray(p0), np.asarray(p1)
ax.arrow(*((p0+p1)/2), *((p1-p0)/2), zorder=20, linewidth=0,
length_includes_head=True, width=.4,
head_width=2, head_length=2, color="black")
ax.arrow(*((p0+p1)/2), *(-(p1-p0)/2), zorder=20, linewidth=0,
length_incl... | code_fim | hard | {
"lang": "python",
"repo": "matplotlib/cheatsheets",
"path": "/scripts/adjustements.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>int_arrow((0, -5), (100, -5))
ax.text(50, -5, "figure width", backgroundcolor="white", zorder=30,
ha="center", va="center")
int_arrow((105, 0), (105, 75))
ax.text(105, 75/2, "figure height", backgroundcolor="white", zorder=30,
rotation="vertical", ha="center", va="center")
int_arrow((55,... | code_fim | hard | {
"lang": "python",
"repo": "matplotlib/cheatsheets",
"path": "/scripts/adjustements.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> M = cv.moments(cnt)
if (M['m00'] > 10):
cx = int(M['m10']/M['m00'])
cy = int(M['m01']/M['m00'])
print "square"
cv.drawContours(img,[cnt],0,(0,0,255),-1)
print("Shape: Square, Area: %f, Centroid:(%f, %f)" %(M['m00'], cx, cy))
... | code_fim | hard | {
"lang": "python",
"repo": "msswn/EECS149_F19_Project",
"path": "/computer vision/Second_trials_square/shape.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: msswn/EECS149_F19_Project path: /computer vision/Second_trials_square/shape.py
import numpy as np
import cv2 as cv
# https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_imgproc/py_contours/py_contours_hierarchy/py_contours_hierarchy.html
img = cv.imread('square.jpg')
gray = c... | code_fim | hard | {
"lang": "python",
"repo": "msswn/EECS149_F19_Project",
"path": "/computer vision/Second_trials_square/shape.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
line1, = plt.plot(self.loss_rec, label="Total loss", linestyle='-')
line2, = plt.plot(self.loss_Dir, label="Dirichlet", linestyle='-.')
line3, = plt.plot(self.loss_Neu, label="Neumman", linestyle=':')
lin... | code_fim | hard | {
"lang": "python",
"repo": "shushu-qin/PINN-elasticity",
"path": "/main/PINN-elasticity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shushu-qin/PINN-elasticity path: /main/PINN-elasticity.py
pe=[None, self.x_Neumann.shape[1]])
self.y_Neumann_tf = tf.placeholder(tf.float32, shape=[None, self.y_Neumann.shape[1]])
self.n1_Neumann_tf = tf.placeholder(tf.float32, shape=[None, self.Neumann_n1.shape[1]])
se... | code_fim | hard | {
"lang": "python",
"repo": "shushu-qin/PINN-elasticity",
"path": "/main/PINN-elasticity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shushu-qin/PINN-elasticity path: /main/PINN-elasticity.py
self.Neumannt2_pred))
self.loss = self.loss_f + self.loss_Dirichlet + self.loss_Neumann
# Optimizer train_bfgs
self.optimizer = tf.contrib.opt.ScipyOptimizerInterface(self.loss,
... | code_fim | hard | {
"lang": "python",
"repo": "shushu-qin/PINN-elasticity",
"path": "/main/PINN-elasticity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> qs = models.DeliveryZone.objects.all()
return gql_optimizer.query(qs, info)<|fim_prefix|># repo: tetyanaloskutova/remote-works path: /remote_works/graphql/delivery/resolvers.py
import graphene_django_optimizer as gql_optimizer
from ...delivery import models
<|fim_middle|>def resolve_delivery_z... | code_fim | easy | {
"lang": "python",
"repo": "tetyanaloskutova/remote-works",
"path": "/remote_works/graphql/delivery/resolvers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def resolve_delivery_zones(info):
qs = models.DeliveryZone.objects.all()
return gql_optimizer.query(qs, info)<|fim_prefix|># repo: tetyanaloskutova/remote-works path: /remote_works/graphql/delivery/resolvers.py
import graphene_django_optimizer as gql_optimizer
<|fim_middle|>from ...delivery impo... | code_fim | easy | {
"lang": "python",
"repo": "tetyanaloskutova/remote-works",
"path": "/remote_works/graphql/delivery/resolvers.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tetyanaloskutova/remote-works path: /remote_works/graphql/delivery/resolvers.py
import graphene_django_optimizer as gql_optimizer
from ...delivery import models
<|fim_suffix|> qs = models.DeliveryZone.objects.all()
return gql_optimizer.query(qs, info)<|fim_middle|>def resolve_delivery_z... | code_fim | easy | {
"lang": "python",
"repo": "tetyanaloskutova/remote-works",
"path": "/remote_works/graphql/delivery/resolvers.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akraino-edge-stack/ta-infra-ansible path: /playbooks/report-installation-progress
#! /usr/bin/python
# Copyright 2019 Nokia
#
# 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 Licen... | code_fim | hard | {
"lang": "python",
"repo": "akraino-edge-stack/ta-infra-ansible",
"path": "/playbooks/report-installation-progress",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser.add_argument('--client-key-path',
dest='client_key_path',
metavar='CLIENT-KEY-PATH',
required=False,
help='The path to client key file',
action='store'... | code_fim | hard | {
"lang": "python",
"repo": "akraino-edge-stack/ta-infra-ansible",
"path": "/playbooks/report-installation-progress",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: googleinterns/cl_analysis path: /data/data_collection.py
olean indicating if collecting all of the pull
requests or not.
_page: An integer page number indicating which page the GitHub API
should retrieve.
"""
def __init__(self, repo_name: str,
... | code_fim | hard | {
"lang": "python",
"repo": "googleinterns/cl_analysis",
"path": "/data/data_collection.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _get_review_comments_body(
self, pull_request_number: int) -> List[Tuple[str, str]]:
"""Retrieves the review comments of a given pull request id.
Args:
pull_request_number: An integer of pull request id.
Returns:
A list of tuples. Each t... | code_fim | hard | {
"lang": "python",
"repo": "googleinterns/cl_analysis",
"path": "/data/data_collection.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
pull_request_info: A dict of a pull request information.
Returns:
A tuple of three float numbers: pull request created time,
pull request closed time, and pull request review time.
"""
pull_request_created_time = to_timestamp(
... | code_fim | hard | {
"lang": "python",
"repo": "googleinterns/cl_analysis",
"path": "/data/data_collection.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_colors_whole_table_with_supplied_spacing(
data, header, footer, fg_colors, bg_colors
):
result = table(
data,
header=header,
footer=footer,
divider=True,
fg_colors=fg_colors,
bg_colors=bg_colors,
spacing=5,
)
if SUPPORTS_ANSI... | code_fim | hard | {
"lang": "python",
"repo": "svlandeg/wasabi",
"path": "/wasabi/tests/test_tables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: svlandeg/wasabi path: /wasabi/tests/test_tables.py
ata():
return [("Hello", "World", "12344342"), ("This is a test", "World", "1234")]
@pytest.fixture()
def header():
return ["COL A", "COL B", "COL 3"]
@pytest.fixture()
def footer():
return ["", "", "2030203.00"]
@pytest.fixture... | code_fim | hard | {
"lang": "python",
"repo": "svlandeg/wasabi",
"path": "/wasabi/tests/test_tables.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ENV_LOG_FRIENDLY = "CUSTOM_LOG_FRIENDLY"
os.environ[ENV_LOG_FRIENDLY] = "True"
result = row(
("Hello", "World", "12344342"),
fg_colors=fg_colors,
bg_colors=bg_colors,
env_prefix="CUSTOM",
)
assert result == "Hello World 12344342"
del os.environ[E... | code_fim | hard | {
"lang": "python",
"repo": "svlandeg/wasabi",
"path": "/wasabi/tests/test_tables.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> fieldsets = [
(None, {'fields':['headline','author','status','pub_date']}),
('Advanced', {'fields':['sites','slug','comments'], 'classes': ['collapse'] }),
('Content', {'fields':['abstract','content','tags']}),
]
prepopulated_fields = {'slug': ('headline',)}
list_di... | code_fim | hard | {
"lang": "python",
"repo": "nicholasstudt/django-blog",
"path": "/blog/admin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nicholasstudt/django-blog path: /blog/admin.py
from django.contrib import admin
from blog.models import Author
from blog.models import Entry
from blog.models import Tag
class AuthorAdmin(admin.ModelAdmin):
<|fim_suffix|> fieldsets = [
(None, {'fields':['headline','author','status','p... | code_fim | hard | {
"lang": "python",
"repo": "nicholasstudt/django-blog",
"path": "/blog/admin.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class EntryAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields':['headline','author','status','pub_date']}),
('Advanced', {'fields':['sites','slug','comments'], 'classes': ['collapse'] }),
('Content', {'fields':['abstract','content','tags']}),
]
prepopulated_fields =... | code_fim | hard | {
"lang": "python",
"repo": "nicholasstudt/django-blog",
"path": "/blog/admin.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
View article page function that returns the various article details page and its data
'''
# title= 'Articles'
articles = article_source(id)
return render_template('article.html',articles= articles,id=id )
@main.route('/article/<source_name>')
def search(source_name):
'''
... | code_fim | hard | {
"lang": "python",
"repo": "gingerlauren/news-project",
"path": "/app/main/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gingerlauren/news-project path: /app/main/views.py
from flask import render_template,request,redirect,url_for
from . import main
from ..request import get_sources,article_source,search_source
# Views
@main.route('/')
def index():
'''
View root page function that returns the index page an... | code_fim | medium | {
"lang": "python",
"repo": "gingerlauren/news-project",
"path": "/app/main/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pygame.init()
ventana = pygame.display.set_mode((1300, 700))
pygame.display.set_caption("Prueba")
ventana.fill((210,210,210))
clock = pygame.time.Clock()
tab = Tablero(0, (1300, 700))
tab.draw(ventana)
new = True
while True:
clock.tick(FPS)
events = pygame.event.get()
for event in events:
... | code_fim | medium | {
"lang": "python",
"repo": "GeinerGV/TS1_ProyectoFinal",
"path": "/game/test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GeinerGV/TS1_ProyectoFinal path: /game/test.py
import time, sys, pygame
from Bloques import Tablero
FPS = 40
<|fim_suffix|> pygame.init()
ventana = pygame.display.set_mode((1300, 700))
pygame.display.set_caption("Prueba")
ventana.fill((210,210,210))
clock = pygame.time.Clock()
tab = Table... | code_fim | medium | {
"lang": "python",
"repo": "GeinerGV/TS1_ProyectoFinal",
"path": "/game/test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> element.click()
if type == 1:
self.toNextTab()
if waitObject is not None:
WebDriverWait(self.getBrowser(), timeout, interval).until(waitObject)
else:
self.waitLast(timeout)
def toFirstTab(self):
self.getBrowser... | code_fim | hard | {
"lang": "python",
"repo": "Eilison/NetCrawl",
"path": "/netcrawl/BaseCrawl.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Eilison/NetCrawl path: /netcrawl/BaseCrawl.py
#encoding:utf-8
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.remote_connection import RemoteConnection
import functools
import logging
from selenium.webdri... | code_fim | hard | {
"lang": "python",
"repo": "Eilison/NetCrawl",
"path": "/netcrawl/BaseCrawl.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tkrebes/nisyscfg-python path: /nisyscfg/filter.py
import ctypes
import nisyscfg.errors
import nisyscfg.properties
import nisyscfg.xnet.properties
from nisyscfg._lib import c_string_encode
@nisyscfg.properties.PropertyBag(nisyscfg.properties.Filter)
@nisyscfg.properties.PropertyBag(nisyscfg.xne... | code_fim | hard | {
"lang": "python",
"repo": "tkrebes/nisyscfg-python",
"path": "/nisyscfg/filter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if c_type == ctypes.c_char_p:
value = c_string_encode(value)
elif issubclass(c_type, nisyscfg.enums.BaseEnum) or issubclass(
c_type, nisyscfg.enums.BaseFlag
):
value = ctypes.c_int(value)
else:
value = c_type(value)
e... | code_fim | hard | {
"lang": "python",
"repo": "tkrebes/nisyscfg-python",
"path": "/nisyscfg/filter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lewtun/huggingface_hub path: /api-inference-community/docker_images/spacy/tests/test_api_question_answering.py
import json
import os
from unittest import TestCase, skipIf
from app.main import ALLOWED_TASKS
from starlette.testclient import TestClient
from tests.test_api import TESTABLE_MODELS
@... | code_fim | hard | {
"lang": "python",
"repo": "lewtun/huggingface_hub",
"path": "/api-inference-community/docker_images/spacy/tests/test_api_question_answering.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_simple(self):
inputs = {"question": "Where do I live ?", "context": "I live in New-York"}
with TestClient(self.app) as client:
response = client.post("/", json={"inputs": inputs})
self.assertEqual(
response.status_code,
200,
... | code_fim | hard | {
"lang": "python",
"repo": "lewtun/huggingface_hub",
"path": "/api-inference-community/docker_images/spacy/tests/test_api_question_answering.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('add', rhs)
c = C()
c.f(0)
c.g(0)
c - 1
c + 2<|fim_prefix|># repo: jiapei100/Stereo path: /micropython/tests/basics/class_staticclassmethod.py
# test static and class methods
class C:
@staticmethod
def f(rhs):
<|fim_middle|> print('f', rhs)
@classmethod
... | code_fim | hard | {
"lang": "python",
"repo": "jiapei100/Stereo",
"path": "/micropython/tests/basics/class_staticclassmethod.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jiapei100/Stereo path: /micropython/tests/basics/class_staticclassmethod.py
# test static and class methods
class C:
@staticmethod
def f(rhs):
<|fim_suffix|> print('add', rhs)
c = C()
c.f(0)
c.g(0)
c - 1
c + 2<|fim_middle|> print('f', rhs)
@classmethod
... | code_fim | hard | {
"lang": "python",
"repo": "jiapei100/Stereo",
"path": "/micropython/tests/basics/class_staticclassmethod.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(3):
wait.until(
lambda: target.column("rows").get_text(i) == "modified"
if row == i
else title[i],
3,
)
assert test.get_log_errors() == []
def test_head002_preserves_hidden_columns_on_rename(test):
test.start_ser... | code_fim | hard | {
"lang": "python",
"repo": "plotly/dash",
"path": "/components/dash-table/tests/selenium/test_header.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: plotly/dash path: /components/dash-table/tests/selenium/test_header.py
import dash
from dash.testing import wait
from utils import get_props
from dash.dash_table import DataTable
import pytest
def get_app(props=dict()):
app = dash.Dash(__name__)
baseProps = get_props()
baseProps... | code_fim | hard | {
"lang": "python",
"repo": "plotly/dash",
"path": "/components/dash-table/tests/selenium/test_header.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: greyhill/linesgodown path: /linesgodown/__init__.py
import matplotlib.pylab as pylab
symbols_colors = [ \
('o', 'blue'),
('^', 'green'),
('s', 'red'),
('p', 'purple'),
('D', 'orange'),
('d', 'cyan')
]
fake_names = [ \
'Bobbins',
... | code_fim | hard | {
"lang": "python",
"repo": "greyhill/linesgodown",
"path": "/linesgodown/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not hasattr(axis, '_linesgodown_symbol_colors_used'):
axis._linesgodown_symbol_colors_used = []
symbol_colors_used = axis._linesgodown_symbol_colors_used
if 'symbol_color' in kwargs:
symbol_color = kwargs['symbol_color']
if symbol_color in symbol_colors_used:
... | code_fim | hard | {
"lang": "python",
"repo": "greyhill/linesgodown",
"path": "/linesgodown/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># is still in development
def get_diSAN(embedding_matrix, num_classes, sequence_length):
input_layer = Input(shape=(sequence_length,))
embedding_layer = Embedding(embedding_matrix.shape[0], embedding_matrix.shape[1], weights=[embedding_matrix], trainable=False)(input_layer)
shape = K.shape(emb... | code_fim | hard | {
"lang": "python",
"repo": "orech/toxic-comments-rep",
"path": "/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: orech/toxic-comments-rep path: /models.py
, trainable=False)(input_layer)
x = Bidirectional(CuDNNGRU(recurrent_units, return_sequences=True))(embedding_layer)
x = Dropout(dropout_rate)(x)
x = Bidirectional(CuDNNGRU(recurrent_units, return_sequences=True))(x)
x = GlobalMaxPooling1D... | code_fim | hard | {
"lang": "python",
"repo": "orech/toxic-comments-rep",
"path": "/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> filter_size, num_of_blocks, dense_size=128, l2_weight_decay=0.0001):
# DPCNN with gated convolutions
input_layer = Input(shape=(sequence_length,))
embedding_layer = Embedding(embedding_matrix.shape[0], embedding_matrix.shape[1],
weights... | code_fim | hard | {
"lang": "python",
"repo": "orech/toxic-comments-rep",
"path": "/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.determinate_info(self.list_of_body_objects[index],
self.list_of_body_objects[index + 1])
self.list_of_body_objects[index].update_line()
del self.list_of_body_objects[index + 1]... | code_fim | hard | {
"lang": "python",
"repo": "zorana-staka/GI_projekat",
"path": "/Poslato_prof_04052020/Output_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zorana-staka/GI_projekat path: /Poslato_prof_04052020/Output_file.py
import gzip
import re
import toolz
from Body_header_line import Body_header_line
from Body_record import Body_record
from Input_file import Input_file
class Output_file:
""" Represents output file that will be gen... | code_fim | hard | {
"lang": "python",
"repo": "zorana-staka/GI_projekat",
"path": "/Poslato_prof_04052020/Output_file.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.list_of_body_objects[index].ref == self.list_of_body_objects[index + 1].ref:
if self.list_of_body_objects[index].filter == self.list_of_body_objects[index + 1].filter \
or (self.list_of_body_objects[index].filter == "PASS" or self... | code_fim | hard | {
"lang": "python",
"repo": "zorana-staka/GI_projekat",
"path": "/Poslato_prof_04052020/Output_file.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cloudxtreme/python-termcast-server path: /termcast_server/ssh.py
import multiprocessing
import paramiko
import select
import threading
import time
import traceback
class Connection(object):
def __init__(self, client, connection_id, publisher, keyfile):
self.transport = paramiko.Trans... | code_fim | hard | {
"lang": "python",
"repo": "Cloudxtreme/python-termcast-server",
"path": "/termcast_server/ssh.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self):
super()
self.cols = 80
self.rows = 24
self.pty_event = threading.Event()
def check_channel_request(self, kind, chanid):
return paramiko.OPEN_SUCCEEDED
def check_channel_pty_request(
self, channel, term, width, height, pixelw... | code_fim | hard | {
"lang": "python",
"repo": "Cloudxtreme/python-termcast-server",
"path": "/termcast_server/ssh.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: phongdly/zigzag path: /tests/integration/test_steps.py
# -*- coding: utf-8 -*-
"""Tests for validating that test cases with steps are represented correctly in qTest."""
# ======================================================================================================================
# Imp... | code_fim | hard | {
"lang": "python",
"repo": "phongdly/zigzag",
"path": "/tests/integration/test_steps.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# noinspection PyShadowingNames
@pytest.fixture(scope='module')
def single_skipping_test_step_for_mk8s(_zigzag_runner_factory, mk8s_config_file, mk8s_global_props):
"""ZigZag CLI runner configured for the "mk8s" CI environment with a test case containing one skipping test step.
Returns:
... | code_fim | hard | {
"lang": "python",
"repo": "phongdly/zigzag",
"path": "/tests/integration/test_steps.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setUp(self):
self.state_one = {
'type': 'Feature',
'properties': {
'name': 'one'
},
'geometry': {
'type': 'MultiPolygon',
'coordinates': [
[[
[0, 0],
... | code_fim | hard | {
"lang": "python",
"repo": "USGS-VIZLAB/active-flood-viz",
"path": "/floodviz/tests/test_map_utils.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: USGS-VIZLAB/active-flood-viz path: /floodviz/tests/test_map_utils.py
import unittest
import requests_mock
from nose.tools import raises
from floodviz.map_utils import site_dict, create_geojson, projection_info, filter_background
class TestSiteDict(unittest.TestCase):
def setUp(self):
... | code_fim | hard | {
"lang": "python",
"repo": "USGS-VIZLAB/active-flood-viz",
"path": "/floodviz/tests/test_map_utils.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> with requests_mock.Mocker() as m:
m.get(self.request_url, status_code=404)
self.assertEqual(site_dict(self.sites, self.prefix), None)
def test_good_data(self):
with requests_mock.Mocker() as m:
m.get(self.request_url, text=self.NWIS_response)
... | code_fim | hard | {
"lang": "python",
"repo": "USGS-VIZLAB/active-flood-viz",
"path": "/floodviz/tests/test_map_utils.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>e:
video = Video(input_path=input_path, output_path=args.output)
video.save()
elif input_path and not is_acceptable:
logging.error("It is not a webm/mp4 video file.")
else:
logging.error("No input or output filepath provided.")
if __name__ == "__main__":
main()... | code_fim | hard | {
"lang": "python",
"repo": "pawanpaudel93/tiktok-long-video",
"path": "/ttlv/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pawanpaudel93/tiktok-long-video path: /ttlv/cli.py
import logging
import argparse
import os
from ttlv import Video
__version__ = "0.6.0"
def main():
description = 'This package/cli tool saves webm video to upload Tiktok long videos above 60 seconds. Accepts video filepath and output video... | code_fim | hard | {
"lang": "python",
"repo": "pawanpaudel93/tiktok-long-video",
"path": "/ttlv/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: skggm/skggm path: /inverse_covariance/adaptive_graph_lasso.py
from __future__ import absolute_import
import numpy as np
from sklearn.utils import check_array, as_float_array, deprecated
from sklearn.base import BaseEstimator
from . import QuicGraphicalLasso, QuicGraphicalLassoCV, InverseCovaria... | code_fim | hard | {
"lang": "python",
"repo": "skggm/skggm",
"path": "/inverse_covariance/adaptive_graph_lasso.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> n_features, _ = estimator.precision_.shape
lam = np.zeros((n_features, n_features))
mask = estimator.precision_ != 0
lam[mask] = 1. / np.abs(estimator.precision_[mask])
mask_0 = estimator.precision_ == 0
lam[mask_0] = np.max(lam[mask].flat) # non-zero in ap... | code_fim | hard | {
"lang": "python",
"repo": "skggm/skggm",
"path": "/inverse_covariance/adaptive_graph_lasso.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
max_img = 10000
max_ann = 2000000
max_video = 10
crowdhuman_json = json.load(open('crowdhuman/annotations/train.json','r'))
img_id_count = 0
for img in crowdhuman_json['images']:
img_id_count += 1
img['file_name'] = 'crowdhuman_train/' + img['file_name']
img['frame_id'] = img_id_count
im... | code_fim | medium | {
"lang": "python",
"repo": "Abrahamon/TransTrack",
"path": "/track_tools/mix_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>video_list.append({
'id': max_video,
'file_name': 'crowdhuman'
})
mix_json = dict()
mix_json['images'] = img_list
mix_json['annotations'] = ann_list
mix_json['videos'] = video_list
mix_json['categories'] = category_list
json.dump(mix_json, open('mix/annotations/train.json','w'))<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "Abrahamon/TransTrack",
"path": "/track_tools/mix_data.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Abrahamon/TransTrack path: /track_tools/mix_data.py
import json
import os
"""
mkdir -p mix/annotations
cp mot/annotations/val_half.json mix/annotations/val_half.json
cp mot/annotations/test.json mix/annotations/test.json
cd mix
ln -s ../mot/train mot_train
ln -s ../crowdhuman/CrowdHuman_train c... | code_fim | hard | {
"lang": "python",
"repo": "Abrahamon/TransTrack",
"path": "/track_tools/mix_data.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Sequência 1: {}".format(sequencia11))
print("Sequência 2: {}".format(sequencia22))
print("Itercalação da Sequência 1 e Sequência 2:")
print(intercalacao)<|fim_prefix|># repo: LourdesOshiroIgarashi/algorithms-and-programming-1-ufms path: /Lists/Listas e Repetição - AVA/Lourdes/07.py
intercalacao = ... | code_fim | medium | {
"lang": "python",
"repo": "LourdesOshiroIgarashi/algorithms-and-programming-1-ufms",
"path": "/Lists/Listas e Repetição - AVA/Lourdes/07.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LourdesOshiroIgarashi/algorithms-and-programming-1-ufms path: /Lists/Listas e Repetição - AVA/Lourdes/07.py
intercalacao = []
sequencia11 = []
sequencia22 = []
sequencia1 = list(map(int, input().split()))
sequencia2 = list(map(int, input().split()))
<|fim_suffix|>for i in range(10):
interca... | code_fim | medium | {
"lang": "python",
"repo": "LourdesOshiroIgarashi/algorithms-and-programming-1-ufms",
"path": "/Lists/Listas e Repetição - AVA/Lourdes/07.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huajianmao/pyleet path: /solutions/a0173binarysearchtreeiterator.py
# -*- coding: utf-8 -*-
################################################
#
# URL:
# =====
# https://leetcode.com/problems/binary-search-tree-iterator/
#
# DESC:
# =====
# Implement an iterator over a binary search tree (BST).
# ... | code_fim | medium | {
"lang": "python",
"repo": "huajianmao/pyleet",
"path": "/solutions/a0173binarysearchtreeiterator.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, root: TreeNode):
self.stack = []
self.__append(root)
def next(self) -> int:
node = self.stack.pop()
if node.right:
self.__append(node.right)
return node.val
def hasNext(self) -> bool:
return len(self.stack) != 0
def __append(self, node):
whi... | code_fim | medium | {
"lang": "python",
"repo": "huajianmao/pyleet",
"path": "/solutions/a0173binarysearchtreeiterator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.stack = []
self.__append(root)
def next(self) -> int:
node = self.stack.pop()
if node.right:
self.__append(node.right)
return node.val
def hasNext(self) -> bool:
return len(self.stack) != 0
def __append(self, node):
while node:
self.stack.append(node)
... | code_fim | medium | {
"lang": "python",
"repo": "huajianmao/pyleet",
"path": "/solutions/a0173binarysearchtreeiterator.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def parse_line(line):
result = PARSE_OK
if is_empty_line(line):
pass
elif parse_special_key(line) != 0:
pass
elif(len(os.path.commonprefix([cmd_NAME, line])) == len(cmd_NAME)):
pass
elif(len(os.path.commonprefix([cmd_UARTPRINT, line])) == len(cmd_UARTPRINT)):
pass
elif(len(os.path.commonpref... | code_fim | hard | {
"lang": "python",
"repo": "madwort/duckyPad",
"path": "/pc_software/ds_syntax_check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: madwort/duckyPad path: /pc_software/ds_syntax_check.py
import os
# quick and dirty port from parse.c
KEY_LEFT_CTRL = 0x80
KEY_LEFT_SHIFT = 0x81
KEY_LEFT_ALT = 0x82
KEY_LEFT_GUI = 0x83
KEY_RIGHT_CTRL = 0x84
KEY_RIGHT_SHIFT = 0x85
KEY_RIGHT_ALT = 0x86
KEY_RIGHT_GUI = 0x87
KEY_RETURN = 0x28+0x88
... | code_fim | hard | {
"lang": "python",
"repo": "madwort/duckyPad",
"path": "/pc_software/ds_syntax_check.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> result = PARSE_OK
if is_empty_line(line):
pass
elif parse_special_key(line) != 0:
pass
elif(len(os.path.commonprefix([cmd_NAME, line])) == len(cmd_NAME)):
pass
elif(len(os.path.commonprefix([cmd_UARTPRINT, line])) == len(cmd_UARTPRINT)):
pass
elif(len(os.path.commonprefix([cmd_REM, line])) =... | code_fim | hard | {
"lang": "python",
"repo": "madwort/duckyPad",
"path": "/pc_software/ds_syntax_check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DouglasOrr/Snippets path: /theano/xor.py
# Train a network to learn the XOR function
### Data & config ###
training_data = [([0, 0], 0),
([0, 1], 1),
([1, 0], 1),
([1, 1], 0)]
learning_rate = 0.5
initial_scale = 0.1
nhidden = 3
import theano
i... | code_fim | hard | {
"lang": "python",
"repo": "DouglasOrr/Snippets",
"path": "/theano/xor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Train:")
for __ in range(1000):
for (xd,yd) in training_data:
yp, ep = train(xd, [yd])
print("\t%r -> %f (pred %f, err %f)" % (xd, yd, yp, ep))
print("Predict:")
for (xd,yd) in training_data:
print("\t%r -> %f" % (xd, predict(xd)))<|fim_prefix|># repo: DouglasOrr/Snippets ... | code_fim | hard | {
"lang": "python",
"repo": "DouglasOrr/Snippets",
"path": "/theano/xor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tacha1/E-platform path: /App/admin.py
from django.contrib import admin
from .models import serv<|fim_suffix|>
admin.site.register(Comments)
admin.site.register(Rating)<|fim_middle|>ice,Profile,Comments,Rating
# Register your models here.
admin.site.register(service)
admin.site.register(Profile) | code_fim | medium | {
"lang": "python",
"repo": "tacha1/E-platform",
"path": "/App/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tacha1/E-platform path: /App/admin.py
from django.contrib import admin
from .models import service,Profile,Comments,Rating
# Register your models here.
<|fim_suffix|>
admin.site.register(Comments)
admin.site.register(Rating)<|fim_middle|>admin.site.register(service)
admin.site.register(Profile) | code_fim | easy | {
"lang": "python",
"repo": "tacha1/E-platform",
"path": "/App/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
admin.site.register(Comments)
admin.site.register(Rating)<|fim_prefix|># repo: tacha1/E-platform path: /App/admin.py
from django.contrib import admin
from .models import serv<|fim_middle|>ice,Profile,Comments,Rating
# Register your models here.
admin.site.register(service)
admin.site.register(Profile) | code_fim | medium | {
"lang": "python",
"repo": "tacha1/E-platform",
"path": "/App/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FrankSchieber/tutorials path: /data-engineering/checker.py
import pandas as pd
import pandas.testing
import scipy.sparse
def csv_match(file1, file2, check_row_order=True):
<|fim_suffix|> # It is more efficient to compare not equals for sparse matrices
assert (m1 != m2).nnz == 0<|fim_middl... | code_fim | hard | {
"lang": "python",
"repo": "FrankSchieber/tutorials",
"path": "/data-engineering/checker.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> m1 = scipy.sparse.load_npz(file1)
m2 = scipy.sparse.load_npz(file2)
# It is more efficient to compare not equals for sparse matrices
assert (m1 != m2).nnz == 0<|fim_prefix|># repo: FrankSchieber/tutorials path: /data-engineering/checker.py
import pandas as pd
import pandas.testing
im... | code_fim | hard | {
"lang": "python",
"repo": "FrankSchieber/tutorials",
"path": "/data-engineering/checker.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#calculate frequency
c = collections.Counter(x) #print(c)
# calculate the number of instances in the list
count_sum = sum(c.values())
for k,v in c.iteritems():
print("The frequency of number " + str(k) + " is " + str(float(v) / count_sum))
#create box plot
plt.boxplot(x)
#plt.show()
plt.savefig("x_arra... | code_fim | medium | {
"lang": "python",
"repo": "ttglennhall/simple_data_analysis_python",
"path": "/prob.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ttglennhall/simple_data_analysis_python path: /prob.py
import numpy as np
import collections
import scipy.stats as stats
import matplotlib.pyplot as plt
<|fim_suffix|>#creat qq plot
plt.figure()
test_data = np.random.normal(size=1000)
graph1 = stats.probplot(x, dist="norm", plot=plt)
#plt.sh... | code_fim | hard | {
"lang": "python",
"repo": "ttglennhall/simple_data_analysis_python",
"path": "/prob.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#creat qq plot
plt.figure()
test_data = np.random.normal(size=1000)
graph1 = stats.probplot(x, dist="norm", plot=plt)
#plt.show() #this will generate the first graph
plt.savefig("x_array_qqplot.png")<|fim_prefix|># repo: ttglennhall/simple_data_analysis_python path: /prob.py
import numpy as np
import... | code_fim | medium | {
"lang": "python",
"repo": "ttglennhall/simple_data_analysis_python",
"path": "/prob.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> while not queue.empty():
next_vertex = queue.get()
if next_vertex[1] in visited:
continue
visited.add(next_vertex[1])
current_time = next_vertex[0]
for neighbor in graph[next_vertex[1]]:
dist = distance_to_neighbor(current_time, neighbo... | code_fim | hard | {
"lang": "python",
"repo": "chirag1992m/heuristicProblemSolvingFall17",
"path": "/week2-Stoplight/bot/bot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chirag1992m/heuristicProblemSolvingFall17 path: /week2-Stoplight/bot/bot.py
from __future__ import print_function
import Queue
import sys
def read_stoplight_info_file(file_lines):
# first line should be start and end node
start_node, end_node = file_lines[0].split(' ')
edge_list =... | code_fim | hard | {
"lang": "python",
"repo": "chirag1992m/heuristicProblemSolvingFall17",
"path": "/week2-Stoplight/bot/bot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> current_time = next_vertex[0]
for neighbor in graph[next_vertex[1]]:
dist = distance_to_neighbor(current_time, neighbor, color_list) + current_time
if dist < path_from_start[neighbor[0]][0]:
path_from_start[neighbor[0]] = (dist, next_vertex[1], neig... | code_fim | hard | {
"lang": "python",
"repo": "chirag1992m/heuristicProblemSolvingFall17",
"path": "/week2-Stoplight/bot/bot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return Ec, text
def eq510821ad1(ldb, lambda_rl, lambda_cf, lambda_rc, lambda_er, lambda_lw):
"""Calculates the modified tension development length.
The modified tension development length, ld, shall not be less than the
basic tension develpoment length, ldb... | code_fim | hard | {
"lang": "python",
"repo": "mwhit74/pyaashto",
"path": "/AASHTOpy/lrfd_8/ch_5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mwhit74/pyaashto path: /AASHTOpy/lrfd_8/ch_5.py
import math
def eq56322d1(Aps=0.0, fps=0.0, dp=0.0, aps=0.0, As1=0.0, fs1=0.0, d1=0.0,
a1=0.0, As2=0.0, fs2=0.0, d2=0.0, a2=0.0, alpha_1=0.0,
fcp=0.0, b=0.0, bw=0.0, hf=0.0, a3=0.0):
"""Eq. 5.6.3.2.2-1: Moment capac... | code_fim | hard | {
"lang": "python",
"repo": "mwhit74/pyaashto",
"path": "/AASHTOpy/lrfd_8/ch_5.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> d2 (float):
distance from extreme compression fiber to the centroid of the
compression reinforcement, (in.)
a2 (float):
c*beta_1, depth of equivalent stress block, (in.), for the
nonprestress tension reinforcement
... | code_fim | hard | {
"lang": "python",
"repo": "mwhit74/pyaashto",
"path": "/AASHTOpy/lrfd_8/ch_5.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jupvfranco/onnxruntime path: /tools/ci_build/github/pai/run_job.py
#!/usr/bin/env python3
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import argparse
import json
import os
import re
import sys
import time
import requests
pai_base_url = "https... | code_fim | hard | {
"lang": "python",
"repo": "jupvfranco/onnxruntime",
"path": "/tools/ci_build/github/pai/run_job.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = requests.post(url=url, data=yaml, headers=headers)
response.raise_for_status()
def wait_for_job(job_name, user, token):
url = "{}/api/v2/jobs/{}~{}".format(pai_base_url, user, job_name)
headers = {
"Authorization": "Bearer {}".format(token),
}
while True:
... | code_fim | hard | {
"lang": "python",
"repo": "jupvfranco/onnxruntime",
"path": "/tools/ci_build/github/pai/run_job.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> with self.subTest(message, expected=expected):
self.assertEqual(cookie.keys(), expected.keys(), message)
for key, expected_value in expected.items():
morsel = cookie[key]
if isinstance(expected_value, tuple):
... | code_fim | hard | {
"lang": "python",
"repo": "yt-dlp/yt-dlp",
"path": "/test/test_cookies.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yt-dlp/yt-dlp path: /test/test_cookies.py
import unittest
from datetime import datetime, timezone
from yt_dlp import cookies
from yt_dlp.cookies import (
LenientSimpleCookie,
LinuxChromeCookieDecryptor,
MacChromeCookieDecryptor,
WindowsChromeCookieDecryptor,
_get_linux_deskto... | code_fim | hard | {
"lang": "python",
"repo": "yt-dlp/yt-dlp",
"path": "/test/test_cookies.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cbrentharris/bricklayer path: /bricklayer/__init__.py
import argparse
import py_compile
from bricklayer.doctor.config import Configurator
from bricklayer.doctor.metrics import Metrics
from bricklayer.doctor.checks import Checker
from bricklayer.backend.api import BackendApi
from bricklayer.utils.... | code_fim | medium | {
"lang": "python",
"repo": "cbrentharris/bricklayer",
"path": "/bricklayer/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.