repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
retroxsky06/Final_Project
webpage/run_ml.py
import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from imblearn.over_sampling import RandomOverSampler def predictions(age, gender, hypertension, heart_disease, ever_married, smoking_status): ...
aldente05/bluetooth-python
service/BluetoothClient.py
<filename>service/BluetoothClient.py """ A simple Python script to send messages to a sever over Bluetooth using Python sockets (with Python 3.3 or above). for sending data """ import socket serverMACAddress = '00:1f:e1:dd:08:3d' port = 3 s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM, socket.BTPROTO_RFCOM...
aldente05/bluetooth-python
temperatureController/Temperature.py
import Adafruit_GPIO.I2C as I2C I2C.require_repeated_start() class Melexis: def __init__(self, address=0x5A): self._i2c = I2C.Device(address, busnum=1) def readAmbient(self): return self._readTemp(0x06) def readObject1(self): return self._readTemp(0x07) def readObject2(self...
aldente05/bluetooth-python
valve-controller/main.py
<gh_stars>0 # import RPi.GPIO as GPIO # import time, sys # # FLOW_SENSOR = 23 # # GPIO.setmode(GPIO.BCM) # GPIO.setup(FLOW_SENSOR, GPIO.IN, pull_up_down = GPIO.PUD_UP) # # global count # count = 0 # # def countPulse(channel): # global count # count = count+1 # print # count # # GPIO.add_event_detect(FLOW_SE...
aldente05/bluetooth-python
core/Connection.py
import mysql.connector as mariadb import datetime # Open database connection db = mariadb.connect(user="root", password="<PASSWORD>", database="Raspi") # prepare a cursor object using cursor() method cursor = db.cursor() # execute SQL query using execute() method. cursor.execute("SELECT start FROM pump") # Fetch a ...
aldente05/bluetooth-python
service/BluetoothTest.py
<reponame>aldente05/bluetooth-python<filename>service/BluetoothTest.py import socket print("\n\nperforming inquiry...") address, services = socket.AF_BLUETOOTH print("Address: %s" % address) for name, port in services.items(): print(u"%s : %d" % (name, port))
aldente05/bluetooth-python
valve-controller/advance.py
<gh_stars>0 # # aritmatics Q = pulses_measured * 60 / measuring_time / 7.5 # # Import modules # import smbus # import time # Library to allow delay times # import datetime # Library to allow time and date recording # from array import array # Library t...
aldente05/bluetooth-python
hearbeatController/hearbeat.py
<gh_stars>0 import RPi.GPIO as GPIO # this input variable for hearbeat sensor # Sensor and pins variables pulsePin = 0 blinkPin = 13 GPIO.setmode(GPIO.BCM) GPIO.setup(pulsePin, GPIO.IN, pull_up_down = GPIO.PUD_UP) GPIO.setup(blinkPin, GPIO.IN, pull_up_down = GPIO.PUD_UP) IBI = 600 # Main function def main(): globa...
aldente05/bluetooth-python
ws/REST.py
# # -*- coding: utf-8 -*- # from flask import Flask, jsonify, request # from flask_login import LoginManager, UserMixin, login_required # from itsdangerous import URLSafeTimedSerializer # # import RPi.GPIO as GPIO # from ws.decorators import crossdomain # # app = Flask(__name__) # app.debug = True # # app.secret_key = ...
aldente05/bluetooth-python
service/BluetoothServer.py
<reponame>aldente05/bluetooth-python<gh_stars>0 """ A simple Python script to receive messages from a client over Bluetooth using Python sockets (with Python 3.3 or above). for receiving """ import socket hostMACAddress = '00:1f:e1:dd:08:3d' # The MAC address of a Bluetooth adapter on the server. The server might hav...
chumpblocckami/psutil
scripts/internal/print_wheels.py
#!/usr/bin/env python3 # Copyright (c) 2009 <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Nicely print wheels print in dist/ directory.""" import collections import glob import os from psutil._common import print_color from psu...
chumpblocckami/psutil
scripts/temperatures.py
<filename>scripts/temperatures.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) 2009, <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ A clone of 'sensors' utility on Linux printing hardware temperatures. $ python...
chumpblocckami/psutil
psutil/_psposix.py
<filename>psutil/_psposix.py<gh_stars>10-100 # Copyright (c) 2009, <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Routines common to all posix systems.""" import glob import os import signal import sys import time from ._common i...
chumpblocckami/psutil
scripts/internal/download_wheels_github.py
<reponame>chumpblocckami/psutil #!/usr/bin/env python3 # Copyright (c) 2009 <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Script which downloads wheel files hosted on GitHub: https://github.com/giampaolo/psutil/actions It needs ...
chumpblocckami/psutil
scripts/internal/bench_oneshot.py
<filename>scripts/internal/bench_oneshot.py<gh_stars>1000+ #!/usr/bin/env python3 # Copyright (c) 2009, <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ A simple micro benchmark script which prints the speedup when using Process.on...
chumpblocckami/psutil
scripts/internal/winmake.py
#!/usr/bin/env python3 # Copyright (c) 2009 <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Shortcuts for various tasks, emulating UNIX "make" on Windows. This is supposed to be invoked by "make.bat" and not used directly. This wa...
chumpblocckami/psutil
scripts/internal/purge_installation.py
<reponame>chumpblocckami/psutil #!/usr/bin/env python3 # Copyright (c) 2009 <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Purge psutil installation by removing psutil-related files and directories found in site-packages director...
chumpblocckami/psutil
scripts/internal/fix_flake8.py
#!/usr/bin/env python3 # Copyright (c) 2009, <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Fix some flake8 errors by rewriting files for which flake8 emitted an error/warning. Usage (from the root dir): $ python3 -m flake8 ...
chumpblocckami/psutil
scripts/internal/print_api_speed.py
<filename>scripts/internal/print_api_speed.py<gh_stars>1000+ #!/usr/bin/env python3 # Copyright (c) 2009, <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Benchmark all API calls. $ make print_api_speed SYSTEM APIS SE...
chumpblocckami/psutil
psutil/tests/runner.py
#!/usr/bin/env python3 # Copyright (c) 2009, <NAME>'. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Unit test runner, providing new features on top of unittest module: - colourized output - parallel run (UNIX only) - print failures/trace...
PsycoTodd/TaichiJourney
HM0_tiFire/tiFire.py
<reponame>PsycoTodd/TaichiJourney import taichi as ti import math # ti.init(debug=True, arch=ti.cpu) ti.init(arch=ti.opengl) def vec(*xs): return ti.Vector(list(xs)) def mix(x, y, a): return x * (1.0 - a) + y * a GUI_TITLE = "Fire" w, h = wh = (640, 480) # GUI size pixels = ti.Vector(3, dt=ti.f32, shape=wh) i...
XtherDevTeam/XmediaCenter
tests/damuku_parser_test.py
import os,core.plugins.video_player.video_apis,sys with open('/media/p0010/8d7176d7-fa0b-485b-a2ed-18e2a4537f53/XmediaCenter-Python-Remaked-Version/core/storage/Video/CLANNAD/CLANNAD:第1话 在那落樱缤纷的坡道上.cmt.xml','r') as f: xmlf = f.read().encode(encoding='utf-8') result = core.plugins.video_player.video_apis.damuku...
XtherDevTeam/XmediaCenter
core/plugins/FileManager/main.py
from types import CodeType import flask,core.plugins.FileManager.file_manage,core.api,core.xmcp from flask.globals import g from flask.templating import render_template import json name = 'FileManager' requestCPR = None def cross_plugin_request(args:list): if type(args[0]).__name__ == 'str' and args[0] == 'get_p...
XtherDevTeam/XmediaCenter
core/xmcp.py
import hashlib,json,base64 def makeUserInfomation(username:str,password:str): password += <PASSWORD>' password = <PASSWORD>(password.encode('utf-8')).<PASSWORD>digest() final = username + ":" + password final = str(base64.encodebytes(bytes(final.encode('utf-8'))),encoding='utf-8') return final def...
XtherDevTeam/XmediaCenter
json_test.py
import json,sys print(json.dumps( { } ))
XtherDevTeam/XmediaCenter
core/plugins/Login/main.py
<filename>core/plugins/Login/main.py from types import CodeType import flask from flask.templating import render_template name = 'Login/Logout' requestCPR = None def cross_plugin_request(args: list): if type(args[0]).__name__ == 'str' and args[0] == 'get_path': return '/login' else: return '...
XtherDevTeam/XmediaCenter
core/plugins/MusicPlayer/main.py
from types import CodeType import flask,core.plugins.MusicPlayer.music_apis,core.api,core.xmcp,core.plugins.MusicPlayer.counter,pymediainfo from werkzeug.utils import redirect from flask.globals import g from flask.templating import render_template import json name = 'MusicPlayer' requestCPR = None def cross_plugin_...
XtherDevTeam/XmediaCenter
utils.py
#!/bin/python3 import core.XmediaCenterCore as Core,core.xmcp,sys if sys.argv[1] == 'account': if sys.argv[2] == 'new': print(Core.create_account(sys.argv[3],sys.argv[4])) elif sys.argv[2] == 'remove': print(Core.remove_account(sys.argv[3],sys.argv[4])) elif sys.argv[2] == 'modify': ...
XtherDevTeam/XmediaCenter
core/plugins/MusicSharing/main.py
<reponame>XtherDevTeam/XmediaCenter<filename>core/plugins/MusicSharing/main.py from types import CodeType import flask,core.plugins.FileManager.file_manage,core.api,core.xmcp from flask.globals import g from flask.templating import render_template import json import pymediainfo from mutagen import File name = 'Mini mu...
XtherDevTeam/XmediaCenter
core/plugins/FileManager/file_manage.py
<reponame>XtherDevTeam/XmediaCenter<filename>core/plugins/FileManager/file_manage.py import os,sys,json,core.api,flask,shutil,mimetypes from posixpath import expanduser def get_mime(path:str): # os.getcwd()+'/core/storage/' + core.api.getAbsPath(path) a = mimetypes.guess_type(path) if a[0] == None: ...
XtherDevTeam/XmediaCenter
core/plugins/EpubReader/main.py
<reponame>XtherDevTeam/XmediaCenter import mimetypes from types import CodeType from typing import final from xml.etree.ElementTree import ElementTree import flask,core.plugins.FileManager.file_manage,core.api,core.xmcp from flask.wrappers import Response from flask.helpers import make_response from flask.globals impor...
XtherDevTeam/XmediaCenter
core/plugins/MusicPlayer/music_apis.py
import json,os,sys,pymediainfo,core.api,hashlib def init_playlists(userinfo:str): # init config directory if os.access('core/plugins/MusicPlayer/.musicplayer',os.F_OK): None else: os.mkdir('core/plugins/MusicPlayer/.musicplayer') # init user playlists if os.access('core/plugins/Mus...
XtherDevTeam/XmediaCenter
core/plugins/video_player/main.py
from os import F_OK import os from types import CodeType import flask,core.plugins.FileManager.file_manage,core.api,core.xmcp,core.plugins.video_player.video_apis from flask.globals import g from flask.templating import render_template import json name = 'Video Player' requestCPR = None def cross_plugin_request(args...
XtherDevTeam/XmediaCenter
core/plugins/main/main.py
<gh_stars>1-10 from types import CodeType import flask from flask.templating import render_template import core.xmcp name = 'main' requestCPR = None def cross_plugin_request(args:list): return "denied" def get_plugins_path_list(): ret = [] print(requestCPR()) for i in requestCPR(): path = i...
XtherDevTeam/XmediaCenter
core/plugins/MusicPlayer/counter.py
<gh_stars>1-10 import json,os,sys,hashlib def init_counter_file(userinfo:str): if os.access(os.getcwd() + '/core/plugins/MusicPlayer/.musicplayer/counter-' + hashlib.md5(userinfo.encode('utf-8')).hexdigest() + '.json',os.F_OK): None else: with open(os.getcwd() + '/core/plugins/MusicPlayer/.musi...
XtherDevTeam/XmediaCenter
tests/mime.py
<reponame>XtherDevTeam/XmediaCenter<gh_stars>1-10 #!/bin/python3 import sys,mimetypes print(mimetypes.guess_type(sys.argv[1])[0])
XtherDevTeam/XmediaCenter
core/plugins/video_player/video_apis.py
import os,sys,lxml.etree def damuku_parser(origin_xml): ret = [] html = lxml.etree.HTML(origin_xml) for item in html.xpath('//d'): description = item.xpath('./@p')[0].split(',') ret.append( [ float(description[0]),int(description[1]),int(description[3]),description[6],item.text ] ) retu...
cloudconductor-patterns/tomcat_pattern_ansible
lib/cloud_conductor_attributes.py
<reponame>cloudconductor-patterns/tomcat_pattern_ansible import os import consul import json import ast def token_key(): return os.environ.get('CONSUL_SECRET_KEY') def kvs_all_keys(): c = consul.Consul() index, data = c.kv.get('', token=token_key(), keys=True) return data def kvs_cc_keys(): cc_ke...
cloudconductor-patterns/tomcat_pattern_ansible
playbooks/filter_plugins/cc_filters.py
<filename>playbooks/filter_plugins/cc_filters.py # Common filters def deep_get(cc_attributes, nested_keys): if cc_attributes == None: return None current_dict = cc_attributes for key in nested_keys.split('.'): if current_dict.has_key(key): current_dict = current_dict[key] else: return Non...
ZhuozhaoLi/funcX
funcx_endpoint/funcx_endpoint/endpoint/endpoint_manager.py
<reponame>ZhuozhaoLi/funcX<gh_stars>0 import glob import json import logging import os import pathlib import shutil import signal import sys import time import uuid from string import Template import daemon import daemon.pidfile import psutil import texttable as tt import typer from retry.api import retry_call import...
tomasz-oponowicz/spoken_language_identification
features.py
import glob import os import time import numpy as np import soundfile as sf from constants import * import common # source1: https://bit.ly/2GSsEgw # source2: https://bit.ly/2sWxHIc def generate_fb_and_mfcc(signal, sample_rate): # Pre-Emphasis pre_emphasis = 0.97 emphasized_signal = np.append( ...
ipodlipnyak/YureiSim
objects/map.py
<gh_stars>0 import pygame import random import numpy as np class grass(): def __init__(self): if not pygame.font.get_init(): pygame.font.init() self.on_init() # self.on_render() def on_init(self): self.f = pygame.font.SysFont ('sawasdee',10,bold=True) self.g...
ipodlipnyak/YureiSim
run.py
import sys, random, math, pygame, logging, objects from sys import exit from pygame.locals import * from pygame.sprite import Group, GroupSingle from objects import observer, grid, var_depo, ghost class App: def __init__(self): self._running = True self._display_surf = None self.size = sel...
ipodlipnyak/YureiSim
objects/ghost.py
<filename>objects/ghost.py<gh_stars>0 import pygame, random class ghost(pygame.sprite.Sprite,object): def __init__(self,surface,observer,x=0,y=0,w=15,h=15): pygame.sprite.Sprite.__init__(self) self.surf = surface self.obs = observer self.rect = pygame.Rect(x,y,w,h) self.surf...
ipodlipnyak/YureiSim
objects/observer.py
<filename>objects/observer.py<gh_stars>0 #-- Observer Pattern -- #http://wiki.c2.com/?ObserverPattern #The two basic styles of notification: PushModel and PullModel. #If the observed object does not have the necessary hooks for observers, #the observers must rely on repeatedly polling the observed to note the changes. ...
ipodlipnyak/YureiSim
objects/var_depo.py
test = 'hi' grid = []
ipodlipnyak/YureiSim
objects/grid.py
<reponame>ipodlipnyak/YureiSim import pygame import math, random, scipy, numpy, Queue, threading, logging, os from numpy import linalg from objects import map from decimal import * from Queue import Queue from threading import Thread module_logger = logging.getLogger('App.Grid') #Return grid with tiles class Grid(obj...
sonalig955/spelling-corrector
spelling corrector.py
from tkinter import* from textblob import TextBlob def clearAll(): word_field1.delete(0,END) word_field2.delete(0,END) def correction(): input_word=word_field1.get() blob_obj=TextBlob(input_word) corrected_word=str(blob_obj.correct()) word_field2.insert(10,corrected_word) if __name__=="__mai...
sh2439/Algo_stanford
C1: Divide and Conquer/Karger_mincut.py
import random, copy def read_file(name): """ Input the file name and return a dictionary to store the graph. """ with open(name, 'r') as data: line = data.read().strip().split("\n") graph_dict = {} for element in line: line_list = list(map(int, element.strip().split("\...
sh2439/Algo_stanford
C2: Graph Search/two_sum_set.py
<gh_stars>10-100 ### Straightforward implementation of Two Sum problem using a hash set. ### Slow! import time start = time.time() def read_file(name): """ Given the name of the file, return the hashset d. """ d = set() file = open(name, 'r') data = file.readlines() for line in ...
sh2439/Algo_stanford
C1: Divide and Conquer/Quick_sort_count.py
<reponame>sh2439/Algo_stanford # Three different partition functions: # 1. Use the 1st element as pivot. # 2. Use the last element as pivot # 3. Use the median of three as pivot(first, last and middle elements). def partition_1(a,l,r): """ partition array a[l...r] Pivot: Always the 1st element of the arra...
sh2439/Algo_stanford
C3: Greedy Algo/huffman.py
import heapq from collections import namedtuple Node = namedtuple('Node', ('weight','index')) def read_file(name): """Given the path/name of the text file, return the heap with nodes. """ tree = [] file = open(name, 'r') data = file.readlines() for index, line in enumerate(data[...
sh2439/Algo_stanford
C1: Divide and Conquer/Karastuba_mul.py
<filename>C1: Divide and Conquer/Karastuba_mul.py<gh_stars>10-100 def kara_mul(x,y): """ The Karatsuba Integer Multiplication Algorithm. """ # base case if len(str(x))==1 or len(str(y))==1: return x*y else: n = max(len(str(x)), len(str(y))) n_half = n//2 ...
sh2439/Algo_stanford
C3: Greedy Algo/MST_Prim.py
<reponame>sh2439/Algo_stanford import random def read_file(name): """Given path/name of the file, return the undirected graph in list. list[1] is a tuple, which contains (node, weights) of node 1. """ file = open(name, 'r') data = file.readlines() num_nodes = 500 graph = [[] f...
sh2439/Algo_stanford
C3: Greedy Algo/clustering_small.py
<filename>C3: Greedy Algo/clustering_small.py from operator import attrgetter class unionfind: """An implementation of union-find data structure by rank. """ def __init__(self,n): """Initialize an union-find with n items(objects). """ self.root = list(range(n)) self.ran...
sh2439/Algo_stanford
C2: Graph Search/SCC.py
import sys import threading def read_file(name): num_nodes = 875715 file = open(name,"r") data = file.readlines() G = [[] for i in range(num_nodes)] G_rev = [[] for i in range(num_nodes)] for line in data: items = line.split() G[int(items[0])] += [int(items[1...
sh2439/Algo_stanford
C4: Shortest Path Revisited, NP-Complete/tsp_heuristic.py
### The following code implements the traveling salesman probblem with a greedy heuristic approach. from tqdm import tqdm import numpy as np def read_file(name): """Given the path/name of the file, return the graph (dictionary). """ file = open(name,'r') data = file.readlines() # initialize t...
sh2439/Algo_stanford
C4: Shortest Path Revisited, NP-Complete/apsp.py
# The following code implements the Floyd-Warshall algorithm to solve all-pairs shortest paths problem. The algorithm can either #find the shortest path of all paris or detect a negative cycle. from tqdm import tqdm class Edge: def __init__(self, from_node, to_node, weight): self.from_node = from_node ...
sh2439/Algo_stanford
C2: Graph Search/two_sum_array.py
import time from bisect import bisect_left, bisect_right start = time.time() def read_file(name): """ Given the name of the file, return the sorted array array_a. """ d = set() file = open(name, 'r') data = file.readlines() for line in data: items = line.split() ...
sh2439/Algo_stanford
C3: Greedy Algo/Schedule_jobs.py
<reponame>sh2439/Algo_stanford ### The code below implements the a scheduling problem which minimizes the weighted sum of completion time of jobs. def read_file(name): """Given the path/name of the file, return nthe jobs list with jobs[][0]: weight and jobs[][1]: length. """ file = open(name,'r') d...
sh2439/Algo_stanford
C2: Graph Search/Median_Maintenance.py
<filename>C2: Graph Search/Median_Maintenance.py import heapq def read_file(name): """Given the path of a file, return a list of numbers to be processed. """ d = [] file = open(name,'r') data = file.readlines() for line in data: items = line.split() d.append(int(items[...
sh2439/Algo_stanford
C2: Graph Search/Dijkstra.py
<reponame>sh2439/Algo_stanford import time from ast import literal_eval def read_file(name,num_nodes=201): """Given the name of the file , return the graph in list. """ graph = [None]*num_nodes file = open(name) data = file.readlines() for line in data: items = line.split() ...
sh2439/Algo_stanford
C1: Divide and Conquer/Merge_sort.py
# Helper function: merge def merge(b, c): """ Arguments: Array1, Array2: Two sorted arrays b and c. Return: array_d: The merged version of b and c """ i = 0 j = 0 k = 0 n1 = len(b) n2 = len(c) array_d = [None]*(n1+n2) # traverse both arrays w...
sh2439/Algo_stanford
C3: Greedy Algo/knapsack_small.py
<reponame>sh2439/Algo_stanford # The following code implements the knapsack problem with bottom-up dynamic programming approach. def read_file(name): """Given the path/nname of a file ,return the Values list, Weights list, capacity and number of jobs. """ file = open(name, 'r') data = file.readl...
sh2439/Algo_stanford
C3: Greedy Algo/MWIS.py
def read_file(name): """Given the path/nname of the file, return the list of the weights of the nodes. """ file = open(name,'r') data = file.readlines() weights = [0]*(int(data[0])+1) for index,line in enumerate(data[1:]): item = line.split() weights[index+1] = int(item[0]) ...
sh2439/Algo_stanford
C1: Divide and Conquer/Count_inversion.py
<filename>C1: Divide and Conquer/Count_inversion.py # Helper function: merge and count split def merge_countsplit(b,c): """ Given two sorted arrays b and c, output a merged sorted array and the number of inversions. Output: d, num_split: Merged array d and number of inversions. """ i=0 ...
sh2439/Algo_stanford
C4: Shortest Path Revisited, NP-Complete/TSP.py
# The following code implements the NP-complete problem 'Traveling Salesman Problem' . # With dynamic programming approach, the algorithm is able to complete in reasonable time. import numpy as np import math from itertools import combinations from tqdm.auto import tqdm def read_file(name): """Given the path/name ...
genegr/py-pure-client
pypureclient/flasharray/FA_2_1/client.py
<filename>pypureclient/flasharray/FA_2_1/client.py import json import platform import time import urllib3 from typing import List, Optional from ...exceptions import PureError from ...keywords import Headers, Responses from ...responses import ValidResponse, ErrorResponse, ApiError, ItemIterator from ...token_manager ...
amatuni/multiformats
multiformats/multiformats.bzl
COPTS = [ "-std=c++1z", "-stdlib=libc++", "-Wall", "-Wextra", "-Wno-unused", "-Wno-unused-parameter", "-pedantic", ]
errbotio/err-ghstatus
ghstatus.py
<filename>ghstatus.py # Copyright 2018 Argo AI, LLC. # # 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/LICENSE-2.0 # # Unless required b...
MeganWright3109/Human-Machine-Interaction
Robot-Maze-Supreme.py
<filename>Robot-Maze-Supreme.py # !/usr/bin/env python3 '''COM2009-3009 EV3DEV TEST PROGRAM''' # Connect left motor to Output C and right motor to Output B # Connect an ultrasonic sensor to Input 3 import math import matplotlib.pyplot as plt from matplotlib import style import time import numpy as np import random imp...
MeganWright3109/Human-Machine-Interaction
com2009-3009_ev3dev_test.py
<filename>com2009-3009_ev3dev_test.py #!/usr/bin/env python3 '''COM2009-3009 EV3DEV TEST PROGRAM''' # Connect left motor to Output C and right motor to Output B # Connect an ultrasonic sensor to Input 3 import os import sys import time import ev3dev.ev3 as ev3 import math # import random # import matplotlib.pyplot as...
MeganWright3109/Human-Machine-Interaction
Robot-Maze-B1.py
# !/usr/bin/env python3 '''COM2009-3009 EV3DEV TEST PROGRAM''' # Connect left motor to Output C and right motor to Output B # Connect an ultrasonic sensor to Input 3 import os import sys import time import ev3dev.ev3 as ev3 import math from time import sleep, time # state constants ON = True OFF = False m_n = 0 m_o...
MeganWright3109/Human-Machine-Interaction
Robot-Maze-B1-Test-Rafa.py
<filename>Robot-Maze-B1-Test-Rafa.py # !/usr/bin/env python3 '''COM2009-3009 EV3DEV TEST PROGRAM''' # Connect left motor to Output C and right motor to Output B # Connect an ultrasonic sensor to Input 3 import os import sys import time import ev3dev.ev3 as ev3 import math import random import matplotlib.pyplot as plt...
suyanzhou626/predict_sliding.py
predict_sliding.py
import os import torch import torch.nn as nn import torch.nn.functional as F import torch.backends.cudnn as cudnn def tta_inference(inp, model, num_classes=8, scales=[1.0], flip=True): b, _, h, w = inp.size() preds = inp.new().resize_(b, num_classes, h, w).zero_().to(inp.device) for scale in scales: ...
jonathonwpowell/alexaTwitchSkill
awsLambda/lambda_code.py
import requests # --------------- Helpers that build all of the responses ---------------------- # These helpers are from amazon def build_speechlet_response(title, output, reprompt_text, should_end_session): return { 'outputSpeech': { 'type': 'PlainText', 'text': clean_return_fo...
lianwutech/ws_plugin_xxx
devices/eq2008/eq2008.py
<gh_stars>0 #!/usr/bin/env python # -*- coding:utf-8 -*- """ EQ2008库DLL的Ctypes封装 """ from ctypes import * from ctypes.wintypes import * import win32con import win32gui from libs.winutils import RGB # 定义结构 # 面板区域结构定义 class _StructPartInfo(Structure): _fields_ = [('iX', c_int), ('iY', c_int), ...
lianwutech/ws_plugin_xxx
plugin.py
#!/usr/bin/env python # -*- coding:utf-8 -*- """ modbus网络的串口数据采集插件 1、device_id的组成方式为ip_port_slaveid 2、设备类型为0,协议类型为modbus 3、devices_info_dict需要持久化设备信息,启动时加载,变化时写入 4、device_cmd内容:json字符串 """ import time from setting import * from libs.plugin import * from libs.mqttclient import MQTTClient # 全局变量 de...
lianwutech/ws_plugin_xxx
test/test_svg_to_bmp.py
<reponame>lianwutech/ws_plugin_xxx #!/usr/bin/env python # -*- coding:utf-8 -*- import os import time import json import cairo import rsvg from PIL import Image def convert_svg_to_png(svg_file_name, png_file_name): file_svg = open(svg_file_name) svg_data = file_svg.read() img = cairo.ImageSurface(cairo.FO...
lianwutech/ws_plugin_xxx
libs/winutils.py
#!/usr/bin/env python # -*- coding:utf-8 -*- import os import sys import json def RGB(r, g, b): """ COLORREF 映射 COLORREF is a typedef to DWORD, not a structure. All RGB macro does is some bitshifting to get 0x00bbggrr value. :param r: red :param g: green :param b: blue :return: ""...
lianwutech/ws_plugin_xxx
devices/led_eq2008.py
#!/usr/bin/env python # -*- coding:utf-8 -*- """ LER EQ2008设备类 EQ2008设备协议。 参数配置说明: device_id和cardnum的对应关系 如: "device": { “device_1”: 0, "device_2": 1 } """ import os import time import json import logging from Jinja2 import Template import cairo import rsvg from PIL import Image from libs.base_device impor...
lianwutech/ws_plugin_xxx
PluginService.py
<gh_stars>0 #!/usr/bin/env python # -*- coding:utf-8 -*- import win32serviceutil import win32service import win32event import os import logging import inspect from setting import * import plugin class PluginService(win32serviceutil.ServiceFramework): _svc_name_ = "" _svc_display_name_ = "Jambu Plugi...
lianwutech/ws_plugin_xxx
setting.py
<reponame>lianwutech/ws_plugin_xxx<gh_stars>0 #!/usr/bin/env python # -*- coding:utf-8 -*- import os import sys import logging import logging.config from libs.utils import * # 设置系统为utf-8 勿删除 reload(sys) sys.setdefaultencoding('utf-8') # 程序运行路径 # 工作目录切换为python脚本所在地址,后续成为守护进程后会被修改为'/' procedure_path = cur_file_dir(...
HTGoldston/sweepstakes_starter
main.py
<gh_stars>0 from contestant import Contestant if __name__ == "__main__": print_contsatant_info(contestant): pass contestants = { }
HTGoldston/sweepstakes_starter
sweepstakes_queue_manager.py
from sweepstake import Sweepstake class Sweepstakes_Queue_Manager: def __init__(self, queue): self.sweepstakes_stack_manager = Sweepstakes_Queue_Manager self.queue = queue def insert_sweepstakes(sweepstakes): pass def get_sweepstakes(): Sweepstake
HTGoldston/sweepstakes_starter
marketing_firm_creator.py
class Marketing_Firm_Creator: def __init__(self, choose_manager_type): self.marketing_firm_creator = Marketing_Firm_Creator self.choose_manager_type = choose_manager_type def choose_manager_type(marketing_firm): pass
HTGoldston/sweepstakes_starter
sweepstake.py
import random class Sweepstake: def __init__(self, contestants, name): self.sweepstake = Sweepstake self.contestants = contestants #keypairs key and value Dictionary def pick_winner(self): pass #.random def register_contestant(self): pass # register_contestant(contestant): pass ...
HTGoldston/sweepstakes_starter
contestant.py
<filename>contestant.py from sweepstake import Sweepstake class Contestant(Sweepstake): def __init__(self): self.contestant = Contestant super(Contestant, self).__init__((self, self.first_name, self.last_name, self.email_address, self.registration_number...
HTGoldston/sweepstakes_starter
sweepstakes_stack_manager.py
<reponame>HTGoldston/sweepstakes_starter class Sweepstakes_Stack_Manager: def __init__(self, stack): self.sweepstakes_stack_manager = Sweepstakes_Stack_Manager self.stack = stack def insert_sweepstakes(sweepstakes): pass def get_sweepstakes(): Sweepstake
HTGoldston/sweepstakes_starter
marketing_firm.py
<filename>marketing_firm.py class Marketing_Firm: def __init__(self, manager): self.marketing_firm = Marketing_Firm self.manager = manager def create_sweepstakes(self): pass
HTGoldston/sweepstakes_starter
user_interface.py
<reponame>HTGoldston/sweepstakes_starter from contestant import Contestant class User_Interface: def __init__(self): self.user_interface = User_Interface def register(self=None): self.register(self, Contestant) def print_contestant_info ([Contestant]): print_contstant_info(contstant)...
Conight/Go-LibDucoHasher
client_sample.py
from ctypes import cdll, Structure, c_char_p, c_longlong, c_double lib = cdll.LoadLibrary('/path/to/shared/main.so') class GoString(Structure): _fields_ = [('p', c_char_p), ('n', c_longlong)] class Return(Structure): _fields_ = [ ('r0', c_longlong), ('r1', c_double), ] # DUCOS1 lib.DU...
RacingTadpole/cmsplugin-rt
cmsplugin_rt/hbar/migrations/0001_initial.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): pass def backwards(self, orm): pass models = { } complete_apps = ['hbar']
RacingTadpole/cmsplugin-rt
cmsplugin_rt/self_calc_pagination/templatetags/descendant_selected.py
from django import template register = template.Library() @register.assignment_tag def descendant_selected(node): """Returns true if this node or a descendant of it is selected. Use as e.g.: {% if descendant_selected node %} """ if node.selected: return True for child in node.children: ...
RacingTadpole/cmsplugin-rt
cmsplugin_rt/text_minimal_markup/cms_plugins.py
<reponame>RacingTadpole/cmsplugin-rt from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.models.pluginmodel import CMSPlugin from django.utils.translation import ugettext_lazy as _ from django.conf import settings from models import * bootstrap_module_name = _("Widgets") layout_...
RacingTadpole/cmsplugin-rt
cmsplugin_rt/style_modifier/cms_plugins.py
from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.models.pluginmodel import CMSPlugin from django.utils.translation import ugettext_lazy as _ from django.conf import settings from models import * bootstrap_module_name = _("Widgets") layout_module_name = _("Layout elements") ge...
RacingTadpole/cmsplugin-rt
cmsplugin_rt/resizeable_picture/cms_plugins.py
<reponame>RacingTadpole/cmsplugin-rt<filename>cmsplugin_rt/resizeable_picture/cms_plugins.py from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.models.pluginmodel import CMSPlugin from django.utils.translation import ugettext_lazy as _ from django.conf import settings from model...
RacingTadpole/cmsplugin-rt
cmsplugin_rt/button/forms.py
<gh_stars>1-10 from django.forms.models import ModelForm from django.utils.translation import ugettext_lazy as _ from .models import ButtonPluginModel from django import forms from cms.models import Page class ButtonForm(ModelForm): page_link = forms.ModelChoiceField(label=_("page"), ...
RacingTadpole/cmsplugin-rt
cmsplugin_rt/button_appstore/cms_plugins.py
from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cms.models.pluginmodel import CMSPlugin from django.utils.translation import ugettext_lazy as _ from django.conf import settings from models import * class ButtonAppstorePlugin(CMSPluginBase): model = ButtonAppstorePluginModel ...
RacingTadpole/cmsplugin-rt
cmsplugin_rt/mailchimp_form/cms_plugins.py
from cms.plugin_base import CMSPluginBase from cms.models import CMSPlugin from cms.plugin_pool import plugin_pool from cmsplugin_mailchimp import models from django.utils.translation import ugettext_lazy as _ class BasePlugin(CMSPluginBase): name = None module = _("Social Networking") def render(self, con...