text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: fhamborg/Giveme5W1H path: /Giveme5W1H/examples/datasets/gold_standard/legacy/converter.py
import copy
import glob
import hashlib
import html
import json
import xml.etree.ElementTree as ET
import unidecode
from twisted.python.util import println
def extract_markup(root, start, end, encoding):
... | code_fim | hard | {
"lang": "python",
"repo": "fhamborg/Giveme5W1H",
"path": "/Giveme5W1H/examples/datasets/gold_standard/legacy/converter.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> # get a nice to readable publisher from the url
if ('www' in news.url):
firstDot = news.url.index('.') + 1
else:
firstDot = news.url.index('//') + 2
news.publisher = news.url[firstDot:]
# print(news.metadata.publisher)
news.publisher = news.publisher[:news.... | code_fim | hard | {
"lang": "python",
"repo": "fhamborg/Giveme5W1H",
"path": "/Giveme5W1H/examples/datasets/gold_standard/legacy/converter.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyclectic/pyfix path: /src/main/python/pyfix/testrunner.py
# pyfix
# Copyright 2012 The pyfix team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:/... | code_fim | hard | {
"lang": "python",
"repo": "pyclectic/pyfix",
"path": "/src/main/python/pyfix/testrunner.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> message = None
traceback = None
success = False
try:
self._execute_interceptors(test_definition.before_interceptors)
try:
test_definition.function(**parameters)
success = True
except AssertionError as err... | code_fim | hard | {
"lang": "python",
"repo": "pyclectic/pyfix",
"path": "/src/main/python/pyfix/testrunner.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> Args:
label (str): The label to remove.
Returns:
AddressBookEntryModel
Raises:
APIError
"""
request_model = RemoveRequest(label=label)
data = self.delete(request_model, **kwargs)
data['address'] = Address(address... | code_fim | hard | {
"lang": "python",
"repo": "nifrali/pyStratis",
"path": "/api/addressbook/addressbook.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nifrali/pyStratis path: /api/addressbook/addressbook.py
from typing import Union, List
from api import APIRequest, EndpointRegister, endpoint
from api.addressbook.responsemodels import *
from api.addressbook.requestmodels import *
from pybitcoin.types import Address
class AddressBook(APIRequest... | code_fim | hard | {
"lang": "python",
"repo": "nifrali/pyStratis",
"path": "/api/addressbook/addressbook.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeffque/games-tk-breakout path: /breakout/game.py
import tkinter as tk
from .tipo_colisao import TipoColisao
from .geometry import Circulo,Retangulo
deslocamento_base = 0.1
tempo_after = 10
velocidade_bola = tempo_after*deslocamento_base
class Bola(Circulo):
radius = 5
def __init__(sel... | code_fim | hard | {
"lang": "python",
"repo": "jeffque/games-tk-breakout",
"path": "/breakout/game.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.score_label = tk.Label(self, textvariable=self.score_text_var, height=1, width = 30, bg= '#000000', fg = '#ff0000')
self.score_label.grid(row=0, column=0, sticky=tk.W + tk.N + tk.S + tk.E,
padx=(10,0), pady=(5,0))
self.btn_start = tk.Button(self, ... | code_fim | hard | {
"lang": "python",
"repo": "jeffque/games-tk-breakout",
"path": "/breakout/game.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print to teminal aways
if newline:
print content
else:
print content,
if writefile:
if path == '':
logfile = os.path.join(os.curdir, 'ynlldb.log')
else:
logfile = path
write_type = 'w'
if os.path.exists(logfile):
... | code_fim | medium | {
"lang": "python",
"repo": "espider/yinuo",
"path": "/util/exportcontent.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: espider/yinuo path: /util/exportcontent.py
#!/usr/bin/python
# coding:utf-8
# for lldb in python
# output to file and teminal
# Copyright (c) 2017, chengliang
# All rights reserved.
<|fim_suffix|> # print to teminal aways
if newline:
print content
else:
print content,... | code_fim | medium | {
"lang": "python",
"repo": "espider/yinuo",
"path": "/util/exportcontent.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Adriantsh/astr-119 path: /helloagain.py
def main():
i = 0 #initializing variable
x = 119.0
for i in range(120): #loops over i between 0 and 120
<|fim_suffix|> print(s) #print final value
if __name__ == "__main__":
main()<|fim_middle|> if((i%2) == 0): #if i is even
x += 3.0 #add three ... | code_fim | medium | {
"lang": "python",
"repo": "Adriantsh/astr-119",
"path": "/helloagain.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(s) #print final value
if __name__ == "__main__":
main()<|fim_prefix|># repo: Adriantsh/astr-119 path: /helloagain.py
def main():
i = 0 #initializing variable
x = 119.0
<|fim_middle|> for i in range(120): #loops over i between 0 and 120
if((i%2) == 0): #if i is even
x += 3.0 #add three ... | code_fim | hard | {
"lang": "python",
"repo": "Adriantsh/astr-119",
"path": "/helloagain.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yutiansut/swainBot path: /src/features/rewards.py
import numpy as np
from .draftstate import DraftState as ds
def get_reward(state, match, submitted_action, actual_action):
"""
Args:
state (DraftState): Present state of the draft to be checked for reward
match (dict): rec... | code_fim | hard | {
"lang": "python",
"repo": "yutiansut/swainBot",
"path": "/src/features/rewards.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
Args:
match (dict): match dictionary with pick and ban data for a single game.
Returns:
val (int): Integer representing which team won the match.
val = DraftState.RED_TEAM if the red team won
val = DraftState.BLUE_TEAM if blue team won
val = No... | code_fim | hard | {
"lang": "python",
"repo": "yutiansut/swainBot",
"path": "/src/features/rewards.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> get_winning_team returns the winning team of the input match encoded as an integer according to DraftState.
"""
if match["winner"]==0:
return ds.BLUE_TEAM
elif match["winner"]==1:
return ds.RED_TEAM
return None<|fim_prefix|># repo: yutiansut/swainBot path: /src/feature... | code_fim | hard | {
"lang": "python",
"repo": "yutiansut/swainBot",
"path": "/src/features/rewards.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bkayranci/ilkbyte-cli path: /ilkbyte_cli/callback.py
import typer
state = {'raw': False}
<|fim_suffix|>
def verbose(verbose: int = typer.Option(0, "--verbose", "-v", count=True)):
typer.echo(f"Verbose level is {verbose}")<|fim_middle|>
def raw(ctx: typer.Context, raw: bool = False):
"""... | code_fim | medium | {
"lang": "python",
"repo": "bkayranci/ilkbyte-cli",
"path": "/ilkbyte_cli/callback.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def verbose(verbose: int = typer.Option(0, "--verbose", "-v", count=True)):
typer.echo(f"Verbose level is {verbose}")<|fim_prefix|># repo: bkayranci/ilkbyte-cli path: /ilkbyte_cli/callback.py
import typer
state = {'raw': False}
<|fim_middle|>def raw(ctx: typer.Context, raw: bool = False):
"""
... | code_fim | medium | {
"lang": "python",
"repo": "bkayranci/ilkbyte-cli",
"path": "/ilkbyte_cli/callback.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Migration(migrations.Migration):
dependencies = [
('bpp', '0099_nagrody'),
]
operations = [
migrations.RunPython(
dodaj_nagrody,
migrations.RunPython.noop),
]<|fim_prefix|># repo: iplweb/bpp path: /src/bpp/migrations/0100_init_nagrody.py
# -... | code_fim | hard | {
"lang": "python",
"repo": "iplweb/bpp",
"path": "/src/bpp/migrations/0100_init_nagrody.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iplweb/bpp path: /src/bpp/migrations/0100_init_nagrody.py
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-20 01:21
from __future__ import unicode_literals
from django.db import migrations
def dodaj_nagrody(apps, schema_editor):
for skrot, nazwa in [
("AW01", "Prezes ... | code_fim | medium | {
"lang": "python",
"repo": "iplweb/bpp",
"path": "/src/bpp/migrations/0100_init_nagrody.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def dodaj_nagrody(apps, schema_editor):
for skrot, nazwa in [
("AW01", "Prezes Rady Ministrów"),
("AW02", "minister kierujący działami administracji rządowej"),
("AW03", "wydział PAN"),
("AW04", "komitet naukowy PAN"),
("AW05", "Fundacja na rzecz Nauki Polskiej"... | code_fim | medium | {
"lang": "python",
"repo": "iplweb/bpp",
"path": "/src/bpp/migrations/0100_init_nagrody.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pyhys/SecureGateway path: /examples/minimal/minimaltaxiapp_with_signalhandler.py
# Register a SIGTERM signal handler in order for 'coverage' tool
# to function properly
import signal
import sys
<|fim_suffix|># Run the example
import minimaltaxiapp<|fim_middle|>
def signal_handler(signum, frame)... | code_fim | medium | {
"lang": "python",
"repo": "pyhys/SecureGateway",
"path": "/examples/minimal/minimaltaxiapp_with_signalhandler.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> print('Handled Linux signal number:', signum)
sys.exit()
signal.signal(signal.SIGTERM, signal_handler)
# Run the example
import minimaltaxiapp<|fim_prefix|># repo: pyhys/SecureGateway path: /examples/minimal/minimaltaxiapp_with_signalhandler.py
# Register a SIGTERM signal handler in order for '... | code_fim | easy | {
"lang": "python",
"repo": "pyhys/SecureGateway",
"path": "/examples/minimal/minimaltaxiapp_with_signalhandler.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bmweiner/skillful path: /skillful/tests/test_controller.py
"""skillful controller module tests"""
# pylint: disable=protected-access
# pylint: disable=too-few-public-methods
# pylint: disable=unused-argument
# pylint: disable=unused-variable
import unittest
from skillful import controller
from s... | code_fim | hard | {
"lang": "python",
"repo": "bmweiner/skillful",
"path": "/skillful/tests/test_controller.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_dispatch_intent(self):
"""Test dispath method for intent."""
@self.skill.intent('test_intent')
def sample_func():
"""Decorated function."""
self.skill.response.sessionAttributes['run'] = True
self.skill.request.request.type = 'IntentRequ... | code_fim | hard | {
"lang": "python",
"repo": "bmweiner/skillful",
"path": "/skillful/tests/test_controller.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def download_flight_data():
"""
Download flights from Spring Airline and save to
{project-root-dir/data/source/dynamic/flights-date_time_string.html} file
:return: file saving path
"""
response = requests.get(FlightAndRoutConst.URL_FLIGHTS_OF_SPRING_AIRLINE,
... | code_fim | medium | {
"lang": "python",
"repo": "LangInteger/code-snippet",
"path": "/spring-statistic/spring_statistic/data_crawler/SpringFlightsCrawler.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LangInteger/code-snippet path: /spring-statistic/spring_statistic/data_crawler/SpringFlightsCrawler.py
import requests
from spring_statistic.utils import DateUtils, IOUtils
from spring_statistic.utils.const import FlightAndRoutConst
<|fim_suffix|> date_time = DateUtils.current_date_time_for... | code_fim | medium | {
"lang": "python",
"repo": "LangInteger/code-snippet",
"path": "/spring-statistic/spring_statistic/data_crawler/SpringFlightsCrawler.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Russ76/navrep path: /external/frame_msgs/msg/_DetectedPerson.py
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from frame_msgs/DetectedPerson.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
impor... | code_fim | hard | {
"lang": "python",
"repo": "Russ76/navrep",
"path": "/external/frame_msgs/msg/_DetectedPerson.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def serialize(self, buff):
"""
serialize message into buffer
:param buff: buffer, ``StringIO``
"""
try:
_x = self
buff.write(_get_struct_Q8d().pack(_x.detection_id, _x.confidence, _x.pose.pose.position.x, _x.pose.pose.position.y, _x.pose.pose.position.z, _x.pose.pose.orie... | code_fim | hard | {
"lang": "python",
"repo": "Russ76/navrep",
"path": "/external/frame_msgs/msg/_DetectedPerson.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def serialize_numpy(self, buff, numpy):
"""
serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module
"""
try:
_x = self
buff.write(_get_struct_Q8d().pack(_x.detection_id, _x.confidence, _x.pose.pose.posit... | code_fim | hard | {
"lang": "python",
"repo": "Russ76/navrep",
"path": "/external/frame_msgs/msg/_DetectedPerson.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LearnCube/LearnCube-python path: /learncube/virtual_classroom/logs.py
from ..core import LearnCubeBase
class Logs(LearnCubeBase):
def __init__(self, public_key, private_key, api_base_path=None):
<|fim_suffix|> def list_logs(self, **kwargs):
response = self.get('logs/', params=kw... | code_fim | hard | {
"lang": "python",
"repo": "LearnCube/LearnCube-python",
"path": "/learncube/virtual_classroom/logs.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def read_logs(self, uuid):
response = self.get('logs/{}/'.format(uuid))
if response.status_code != 200:
raise Exception("Error during read", response.status_code, response.json())
else:
return response.json()
def list_logs(self, **kwargs):
r... | code_fim | medium | {
"lang": "python",
"repo": "LearnCube/LearnCube-python",
"path": "/learncube/virtual_classroom/logs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = self.get('logs/', params=kwargs)
if response.status_code != 200:
raise Exception("Error during list", response.status_code, response.json())
else:
return response.json()<|fim_prefix|># repo: LearnCube/LearnCube-python path: /learncube/virtual_cla... | code_fim | hard | {
"lang": "python",
"repo": "LearnCube/LearnCube-python",
"path": "/learncube/virtual_classroom/logs.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class LearningPolicy(Policy):
def __init__(self):
super(LearningPolicy).__init__()
class HybridPolicy(Policy):
def __init__(self):
super(HybridPolicy).__init__()<|fim_prefix|># repo: flatland-sutd-2021/flatland-proj path: /neurips2020-flatland-starter-kit/reinforcement_learning/... | code_fim | hard | {
"lang": "python",
"repo": "flatland-sutd-2021/flatland-proj",
"path": "/neurips2020-flatland-starter-kit/reinforcement_learning/policy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flatland-sutd-2021/flatland-proj path: /neurips2020-flatland-starter-kit/reinforcement_learning/policy.py
from flatland.envs.rail_env import RailEnv
class DummyMemory:
def __init__(self):
self.memory = []
def __len__(self):
return 0
<|fim_suffix|> def end_episode(se... | code_fim | hard | {
"lang": "python",
"repo": "flatland-sutd-2021/flatland-proj",
"path": "/neurips2020-flatland-starter-kit/reinforcement_learning/policy.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> super(LearningPolicy).__init__()
class HybridPolicy(Policy):
def __init__(self):
super(HybridPolicy).__init__()<|fim_prefix|># repo: flatland-sutd-2021/flatland-proj path: /neurips2020-flatland-starter-kit/reinforcement_learning/policy.py
from flatland.envs.rail_env import RailEnv
... | code_fim | hard | {
"lang": "python",
"repo": "flatland-sutd-2021/flatland-proj",
"path": "/neurips2020-flatland-starter-kit/reinforcement_learning/policy.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elunna/eular_python path: /test_problem11.py
import problem11
# Tests for read_matrix(filename):
# Reading just 0 in a file, returns 1x1 matrix with 0
def test_readmatrix_1x1file_1x1matrix():
expected = [[0]]
assert problem11.read_matrix('data/test_matrix1.txt') == expected
def test_... | code_fim | hard | {
"lang": "python",
"repo": "elunna/eular_python",
"path": "/test_problem11.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> expected = [[7], [4, 8], [1, 5, 9], [2, 6], [3]]
m = problem11.read_matrix('data/test_matrix4.txt')
assert problem11.get_right_diagonals(m) == expected
def test_get_left_diagonals_3x3_returns5lists():
expected = [[1], [2, 4], [3, 5, 7], [6, 8], [9]]
m = problem11.read_matrix('data/te... | code_fim | hard | {
"lang": "python",
"repo": "elunna/eular_python",
"path": "/test_problem11.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> expected = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
m = problem11.read_matrix('data/test_matrix4.txt')
assert problem11.get_rows(m) == expected
def test_getcolumns_3x3_returns3lists():
expected = [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
m = problem11.read_matrix('data/test_matrix4.txt')
assert... | code_fim | hard | {
"lang": "python",
"repo": "elunna/eular_python",
"path": "/test_problem11.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> raise NotImplementedError("Todo")<|fim_prefix|># repo: ellipsys/urh path: /src/urh/awre/components/SequenceNumber.py
from urh.awre.components.Component import Component
class SequenceNumber(Component):
<|fim_middle|> def __init__(self, priority=2, predecessors=None, enabled=True, backend=None... | code_fim | medium | {
"lang": "python",
"repo": "ellipsys/urh",
"path": "/src/urh/awre/components/SequenceNumber.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ellipsys/urh path: /src/urh/awre/components/SequenceNumber.py
from urh.awre.components.Component import Component
class SequenceNumber(Component):
def __init__(self, priority=2, predecessors=None, enabled=True, backend=None):
<|fim_suffix|> raise NotImplementedError("Todo")<|fim_middl... | code_fim | medium | {
"lang": "python",
"repo": "ellipsys/urh",
"path": "/src/urh/awre/components/SequenceNumber.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NaluCFD/Nalu path: /reg_tests/test_files/BoussinesqNonIso/norms.py
import os
import math
import os.path
import subprocess
def exit_if_file_does_not_exist(fname):
if not os.path.exists(fname):
print ('No file: ' + fname)
exit(1)
def num_lines_output(fname):
exit_if_file... | code_fim | hard | {
"lang": "python",
"repo": "NaluCFD/Nalu",
"path": "/reg_tests/test_files/BoussinesqNonIso/norms.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> for line in lines:
tokens = line.split()
l2norm[tokens[0]] = float(tokens[6])
return numNodes, l2norm
def compute_and_check_ooas(basep_name, numResolutions, dim, min_ooas):
first_name = basep_name + "_R0.dat"
linesToRead = num_lines_output(first_name)
nodes0, norm0 =... | code_fim | hard | {
"lang": "python",
"repo": "NaluCFD/Nalu",
"path": "/reg_tests/test_files/BoussinesqNonIso/norms.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>ttr(multMatrix + ".matrixSum", decomposeMatrix + ".inputMatrix")
cmds.connectAttr(decomposeMatrix + ".outputTranslate", drivenName + ".translate", force = True)
cmds.connectAttr(decomposeMatrix + ".outputRotate", drivenName + ".rotate", force = True)
quickConnect(cmds.ls(selection = True)[0], cmds.l... | code_fim | hard | {
"lang": "python",
"repo": "PandaKunQiao/pandaScript",
"path": "/shelfScripts/winSing_proj/quickParentMatrix.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PandaKunQiao/pandaScript path: /shelfScripts/winSing_proj/quickParentMatrix.py
import maya.cmds as cmds
def quickConnect(driverName, drivenName):
tempNode = cmds.createNode("multMatrix")
cmds.connectAttr(drivenName + ".worldMatrix[0]", tempNode + ".matrixIn[0]")
cmds.connectAttr(driverName + "... | code_fim | hard | {
"lang": "python",
"repo": "PandaKunQiao/pandaScript",
"path": "/shelfScripts/winSing_proj/quickParentMatrix.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mohanrex/music_led_strip_control path: /server/main.py
# Main File
# ----------------
#
# The Programm will start here.
# This file will only initialize and start the processes.
#
from libs.output import Output
from libs.config_service import ConfigService
from libs.effects import Effec... | code_fim | hard | {
"lang": "python",
"repo": "mohanrex/music_led_strip_control",
"path": "/server/main.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #Start Webserver
self._webserver = Webserver()
self._webserver_process = Process(
target=self._webserver.start,
args=(
self._config_lock,
self._notification_queue_webserver_in,
self._notification_queue_webse... | code_fim | hard | {
"lang": "python",
"repo": "mohanrex/music_led_strip_control",
"path": "/server/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._notification_queue_webserver_in = Queue(2)
self._notification_queue_webserver_out = Queue(2)
self._notification_queue_server_in = Queue(2)
self._notification_queue_server_out = Queue(2)
# Only activate the output if I'm inside the output mode.
if(not... | code_fim | hard | {
"lang": "python",
"repo": "mohanrex/music_led_strip_control",
"path": "/server/main.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: faical-yannick-congo/ddsm-cloud path: /run.py
"""Usage: run.py [--port=<port>] [--api | --view] [--debug | --no-debug]
<|fim_suffix|>if arguments['--api']:
from smt_api import app
if not port: port = 5500
else:
from smt_view import app
if not port: port = 5000
app.run(debug=debu... | code_fim | hard | {
"lang": "python",
"repo": "faical-yannick-congo/ddsm-cloud",
"path": "/run.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>port = arguments['--port']
debug = not arguments['--no-debug']
if arguments['--api']:
from smt_api import app
if not port: port = 5500
else:
from smt_view import app
if not port: port = 5000
app.run(debug=debug, port=int(port))<|fim_prefix|># repo: faical-yannick-congo/ddsm-cloud path: ... | code_fim | medium | {
"lang": "python",
"repo": "faical-yannick-congo/ddsm-cloud",
"path": "/run.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# print "Stalled?", a.is_stalled(), b.is_stalled()
# a.set_speed(800)
# b.set_speed(800)
#
# print "testing forward a"
# a.forward()
#
# print "testing forward b"
# b.forward()
#
# time.sleep(5)
# print "stopping both"
# b.stop()
# a.stop()
# time.sleep(5)
# print a.get_position(), b.get_position()
# mo... | code_fim | hard | {
"lang": "python",
"repo": "alexander-svendsen/ev3-python",
"path": "/examples/motor_tests.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexander-svendsen/ev3-python path: /examples/motor_tests.py
import ev3
from ev3 import Motor, MOTOR_PORTS
import time
import sys
brick = ev3.connect_to_brick(address='10.0.1.1')
#brick = ev3.find_brick_by_name('ev3', by_ip=False)
a = Motor(brick, 'A')
b = Motor(brick, 'B')
time.sleep(4)
# sy... | code_fim | hard | {
"lang": "python",
"repo": "alexander-svendsen/ev3-python",
"path": "/examples/motor_tests.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def handle_unknown():
context = {'client_name': 'mycroft_listener',
'source': 'audio',
'destination': ["skills"]}
bus.emit(Message('mycroft.speech.recognition.unknown', context=context))
def handle_speak(event):
"""
Forward speak message to message bus.
... | code_fim | hard | {
"lang": "python",
"repo": "NeonAndrii/neon_speech",
"path": "/neon_speech/__main__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NeonAndrii/neon_speech path: /neon_speech/__main__.py
AMAGE.
import os.path
import time
from mycroft_bus_client import MessageBusClient
from typing import Optional
from threading import Lock
from ovos_utils import create_daemon, wait_for_exit_signal
from ovos_utils.messagebus import Message, ge... | code_fim | hard | {
"lang": "python",
"repo": "NeonAndrii/neon_speech",
"path": "/neon_speech/__main__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if message.data.get("need_transcription"):
# transcriptions = loop.consumer.transcribe(audio) # flac_data for Google Beta STT
LOG.debug(f"return stt to server: {transcriptions}")
bus.emit(Message("css.emit", {"event": "stt from mycroft",
... | code_fim | hard | {
"lang": "python",
"repo": "NeonAndrii/neon_speech",
"path": "/neon_speech/__main__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|># raised when argument type is not valid for operation
class TRexTypeError(TRexError):
def __init__ (self, arg_name, arg_type, valid_types):
msg = "Argument: '%s' invalid type: '%s', expecting type(s): %s." % (arg_name, arg_type.__name__,
[t.__name__ for t in valid_types] if isinst... | code_fim | hard | {
"lang": "python",
"repo": "elados93/trex-core",
"path": "/scripts/automation/trex_control_plane/interactive/trex/common/trex_exceptions.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elados93/trex-core path: /scripts/automation/trex_control_plane/interactive/trex/common/trex_exceptions.py
import os
import sys
import inspect
from ..utils.text_opts import format_text
# add here any object that needs to be available in the API
__all__ = ["TRexError", "TRexArgumentError", "TRex... | code_fim | hard | {
"lang": "python",
"repo": "elados93/trex-core",
"path": "/scripts/automation/trex_control_plane/interactive/trex/common/trex_exceptions.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bruno-zaccariello/sgeheroku path: /core/my_views/producao.py
"""
Módulo que contem as views de produção
"""
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator
f... | code_fim | hard | {
"lang": "python",
"repo": "bruno-zaccariello/sgeheroku",
"path": "/core/my_views/producao.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@login_required(login_url="/admin")
def editar_fabricacao(request, id_fabricacao):
""" Pagina para editar um pedido de fabricação """
success = request.GET.get('success', False)
try:
fabricacao = Pedidofabricacao.objects.get(
pkid_pedidofabricacao=id_fabricacao)
except... | code_fim | hard | {
"lang": "python",
"repo": "bruno-zaccariello/sgeheroku",
"path": "/core/my_views/producao.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bglezseoane/osxmetadata path: /tests/test_finderinfo.py
#!/usr/bin/env python
from tempfile import NamedTemporaryFile
import pytest
import platform
@pytest.fixture
def temp_file():
# TESTDIR for temporary files usually defaults to "/tmp",
# which may not have XATTR support (e.g. tmpf... | code_fim | hard | {
"lang": "python",
"repo": "bglezseoane/osxmetadata",
"path": "/tests/test_finderinfo.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
from osxmetadata import OSXMetaData, Tag
from osxmetadata.constants import _MAX_FINDER_COLOR
from osxmetadata.findertags import (
get_finderinfo_color,
set_finderinfo_color,
get_tag_color_name,
)
meta = OSXMetaData(temp_file)
# check each color combo. Se... | code_fim | medium | {
"lang": "python",
"repo": "bglezseoane/osxmetadata",
"path": "/tests/test_finderinfo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_invalid_colorid(temp_file):
from osxmetadata.constants import _MAX_FINDER_COLOR, _MIN_FINDER_COLOR
from osxmetadata.findertags import set_finderinfo_color
with pytest.raises(ValueError):
set_finderinfo_color(temp_file, _MAX_FINDER_COLOR + 1)
with pytest.raises(ValueErro... | code_fim | hard | {
"lang": "python",
"repo": "bglezseoane/osxmetadata",
"path": "/tests/test_finderinfo.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self._dirty_mask = 0
self.priority = priority
self.auth_profile_name = None
self.child_action = None
self.ip_address = None
self.name = None
self.oper_auth_profile_name = None
self.port = None
self.prop_acl = None
self.sacl = ... | code_fim | hard | {
"lang": "python",
"repo": "CiscoUcs/ucsmsdk",
"path": "/ucsmsdk/mometa/vnic/VnicIScsiStaticTargetIf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> prop_meta = {
"auth_profile_name": MoPropertyMeta("auth_profile_name", "authProfileName", "string", VersionMeta.Version201m, MoPropertyMeta.READ_WRITE, 0x2, None, None, None, [], []),
"child_action": MoPropertyMeta("child_action", "childAction", "string", VersionMeta.Version201m, MoPro... | code_fim | hard | {
"lang": "python",
"repo": "CiscoUcs/ucsmsdk",
"path": "/ucsmsdk/mometa/vnic/VnicIScsiStaticTargetIf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CiscoUcs/ucsmsdk path: /ucsmsdk/mometa/vnic/VnicIScsiStaticTargetIf.py
"""This module contains the general information for VnicIScsiStaticTargetIf ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class Vni... | code_fim | medium | {
"lang": "python",
"repo": "CiscoUcs/ucsmsdk",
"path": "/ucsmsdk/mometa/vnic/VnicIScsiStaticTargetIf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
计算静阵风荷载
《公路桥梁抗风设计规范》4.3.1节
Args:
B: 主梁断面全宽(m)
H: 主梁投影高度(m)
ρ:空气密度,1.25 kg/m3
GV:静阵风系数,查表4.2.1
Z:基准高度
地表类别:A,B,C,D
Returns:
FH: 作用在主梁单位长度上的静阵风荷载(N/m)
>>> fh=wind.FH(4.8,1... | code_fim | hard | {
"lang": "python",
"repo": "warmwaver/calla",
"path": "/calla/legacy/JTG_T D60-01-2004/wind.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: warmwaver/calla path: /calla/legacy/JTG_T D60-01-2004/wind.py
"""JTG D60-2015 公路桥涵设计通用规范"""
__all__ = [
'wind',
]
from calla import abacus
from collections import OrderedDict
from math import pi, sqrt, sin, cos, tan
class wind(abacus):
'''风荷载计算
《公路桥梁抗风设计规范》(JTG/T D60-01-2004)
... | code_fim | hard | {
"lang": "python",
"repo": "warmwaver/calla",
"path": "/calla/legacy/JTG_T D60-01-2004/wind.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = RNNModel(
x.shape[-1],
1,
return_sequences=False
)
model.train(
train_data["x"],
train_data["y"][:, 0],
epochs=15
)
pred_y = model.predict(
test_data["x"]
)
prediction_result = PredictionEvaluator().evaluate(
test_data["... | code_fim | hard | {
"lang": "python",
"repo": "linewalks/mimic-oodd",
"path": "/run_rnn_survival.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> prediction_result = PredictionEvaluator().evaluate(
test_data["y"][:, 0],
pred_y
)
print("Prediction Result", prediction_result)
train_ood = model.predict_ood(train_data["x"])
test_ood = model.predict_ood(test_data["x"])
oodd_result = OODDEvaluator().evaluate(
t... | code_fim | hard | {
"lang": "python",
"repo": "linewalks/mimic-oodd",
"path": "/run_rnn_survival.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: linewalks/mimic-oodd path: /run_rnn_survival.py
import numpy as np
from oodd.evaluation.prediction import PredictionEvaluator
from oodd.evaluation.oodd import OODDEvaluator
from oodd.model.rnn import RNNModel
from oodd.utils.args import get_common_args, parse_common_args
from oodd.utils.config i... | code_fim | hard | {
"lang": "python",
"repo": "linewalks/mimic-oodd",
"path": "/run_rnn_survival.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>element not in result:
result.append(element)
print(result)<|fim_prefix|># repo: dlgiang/python-practice path: /05-list-overlap/list-overlap.py
import random
a = random.sample(range(1,100), random.randint(10, 30<|fim_middle|>))
b = random.sample(range(1,100), random.randint(10, 30))
print(a)... | code_fim | medium | {
"lang": "python",
"repo": "dlgiang/python-practice",
"path": "/05-list-overlap/list-overlap.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dlgiang/python-practice path: /05-list-overlap/list-overlap.py
import random
a = random.sample(range(1,100), random.randint(10, 30<|fim_suffix|>
print(b)
result = []
for element in a:
if element in b and element not in result:
result.append(element)
print(result)<|fim_middle|>)... | code_fim | medium | {
"lang": "python",
"repo": "dlgiang/python-practice",
"path": "/05-list-overlap/list-overlap.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: david-kn/nautobot-plugin-capacity-metrics path: /nautobot_capacity_metrics/api/views.py
"""Django views for Prometheus metric collection and reporting."""
import time
import logging
from django.conf import settings
from django.http import HttpResponse
import prometheus_client
from prometheus_cl... | code_fim | hard | {
"lang": "python",
"repo": "david-kn/nautobot-plugin-capacity-metrics",
"path": "/nautobot_capacity_metrics/api/views.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Collect metrics for all plugins and extras."""
start = time.time()
for metric in metric_rq():
yield metric
gauge = GaugeMetricFamily(
"nautobot_rq_metrics_processing_ms", "Time in ms to generate the app metrics endpoint"
)
duratio... | code_fim | hard | {
"lang": "python",
"repo": "david-kn/nautobot-plugin-capacity-metrics",
"path": "/nautobot_capacity_metrics/api/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Collect metrics for all plugins and extras."""
start = time.time()
if "jobs" in PLUGIN_SETTINGS and PLUGIN_SETTINGS["jobs"]:
for metric in metric_jobs():
yield metric
if "models" in PLUGIN_SETTINGS:
for metric in metric_models(PL... | code_fim | hard | {
"lang": "python",
"repo": "david-kn/nautobot-plugin-capacity-metrics",
"path": "/nautobot_capacity_metrics/api/views.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: marchingphoenix/py-graph-ql-client path: /tests/development_test.py
from py_graph_ql_client.Query import Fragment, Query, Resource
<|fim_suffix|>asset = Resource("asset", sub_resource=True)
asset.add_simple_properties(["id", "name"])
fragment = Fragment("asset", asset)
devices = Resource(
"d... | code_fim | medium | {
"lang": "python",
"repo": "marchingphoenix/py-graph-ql-client",
"path": "/tests/development_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>asset = Resource("asset", sub_resource=True)
asset.add_simple_properties(["id", "name"])
fragment = Fragment("asset", asset)
devices = Resource(
"devices",
{"first": "$first", "search": "$search", "after": '""', "order": "$order"},
page_info=True,
cursor=True,
name_override="device",
)... | code_fim | medium | {
"lang": "python",
"repo": "marchingphoenix/py-graph-ql-client",
"path": "/tests/development_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @Autowired
private UserService service;
@RequestMapping(value = "/add", method = RequestMethod.POST)
public boolean addUser(@RequestBody User user) {
boolean flag = service.addUser(user);
return flag;
}
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
public User getUser(@Path... | code_fim | medium | {
"lang": "python",
"repo": "CSeven19/SpringCloudModels",
"path": "/microservice-parent/microservice-provider/src/main/java/com/lsw/springcloud/controller/UserController.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|> boolean flag = service.addUser(user);
return flag;
}
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
public User getUser(@PathVariable("id") int id) {
User user = service.getUser(id);
return user;
}
@RequestMapping(value = "/getUser/list", method = RequestMethod.GET)
publi... | code_fim | medium | {
"lang": "python",
"repo": "CSeven19/SpringCloudModels",
"path": "/microservice-parent/microservice-provider/src/main/java/com/lsw/springcloud/controller/UserController.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: CSeven19/SpringCloudModels path: /microservice-parent/microservice-provider/src/main/java/com/lsw/springcloud/controller/UserController.py
package com.lsw.springcloud.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.... | code_fim | hard | {
"lang": "python",
"repo": "CSeven19/SpringCloudModels",
"path": "/microservice-parent/microservice-provider/src/main/java/com/lsw/springcloud/controller/UserController.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_suffix|>
OK_RESPONSE = MegatronResponse({"ok": True}, 200)<|fim_prefix|># repo: team-labs/megatron path: /app/megatron/responses.py
import json
from django.http import HttpResponse
<|fim_middle|>
class MegatronResponse(HttpResponse):
def __init__(self, json_data, status, *args, **kwargs):
super()._... | code_fim | hard | {
"lang": "python",
"repo": "team-labs/megatron",
"path": "/app/megatron/responses.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: team-labs/megatron path: /app/megatron/responses.py
import json
from django.http import HttpResponse
class MegatronResponse(HttpResponse):
<|fim_suffix|>
OK_RESPONSE = MegatronResponse({"ok": True}, 200)<|fim_middle|> def __init__(self, json_data, status, *args, **kwargs):
super()._... | code_fim | hard | {
"lang": "python",
"repo": "team-labs/megatron",
"path": "/app/megatron/responses.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pluscord/nextcord path: /nextcord/ext/menus/utils.py
from typing import Pattern
from .constants import EmojiType
import re
import nextcord
class Position:
__slots__ = ('number', 'bucket')
def __init__(self, number: int, *, bucket: int = 1):
self.bucket = bucket
self.nu... | code_fim | hard | {
"lang": "python",
"repo": "Pluscord/nextcord",
"path": "/nextcord/ext/menus/utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if isinstance(obj, nextcord.PartialEmoji):
return obj
obj = str(obj)
match = _custom_emoji.match(obj)
if match is not None:
groups = match.groupdict()
animated = bool(groups['animated'])
emoji_id = int(groups['id'])
name = groups['name']
ret... | code_fim | hard | {
"lang": "python",
"repo": "Pluscord/nextcord",
"path": "/nextcord/ext/menus/utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>ATCH_SIZE = 128
EPOCHS = 10
GLOVE_PATH = "/Users/praveenkumar/Own_works/resources/nlp/glove"<|fim_prefix|># repo: pk0912/ToxicCommentsClassification path: /config.py
"""
Contains configurations which will get executed
"""
SIMPLE_PROCESSING_TYPE = False
COMPLEX_PROCESSING_TYPE = False
VECTORIZE_DATA_SIMP... | code_fim | medium | {
"lang": "python",
"repo": "pk0912/ToxicCommentsClassification",
"path": "/config.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pk0912/ToxicCommentsClassification path: /config.py
"""
Contains configurations which will get executed
"""
SIMPLE_PROCESSING_TYPE = False
COMPLEX_PROCESSING_TYPE = False
VECTORIZE_DATA_SIMPLE = False
VECTORIZE_DATA_COMPLEX = True
MA<|fim_suffix|>ATCH_SIZE = 128
EPOCHS = 10
GLOVE_PATH = "/Users/... | code_fim | medium | {
"lang": "python",
"repo": "pk0912/ToxicCommentsClassification",
"path": "/config.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: OneGov/onegov-cloud path: /src/onegov/translator_directory/__init__.py
import logging
log = logging.getLogger('onegov.translator_directory')
log.addHandler(logging.NullHandler())
<|fim_suffix|>
__all__ = ('TranslatorDirectoryApp', 'log', '_')<|fim_middle|>from onegov.translator_directory.i18n im... | code_fim | medium | {
"lang": "python",
"repo": "OneGov/onegov-cloud",
"path": "/src/onegov/translator_directory/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
__all__ = ('TranslatorDirectoryApp', 'log', '_')<|fim_prefix|># repo: OneGov/onegov-cloud path: /src/onegov/translator_directory/__init__.py
import logging
log = logging.getLogger('onegov.translator_directory')
log.addHandler(logging.NullHandler())
<|fim_middle|>from onegov.translator_directory.i18n im... | code_fim | medium | {
"lang": "python",
"repo": "OneGov/onegov-cloud",
"path": "/src/onegov/translator_directory/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xrick/III_Teaching_201907 path: /audio/audiotest.py
import pyaudio
import speech_recognition as sr
from speech_recognition import Recognizer
from speech_recognition import Microphone
AUDIONAME='harvard.wav'
NOISEAUDIONAME='jackhammer.wav'
ZHAUDIONAME='mandarin01.flac'
"""
r.energy_thres... | code_fim | hard | {
"lang": "python",
"repo": "xrick/III_Teaching_201907",
"path": "/audio/audiotest.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mic = sr.Microphone()
#print(Microphone.list_microphone_names())
with mic as audio_source:
r = sr.Recognizer()
print("Start to listen pls say something:")
audio = r.listen(audio_source)
result = r.recognize_google(audio,language='zh-TW')
if not is... | code_fim | hard | {
"lang": "python",
"repo": "xrick/III_Teaching_201907",
"path": "/audio/audiotest.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cydenix/OpenGLCffi path: /OpenGLCffi/GL/EXT/ARB/shading_language_include.py
from OpenGLCffi.GL import params
@params(api='gl', prms=['type', 'namelen', 'name', 'stringlen', 'string'])
def glNamedStringARB(type, namelen, name, stringlen, string):
pass
<|fim_suffix|> pass
@params(api='gl', prm... | code_fim | hard | {
"lang": "python",
"repo": "cydenix/OpenGLCffi",
"path": "/OpenGLCffi/GL/EXT/ARB/shading_language_include.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
@params(api='gl', prms=['namelen', 'name', 'bufSize', 'stringlen', 'string'])
def glGetNamedStringARB(namelen, name, bufSize, stringlen, string):
pass
@params(api='gl', prms=['namelen', 'name', 'pname', 'params'])
def glGetNamedStringivARB(namelen, name, pname, params):
pass<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "cydenix/OpenGLCffi",
"path": "/OpenGLCffi/GL/EXT/ARB/shading_language_include.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@params(api='gl', prms=['namelen', 'name', 'pname', 'params'])
def glGetNamedStringivARB(namelen, name, pname, params):
pass<|fim_prefix|># repo: cydenix/OpenGLCffi path: /OpenGLCffi/GL/EXT/ARB/shading_language_include.py
from OpenGLCffi.GL import params
@params(api='gl', prms=['type', 'namelen', 'name'... | code_fim | medium | {
"lang": "python",
"repo": "cydenix/OpenGLCffi",
"path": "/OpenGLCffi/GL/EXT/ARB/shading_language_include.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: slamer59/batch8_mednum path: /dockerize-apps/panel/mednum/indicators/panels.py
import re
from pathlib import Path
import panel as pn
import param
import pygal
from pygal.style import Style
from mednum.controlers.overallparameters import OverallParameters
from mednum.tools import css2dict
from m... | code_fim | hard | {
"lang": "python",
"repo": "slamer59/batch8_mednum",
"path": "/dockerize-apps/panel/mednum/indicators/panels.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @pn.depends("score", watch=True)
def glob_stats(self):
label = "Score Global"
score_min, score_max = self.score
HTML = """
<b>{score_name}</b> | {score_min}->{score_max}<br>
<b>{pop_name}</b> | {population}
""".format(
score_name=label,
... | code_fim | hard | {
"lang": "python",
"repo": "slamer59/batch8_mednum",
"path": "/dockerize-apps/panel/mednum/indicators/panels.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DamienFruleux/P13pt path: /P13pt/rfspectrum.py
# -*- coding: utf-8 -*-
"""
Interface for the scikit-rf Network class for use in P13. Refer to the
`scikit-rf documentation <http://scikit-rf.readthedocs.io/en/latest/api/network.html>`_
for more detail.
* Adding P13 spectrum file format support to ... | code_fim | hard | {
"lang": "python",
"repo": "DamienFruleux/P13pt",
"path": "/P13pt/rfspectrum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# for compatibility with old name
rfspectrum = Network
def convert_to_touchstone(filename, newfilename):
"""Convert a "P13 standard" file to a touchstone file (.s2p)
Arguments
----------
filename : string
File name of the "P13 standard" file.
newfilename : string
... | code_fim | hard | {
"lang": "python",
"repo": "DamienFruleux/P13pt",
"path": "/P13pt/rfspectrum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># XY イベント レイヤー を削除します。
arcpy.Delete_management(event_layer)<|fim_prefix|># repo: EsriJapan/arcpy-resources path: /演習データ/source/ArcGISPro/exercise3.py
# ArcPy サイト パッケージをインポートします。
import arcpy
# ジオプロセシング ツールで利用する変数を定義
csv_table = r"C:\data\HandsOn.csv"
x_field = "X"
y_field = "Y"
event_layer = "point_lay... | code_fim | hard | {
"lang": "python",
"repo": "EsriJapan/arcpy-resources",
"path": "/演習データ/source/ArcGISPro/exercise3.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: EsriJapan/arcpy-resources path: /演習データ/source/ArcGISPro/exercise3.py
# ArcPy サイト パッケージをインポートします。
import arcpy
# ジオプロセシング ツールで利用する変数を定義
csv_table = r"C:\data\HandsOn.csv"
x_field = "X"
y_field = "Y"
event_layer = "point_layer"
out_path = r"C:\data\ArcGISPro\arcpy.gdb"
<|fim_suffix|># XY イベント レイ... | code_fim | medium | {
"lang": "python",
"repo": "EsriJapan/arcpy-resources",
"path": "/演習データ/source/ArcGISPro/exercise3.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cybernetisk/internsystem path: /voucher/migrations/0010_rename_voucher.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
<|fim_suffix|> migrations.AlterField(
model_name='worklog',
... | code_fim | hard | {
"lang": "python",
"repo": "cybernetisk/internsystem",
"path": "/voucher/migrations/0010_rename_voucher.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> migrations.AlterField(
model_name='worklog',
name='wallet',
field=models.ForeignKey(to='voucher.VoucherWallet', related_name='worklogs', on_delete=models.CASCADE),
),
migrations.AlterField(
model_name='voucheruselog',
name... | code_fim | hard | {
"lang": "python",
"repo": "cybernetisk/internsystem",
"path": "/voucher/migrations/0010_rename_voucher.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.