prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | def LoadFromFile(self, file):
self.fs, self.s = wav.read(file)
self.sLength, self.nChans = self.s.shape
def LoadWF(self, waveform, fs):
self.s = waveform
self.fs = fs
self.sLength, self.nChans = self.s.shape
def __init__(self, *args):
#signal pr... |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | self.fs, self.s = wav.read(file)
self.sLength, self.nChans = self.s.shape |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | self.s = waveform
self.fs = fs
self.sLength, self.nChans = self.s.shape |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | self.singlePrecision = 0
self.s = np.array([])
self.fs = 44100
self.sLength = 0
self.nChans = 0
self.weightingFunction = np.hamming #FIXME
#STFT properties
self.S = np.array([])
self.windowLength = 60
self.nfft = 0
self.nff... |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | if type(args[0]) == type(''): # it's a filename
self.LoadFromFile(args[0])
elif type(args[0] == type(self)): # copy data from other signal
self.__dict__ = copy.deepcopy(args[0].__dict__) |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | self.LoadFromFile(args[0]) |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | self.__dict__ = copy.deepcopy(args[0].__dict__) |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | self.LoadWF(args(0), args(1)) |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | LoadFromFile |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | LoadWF |
<|file_name|>Signal.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python3
################################################################################
#
# Copyright 2014 Stjepan Henc <sthenc@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | __init__ |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | break
await loop.sock_sendall(client, data)
if PRINT:
print('Connection closed') |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
<|fim_middle|>
async def echo_client(loop, client):
try:
client.setsockopt(socket.IPPROTO_T... | if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(address)
sock.listen(5)
sock.setblocking(False)
if PRINT:
print('S... |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | try:
client.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
except (OSError, NameError):
pass
with client:
while True:
data = await loop.sock_recv(client, 1000000)
if not data:
break
await loop.sock_sendall(client, data)
... |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | sock = writer.get_extra_info('socket')
try:
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
except (OSError, NameError):
pass
if PRINT:
print('Connection from', sock.getpeername())
while True:
data = await reader.read(1000000)
if not data:
... |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | def connection_made(self, transport):
self.transport = transport
def connection_lost(self, exc):
self.transport = None
def data_received(self, data):
self.transport.write(data) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | self.transport = transport |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | self.transport = None |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | self.transport.write(data) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | def connection_made(self, transport):
self.transport = transport
# Here the buffer is intended to be copied, so that the outgoing buffer
# won't be wrongly updated by next read
self.buffer = bytearray(256 * 1024)
def connection_lost(self, exc):
self.transport = None
... |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | self.transport = transport
# Here the buffer is intended to be copied, so that the outgoing buffer
# won't be wrongly updated by next read
self.buffer = bytearray(256 * 1024) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | self.transport = None |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | return self.buffer |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | self.transport.write(self.buffer[:nbytes]) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | while True:
print(chr(27) + "[2J") # clear screen
loop.print_debug_info()
await asyncio.sleep(0.5) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
<|fim_middle|>
else:
sock = socket.socket(socket.AF_INET, socket.SOC... | sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
<|fim_... | sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('Server listening at', address) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('Connection from', addr) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | break |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('Connection closed') |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('Connection from', sock.getpeername()) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | break |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('Connection closed') |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | parser = argparse.ArgumentParser()
parser.add_argument('--uvloop', default=False, action='store_true')
parser.add_argument('--streams', default=False, action='store_true')
parser.add_argument('--proto', default=False, action='store_true')
parser.add_argument('--addr', default='127.0.0.1:25000', type... |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | import uvloop
loop = uvloop.new_event_loop()
print('using UVLoop') |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | loop = asyncio.new_event_loop()
print('using asyncio loop') |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | PRINT = 1 |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | loop.create_task(print_debug(loop))
PRINT = 0 |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | unix = True
addr = args.addr[5:]
if os.path.exists(addr):
os.remove(addr) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | os.remove(addr) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | addr = args.addr.split(':')
addr[1] = int(addr[1])
addr = tuple(addr) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('with SSL')
if hasattr(ssl, 'PROTOCOL_TLS'):
server_context = ssl.SSLContext(ssl.PROTOCOL_TLS)
else:
server_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
server_context.load_cert_chain(
(pathlib.Path(__file__).parent.parent.parent /
... |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | server_context = ssl.SSLContext(ssl.PROTOCOL_TLS) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | server_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | server_context.check_hostname = False |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | if args.proto:
print('cannot use --stream and --proto simultaneously')
exit(1)
if args.buffered:
print('cannot use --stream and --buffered simultaneously')
exit(1)
print('using asyncio/streams')
if unix:
coro = asyncio.start_u... |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('cannot use --stream and --proto simultaneously')
exit(1) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('cannot use --stream and --buffered simultaneously')
exit(1) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | coro = asyncio.start_unix_server(echo_client_streams,
addr,
ssl=server_context) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | coro = asyncio.start_server(echo_client_streams,
*addr,
ssl=server_context) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | if args.streams:
print('cannot use --stream and --proto simultaneously')
exit(1)
if args.buffered:
print('using buffered protocol')
protocol = EchoBufferedProtocol
else:
print('using simple protocol')
protocol = EchoProtoco... |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('cannot use --stream and --proto simultaneously')
exit(1) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('using buffered protocol')
protocol = EchoBufferedProtocol |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('using simple protocol')
protocol = EchoProtocol |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | coro = loop.create_unix_server(protocol, addr,
ssl=server_context) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | coro = loop.create_server(protocol, *addr,
ssl=server_context) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | if args.ssl:
print('cannot use SSL for loop.sock_* methods')
exit(1)
print('using sock_recv/sock_sendall')
loop.create_task(echo_server(loop, addr, unix)) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print('cannot use SSL for loop.sock_* methods')
exit(1) |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | gc.collect()
print(chr(27) + "[2J")
loop.print_debug_info() |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def <|fim_middle|>(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = sock... | echo_server |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | echo_client |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | echo_client_streams |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | connection_made |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | connection_lost |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | data_received |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | connection_made |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | connection_lost |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | get_buffer |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | buffer_updated |
<|file_name|>echoserver.py<|end_file_name|><|fim▁begin|>import argparse
import asyncio
import gc
import os.path
import pathlib
import socket
import ssl
PRINT = 0
async def echo_server(loop, address, unix):
if unix:
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
else:
sock = socket.... | print_debug |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>__all__ = []<|fim▁hole|>
import pkgutil
import inspect
# http://stackoverflow.com/questions/22209564/python-qualified-import-all-in-package
for loader, name, is_pkg in pkgutil.walk_packages(__path__):
module = loader.find_module(name).load_module(name)
for... | |
<|file_name|>__init__.py<|end_file_name|><|fim▁begin|>__all__ = []
import pkgutil
import inspect
# http://stackoverflow.com/questions/22209564/python-qualified-import-all-in-package
for loader, name, is_pkg in pkgutil.walk_packages(__path__):
module = loader.find_module(name).load_module(name)
for name, valu... | continue |
<|file_name|>GeodesicActiveContourImageFilterTest.py<|end_file_name|><|fim▁begin|>#==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | filter,
OutputMinimum=0, |
<|file_name|>GeodesicActiveContourImageFilterTest.py<|end_file_name|><|fim▁begin|>#==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | if len(argv) < 10:
errMsg = "Missing parameters\n" \
"Usage: %s\n" % (argv[0],) + \
" inputImage outputImage\n" \
" seedX seedY InitialDistance\n" \
" Sigma SigmoidAlpha SigmoidBeta\n" \
" PropagationScaling\n"
pr... |
<|file_name|>GeodesicActiveContourImageFilterTest.py<|end_file_name|><|fim▁begin|>#==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | caster = itk.RescaleIntensityImageFilter[
InternalImageType,
OutputImageType].New(
filter,
OutputMinimum=0,
OutputMaximum=255)
itk.imwrite(caster, os.path.join(outputDirectory, fileName)) |
<|file_name|>GeodesicActiveContourImageFilterTest.py<|end_file_name|><|fim▁begin|>#==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | errMsg = "Missing parameters\n" \
"Usage: %s\n" % (argv[0],) + \
" inputImage outputImage\n" \
" seedX seedY InitialDistance\n" \
" Sigma SigmoidAlpha SigmoidBeta\n" \
" PropagationScaling\n"
print(errMsg, file=stderr... |
<|file_name|>GeodesicActiveContourImageFilterTest.py<|end_file_name|><|fim▁begin|>#==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | main() |
<|file_name|>GeodesicActiveContourImageFilterTest.py<|end_file_name|><|fim▁begin|>#==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | main |
<|file_name|>GeodesicActiveContourImageFilterTest.py<|end_file_name|><|fim▁begin|>#==========================================================================
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... | rescaleAndWrite |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""myproject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatt... | 3. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) |
<|file_name|>urls.py<|end_file_name|><|fim▁begin|>"""myproject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatt... | import debug_toolbar
urlpatterns += [
url(r'^__debug__/', include(debug_toolbar.urls)),
] |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License. |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | """Return the list of metrics corresponding to pattern.
Exit with error message if None.
Args:
accessor: Accessor, a connected accessor
pattern: string, e.g. my.metric.a or my.metric.**.a
Optional Args:
graphite: bool, use graphite globbing if True.
Returns:
itera... |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | """List for metrics."""
NAME = "list"
HELP = "List metrics."
def add_arguments(self, parser):
"""Add custom arguments.
See command.CommandBase.
"""
parser.add_argument("glob", help="One metric name or globbing on metrics names")
parser.add_argument(
... |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | """Add custom arguments.
See command.CommandBase.
"""
parser.add_argument("glob", help="One metric name or globbing on metrics names")
parser.add_argument(
"--graphite",
default=False,
action="store_true",
help="Enable Graphite glo... |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | """List metrics and directories.
See command.CommandBase.
"""
accessor.connect()
if not opts.graphite:
directories_names = accessor.glob_directory_names(opts.glob)
else:
_, directories_names = graphite_glob(
accessor, opts.glob, m... |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | metrics_names = accessor.glob_metric_names(pattern) |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | metrics, _ = graphite_glob(
accessor, pattern, metrics=True, directories=False
)
metrics_names = [metric.name for metric in metrics] |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | continue |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | directories_names = accessor.glob_directory_names(opts.glob) |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | _, directories_names = graphite_glob(
accessor, opts.glob, metrics=False, directories=True
) |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | print("m %s %s" % (metric.name, metric.metadata.as_string_dict())) |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | list_metrics |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | add_arguments |
<|file_name|>command_list.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright 2016 Criteo
#
# 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://www.apache.org/licenses/... | run |
<|file_name|>math.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
from __future__ import absolute_import
from math import acos, cos, pi, radians, sin, sqrt
import auttitude as at
import numpy as np
def normalized_cross(a, b):
"""
Returns the normalized ... |
return R3.dot(R2).dot(R1) |
<|file_name|>math.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
from __future__ import absolute_import
from math import acos, cos, pi, radians, sin, sqrt
import auttitude as at
import numpy as np
def normalized_cross(a, b):
<|fim_middle|>
def general_p... | """
Returns the normalized cross product between vectors.
Uses numpy.cross().
Parameters:
a: First vector.
b: Second vector.
"""
c = np.cross(a, b)
length = sqrt(c.dot(c))
return c/length if length > 0 else c |
<|file_name|>math.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
from __future__ import absolute_import
from math import acos, cos, pi, radians, sin, sqrt
import auttitude as at
import numpy as np
def normalized_cross(a, b):
"""
Returns the normalized ... | """
Returns a point and direction vector for the line of intersection
of two planes in space, or None if planes are parallel.
Parameters:
n_a: Normal vector to plane A
da: Point of plane A
n_b: Normal vector to plane B
db: Point of plane B
"""
# https:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.