hexsha
stringlengths
40
40
size
int64
5
2.06M
ext
stringclasses
11 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
251
max_stars_repo_name
stringlengths
4
130
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
251
max_issues_repo_name
stringlengths
4
130
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
116k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
251
max_forks_repo_name
stringlengths
4
130
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
1
1.05M
avg_line_length
float64
1
1.02M
max_line_length
int64
3
1.04M
alphanum_fraction
float64
0
1
2860ad63802d9b4247cfc5b4ea2a3cd53137c044
3,973
py
Python
src/anaplan_api/Upload.py
pieter-pot/anaplan-api
1b099cb102f98b114afa0794a40aaf0de19956c1
[ "BSD-2-Clause" ]
null
null
null
src/anaplan_api/Upload.py
pieter-pot/anaplan-api
1b099cb102f98b114afa0794a40aaf0de19956c1
[ "BSD-2-Clause" ]
null
null
null
src/anaplan_api/Upload.py
pieter-pot/anaplan-api
1b099cb102f98b114afa0794a40aaf0de19956c1
[ "BSD-2-Clause" ]
null
null
null
# =============================================================================== # Created: 1 Nov 2021 # @author: Jesse Wilson (Anaplan Asia Pte Ltd) # Description: Abstract Anaplan Authentication Class # Input: Username & Password, or SHA keypair # Output: Anaplan JWT and token expiry time # =============================================================================== import logging import requests from requests.exceptions import HTTPError, ConnectionError, SSLError, Timeout, ConnectTimeout, ReadTimeout from .File import File logger = logging.getLogger(__name__)
29.87218
106
0.686383
28631cb627e7dcbf9512e0e9d35ed83e8378693a
427
py
Python
startPWM.py
adeept/adeept_alter
6adf00eb141405fc3abad44965f81ba7797dd962
[ "MIT" ]
1
2021-12-21T15:50:57.000Z
2021-12-21T15:50:57.000Z
startPWM.py
adeept/adeept_alter
6adf00eb141405fc3abad44965f81ba7797dd962
[ "MIT" ]
2
2021-03-14T22:05:42.000Z
2021-07-19T22:13:37.000Z
startPWM.py
adeept/adeept_alter
6adf00eb141405fc3abad44965f81ba7797dd962
[ "MIT" ]
null
null
null
import Adafruit_PCA9685 pwm = Adafruit_PCA9685.PCA9685() pwm.set_pwm_freq(50) initPWM = 320 setPWM = initPWM ctrlPort = 11 try: main() except KeyboardInterrupt: pwm.set_pwm(ctrlPort, 0, initPWM)
16.423077
35
0.651054
28658c7c561044400a64c09359dccf6abba3fb8e
2,042
py
Python
get_tracks.py
RamonPuon/Spotipy-Valence-Analysis
05f48e068097839d3dbd47d06f69608e48d1ac16
[ "MIT" ]
null
null
null
get_tracks.py
RamonPuon/Spotipy-Valence-Analysis
05f48e068097839d3dbd47d06f69608e48d1ac16
[ "MIT" ]
null
null
null
get_tracks.py
RamonPuon/Spotipy-Valence-Analysis
05f48e068097839d3dbd47d06f69608e48d1ac16
[ "MIT" ]
null
null
null
#cred.py, python script with my client ID and my client secret import cred import spotipy from spotipy.oauth2 import SpotifyClientCredentials import pandas as pd client_credential_manager = SpotifyClientCredentials(client_id= cred.client_ID, client_secret= cred.client_SECRET) sp = spotipy.Spotify(client_credentials_manager= client_credential_manager) #Function that returns every track from each album from a specific artist
39.269231
114
0.644466
28673f63b24f6a069e726650a9df5d529a4e2b9c
3,053
py
Python
Uzura/data/subsystem/stream.py
jskny/Uzura
356f8c25ceef5bd098b8e338e4acabb3f8653dca
[ "MIT" ]
null
null
null
Uzura/data/subsystem/stream.py
jskny/Uzura
356f8c25ceef5bd098b8e338e4acabb3f8653dca
[ "MIT" ]
null
null
null
Uzura/data/subsystem/stream.py
jskny/Uzura
356f8c25ceef5bd098b8e338e4acabb3f8653dca
[ "MIT" ]
null
null
null
#! /usr/bin/env python # -*- coding: utf-8 -*- # # Perl # 2012 / 11 / 14 # jskny # http://d.hatena.ne.jp/iacctech/20110429/1304090609 import sys, tweepy, urllib, urllib2 import os, time, subprocess, socket import re from tweepy.streaming import StreamListener, Stream from tweepy.auth import OAuthHandler from datetime import timedelta # host = '' port = 18385 serversock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # serversock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) serversock.bind((host, port)) serversock.listen(1) print 'Waiting for connections...' clientsock, client_address = serversock.accept() print 'Connection his Succeed...' # consumer_key = "oDiVnBOqcYjie0T8AN6XyA" consumer_secret = "0rsndWq3N3u8AJXKP7gfwrAcdwzPoFxAgZ5PuLt4Ww" access_key = "397948629-j4HutoScDcL5ncMZNvuA13JY6BA3D2zEJyZPdEAJ" access_secret = "N3UGJUwxDcrs0yz4mK3Y9cNhkw8IpO6kHnFIzHMH3pM" # # Tweepy if __name__ == "__main__": try: main() clientsock.close() sys.exit() except KeyboardInterrupt: clientsock.close() sys.exit()
24.821138
263
0.717327
286a9f1d8d066c57291a41e5d9d48a731a2d4a0c
541
py
Python
templates/django/djangoRest/app_dir/user/test/test_user_views.py
david-osas/create-basic-app
860fc579672855093ad8426fb01d010de4c7cff8
[ "MIT" ]
2
2020-12-01T11:33:36.000Z
2020-12-01T12:25:49.000Z
django-rest-framework-boilerplate/app_dir/user/test/test_user_views.py
PiotrZak/lem-golem
78f91f21b19725fca99c05d8c536330ef2785064
[ "MIT" ]
2
2020-11-25T14:38:57.000Z
2020-11-25T22:55:25.000Z
templates/django/djangoRest/app_dir/user/test/test_user_views.py
david-osas/create-basic-app
860fc579672855093ad8426fb01d010de4c7cff8
[ "MIT" ]
2
2020-11-26T08:59:50.000Z
2021-03-30T20:01:06.000Z
from django.test import TestCase from django.urls import reverse from rest_framework.test import APIClient from ...factories import UserFactory
28.473684
54
0.698706
286ba9afaaf93ad96524d8cf507a1bf2ad30a104
2,862
py
Python
port_mapping.py
sbalasa/CiscoFMC
024c9b6df3513e1e4a8e3e3f976a0c67b58c1909
[ "MIT" ]
1
2021-11-09T03:56:29.000Z
2021-11-09T03:56:29.000Z
port_mapping.py
sbalasa/CiscoFMC
024c9b6df3513e1e4a8e3e3f976a0c67b58c1909
[ "MIT" ]
null
null
null
port_mapping.py
sbalasa/CiscoFMC
024c9b6df3513e1e4a8e3e3f976a0c67b58c1909
[ "MIT" ]
1
2021-11-09T03:56:06.000Z
2021-11-09T03:56:06.000Z
ports = { "ssh": {"type": "PortLiteral", "port": "22", "protocol": "6",}, "udp/netbios-dgm": {"type": "PortLiteral", "port": "138", "protocol": "17",}, "udp/netbios-ns": {"type": "PortLiteral", "port": "137", "protocol": "17",}, "tcp/ssh": {"type": "PortLiteral", "port": "22", "protocol": "6",}, "tcp": {"type": "PortLiteral", "protocol": "6",}, "esp": {"type": "PortLiteral", "protocol": "50",}, "ah": {"type": "PortLiteral", "protocol": "51",}, "udp": {"type": "PortLiteral", "protocol": "17",}, "snmp": [ {"type": "PortLiteral", "port": "161", "protocol": "17",}, {"type": "PortLiteral", "port": "162", "protocol": "17",}, ], "udp/snmp": [ {"type": "PortLiteral", "port": "161", "protocol": "17",}, {"type": "PortLiteral", "port": "162", "protocol": "6",}, {"type": "PortLiteral", "port": "162", "protocol": "17",}, ], "udp/snmptrap": {"type": "PortLiteral", "port": "162", "protocol": "6",}, "snmptrap": [ {"type": "PortLiteral", "port": "162", "protocol": "6",}, {"type": "PortLiteral", "port": "162", "protocol": "17",}, ], "https": [ {"type": "PortLiteral", "port": "443", "protocol": "6",}, {"type": "PortLiteral", "port": "443", "protocol": "17",}, ], "tcp/https": {"type": "PortLiteral", "port": "443", "protocol": "6",}, "netbios-ssn": {"type": "PortLiteral", "port": "139", "protocol": "6",}, "tcp/netbios-ssn": {"type": "PortLiteral", "port": "139", "protocol": "6",}, "ntp": {"type": "PortLiteral", "port": "123", "protocol": "17",}, "udp/ntp": {"type": "PortLiteral", "port": "123", "protocol": "17",}, "tcp/tacacs": {"type": "PortLiteral", "port": "49", "protocol": "6",}, "udp/tacacs": {"type": "PortLiteral", "port": "49", "protocol": "17",}, "tcp/www": {"type": "PortLiteral", "port": "80", "protocol": "6",}, "udp/www": {"type": "PortLiteral", "port": "80", "protocol": "17",}, "tcp/http": {"type": "PortLiteral", "port": "80", "protocol": "6",}, "ldaps": {"type": "PortLiteral", "port": "636", "protocol": "6",}, "tcp/ldaps": {"type": "PortLiteral", "port": "636", "protocol": "6",}, "ldap": {"type": "PortLiteral", "port": "389", "protocol": "6",}, "tcp/ldap": {"type": "PortLiteral", "port": "389", "protocol": "6",}, "tcp/syslog": {"type": "PortLiteral", "port": "514", "protocol": "6",}, "udp/syslog": {"type": "PortLiteral", "port": "514", "protocol": "17",}, "tcp/domain": {"type": "PortLiteral", "port": "53", "protocol": "6", }, "udp/domain": {"type": "PortLiteral", "port": "53", "protocol": "17",}, "tcp/rsh": {"type": "PortLiteral", "port": "514", "protocol": "6",}, "icmp": {"type": "ICMPv4PortLiteral", "protocol": "1", "icmpType": "Any",}, "any": [], }
57.24
82
0.490217
286dae799942d25528e620a011ce5d17032d1ce7
2,336
py
Python
deep-learning-lab-00/binlogreg.py
BalderOdinson/Deep-Learning-Lab
70786ff1be40fc829d64a644585c1d5683c76538
[ "MIT" ]
null
null
null
deep-learning-lab-00/binlogreg.py
BalderOdinson/Deep-Learning-Lab
70786ff1be40fc829d64a644585c1d5683c76538
[ "MIT" ]
null
null
null
deep-learning-lab-00/binlogreg.py
BalderOdinson/Deep-Learning-Lab
70786ff1be40fc829d64a644585c1d5683c76538
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Mon Mar 18 18:38:38 2019 @author: Oshikuru """ import numpy as np import matplotlib.pyplot as plt import random import data import pdb import IPython param_delta = 0.5 param_niter = 100 param_lambda = 0.01 def binlogreg_train(X,Y_): ''' Argumenti X: podatci, np.array NxD Y_: indeksi razreda, np.array Nx1 Povratne vrijednosti w, b: parametri logistike regresije ''' N = Y_.shape[0] D = X.shape[1] w = np.random.randn(D, 1) b = np.random.randn(1,1) Y__ = np.hsplit(Y_, 2)[1] # gradijentni spust (param_niter iteracija) for i in range(param_niter): # klasifikacijske mjere scores = np.dot(X, w) + b # N x 1 # vjerojatnosti razreda c_1 probs = np.abs((1 / (1 + np.exp(scores))) - Y__) # N x 1 # gubitak loss = - (1 / N) * np.sum(np.log(probs)) + param_lambda * np.linalg.norm(w) # scalar # dijagnostiki ispis if i % 10 == 0: print("iteration {}: loss {}".format(i, loss)) # derivacije gubitka po klasifikacijskim mjerama dL_dscores = np.exp(scores) / (1 + np.exp(scores)) - Y__ # N x 1 # gradijenti parametara grad_w = np.expand_dims((1 / N) * np.sum(dL_dscores * X, axis=0), axis=1) + param_lambda * (1 / (2 * np.linalg.norm(w))) * 2 * w # D x 1 grad_b = (1 / N) * np.sum(dL_dscores) # 1 x 1 # poboljani parametri w += -param_delta * grad_w b += -param_delta * grad_b return w,b if __name__=="__main__": np.random.seed(100) # get the training dataset X,Y_ = data.sample_gauss(2, 100) # train the model w,b = binlogreg_train(X, data.class_to_onehot(Y_)) # evaluate the model on the training dataset probs = binlogreg_classify(X, w,b) Y = probs>0.5 # report performance accuracy, recall, precision = data.eval_perf_binary(Y[:,-1], Y_) AP = data.eval_AP(Y_) print (accuracy, recall, precision, AP) # graph the decision surface rect=(np.min(X, axis=0), np.max(X, axis=0)) data.graph_surface(lambda x: binlogreg_classify(x,w,b), rect, offset=0.5) # graph the data points data.graph_data(X, Y_, Y[:,-1], special=[]) plt.show()
24.851064
141
0.610445
286e9cde8312920eabbf75c1a2872023f23ceb28
778
py
Python
LintCode/1103.py
RENHANFEI/LintCode
d572dee248ba4c2a95b52cd737d76c7297f4e7b4
[ "CNRI-Python" ]
null
null
null
LintCode/1103.py
RENHANFEI/LintCode
d572dee248ba4c2a95b52cd737d76c7297f4e7b4
[ "CNRI-Python" ]
null
null
null
LintCode/1103.py
RENHANFEI/LintCode
d572dee248ba4c2a95b52cd737d76c7297f4e7b4
[ "CNRI-Python" ]
null
null
null
from collections import Counter
25.933333
71
0.417738
286fb0783887ca84bf84591d7e276b7bf74e2f66
2,867
py
Python
safe_eval/default_rules.py
bentheiii/safe_eval
caf9e7a6df3d6029e4bdac2abe11326d55c09ed2
[ "MIT" ]
1
2021-05-16T17:24:05.000Z
2021-05-16T17:24:05.000Z
safe_eval/default_rules.py
bentheiii/safe_eval
caf9e7a6df3d6029e4bdac2abe11326d55c09ed2
[ "MIT" ]
null
null
null
safe_eval/default_rules.py
bentheiii/safe_eval
caf9e7a6df3d6029e4bdac2abe11326d55c09ed2
[ "MIT" ]
null
null
null
from _ast import In, NotIn, Is, IsNot from collections import deque, Counter from decimal import Decimal from fractions import Fraction from safe_eval.rules import BinOpRule, CallableTypeRule, CallableRule, GetattrTypeRule, CallableMethodRule k_view_type = type({}.keys()) v_view_type = type({}.values()) it_view_type = type({}.items()) trusted_iterator_types = set( type(iter(t())) for t in (str, tuple, bytes, list, set, frozenset, dict, deque, Counter) ) trusted_iterator_types.update(( type(iter({}.keys())), type(iter({}.values())), type(iter({}.items())), type(iter(range(0))), )) immutable_trusted = frozenset((int, bool, float, str, complex, frozenset, tuple, Decimal, Fraction, bytes, type(None), type(...), type(NotImplemented), object, range)) mutable_trusted = frozenset((list, set, dict, k_view_type, v_view_type, it_view_type, Exception, NameError, ValueError, LookupError, KeyError, TypeError, deque, Counter, *trusted_iterator_types)) trusted_types = immutable_trusted | mutable_trusted trusted_types |= trusted_iterator_types bin_op_trusted_types = trusted_types default_bin_rules = [ BinOpRule(..., op_set=(Is, IsNot)), BinOpRule(bin_op_trusted_types), BinOpRule(..., bin_op_trusted_types, (In, NotIn)) ] trusted_builtin_unary_funcs = frozenset(( abs, all, any, ascii, bin, bool, bytearray, bytes, chr, complex, dict, enumerate, float, format, frozenset, hasattr, hash, hex, int, iter, len, list, max, min, next, oct, property, range, repr, reversed, round, set, slice, sorted, str, sum, tuple, zip, )) safe_builtin_unary_funcs = frozenset(( id, callable, classmethod, ord, )) # todo a lot of functions are only fine if iteration is fine, do that default_callable_rules = [ CallableTypeRule(trusted_builtin_unary_funcs, trusted_types), CallableTypeRule(safe_builtin_unary_funcs, ...), CallableTypeRule(divmod, trusted_types, trusted_types), CallableRule((isinstance, issubclass), ..., trusted_types), CallableRule(object), CallableTypeRule(pow, trusted_types, trusted_types, trusted_types) ] imported_builtin_names = {*trusted_builtin_unary_funcs, *safe_builtin_unary_funcs, divmod, isinstance, issubclass, object, pow} default_namespace = {ibn.__name__: ibn for ibn in imported_builtin_names} default_attr_rules = [] _allow_method(str, str.join, trusted_types)
31.505495
118
0.702825
2870b3250a7dca1e04fe54265450ad0c248653be
6,745
py
Python
test/lib/mayaUsd/render/vp2RenderDelegate/testVP2RenderDelegatePointInstanceSelection.py
ika-rporter/maya-usd
8f216a4fb955fc44c0abda55caa53ed295aaa625
[ "Apache-2.0" ]
507
2019-07-30T20:05:10.000Z
2022-03-30T07:38:43.000Z
test/lib/mayaUsd/render/vp2RenderDelegate/testVP2RenderDelegatePointInstanceSelection.py
ika-rporter/maya-usd
8f216a4fb955fc44c0abda55caa53ed295aaa625
[ "Apache-2.0" ]
1,188
2019-07-31T11:27:27.000Z
2022-03-31T21:06:06.000Z
test/lib/mayaUsd/render/vp2RenderDelegate/testVP2RenderDelegatePointInstanceSelection.py
ika-rporter/maya-usd
8f216a4fb955fc44c0abda55caa53ed295aaa625
[ "Apache-2.0" ]
165
2019-07-30T22:27:57.000Z
2022-03-25T07:20:23.000Z
#!/usr/bin/env mayapy # # Copyright 2021 Autodesk # # 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 by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # 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. # import fixturesUtils import imageUtils import mayaUtils import usdUtils from mayaUsd import lib as mayaUsdLib from mayaUsd import ufe as mayaUsdUfe from maya import cmds import ufe import os if __name__ == '__main__': fixturesUtils.runTests(globals())
37.265193
100
0.697999
2871778d5e8e5178dee6f9e80da7e8ac737d84a0
5,443
py
Python
cy_widgets/strategy/exchange/base.py
cragod/CYWidgets
b1df1e32c363ed9252737d3041a7557b1dc604fe
[ "MIT" ]
1
2021-06-17T02:25:25.000Z
2021-06-17T02:25:25.000Z
cy_widgets/strategy/exchange/base.py
cragod/CYWidgets
b1df1e32c363ed9252737d3041a7557b1dc604fe
[ "MIT" ]
null
null
null
cy_widgets/strategy/exchange/base.py
cragod/CYWidgets
b1df1e32c363ed9252737d3041a7557b1dc604fe
[ "MIT" ]
1
2021-12-08T06:50:33.000Z
2021-12-08T06:50:33.000Z
# -*- coding: utf-8 -*- import numpy as np import talib as ta from abc import ABC, abstractproperty, abstractclassmethod, abstractmethod
35.344156
165
0.533346
287237c213c17fd114b9833d581d53122d6ad18d
492
py
Python
app/core/admin/__init__.py
3darkman/faction-builder-api
9dda323ef44a1ca0976306a4f20f9cc3e13704ec
[ "MIT" ]
null
null
null
app/core/admin/__init__.py
3darkman/faction-builder-api
9dda323ef44a1ca0976306a4f20f9cc3e13704ec
[ "MIT" ]
null
null
null
app/core/admin/__init__.py
3darkman/faction-builder-api
9dda323ef44a1ca0976306a4f20f9cc3e13704ec
[ "MIT" ]
null
null
null
from django.contrib import admin from core import models from .category import CategoryAdmin from .trait import TraitAdmin from .user import UserAdmin admin.site.register(models.User, UserAdmin) admin.site.register(models.Ability) admin.site.register(models.Category, CategoryAdmin) admin.site.register(models.Trait, TraitAdmin) admin.site.register(models.Domain) admin.site.register(models.FactionType) admin.site.register(models.CategorySlot) admin.site.register(models.StartingProfile)
28.941176
51
0.835366
287358c4458cfef128d6223f0355c87f498e047c
2,196
py
Python
src/predict_video_file.py
irfanmustafas/TeethClassifierCNN
8c58b50162b3f9eb7f12251cbca9fcbd4d6c43b7
[ "MIT" ]
1
2018-12-05T01:49:54.000Z
2018-12-05T01:49:54.000Z
src/predict_video_file.py
irfanmustafas/TeethClassifierCNN
8c58b50162b3f9eb7f12251cbca9fcbd4d6c43b7
[ "MIT" ]
null
null
null
src/predict_video_file.py
irfanmustafas/TeethClassifierCNN
8c58b50162b3f9eb7f12251cbca9fcbd4d6c43b7
[ "MIT" ]
null
null
null
import numpy as np import sys import caffe import glob import uuid import cv2 from util import transform_img from mouth_detector_dlib import mouth_detector from caffe.proto import caffe_pb2 import os import shutil from util import histogram_equalization from teeth_cnn import teeth_cnn mouth_detector_instance = mouth_detector() teeth_cnn_instance = teeth_cnn() size = cv2.getTextSize("Showing teeth", cv2.FONT_HERSHEY_PLAIN, 2, 1)[0] x,y = (50,250) # Define the codec and create VideoWriter object fourcc = cv2.cv.CV_FOURCC(*'mp4v') cap = cv2.VideoCapture('../elon.mp4') cap.set(1,19300); ret, frame = cap.read() #cv2.imshow('window_name', frame) # show frame on window w = cap.get(cv2.cv.CV_CAP_PROP_FRAME_WIDTH); h = cap.get(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT); out = cv2.VideoWriter('output_elon.avi',fourcc, 24, (int(w),int(h))) #cap.set(3,500) #cap.set(4,500) #cap.set(5,30) ret, frame = cap.read() while(cap.isOpened()): ret, frame = cap.read() copy_frame = frame.copy() result,prob,xf,yf,wf,hf = teeth_cnn_instance.predict(copy_frame,mouth_detector_instance) if result is not None: if(result == 1): cv2.rectangle(frame, (xf,yf),(wf,hf),(0,255,0),4,0) prob_round = prob[0][1]*100 print prob_round cv2.rectangle(frame, (xf-2,yf-25),(wf+2,yf),(0,255,0),-1,0) cv2.rectangle(frame, (xf-2,hf),(xf+((wf-xf)/2),hf+25),(0,255,0),-1,0) cv2.putText(frame, "Teeth!!",(xf,hf+14),cv2.FONT_HERSHEY_PLAIN,1.2,0,2) cv2.putText(frame, str(prob_round)+"%",(xf,yf-10),cv2.FONT_HERSHEY_PLAIN,1.2,0,2) #out.write(frame) print "SHOWING TEETH!!!" elif(result==0): cv2.rectangle(frame, (xf,yf),(wf,hf),(64,64,64),4,0) prob_round = prob[0][1]*100 print prob_round cv2.rectangle(frame, (xf-2,yf-25),(wf+2,yf),(64,64,64),-1,0) cv2.rectangle(frame, (xf-2,hf),(xf+((wf-xf)/2),hf+25),(64,64,64),-1,0) cv2.putText(frame, "Teeth??",(xf,hf+14),cv2.FONT_HERSHEY_PLAIN,1.2,0,2) cv2.putText(frame, str(prob_round)+"%",(xf,yf-10),cv2.FONT_HERSHEY_PLAIN,1.2,0,2) out.write(frame) cv2.imshow('frame',frame) if cv2.waitKey(200) & 0xFF == ord('q'): break cap.release() out.release() cv2.destroyAllWindows()
31.371429
89
0.679417
28738d283bf4868349454e25d748bec7dc9a9c6f
33,650
py
Python
sdk/python/pulumi_gcp/dataloss/prevention_deidentify_template.py
sisisin/pulumi-gcp
af6681d70ea457843409110c1324817fe55f68ad
[ "ECL-2.0", "Apache-2.0" ]
121
2018-06-18T19:16:42.000Z
2022-03-31T06:06:48.000Z
sdk/python/pulumi_gcp/dataloss/prevention_deidentify_template.py
sisisin/pulumi-gcp
af6681d70ea457843409110c1324817fe55f68ad
[ "ECL-2.0", "Apache-2.0" ]
492
2018-06-22T19:41:03.000Z
2022-03-31T15:33:53.000Z
sdk/python/pulumi_gcp/dataloss/prevention_deidentify_template.py
sisisin/pulumi-gcp
af6681d70ea457843409110c1324817fe55f68ad
[ "ECL-2.0", "Apache-2.0" ]
43
2018-06-19T01:43:13.000Z
2022-03-23T22:43:37.000Z
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities from . import outputs from ._inputs import * __all__ = ['PreventionDeidentifyTemplateArgs', 'PreventionDeidentifyTemplate'] class PreventionDeidentifyTemplate(pulumi.CustomResource): def __init__(__self__, resource_name: str, *args, **kwargs): resource_args, opts = _utilities.get_resource_args_opts(PreventionDeidentifyTemplateArgs, pulumi.ResourceOptions, *args, **kwargs) if resource_args is not None: __self__._internal_init(resource_name, opts, **resource_args.__dict__) else: __self__._internal_init(resource_name, *args, **kwargs) def _internal_init(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, deidentify_config: Optional[pulumi.Input[pulumi.InputType['PreventionDeidentifyTemplateDeidentifyConfigArgs']]] = None, description: Optional[pulumi.Input[str]] = None, display_name: Optional[pulumi.Input[str]] = None, parent: Optional[pulumi.Input[str]] = None, __props__=None): if opts is None: opts = pulumi.ResourceOptions() if not isinstance(opts, pulumi.ResourceOptions): raise TypeError('Expected resource options to be a ResourceOptions instance') if opts.version is None: opts.version = _utilities.get_version() if opts.id is None: if __props__ is not None: raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') __props__ = PreventionDeidentifyTemplateArgs.__new__(PreventionDeidentifyTemplateArgs) if deidentify_config is None and not opts.urn: raise TypeError("Missing required property 'deidentify_config'") __props__.__dict__["deidentify_config"] = deidentify_config __props__.__dict__["description"] = description __props__.__dict__["display_name"] = display_name if parent is None and not opts.urn: raise TypeError("Missing required property 'parent'") __props__.__dict__["parent"] = parent __props__.__dict__["name"] = None super(PreventionDeidentifyTemplate, __self__).__init__( 'gcp:dataloss/preventionDeidentifyTemplate:PreventionDeidentifyTemplate', resource_name, __props__, opts)
56.841216
422
0.624101
2874251d928931a6c2a13448e5d757c4351cb292
2,163
py
Python
examples/quickstart.py
miketlk/omfgp
6e5a0f52f2688d81bde3e5169a37311c9517fe1d
[ "MIT" ]
null
null
null
examples/quickstart.py
miketlk/omfgp
6e5a0f52f2688d81bde3e5169a37311c9517fe1d
[ "MIT" ]
null
null
null
examples/quickstart.py
miketlk/omfgp
6e5a0f52f2688d81bde3e5169a37311c9517fe1d
[ "MIT" ]
1
2021-08-16T10:19:52.000Z
2021-08-16T10:19:52.000Z
import sys import omfgp as gp import time if gp.USES_USCARD: import uscard from machine import Pin def get_default_reader(): """Return default smart card reader.""" if gp.USES_USCARD: return uscard.Reader(name="Smart card reader", ifaceId=2, ioPin=Pin.cpu.A2, clkPin=Pin.cpu.A4, rstPin=Pin.cpu.G10, presPin=Pin.cpu.C2, pwrPin=Pin.cpu.C5) else: return None def card_status(card: gp.card.GPCard) -> list: """Display all kinds of smart card status information returning file list :param card: instance of smart card interface :return: list of load file AID """ isd_status = card.get_status(gp.StatusKind.ISD) app_sd_status = card.get_status(gp.StatusKind.APP_SSD) file_mod_status = card.get_status(gp.StatusKind.LOAD_FILES_MOD) file_status = card.get_status(gp.StatusKind.LOAD_FILES) print("\n=== ISD status ===\n", isd_status, "\n") print("\n=== Apps and SDs ===\n", app_sd_status, "\n") print("\n=== Load files & modules ===\n", file_mod_status, "\n") print("\n=== Load files only ===\n", file_status, "\n") return [s.aid for s in file_status] if __name__ == '__main__': main()
32.283582
77
0.631993
28742e12e6739c290a95e278f025627ff9c82803
685
py
Python
basic/myunittest/test_timeit.py
fplust/python3-cookbook
0eaca2e3631bb69deaf466c32023bbb2093513da
[ "Apache-2.0" ]
1
2019-07-25T09:09:54.000Z
2019-07-25T09:09:54.000Z
basic/myunittest/test_timeit.py
fplust/python3-cookbook
0eaca2e3631bb69deaf466c32023bbb2093513da
[ "Apache-2.0" ]
null
null
null
basic/myunittest/test_timeit.py
fplust/python3-cookbook
0eaca2e3631bb69deaf466c32023bbb2093513da
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ Topic: Desc : """ from timeit import timeit __author__ = 'Xiong Neng' if __name__ == '__main__': main()
17.125
58
0.563504
28753e72046917448d518c1d4a909cdfe502ee60
7,276
py
Python
tectosaur2/hmatrix/tree.py
tbenthompson/BIE_tutorials
02cd56ab7e63e36afc4a10db17072076541aab77
[ "MIT" ]
15
2021-08-31T15:02:45.000Z
2022-02-11T21:10:01.000Z
tectosaur2/hmatrix/tree.py
tbenthompson/BIE_tutorials
02cd56ab7e63e36afc4a10db17072076541aab77
[ "MIT" ]
79
2021-08-29T15:35:39.000Z
2022-03-25T14:56:42.000Z
tectosaur2/hmatrix/tree.py
tbenthompson/BIE_tutorials
02cd56ab7e63e36afc4a10db17072076541aab77
[ "MIT" ]
3
2022-03-12T14:44:41.000Z
2022-03-21T20:43:20.000Z
from dataclasses import dataclass from typing import Optional import matplotlib.pyplot as plt import numpy as np def build_tree(pts, radii, min_pts_per_box=10): # The tree construction process receives three parameters: # # pts: the center of each element. # # radii: the radius of each element. Remember that we're dealing with spherical # approximations to elements here instead of the triangular elements # themselves. # # min_pts_per_box: this determines when we'll stop splitting. If a box has more # than min_pts_per_box elements, we keep splitting. # We'll start with the element indices in the order that they were given to this function. # build_tree_node will re-order these indices at each step to enforce the rule that # left child indices must be less than right child indices. ordered_idxs = np.arange(pts.shape[0]) # The rest of the tree construction process will be handled by the recursive function: # build_tree_node. The last two parameters are idx_start and idx_end. For the root of the # tree, we pass the full set of elements: (0, pts.shape[0]) root = build_tree_node(pts, radii, min_pts_per_box, ordered_idxs, 0, pts.shape[0]) return Tree(ordered_idxs, pts, radii, root) def build_tree_node( all_pts, all_radii, min_pts_per_box, ordered_idxs, idx_start, idx_end ): # 1) Collect the relevant element data. # A view into the ordered_idxs array for the elements we're working on here. idx_view = ordered_idxs[idx_start:idx_end] # And the center and radius of each element. pts = all_pts[idx_view] radii = all_radii[idx_view] # 2) Define the bounding box. box_center = np.mean(pts, axis=0) sep = pts - box_center[None, :] box_axis_length = np.max(sep, axis=0) box_radius = np.max(np.linalg.norm(sep, axis=1) + radii) # 3) Build the node # To start with, the left and right child are absent and is_leaf=True. # If the node is not a leaf, we'll overwrite these below. node = TreeNode( idx_start, idx_end, box_center, box_radius, is_leaf=True, left=None, right=None ) # 4) Return if the node is a leaf node. # If there are fewer than min_pts_per_box elements in this node, then we do not split. if idx_end - idx_start <= min_pts_per_box: return node # 5) If the node is not a leaf, split! # First, find which axis of the box is longest split_d = np.argmax(box_axis_length) # Then identify which elements are on the left hand side of the box along that axis. split_val = np.median(pts[:, split_d]) is_left = pts[:, split_d] < split_val # 6) Re-arrange indices. # Since we're going to re-arrange indices, we need to save the relevant indices first. left_idxs = idx_view[np.where(is_left)[0]].copy() right_idxs = idx_view[np.where(~is_left)[0]].copy() n_left = left_idxs.shape[0] # Then assign the left side indices to the beginning of our index block idx_view[:n_left] = left_idxs # And assign the right side indices to the end of our index block. idx_view[n_left:] = right_idxs # 7) Create children! idx_split = idx_start + n_left node.is_leaf = False # We recursively call build_tree_node here. The key difference between the left and right # sides is that the left receives the index block [idx_start, idx_split) and the right # receives the index block [idx_split, idx_end). Thus, we've created a smaller, equivalent # problem. node.left = build_tree_node( all_pts, all_radii, min_pts_per_box, ordered_idxs, idx_start, idx_split ) node.right = build_tree_node( all_pts, all_radii, min_pts_per_box, ordered_idxs, idx_split, idx_end ) return node def _traverse(obs_node, src_node, safety_factor, direct_list, approx_list): dist = np.linalg.norm(obs_node.center - src_node.center) if dist > safety_factor * (obs_node.radius + src_node.radius): # We're far away, use an approximate interaction approx_list.append((obs_node, src_node)) elif obs_node.is_leaf and src_node.is_leaf: # If we get here, then we can't split the nodes anymore but they are # still close. That means we need to use a exact interaction. direct_list.append((obs_node, src_node)) else: # We're close by, so we should recurse and use the child tree nodes. # But which node should we recurse with? split_src = ( (obs_node.radius < src_node.radius) and not src_node.is_leaf ) or obs_node.is_leaf if split_src: _traverse(obs_node, src_node.left, safety_factor, direct_list, approx_list) _traverse(obs_node, src_node.right, safety_factor, direct_list, approx_list) else: _traverse(obs_node.left, src_node, safety_factor, direct_list, approx_list) _traverse(obs_node.right, src_node, safety_factor, direct_list, approx_list) def traverse(obs_node, src_node, safety_factor=1.5): direct_list = [] approx_list = [] _traverse(obs_node, src_node, safety_factor, direct_list, approx_list) return direct_list, approx_list def check_tree(pts, radii, tree, node): if node is None: return True idxs = tree.ordered_idxs[node.idx_start : node.idx_end] dist = np.linalg.norm(pts[idxs] - node.center, axis=1) + radii[idxs] if np.any(dist > node.radius): return False else: return check_tree(pts, radii, tree, node.left) and check_tree( pts, radii, tree, node.right ) def plot_tree_level(node, depth, **kwargs): if depth == 0: circle = plt.Circle(tuple(node.center[:2]), node.radius, fill=False, **kwargs) plt.gca().add_patch(circle) if node.left is None or depth == 0: return else: plot_tree_level(node.left, depth - 1, **kwargs) plot_tree_level(node.right, depth - 1, **kwargs) def plot_tree(tree): plt.figure(figsize=(9, 9)) for depth in range(9): plt.subplot(3, 3, 1 + depth) plt.title(f"level = {depth}") plot_tree_level(tree.root, depth, color="b", linewidth=0.5) plt.xlim( [ tree.root.center[0] - tree.root.radius, tree.root.center[0] + tree.root.radius, ] ) plt.ylim( [ tree.root.center[1] - tree.root.radius, tree.root.center[1] + tree.root.radius, ] ) plt.tight_layout() plt.show()
35.149758
94
0.665063
2875e4f861693b2c0256a550012c98712e49a11c
644
py
Python
2017/day2/corruptionChecksum.py
madeleine-adams/advent_of_code_2020
8f142a91d1a40390aad274c5e0513f50b168d029
[ "MIT" ]
null
null
null
2017/day2/corruptionChecksum.py
madeleine-adams/advent_of_code_2020
8f142a91d1a40390aad274c5e0513f50b168d029
[ "MIT" ]
null
null
null
2017/day2/corruptionChecksum.py
madeleine-adams/advent_of_code_2020
8f142a91d1a40390aad274c5e0513f50b168d029
[ "MIT" ]
null
null
null
file = open('corruptionChecksum_input.txt', 'r') spreadsheet = file.readlines() checksum = 0 for line in spreadsheet: cells = line.split() minimum = find_smallest(cells) maximum = find_largest(cells) checksum += maximum - minimum print(checksum)
20.774194
48
0.636646
287609c52314ac1d737c0937fa4d8b3058a4d68f
3,579
py
Python
neurst/cli/inspect_checkpoint.py
ishine/neurst
2ba322393fcfed4261b33f4a657e12bbe321baaa
[ "Apache-2.0" ]
208
2020-11-12T03:56:41.000Z
2022-03-27T07:01:27.000Z
neurst/cli/inspect_checkpoint.py
ishine/neurst
2ba322393fcfed4261b33f4a657e12bbe321baaa
[ "Apache-2.0" ]
16
2021-02-20T07:57:03.000Z
2022-01-27T07:36:31.000Z
neurst/cli/inspect_checkpoint.py
ishine/neurst
2ba322393fcfed4261b33f4a657e12bbe321baaa
[ "Apache-2.0" ]
33
2020-11-12T04:44:50.000Z
2022-03-23T09:22:29.000Z
# Copyright 2020 ByteDance Inc. # # 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 by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # 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. import re import sys import tensorflow as tf from neurst.models.model_utils import _summary_model_variables from neurst.utils.compat import wrapper_var_name if __name__ == "__main__": cli_main()
41.137931
103
0.658843
28762253888319609860c7b7288acdb032a74ac2
1,621
py
Python
homepage/migrations/0005_professor_test_data.py
oriAdler/ClassRater
a68492ea8eab1475ab604da9d6efc99c73954d4b
[ "MIT" ]
1
2021-04-12T18:05:12.000Z
2021-04-12T18:05:12.000Z
homepage/migrations/0005_professor_test_data.py
ellaml/ClassRater
d786f9fb4bb51041590e46165badf12a7beef67e
[ "MIT" ]
103
2021-03-09T07:12:20.000Z
2021-05-23T06:13:21.000Z
homepage/migrations/0005_professor_test_data.py
ellaml/ClassRater
d786f9fb4bb51041590e46165badf12a7beef67e
[ "MIT" ]
17
2021-03-09T07:07:44.000Z
2021-05-02T16:31:45.000Z
from django.db import migrations, transaction
33.770833
76
0.595312
2876482aeef7877b4183338fac2e85b74a0eaedf
1,220
py
Python
scripts/hsvanalyzer.py
acmerobotics/relic-recovery
4ff05bbf906829aef0a98bc32691e5d0eadc1d8f
[ "MIT" ]
32
2018-01-17T03:00:02.000Z
2022-01-15T18:30:48.000Z
scripts/hsvanalyzer.py
acmerobotics/relic-recovery
4ff05bbf906829aef0a98bc32691e5d0eadc1d8f
[ "MIT" ]
4
2017-10-21T20:28:27.000Z
2018-04-02T05:27:00.000Z
scripts/hsvanalyzer.py
acmerobotics/relic-recovery
4ff05bbf906829aef0a98bc32691e5d0eadc1d8f
[ "MIT" ]
7
2018-02-21T00:59:20.000Z
2021-01-21T21:52:17.000Z
import cv2 import numpy as np from matplotlib import pyplot as plt from util import resize_min_dim, smart_hsv_range IMAGE_FILENAME = '/Users/ryanbrott/Desktop/36.jpg' MIN_DIMENSION = 480 # LOWER_HSV, UPPER_HSV = (170, 80, 0), (7, 255, 255) LOWER_HSV, UPPER_HSV = (175, 80, 80), (22, 255, 255) image = cv2.imread(IMAGE_FILENAME) image = resize_min_dim(image, MIN_DIMENSION) hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV) mask = smart_hsv_range(hsv, LOWER_HSV, UPPER_HSV) hue_hist = cv2.calcHist([hsv], [0], None, [180], [0, 180]) plt.gcf().canvas.set_window_title(IMAGE_FILENAME) plt.subplot(2, 3, 1) plt.plot(hue_hist) plt.xlim([0, 180]) plt.title('Hue Histogram') plt.subplot(2, 3, 2) plt.imshow(hsv[:,:,0], cmap=plt.cm.binary) plt.title('Hue') plt.subplot(2, 3, 4) plt.imshow(hsv[:,:,1], cmap=plt.cm.binary) plt.title('Saturation') plt.subplot(2, 3, 5) plt.imshow(hsv[:,:,2], cmap=plt.cm.binary) plt.title('Value') plt.subplot(2, 3, 3) plt.imshow(mask, cmap=plt.cm.binary) plt.title('Mask') mask_3c = np.zeros(image.shape, np.uint8) for i in range(3): mask_3c[:,:,i] = mask plt.subplot(2, 3, 6) plt.imshow(cv2.cvtColor(cv2.bitwise_and(image, mask_3c), cv2.COLOR_BGR2RGB)) plt.title('Image') plt.show()
23.461538
76
0.705738
2876ee5a4ee75e47b6a9d9c1abc057001acf18bc
1,114
py
Python
FEniCSUI/AnalysesHub/models.py
nasserarbabi/FEniCSUI-dev
f8f161e1b49932843e01301212e7d031fff4f6c8
[ "MIT" ]
null
null
null
FEniCSUI/AnalysesHub/models.py
nasserarbabi/FEniCSUI-dev
f8f161e1b49932843e01301212e7d031fff4f6c8
[ "MIT" ]
8
2021-03-10T21:59:52.000Z
2021-09-22T19:12:57.000Z
FEniCSUI/AnalysesHub/models.py
nasserarbabi/FEniCSUI
f8f161e1b49932843e01301212e7d031fff4f6c8
[ "MIT" ]
null
null
null
from django.db import models from dashboard.models import projects
23.208333
42
0.672352
2877efb3076b7e16a9739c3098ef12ad38d235d3
1,924
py
Python
code/pyto/util/test/_test_numpy_plus.py
anmartinezs/pyseg_system
5bb07c7901062452a34b73f376057cabc15a13c3
[ "Apache-2.0" ]
12
2020-01-08T01:33:02.000Z
2022-03-16T00:25:34.000Z
code/pyto/util/test/_test_numpy_plus.py
anmartinezs/pyseg_system
5bb07c7901062452a34b73f376057cabc15a13c3
[ "Apache-2.0" ]
8
2019-12-19T19:34:56.000Z
2022-03-10T10:11:28.000Z
code/pyto/util/test/_test_numpy_plus.py
anmartinezs/pyseg_system
5bb07c7901062452a34b73f376057cabc15a13c3
[ "Apache-2.0" ]
2
2022-03-30T13:12:22.000Z
2022-03-30T18:12:10.000Z
""" ToDo: convert to proper format Tests for modules in this directory """ from __future__ import print_function # Author: Vladan Lucic, last modified 05.04.07 import scipy import scipy.ndimage import numpy import pyto.util.numpy_plus as np_plus # define test arrays aa = numpy.arange(12, dtype='int32') aa = aa.reshape((3,4)) bb = numpy.arange(6, dtype='int32') bb = bb.reshape((2,3))
26.722222
73
0.572245
2878821e6aef46d6ef7a165e5a576c9bd3a04754
922
py
Python
GithubRepositoryStatistics-Python3/Repository.py
SmileZXLee/GithubRepositoryStatistics
62eeddd715aecf268c48b39aa596f1168a3c2661
[ "MIT" ]
1
2020-07-15T14:12:53.000Z
2020-07-15T14:12:53.000Z
GithubRepositoryStatistics-Python3/Repository.py
SmileZXLee/GithubRepositoryStatistics
62eeddd715aecf268c48b39aa596f1168a3c2661
[ "MIT" ]
null
null
null
GithubRepositoryStatistics-Python3/Repository.py
SmileZXLee/GithubRepositoryStatistics
62eeddd715aecf268c48b39aa596f1168a3c2661
[ "MIT" ]
null
null
null
#coding=utf-8 __author__ = 'zxlee' __github__ = 'https://github.com/SmileZXLee/GithubRepositoryStatistics'
26.342857
87
0.627983
287c433b713a1b08f3c14e17afb0adcebbc1cab6
3,242
py
Python
src/www/__init__.py
jbrezmorf/codecritic
190df65f2f12667469b55abed48a45de5dc18965
[ "MIT" ]
null
null
null
src/www/__init__.py
jbrezmorf/codecritic
190df65f2f12667469b55abed48a45de5dc18965
[ "MIT" ]
20
2019-05-26T12:13:19.000Z
2020-09-09T16:37:09.000Z
src/www/__init__.py
jbrezmorf/codecritic
190df65f2f12667469b55abed48a45de5dc18965
[ "MIT" ]
1
2020-04-13T09:02:48.000Z
2020-04-13T09:02:48.000Z
#!/bin/python3 # author: Jan Hybs import enum import pathlib from bson import objectid from flask import Flask, redirect, session, render_template, url_for import flask.json from flask_cors import CORS from loguru import logger from entities.crates import ICrate from env import Env from functools import wraps render_template_ext = render_template_base(Env=Env, version=Env.version) app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' app.root_path = Env.www app.json_encoder = CustomJSONEncoder cors = CORS(app) # @app.context_processor # def override_url_for(): # """ # Generate a new token on every request to prevent the browser from # caching static files. # """ # return dict(url_for=dated_url_for) # # # def dated_url_for(endpoint, **values): # if endpoint == 'static': # filename = values.get('filename', None) # if filename: # file_path = os.path.join(app.root_path, endpoint, filename) # values['q'] = int(os.stat(file_path).st_mtime) # return url_for(endpoint, **values)
25.936
82
0.612585
287d78c0342acb7571ce49d00f17612456b0c4a2
18,740
py
Python
pages/getAltData.py
ngocuong0105/ts_webapp
4399862ead6eb2d0c993d36fffe14967984ad4b2
[ "MIT" ]
null
null
null
pages/getAltData.py
ngocuong0105/ts_webapp
4399862ead6eb2d0c993d36fffe14967984ad4b2
[ "MIT" ]
null
null
null
pages/getAltData.py
ngocuong0105/ts_webapp
4399862ead6eb2d0c993d36fffe14967984ad4b2
[ "MIT" ]
null
null
null
import base64 from collections import deque from io import BytesIO import os import time from PIL import Image import pandas as pd from pandas.core.arrays import boolean import praw import requests import streamlit as st import datetime import pytesseract pytesseract.pytesseract.tesseract_cmd ='context/tesseract' import tweepy from framework.page import Page from framework.utils import markdown_css, click_button
44.513064
143
0.596265
287d866f9124af9905e3876a7fc982e255ffcb59
157
py
Python
npt/pipelines/__init__.py
chbrandt/npt
7d58db9987c8f4d93c4e61e1fc98cce38733d06e
[ "MIT" ]
null
null
null
npt/pipelines/__init__.py
chbrandt/npt
7d58db9987c8f4d93c4e61e1fc98cce38733d06e
[ "MIT" ]
2
2022-02-18T16:38:13.000Z
2022-02-18T16:56:33.000Z
npt/pipelines/__init__.py
chbrandt/npt
7d58db9987c8f4d93c4e61e1fc98cce38733d06e
[ "MIT" ]
1
2022-03-15T09:03:51.000Z
2022-03-15T09:03:51.000Z
from npt import log from . import search as Search from . import download as Download from . import processing as Processing from . import mosaic as Mosaic
22.428571
38
0.789809
287f3fa6bbdc5def4722251d903f7d2865df6fbb
324
py
Python
config.py
Shutey/ShuteyBot2.0
16f0baf6e8725bb452cac06fa60d6db023212f6c
[ "MIT" ]
2
2020-04-23T00:52:06.000Z
2020-04-23T00:56:24.000Z
config.py
Shutey/ShuteyBot2.0
16f0baf6e8725bb452cac06fa60d6db023212f6c
[ "MIT" ]
null
null
null
config.py
Shutey/ShuteyBot2.0
16f0baf6e8725bb452cac06fa60d6db023212f6c
[ "MIT" ]
null
null
null
token = 'Mzc5NTc3MDc1NTU3NzI4MjU2.DXixQA.DLLB8b81nSyB1IGNJ6WeEeukAQU' #Put Your bots token here prefix = '^^' #put prefix here link = 'https://discordapp.com/oauth2/authorize?client_id=379577075557728256&scope=bot&permissions=134659080' #put bot invite link here ownerid = '227860415709708288' #put your id here
36
136
0.774691
2881d51b1365029af80a4c7b248cb3bb598a7958
3,466
py
Python
frispy/throw_data.py
carrino/FrisPy
db9e59f465ee25d1c037d580c37da8f35b930b50
[ "MIT" ]
null
null
null
frispy/throw_data.py
carrino/FrisPy
db9e59f465ee25d1c037d580c37da8f35b930b50
[ "MIT" ]
null
null
null
frispy/throw_data.py
carrino/FrisPy
db9e59f465ee25d1c037d580c37da8f35b930b50
[ "MIT" ]
null
null
null
# Copyright (c) 2021 John Carrino import struct from dataclasses import dataclass import numpy as np from scipy.spatial.transform import Rotation
35.731959
124
0.638777
288275f551eb96263ac0a6a9893bc8305effff9d
7,754
py
Python
test/test_hankelutils.py
hlatkydavid/vnmrjpy
48707a1000dc87e646e37c8bd686e695bd31a61e
[ "MIT" ]
null
null
null
test/test_hankelutils.py
hlatkydavid/vnmrjpy
48707a1000dc87e646e37c8bd686e695bd31a61e
[ "MIT" ]
null
null
null
test/test_hankelutils.py
hlatkydavid/vnmrjpy
48707a1000dc87e646e37c8bd686e695bd31a61e
[ "MIT" ]
null
null
null
import unittest import vnmrjpy as vj import numpy as np import matplotlib.pyplot as plt import time #import cupy as cp RP={'rcvrs':4,'filter_size':(11,7),'virtualcoilboost':False} PLOTTING = False
39.969072
79
0.596595
2883fadc5c01ff1f187f68ba84f5e3ae0a52978b
1,057
py
Python
src/archive/test3.py
felipearcaro/indexing-repository-python
4fa504d3535495b30db443cc753ebc56e7e329c2
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
src/archive/test3.py
felipearcaro/indexing-repository-python
4fa504d3535495b30db443cc753ebc56e7e329c2
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
src/archive/test3.py
felipearcaro/indexing-repository-python
4fa504d3535495b30db443cc753ebc56e7e329c2
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
#setup import docx2txt # extract text text = docx2txt.process("../documents/ambev.docx") text2 = docx2txt.process("../documents/ambev2.docx") text3 = docx2txt.process("../documents/ambev3.docx") from whoosh.fields import Schema, TEXT schema = Schema(title=TEXT, content=TEXT) import os, os.path from whoosh import index if not os.path.exists("indexdir"): os.mkdir("indexdir") ix = index.create_in("indexdir", schema) #indexando arquivos ix = index.open_dir("indexdir") writer = ix.writer() writer.add_document(title=u"ambev", content=text) writer.add_document(title=u"gleidson", content=text2) writer.add_document(title=u"gleidson", content=text3) writer.add_document(title=u"sato", content=u"thiago") writer.commit() #buscando with ix.searcher() as searcher: searcher = ix.searcher() from whoosh.query import * myquery = And([Term("content", u"chamorro")) from whoosh.qparser import QueryParser parser = QueryParser("content", ix.schema) myquery = parser.parse(querystring) results = searcher.search(myquery) print(len(results))
24.581395
53
0.746452
28846fa1c1e9c7ab3ae95eddc73455be7f366a02
196
py
Python
Source Code/web/backend/files_app/fileapi/urls.py
creosB/Virtual-pdf-library
edb334b16dfd0d3c616683f6fbb370e54f489560
[ "CC0-1.0" ]
11
2021-12-20T01:51:56.000Z
2022-01-01T10:17:47.000Z
Source Code/web/backend/files_app/fileapi/urls.py
creosB/Virtual-pdf-library
edb334b16dfd0d3c616683f6fbb370e54f489560
[ "CC0-1.0" ]
null
null
null
Source Code/web/backend/files_app/fileapi/urls.py
creosB/Virtual-pdf-library
edb334b16dfd0d3c616683f6fbb370e54f489560
[ "CC0-1.0" ]
1
2021-12-21T08:47:56.000Z
2021-12-21T08:47:56.000Z
from django.urls import path from .views import FileList, FileDetail urlpatterns = [ path('',FileList.as_view()), path('<int:pk>/',FileDetail.as_view()), # individual items from django ]
24.5
74
0.704082
288538cbd5c881814ddd71394b3b7fcabde021bf
4,427
py
Python
barcodes/generateBarcodes.py
sbarton272/AcousticBarcodes-Explorations
73f019228988727575af7d67d1b7c7119f6c49a6
[ "MIT" ]
null
null
null
barcodes/generateBarcodes.py
sbarton272/AcousticBarcodes-Explorations
73f019228988727575af7d67d1b7c7119f6c49a6
[ "MIT" ]
null
null
null
barcodes/generateBarcodes.py
sbarton272/AcousticBarcodes-Explorations
73f019228988727575af7d67d1b7c7119f6c49a6
[ "MIT" ]
null
null
null
""" Generate barcode images with various encodings TODO - Include text at bottom - DXF instead """ #======================================================== # Imports #======================================================== from dxfwrite import DXFEngine as dxf #======================================================== # Constants #======================================================== START_BAND = [1,1] STOP_BAND = [0,1] #======================================================== # Hamming Codes #======================================================== #======================================================== # Barcode drawer #======================================================== #======================================================== # Parse options #======================================================== if __name__ == '__main__': codes = [[1,1,1],[0,0,0],[0,1,0],[1,0,1]] width = 15 height = 20 unit = 1 notchWidth = [.3,.5] for code in codes: codeStr = ''.join(map(str,code)) for n in notchWidth: filename = 'code' + codeStr + '-notch' + str(n) + '-len' + str(unit) + '.dxf' drawer = BarcodeDrawer(code, width=width, height=height, unitWidth=unit, notchWidth=n, includeText=True) drawer.draw(filename)
29.125
98
0.483171
2887834c88b90ae4d29891c6021442f87fb025c0
110
py
Python
example/cheeseshop/apps/catalog/admin.py
sflems/django-constance
e177292c74cbf158c7218d8818d5d6c34b17eee1
[ "BSD-3-Clause" ]
899
2015-12-17T09:24:11.000Z
2022-03-31T15:57:53.000Z
example/cheeseshop/apps/catalog/admin.py
sflems/django-constance
e177292c74cbf158c7218d8818d5d6c34b17eee1
[ "BSD-3-Clause" ]
342
2015-12-27T11:07:44.000Z
2022-03-24T13:34:46.000Z
example/cheeseshop/apps/catalog/admin.py
sflems/django-constance
e177292c74cbf158c7218d8818d5d6c34b17eee1
[ "BSD-3-Clause" ]
213
2015-12-23T00:32:34.000Z
2022-03-17T17:04:57.000Z
from django.contrib import admin from cheeseshop.apps.catalog.models import Brand admin.site.register(Brand)
22
48
0.836364
28878c846aed485a7bc9a73365300409e1defb8b
672
py
Python
leetcode/editor/cn/FindKPairsWithSmallestSums.py
huangge1199/leet-code-python
5d01bbb6f12a495ea7ea0a90b5b3b4aa92bcc2f7
[ "Apache-2.0" ]
1
2022-02-12T13:55:41.000Z
2022-02-12T13:55:41.000Z
leetcode/editor/cn/FindKPairsWithSmallestSums.py
huangge1199/leet-code-python
5d01bbb6f12a495ea7ea0a90b5b3b4aa92bcc2f7
[ "Apache-2.0" ]
null
null
null
leetcode/editor/cn/FindKPairsWithSmallestSums.py
huangge1199/leet-code-python
5d01bbb6f12a495ea7ea0a90b5b3b4aa92bcc2f7
[ "Apache-2.0" ]
null
null
null
# 373: K # leetcode submit region begin(Prohibit modification and deletion) from heapq import heappop, heappush from typing import List # leetcode submit region end(Prohibit modification and deletion)
33.6
92
0.578869
288bed12c190fb35b526a110b53eefe990c1f7a5
2,505
py
Python
urls.py
Shakil-1501/Quizdjango
5e201d0f05ce2a49d36484009ff6032821365bc6
[ "MIT" ]
null
null
null
urls.py
Shakil-1501/Quizdjango
5e201d0f05ce2a49d36484009ff6032821365bc6
[ "MIT" ]
null
null
null
urls.py
Shakil-1501/Quizdjango
5e201d0f05ce2a49d36484009ff6032821365bc6
[ "MIT" ]
null
null
null
# Core Django imports. from django.urls import path from django.shortcuts import redirect, render # LMS app imports from lms.views.course.course_views import ( CourseListView,fetch_questions,compute_stats,display_lp,Edit_quiz,preview_quiz,fetch_questions_oneatatime,compute_html,enter_comment,quiz_lp ) from lms.views.dashboard.student.dashboard_views import ( DashboardHomeView, ) from lms.views.account.register_view import \ ( ActivateView, AccountActivationSentView, UserRegisterView, ) from lms.views.account.logout_view import UserLogoutView from lms.views.account.login_view import UserLoginView # Specifies the app name for name spacing. app_name = "lms" # lms/urls.py urlpatterns = [ # LMS URLS # # /home/ path( route='', view=CourseListView.as_view(), name='home' ), path('lms/course',compute_stats,name="compute_stats"), path('lms/quiz',fetch_questions_oneatatime,name="fetch_questions_oneatatime"), path('lms/quiz3',fetch_questions,name="fetch_questions"), path('lms/quizlp',quiz_lp,name="quiz_lp"), path('lms/quiz2',display_lp,name="display_lp"), path('admin/',Edit_quiz,name="Edit_quiz"), path('lms/quizs',preview_quiz,name="preview_quiz"), path('lms/file',compute_html,name="compute_html"), path('lms/enter_comment',enter_comment,name="enter_comment"), #path('quiz2', lambda request: render(request, 'templates/lms/quiz2.html')), # ACCOUNT URLS # # /account/login/ path( route='account/login/', view=UserLoginView.as_view(), name='login' ), # /account/login/ path( route='account/register/', view=UserRegisterView.as_view(), name='register' ), # /account/logout/ path( route='account/logout/', view=UserLogoutView.as_view(), name='logout' ), path(route='account_activation_sent/', view=AccountActivationSentView.as_view(), name='account_activation_sent' ), path(route='activate/<uidb64>/<token>/', view=ActivateView.as_view(), name='activate' ), # DASHBOARD URLS # # /author/dashboard/home/ path( route="student/dashboard/home/", view=DashboardHomeView.as_view(), name="dashboard_home" ), ]
22.567568
145
0.621956
288fb0e62147ed4c6a19e3faeb3476a5404525aa
270
py
Python
rasterio/errors.py
clembou/rasterio
57169c31dae04e1319b4c4b607345475a7122910
[ "BSD-3-Clause" ]
null
null
null
rasterio/errors.py
clembou/rasterio
57169c31dae04e1319b4c4b607345475a7122910
[ "BSD-3-Clause" ]
null
null
null
rasterio/errors.py
clembou/rasterio
57169c31dae04e1319b4c4b607345475a7122910
[ "BSD-3-Clause" ]
null
null
null
"""A module of errors."""
27
78
0.733333
2893612d9bb5f812e7e498a10ba625355b7d1dee
1,794
py
Python
clientV4.py
sekranmert/AWS-Arduino-SmartHomeSystem
80f4b6a5871fccb3bfc065d3fac5ba09feec525a
[ "MIT" ]
1
2021-06-24T14:24:39.000Z
2021-06-24T14:24:39.000Z
clientV4.py
sekranmert/AWS-Arduino-SmartHomeSystem
80f4b6a5871fccb3bfc065d3fac5ba09feec525a
[ "MIT" ]
null
null
null
clientV4.py
sekranmert/AWS-Arduino-SmartHomeSystem
80f4b6a5871fccb3bfc065d3fac5ba09feec525a
[ "MIT" ]
null
null
null
import socket import threading helpMessage = '-q -- close connection\n-l -- list of connected devices\n-t -- server time \n-s "arduino/client ""reciever name" "message" -- send message (messages can be max 100 character) \nif reciever is an arduino board it can be controlled by this messsage:\n -s arduino "arduino name" led "0/1/status" \n' print("connecting...\n for command list write '-h' \n"+helpMessage) host = '127.0.0.1' # 127.0.0.1 for local port = 9999 # 9999 for local socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) socket.connect((host, port)) recvThread = threading.Thread(target=recvTh) sendThread = threading.Thread(target=sendTh) recvThread.start() sendThread.start()
32.618182
312
0.545151
289396e6e160ca17355478e692561082d33da8f2
3,885
py
Python
data_loader/data_loaders.py
ChunpingQiu/Sen2LCZ_CNN
5576567da658f945321280f37ff8d9bf46dd1818
[ "MIT" ]
null
null
null
data_loader/data_loaders.py
ChunpingQiu/Sen2LCZ_CNN
5576567da658f945321280f37ff8d9bf46dd1818
[ "MIT" ]
null
null
null
data_loader/data_loaders.py
ChunpingQiu/Sen2LCZ_CNN
5576567da658f945321280f37ff8d9bf46dd1818
[ "MIT" ]
1
2021-08-19T03:35:05.000Z
2021-08-19T03:35:05.000Z
from torchvision import datasets, transforms from base import BaseDataLoader from torch.utils.data import Dataset, DataLoader import pandas as pd import torch from skimage import io#, transform import numpy as np
32.647059
121
0.621107
28957d205b560942a43fe20af3ee47c7d8d34a15
591
py
Python
eval_predictions.py
uporwal/sigir-2019-ecom-challenge
bffa7f99930321ad5d86e0cddd3c9ddfb98ba3d2
[ "MIT" ]
7
2019-06-05T01:42:54.000Z
2020-07-31T04:31:47.000Z
eval_predictions.py
uporwal/sigir-2019-ecom-challenge
bffa7f99930321ad5d86e0cddd3c9ddfb98ba3d2
[ "MIT" ]
5
2019-06-09T15:11:47.000Z
2019-06-28T18:35:48.000Z
eval_predictions.py
uporwal/sigir-2019-ecom-challenge
bffa7f99930321ad5d86e0cddd3c9ddfb98ba3d2
[ "MIT" ]
5
2019-06-04T17:06:33.000Z
2021-01-15T11:14:43.000Z
import evaluation_script import argparse parser = argparse.ArgumentParser(description='Evaluation script used in the eBay SIGIR 2019 eCommerce Search Challenge.') parser.add_argument('-g', '--ground-truth-file', required=True, help="Ground truth file") parser.add_argument('-p', '--prediction-file', required=True, help="Prediction file") parser.add_argument('-d', '--document-file', required=False, default=None, help="Document file") args = parser.parse_args() r = evaluation_script.evaluate_submission(args.ground_truth_file, args.prediction_file, args.document_file) print(); print(r)
45.461538
121
0.781726
2895a62d74a6cf74dd272cfa08d6a6029b8f3434
48
py
Python
starfish/__main__.py
haoxusci/starfish
d7bd856024c75f2ce41504406f2a663566c3814b
[ "MIT" ]
164
2018-03-21T21:52:56.000Z
2022-03-23T17:14:39.000Z
starfish/__main__.py
lbgbox/starfish
0e879d995d5c49b6f5a842e201e3be04c91afc7e
[ "MIT" ]
1,728
2018-03-15T23:16:09.000Z
2022-03-12T00:09:18.000Z
starfish/__main__.py
lbgbox/starfish
0e879d995d5c49b6f5a842e201e3be04c91afc7e
[ "MIT" ]
66
2018-03-25T17:21:15.000Z
2022-01-16T09:17:11.000Z
from .core.starfish import starfish starfish()
12
35
0.791667
2896d0048b215dc837ae66958ce2ac38e7c770f9
968
py
Python
coreapp/migrations/0058_auto_20200426_1348.py
Quanscendence/braynai
ab828ca95571c6dffef2b2392522e6a4160a2304
[ "MIT" ]
null
null
null
coreapp/migrations/0058_auto_20200426_1348.py
Quanscendence/braynai
ab828ca95571c6dffef2b2392522e6a4160a2304
[ "MIT" ]
null
null
null
coreapp/migrations/0058_auto_20200426_1348.py
Quanscendence/braynai
ab828ca95571c6dffef2b2392522e6a4160a2304
[ "MIT" ]
null
null
null
# Generated by Django 2.2 on 2020-04-26 08:18 from django.db import migrations, models
29.333333
144
0.597107
2897d15751315f822719f939136b75871bf6ecab
1,431
py
Python
server/price_cache.py
pareeohnos/ktrade
1eaed1ff16ded580d5649c667935357567e7b514
[ "MIT" ]
5
2021-09-08T11:04:15.000Z
2021-11-27T08:42:23.000Z
server/price_cache.py
pareeohnos/ktrade
1eaed1ff16ded580d5649c667935357567e7b514
[ "MIT" ]
36
2021-08-31T09:28:10.000Z
2021-12-10T06:47:04.000Z
server/price_cache.py
pareeohnos/ktrade
1eaed1ff16ded580d5649c667935357567e7b514
[ "MIT" ]
2
2021-08-29T02:53:54.000Z
2021-08-29T06:21:36.000Z
import logging from server.singleton_meta import SingletonMeta log = logging.getLogger(__name__)
31.108696
81
0.714186
289918d2c57a6904734431ddd51bb10c97d644f6
499
py
Python
series_loop.py
Akshara2820/Python_WhileLoop
d525b547bc8c8236cb2cd1881080ec4e6604fffc
[ "MIT" ]
1
2021-09-15T03:42:15.000Z
2021-09-15T03:42:15.000Z
series_loop.py
Akshara2820/Python_WhileLoop
d525b547bc8c8236cb2cd1881080ec4e6604fffc
[ "MIT" ]
null
null
null
series_loop.py
Akshara2820/Python_WhileLoop
d525b547bc8c8236cb2cd1881080ec4e6604fffc
[ "MIT" ]
null
null
null
# (10,2,20,4,30,6,40,8,50) n=int(input("enter no--")) i=1 c=10 while i<=n: if i%2==0: c+=10 print(i,end=",") i+=1 i+=1 print(c,end=",") # (1+10=11, 11+20=31, 31+30=61, 61+40=101) n=int(input("enter no,-")) i=0 d=1 s=10 while i<n: print(d,end=",") d=d+s s+=10 i+=1 # (1+10=11, 11+20=31, 31+30=61, 61+40=101) n=int(input("enter no.==")) i=1 d=1 while i<=n: print(d,end=" ") d=d+10*i i+=1
12.794872
44
0.420842
289d03fd3a78072e9344f01958c2c279a5179efe
9,092
py
Python
modules/Manager.py
jurajkula/IBT
7b09f6d331433bfbf3e7955754a36b69b332bb4e
[ "MIT" ]
3
2019-05-16T18:54:49.000Z
2019-10-21T11:12:50.000Z
modules/Manager.py
jurajkula/IBT
7b09f6d331433bfbf3e7955754a36b69b332bb4e
[ "MIT" ]
null
null
null
modules/Manager.py
jurajkula/IBT
7b09f6d331433bfbf3e7955754a36b69b332bb4e
[ "MIT" ]
null
null
null
import os import time from os import mkdir from os.path import isdir from threading import Lock import cv2 import imutils from modules.Camera import Detect from modules.Camera.CameraHandler import CameraHandler from modules.Config import Config from modules.Fusion import Fusion from modules.Logger.Logger import Logger from modules.Radar.RadarHandler import RadarHandler
34.439394
114
0.478883
289e8099349c64172c6b2bf0ba568b861c6f1152
5,809
py
Python
train.py
okwrtdsh/3D-ResNets-PyTorch
f36a32ea8b283524d1d102937c49689b1f475b5f
[ "MIT" ]
null
null
null
train.py
okwrtdsh/3D-ResNets-PyTorch
f36a32ea8b283524d1d102937c49689b1f475b5f
[ "MIT" ]
null
null
null
train.py
okwrtdsh/3D-ResNets-PyTorch
f36a32ea8b283524d1d102937c49689b1f475b5f
[ "MIT" ]
null
null
null
import torch from torch.autograd import Variable import time import os import sys import numpy as np from utils import AverageMeter, calculate_accuracy, save_gif, accuracy from models.binarized_modules import binarizef
36.30625
88
0.484249
289f6d1cb4c2dff400bd79a40abc1c0e080f2635
477
py
Python
contact/views.py
ledomone/kurs_django
c24aaf8f8a22a695b41e2436bf9bf4d1ca665079
[ "MIT" ]
null
null
null
contact/views.py
ledomone/kurs_django
c24aaf8f8a22a695b41e2436bf9bf4d1ca665079
[ "MIT" ]
null
null
null
contact/views.py
ledomone/kurs_django
c24aaf8f8a22a695b41e2436bf9bf4d1ca665079
[ "MIT" ]
null
null
null
from django.contrib.contenttypes import fields from django.shortcuts import render from .forms import MessageForm, ContactForm from django.views.generic import DetailView, ListView, FormView
29.8125
63
0.740042
289fb47f080457beca96ad6fa33ec1f46323cf2b
6,506
py
Python
commands/misc/settings.py
ii-Python/Prism
a404a61ddb16d045aa29d81908ce4ad80b24e24d
[ "MIT" ]
6
2020-09-28T13:19:37.000Z
2021-07-13T10:37:22.000Z
commands/misc/settings.py
BenjaminGotBanned/Prism
a404a61ddb16d045aa29d81908ce4ad80b24e24d
[ "MIT" ]
2
2020-10-06T17:59:40.000Z
2020-10-06T20:12:39.000Z
commands/misc/settings.py
BenjaminGotBanned/Prism
a404a61ddb16d045aa29d81908ce4ad80b24e24d
[ "MIT" ]
3
2021-01-05T13:33:58.000Z
2021-07-13T10:37:37.000Z
# Modules import discord from datetime import date from discord import Embed from json import loads, dumps from assets.prism import Tools from discord.ext import commands # Main Command Class # Link to bot def setup(bot): bot.add_cog(Settings(bot))
29.306306
196
0.527206
28a230764b88abf38e3cb6d2f0cf4df9e3778896
970
py
Python
core/test.py
awesome-archive/muzero-pytorch
2ff4ea145097050031d6026f0aa1a97de72d702d
[ "MIT" ]
null
null
null
core/test.py
awesome-archive/muzero-pytorch
2ff4ea145097050031d6026f0aa1a97de72d702d
[ "MIT" ]
null
null
null
core/test.py
awesome-archive/muzero-pytorch
2ff4ea145097050031d6026f0aa1a97de72d702d
[ "MIT" ]
null
null
null
import torch from .mcts import MCTS, Node from .utils import select_action
31.290323
93
0.565979
28a386192b68f112112b6e68f5293867934e803f
167
py
Python
demo/deep_learning/base/second_stage_bounding_box_prediction/dcn_feature_calibration.py
jihuacao/Putil
b753fc94bea4cbda00f483681c55f0e9f54adef2
[ "Apache-2.0" ]
1
2018-12-09T06:09:29.000Z
2018-12-09T06:09:29.000Z
demo/deep_learning/base/second_stage_bounding_box_prediction/dcn_feature_calibration.py
jihuacao/Putil
b753fc94bea4cbda00f483681c55f0e9f54adef2
[ "Apache-2.0" ]
null
null
null
demo/deep_learning/base/second_stage_bounding_box_prediction/dcn_feature_calibration.py
jihuacao/Putil
b753fc94bea4cbda00f483681c55f0e9f54adef2
[ "Apache-2.0" ]
null
null
null
# coding=utf-8 import torch
20.875
60
0.712575
953703edf77bdad68e1e40c1a564d92c76b7a5a5
1,824
pyde
Python
listing_70/listing_70.pyde
tiranderel/2019-fall-polytech-cs
67f0482a0f143381f9b494a4348d6436ce8f8c1e
[ "MIT" ]
null
null
null
listing_70/listing_70.pyde
tiranderel/2019-fall-polytech-cs
67f0482a0f143381f9b494a4348d6436ce8f8c1e
[ "MIT" ]
null
null
null
listing_70/listing_70.pyde
tiranderel/2019-fall-polytech-cs
67f0482a0f143381f9b494a4348d6436ce8f8c1e
[ "MIT" ]
null
null
null
import math ballArray_one=[] ballArray_two=[]
26.057143
75
0.533991
953906e1815512ae7854e463509fe51bfa7374f8
1,340
py
Python
src/carim_discord_bot/discord_client/member_count.py
schana/carim-discord-bot
c1f5e868404744667156af7ad6d244939998b5a2
[ "Apache-2.0" ]
14
2020-04-06T17:58:09.000Z
2022-02-28T13:29:35.000Z
src/carim_discord_bot/discord_client/member_count.py
schana/carim-discord-bot
c1f5e868404744667156af7ad6d244939998b5a2
[ "Apache-2.0" ]
48
2020-04-05T11:24:10.000Z
2021-03-10T08:12:19.000Z
src/carim_discord_bot/discord_client/member_count.py
schana/carim-discord-bot
c1f5e868404744667156af7ad6d244939998b5a2
[ "Apache-2.0" ]
12
2020-03-31T15:08:56.000Z
2021-09-07T17:54:49.000Z
import asyncio import logging import discord from carim_discord_bot import managed_service, config from carim_discord_bot.discord_client import discord_service log = logging.getLogger(__name__) service = None
31.162791
102
0.698507
953acd7416847beb9014f4f513c188884ed30577
567
py
Python
GAPullTest.py
wrashi/GAReport
b58fb1ef8a8984761ba417879aa52c4100c61a0b
[ "Unlicense" ]
null
null
null
GAPullTest.py
wrashi/GAReport
b58fb1ef8a8984761ba417879aa52c4100c61a0b
[ "Unlicense" ]
null
null
null
GAPullTest.py
wrashi/GAReport
b58fb1ef8a8984761ba417879aa52c4100c61a0b
[ "Unlicense" ]
null
null
null
#!/usr/bin/env python3 from GAReport import GAReport VIEW_ID = 'PutViewIDHere' DIMENSIONS = ["Page", ] METRICS = ["Pageviews", "Unique Pageviews", "Avg. Time on Page", "Entrances", "Bounce Rate", "% Exit", "Page Value"] # Use these instructions for creating single and multiple filters: https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters FILTERS= "ga:pagePath=~news" report = GAReport(startdate="yesterday", enddate="yesterday", viewID=VIEW_ID, dimensions=DIMENSIONS, metrics=METRICS, filters=FILTERS) print(report.df.head(3))
43.615385
153
0.75485
953ca9b5b1450ae6da266d252be6ca5bb7c74e70
14,525
py
Python
model.py
coolEphemeroptera/AESRC2020
b64cdeeaaf74e8c1a741930b3a47dc8dcadca8de
[ "Apache-2.0" ]
35
2020-09-26T13:40:16.000Z
2022-03-22T19:42:20.000Z
model.py
coolEphemeroptera/ARNet
b64cdeeaaf74e8c1a741930b3a47dc8dcadca8de
[ "Apache-2.0" ]
4
2021-04-10T13:05:52.000Z
2022-03-14T03:22:32.000Z
model.py
coolEphemeroptera/ARNet
b64cdeeaaf74e8c1a741930b3a47dc8dcadca8de
[ "Apache-2.0" ]
7
2020-09-26T15:52:45.000Z
2021-06-11T05:05:23.000Z
from resnet import resnet18_,resnet34_,resnet50_,resnet101_, resnet152_ from keras.layers import Input, Dense, Lambda,Dropout,Conv2D,Activation,Bidirectional,GlobalAveragePooling1D,\ BatchNormalization,Reshape from keras_layer_normalization import LayerNormalization from keras.layers.cudnn_recurrent import CuDNNGRU,CuDNNLSTM from keras.models import Model from keras import backend as K from keras.regularizers import l2 from keras.constraints import unit_norm from keras.utils import multi_gpu_model from keras.optimizers import Adam import losses as ls import VLAD as vd """ ========================= Layers ========================= """ """ ========================= ctc constructors ========================= """ """ ========================= NetVLAD ========================= """ """ ========================= AR Module ========================= """ """ ========================= Model ========================= """ """ ====================== OTHER ====================== """ if __name__=="__main__": model,train_model = SAR_Net(input_shape=(1200,80,1), ctc_enable = True, ar_enable = True, disc_enable = True, res_type="res18", res_filters=32, hidden_dim=256, bn_dim=0, bpe_classes=1000, accent_classes=8, max_ctc_len=72, mto='vlad', vlad_clusters=8, ghost_clusters=2, metric_loss='cosface', margin=0.3, raw_model=None, lr=0.01, gpus = 1, name=None) sub_model(model,'x_data','y_accent') model.save_weights('exp/demo.h5') model.load_weights('exp/demo.h5')
34.748804
112
0.497969
953d34fa43582a04419407658a07c6d2cffc68aa
187
py
Python
tests/strategies/__init__.py
lycantropos/rsrc_web
6702840befa4fa70114ce10543144410b453aa30
[ "MIT" ]
null
null
null
tests/strategies/__init__.py
lycantropos/rsrc_web
6702840befa4fa70114ce10543144410b453aa30
[ "MIT" ]
4
2019-06-18T18:36:50.000Z
2019-07-10T13:14:48.000Z
tests/strategies/__init__.py
lycantropos/rsrc_web
6702840befa4fa70114ce10543144410b453aa30
[ "MIT" ]
null
null
null
from .literals import booleans from .models import (readable_web_streams, web_streams, writeable_web_streams) from .paths import web_url_strings
31.166667
43
0.663102
953d79768caec877a768ca7a6b3a2fc0176266ec
27,309
py
Python
main.py
ruotianluo/neural-summ-cnndm-pytorch
027b63107b748bc56356bd119b243cfdda684aa2
[ "MIT" ]
3
2018-10-22T23:03:40.000Z
2018-10-23T09:45:32.000Z
main.py
ruotianluo/neural-summ-cnndm-pytorch
027b63107b748bc56356bd119b243cfdda684aa2
[ "MIT" ]
null
null
null
main.py
ruotianluo/neural-summ-cnndm-pytorch
027b63107b748bc56356bd119b243cfdda684aa2
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- import os cudaid = 0 os.environ["CUDA_VISIBLE_DEVICES"] = str(cudaid) import sys import time import numpy as np import cPickle as pickle import copy import random from random import shuffle import math import torch import torch.nn as nn from torch.autograd import Variable import data as datar from model import * from utils_pg import * from configs import * cfg = DeepmindConfigs() TRAINING_DATASET_CLS = DeepmindTraining TESTING_DATASET_CLS = DeepmindTesting if __name__ == "__main__": np.set_printoptions(threshold = np.inf) existing_model_name = sys.argv[1] if len(sys.argv) > 1 else None run(existing_model_name)
40.397929
211
0.587462
953e614df603a782bc861b2188ed97f796d8d6d2
471
py
Python
openbook_posts/migrations/0016_auto_20190214_1525.py
TamaraAbells/okuna-api
f87d8e80d2f182c01dbce68155ded0078ee707e4
[ "MIT" ]
164
2019-07-29T17:59:06.000Z
2022-03-19T21:36:01.000Z
openbook_posts/migrations/0016_auto_20190214_1525.py
TamaraAbells/okuna-api
f87d8e80d2f182c01dbce68155ded0078ee707e4
[ "MIT" ]
188
2019-03-16T09:53:25.000Z
2019-07-25T14:57:24.000Z
openbook_posts/migrations/0016_auto_20190214_1525.py
TamaraAbells/okuna-api
f87d8e80d2f182c01dbce68155ded0078ee707e4
[ "MIT" ]
80
2019-08-03T17:49:08.000Z
2022-02-28T16:56:33.000Z
# Generated by Django 2.1.5 on 2019-02-14 14:25 from django.db import migrations import imagekit.models.fields
23.55
108
0.641189
953e8e8b09e196ff5d7362c6a2eeb02c08425111
15,517
py
Python
blackjack.py
hackerboy9/blackjack
1346642e353719ab68c0dc3573aa33b688431bf8
[ "MIT" ]
null
null
null
blackjack.py
hackerboy9/blackjack
1346642e353719ab68c0dc3573aa33b688431bf8
[ "MIT" ]
1
2020-10-25T10:16:37.000Z
2020-10-25T10:16:37.000Z
blackjack.py
hackerboy9/blackjack
1346642e353719ab68c0dc3573aa33b688431bf8
[ "MIT" ]
2
2017-07-16T08:00:29.000Z
2020-10-06T14:48:18.000Z
from collections import MutableMapping, MutableSet, namedtuple from operator import itemgetter NULL = Node(None, None, None, False) from unittest import TestCase
29.783109
82
0.566475
9540c7d295e0a61b349ecd6b4bc768783ff0138e
45,052
py
Python
ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/linkOAM_template.py
OpenIxia/ixnetwork_restpy
f628db450573a104f327cf3c737ca25586e067ae
[ "MIT" ]
20
2019-05-07T01:59:14.000Z
2022-02-11T05:24:47.000Z
ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/linkOAM_template.py
OpenIxia/ixnetwork_restpy
f628db450573a104f327cf3c737ca25586e067ae
[ "MIT" ]
60
2019-04-03T18:59:35.000Z
2022-02-22T12:05:05.000Z
ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/linkOAM_template.py
OpenIxia/ixnetwork_restpy
f628db450573a104f327cf3c737ca25586e067ae
[ "MIT" ]
13
2019-05-20T10:48:31.000Z
2021-10-06T07:45:44.000Z
from ixnetwork_restpy.base import Base from ixnetwork_restpy.files import Files
43.319231
202
0.715551
954146cbdea7e57641fc5a1ec374f381deb7f479
3,967
py
Python
memos/memos/users/forms.py
iotexpert/docmgr
735c7bcbaeb73bc44efecffb175f268f2438ac3a
[ "MIT" ]
null
null
null
memos/memos/users/forms.py
iotexpert/docmgr
735c7bcbaeb73bc44efecffb175f268f2438ac3a
[ "MIT" ]
null
null
null
memos/memos/users/forms.py
iotexpert/docmgr
735c7bcbaeb73bc44efecffb175f268f2438ac3a
[ "MIT" ]
null
null
null
from flask import current_app from flask_wtf import FlaskForm from flask_wtf.file import FileField, FileAllowed from wtforms import StringField, PasswordField, SubmitField, BooleanField from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError from flask_login import current_user from memos.models.User import User from memos.models.Memo import Memo from memos.models.MemoFile import MemoFile from memos.models.MemoSignature import MemoSignature
40.896907
98
0.659188
95419b554583bc803a43eac8c57ec34a913022a2
626
py
Python
app/models/encryption.py
janaSunrise/ZeroCOM
7197684ce708f080fe215b0a6e57c12836e4c0ab
[ "Apache-2.0" ]
6
2021-03-27T08:58:04.000Z
2021-05-23T17:07:09.000Z
app/models/encryption.py
janaSunrise/ZeroCOM
7197684ce708f080fe215b0a6e57c12836e4c0ab
[ "Apache-2.0" ]
2
2021-05-30T08:06:53.000Z
2021-06-02T17:02:06.000Z
app/models/encryption.py
janaSunrise/ZeroCOM
7197684ce708f080fe215b0a6e57c12836e4c0ab
[ "Apache-2.0" ]
null
null
null
import rsa
31.3
106
0.693291
954332209f4c21416110fe7a318ebf31b6100c2e
3,566
py
Python
Terminal_Bot.py
Data-Alchemy/Unix_Automation
3d5ee450e1b19f79509960f6d117c16fb8aa5313
[ "Apache-2.0" ]
null
null
null
Terminal_Bot.py
Data-Alchemy/Unix_Automation
3d5ee450e1b19f79509960f6d117c16fb8aa5313
[ "Apache-2.0" ]
null
null
null
Terminal_Bot.py
Data-Alchemy/Unix_Automation
3d5ee450e1b19f79509960f6d117c16fb8aa5313
[ "Apache-2.0" ]
null
null
null
import paramiko,time,sys,json,os,pandas ######################################################################################################################## ################################################### parms ############################################################# proxy = None Port = 22 Username = open('').read() #put username in txt file Pwd = open('').read() #put password in txt file Host = '' keys= '' #file with ssh keys sudo_user = '' #optional parameter fill in if using sudo option in function must be passed as full command ie: sudo su - user path = '' download_from = "" download_to = "" ## put commands one line at a time ## listofcommands=f''' ''' ######################################################################################################################## exec_remote_cmds(listofcommands,1,sudo_user)#sudo user is option must by passed as full sudo su - if used #write_file_to_remote(download_from,download_to,1,sudo_user) #download_remote_file(download_to,download_from,1)
37.93617
160
0.615536
95433e555cbe86270b9f0c26744b230b46b56f5a
825
py
Python
pnnl/models/__init__.py
rkini-pnnl/volttron-GS
60055438446a060176381468757ad0ec339f2371
[ "BSD-3-Clause" ]
1
2021-08-05T04:01:55.000Z
2021-08-05T04:01:55.000Z
pnnl/models/__init__.py
kevinatkinson-pnnl/volttron-GS
479c614a6f7cd779fcc208e8e35d27d0961a16f8
[ "BSD-3-Clause" ]
null
null
null
pnnl/models/__init__.py
kevinatkinson-pnnl/volttron-GS
479c614a6f7cd779fcc208e8e35d27d0961a16f8
[ "BSD-3-Clause" ]
null
null
null
import importlib import logging from volttron.platform.agent import utils _log = logging.getLogger(__name__) utils.setup_logging() __version__ = "0.1" __all__ = ['Model']
29.464286
73
0.65697
95446537feef632a16bbea1d71d8483703929711
826
py
Python
src/cli.py
thisistrivial/cr-draft
25defcf03466b044c28ad42661536e27b6df1222
[ "MIT" ]
null
null
null
src/cli.py
thisistrivial/cr-draft
25defcf03466b044c28ad42661536e27b6df1222
[ "MIT" ]
null
null
null
src/cli.py
thisistrivial/cr-draft
25defcf03466b044c28ad42661536e27b6df1222
[ "MIT" ]
null
null
null
import draft import os run()
22.944444
69
0.521792
9547e7b57fef282a81e3052edbdb2d34bb2cd61a
222
py
Python
src/honey.py
terror/golf
9d38f8376c2ddbbb34360a3353ec6f4289736bd4
[ "Unlicense" ]
null
null
null
src/honey.py
terror/golf
9d38f8376c2ddbbb34360a3353ec6f4289736bd4
[ "Unlicense" ]
null
null
null
src/honey.py
terror/golf
9d38f8376c2ddbbb34360a3353ec6f4289736bd4
[ "Unlicense" ]
null
null
null
# https://open.kattis.com/problems/honey print(*(lambda x: [x[int(input())] for _ in range(int(input()))])([1, 0, 6, 12, 90, 360, 2040, 10080, 54810, 290640, 1588356, 8676360, 47977776, 266378112, 1488801600]), sep="\n")
55.5
179
0.657658
954b661a558c8d594bb41be0460c68998860e06c
4,712
py
Python
plaso/parsers/winreg_plugins/usbstor.py
Defense-Cyber-Crime-Center/plaso
4f3a85fbea10637c1cdbf0cde9fc539fdcea9c47
[ "Apache-2.0" ]
2
2016-02-18T12:46:29.000Z
2022-03-13T03:04:59.000Z
plaso/parsers/winreg_plugins/usbstor.py
Defense-Cyber-Crime-Center/plaso
4f3a85fbea10637c1cdbf0cde9fc539fdcea9c47
[ "Apache-2.0" ]
null
null
null
plaso/parsers/winreg_plugins/usbstor.py
Defense-Cyber-Crime-Center/plaso
4f3a85fbea10637c1cdbf0cde9fc539fdcea9c47
[ "Apache-2.0" ]
6
2016-12-18T08:05:36.000Z
2021-04-06T14:19:11.000Z
# -*- coding: utf-8 -*- """File containing a Windows Registry plugin to parse the USBStor key.""" import logging from plaso.events import windows_events from plaso.lib import eventdata from plaso.parsers import winreg from plaso.parsers.winreg_plugins import interface __author__ = 'David Nides (david.nides@gmail.com)' winreg.WinRegistryParser.RegisterPlugin(USBStorPlugin)
39.266667
79
0.695034
9550103d22b0d4fa16de9bf491fa914c8ddf64fb
4,877
py
Python
musicbot/modules/default/helpmsg.py
oKidd/PrendeMusic
b66d54d93ed36587193c20b71201c4447d80ad85
[ "MIT" ]
5
2018-09-07T12:17:27.000Z
2019-12-06T02:35:26.000Z
musicbot/modules/default/helpmsg.py
oKidd/PrendeMusic
b66d54d93ed36587193c20b71201c4447d80ad85
[ "MIT" ]
null
null
null
musicbot/modules/default/helpmsg.py
oKidd/PrendeMusic
b66d54d93ed36587193c20b71201c4447d80ad85
[ "MIT" ]
2
2020-04-25T00:35:17.000Z
2021-05-13T22:20:19.000Z
from collections import defaultdict from discord.ext.commands import Cog, command from discord.utils import get from ...utils import check_restricted from ... import exceptions from ... import messagemanager cogs = [Help]
44.743119
204
0.568792
95515f6c6551928915064695c2fceeeba21d268c
8,710
py
Python
flatpak_update.py
willsALMANJ/flatpak_update
84a8f59a11952a5daf57a18f0426b676f3a707c2
[ "0BSD" ]
1
2020-06-12T07:51:32.000Z
2020-06-12T07:51:32.000Z
flatpak_update.py
willsALMANJ/flatpak_update
84a8f59a11952a5daf57a18f0426b676f3a707c2
[ "0BSD" ]
null
null
null
flatpak_update.py
willsALMANJ/flatpak_update
84a8f59a11952a5daf57a18f0426b676f3a707c2
[ "0BSD" ]
null
null
null
"Update a Flatpak repository for new versions of components" import argparse import asyncio import datetime from functools import total_ordering import hashlib from itertools import zip_longest import json from pathlib import Path import re import httpx import jinja2 import yaml GITHUB_DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ" async def get_version_scrape(spec): "Scrape raw HTML for version string regex to find latest version" matches = re.findall(spec["regex"], response.text) version = max(Version(m) for m in matches) return version def load_manifest(path): "Load json or yaml file" with path.open("r") as file_: if path.suffix == ".json": manifest = json.load(file_) else: manifest = yaml.load(file_, Loader=yaml.SafeLoader) return manifest def get_current_versions(manifest): "Parse versions from current Flatpak manifest" versions = {"runtime": Version(manifest["runtime-version"])} for module in manifest["modules"]: match = re.search(r"-([0-9\.]+)\.tar\.gz$", module["sources"][0]["url"]) versions[module["name"]] = Version(match.group(1)) return versions def get_template_vars(config, current_versions, new_versions, manifest): "Build up variables for jinja2 templates from version data" env = {} remote_sha256 = {} env["runtime_version"] = new_versions["runtime"] for spec in config["modules"]: name = spec["name"] env[f"{name}_version"] = new_versions[name] env[f"{name}_source_url"] = spec["source_url"].format( version=new_versions[name] ) env[f"{name}_version_date"] = new_versions[name].date if new_versions[name] > current_versions[name]: remote_sha256[name] = env[f"{name}_source_url"] else: for mod in manifest["modules"]: if mod["name"] == name: env[f"{name}_sha256"] = mod["sources"][0]["sha256"] new_sha256 = asyncio.run(get_sha256_set(remote_sha256)) env.update(**new_sha256) return env def render_templates(template_dir, env): "Render a .j2 templates using collected version information" for path in template_dir.glob("*.j2"): with path.open("r") as file_: template = jinja2.Template(file_.read()) with path.with_name(path.stem).open("w") as file_: file_.write(template.render(**env)) def parse_args(): "Parse command line arguments" parser = argparse.ArgumentParser() parser.add_argument("--config", "-c", required=True, help="Configuration file") parser.add_argument( "--manifest", "-m", required=True, help="Current flatpak manifest" ) parser.add_argument( "--template-dir", "-t", help="Directory with .j2 files to render" ) return parser.parse_args() def main(): "Main logic" args = parse_args() with open(args.config) as file_: config = yaml.load(file_, Loader=yaml.SafeLoader) new_versions = asyncio.run( get_latest_versions([config["runtime"]] + config["modules"]) ) manifest = load_manifest(Path(args.manifest)) current_versions = get_current_versions(manifest) env = get_template_vars(config, current_versions, new_versions, manifest) render_templates(Path(args.template_dir), env) if __name__ == "__main__": main()
30.138408
83
0.62721
955231e63fbff36ad8601f161f98440ad3a247cb
1,746
py
Python
base/env/test_processStrategy.py
stevenchen521/quant_ml
f7d5efc49c934724f97fcafacc560f4a35b24551
[ "MIT" ]
5
2019-02-14T03:12:22.000Z
2022-01-24T18:43:07.000Z
base/env/test_processStrategy.py
stevenchen521/quant_ml
f7d5efc49c934724f97fcafacc560f4a35b24551
[ "MIT" ]
null
null
null
base/env/test_processStrategy.py
stevenchen521/quant_ml
f7d5efc49c934724f97fcafacc560f4a35b24551
[ "MIT" ]
2
2019-11-13T18:56:13.000Z
2021-12-31T01:25:22.000Z
from unittest import TestCase import base.env.pre_process as pre_process import pandas as pd from sklearn.preprocessing import MinMaxScaler from helper.util import get_attribute from base.env.pre_process_conf import active_stragery, get_strategy_analyze import base.env.pre_process
38.8
143
0.708477
9552f2a3d627a440738e08b8175d69d9667e0003
12,194
py
Python
resources/lib/themoviedb/tmdb.py
bopopescu/ServerStatus
a883598248ad6f5273eb3be498e3b04a1fab6510
[ "MIT" ]
null
null
null
resources/lib/themoviedb/tmdb.py
bopopescu/ServerStatus
a883598248ad6f5273eb3be498e3b04a1fab6510
[ "MIT" ]
1
2015-04-21T22:05:02.000Z
2015-04-22T22:27:15.000Z
resources/lib/themoviedb/tmdb.py
GetSomeBlocks/Score_Soccer
a883598248ad6f5273eb3be498e3b04a1fab6510
[ "MIT" ]
2
2015-09-29T16:31:43.000Z
2020-07-26T03:41:10.000Z
#!/usr/bin/env python2.5 #encoding:utf-8 #author:dbr/Ben #project:themoviedb #forked by ccjensen/Chris #http://github.com/ccjensen/themoviedb """An interface to the themoviedb.org API """ __author__ = "dbr/Ben" __version__ = "0.2b" config = {} config['apikey'] = "a8b9f96dde091408a03cb4c78477bd14" config['urls'] = {} config['urls']['movie.search'] = "http://api.themoviedb.org/2.1/Movie.search/en/xml/%(apikey)s/%%s" % (config) config['urls']['movie.getInfo'] = "http://api.themoviedb.org/2.1/Movie.getInfo/en/xml/%(apikey)s/%%s" % (config) import urllib try: import xml.etree.cElementTree as ElementTree except ImportError: import elementtree.ElementTree as ElementTree # collections.defaultdict # originally contributed by Yoav Goldberg <yoav.goldberg@gmail.com> # new version by Jason Kirtland from Python cookbook. # <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/523034> try: from collections import defaultdict except ImportError: # [XX] to make pickle happy in python 2.4: import collections collections.defaultdict = defaultdict def search(name = None): """Convenience wrapper for MovieDb.search - so you can do.. >>> import tmdb >>> tmdb.search("Fight Club") <Search results: [<MovieResult: Fight Club (1999-09-16)>]> """ mdb = MovieDb() return mdb.search(name) def getMovieInfo(id = None): """Convenience wrapper for MovieDb.search - so you can do.. >>> import tmdb >>> tmdb.getMovieInfo(187) <MovieResult: Sin City (2005-04-01)> """ mdb = MovieDb() return mdb.getMovieInfo(id) def main(): results = search("Fight Club") searchResult = results[0] movie = getMovieInfo(searchResult['id']) print movie['name'] print "Producers:" for prodr in movie['cast']['Producer']: print " " * 4, prodr['name'] print movie['images'] for genreName in movie['categories']['genre']: print "%s (%s)" % (genreName, movie['categories']['genre'][genreName]) if __name__ == '__main__': main()
33.31694
142
0.586354
955351f42a772eb848c0ae2b75d5d28ba1ff2a00
3,033
py
Python
mir3/lib/knn.py
pymir3/pymir3
c1bcca66a5ef1ff0ebd6373e3820e72dee6b0b70
[ "MIT" ]
12
2015-08-03T12:41:11.000Z
2020-08-18T07:55:23.000Z
mir3/lib/knn.py
pymir3/pymir3
c1bcca66a5ef1ff0ebd6373e3820e72dee6b0b70
[ "MIT" ]
1
2015-05-27T18:47:20.000Z
2015-05-27T18:47:20.000Z
mir3/lib/knn.py
pymir3/pymir3
c1bcca66a5ef1ff0ebd6373e3820e72dee6b0b70
[ "MIT" ]
3
2016-03-18T03:30:02.000Z
2018-07-05T02:29:16.000Z
import numpy import numpy.linalg def distance_sum(inputs, references): """Sum of all distances between inputs and references Each element should be in a row! """ norms = numpy.zeros(inputs.shape[0]) for i in xrange(references.shape[0]): norms += numpy.apply_along_axis(numpy.linalg.norm, 1, inputs-references[i,:]) return norms def distance_min(inputs, references): """Minimum distances between inputs and any reference Each element should be in a row! """ norms = numpy.ones(inputs.shape[0])*99999999 for i in xrange(references.shape[0]): norms = numpy.minimum(norms, numpy.apply_along_axis(numpy.linalg.norm, 1, inputs-references[i,:])) return norms def distance_matrix(inputs): """Returns a distance matrix """ D = numpy.ones( (inputs.shape[0], inputs.shape[0]) )*99999999 for i in xrange(inputs.shape[0]): for j in xrange(i): D[i,j] = numpy.linalg.norm(inputs[i,:]-inputs[j,:]) D[j,i] = numpy.linalg.norm(inputs[i,:]-inputs[j,:]) return D def distance_mutual_min(inputs, references): """Distance using a mutual distance reference Inspired in: USING MUTUAL PROXIMITY TO IMPROVE CONTENT-BASED AUDIO SIMILARITY Dominik Schnitzer, Arthur Flexer, Markus Sched, Gerhard Widmer """ d = distance_matrix(inputs) a = distance_min(inputs, references) for i in xrange(len(a)): a[i] = a[i] - numpy.min(d[:,i]) return a def range_distance(inputs, references): """Minimum distance from boundaries of a rang """ mi = numpy.amin(references, 0) ma = numpy.amax(references, 0) norms = numpy.zeros(inputs.shape[0]) for i in xrange(inputs.shape[0]): for j in xrange(inputs.shape[1]): if (inputs[i,j] < mi[j]) or \ (inputs[i,j] > ma[j]): norms[i] += numpy.min([abs(inputs[i,j]-mi[j]),\ abs(inputs[i,j]-ma[j])])**2 norms[i] = norms[i]**(0.5) return norms def mutual_range_distance(inputs, references): """Minimum distance from boundaries of a range """ mi = numpy.amin(references, 0) ma = numpy.amax(references, 0) norms = numpy.zeros(inputs.shape[0]) d = distance_matrix(inputs) for i in xrange(inputs.shape[0]): for j in xrange(inputs.shape[1]): if (inputs[i,j] < mi[j]) or \ (inputs[i,j] > ma[j]): norms[i] += numpy.min([abs(inputs[i,j]-mi[j]),\ abs(inputs[i,j]-ma[j])])**2 norms[i] = norms[i]**(0.5) norms[i] = norms[i] - numpy.min(d[:,i]) return norms #a = numpy.array([[2, 4, 6], [4, 3, 2], [5, -2, -1], [10, 11, 12], [15, 20, 31]]) #b = numpy.array([[10, 11, 12], [-1, -2, -3]]) #print distance_sum(a, b) #print a #print b #print distance_min(a, b) #print distance_mutual_min(a, b)
31.59375
81
0.567755
9553b680206d84c135ef2d6c3b9397a51e5c12a9
17,984
py
Python
pysnmp/CABH-QOS2-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
11
2021-02-02T16:27:16.000Z
2021-08-31T06:22:49.000Z
pysnmp/CABH-QOS2-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
75
2021-02-24T17:30:31.000Z
2021-12-08T00:01:18.000Z
pysnmp/CABH-QOS2-MIB.py
agustinhenze/mibs.snmplabs.com
1fc5c07860542b89212f4c8ab807057d9a9206c7
[ "Apache-2.0" ]
10
2019-04-30T05:51:36.000Z
2022-02-16T03:33:41.000Z
# # PySNMP MIB module CABH-QOS2-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CABH-QOS2-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:26:31 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # ObjectIdentifier, OctetString, Integer = mibBuilder.importSymbols("ASN1", "ObjectIdentifier", "OctetString", "Integer") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ConstraintsUnion, ValueRangeConstraint, ValueSizeConstraint, ConstraintsIntersection, SingleValueConstraint = mibBuilder.importSymbols("ASN1-REFINEMENT", "ConstraintsUnion", "ValueRangeConstraint", "ValueSizeConstraint", "ConstraintsIntersection", "SingleValueConstraint") clabProjCableHome, = mibBuilder.importSymbols("CLAB-DEF-MIB", "clabProjCableHome") ifIndex, = mibBuilder.importSymbols("IF-MIB", "ifIndex") InetAddress, InetAddressType, InetPortNumber = mibBuilder.importSymbols("INET-ADDRESS-MIB", "InetAddress", "InetAddressType", "InetPortNumber") SnmpAdminString, = mibBuilder.importSymbols("SNMP-FRAMEWORK-MIB", "SnmpAdminString") ObjectGroup, ModuleCompliance, NotificationGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ObjectGroup", "ModuleCompliance", "NotificationGroup") MibIdentifier, iso, Bits, TimeTicks, MibScalar, MibTable, MibTableRow, MibTableColumn, Counter64, NotificationType, Integer32, Counter32, Gauge32, Unsigned32, ObjectIdentity, ModuleIdentity, IpAddress = mibBuilder.importSymbols("SNMPv2-SMI", "MibIdentifier", "iso", "Bits", "TimeTicks", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "Counter64", "NotificationType", "Integer32", "Counter32", "Gauge32", "Unsigned32", "ObjectIdentity", "ModuleIdentity", "IpAddress") RowStatus, TextualConvention, DisplayString, TimeStamp, TruthValue = mibBuilder.importSymbols("SNMPv2-TC", "RowStatus", "TextualConvention", "DisplayString", "TimeStamp", "TruthValue") cabhQos2Mib = ModuleIdentity((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8)) cabhQos2Mib.setRevisions(('2005-04-08 00:00',)) if mibBuilder.loadTexts: cabhQos2Mib.setLastUpdated('200504080000Z') if mibBuilder.loadTexts: cabhQos2Mib.setOrganization('CableLabs Broadband Access Department') cabhQos2Mib2Notifications = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 0)) cabhQos2MibObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1)) cabhQos2Base = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 1)) cabhQos2PsIfAttributes = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 2)) cabhQos2PolicyHolderObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3)) cabhQos2DeviceObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4)) cabhQos2SetToFactory = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 1, 1), TruthValue()).setMaxAccess("readwrite") if mibBuilder.loadTexts: cabhQos2SetToFactory.setStatus('current') cabhQos2LastSetToFactory = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 1, 2), TimeStamp()).setMaxAccess("readonly") if mibBuilder.loadTexts: cabhQos2LastSetToFactory.setStatus('current') cabhQos2PsIfAttribTable = MibTable((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 2, 1), ) if mibBuilder.loadTexts: cabhQos2PsIfAttribTable.setStatus('current') cabhQos2PsIfAttribEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 2, 1, 1), ).setIndexNames((0, "IF-MIB", "ifIndex")) if mibBuilder.loadTexts: cabhQos2PsIfAttribEntry.setStatus('current') cabhQos2PsIfAttribNumPriorities = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 2, 1, 1, 1), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: cabhQos2PsIfAttribNumPriorities.setStatus('current') cabhQos2PsIfAttribNumQueues = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 2, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 8))).setMaxAccess("readonly") if mibBuilder.loadTexts: cabhQos2PsIfAttribNumQueues.setStatus('current') cabhQos2PolicyHolderEnabled = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 1), TruthValue().clone('true')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cabhQos2PolicyHolderEnabled.setStatus('current') cabhQos2PolicyAdmissionControl = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("enabled", 1), ("disabled", 2))).clone('disabled')).setMaxAccess("readwrite") if mibBuilder.loadTexts: cabhQos2PolicyAdmissionControl.setStatus('current') cabhQos2NumActivePolicyHolder = MibScalar((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 3), Gauge32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readonly") if mibBuilder.loadTexts: cabhQos2NumActivePolicyHolder.setStatus('current') cabhQos2PolicyTable = MibTable((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4), ) if mibBuilder.loadTexts: cabhQos2PolicyTable.setStatus('current') cabhQos2PolicyEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1), ).setIndexNames((0, "CABH-QOS2-MIB", "cabhQos2PolicyOwner"), (0, "CABH-QOS2-MIB", "cabhQos2PolicyOwnerRuleId")) if mibBuilder.loadTexts: cabhQos2PolicyEntry.setStatus('current') cabhQos2PolicyOwner = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2, 3, 4))).clone(namedValues=NamedValues(("operatorOnly", 1), ("homeUser", 2), ("operatorForHomeUser", 3), ("upnp", 4)))) if mibBuilder.loadTexts: cabhQos2PolicyOwner.setStatus('current') cabhQos2PolicyOwnerRuleId = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: cabhQos2PolicyOwnerRuleId.setStatus('current') cabhQos2PolicyRuleOrder = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 4294967295))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyRuleOrder.setStatus('current') cabhQos2PolicyAppDomain = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 4), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyAppDomain.setStatus('current') cabhQos2PolicyAppName = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 5), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyAppName.setStatus('current') cabhQos2PolicyServiceProvDomain = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 6), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyServiceProvDomain.setStatus('current') cabhQos2PolicyServiceName = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 7), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyServiceName.setStatus('current') cabhQos2PolicyPortDomain = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 8), SnmpAdminString().subtype(subtypeSpec=ValueSizeConstraint(0, 32))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyPortDomain.setStatus('current') cabhQos2PolicyPortNumber = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 9), InetPortNumber()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyPortNumber.setStatus('current') cabhQos2PolicyIpType = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 10), InetAddressType().clone('ipv4')).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyIpType.setStatus('current') cabhQos2PolicyIpProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 11), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyIpProtocol.setStatus('current') cabhQos2PolicySrcIp = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 12), InetAddress().clone(hexValue="00000000")).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicySrcIp.setStatus('current') cabhQos2PolicyDestIp = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 13), InetAddress().clone(hexValue="00000000")).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyDestIp.setStatus('current') cabhQos2PolicySrcPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 14), InetPortNumber()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicySrcPort.setStatus('current') cabhQos2PolicyDestPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 15), InetPortNumber()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyDestPort.setStatus('current') cabhQos2PolicyTraffImpNum = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 16), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyTraffImpNum.setStatus('current') cabhQos2PolicyUserImportance = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 17), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 255))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyUserImportance.setStatus('current') cabhQos2PolicyRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 3, 4, 1, 18), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2PolicyRowStatus.setStatus('current') cabhQos2TrafficClassTable = MibTable((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1), ) if mibBuilder.loadTexts: cabhQos2TrafficClassTable.setStatus('current') cabhQos2TrafficClassEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1), ).setIndexNames((0, "CABH-QOS2-MIB", "cabhQos2TrafficClassMethod"), (0, "CABH-QOS2-MIB", "cabhQos2TrafficClassIdx")) if mibBuilder.loadTexts: cabhQos2TrafficClassEntry.setStatus('current') cabhQos2TrafficClassMethod = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 1), Integer32().subtype(subtypeSpec=ConstraintsUnion(SingleValueConstraint(1, 2))).clone(namedValues=NamedValues(("static", 1), ("upnp", 2)))) if mibBuilder.loadTexts: cabhQos2TrafficClassMethod.setStatus('current') cabhQos2TrafficClassIdx = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 2), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(1, 4294967295))) if mibBuilder.loadTexts: cabhQos2TrafficClassIdx.setStatus('current') cabhQos2TrafficClassProtocol = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 3), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 256))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2TrafficClassProtocol.setStatus('current') cabhQos2TrafficClassIpType = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 4), InetAddressType().clone('ipv4')).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2TrafficClassIpType.setStatus('current') cabhQos2TrafficClassSrcIp = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 5), InetAddress().clone(hexValue="00000000")).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2TrafficClassSrcIp.setStatus('current') cabhQos2TrafficClassDestIp = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 6), InetAddress().clone(hexValue="00000000")).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2TrafficClassDestIp.setStatus('current') cabhQos2TrafficClassSrcPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 7), InetPortNumber()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2TrafficClassSrcPort.setStatus('current') cabhQos2TrafficClassDestPort = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 8), InetPortNumber()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2TrafficClassDestPort.setStatus('current') cabhQos2TrafficClassImpNum = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 9), Unsigned32().subtype(subtypeSpec=ValueRangeConstraint(0, 7))).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2TrafficClassImpNum.setStatus('current') cabhQos2TrafficClassRowStatus = MibTableColumn((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 1, 4, 1, 1, 10), RowStatus()).setMaxAccess("readcreate") if mibBuilder.loadTexts: cabhQos2TrafficClassRowStatus.setStatus('current') cabhQos2Conformance = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 2)) cabhQos2Compliances = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 2, 1)) cabhQos2Groups = MibIdentifier((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 2, 2)) cabhQos2Compliance = ModuleCompliance((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 2, 1, 1)).setObjects(("CABH-QOS2-MIB", "cabhQos2Group"), ("CABH-QOS2-MIB", "cabhQos2ClassifierGroup")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cabhQos2Compliance = cabhQos2Compliance.setStatus('current') cabhQos2Group = ObjectGroup((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 2, 2, 1)).setObjects(("CABH-QOS2-MIB", "cabhQos2SetToFactory"), ("CABH-QOS2-MIB", "cabhQos2LastSetToFactory"), ("CABH-QOS2-MIB", "cabhQos2PsIfAttribNumPriorities"), ("CABH-QOS2-MIB", "cabhQos2PsIfAttribNumQueues"), ("CABH-QOS2-MIB", "cabhQos2PolicyHolderEnabled"), ("CABH-QOS2-MIB", "cabhQos2PolicyAdmissionControl"), ("CABH-QOS2-MIB", "cabhQos2NumActivePolicyHolder"), ("CABH-QOS2-MIB", "cabhQos2PolicyRuleOrder"), ("CABH-QOS2-MIB", "cabhQos2PolicyAppDomain"), ("CABH-QOS2-MIB", "cabhQos2PolicyAppName"), ("CABH-QOS2-MIB", "cabhQos2PolicyServiceProvDomain"), ("CABH-QOS2-MIB", "cabhQos2PolicyServiceName"), ("CABH-QOS2-MIB", "cabhQos2PolicyPortDomain"), ("CABH-QOS2-MIB", "cabhQos2PolicyPortNumber"), ("CABH-QOS2-MIB", "cabhQos2PolicyIpProtocol"), ("CABH-QOS2-MIB", "cabhQos2PolicyIpType"), ("CABH-QOS2-MIB", "cabhQos2PolicySrcIp"), ("CABH-QOS2-MIB", "cabhQos2PolicyDestIp"), ("CABH-QOS2-MIB", "cabhQos2PolicySrcPort"), ("CABH-QOS2-MIB", "cabhQos2PolicyDestPort"), ("CABH-QOS2-MIB", "cabhQos2PolicyTraffImpNum"), ("CABH-QOS2-MIB", "cabhQos2PolicyUserImportance"), ("CABH-QOS2-MIB", "cabhQos2PolicyRowStatus"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassProtocol"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassIpType"), ("CABH-QOS2-MIB", "cabhQos2PolicySrcIp"), ("CABH-QOS2-MIB", "cabhQos2PolicyDestIp"), ("CABH-QOS2-MIB", "cabhQos2PolicySrcPort"), ("CABH-QOS2-MIB", "cabhQos2PolicyDestPort"), ("CABH-QOS2-MIB", "cabhQos2PolicyTraffImpNum"), ("CABH-QOS2-MIB", "cabhQos2PolicyUserImportance"), ("CABH-QOS2-MIB", "cabhQos2PolicyRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cabhQos2Group = cabhQos2Group.setStatus('current') cabhQos2ClassifierGroup = ObjectGroup((1, 3, 6, 1, 4, 1, 4491, 2, 4, 8, 2, 2, 2)).setObjects(("CABH-QOS2-MIB", "cabhQos2TrafficClassProtocol"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassIpType"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassSrcIp"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassDestIp"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassSrcPort"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassDestPort"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassImpNum"), ("CABH-QOS2-MIB", "cabhQos2TrafficClassRowStatus")) if getattr(mibBuilder, 'version', (0, 0, 0)) > (4, 4, 0): cabhQos2ClassifierGroup = cabhQos2ClassifierGroup.setStatus('current') mibBuilder.exportSymbols("CABH-QOS2-MIB", cabhQos2PolicyAppName=cabhQos2PolicyAppName, cabhQos2PolicyEntry=cabhQos2PolicyEntry, cabhQos2TrafficClassProtocol=cabhQos2TrafficClassProtocol, cabhQos2TrafficClassRowStatus=cabhQos2TrafficClassRowStatus, cabhQos2SetToFactory=cabhQos2SetToFactory, cabhQos2Mib2Notifications=cabhQos2Mib2Notifications, cabhQos2PsIfAttribEntry=cabhQos2PsIfAttribEntry, cabhQos2PsIfAttribNumQueues=cabhQos2PsIfAttribNumQueues, cabhQos2PolicyHolderEnabled=cabhQos2PolicyHolderEnabled, cabhQos2PolicyIpProtocol=cabhQos2PolicyIpProtocol, PYSNMP_MODULE_ID=cabhQos2Mib, cabhQos2DeviceObjects=cabhQos2DeviceObjects, cabhQos2PolicyPortNumber=cabhQos2PolicyPortNumber, cabhQos2PolicyOwnerRuleId=cabhQos2PolicyOwnerRuleId, cabhQos2PsIfAttribTable=cabhQos2PsIfAttribTable, cabhQos2LastSetToFactory=cabhQos2LastSetToFactory, cabhQos2MibObjects=cabhQos2MibObjects, cabhQos2PsIfAttributes=cabhQos2PsIfAttributes, cabhQos2PolicyDestIp=cabhQos2PolicyDestIp, cabhQos2PolicyDestPort=cabhQos2PolicyDestPort, cabhQos2Compliances=cabhQos2Compliances, cabhQos2TrafficClassSrcPort=cabhQos2TrafficClassSrcPort, cabhQos2PolicyTraffImpNum=cabhQos2PolicyTraffImpNum, cabhQos2Conformance=cabhQos2Conformance, cabhQos2ClassifierGroup=cabhQos2ClassifierGroup, cabhQos2TrafficClassDestIp=cabhQos2TrafficClassDestIp, cabhQos2TrafficClassDestPort=cabhQos2TrafficClassDestPort, cabhQos2PolicyRowStatus=cabhQos2PolicyRowStatus, cabhQos2PolicySrcIp=cabhQos2PolicySrcIp, cabhQos2TrafficClassSrcIp=cabhQos2TrafficClassSrcIp, cabhQos2TrafficClassMethod=cabhQos2TrafficClassMethod, cabhQos2PolicySrcPort=cabhQos2PolicySrcPort, cabhQos2PolicyServiceName=cabhQos2PolicyServiceName, cabhQos2NumActivePolicyHolder=cabhQos2NumActivePolicyHolder, cabhQos2PolicyUserImportance=cabhQos2PolicyUserImportance, cabhQos2Compliance=cabhQos2Compliance, cabhQos2PsIfAttribNumPriorities=cabhQos2PsIfAttribNumPriorities, cabhQos2TrafficClassImpNum=cabhQos2TrafficClassImpNum, cabhQos2PolicyAdmissionControl=cabhQos2PolicyAdmissionControl, cabhQos2PolicyRuleOrder=cabhQos2PolicyRuleOrder, cabhQos2PolicyServiceProvDomain=cabhQos2PolicyServiceProvDomain, cabhQos2PolicyOwner=cabhQos2PolicyOwner, cabhQos2Groups=cabhQos2Groups, cabhQos2PolicyTable=cabhQos2PolicyTable, cabhQos2PolicyAppDomain=cabhQos2PolicyAppDomain, cabhQos2PolicyIpType=cabhQos2PolicyIpType, cabhQos2TrafficClassTable=cabhQos2TrafficClassTable, cabhQos2PolicyPortDomain=cabhQos2PolicyPortDomain, cabhQos2Mib=cabhQos2Mib, cabhQos2TrafficClassEntry=cabhQos2TrafficClassEntry, cabhQos2Group=cabhQos2Group, cabhQos2PolicyHolderObjects=cabhQos2PolicyHolderObjects, cabhQos2TrafficClassIpType=cabhQos2TrafficClassIpType, cabhQos2Base=cabhQos2Base, cabhQos2TrafficClassIdx=cabhQos2TrafficClassIdx)
145.032258
2,723
0.769462
9554b36b01a4be87039a97f47f4d8ef14a97ffe2
2,440
py
Python
nasafree/views.py
luanmalaquias/projeto_api_nasa_django
3441c404da821b4177571814014e89b0cff6a6b7
[ "MIT" ]
null
null
null
nasafree/views.py
luanmalaquias/projeto_api_nasa_django
3441c404da821b4177571814014e89b0cff6a6b7
[ "MIT" ]
null
null
null
nasafree/views.py
luanmalaquias/projeto_api_nasa_django
3441c404da821b4177571814014e89b0cff6a6b7
[ "MIT" ]
null
null
null
from django.shortcuts import redirect, render from .models import * from datetime import date from brain import ipfunc
34.366197
93
0.685246
9554dabbb9a81e2fbde331f2e40edcaa0f221585
805
py
Python
bslparloursite/videolibrary/models.py
natfarleydev/thebslparlour
ebb2588282cdb2a977ec6c5f8d82cec4e8fd1f99
[ "CC0-1.0" ]
1
2016-01-06T23:13:11.000Z
2016-01-06T23:13:11.000Z
bslparloursite/videolibrary/models.py
natfarleydev/thebslparlour
ebb2588282cdb2a977ec6c5f8d82cec4e8fd1f99
[ "CC0-1.0" ]
4
2021-03-18T20:15:04.000Z
2021-06-10T17:52:31.000Z
bslparloursite/videolibrary/models.py
natfarleydev/thebslparlour
ebb2588282cdb2a977ec6c5f8d82cec4e8fd1f99
[ "CC0-1.0" ]
null
null
null
from django.db import models from django.utils import timezone from sizefield.models import FileSizeField # Create your models here.
29.814815
75
0.720497
9554ef14a15f7437ba6f8f9a2cf1620b9d8dfb4c
1,681
py
Python
location.py
TED-996/Nightshift
3cc76af96c8e85e913be8c2f8f70564ea9d9f95d
[ "MIT" ]
null
null
null
location.py
TED-996/Nightshift
3cc76af96c8e85e913be8c2f8f70564ea9d9f95d
[ "MIT" ]
null
null
null
location.py
TED-996/Nightshift
3cc76af96c8e85e913be8c2f8f70564ea9d9f95d
[ "MIT" ]
null
null
null
import os.path import json from astral import Astral appdata_folder = os.path.join(os.environ["LOCALAPPDATA"], "Nightshift")
28.982759
75
0.625223
95583195ca817a2531ead6462fb4ef3915b9a847
12,140
py
Python
src/awkward1/operations/reducers.py
martindurant/awkward-1.0
a3221ee1bab6551dd01d5dd07a1d2dc24fd02c38
[ "BSD-3-Clause" ]
null
null
null
src/awkward1/operations/reducers.py
martindurant/awkward-1.0
a3221ee1bab6551dd01d5dd07a1d2dc24fd02c38
[ "BSD-3-Clause" ]
null
null
null
src/awkward1/operations/reducers.py
martindurant/awkward-1.0
a3221ee1bab6551dd01d5dd07a1d2dc24fd02c38
[ "BSD-3-Clause" ]
null
null
null
# BSD 3-Clause License; see https://github.com/jpivarski/awkward-1.0/blob/master/LICENSE from __future__ import absolute_import import numpy import awkward1._util import awkward1._connect._numpy import awkward1.layout import awkward1.operations.convert ### The following are not strictly reducers, but are defined in terms of reducers and ufuncs. def moment(x, n, weight=None, axis=None, keepdims=False): with numpy.errstate(invalid="ignore"): if weight is None: sumw = count(x, axis=axis, keepdims=keepdims) sumwxn = sum(x**n, axis=axis, keepdims=keepdims) else: sumw = sum(x*0 + weight, axis=axis, keepdims=keepdims) sumwxn = sum((x*weight)**n, axis=axis, keepdims=keepdims) return numpy.true_divide(sumwxn, sumw) def covar(x, y, weight=None, axis=None, keepdims=False): with numpy.errstate(invalid="ignore"): xmean = mean(x, weight=weight, axis=axis, keepdims=keepdims) ymean = mean(y, weight=weight, axis=axis, keepdims=keepdims) if weight is None: sumw = count(x, axis=axis, keepdims=keepdims) sumwxy = sum((x - xmean)*(y - ymean), axis=axis, keepdims=keepdims) else: sumw = sum(x*0 + weight, axis=axis, keepdims=keepdims) sumwxy = sum((x - xmean)*(y - ymean)*weight, axis=axis, keepdims=keepdims) return numpy.true_divide(sumwxy, sumw) def corr(x, y, weight=None, axis=None, keepdims=False): with numpy.errstate(invalid="ignore"): xmean = mean(x, weight=weight, axis=axis, keepdims=keepdims) ymean = mean(y, weight=weight, axis=axis, keepdims=keepdims) xdiff = x - xmean ydiff = y - ymean if weight is None: sumwxx = sum(xdiff**2, axis=axis, keepdims=keepdims) sumwyy = sum(ydiff**2, axis=axis, keepdims=keepdims) sumwxy = sum(xdiff*ydiff, axis=axis, keepdims=keepdims) else: sumwxx = sum((xdiff**2)*weight, axis=axis, keepdims=keepdims) sumwyy = sum((ydiff**2)*weight, axis=axis, keepdims=keepdims) sumwxy = sum((xdiff*ydiff)*weight, axis=axis, keepdims=keepdims) return numpy.true_divide(sumwxy, numpy.sqrt(sumwxx * sumwyy)) def linearfit(x, y, weight=None, axis=None, keepdims=False): with numpy.errstate(invalid="ignore"): if weight is None: sumw = count(x, axis=axis, keepdims=keepdims) sumwx = sum(x, axis=axis, keepdims=keepdims) sumwy = sum(y, axis=axis, keepdims=keepdims) sumwxx = sum(x**2, axis=axis, keepdims=keepdims) sumwxy = sum(x*y, axis=axis, keepdims=keepdims) else: sumw = sum(x*0 + weight, axis=axis, keepdims=keepdims) sumwx = sum(x*weight, axis=axis, keepdims=keepdims) sumwy = sum(y*weight, axis=axis, keepdims=keepdims) sumwxx = sum((x**2)*weight, axis=axis, keepdims=keepdims) sumwxy = sum(x*y*weight, axis=axis, keepdims=keepdims) delta = (sumw*sumwxx) - (sumwx*sumwx) intercept = numpy.true_divide(((sumwxx*sumwy) - (sumwx*sumwxy)), delta) slope = numpy.true_divide(((sumw*sumwxy) - (sumwx*sumwy)), delta) intercept_error = numpy.sqrt(numpy.true_divide(sumwxx, delta)) slope_error = numpy.sqrt(numpy.true_divide(sumw, delta)) intercept = awkward1.operations.convert.tolayout(intercept, allowrecord=True, allowother=True) slope = awkward1.operations.convert.tolayout(slope, allowrecord=True, allowother=True) intercept_error = awkward1.operations.convert.tolayout(intercept_error, allowrecord=True, allowother=True) slope_error = awkward1.operations.convert.tolayout(slope_error, allowrecord=True, allowother=True) scalar = not isinstance(intercept, awkward1.layout.Content) and not isinstance(slope, awkward1.layout.Content) and not isinstance(intercept_error, awkward1.layout.Content) and not isinstance(slope_error, awkward1.layout.Content) if not isinstance(intercept, (awkward1.layout.Content, awkward1.layout.Record)): intercept = awkward1.layout.NumpyArray(numpy.array([intercept])) if not isinstance(slope, (awkward1.layout.Content, awkward1.layout.Record)): slope = awkward1.layout.NumpyArray(numpy.array([slope])) if not isinstance(intercept_error, (awkward1.layout.Content, awkward1.layout.Record)): intercept_error = awkward1.layout.NumpyArray(numpy.array([intercept_error])) if not isinstance(slope_error, (awkward1.layout.Content, awkward1.layout.Record)): slope_error = awkward1.layout.NumpyArray(numpy.array([slope_error])) out = awkward1.layout.RecordArray([intercept, slope, intercept_error, slope_error], ["intercept", "slope", "intercept_error", "slope_error"]) out.setparameter("__record__", "LinearFit") if scalar: out = out[0] return awkward1._util.wrap(out, awkward1._util.behaviorof(x, y)) def softmax(x, axis=None, keepdims=False): with numpy.errstate(invalid="ignore"): expx = numpy.exp(x) denom = sum(expx, axis=axis, keepdims=keepdims) return numpy.true_divide(expx, denom) __all__ = [x for x in list(globals()) if not x.startswith("_") and x not in ("collections", "numpy", "awkward1")]
48.174603
236
0.647117
9558fc73a95bcd6653e042be3bc2a2e8ae6c004c
4,758
py
Python
dotenv.py
ross-urban/django-dotenv
16cbf7bb78571174bc5376c95c85b213857cb9f9
[ "MIT" ]
null
null
null
dotenv.py
ross-urban/django-dotenv
16cbf7bb78571174bc5376c95c85b213857cb9f9
[ "MIT" ]
null
null
null
dotenv.py
ross-urban/django-dotenv
16cbf7bb78571174bc5376c95c85b213857cb9f9
[ "MIT" ]
1
2021-02-16T15:37:18.000Z
2021-02-16T15:37:18.000Z
import os import re import sys import warnings __version__ = '1.4.3' line_re = re.compile(r""" ^ (?:export\s+)? # optional export ([\w\.]+) # key (?:\s*=\s*|:\s+?) # separator ( # optional value begin '(?:\'|[^'])*' # single quoted value | # or "(?:\"|[^"])*" # double quoted value | # or [^#\n]+ # unquoted value )? # value end (?:\s*\#.*)? # optional comment $ """, re.VERBOSE) variable_re = re.compile(r""" (\\)? # is it escaped with a backslash? (\$) # literal $ ( # collect braces with var for sub \{? # allow brace wrapping ([A-Z0-9_]+) # match the variable \}? # closing brace ) # braces end """, re.IGNORECASE | re.VERBOSE) overrides = ('source_env', 'source_up') def read_dotenv(dotenv=None, override=False): """ Read a .env file into os.environ. If not given a path to a dotenv path, does filthy magic stack backtracking to find manage.py and then find the dotenv. If tests rely on .env files, setting the overwrite flag to True is a safe way to ensure tests run consistently across all environments. :param override: True if values in .env should override system variables. """ if dotenv is None: frame_filename = sys._getframe().f_back.f_code.co_filename dotenv = os.path.join(os.path.dirname(frame_filename), '.env') if os.path.isdir(dotenv) and os.path.isfile(os.path.join(dotenv, '.env')): dotenv = os.path.join(dotenv, '.env') if os.path.exists(dotenv): with open(dotenv) as f: env = parse_dotenv(f.read()) for k, v in env.items(): if k in overrides: continue if override: os.environ[k] = v else: os.environ.setdefault(k, v) for k, v in env.items(): if k not in overrides: continue for fname in v: read_dotenv(fname, override) else: warnings.warn("Not reading {0} - it doesn't exist.".format(dotenv), stacklevel=2)
31.72
78
0.481084
955b60084410969a08f97fe22aa1d69988088bf0
16,755
py
Python
PsychoPy3 Experiments/ContrastDetection.py
mrhunsaker/ContrastDetection
bb058460c5f90119316d0637885cd47f7ca2a307
[ "MIT" ]
null
null
null
PsychoPy3 Experiments/ContrastDetection.py
mrhunsaker/ContrastDetection
bb058460c5f90119316d0637885cd47f7ca2a307
[ "MIT" ]
null
null
null
PsychoPy3 Experiments/ContrastDetection.py
mrhunsaker/ContrastDetection
bb058460c5f90119316d0637885cd47f7ca2a307
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This experiment was created using PsychoPy3 Experiment Builder (v2020.2.4post1), on October 27, 2020, at 14:06 If you publish work using this script the most relevant publication is: Peirce J, Gray JR, Simpson S, MacAskill M, Hchenberger R, Sogo H, Kastman E, Lindelv JK. (2019) PsychoPy2: Experiments in behavior made easy Behav Res 51: 195. https://doi.org/10.3758/s13428-018-01193-y """ from __future__ import absolute_import, division from psychopy import locale_setup from psychopy import prefs from psychopy import sound, gui, visual, core, data, event, logging, clock from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED, STOPPED, FINISHED, PRESSED, RELEASED, FOREVER) import numpy as np # whole numpy lib is available, prepend 'np.' from numpy import (sin, cos, tan, log, log10, pi, average, sqrt, std, deg2rad, rad2deg, linspace, asarray) from numpy.random import random, randint, normal, shuffle import os # handy system and path functions import sys # to get file system encoding from psychopy.hardware import keyboard # Ensure that relative paths start from the same directory as this script _thisDir = os.path.dirname(os.path.abspath(__file__)) os.chdir(_thisDir) # Store info about the experiment session psychopyVersion = '2020.2.4post1' expName = 'ContrastDetection' # from the Builder filename that created this script expInfo = {'participant': 's_001', 'ori': '10'} dlg = gui.DlgFromDict(dictionary=expInfo, sort_keys=False, title=expName) if dlg.OK == False: core.quit() # user pressed cancel expInfo['date'] = data.getDateStr() # add a simple timestamp expInfo['expName'] = expName expInfo['psychopyVersion'] = psychopyVersion # Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc filename = _thisDir + os.sep + 'data' + os.sep + '%s_%s' % (expInfo['participant'], expInfo['date']) # An ExperimentHandler isn't essential but helps with data saving thisExp = data.ExperimentHandler(name=expName, version='', extraInfo=expInfo, runtimeInfo=None, originPath='C:\\Users\\Ryan Hunsaker\\psychopy\\PsychoPy3 Experiments\\ContrastDetection.py', savePickle=True, saveWideText=True, dataFileName=filename) # save a log file for detail verbose info logFile = logging.LogFile(filename+'.log', level=logging.EXP) logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file endExpNow = False # flag for 'escape' or other condition => quit the exp frameTolerance = 0.001 # how close to onset before 'same' frame # Start Code - component code to be run before the window creation # Setup the Window win = visual.Window( size=[2496, 1664], fullscr=True, screen=0, winType='pyglet', allowGUI=False, allowStencil=False, monitor='testMonitor', color=[0,0,0], colorSpace='rgb', blendMode='avg', useFBO=True) # store frame rate of monitor if we can measure it expInfo['frameRate'] = win.getActualFrameRate() if expInfo['frameRate'] != None: frameDur = 1.0 / round(expInfo['frameRate']) else: frameDur = 1.0 / 60.0 # could not measure, so guess # create a default keyboard (e.g. to check for escape) defaultKeyboard = keyboard.Keyboard() # Initialize components for Routine "instr" instrClock = core.Clock() instructions = visual.TextStim(win=win, name='instructions', text="Press 'up' if you see the stimulus, 'down' if you didn't.\n\nAny key to start", font='Atkinson Hyperlegible', pos=[0, 0], height=0.1, wrapWidth=None, ori=0, color=[1, 1, 1], colorSpace='rgb', opacity=1, languageStyle='LTR', depth=0.0); ready = keyboard.Keyboard() # Initialize components for Routine "trial" trialClock = core.Clock() fixation = visual.GratingStim( win=win, name='fixation',units='pix', tex=None, mask=None, ori=0, pos=[0, 0], size=[25, 25], sf=1, phase=0.0, color=[1, 1, 1], colorSpace='rgb', opacity=1,blendmode='avg', texRes=512, interpolate=True, depth=0.0) gabor = visual.GratingStim( win=win, name='gabor',units='pix', tex='sin', mask='gauss', ori=expInfo['ori'], pos=[0, 0], size=[1024,1024], sf=0.025, phase=1.0, color='white', colorSpace='rgb', opacity=1,blendmode='avg', texRes=512, interpolate=True, depth=-1.0) resp = keyboard.Keyboard() # Create some handy timers globalClock = core.Clock() # to track the time since experiment started routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine # ------Prepare to start Routine "instr"------- continueRoutine = True # update component parameters for each repeat ready.keys = [] ready.rt = [] _ready_allKeys = [] # keep track of which components have finished instrComponents = [instructions, ready] for thisComponent in instrComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") instrClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "instr"------- while continueRoutine: # get current time t = instrClock.getTime() tThisFlip = win.getFutureFlipTime(clock=instrClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *instructions* updates if instructions.status == NOT_STARTED and tThisFlip >= 0-frameTolerance: # keep track of start time/frame for later instructions.frameNStart = frameN # exact frame index instructions.tStart = t # local t and not account for scr refresh instructions.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(instructions, 'tStartRefresh') # time at next scr refresh instructions.setAutoDraw(True) # *ready* updates waitOnFlip = False if ready.status == NOT_STARTED and tThisFlip >= 0-frameTolerance: # keep track of start time/frame for later ready.frameNStart = frameN # exact frame index ready.tStart = t # local t and not account for scr refresh ready.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(ready, 'tStartRefresh') # time at next scr refresh ready.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(ready.clock.reset) # t=0 on next screen flip win.callOnFlip(ready.clearEvents, eventType='keyboard') # clear events on next screen flip if ready.status == STARTED and not waitOnFlip: theseKeys = ready.getKeys(keyList=None, waitRelease=False) _ready_allKeys.extend(theseKeys) if len(_ready_allKeys): ready.keys = _ready_allKeys[-1].name # just the last key pressed ready.rt = _ready_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in instrComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "instr"------- for thisComponent in instrComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('instructions.started', instructions.tStartRefresh) thisExp.addData('instructions.stopped', instructions.tStopRefresh) # check responses if ready.keys in ['', [], None]: # No response was made ready.keys = None thisExp.addData('ready.keys',ready.keys) if ready.keys != None: # we had a response thisExp.addData('ready.rt', ready.rt) thisExp.addData('ready.started', ready.tStartRefresh) thisExp.addData('ready.stopped', ready.tStopRefresh) thisExp.nextEntry() # the Routine "instr" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # --------Prepare to start Staircase "trials" -------- # set up handler to look after next chosen value etc trials = data.StairHandler(startVal=0.9, extraInfo=expInfo, stepSizes=asarray([1,1,0.9,0.9,0.8,0.8,0.6, 0.6, 0.4,0.4,0.2]), stepType='log', nReversals=1, nTrials=30.0, nUp=1, nDown=3, minVal=0.0, maxVal=1.0, originPath=-1, name='trials') thisExp.addLoop(trials) # add the loop to the experiment level = thisTrial = 0.9 # initialise some vals for thisTrial in trials: currentLoop = trials level = thisTrial # ------Prepare to start Routine "trial"------- continueRoutine = True routineTimer.add(2.500000) # update component parameters for each repeat gabor.setColor([level, level, level], colorSpace='rgb') resp.keys = [] resp.rt = [] _resp_allKeys = [] # keep track of which components have finished trialComponents = [fixation, gabor, resp] for thisComponent in trialComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") trialClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "trial"------- while continueRoutine and routineTimer.getTime() > 0: # get current time t = trialClock.getTime() tThisFlip = win.getFutureFlipTime(clock=trialClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *fixation* updates if fixation.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later fixation.frameNStart = frameN # exact frame index fixation.tStart = t # local t and not account for scr refresh fixation.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(fixation, 'tStartRefresh') # time at next scr refresh fixation.setAutoDraw(True) if fixation.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > fixation.tStartRefresh + 0.5-frameTolerance: # keep track of stop time/frame for later fixation.tStop = t # not accounting for scr refresh fixation.frameNStop = frameN # exact frame index win.timeOnFlip(fixation, 'tStopRefresh') # time at next scr refresh fixation.setAutoDraw(False) # *gabor* updates if gabor.status == NOT_STARTED and tThisFlip >= 0.5-frameTolerance: # keep track of start time/frame for later gabor.frameNStart = frameN # exact frame index gabor.tStart = t # local t and not account for scr refresh gabor.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(gabor, 'tStartRefresh') # time at next scr refresh gabor.setAutoDraw(True) if gabor.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > gabor.tStartRefresh + 0.5-frameTolerance: # keep track of stop time/frame for later gabor.tStop = t # not accounting for scr refresh gabor.frameNStop = frameN # exact frame index win.timeOnFlip(gabor, 'tStopRefresh') # time at next scr refresh gabor.setAutoDraw(False) if gabor.status == STARTED: # only update if drawing gabor.setPhase(trialClock.getTime()*2, log=False) # *resp* updates waitOnFlip = False if resp.status == NOT_STARTED and tThisFlip >= 0.5-frameTolerance: # keep track of start time/frame for later resp.frameNStart = frameN # exact frame index resp.tStart = t # local t and not account for scr refresh resp.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(resp, 'tStartRefresh') # time at next scr refresh resp.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(resp.clock.reset) # t=0 on next screen flip win.callOnFlip(resp.clearEvents, eventType='keyboard') # clear events on next screen flip if resp.status == STARTED: # is it time to stop? (based on global clock, using actual start) if tThisFlipGlobal > resp.tStartRefresh + 2.0-frameTolerance: # keep track of stop time/frame for later resp.tStop = t # not accounting for scr refresh resp.frameNStop = frameN # exact frame index win.timeOnFlip(resp, 'tStopRefresh') # time at next scr refresh resp.status = FINISHED if resp.status == STARTED and not waitOnFlip: theseKeys = resp.getKeys(keyList=['up', 'down'], waitRelease=False) _resp_allKeys.extend(theseKeys) if len(_resp_allKeys): resp.keys = _resp_allKeys[-1].name # just the last key pressed resp.rt = _resp_allKeys[-1].rt # was this correct? if (resp.keys == str('up')) or (resp.keys == 'up'): resp.corr = 1 else: resp.corr = 0 # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.getKeys(keyList=["escape"]): core.quit() # check if all components have finished if not continueRoutine: # a component has requested a forced-end of Routine break continueRoutine = False # will revert to True if at least one component still running for thisComponent in trialComponents: if hasattr(thisComponent, "status") and thisComponent.status != FINISHED: continueRoutine = True break # at least one component has not yet finished # refresh the screen if continueRoutine: # don't flip if this routine is over or we'll get a blank screen win.flip() # -------Ending Routine "trial"------- for thisComponent in trialComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) trials.addOtherData('fixation.started', fixation.tStartRefresh) trials.addOtherData('fixation.stopped', fixation.tStopRefresh) trials.addOtherData('gabor.started', gabor.tStartRefresh) trials.addOtherData('gabor.stopped', gabor.tStopRefresh) # check responses if resp.keys in ['', [], None]: # No response was made resp.keys = None # was no response the correct answer?! if str('up').lower() == 'none': resp.corr = 1; # correct non-response else: resp.corr = 0; # failed to respond (incorrectly) # store data for trials (StairHandler) trials.addResponse(resp.corr) trials.addOtherData('resp.rt', resp.rt) trials.addOtherData('resp.started', resp.tStartRefresh) trials.addOtherData('resp.stopped', resp.tStopRefresh) thisExp.nextEntry() # staircase completed trials.saveAsExcel(filename + '.xlsx', sheetName='trials') trials.saveAsText(filename + 'trials.csv', delim=',') # Flip one final time so any remaining win.callOnFlip() # and win.timeOnFlip() tasks get executed before quitting win.flip() # these shouldn't be strictly necessary (should auto-save) thisExp.saveAsWideText(filename+'.csv', delim='comma') thisExp.saveAsPickle(filename) logging.flush() # make sure everything is closed down thisExp.abort() # or data files will save again on exit win.close() core.quit()
43.861257
102
0.66607
955b6290b3f098708424dbec65825578b92645dc
1,945
py
Python
self_driving_desktop/grammar.py
wasimakh2/self-driving-desktop
309b9b6614f8d3f2b85ed40c8e3cd9d72cd069a6
[ "MIT" ]
536
2019-05-08T02:54:27.000Z
2022-03-24T10:02:07.000Z
self_driving_desktop/grammar.py
JonTheNiceGuy/self-driving-desktop
309b9b6614f8d3f2b85ed40c8e3cd9d72cd069a6
[ "MIT" ]
17
2019-05-08T03:08:14.000Z
2021-03-02T12:52:53.000Z
self_driving_desktop/grammar.py
JonTheNiceGuy/self-driving-desktop
309b9b6614f8d3f2b85ed40c8e3cd9d72cd069a6
[ "MIT" ]
33
2019-05-08T03:50:56.000Z
2021-12-08T11:22:29.000Z
grammar = r""" start: (item ";")+ item: import | coords | playlist | step import : "import" string coords : "coords" coords_body coords_body : "{" coord_def ("," coord_def)* "}" coord_def: string ":" "{" coord_body ("," coord_body)* "}" coord_body: string ":" "[" int "," int "]" playlist : "playlist" string playlist_body playlist_body : "{" (step ";")* "}" step : screen | repeat | play | active | focus | delay | sleep | shell | coord_off | coord | mouse | drag | click | btnclick | btndown | btnup | scroll | hscroll | keypress | keydown | keyup | hotkeys | write | copy | paste | save_clipboard | load_clipboard | copy_clipboard | paste_clipboard screen: "screen" string repeat: "play" string+ int | "play" string+ number play: "play" string+ active: "active" string focus: "focus" string delay: "delay" number sleep: "sleep" number shell: ("shell"|"sh") string+ coord_off: ("coord"|"mc") string number number number coord: ("coord"|"mc") string number mouse: ("mouse"|"mv"|"mm") number number number drag: ("drag"|"md") string number number number click: "click" btnclick: ("btnclick"|"bc") string btndown: ("btndown"|"bd") string btnup: ("btnup"|"bu") string scroll: "scroll" number hscroll: "hscroll" number keypress: ("keypress"|"kp") string keydown: ("keydown"|"kd") string keyup: ("keyup"|"ku") string hotkeys: ("hotkeys"|"hk") string+ write: ("write"|"w"|"type"|"t") string number? copy: "copy" paste: "paste" save_clipboard: ("save_clipboard"|"scb") string load_clipboard: ("load_clipboard"|"lcb") string copy_clipboard: ("copy_clipboard"|"ccb") string paste_clipboard: ("paste_clipboard"|"pcb") string int: INT number: SIGNED_NUMBER string: ESCAPED_STRING COMMENT: /#[^\n]*/ IDENT: (LETTER|"_") (LETTER|INT|"-"|"_")* NAME: LETTER (LETTER|INT|"-"|"_")* WORD: LETTER+ %import common.LETTER %import common.ESCAPED_STRING %import common.INT %import common.SIGNED_NUMBER %import common.WS %ignore COMMENT %ignore WS """
19.45
58
0.682776
955dce71570249e6e13d912ac4f316735729f8a7
1,765
py
Python
BB/conf.py
poco0317/BarinadeBot-Rewrite
4f34246178ab2ee0fd4c0a79fff5a43adbed134c
[ "MIT" ]
2
2021-05-06T09:07:44.000Z
2021-05-11T23:45:38.000Z
BB/conf.py
poco0317/BarinadeBot-Rewrite
4f34246178ab2ee0fd4c0a79fff5a43adbed134c
[ "MIT" ]
null
null
null
BB/conf.py
poco0317/BarinadeBot-Rewrite
4f34246178ab2ee0fd4c0a79fff5a43adbed134c
[ "MIT" ]
null
null
null
import configparser import os import shutil import traceback
41.046512
155
0.602833
955f1cf7d1a0592b32cf0c5abbfe0bb9060df419
2,805
py
Python
geocamUtil/usng/convertUsngCsv.py
geocam/geocamUtilWeb
b64fc063c64b4b0baa140db4c126f2ff980756ab
[ "NASA-1.3" ]
4
2017-03-03T16:24:24.000Z
2018-06-24T05:50:40.000Z
geocamUtil/usng/convertUsngCsv.py
geocam/geocamUtilWeb
b64fc063c64b4b0baa140db4c126f2ff980756ab
[ "NASA-1.3" ]
1
2021-09-29T17:17:30.000Z
2021-09-29T17:17:30.000Z
geocamUtil/usng/convertUsngCsv.py
geocam/geocamUtilWeb
b64fc063c64b4b0baa140db4c126f2ff980756ab
[ "NASA-1.3" ]
1
2017-12-19T20:45:53.000Z
2017-12-19T20:45:53.000Z
#!/usr/bin/env python # __BEGIN_LICENSE__ #Copyright (c) 2015, United States Government, as represented by the #Administrator of the National Aeronautics and Space Administration. #All rights reserved. # __END_LICENSE__ """ Takes as input a CSV file in the format: 37 46 29.2080,-122 25 08.1336,San Francisco 37 27 13.8132,-122 10 55.7184,Menlo Park And outputs CSV in the format: 10S EG 51172 80985,San Francisco 10S EG 72335 45533,Menlo Park Optionally outputs a KML file of placemarks as well, where the placemark descriptions include USNG coordinates. """ import csv from geocamUtil.usng import usng from geocamUtil import KmlUtil if __name__ == '__main__': main()
30.824176
92
0.624242
955fa29268924998ee2dd6306f368b16b34e2595
478
py
Python
process_cifar10.py
IIGROUP/AttentionProbe
b2c88b064452741a7ccc6660a4b090743013cc73
[ "MIT" ]
11
2022-01-23T15:09:09.000Z
2022-03-18T10:27:04.000Z
process_cifar10.py
Wang-jiahao/AttentionProbe
41a3cc0d5454ec5bba78c3dace9cded00da8cff9
[ "MIT" ]
null
null
null
process_cifar10.py
Wang-jiahao/AttentionProbe
41a3cc0d5454ec5bba78c3dace9cded00da8cff9
[ "MIT" ]
null
null
null
from torchvision.datasets import CIFAR10 from torchvision.datasets import CIFAR100 import os root = '/database/cifar10/' from PIL import Image dataset_train = CIFAR10(root) for k, (img, label) in enumerate(dataset_train): print('processsing' + str(k)) if not os.path.exists(root + 'CIFAR10_image/' + str(label)+ '/'): os.mkdir(root + 'CIFAR10_image/' + str(label)+ '/') img.save(root + 'CIFAR10_image/' + str(label) + '/' + str(k) + '.png')
31.866667
75
0.650628
955fe4376191cdb0e3d9522af865a55375090411
246
py
Python
examples/fullproject/items/user.py
cnkailyn/toapi
03a49d02dd0a55f1f83270154144e1a08fae6b78
[ "Apache-2.0" ]
null
null
null
examples/fullproject/items/user.py
cnkailyn/toapi
03a49d02dd0a55f1f83270154144e1a08fae6b78
[ "Apache-2.0" ]
null
null
null
examples/fullproject/items/user.py
cnkailyn/toapi
03a49d02dd0a55f1f83270154144e1a08fae6b78
[ "Apache-2.0" ]
1
2019-11-12T20:15:50.000Z
2019-11-12T20:15:50.000Z
from toapi import Item, XPath
22.363636
50
0.536585
95620b3f160fc0fb6d0c0896e86c4e7d56432d0b
722
py
Python
src/tests/test_fail.py
bspeagle/py_git_diff
1674afc1dfac0408372e11945f4a36b297b77e66
[ "MIT" ]
null
null
null
src/tests/test_fail.py
bspeagle/py_git_diff
1674afc1dfac0408372e11945f4a36b297b77e66
[ "MIT" ]
null
null
null
src/tests/test_fail.py
bspeagle/py_git_diff
1674afc1dfac0408372e11945f4a36b297b77e66
[ "MIT" ]
null
null
null
''' Failure tests ''' import os from typing import Any import pytest from helpers.github import API api = API() pass_token = Any fail_token = os.getenv('FAIL_TOKEN') fail_org = os.getenv('FAIL_ORG') fail_repo = os.getenv('FAIL_REPO') def test_fail_auth(): ''' Fail 'auth' to Github ''' with pytest.raises(SystemExit): api.authenticate(fail_token) def test_fail_org(token): ''' Fail 'get organization' ''' pass_token = token with pytest.raises(SystemExit): api.authenticate(pass_token) api.get_organization(fail_org) def test_fail_repo(): ''' Fail 'get repo' ''' with pytest.raises(SystemExit): api.get_repo("user", fail_repo)
16.044444
39
0.649584
9562440f3dc7a8e571a4195021e3f9febc5d8b84
3,042
py
Python
tutorials/mechanisms/tutorial_convenience_inhibition.py
AQ18/skimpy
435fc50244f2ca815bbb39d525a82a4692f5c0ac
[ "Apache-2.0" ]
13
2020-11-05T10:59:13.000Z
2022-03-21T01:38:31.000Z
tutorials/mechanisms/tutorial_convenience_inhibition.py
AQ18/skimpy
435fc50244f2ca815bbb39d525a82a4692f5c0ac
[ "Apache-2.0" ]
4
2022-01-27T10:23:40.000Z
2022-03-10T18:16:06.000Z
tutorials/mechanisms/tutorial_convenience_inhibition.py
AQ18/skimpy
435fc50244f2ca815bbb39d525a82a4692f5c0ac
[ "Apache-2.0" ]
6
2020-08-04T17:01:33.000Z
2022-03-21T01:38:32.000Z
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland 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 by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, 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. """ import numpy as np # Test models from skimpy.core import * from skimpy.mechanisms import * name = 'pfk' SpecificConvenience = make_convenience_with_inhibition([-2, -1, 3], [1]) metabolites = SpecificConvenience.Reactants(substrate1 = 'A', substrate2 = 'B', product1 = 'C' ) inhibitors = SpecificConvenience.Inhibitors(inhibitor1 = 'I') # thermo_data = {'S': 1e-2, # 'P': 1e-2, # 'sig_S': 0.1, # 'sig_P': 0.1, # 'gamma': 0.1, # 'flux': 1.0, # 'E_tot': 1e-5} ## QSSA Method parameters = SpecificConvenience.Parameters( vmax_forward = 1.0, k_equilibrium=2.0, km_substrate1 = 10.0, km_substrate2 = 10.0, km_product1 = 10.0, ki_inhibitor1 = 1.0) pfk = Reaction(name=name, mechanism=SpecificConvenience, reactants=metabolites, inhibitors=inhibitors, ) name = 'inhib' metabolites = ReversibleMichaelisMenten.Reactants(substrate = 'C', product = 'I') ## QSSA Method parameters_inh = ReversibleMichaelisMenten.Parameters( vmax_forward = 1.0, k_equilibrium=2.0, km_substrate = 10.0, km_product = 10.0, total_enzyme_concentration = 1.0, ) inh = Reaction(name=name, mechanism=ReversibleMichaelisMenten, reactants=metabolites, ) this_model = KineticModel() this_model.add_reaction(pfk) this_model.add_reaction(inh) this_model.parametrize_by_reaction({inh.name:parameters_inh, pfk.name: parameters}) this_model.compile_ode(sim_type = QSSA) this_model.initial_conditions['A'] = 10.0 this_model.initial_conditions['B'] = 10.0 this_model.initial_conditions['C'] = 10.0 this_model.initial_conditions['I'] = 0.0 this_sol_qssa = this_model.solve_ode(np.linspace(0.0, 50.0, 500),solver_type = 'cvode') this_sol_qssa.plot('output/base_out_qssa.html')
29.25
87
0.610782
9564a1cacc7687a8261fe339aaf329a5f5fa587d
825
py
Python
advanced-python/05_advanced_classes_and_objects/enums.py
alexprodan99/python-workspace
8c805afc29fafe3916759d1cf07e597f945b8b45
[ "MIT" ]
null
null
null
advanced-python/05_advanced_classes_and_objects/enums.py
alexprodan99/python-workspace
8c805afc29fafe3916759d1cf07e597f945b8b45
[ "MIT" ]
null
null
null
advanced-python/05_advanced_classes_and_objects/enums.py
alexprodan99/python-workspace
8c805afc29fafe3916759d1cf07e597f945b8b45
[ "MIT" ]
null
null
null
from enum import Enum, unique, auto if __name__ == '__main__': main()
27.5
152
0.641212
9566a5fe7dd2b6c92ef1c6e1f73143b039776af9
3,313
py
Python
detector/detector.py
suhendaragung20/Object-Detection-Metrics
e756c9ba20ff1e89143c64e6d38288d2a8680f0e
[ "MIT" ]
null
null
null
detector/detector.py
suhendaragung20/Object-Detection-Metrics
e756c9ba20ff1e89143c64e6d38288d2a8680f0e
[ "MIT" ]
null
null
null
detector/detector.py
suhendaragung20/Object-Detection-Metrics
e756c9ba20ff1e89143c64e6d38288d2a8680f0e
[ "MIT" ]
null
null
null
# Import packages import os import cv2 import numpy as np import tensorflow as tf import sys from imutils.object_detection import non_max_suppression # This is needed since the notebook is stored in the object_detection folder. sys.path.append("..") # Import utilites from utils import label_map_util
37.224719
107
0.690915
9566c8358fb6d074b645539d82fffd8a430711c8
1,770
py
Python
processDiscoveryNews4chat.py
data-henrik/watson-chatbot-discovery-news
d63d579718d4fc529af29bb413c73fdbd9b52361
[ "Apache-2.0" ]
3
2019-05-03T20:28:45.000Z
2019-06-28T09:58:25.000Z
processDiscoveryNews4chat.py
psaupsau/watson-chatbot-discovery-news
d63d579718d4fc529af29bb413c73fdbd9b52361
[ "Apache-2.0" ]
null
null
null
processDiscoveryNews4chat.py
psaupsau/watson-chatbot-discovery-news
d63d579718d4fc529af29bb413c73fdbd9b52361
[ "Apache-2.0" ]
4
2019-04-25T16:49:47.000Z
2020-07-02T15:27:05.000Z
# Handle client-side action for an IBM Watson Assistant chatbot # # The code requires my Watson Conversation Tool. For details see # https://github.com/data-henrik/watson-conversation-tool # # # Setup: Configure your credentials # - for Watson Assistant see instructions for the tool # - for Discovery change username / password below # # # Written by Henrik Loeser import json from watson_developer_cloud import DiscoveryV1
35.4
95
0.714124
9566fa933abad53d06086af6a6e451a81990671d
2,977
py
Python
test_scripts/test_residual_solver_dynamic.py
JoZimmer/ParOptBeam
50d15d8d822a2718f2932807e06c4a7e02f866a3
[ "BSD-3-Clause" ]
1
2021-04-09T14:08:20.000Z
2021-04-09T14:08:20.000Z
test_scripts/test_residual_solver_dynamic.py
JoZimmer/ParOptBeam
50d15d8d822a2718f2932807e06c4a7e02f866a3
[ "BSD-3-Clause" ]
2
2021-04-28T15:05:01.000Z
2021-11-10T15:12:56.000Z
test_scripts/test_residual_solver_dynamic.py
JoZimmer/ParOptBeam
50d15d8d822a2718f2932807e06c4a7e02f866a3
[ "BSD-3-Clause" ]
2
2021-02-01T08:49:45.000Z
2021-08-10T02:07:36.000Z
import numpy as np import matplotlib.pyplot as plt from cycler import cycler from source.solving_strategies.strategies.residual_based_newton_raphson_solver import ResidualBasedNewtonRaphsonSolver from source.solving_strategies.strategies.residual_based_picard_solver import ResidualBasedPicardSolver from source.model.structure_model import StraightBeam np.set_printoptions(suppress=False, precision=2, linewidth=140) params = { "name": "CaarcBeamPrototypeOptimizable", "domain_size": "3D", "system_parameters": { "element_params": { "type": "CRBeam", "is_nonlinear": True }, "material": { "density": 7850.0, "youngs_modulus": 2069000000, "poisson_ratio": 0.29, "damping_ratio": 0.1 }, "geometry": { "length_x": 1.2, "number_of_elements": 1, "defined_on_intervals": [{ "interval_bounds": [0.0, "End"], "length_y": [1.0], "length_z": [1.0], "area": [0.0001], "shear_area_y": [0.0], "shear_area_z": [0.0], "moment_of_inertia_y": [0.0001], "moment_of_inertia_z": [0.0001], "torsional_moment_of_inertia": [0.0001], "outrigger_mass": [0.0], "outrigger_stiffness": [0.0]}] } }, "boundary_conditions": "fixed-free" } dt = 0.1 tend = 10. steps = int(tend / dt) array_time = np.linspace(0.0, tend, steps + 1) array_time_kratos = np.linspace(0.1, 10, 101)
34.616279
118
0.566006
9567e6ba5dc9af36046c391fbc5d4e1144009cc8
378
py
Python
objects/regex_deleter.py
Egor2005l/cho
c7cb165394089b277be5c306edde0b8fb42e466d
[ "MIT" ]
null
null
null
objects/regex_deleter.py
Egor2005l/cho
c7cb165394089b277be5c306edde0b8fb42e466d
[ "MIT" ]
null
null
null
objects/regex_deleter.py
Egor2005l/cho
c7cb165394089b277be5c306edde0b8fb42e466d
[ "MIT" ]
null
null
null
from typing import Dict from objects.base import BaseModel
19.894737
38
0.531746
95697b5d755424cb46ff8e11e52fcff72a602bf4
639
py
Python
cartridge_external_payment/admin.py
thomasWajs/cartridge-external-payment
02c1c2b43504a17547a908622c3d54a331945c77
[ "BSD-2-Clause" ]
7
2015-02-14T20:25:27.000Z
2021-04-10T16:05:00.000Z
cartridge_external_payment/admin.py
thomasWajs/cartridge-external-payment
02c1c2b43504a17547a908622c3d54a331945c77
[ "BSD-2-Clause" ]
2
2015-11-30T17:54:19.000Z
2016-09-09T21:21:01.000Z
cartridge_external_payment/admin.py
thomasWajs/cartridge-external-payment
02c1c2b43504a17547a908622c3d54a331945c77
[ "BSD-2-Clause" ]
3
2015-10-19T15:22:18.000Z
2017-11-13T23:22:17.000Z
from copy import deepcopy from django.contrib import admin from cartridge.shop.admin import OrderAdmin from cartridge.shop.models import Order order_fieldsets = deepcopy(admin.site._registry[Order].fieldsets) order_fieldsets[2][1]["fields"] = list(order_fieldsets[2][1]["fields"]) order_fieldsets[2][1]["fields"].insert(0, 'payment_done') admin.site.unregister(Order) admin.site.register(Order, ExternalPaymentOrderAdmin)
33.631579
74
0.748044
9569b1f581ecb174ee905898df207343952c8b6e
1,483
py
Python
webeditor/app/attrdict.py
lshen1120/web-editor
170ac96b47bf957a3a42a99092e45e88e584c49a
[ "Apache-2.0" ]
4
2018-07-25T03:57:08.000Z
2018-07-25T06:34:59.000Z
webeditor/app/attrdict.py
lshen1120/web-editor
170ac96b47bf957a3a42a99092e45e88e584c49a
[ "Apache-2.0" ]
null
null
null
webeditor/app/attrdict.py
lshen1120/web-editor
170ac96b47bf957a3a42a99092e45e88e584c49a
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding:utf-8 -*- import copy
26.017544
68
0.574511
956a1d409e8bf27f1eb1d39023f7ad436c2f2c6c
16,034
py
Python
EVeP/EVeP.py
amandaortega/EVeP
4bca562c814210b1d835e9be63ab80385c93320b
[ "MIT" ]
null
null
null
EVeP/EVeP.py
amandaortega/EVeP
4bca562c814210b1d835e9be63ab80385c93320b
[ "MIT" ]
null
null
null
EVeP/EVeP.py
amandaortega/EVeP
4bca562c814210b1d835e9be63ab80385c93320b
[ "MIT" ]
null
null
null
""" Author: Amanda Ortega de Castro Ayres Created in: September 19, 2019 Python version: 3.6 """ from Least_SRMTL import Least_SRMTL import libmr from matplotlib import pyplot, cm from matplotlib.patches import Circle from mpl_toolkits.mplot3d import Axes3D, art3d import numpy as np import numpy.matlib import sklearn.metrics
40.489899
247
0.591493
956c1145058b098a2e217c047220f62e14dea6e3
5,375
py
Python
bigml/modelfields.py
alanponce/python
9423b4c4968b81ee14cef1ab6cd62d23dfa8bd26
[ "Apache-2.0" ]
1
2021-06-20T11:51:22.000Z
2021-06-20T11:51:22.000Z
bigml/modelfields.py
alanponce/python
9423b4c4968b81ee14cef1ab6cd62d23dfa8bd26
[ "Apache-2.0" ]
null
null
null
bigml/modelfields.py
alanponce/python
9423b4c4968b81ee14cef1ab6cd62d23dfa8bd26
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- #!/usr/bin/env python # # Copyright 2013-2016 BigML # # 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 by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, 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. """A BasicModel resource. This module defines a BasicModel to hold the main information of the model resource in BigML. It becomes the starting point for the Model class, that is used for local predictions. """ import logging LOGGER = logging.getLogger('BigML') from bigml.util import invert_dictionary, DEFAULT_LOCALE from bigml.fields import DEFAULT_MISSING_TOKENS def check_model_structure(model): """Checks the model structure to see if it contains all the needed keys """ return (isinstance(model, dict) and 'resource' in model and model['resource'] is not None and ('object' in model and 'model' in model['object'] or 'model' in model))
37.852113
77
0.596279
956d8de300f81dc8c0786d5a4d8868b85762da6f
16,229
py
Python
networks/infill/func_intersect_ub.py
LArbys/ublarcvserver
02381c937f49a2eab2f754017ab431c3f6fa70d7
[ "Apache-2.0" ]
2
2020-07-09T19:34:03.000Z
2021-06-21T23:09:23.000Z
networks/larflow/models/func_intersect_ub.py
LArbys/ublarcvserver
02381c937f49a2eab2f754017ab431c3f6fa70d7
[ "Apache-2.0" ]
null
null
null
networks/larflow/models/func_intersect_ub.py
LArbys/ublarcvserver
02381c937f49a2eab2f754017ab431c3f6fa70d7
[ "Apache-2.0" ]
null
null
null
import os,time import torch from larcv import larcv import numpy as np import ROOT as rt from array import array if __name__=="__main__": device = torch.device("cuda:0") #device = torch.device("cpu") IntersectUB.load_intersection_data() IntersectUB.set_img_dims(512,832) IntersectUB.print_intersect_grad() # save a histogram rout = rt.TFile("testout_func_intersect_ub.root","recreate") ttest = rt.TTree("test","Consistency 3D Loss test data") dloss = array('d',[0]) dtime = array('d',[0]) ttest.Branch("loss",dloss,"loss/D") ttest.Branch("dtime",dtime,"dtime/D") # as test, we process some pre-cropped small samples io = larcv.IOManager() io.add_in_file( "../testdata/smallsample/larcv_dlcosmictag_5482426_95_smallsample082918.root" ) # create a unit test file (csv) io.initialize() nentries = io.get_n_entries() print "Number of Entries: ",nentries start = time.time() istart=0 iend=nentries #istart=155 #iend=156 for ientry in xrange(istart,iend): tentry = time.time() io.read_entry( ientry ) if os.environ["LARCV_VERSION"]=="1": ev_adc_test = io.get_data(larcv.kProductImage2D,"adc") ev_flowy2u_test = io.get_data(larcv.kProductImage2D,"larflow_y2u") ev_flowy2v_test = io.get_data(larcv.kProductImage2D,"larflow_y2v") ev_trueflow_test = io.get_data(larcv.kProductImage2D,"pixflow") ev_truevisi_test = io.get_data(larcv.kProductImage2D,"pixvisi") flowy2u = ev_flowy2u_test.Image2DArray()[0] flowy2v = ev_flowy2v_test.Image2DArray()[0] truey2u = ev_trueflow_test.Image2DArray()[0] truey2v = ev_trueflow_test.Image2DArray()[1] visiy2u = ev_truevisi_test.Image2DArray()[0] visiy2v = ev_truevisi_test.Image2DArray()[1] source_meta = ev_adc_test.Image2DArray()[2].meta() targetu_meta = ev_adc_test.Image2DArray()[0].meta() targetv_meta = ev_adc_test.Image2DArray()[1].meta() elif os.environ["LARCV_VERSION"]=="2": ev_adc_test = io.get_data("image2d","adc") ev_flowy2u_test = io.get_data("image2d","larflow_y2u") ev_flowy2v_test = io.get_data("image2d","larflow_y2v") ev_trueflow_test = io.get_data("image2d","pixflow") ev_truevisi_test = io.get_data("image2d","pixvisi") flowy2u = ev_flowy2u_test.as_vector()[0] flowy2v = ev_flowy2v_test.as_vector()[0] truey2u = ev_trueflow_test.as_vector()[0] truey2v = ev_trueflow_test.as_vector()[1] visiy2u = ev_truevisi_test.as_vector()[0] visiy2v = ev_truevisi_test.as_vector()[1] source_meta = ev_adc_test.as_vector()[2].meta() targetu_meta = ev_adc_test.as_vector()[0].meta() targetv_meta = ev_adc_test.as_vector()[1].meta() # numpy arrays index = (0,1) if os.environ["LARCV_VERSION"]=="2": index = (1,0) np_flowy2u = larcv.as_ndarray(flowy2u).transpose(index).reshape((1,1,source_meta.cols(),source_meta.rows())) np_flowy2v = larcv.as_ndarray(flowy2v).transpose(index).reshape((1,1,source_meta.cols(),source_meta.rows())) np_visiy2u = larcv.as_ndarray(visiy2u).transpose(index).reshape((1,1,source_meta.cols(),source_meta.rows())) np_visiy2v = larcv.as_ndarray(visiy2v).transpose(index).reshape((1,1,source_meta.cols(),source_meta.rows())) np_trueflowy2u = larcv.as_ndarray(truey2u).transpose(index).reshape((1,1,source_meta.cols(),source_meta.rows())) np_trueflowy2v = larcv.as_ndarray(truey2v).transpose(index).reshape((1,1,source_meta.cols(),source_meta.rows())) #print "NAN indices (flow-Y2U): ",np.argwhere( np.isnan(np_flowy2u) ) #print "NAN indices (flow-Y2V): ",np.argwhere( np.isnan(np_flowy2v) ) #print "NAN indices (visi-Y2U): ",np.argwhere( np.isnan(np_visiy2u) ) #print "NAN indices (visi-Y2V): ",np.argwhere( np.isnan(np_visiy2v) ) # tensor conversion predflow_y2u_t = torch.from_numpy( np_flowy2u ).to(device=device).requires_grad_() predflow_y2v_t = torch.from_numpy( np_flowy2v ).to(device=device).requires_grad_() trueflow_y2u_t = torch.from_numpy( np_trueflowy2u ).to(device=device).requires_grad_() trueflow_y2v_t = torch.from_numpy( np_trueflowy2v ).to(device=device).requires_grad_() truevisi_y2u_t = torch.from_numpy( np_visiy2u ).to(device=device) truevisi_y2v_t = torch.from_numpy( np_visiy2v ).to(device=device) #print "requires grad: ",predflow_y2u_t.requires_grad,predflow_y2v_t.requires_grad #y2u_t = predflow_y2u_t #y2v_t = predflow_y2v_t y2u_t = trueflow_y2u_t y2v_t = trueflow_y2v_t source_origin = torch.zeros( (1) ).to(device=device) targetu_origin = torch.zeros( (1) ).to(device=device) targetv_origin = torch.zeros( (1) ).to(device=device) for b in xrange(1): source_origin[0] = source_meta.min_x() targetu_origin[0] = targetu_meta.min_x() targetv_origin[0] = targetv_meta.min_x() posyz_fromy2u,posyz_fromy2v = IntersectUB.apply( y2u_t, y2v_t, source_origin, targetu_origin, targetv_origin ) mask = truevisi_y2u_t*truevisi_y2v_t diff = (posyz_fromy2u-posyz_fromy2v) #print "diff.shape=",diff.shape #print "mask.shape=",mask.shape diff[:,0,:,:] *= mask[:,0,:,:] diff[:,1,:,:] *= mask[:,0,:,:] l2 = diff[:,0,:,:]*diff[:,0,:,:] + diff[:,1,:,:]*diff[:,1,:,:] #print "l2 shape: ",l2.shape if mask.sum()>0: lossval = l2.sum()/mask.sum() else: lossval = l2.sum() # backward test tback = time.time() lossval.backward() print " runbackward: ",time.time()-tback," secs" print "Loss (iter {}): {}".format(ientry,lossval.item())," iscuda",lossval.is_cuda dloss[0] = lossval.item() dtime[0] = time.time()-tentry ttest.Fill() end = time.time() tloss = end-start print "Time: ",tloss," secs / ",tloss/nentries," secs per event" rout.cd() ttest.Write() rout.Close()
48.735736
182
0.644217
956dfd3898d4db0373cc4caa6c858737d336c6e2
3,270
py
Python
simple_api/object/permissions.py
ladal1/simple_api
1b5d560476bccad9f68a7331d092dbdb68c48bf7
[ "MIT" ]
1
2021-02-24T22:14:59.000Z
2021-02-24T22:14:59.000Z
simple_api/object/permissions.py
ladal1/simple_api
1b5d560476bccad9f68a7331d092dbdb68c48bf7
[ "MIT" ]
null
null
null
simple_api/object/permissions.py
ladal1/simple_api
1b5d560476bccad9f68a7331d092dbdb68c48bf7
[ "MIT" ]
null
null
null
from inspect import isclass
34.0625
119
0.663609
95728ec4185daad9b5e30451603845ad35ca972b
290
py
Python
Desafios/MODULO 1/Desafio 12.py
deneyjunior/python-mundos-cev
4bc82bf0630f65cf66e5442ae57b72fd4b0207fc
[ "MIT" ]
null
null
null
Desafios/MODULO 1/Desafio 12.py
deneyjunior/python-mundos-cev
4bc82bf0630f65cf66e5442ae57b72fd4b0207fc
[ "MIT" ]
null
null
null
Desafios/MODULO 1/Desafio 12.py
deneyjunior/python-mundos-cev
4bc82bf0630f65cf66e5442ae57b72fd4b0207fc
[ "MIT" ]
null
null
null
# Faa um algoritmo que leia o preo de um produto e mostre o novo preo com um desconto. preco = float(input('Digite o preo atual do produto: R$ ')) desconto = float(input('Digite o valor do desconto (0.X): ')) novopreco = preco * desconto print('O novo preo R$ {}.'.format(novopreco))
58
89
0.713793
957446e0b2daddda7b2cb6fdb76915dc45c186cf
1,188
py
Python
test.py
Ericqle/Senior-Design-Project
aa8e2134b26aef151d3736d306a4fbc9fe69790e
[ "MIT" ]
null
null
null
test.py
Ericqle/Senior-Design-Project
aa8e2134b26aef151d3736d306a4fbc9fe69790e
[ "MIT" ]
null
null
null
test.py
Ericqle/Senior-Design-Project
aa8e2134b26aef151d3736d306a4fbc9fe69790e
[ "MIT" ]
null
null
null
from draw_control import DrawControl if __name__ == '__main__': zotter = DrawControl() test = input("track, rail, pen, hor, ver, diag: ") while(test): if test == "track": dir_in = input('dir step: ') dir = dir_in.split(" ") zotter.track.spin_fixed_step(int(dir[0]), int(dir[1])) elif test == "rail": dir_in = input('dir step: ') dir = dir_in.split(" ") zotter.rail.spin_fixed_step(int(dir[0]), int(dir[1])) elif test == "pen": angle = float(input("angle: ")) zotter.pen_holder.turn_angle(angle) elif test == "hor": steps = input('steps: ') s = int(steps) zotter.draw_hor_line(0, s) elif test == "ver": steps = input('steps: ') s = int(steps) zotter.draw_ver_line(0, s) elif test == "diag": dir_in = input('dir1 dir2 steps1 steps2: ') dir = dir_in.split(" ") zotter.draw_diagonal(int(dir[0]), int(dir[1]), int(dir[2]), int(dir[3])) test = input("track, rail, pen, hor, ver, diag: ") zotter.close_board()
29.7
84
0.505051
95770242fba26f6f07dd35c5f3e789a8b70b5318
2,961
py
Python
fcos/datasets/cityscapes.py
rosshemsley/fcos
de30bb2c78df54cae6814282c7166beed333d34c
[ "MIT" ]
5
2020-08-02T11:03:25.000Z
2021-12-12T19:37:09.000Z
fcos/datasets/cityscapes.py
rosshemsley/fcos
de30bb2c78df54cae6814282c7166beed333d34c
[ "MIT" ]
null
null
null
fcos/datasets/cityscapes.py
rosshemsley/fcos
de30bb2c78df54cae6814282c7166beed333d34c
[ "MIT" ]
1
2021-03-05T12:19:48.000Z
2021-03-05T12:19:48.000Z
import pathlib import logging from torch import nn import numpy as np import torch import torch.functional as F import torchvision.transforms as T from torch.utils.data import Dataset from torchvision.datasets.cityscapes import Cityscapes import cv2 from torchvision.transforms import ToPILImage from torch.utils.data import DataLoader from torchvision.transforms import ( RandomResizedCrop, RandomHorizontalFlip, Normalize, RandomErasing, Resize, ToTensor, RandomAffine, Compose, ColorJitter, ) logger = logging.getLogger(__name__) from enum import Enum def collate_fn(batch): return ( torch.stack([b[0] for b in batch], dim=0), [b[1] for b in batch], [b[2] for b in batch], ) def tensor_to_image(t) -> np.ndarray: """ Return a PIL image (RGB) """ img = Compose([ToPILImage(),])(t) return np.array(img) def _poly_to_labels(image_tensor, poly): _, img_height, img_width = image_tensor.shape # TODO(Ross): fix this. h = poly["imgHeight"] w = poly["imgWidth"] scaling = img_height / h box_labels = [] class_labels = [] for obj in poly["objects"]: if obj["label"] == "car": polygon = obj["polygon"] min_x = min(x for x, _ in polygon) * scaling max_x = max(x for x, _ in polygon) * scaling max_y = max(y for _, y in polygon) * scaling min_y = min(y for _, y in polygon) * scaling box_labels.append(torch.FloatTensor([min_x, min_y, max_x, max_y])) class_labels.append(torch.IntTensor([1])) if len(class_labels) == 0: return torch.zeros((0, 1)), torch.zeros(0, 4) return torch.stack(class_labels), torch.stack(box_labels) def _get_split(split_name: str) -> Split: if split_name is Split.TEST: return "test" elif split_name is Split.VALIDATE: return "val" elif split_name is Split.TRAIN: return "train" else: raise ValueError(f"unknown split kind {split_name}")
24.882353
90
0.628842
957893734aaf183904dce73b5e054520162c5d69
11,838
py
Python
flask_jquery/app.py
lmj0328/SocialMediaReport
555aa3551844b5ee67bcf9296d574fd99977982d
[ "MIT" ]
1
2021-02-28T05:01:37.000Z
2021-02-28T05:01:37.000Z
flask_jquery/app.py
lmj0328/SocialMediaReport
555aa3551844b5ee67bcf9296d574fd99977982d
[ "MIT" ]
null
null
null
flask_jquery/app.py
lmj0328/SocialMediaReport
555aa3551844b5ee67bcf9296d574fd99977982d
[ "MIT" ]
1
2020-03-12T02:08:10.000Z
2020-03-12T02:08:10.000Z
from flask import Flask, render_template, request, jsonify from flask import request from flask import Response from flask import url_for from flask import jsonify import GetOldTweets3 as got import pandas as pd import datetime import numpy as np import requests import json from pyquery import PyQuery as pq app = Flask(__name__) if __name__ == '__main__': app.run(debug=True, threaded=True)
41.391608
755
0.598496