prompt large_stringlengths 72 9.34k | completion large_stringlengths 0 7.61k |
|---|---|
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | elf.index = 0
|
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | eturn
|
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | ""
Run module in test mode.
"""
from py3status.module_test import module_test
module_test(Py3status)
|
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | post_config_hook |
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | set_fortune( |
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | set_motion( |
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | set_wanda( |
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | anda_the_fish( |
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | ill( |
<|file_name|>wanda_the_fish.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Display a fortune-telling, swimming fish.
Wanda has no use what-so-ever. It only takes up disk space and compilation time,
and if loaded, it also takes up precious bar space, memory, and cpu cycles.
Anybody found using it should be... | n_click( |
<|file_name|>test-xy.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import pynotify<|fim▁hole|> if not pynotify.init("XY"):
sys.exit(1)
n = pynotify.Notification("X, Y Test",
"This notification should point to 150, 10")
n.set_hi... | import sys
if __name__ == '__main__': |
<|file_name|>test-xy.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import pynotify
import sys
if __name__ == '__main__':
<|fim_middle|>
<|fim▁end|> | if not pynotify.init("XY"):
sys.exit(1)
n = pynotify.Notification("X, Y Test",
"This notification should point to 150, 10")
n.set_hint("x", 150)
n.set_hint("y", 10)
if not n.show():
print "Failed to send notification"
sys.exit(1) |
<|file_name|>test-xy.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import pynotify
import sys
if __name__ == '__main__':
if not pynotify.init("XY"):
<|fim_middle|>
n = pynotify.Notification("X, Y Test",
"This notificatio... | sys.exit(1) |
<|file_name|>test-xy.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import pynotify
import sys
if __name__ == '__main__':
if not pynotify.init("XY"):
sys.exit(1)
n = pynotify.Notification("X, Y Test",
"This notification should poi... | print "Failed to send notification"
sys.exit(1) |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, find_packages
from codecs import open
import os
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()<|fim▁hole|>
setup(
name='transp... | |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, find_packages
from codecs import open
import os
def read(*paths):
<|fim_middle|>
setup(
name='transposer',
version='0.0.3',
description='Transposes columns and rows in delimited text files',
long_description=(read('R... | """Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read() |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>from setuptools import setup, find_packages
from codecs import open
import os
def <|fim_middle|>(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
setup(
name='transpo... | read |
<|file_name|>setup.py<|end_file_name|><|fim▁begin|>import os
from setuptools import setup, find_packages
README = open(os.path.join(os.path.dirname(__file__), 'README.md')).read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-email-subscription',
url='http... | |
<|file_name|>example_date_featurizer.py<|end_file_name|><|fim▁begin|>"""
=================================================
Modeling quasi-seasonal trends with date features
=================================================
Some trends are common enough to appear seasonal, yet sporadic enough that
approaching them fro... | # What next? Try combining different featurizers in your pipeline to enhance |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | def startProtocol(self):
self.transport.connect(self.ip,self.port)
if state=='INITIAL': |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | def __init__(self, host,port,reactor):
self.ip= socket.gethostbyname(host)
self.port = port
#self._reactor=reactor
#self.ip=reactor.resolve(host)
def startProtocol(self):
self.transport.connect(self.ip,self.port)
if state=='INITIAL':
#If system is at t... |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | self.ip= socket.gethostbyname(host)
self.port = port
#self._reactor=reactor
#self.ip=reactor.resolve(host) |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | self.transport.connect(self.ip,self.port)
if state=='INITIAL':
#If system is at the initial state, it will send the device creation Senze
self.register()
else:
response=raw_input("Enter your Senze:")
self.sendDatagram(response) |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | print "STOP **************" |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | global server
cry=myCrypto(name=device)
senze ='SHARE #pubkey %s @%s' %(pubkey,server)
senze=cry.signSENZE(senze)
self.transport.write(senze) |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | global server
cry=myCrypto(name=device)
senze=cry.signSENZE(senze)
print senze
self.transport.write(senze) |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | print 'Datagram received: ', repr(datagram)
parser=myParser(datagram)
recipients=parser.getUsers()
sender=parser.getSender()
signature=parser.getSignature()
data=parser.getData()
sensors=parser.getSensors()
cmd=parser.getCmd()
... |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | global device
global pubkey
global state
#If .device name is not there, we will read the device name from keyboard
#else we will get it from .devicename file
try:
if not os.path.isfile(".devicename"):
device=raw_input("Enter the device name: ")
# Account need to be create... |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | global host
global port
protocol = mySensorDatagramProtocol(host,port,reactor)
reactor.listenUDP(0, protocol)
reactor.run() |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | self.register() |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | response=raw_input("Enter your Senze:")
self.sendDatagram(response) |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | if 'UserCreated' in data['msg']:
#Creating the .devicename file and store the device name and PIN
f=open(".devicename",'w')
f.write(device+'\n')
f.close()
print device+ " was created at the server."
print "You should ... |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | f=open(".devicename",'w')
f.write(device+'\n')
f.close()
print device+ " was created at the server."
print "You should execute the program again."
print "The system halted!"
reactor.stop() |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | print "This user name may be already taken"
print "You can try it again with different username"
print "The system halted!"
reactor.stop() |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | device=raw_input("Enter the device name: ")
# Account need to be created at the server
state='INITIAL' |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | f=open(".devicename","r")
device = f.readline().rstrip("\n")
state='READY' |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | cry.generateRSA(bits=1024) |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | init()
main() |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | __init__ |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | startProtocol |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | stopProtocol |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | register |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | sendDatagram |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | datagramReceived |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | init |
<|file_name|>myDevice.py<|end_file_name|><|fim▁begin|>#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import datetime
import socket
import time
import sys
import os.path
lib_path... | main |
<|file_name|>analyzer.py<|end_file_name|><|fim▁begin|># Copyright (C) 2019 Fassio Blatter
from stopeight import analyzer
version=analyzer.version
from stopeight.util.editor.data import ScribbleData
def legal_segments(data):<|fim▁hole|>legal_segments.__annotations__ = {'data':ScribbleData,'return':ScribbleData}<|fim▁e... | from stopeight.matrix import Vectors
from stopeight.analyzer import legal_segments
return legal_segments(Vectors(data)).__array__().view(ScribbleData) |
<|file_name|>analyzer.py<|end_file_name|><|fim▁begin|># Copyright (C) 2019 Fassio Blatter
from stopeight import analyzer
version=analyzer.version
from stopeight.util.editor.data import ScribbleData
def legal_segments(data):
<|fim_middle|>
legal_segments.__annotations__ = {'data':ScribbleData,'return':ScribbleDat... | from stopeight.matrix import Vectors
from stopeight.analyzer import legal_segments
return legal_segments(Vectors(data)).__array__().view(ScribbleData) |
<|file_name|>analyzer.py<|end_file_name|><|fim▁begin|># Copyright (C) 2019 Fassio Blatter
from stopeight import analyzer
version=analyzer.version
from stopeight.util.editor.data import ScribbleData
def <|fim_middle|>(data):
from stopeight.matrix import Vectors
from stopeight.analyzer import legal_segments
... | legal_segments |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | class Resistor:
def __init__(self, resistance, voltage):
self._resistance = resistance
self.voltage = voltage |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | def __init__(self, resistance, voltage):
self._resistance = resistance
self.voltage = voltage
@property
def resistance(self):
return self._resistance
@property
def current(self):
return self.voltage / self.resistance
@current.setter
def current(self, value)... |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | self._resistance = resistance
self.voltage = voltage |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | return self._resistance |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | return self.voltage / self.resistance |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | self.voltage = self.resistance * value |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | return self.current * 1000 |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | self.current = value / 1000 |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | import doctest
count, _ = doctest.testmod()
if count == 0:
print('*** ALL TESTS PASS ***\nGive someone a HIGH FIVE!') |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | print('*** ALL TESTS PASS ***\nGive someone a HIGH FIVE!') |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | __init__ |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | resistance |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | current |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | current |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | current_in_milliamps |
<|file_name|>properties_extra.py<|end_file_name|><|fim▁begin|>'''
Ohm's law is a simple equation describing electrical circuits. It
states that the voltage V through a resistor is equal to the current
(I) times the resistance:
V = I * R
The units of these are volts, ampheres (or "amps"), and ohms,
respectively. In re... | current_in_milliamps |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | require = cfg.get("require", require) |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | """
FIXME: Think about, should I return 0, or have an assert, and at qc.py
all qc tests are applied with a try, and in case it fails it flag
0s.
"""
require = cfg.get("require", require)
if (require == "all") and not np.all([f in features for f in cfg["features"]]):
... |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | def set_features(self):
self.features = {}
for v in [f for f in self.cfg["features"] if f not in self.features]:
if v == "woa_bias":
woa_comparison = woa_normbias(self.data, self.varname, self.attrs)
self.features[v] = woa_comparison["woa_bias"]
... |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | self.features = {}
for v in [f for f in self.cfg["features"] if f not in self.features]:
if v == "woa_bias":
woa_comparison = woa_normbias(self.data, self.varname, self.attrs)
self.features[v] = woa_comparison["woa_bias"]
elif v == "woa_normbias":
... |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | self.flags = {}
cfg = self.cfg
flag = np.zeros(np.shape(self.data[self.varname]), dtype="i1")
uncertainty = self.features["fuzzylogic"]
# FIXME: As it is now, it will have no zero flag value. Think about cases
# where some values in a profile would not be estimated, he... |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | module_logger.warning(
"Not all features (%s) required by fuzzy logic are available".format(
cfg["features"].keys()
)
)
raise KeyError |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | woa_comparison = woa_normbias(self.data, self.varname, self.attrs)
self.features[v] = woa_comparison["woa_bias"] |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | woa_comparison = woa_normbias(self.data, self.varname, self.attrs)
self.features[v] = woa_comparison["woa_normbias"] |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | self.features[v] = spike(self.data[self.varname]) |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | self.features[v] = gradient(self.data[self.varname]) |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | fuzzylogic |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | set_features |
<|file_name|>fuzzylogic.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Quality Control based on fuzzy logic.
"""
import logging
import numpy as np
from .core import QCCheckVar
from .gradient import gradient
from .spike import spike
fro... | test |
<|file_name|>Write.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1be... |
if __name__ == "__main__":
main() |
<|file_name|>Write.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1be... | messages = [
firestore_pb2.WriteRequest(database = database, writes = [])
]
for msg in messages:
yield msg |
<|file_name|>Write.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1be... | messages = [
firestore_pb2.WriteRequest(database=database, writes = []),
firestore_pb2.WriteRequest(database=database, writes = [writes], stream_id = stream_id, stream_token = stream_token)
]
for msg in messages:
yield msg |
<|file_name|>Write.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1be... | fl = os.path.dirname(os.path.abspath(__file__))
fn = os.path.join(fl, 'grpc.json')
with open(fn) as grpc_file:
item = json.load(grpc_file)
creds = item["grpc"]["Write"]["credentials"]
credentials = service_account.Credentials.from_service_account_file("{}".form... |
<|file_name|>Write.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1be... | main() |
<|file_name|>Write.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1be... | first_message |
<|file_name|>Write.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1be... | generate_messages |
<|file_name|>Write.py<|end_file_name|><|fim▁begin|>#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1be... | main |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... |
def check_hosts(self, serializer): |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | serializer_class = CommandExecutionSerializer
permission_classes = (IsValidUser,)
def get_queryset(self):
return CommandExecution.objects.filter(
user_id=str(self.request.user.id)
)
def check_hosts(self, serializer):
data = serializer.validated_data
assets =... |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | return CommandExecution.objects.filter(
user_id=str(self.request.user.id)
) |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | data = serializer.validated_data
assets = data["hosts"]
system_user = data["run_as"]
util = AssetPermissionUtil(self.request.user)
util.filter_permissions(system_users=system_user.id)
permed_assets = util.get_assets().filter(id__in=[a.id for a in assets])
invalid_... |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | if not settings.SECURITY_COMMAND_EXECUTION and request.user.is_common_user:
return self.permission_denied(request, "Command execution disabled")
return super().check_permissions(request) |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | self.check_hosts(serializer)
instance = serializer.save()
instance.user = self.request.user
instance.save()
cols = self.request.query_params.get("cols", '80')
rows = self.request.query_params.get("rows", '24')
transaction.on_commit(lambda: run_command_execution.ap... |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | msg = _("Not has host {} permission").format(
[str(a.id) for a in invalid_assets]
)
raise ValidationError({"hosts": msg}) |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | return self.permission_denied(request, "Command execution disabled") |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | get_queryset |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | check_hosts |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | check_permissions |
<|file_name|>command.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
#
from rest_framework import viewsets
from rest_framework.exceptions import ValidationError
from django.db import transaction
from django.utils.translation import ugettext as _
from django.conf import settings
from orgs.mixins.api import Root... | perform_create |
<|file_name|>Gauss2.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 16:29:34 2017
@author: ishort
"""
import math
""" procedure to generate Gaussian of unit area when passed a FWHM"""
#IDL: PRO GAUSS2,FWHM,LENGTH,NGAUS
def gauss2(fwhm, length):
#length=le... | #This expression for AMP (amplitude) comes from requiring that the
#area under the gaussian is unity:
|
<|file_name|>Gauss2.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
Created on Thu Sep 21 16:29:34 2017
@author: ishort
"""
import math
""" procedure to generate Gaussian of unit area when passed a FWHM"""
#IDL: PRO GAUSS2,FWHM,LENGTH,NGAUS
def gauss2(fwhm, length):
#length=le... | ngaus = [0.0 for i in range(length)]
#This expression for CHAR comes from requiring f(x=0.5*FWHM)=0.5*f(x=0):
#CHAR=-1d0*ALOG(0.5d0)/(0.5d0*0.5d0*FWHM*FWHM)
char = -1.0 * math.log(0.5) / (0.5*0.5*fwhm*fwhm)
#This expression for AMP (amplitude) comes from requiring that the
#area under the gaussia... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.