text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> """Add or remove given issue from this epic (self). Specify one issue to add or remove as a kwarg"""
if add and not remove:
logger.debug(f'Adding Jira issue {add} to epic {self.jira_key}')
epic_name = self.jira_key
elif remove and not add:
logge... | code_fim | hard | {
"lang": "python",
"repo": "ucsc-cgp/sync-agile-boards",
"path": "/src/jira.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Not all issue descriptions have the corresponding github issue listed in them
# self.github_repo, self.github_key = self.get_github_equivalent() or (None, None)
self.get_github_equivalent()
if CustomFieldNames.story_points in content['fields'].keys():
self.st... | code_fim | hard | {
"lang": "python",
"repo": "ucsc-cgp/sync-agile-boards",
"path": "/src/jira.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ucsc-cgp/sync-agile-boards path: /src/jira.py
import datetime
import logging
from more_itertools import first
import re
import requests
from tqdm import tqdm
from settings import transitions
from src.access import get_access_params
from src.issue import Repo, Issue
from src.utilities import Cust... | code_fim | hard | {
"lang": "python",
"repo": "ucsc-cgp/sync-agile-boards",
"path": "/src/jira.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hhursev/recipe-scrapers path: /tests/test_spendwithpennies.py
from recipe_scrapers.spendwithpennies import SpendWithPennies
from tests import ScraperTest
class TestSpendWithPenniesScraper(ScraperTest):
scraper_class = SpendWithPennies
def test_host(self):
self.assertEqual("spe... | code_fim | hard | {
"lang": "python",
"repo": "hhursev/recipe-scrapers",
"path": "/tests/test_spendwithpennies.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertEqual(35, self.harvester_class.total_time())
def test_yields(self):
self.assertEqual("6 servings", self.harvester_class.yields())
def test_image(self):
self.assertEqual(
"https://www.spendwithpennies.com/wp-content/uploads/2013/10/Chocolate-Pudding-... | code_fim | hard | {
"lang": "python",
"repo": "hhursev/recipe-scrapers",
"path": "/tests/test_spendwithpennies.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class RenderMenuNode(Node):
"""
:param user: the user to render menu
:type user: User object
:param path: path of the request
:type path: str
"""
def render(self, context):
if not 'request' in context:
raise ImproperlyConfigured(context_proces... | code_fim | hard | {
"lang": "python",
"repo": "arkanister/minitickets",
"path": "/lib/utils/html/templatetags/menu.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arkanister/minitickets path: /lib/utils/html/templatetags/menu.py
# -*- coding: utf-8 -*-
from django import template
from django.core.exceptions import ImproperlyConfigured
from django.template import Node
from django.utils.safestring import mark_safe
from ..menu.base import menu_factory
from ... | code_fim | hard | {
"lang": "python",
"repo": "arkanister/minitickets",
"path": "/lib/utils/html/templatetags/menu.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keras-team/keras-cv path: /keras_cv/models/object_detection/yolo_v8/yolo_v8_detector_presets.py
# Copyright 2023 The KerasCV Authors
#
# 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 th... | code_fim | hard | {
"lang": "python",
"repo": "keras-team/keras-cv",
"path": "/keras_cv/models/object_detection/yolo_v8/yolo_v8_detector_presets.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
"YOLOV8-M pretrained on PascalVOC 2012 object detection task, "
"which consists of 20 classes. This model achieves a final MaP "
"of 0.45 on the evaluation set."
),
"params": 25901004,
"official_name": "YOLOV8Detector",
... | code_fim | hard | {
"lang": "python",
"repo": "keras-team/keras-cv",
"path": "/keras_cv/models/object_detection/yolo_v8/yolo_v8_detector_presets.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DanielGomeX/meetup2xibo path: /meetup2xibo/log_summarizer/conflict.py
"""Conflicts when two or more events are scheduled in the same place at the
same time."""
from .event import Event
class Conflict:
"""Conflicts when two or more events are scheduled in the same place at the
same tim... | code_fim | hard | {
"lang": "python",
"repo": "DanielGomeX/meetup2xibo",
"path": "/meetup2xibo/log_summarizer/conflict.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Return the list of events sorted for reporting."""
return sorted(self._events, key=Event.report_sort_key)
@property
def start_time(self):
return self._start_time
@property
def end_time(self):
return self._end_time
@property
def events(self):
... | code_fim | hard | {
"lang": "python",
"repo": "DanielGomeX/meetup2xibo",
"path": "/meetup2xibo/log_summarizer/conflict.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># def CountSort(self, nums):
# MIN = min(nums)
# for k in range(len(nums)):
# nums[k] -= MIN
# tmp = [0] * (max(nums)+1)
# for num in nums:
# tmp[num] += 1
# ans = []
# for k in range(len(tmp)):
# for _ in range(tmp[k]... | code_fim | hard | {
"lang": "python",
"repo": "1050669722/LeetCode-Answers",
"path": "/Python/problem0455.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1050669722/LeetCode-Answers path: /Python/problem0455.py
class Solution:
def findContentChildren(self, g: list, s: list) -> int:
'''
这一题很像华为面试的第一题:优势洗牌
不过,那一题是要求把s重新排序以满足g
'''
# count = 0
# for g0 in g:
# s.append(g0)
# s... | code_fim | hard | {
"lang": "python",
"repo": "1050669722/LeetCode-Answers",
"path": "/Python/problem0455.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
g.sort(), s.sort()
p, q, ans = 0, 0, 0
while p<len(s) and q<len(g):
if s[p] >= g[q]:
ans += 1
p += 1
q += 1
else:
p += 1
return ans
solu = Solution()
g, s = [1,2,3], [1,1]
g, s = [1,2... | code_fim | hard | {
"lang": "python",
"repo": "1050669722/LeetCode-Answers",
"path": "/Python/problem0455.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.idx += 1
if local_dur == 0:
local_dur = self.dur
predict_list, nature = readLETKF(predictdir, naturepath, naturesteps=naturesteps, dur=local_dur, num=num, npoints=self.npts, nens=nens)
rmse_series = np.zeros((local_dur, num*nens))
naturestart += 1
... | code_fim | hard | {
"lang": "python",
"repo": "f-tomizawa/RC_Analysis_Loren96",
"path": "/data/post/ensemble_fig.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: f-tomizawa/RC_Analysis_Loren96 path: /data/post/ensemble_fig.py
#!python3
# This is the code to visualize the expr1 result
import struct, os
import numpy as np
import matplotlib.pyplot as plt
from lorenz96data import Lorenz96, readData, readBinary
def drawRMSEfig(rmse_series, dirpath):
# ge... | code_fim | hard | {
"lang": "python",
"repo": "f-tomizawa/RC_Analysis_Loren96",
"path": "/data/post/ensemble_fig.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def add_rc(self, exprdir, npoints=0, local_dur=0, num=0, step=1):
if local_dur == 0:
local_dur = self.dur
if npoints == 0:
npoints = self.npts
predict, nature = readRC(exprdir, nsteps=local_dur*num, npoints=npoints, nens=1)
# cut the recursive da... | code_fim | hard | {
"lang": "python",
"repo": "f-tomizawa/RC_Analysis_Loren96",
"path": "/data/post/ensemble_fig.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: floregol/gcn_mark path: /gcn/plotting_classification_results.py
import matplotlib.pyplot as plt
import pickle as pk
import numpy as np
import os
from os import listdir
from os.path import isfile, join
from utils import *
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_sc... | code_fim | hard | {
"lang": "python",
"repo": "floregol/gcn_mark",
"path": "/gcn/plotting_classification_results.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(accuracy_score(label_predictions, label_ground_truth))
print(f1_score(label_predictions, label_ground_truth, average="macro"))
args_good = np.where(label_predictions == label_ground_truth)
args_not = np.where(label_predictions != label_ground_truth)
result_path = 'results/classification/'
plot_pat... | code_fim | hard | {
"lang": "python",
"repo": "floregol/gcn_mark",
"path": "/gcn/plotting_classification_results.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gistable/gistable path: /dockerized-gists/1330493/snippet.py
from fabric.api import env, local, run
<|fim_suffix|> # change from the default user to 'vagrant'
env.user = 'vagrant'
# connect to the port-forwarded ssh
env.hosts = ['127.0.0.1:2222']
# use vagrant ssh key
r... | code_fim | easy | {
"lang": "python",
"repo": "gistable/gistable",
"path": "/dockerized-gists/1330493/snippet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # use vagrant ssh key
result = local('vagrant ssh_config | grep IdentityFile', capture=True)
env.key_filename = result.split()[1]
def uname():
run('uname -a')<|fim_prefix|># repo: gistable/gistable path: /dockerized-gists/1330493/snippet.py
from fabric.api import env, local, run
def v... | code_fim | medium | {
"lang": "python",
"repo": "gistable/gistable",
"path": "/dockerized-gists/1330493/snippet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # change from the default user to 'vagrant'
env.user = 'vagrant'
# connect to the port-forwarded ssh
env.hosts = ['127.0.0.1:2222']
# use vagrant ssh key
result = local('vagrant ssh_config | grep IdentityFile', capture=True)
env.key_filename = result.split()[1]
def uname():... | code_fim | easy | {
"lang": "python",
"repo": "gistable/gistable",
"path": "/dockerized-gists/1330493/snippet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vtalks/vtalks.net path: /web/talks/migrations/0034_auto_20180223_0911.py
# Generated by Django 2.0.2 on 2018-02-23 09:11
<|fim_suffix|>
class Migration(migrations.Migration):
dependencies = [
('talks', '0033_auto_20180217_1239'),
]
operations = [
]<|fim_middle|>from dj... | code_fim | medium | {
"lang": "python",
"repo": "vtalks/vtalks.net",
"path": "/web/talks/migrations/0034_auto_20180223_0911.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('talks', '0033_auto_20180217_1239'),
]
operations = [
]<|fim_prefix|># repo: vtalks/vtalks.net path: /web/talks/migrations/0034_auto_20180223_0911.py
# Generated by Django 2.0.2 on 2018-02-23 09:11
from django.db import migrations, models
import django.db.mod... | code_fim | easy | {
"lang": "python",
"repo": "vtalks/vtalks.net",
"path": "/web/talks/migrations/0034_auto_20180223_0911.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: angseung/CIS_Convert path: /CIS_Demo.py
import sys
import argparse
import cv2
import numpy as np
import time
def salt_and_pepper(img, p):
org_shape = img.shape
wsize = img.shape[0] * img.shape[1]
img = img.reshape(wsize)
thres = 1 - p
rnd_array = np.random.random(size=wsize)... | code_fim | hard | {
"lang": "python",
"repo": "angseung/CIS_Convert",
"path": "/CIS_Demo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(1, rowsize + 1):
before = now
now = np.squeeze(np.sum(input_image[:, N * (i - 1): N * i, :], 1))
if (i == 1):
gain = now
else:
gain = gain + np.abs(before - now)
finalGain = np.sum(gain, 0)
som = np.sqrt((finalGain ** 2)... | code_fim | hard | {
"lang": "python",
"repo": "angseung/CIS_Convert",
"path": "/CIS_Demo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Generates text to visualize inside a pie chart
def make_autopct(values):
def autopct(pct):
total = sum(values)
val = int(round(pct*total/100.0))
return '{v}'.format(v=val)
return autopct
# Runs all functions, handle exceptions when necessary
def main():
hum... | code_fim | hard | {
"lang": "python",
"repo": "Hoangven/detect-breast-cancer-genes",
"path": "/detect_breast_cancer_genes.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hoangven/detect-breast-cancer-genes path: /detect_breast_cancer_genes.py
'''
AUTHOR: Koen Rademaker
FILE: detect_breast_cancer_genes.py
VERSION: 1.0
DATE: 24/jun/2018
FUNCTION: Detect human genes and aliases associated with breast cancer from the complete list of human cancer genes (n = 8159... | code_fim | hard | {
"lang": "python",
"repo": "Hoangven/detect-breast-cancer-genes",
"path": "/detect_breast_cancer_genes.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Preparing to open vision")
mamboVision = DroneVisionGUI(mambo, is_bebop=False, buffer_size=200,
user_code_to_run=demo_mambo_user_vision_function, user_args=(mambo, ))
userVision = UserVision(mamboVision)
mamboVision.set_user_callb... | code_fim | hard | {
"lang": "python",
"repo": "ajpen/pyparrot",
"path": "/examples/demoMamboVisionGUI.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ajpen/pyparrot path: /examples/demoMamboVisionGUI.py
"""
Demo of the Bebop vision using DroneVisionGUI that relies on libVLC. It is a different
multi-threaded approach than DroneVision
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
from pyparrot.DroneVisionGUI import DroneVisionG... | code_fim | hard | {
"lang": "python",
"repo": "ajpen/pyparrot",
"path": "/examples/demoMamboVisionGUI.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
# you will need to change this to the address of YOUR mambo
mamboAddr = "e0:14:d0:63:3d:d0"
# make my mambo object
# remember to set True/False for the wifi depending on if you are using the wifi or the BLE to connect
mambo = Mambo(mamboAddr, use_wifi=True)... | code_fim | hard | {
"lang": "python",
"repo": "ajpen/pyparrot",
"path": "/examples/demoMamboVisionGUI.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dmitriyvek/Tracker path: /backend/tests/api/auth/test_logout.py
import json
from tracker.api.services.auth import (
generate_auth_token, generate_password_hash
)
from tracker.db.schema import users_table, blacklist_tokens_table
from tests.services import generate_user_data
async def test_l... | code_fim | hard | {
"lang": "python",
"repo": "dmitriyvek/Tracker",
"path": "/backend/tests/api/auth/test_logout.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # check login with blacklisted token
query = '''
{
users {
detail {
record {
id
}
}
}
}
'''
response = await client.post(
'/graphql', data=json.du... | code_fim | hard | {
"lang": "python",
"repo": "dmitriyvek/Tracker",
"path": "/backend/tests/api/auth/test_logout.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("************ Step 1: Please select growth-trait data ************")
local_path = os.getcwd()
summery_path = local_path + "/mov/summary/"
growth_trait_path = growth_trait_selection()
df_gt = pd.read_csv(growth_trait_path)
print("************ Step 2: Please select y... | code_fim | hard | {
"lang": "python",
"repo": "MTNakata/AraVib",
"path": "/AraVibS.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MTNakata/AraVib path: /AraVibS.py
#!/Users/local/.pyenv/versions/anaconda3-4.0.0/bin python3
# coding: utf-8
import os
import numpy as np
import pandas as pd
from sklearn.externals import joblib
import AraVib
from AraVib_modules.AraVibS_def import growth_trait_selection, freq_file_selection
... | code_fim | hard | {
"lang": "python",
"repo": "MTNakata/AraVib",
"path": "/AraVibS.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> df_freq2 = df_freq.copy()
df_freq2["H"] = df_gt["H"]
df_freq2["FW"] = df_gt["FW"]
df_freq2["Dif"] = dif
df_freq2["p_value"] = p_value
df_freq2["Mutant?(p_value<0.01)"] = clf
result_path = "{}/mov/AraVibS_result/{}+Identify.csv".format(local_... | code_fim | hard | {
"lang": "python",
"repo": "MTNakata/AraVib",
"path": "/AraVibS.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>inputs.append(csv_meta_input)
meta_pattern = os.path.join('meta', '*-*.md')
md_meta_input = sdg.inputs.InputYamlMdMeta(path_pattern=meta_pattern, git=False)
# add metadata to inputs
inputs.append(md_meta_input)
# Use .csv and .md files for metadata
meta_pattern = os.path.join('meta', '*.*.xlsx')
excel_m... | code_fim | hard | {
"lang": "python",
"repo": "mauromussin/open-sdg-data-starter-1",
"path": "/scripts/output.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mauromussin/open-sdg-data-starter-1 path: /scripts/output.py
import os
import sdg
import glob
import json
import lxml.etree as ET
import pandas as pd
import numpy as np
def csv2mapping(csv):
df=pd.read_csv(csv)
data={}
for index, row in df.iterrows():
if "," in row["Indicator... | code_fim | hard | {
"lang": "python",
"repo": "mauromussin/open-sdg-data-starter-1",
"path": "/scripts/output.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @staticmethod
def test_invalid_param(visitor):
visitor(
ENDPOINT,
params={"page": 1337},
code=404,
)
visitor(
ENDPOINT,
params={"page": 1, "field": "peach"},
code=404,
)
visitor(
... | code_fim | hard | {
"lang": "python",
"repo": "spookey/shorter",
"path": "/tests/views/test_plus_block.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spookey/shorter path: /tests/views/test_plus_block.py
from re import IGNORECASE
from re import compile as re_compile
from flask import url_for
from pytest import mark
from shorter.models.short import Short
from shorter.views import plus
ENDPOINT = "plus.block"
@mark.usefixtures("session")
cl... | code_fim | medium | {
"lang": "python",
"repo": "spookey/shorter",
"path": "/tests/views/test_plus_block.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def read_config(self):
with open(self.config_file, 'r') as f:
while True:
line = f.readline().strip()
if not line:
break
self.words.append(line.split('\t'))<|fim_prefix|># repo: bosconb/scel-crawler-rime-converter ... | code_fim | hard | {
"lang": "python",
"repo": "bosconb/scel-crawler-rime-converter",
"path": "/Helper/ConfigHelper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bosconb/scel-crawler-rime-converter path: /Helper/ConfigHelper.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
os.path.exists('config') or os.makedirs('config')
class ConfigHelper:
def __init__(self, words = [], config_file = None):
<|fim_suffix|> with open(self.config_f... | code_fim | medium | {
"lang": "python",
"repo": "bosconb/scel-crawler-rime-converter",
"path": "/Helper/ConfigHelper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.words = words
self.config_file = config_file or 'config/trans.conf'
def write_config(self):
with open(self.config_file, 'w') as f:
for w, t in self.words:
f.write(w + '\t' + t + '\n')
def read_config(self):
with open(self.config_fi... | code_fim | medium | {
"lang": "python",
"repo": "bosconb/scel-crawler-rime-converter",
"path": "/Helper/ConfigHelper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jdecked/trifold-api path: /api/migrations/0001_initial.py
# Generated by Django 2.1.5 on 2019-02-10 06:32
from django.db import migrations, models
import django.utils.timezone
<|fim_suffix|> initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | code_fim | hard | {
"lang": "python",
"repo": "jdecked/trifold-api",
"path": "/api/migrations/0001_initial.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='User',
fields=[
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('id', models.CharField(default=None, editable=False, max_length=255, primary_key=True, s... | code_fim | hard | {
"lang": "python",
"repo": "jdecked/trifold-api",
"path": "/api/migrations/0001_initial.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ilapi/intralinks-sdk-python path: /intralinks/tools/notebooks_goodies.py
import IPython
import base64
import ipywidgets
import IPython.display
import pandas as pd
import pandas.io.json
def table(data, first_columns=[], drop_columns=[]):
data = data.copy()
for d in data:
if 'cus... | code_fim | hard | {
"lang": "python",
"repo": "ilapi/intralinks-sdk-python",
"path": "/intralinks/tools/notebooks_goodies.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def Dropdown(self, description, options, value=None, key=None): # NOSONAR
w = ipywidgets.widgets.Dropdown(description=description, options=options, value=value)
return self.register_widget(w, key)
def Button(self, description, action=None, key=None): # NOSONAR
w = ipywidge... | code_fim | hard | {
"lang": "python",
"repo": "ilapi/intralinks-sdk-python",
"path": "/intralinks/tools/notebooks_goodies.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spacetelescope/stsci-aws-utils path: /tests/test_s3.py
ts(monkeypatch):
# No need to sleep while tests are running
monkeypatch.setattr(s3, "_BACKOFF_CAP", 0.1)
monkeypatch.setattr(s3, "_MIN_DOWNLOAD_PART_SIZE_BYTES", 1024)
def generate_object_data(content_length, num_parts):
con... | code_fim | hard | {
"lang": "python",
"repo": "spacetelescope/stsci-aws-utils",
"path": "/tests/test_s3.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> @pytest.mark.asyncio
async def test_context_management(self, s3_session):
assert s3_session.closed is False
async with s3.AsyncConcurrentS3Client(session=s3_session):
assert s3_session.closed is False
assert s3_session.closed is True
class MockAsyncClient:
... | code_fim | hard | {
"lang": "python",
"repo": "spacetelescope/stsci-aws-utils",
"path": "/tests/test_s3.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: spacetelescope/stsci-aws-utils path: /tests/test_s3.py
, num_parts):
content = os.urandom(content_length)
if num_parts == 1:
etag = '"' + compute_md5(content).hex() + '"'
else:
assert content_length > (num_parts * 1024 * 1024)
part_size_bytes = math.floor(con... | code_fim | hard | {
"lang": "python",
"repo": "spacetelescope/stsci-aws-utils",
"path": "/tests/test_s3.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bradleygolden/configureme path: /configureme/__version__.py
# -*- coding: utf-8 -*-
# __ _
# / _(_)
# ___ ___ _ __ | |_ _ __ _ _ _ _ __ ___ _ __ ___ ___
# / __/ _ \| '_ \| _| |/ _` | | | | '__/ _ \ '_ ` _ \ / _ \
# | (_| (_) | | | | | | | (_| | |_| | |... | code_fim | easy | {
"lang": "python",
"repo": "bradleygolden/configureme",
"path": "/configureme/__version__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>__version__ = ".".join(map(str, VERSION)) + PRE<|fim_prefix|># repo: bradleygolden/configureme path: /configureme/__version__.py
# -*- coding: utf-8 -*-
# __ _
# / _(_)
# ___ ___ _ __ | |_ _ __ _ _ _ _ __ ___ _ __ ___ ___
# / __/ _ \| '_ \| _| |/ _` | | | | '_... | code_fim | easy | {
"lang": "python",
"repo": "bradleygolden/configureme",
"path": "/configureme/__version__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bkj/topdot path: /test.py
#!/usr/bin/env python
"""
test.py
"""
from __future__ import print_function, division
import sys
import json
import argparse
import numpy as np
from time import time
from scipy import sparse
import topdot.topdot as td
def run_topdot(A, B, k, lower_bound=0):
... | code_fim | hard | {
"lang": "python",
"repo": "bkj/topdot",
"path": "/test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>def run_naive(A, B, ntop, lower_bound=None):
C = A.dot(B)
I, D = zip(*[_run_naive(row, ntop) for row in C])
return D, I
# --
# Run
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--dim', type=int, default=4096)
parser.add_argument('--k', type=int, defau... | code_fim | hard | {
"lang": "python",
"repo": "bkj/topdot",
"path": "/test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 174high/auto-car-new path: /test/rc_control_socket_client_test.py
import socket
import time
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('192.168.0.106', 8000))
connection = client_socket.makefile('wb')
print "----connection--- :"
<|fim_suffix|> ... | code_fim | easy | {
"lang": "python",
"repo": "174high/auto-car-new",
"path": "/test/rc_control_socket_client_test.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> connection.write("a")
connection.flush()
time.sleep(1)<|fim_prefix|># repo: 174high/auto-car-new path: /test/rc_control_socket_client_test.py
import socket
import time
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('192.168.0.106', 8000))
connection... | code_fim | easy | {
"lang": "python",
"repo": "174high/auto-car-new",
"path": "/test/rc_control_socket_client_test.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def ensure_login(self, username, password):
wd = self.app.wd
if self.is_logged_in():
if self.is_logged_in_as(username):
return
else:
self.exit_s3()
self.login(username, password)
def assertion_current_page(self):
... | code_fim | hard | {
"lang": "python",
"repo": "FearFactor1/S3",
"path": "/fixture/session.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: FearFactor1/S3 path: /fixture/session.py
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("username").send_keys(username)
wd.fi... | code_fim | medium | {
"lang": "python",
"repo": "FearFactor1/S3",
"path": "/fixture/session.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dusktreader/pydon path: /tests/test_pydon.py
import re
from pydon import (
load_string,
load_file,
dump_string,
dump_file,
)
def strip_whitespace(text):
return re.sub(r'\s+', '', text)
<|fim_suffix|>
def test_dump_file(tmpdir):
filename = tmpdir.join('test.pydon')
... | code_fim | hard | {
"lang": "python",
"repo": "dusktreader/pydon",
"path": "/tests/test_pydon.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_dump_file(tmpdir):
filename = tmpdir.join('test.pydon')
data = {'a': 1, 'b': '2', 'c': [3, 4, 5]}
dump_file(data, str(filename))
with open(str(filename)) as test_file:
text = test_file.read()
computed_text = strip_whitespace(text)
expected_text = strip_whitespace(... | code_fim | hard | {
"lang": "python",
"repo": "dusktreader/pydon",
"path": "/tests/test_pydon.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return list(self.get_with_unit_type(UnitTypeId.BATTLECRUISER))
def cyclones(self) -> list:
return list(self.get_with_unit_type(UnitTypeId.CYCLONE))
def ghosts(self) -> list:
return list(self.get_with_unit_type(UnitTypeId.GHOST))
def hellions(self) -> list:
return list(self.get_wit... | code_fim | hard | {
"lang": "python",
"repo": "ljuti/raynors-rangers",
"path": "/bot/registries/unit_registry.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ljuti/raynors-rangers path: /bot/registries/unit_registry.py
# -*- coding: utf-8 -*-
""" Unit Registry
Unit registry keeps track of all units that the AI has at any given moment.
Units can be queried by a tag or by type of units.
"""
from bot.registries.base_registry import BaseRegistry
from ... | code_fim | hard | {
"lang": "python",
"repo": "ljuti/raynors-rangers",
"path": "/bot/registries/unit_registry.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tymscar/Advent-Of-Code path: /2020/Python/day14/part2.py
def get_addresses(mask, location):
main_address = []
location_string = (38-len(bin(location))) * "0" + bin(location)[2:]
for i in range(len(mask)):
if mask[i] == "0":
main_address.append(location_string[i])
... | code_fim | medium | {
"lang": "python",
"repo": "tymscar/Advent-Of-Code",
"path": "/2020/Python/day14/part2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> file = open('input.txt', 'r')
memory = {}
for line in file:
line = line.strip("\n").split(" = ")
if line[0] == "mask":
mask = line[1]
else:
location = int(line[0].split("[")[1].strip("]"))
value = int(line[1])
addresses =... | code_fim | hard | {
"lang": "python",
"repo": "tymscar/Advent-Of-Code",
"path": "/2020/Python/day14/part2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def dCadt(self, args: List[float]) -> float:
""" Calculate dCa/dt for given parameters.
Intracellular calcium changes over time dependent on CaV channel,
NMDA receptor, and calcium pump. Updated from ANmodel.dCadt()
for SAN model.
Parameters
--------... | code_fim | hard | {
"lang": "python",
"repo": "ModelDBRepository/264519",
"path": "/anmodel/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Attributes
----------
ini : list (float)
Initial parameters for differential equations of SAN model.
update from initial parameters of AN model
channel_bool : list (bool)
True means channels incorporated in the model and False means not.
The order of the lis... | code_fim | hard | {
"lang": "python",
"repo": "ModelDBRepository/264519",
"path": "/anmodel/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ModelDBRepository/264519 path: /anmodel/models.py
]) -> float:
""" Calculate dCa/dt for given parameters.
Intracellular calcium changes over time dependent on CaV channel,
NMDA receptor, and calcium pump.
Parameters
----------
args : list (float)... | code_fim | hard | {
"lang": "python",
"repo": "ModelDBRepository/264519",
"path": "/anmodel/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RenaKunisaki/StarFoxAdventures path: /modelviewer/common/xstruct.py
import logging; log = logging.getLogger(__name__)
import struct
class Struct:
"""Class wrapping struct unpacking."""
_order = ''
def __init__(self, data):
self._raw = data
for name, field in self._fi... | code_fim | hard | {
"lang": "python",
"repo": "RenaKunisaki/StarFoxAdventures",
"path": "/modelviewer/common/xstruct.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if offset is not None: file.seek(offset)
if count is None:
data = file.read(cls._size)
return cls(data)
else:
#log.debug("Read %d x %s from 0x%X", count, cls.__name__, file.tell())
data = file.read(cls._size * count)
res ... | code_fim | hard | {
"lang": "python",
"repo": "RenaKunisaki/StarFoxAdventures",
"path": "/modelviewer/common/xstruct.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # TEST: IPv4 ping from host1 to loopback interface ip
LogOutput('info', "\n\n\nTEST: IPv4 ping from host1 to loopback interface")
retStruct = host1.Ping(ipAddr="2.2.2.1", packetCount=1)
retCode = retStruct.returnCode()
assert retCode != 0, "\n#### FAIL: IPv4 ping to loopback passed. ##... | code_fim | hard | {
"lang": "python",
"repo": "jxtxinbing/opssrc_org",
"path": "/ops-switchd-opennsl-plugin/tests/test_switchd_opennsl_ct_loopback.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Delete loopback interface
LogOutput('info', "Deleting loopback interface lo:1")
loopback_command = """ovsdb-client transact '[ "OpenSwitch",
{
"op" : "delete",
"table" : "Port",
"where":[["name","==","lo:1"]]
},
{
"op... | code_fim | hard | {
"lang": "python",
"repo": "jxtxinbing/opssrc_org",
"path": "/ops-switchd-opennsl-plugin/tests/test_switchd_opennsl_ct_loopback.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jxtxinbing/opssrc_org path: /ops-switchd-opennsl-plugin/tests/test_switchd_opennsl_ct_loopback.py
#!/usr/bin/env python
# Copyright (C) 2015 Hewlett Packard Enterprise Development LP
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compl... | code_fim | hard | {
"lang": "python",
"repo": "jxtxinbing/opssrc_org",
"path": "/ops-switchd-opennsl-plugin/tests/test_switchd_opennsl_ct_loopback.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lstefanello/perceptron path: /perceptron/cost_functions.py
import numpy as np
def quadratic(model):
return sum((model.activations[-1] - model.desired_output)**2)
def quadratic_derivative(model):
<|fim_suffix|> return model.activations[-1] - model.desired_output
def func_dict(order):
... | code_fim | hard | {
"lang": "python",
"repo": "lstefanello/perceptron",
"path": "/perceptron/cost_functions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def func_dict(order):
if (order == 0):
dict = {
"quadratic": quadratic,
"cross entropy": cross_entropy
}
elif (order == 1):
dict = {
"quadratic": quadratic_derivative,
"cross entropy": cross_entropy_derivative
}
... | code_fim | medium | {
"lang": "python",
"repo": "lstefanello/perceptron",
"path": "/perceptron/cost_functions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>NONE = 'none'
GPRS = 'GPRS'
REGULAR_2G = 'Regular-2G'
GOOD_2G = 'Good-2G'
REGULAR_3G = 'Regular-3G'
GOOD_3G = 'Good-3G'
REGULAR_4G = 'Regular-4G'
DSL = 'DSL'
WIFI = 'WiFi'
NETWORK_CONFIGS = {
NONE: _Configs(0, 0, 0),
GPRS: _Configs(50, 20, 500),
REGULAR_2G: _Configs(250, 50, 300),
GOOD_2... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/telemetry/telemetry/page/traffic_setting.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: catapult-project/catapult path: /telemetry/telemetry/page/traffic_setting.py
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Copyright 2016 The Chromium Authors. All rights reserved... | code_fim | hard | {
"lang": "python",
"repo": "catapult-project/catapult",
"path": "/telemetry/telemetry/page/traffic_setting.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TACC/Galaxy path: /src/cinema/quat.py
## ========================================================================== ##
## Copyright (c) 2014-2020 The University of Texas at Austin. ##
## All rights reserved. ##
## ... | code_fim | hard | {
"lang": "python",
"repo": "TACC/Galaxy",
"path": "/src/cinema/quat.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> num = q[0] * 2.0
num2 = q[1] * 2.0
num3 = q[2] * 2.0
num4 = q[0] * num
num5 = q[1] * num2
num6 = q[2] * num3
num7 = q[0] * num2
num8 = q[0] * num3
num9 = q[1] * num3
num10 = q[3] * num
num11 = q[3] * num2
num12 = q[3] * num3
return [(1.0 - (... | code_fim | hard | {
"lang": "python",
"repo": "TACC/Galaxy",
"path": "/src/cinema/quat.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> if p1x == p2x and p1y == p2y:
return [0.0, 0.0, 0.0, 0.0]
p1 = [p1x, p1y, project_to_sphere(TRACKBALLSIZE,p1x,p1y)]
p2 = [p2x, p2y, project_to_sphere(TRACKBALLSIZE,p2x,p2y)]
a = normalize(cross(p2,p1))
d = sub(p1,p2)
t = length(d) / (2.0*TRACKBALLSIZE)
if t > 1.0:
... | code_fim | hard | {
"lang": "python",
"repo": "TACC/Galaxy",
"path": "/src/cinema/quat.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jcoffi/pandas-ml-quant path: /pandas-quant-data-provider/pandas_quant_data_provider/old/provider.py
from pandas_quant_data_provider.datafetching import fetch_yahoo, fetch_investing, fetch_cryptocompare_daily, \
fetch_cryptocompare_hourly, fetch_fred
<|fim_suffix|>PROVIDER_MAP = {
"yahoo"... | code_fim | medium | {
"lang": "python",
"repo": "jcoffi/pandas-ml-quant",
"path": "/pandas-quant-data-provider/pandas_quant_data_provider/old/provider.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>PROVIDER_MAP = {
"yahoo": YAHOO,
"investing": INVESTING,
"cryptocompare": CRYPTO_COMPARE,
"cryptocompare_daily": CRYPTO_COMPARE,
"cryptocompare_hourly": CRYPTO_COMPARE_HOURLY,
"fred": FRED
}<|fim_prefix|># repo: jcoffi/pandas-ml-quant path: /pandas-quant-data-provider/pandas_quant... | code_fim | medium | {
"lang": "python",
"repo": "jcoffi/pandas-ml-quant",
"path": "/pandas-quant-data-provider/pandas_quant_data_provider/old/provider.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vault-the/sorter path: /tests/some_files.py
many_files = ['WhatsApp Image 2017-06-10 at 9.53.02 PM.jpeg',
'unnamed.png',
'index.php',
'wp-settings.php',
'WallPaper.zip',
'coverage-4.4.1.tar.gz',
'Coldplay - The Scientist.mp4',
'GBWAPlus v5.60-2.17.146 @atnfas_hoak.apk',
'updates to www.th... | code_fim | hard | {
"lang": "python",
"repo": "vault-the/sorter",
"path": "/tests/some_files.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>GBWhatsapp Profile Photos.zip',
'wp-load.php',
'wp-includes',
'optimizilla.zip',
'optimizilla',
'Download.zip',
'unnamed.webp',
'wp-config-sample.php',
't-20',
'comment.png',
'unnamed (1).png',
'wp-login.php',
'LICENSE',
'Gumba Free Website Template - Free-CSS.com.zip',
'gumba-0.1.0',
'Cons... | code_fim | hard | {
"lang": "python",
"repo": "vault-the/sorter",
"path": "/tests/some_files.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def inverse(args):
if left < args.threshold:
bl('keyboard', LIMITS['keyboard'] * left/_THRESHOLD)
bl('screen', args.minimum_brightness +
LIMITS['screen'] * (left/_THRESHOLD))
else:
bl('keyboard', 0)
bl('screen', LIMITS['screen'])
_GOVERNORS =... | code_fim | hard | {
"lang": "python",
"repo": "pilona/Utils",
"path": "/mb-backlightd.py",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pilona/Utils path: /mb-backlightd.py
#! /usr/bin/env python3
from time import sleep
from os import path
import re
_THRESHOLD = 20
_LIGHT_SENSOR = '/sys/devices/platform/applesmc.768/light'
_KBD_BACKLIGHT = '/sys/class/leds/smc::kbd_backlight'
_SCREEN_BACKLIGHT = '/sys/class/backlight/gmux_back... | code_fim | hard | {
"lang": "python",
"repo": "pilona/Utils",
"path": "/mb-backlightd.py",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.reader
def get_exceptions(self):
return self.exceptions<|fim_prefix|># repo: thelennylord/brigadier.py path: /brigadier/parse_result.py
from brigadier.string_reader import StringReader
class ParseResult:
def __init__(self, context, reader=StringReader(""), except... | code_fim | medium | {
"lang": "python",
"repo": "thelennylord/brigadier.py",
"path": "/brigadier/parse_result.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.context
def get_reader(self):
return self.reader
def get_exceptions(self):
return self.exceptions<|fim_prefix|># repo: thelennylord/brigadier.py path: /brigadier/parse_result.py
from brigadier.string_reader import StringReader
<|fim_middle|>class ParseRe... | code_fim | hard | {
"lang": "python",
"repo": "thelennylord/brigadier.py",
"path": "/brigadier/parse_result.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thelennylord/brigadier.py path: /brigadier/parse_result.py
from brigadier.string_reader import StringReader
class ParseResult:
<|fim_suffix|> return self.context
def get_reader(self):
return self.reader
def get_exceptions(self):
return self.exceptions<|fim_mi... | code_fim | hard | {
"lang": "python",
"repo": "thelennylord/brigadier.py",
"path": "/brigadier/parse_result.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @async_task
def _send_frame(self, frame):
yield self._stream.send(frame.serialize())
def websocket_protocol(allowed_origins=None):
def decorator(protocol):
@async_task
def wrapper(server, stream):
try:
handshake_headers = yield timeout(
... | code_fim | hard | {
"lang": "python",
"repo": "lgfrbcsgo/wot-websocket-server",
"path": "/src/mod_websocket_server/websocket_server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def websocket_protocol(allowed_origins=None):
def decorator(protocol):
@async_task
def wrapper(server, stream):
try:
handshake_headers = yield timeout(
5, perform_handshake(stream, allowed_origins)
)
except Ti... | code_fim | hard | {
"lang": "python",
"repo": "lgfrbcsgo/wot-websocket-server",
"path": "/src/mod_websocket_server/websocket_server.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lgfrbcsgo/wot-websocket-server path: /src/mod_websocket_server/websocket_server.py
import struct
from collections import deque
from mod_async import Return, TimeoutExpired, async_task, timeout
from mod_async_server import StreamClosed
from mod_websocket_server.frame import Frame, OpCode
from mod... | code_fim | hard | {
"lang": "python",
"repo": "lgfrbcsgo/wot-websocket-server",
"path": "/src/mod_websocket_server/websocket_server.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x0B\x00\x00\x00\x0C\x00\x00\x0C\x00\x00\x0C\x00\x00\x0C\x00\x00\xFC\x7F\x00\xFC\x7F\x00\x0C\x00\x00\x0C\x00\x00\x0C\x00\x00\x0C\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x0C\x00\x00\x00\xFC\x0F\x00\xFC\x3F\x00\x00\x30\x00\x0... | code_fim | hard | {
"lang": "python",
"repo": "fojie/micropython-samples",
"path": "/font/ubuntu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x0A\x00\x00\x06\x00\x00\x06\x00\x00\x06\x00\x00\x06\x00\x00\x06\x00\x00\x06\x00\x00\x06\x00\x00\x06\x00\x00\x06\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x06\x00\x00\x00\x00\x00\x00\x02\... | code_fim | hard | {
"lang": "python",
"repo": "fojie/micropython-samples",
"path": "/font/ubuntu.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fojie/micropython-samples path: /font/ubuntu.py
00\x07\x3E\xE0\x03\xF8\xFF\x00\xC0\x1F\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
\x09\x00\x00\x00\x20\x00\x00\x30\x01\x00\xB0\x03\x00\xFC\x00\... | code_fim | hard | {
"lang": "python",
"repo": "fojie/micropython-samples",
"path": "/font/ubuntu.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thexa4/Spades path: /bids.py
from relative_data import RelativeData
class Bids(RelativeData):
def __init__(self, reference_id=0):
super().__init__(reference_id)
self.bids = self.data
def add_bid(self, bid, player_id):
<|fim_suffix|> def __str__(self):
str_bids = {i: '?' for i in range... | code_fim | hard | {
"lang": "python",
"repo": "thexa4/Spades",
"path": "/bids.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for player_id in self.bids:
if self.bids[player_id] == "B":
return self.localize_id(player_id)
return None
def get_team_bid(self, team_id):
""""
Get the bid of a team.
return: A list with a single entry if both players made a normal bid, or the separate bids if either player has bid a (... | code_fim | hard | {
"lang": "python",
"repo": "thexa4/Spades",
"path": "/bids.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ssegundo/ANMI path: /src/anmi/T4/__init__.py
from .funcs_ruffini import metodo_ruffini
from .funcs_aproximacion import producto_<|fim_suffix|>ios_orto_peso
from .funcs_fourier import producto_escalar_trigono, coefs_fourier, coefs_fourier_discr, serie_fourier
from .funcs_bernstein import polinomio... | code_fim | medium | {
"lang": "python",
"repo": "ssegundo/ANMI",
"path": "/src/anmi/T4/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>oefs_fourier_discr, serie_fourier
from .funcs_bernstein import polinomios_bernstein<|fim_prefix|># repo: ssegundo/ANMI path: /src/anmi/T4/__init__.py
from .funcs_ruffini import metodo_ruffini
from .funcs_aproximacion import producto_<|fim_middle|>deriv, producto_asecas, producto_escalar_peso, metodo_gram... | code_fim | medium | {
"lang": "python",
"repo": "ssegundo/ANMI",
"path": "/src/anmi/T4/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
b'\n<proto/core/node/common/service/heritage_update_service.proto\x12\x1dsyft.core.node.common.service\x1a%proto/core/common/common_object.proto\x1a\x1bproto/core/io/address.proto"\x9b\x01\n\x15HeritageUpdateMessage\x12%\n\x06msg_id\x18\x01 \x... | code_fim | hard | {
"lang": "python",
"repo": "faustyang/PySyft",
"path": "/packages/syft/src/syft/proto/core/node/common/service/heritage_update_service_pb2.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>_HERITAGEUPDATEMESSAGE = DESCRIPTOR.message_types_by_name["HeritageUpdateMessage"]
HeritageUpdateMessage = _reflection.GeneratedProtocolMessageType(
"HeritageUpdateMessage",
(_message.Message,),
{
"DESCRIPTOR": _HERITAGEUPDATEMESSAGE,
"__module__": "proto.core.node.common.servi... | code_fim | hard | {
"lang": "python",
"repo": "faustyang/PySyft",
"path": "/packages/syft/src/syft/proto/core/node/common/service/heritage_update_service_pb2.py",
"mode": "spm",
"license": "Python-2.0",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.