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
9b3a30a350d4766ec5248befbf7cb18770423342
10,867
py
Python
molsysmt/forms/viewers/api_nglview_NGLWidget.py
uibcdf/MolSysMT
9866a6fb090df9fff36af113a45164da4b674c09
[ "MIT" ]
3
2020-06-02T03:55:52.000Z
2022-03-21T04:43:52.000Z
molsysmt/forms/viewers/api_nglview_NGLWidget.py
uibcdf/MolSysMT
9866a6fb090df9fff36af113a45164da4b674c09
[ "MIT" ]
28
2020-06-24T00:55:53.000Z
2021-07-16T22:09:19.000Z
molsysmt/forms/viewers/api_nglview_NGLWidget.py
uibcdf/MolSysMT
9866a6fb090df9fff36af113a45164da4b674c09
[ "MIT" ]
1
2021-06-17T18:55:25.000Z
2021-06-17T18:55:25.000Z
from molsysmt._private_tools.exceptions import * from molsysmt.forms.common_gets import * import numpy as np from nglview import widget as _nglview_widget import importlib import sys from molsysmt.molecular_system import molecular_system_components form_name='nglview.NGLWidget' is_form = { _nglview_widget.NGLWidget: form_name } info=["NGLView visualization native object","http://nglviewer.org/nglview/latest/_modules/nglview/widget.html"] has = molecular_system_components.copy() for ii in ['elements', 'coordinates', 'box']: has[ii]=True ###### Get ## Atom ## group ## component ## molecule ## chain ## entity ## system ## bond ###### Set
33.334356
164
0.767829
9b3e5ba25f6539f2d54fc3ee309eb76f77501061
1,435
py
Python
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
1
2019-11-03T08:28:59.000Z
2019-11-03T08:28:59.000Z
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
null
null
null
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
null
null
null
"""Hotkeys plugin example this module contains the general, non gui-toolkit specific part of the code """ # uncomment these where appropriate # import collections # from example_app_keys_gui import layout_extra_fields_* # om dit beschikbaar te maken voor import # uncomment this to define a routine to (re)build the csv file from source data # showinfo is a switch for in case you want to show instructions # otherstuff can be used to pass on things like a list of possible commands # to method add_extra_attributes # ** corresponds to the RebuildCSV setting ** # def buildcsv(parent, showinfo=True): # shortcuts = collections.defaultdict() # otherstuff = {} # ...implement some logic here... # return shortcuts, otherstuff # uncomment these to define routines to be used by methods of a HotKeyPanel instance # ** corresponds to the ShowDetails setting ** # win is a reference to the HotKeyPanel instance # def add_extra_attributes(win): # """add attributes specific to this plugin # e.g a shorter name for a collection read from buildcsv's otherstuff # some of these are needed when filling fields in the details part of the screen # """ # win.contextslist = win.otherstuff['...'] # win.commandslist = win.otherstuff['...'] # uncomment this to define a routine to write back the keydefs to the source data # ** corresponds to the RedefineKeys setting ** # def savekeys(parent): # pass
41
99
0.738676
9b40ad333c949a389ee209ebc469efbe2a1da3d3
8,525
py
Python
electrumx/lib/script.py
Electrum-RVN-SIG/electrumx-ravencoin
6b888a9246257037c95cdaffcce3386181050398
[ "MIT" ]
11
2021-04-03T21:29:44.000Z
2022-03-28T09:37:34.000Z
electrumx/lib/script.py
Electrum-RVN-SIG/electrumx-ravencoin
6b888a9246257037c95cdaffcce3386181050398
[ "MIT" ]
4
2021-05-14T13:10:01.000Z
2021-12-03T15:12:23.000Z
electrumx/lib/script.py
Electrum-RVN-SIG/electrumx-ravencoin
6b888a9246257037c95cdaffcce3386181050398
[ "MIT" ]
4
2021-04-05T22:07:06.000Z
2021-09-23T08:04:48.000Z
# Copyright (c) 2016-2017, Neil Booth # # All rights reserved. # # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # and warranty status of this software. '''Script-related classes and functions.''' import struct from enum import IntEnum from electrumx.lib.util import unpack_le_uint16_from, unpack_le_uint32_from, \ pack_le_uint16, pack_le_uint32 # Paranoia to make it hard to create bad scripts assert OpCodes.OP_DUP == 0x76 assert OpCodes.OP_HASH160 == 0xa9 assert OpCodes.OP_EQUAL == 0x87 assert OpCodes.OP_EQUALVERIFY == 0x88 assert OpCodes.OP_CHECKSIG == 0xac assert OpCodes.OP_CHECKMULTISIG == 0xae
26.892744
110
0.598827
9b4525dbfb8005b0d75af097477692fce19cafdb
3,854
py
Python
main.py
poplock1/Number_guesser
2766d73e0f1babc980865de8fabe2f37d9ee43a6
[ "MIT" ]
null
null
null
main.py
poplock1/Number_guesser
2766d73e0f1babc980865de8fabe2f37d9ee43a6
[ "MIT" ]
null
null
null
main.py
poplock1/Number_guesser
2766d73e0f1babc980865de8fabe2f37d9ee43a6
[ "MIT" ]
null
null
null
import pygame import tensorflow as tf import sys import settings as stg import matplotlib.pyplot as plt from board import Grid import gui import numpy as np game = Game() while game.running: game.new_guess() pygame.quit()
31.590164
123
0.577582
9b454cd03eb2a08f7263b1381a0130bff6f74d66
825
py
Python
examples/maskrcnn_fastai.py
ramaneswaran/mantisshrimp
d30c056f1f9f26a2ce42da73cfb32d591321f426
[ "Apache-2.0" ]
null
null
null
examples/maskrcnn_fastai.py
ramaneswaran/mantisshrimp
d30c056f1f9f26a2ce42da73cfb32d591321f426
[ "Apache-2.0" ]
8
2020-06-16T18:06:42.000Z
2020-09-15T22:35:56.000Z
examples/maskrcnn_fastai.py
ramaneswaran/mantisshrimp
d30c056f1f9f26a2ce42da73cfb32d591321f426
[ "Apache-2.0" ]
null
null
null
from mantisshrimp import * from mantisshrimp.hub.pennfundan import * from mantisshrimp.engines.fastai import * import albumentations as A source = get_pennfundan_data() parser = PennFundanParser(source) splitter = RandomSplitter([0.8, 0.2]) train_records, valid_records = parser.parse(splitter) train_transforms = AlbuTransform([A.Flip()]) train_dataset = Dataset(train_records, train_records) valid_dataset = Dataset(valid_records) model = MantisMaskRCNN(num_classes=2) metric = COCOMetric(valid_records, bbox=True, mask=True) train_dataloader = model.dataloader(train_dataset, batch_size=2, num_workers=2) valid_dataloader = model.dataloader(valid_dataset, batch_size=2, num_workers=2) learn = rcnn_learner( dls=[train_dataloader, valid_dataloader], model=model, metrics=[metric] ) learn.fine_tune(3, lr=2e-4)
28.448276
79
0.796364
9b465713a6d45355da79d52e919ae9d389a96675
10,649
py
Python
setup.py
mdavezac/bempp
bc573062405bda107d1514e40b6153a8350d5ab5
[ "BSL-1.0" ]
null
null
null
setup.py
mdavezac/bempp
bc573062405bda107d1514e40b6153a8350d5ab5
[ "BSL-1.0" ]
null
null
null
setup.py
mdavezac/bempp
bc573062405bda107d1514e40b6153a8350d5ab5
[ "BSL-1.0" ]
null
null
null
from os.path import basename, dirname, join, abspath from setuptools import setup, Extension from distutils.command.build import build as dBuild from setuptools.command.install import install as dInstall from setuptools.command.build_ext import build_ext as dBuildExt from setuptools.command.bdist_egg import bdist_egg as dBuildDistEgg from setuptools.command.sdist import sdist as dSDist from setuptools.command.egg_info import egg_info as dEggInfo from distutils.dir_util import mkpath source_dir = dirname(abspath(__file__)) package_dir = join(source_dir, 'pkg_install') mkpath(package_dir) def as_preload_file(name, info): """ Python information to cmake commandline """ result = [] if len(info.get('libraries', [])): libs = ('-l' + '-l'.join(info['libraries'])).rstrip().lstrip() if len(info.get('library_dirs', [])): libdirs = ('-L' + '-L'.join(info['library_dirs'])).rstrip().lstrip() else: libdirs = "" result.append(cmake_cache_line("%s_LIBRARIES" % name, "%s %s" %(libdirs, libs))) if len(info.get('include_dirs', [])): incs = ';'.join(info['include_dirs']).rstrip().lstrip() result.append(cmake_cache_line("%s_INCLUDE_DIRS" % name, incs)) return result def cmake_executable(): """ Path to cmake executable """ from os.path import exists from os import environ from distutils.spawn import find_executable cmake = find_executable('cmake') if cmake is None and 'CASAPATH' in environ: # Tries to out-smart CASA. # Look places cmake might be that casa removes from path. directories = [ join('/', 'usr', 'local', 'bin'), join(environ['HOME'], 'bin'), join(environ['HOME'], '.local', 'bin'), join(environ['HOME'], 'usr', 'bin'), join('/', 'sw', 'bin') # -- default Fink location ] for directory in directories: if exists(join(directory, 'cmake')): cmake = join(directory, 'cmake') break if cmake is None: raise RuntimeError('Could not find cmake executable in path') return cmake setup( name = "bempp", version = "2.0", setup_requires = ['numpy', 'pytest'], install_requires = ['numpy', 'pytest'], platforms = ['GNU/Linux','Unix','Mac OS-X'], zip_safe = False, cmdclass = { 'build': Build, 'install': Install, 'build_ext': BuildExt, 'bdist_egg': BuildDistEgg, 'egg_info': EggInfo }, author = "Tim Betcke", author_email = "t.betcke@ucl.ac.uk", description = "BEMP does what it does well", license = "MIT", url = "https://github.com/bempp/bempp", ext_modules = [Extension('bempp._core', [])], ext_package = 'bempp', packages = ['bempp', 'PyTrilinos'], package_dir = { 'bempp': join(basename(package_dir), 'bempp'), 'PyTrilinos': join(basename(package_dir), 'PyTrilinos'), }, include_package_data=True, keywords= "mathology", classifiers = [ 'Development Status :: 0 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', ], long_description = open(join(dirname(__file__), 'README'), 'r').read() )
35.855219
88
0.596676
9b465aec5248b4a295d099e00bd63dbcb0fdd474
677
py
Python
config/__init__.py
CSuppan/two-shot-brdf-shape
352201b66bfa5cd5e25111451a6583a3e7d499f0
[ "BSD-Source-Code" ]
null
null
null
config/__init__.py
CSuppan/two-shot-brdf-shape
352201b66bfa5cd5e25111451a6583a3e7d499f0
[ "BSD-Source-Code" ]
null
null
null
config/__init__.py
CSuppan/two-shot-brdf-shape
352201b66bfa5cd5e25111451a6583a3e7d499f0
[ "BSD-Source-Code" ]
null
null
null
# ----------------------------------------------------------------------- # Copyright (c) 2020, NVIDIA Corporation. All rights reserved. # # This work is made available # under the Nvidia Source Code License (1-way Commercial). # # Official Implementation of the CVPR2020 Paper # Two-shot Spatially-varying BRDF and Shape Estimation # Mark Boss, Varun Jampani, Kihwan Kim, Hendrik P. A. Lensch, Jan Kautz # ----------------------------------------------------------------------- import json import os
28.208333
73
0.567208
9b4985b49cd879340b47fb541710318c2bb259dc
26,765
py
Python
demo/rrteAutoLog.py
CharlesWangYu/guitest
785f234321143a4a3f4afe92376dc4f138489b31
[ "BSD-3-Clause" ]
null
null
null
demo/rrteAutoLog.py
CharlesWangYu/guitest
785f234321143a4a3f4afe92376dc4f138489b31
[ "BSD-3-Clause" ]
null
null
null
demo/rrteAutoLog.py
CharlesWangYu/guitest
785f234321143a4a3f4afe92376dc4f138489b31
[ "BSD-3-Clause" ]
null
null
null
import pdb import logging import os import sys import time import subprocess import xlrd import win32gui import win32api import win32con #import comtypes from configparser import ConfigParser from comtypes.client import * from ctypes import * class RRTE: DELAY_RRET_START = 8 DELAY_WAIT_DLG = 3 NAME_RRTE_APP = 'Reference Run-time Environment' NAME_TRACE_LEVEL = 'Microsoft.Windows.Controls.Ribbon.RibbonGallery Items.Count:1' NAME_BROWSER_MODEL = 'Fdi.Client.Catalog.DeviceCatalogBrowserModel' NAME_TOP_TAB = 'Fdi.Client.DeviceUi.ViewModel.DeviceUiHostContainerItemViewModel' NAME_X_BTN = 'X' NAME_ONLINE_PARAMS = 'OnlineParameters' NAME_OFFLINE_TAB = 'Offline root menu' NAME_ONLINE_TAB = 'Online' NAME_DEVICE_ROOT_MENU = 'Device root menu' NAME_DIAGNOSTIC_ROOT_MENU = 'Diagnostic root menu' NAME_MAINT_ROOT_MENU = 'Maintenance root menu' NAME_PROCESS_ROOT_MENU = 'Process variables root menu' NAME_HEALTH_TAB = 'Health' NAME_TREE_ROOT = 'DD_ExplorerView' NAME_APPLY_BTN = 'Apply' NAME_REVERT_BTN = 'Revert' def close(self): ''' titleBar = UIA.findFirstElem(self.RRTERoot, UIA.Client.UIA_TitleBarControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) pdb.set_trace() assert UIA.isUIAElem(titleBar) closeBtn = UIA.findFirstElem(titleBar, 'Close', UIA.Client.UIA_AutomationIdPropertyId, scope=UIA.Client.TreeScope_Children) assert UIA.isUIAElem(closeBtn) UIA.pushButton(closeBtn) ''' hwnd = win32gui.FindWindow(None, RRTE.NAME_RRTE_APP) win32gui.SetForegroundWindow(hwnd) win32api.keybd_event(win32con.VK_MENU, 0, 0, 0) win32api.keybd_event(win32con.VK_F4, 0, 0, 0) win32api.keybd_event(win32con.VK_F4, 0, win32con.KEYEVENTF_KEYUP, 0) win32api.keybd_event(win32con.VK_MENU, 0, win32con.KEYEVENTF_KEYUP, 0) time.sleep(4) #self.provider.terminate() #time.sleep(4) logging.info('Close RRTE') class TreeNode: def __init__(self, elem, parent=None, left=None, right=None): self.elem = elem self.parent = parent # It's logic parent node in tree, not in binary tree self.left = left self.right = right # RRTE element class if __name__ == '__main__': #pdb.set_trace() logging.basicConfig(level = logging.INFO) # get hart register log from RRTE rrte = RRTE() rrte.clearOutput() rrte.start() rrte.createNodeTree(rrte.tree.root.left) #pdb.set_trace() rrte.closeMenu() #rrte.close() rrte.clearRegistLog() rrte.traversal(rrte.tree.root.left) #rrte.close()
37.173611
256
0.74986
9b49b82dae00206e28c1ae751fd26cec3f45c20f
1,052
py
Python
eregs_core/migrations/0006_analysisparagraph_analysissection_footnote.py
cfpb/eregs-2.0
820bd56fa5265ee25f88fe8dce4c7aa092e5d6a3
[ "CC0-1.0" ]
1
2019-02-25T21:43:36.000Z
2019-02-25T21:43:36.000Z
eregs_core/migrations/0006_analysisparagraph_analysissection_footnote.py
cfpb/eregs-2.0
820bd56fa5265ee25f88fe8dce4c7aa092e5d6a3
[ "CC0-1.0" ]
46
2017-03-16T21:58:49.000Z
2017-09-05T16:21:29.000Z
eregs_core/migrations/0006_analysisparagraph_analysissection_footnote.py
cfpb/eregs-2.0
820bd56fa5265ee25f88fe8dce4c7aa092e5d6a3
[ "CC0-1.0" ]
7
2017-06-07T14:56:46.000Z
2021-02-20T10:50:48.000Z
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-03 17:48 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion
23.909091
95
0.497148
9b4a434127e56ce9f10a860ea190256cba7c7ff6
2,592
py
Python
project-euler/261/euler_261_v3.py
zoffixznet/project-euler
39921379385ae2521354c7266a541c46785e85a2
[ "MIT" ]
null
null
null
project-euler/261/euler_261_v3.py
zoffixznet/project-euler
39921379385ae2521354c7266a541c46785e85a2
[ "MIT" ]
null
null
null
project-euler/261/euler_261_v3.py
zoffixznet/project-euler
39921379385ae2521354c7266a541c46785e85a2
[ "MIT" ]
null
null
null
# The Expat License # # Copyright (c) 2017, Shlomi Fish # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import sys if sys.version_info > (3,): long = int xrange = range LIM = 10000000000 if __name__ == "__main__": main()
28.483516
79
0.531636
9b4addb7383ad54fbd74f3fafd29a6bba825287f
4,331
py
Python
Naive_Bayes/lib/naive_bayes.py
DavexPro/MLStudy
869ab4e569fe1cde1a3a6238977282b81a71fc81
[ "MIT" ]
null
null
null
Naive_Bayes/lib/naive_bayes.py
DavexPro/MLStudy
869ab4e569fe1cde1a3a6238977282b81a71fc81
[ "MIT" ]
null
null
null
Naive_Bayes/lib/naive_bayes.py
DavexPro/MLStudy
869ab4e569fe1cde1a3a6238977282b81a71fc81
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # coding=utf-8 # -*- utf8 -*- # author=dave.fang@outlook.com # create=20170330 import math from lib.log import LOGGER def calc_mean(numbers): """ :param numbers: :return: """ return sum(numbers) / float(len(numbers)) def calc_stdev(numbers): """ :param numbers: :return: """ avg = calc_mean(numbers) variance = sum([pow(x - avg, 2) for x in numbers]) / float(len(numbers) - 1) return math.sqrt(variance) def calc_probability(x, mean, stdev): """ :param x: :param mean: :param stdev: :return: """ exponent = math.exp(-(math.pow(x - mean, 2) / (2 * math.pow(stdev, 2)))) return (1 / (math.sqrt(2 * math.pi) * stdev)) * exponent
31.384058
111
0.563842
9b4d709976efa66a27e01fd0d18980bfda0f6d63
1,004
py
Python
views/sprite_views/combo_attack_sprite.py
kuyu12/pygame_fight_game
3bbc286b9f33c6d6d9db9bea21f9b7af15247df5
[ "MIT" ]
1
2020-08-03T07:54:59.000Z
2020-08-03T07:54:59.000Z
views/sprite_views/combo_attack_sprite.py
kuyu12/pygame_fight_game
3bbc286b9f33c6d6d9db9bea21f9b7af15247df5
[ "MIT" ]
null
null
null
views/sprite_views/combo_attack_sprite.py
kuyu12/pygame_fight_game
3bbc286b9f33c6d6d9db9bea21f9b7af15247df5
[ "MIT" ]
null
null
null
from views.sprite_views.attack_sprite import AttackSprite, AttackState from views.sprite_views.movement_sprite import Direction, State
37.185185
115
0.721116
9b4eebb09566e097a91f5dda6e303d168c9b41e8
337
py
Python
app/migrations/0024_auto_20190801_2013.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
app/migrations/0024_auto_20190801_2013.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
app/migrations/0024_auto_20190801_2013.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
# Generated by Django 2.2.3 on 2019-08-01 18:13 from django.db import migrations
18.722222
47
0.602374
9b4f6caa8f4e00e79f672af5d86d90e4902524c8
548
py
Python
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
from flask import Blueprint from flask_security import SQLAlchemyUserDatastore from app import db from app.users.models import User, Role bp = Blueprint('users', __name__, template_folder='templates') user_datastore = SQLAlchemyUserDatastore(db, User, Role) # Create a user to test with
28.842105
86
0.755474
9b4fcde6493e496f8266585c418f51bc87980875
6,457
py
Python
payctl/utils.py
arjanz/substrate-payctl
57d13155ffd8e200d54ec4d4382a09b757fa8211
[ "MIT" ]
null
null
null
payctl/utils.py
arjanz/substrate-payctl
57d13155ffd8e200d54ec4d4382a09b757fa8211
[ "MIT" ]
null
null
null
payctl/utils.py
arjanz/substrate-payctl
57d13155ffd8e200d54ec4d4382a09b757fa8211
[ "MIT" ]
null
null
null
from substrateinterface import SubstrateInterface, Keypair from substrateinterface.utils.ss58 import ss58_encode, ss58_decode # # get_config - Get a default and validator specific config elements from args and config. # # # get_eras_rewards_point - Collect the ErasRewardPoints (total and invididual) for a given range of eras. # # # get_eras_validator_rewards - Collect the ErasValidatorReward for a given range of eras. # # # get_eras_payment_info - Combine information from ErasRewardPoints and ErasValidatorReward for given # range of eras to repor the amount of per validator instead of era points. # # # get_eras_payment_info_filtered - Similar than get_eras_payment_info but applying some filters; # 1 . Include only eras containing given acconts. # 2 . Include only eras containing unclaimed rewards. # # NOTE: The returned structure is slighly different than # get_eras_payment_info # # # get_included_accounts - Get the list (for the filtering) of included accounts from the args and config. # # # get_accounts_ledger - Collect the Ledger for a given list of accounts. # # # get_keypair - Generate a Keypair from args and config. # # # get_nonce - Get the next nonce to be used on a signature for a given account. #
32.447236
106
0.647205
9b52940acbc894f83db7c38174cba4aed0fe37b6
7,279
py
Python
Notepad++/programfiles/Notepad++/plugins/PythonScript/scripts/Samples/LogfileLexer.py
slim71/Utils
5fcb0ec604cc039668f132c102d6bd2050bcea5c
[ "Unlicense" ]
null
null
null
Notepad++/programfiles/Notepad++/plugins/PythonScript/scripts/Samples/LogfileLexer.py
slim71/Utils
5fcb0ec604cc039668f132c102d6bd2050bcea5c
[ "Unlicense" ]
null
null
null
Notepad++/programfiles/Notepad++/plugins/PythonScript/scripts/Samples/LogfileLexer.py
slim71/Utils
5fcb0ec604cc039668f132c102d6bd2050bcea5c
[ "Unlicense" ]
null
null
null
# -*- coding: utf-8 -*- """ LogfileLexer - Demo Highlights whole lines which matches the regex. Usage: Load a logfile, modify error and warning regex and run script to see how it works Note: By commenting or deleting everything, including, the <comment_or_delete> tags it is ready to be used as an additional lexer """ from Npp import editor, notepad, LEXER, SCINTILLANOTIFICATION, NOTIFICATION, LANGTYPE import re try: # on first run this will generate an NameError exception LOGFILE_LEXER().main() except NameError: LOGFILE_LEXER().main()
37.911458
96
0.615469
9b52da16ba296fc3a30eb27a8abe81a9c2046c19
913
py
Python
py_mybatis/mapper_func.py
malone081021/py_mybatis
bea69b2aa0d17d9a96ddf596bc63bd88e5a2045e
[ "Apache-2.0" ]
15
2020-08-20T03:57:13.000Z
2022-02-01T03:08:14.000Z
py_mybatis/mapper_func.py
malone081021/py_mybatis
bea69b2aa0d17d9a96ddf596bc63bd88e5a2045e
[ "Apache-2.0" ]
3
2020-08-20T05:43:22.000Z
2020-09-23T08:08:10.000Z
py_mybatis/mapper_func.py
malone081021/py_mybatis
bea69b2aa0d17d9a96ddf596bc63bd88e5a2045e
[ "Apache-2.0" ]
10
2020-12-10T06:17:20.000Z
2022-02-26T07:07:48.000Z
from .logger import LOG from .funs import * # # PY_PARAM_FUNCTION = PyFunction() # for fun_name in default_fun_dict: PY_PARAM_FUNCTION.register_func(fun_name, default_fun_dict[fun_name]) # PY_RESULT_FUNCTION = PyFunction()
25.361111
73
0.682366
9b5316477ce7fd6da19f6364699eb3e0afb2374d
87
py
Python
envisage/plugins/ipython_kernel/api.py
janvonrickenbach/Envisage_wxPhoenix_py3
cf79e5b2a0c3b46898a60b5fe5a2fb580604808b
[ "BSD-3-Clause" ]
null
null
null
envisage/plugins/ipython_kernel/api.py
janvonrickenbach/Envisage_wxPhoenix_py3
cf79e5b2a0c3b46898a60b5fe5a2fb580604808b
[ "BSD-3-Clause" ]
1
2017-05-22T21:15:22.000Z
2017-05-22T21:15:22.000Z
envisage/plugins/ipython_kernel/api.py
janvonrickenbach/Envisage_wxPhoenix_py3
cf79e5b2a0c3b46898a60b5fe5a2fb580604808b
[ "BSD-3-Clause" ]
1
2019-10-01T07:03:58.000Z
2019-10-01T07:03:58.000Z
from ipython_kernel_plugin import IPythonKernelPlugin, IPYTHON_KERNEL_PROTOCOL # noqa
43.5
86
0.885057
9b533be27e81a8ec5389e0a6e1d39a3dcf1f48a7
3,283
py
Python
multiAgentEnv/maenv/mpe/_mpe_utils/forward_models/forward_model.py
eranbTAU/Closing-the-Reality-Gap-for-a-Multi-Agent-System-Using-GAN
3df5f8ba1069ce3f16f1ab743da9cbdd3bddd43c
[ "MIT" ]
null
null
null
multiAgentEnv/maenv/mpe/_mpe_utils/forward_models/forward_model.py
eranbTAU/Closing-the-Reality-Gap-for-a-Multi-Agent-System-Using-GAN
3df5f8ba1069ce3f16f1ab743da9cbdd3bddd43c
[ "MIT" ]
null
null
null
multiAgentEnv/maenv/mpe/_mpe_utils/forward_models/forward_model.py
eranbTAU/Closing-the-Reality-Gap-for-a-Multi-Agent-System-Using-GAN
3df5f8ba1069ce3f16f1ab743da9cbdd3bddd43c
[ "MIT" ]
1
2022-02-22T11:06:40.000Z
2022-02-22T11:06:40.000Z
import torch import numpy as np import os from ..utils import load_params, get_scaler, get_rescaler
35.301075
115
0.603412
9b5505ca703b310b156073810269854022e84cd6
948
py
Python
src/personal/views.py
vybhavpai/Blog
8e0adf52bfba5502f787dd339866f39b5f4856f4
[ "bzip2-1.0.6" ]
null
null
null
src/personal/views.py
vybhavpai/Blog
8e0adf52bfba5502f787dd339866f39b5f4856f4
[ "bzip2-1.0.6" ]
17
2020-06-06T00:04:23.000Z
2022-03-12T00:25:43.000Z
src/personal/views.py
vybhavpai/Blog
8e0adf52bfba5502f787dd339866f39b5f4856f4
[ "bzip2-1.0.6" ]
null
null
null
from django.shortcuts import render from blog.models import BlogPost from operator import attrgetter from blog.views import get_blog_queryset from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator # Create your views here. BLOG_POSTS_PER_PAGE = 1
27.085714
90
0.781646
9b551741cab1afbab203fa568039b9c06d277d87
5,771
py
Python
tools/makeplugin.py
rhcad/x3py
a631b9130673683f9c0395209ff49b94eb0ceac6
[ "Apache-2.0" ]
214
2015-01-25T15:54:57.000Z
2022-03-13T13:20:34.000Z
tools/makeplugin.py
HAERBINWINE/x3py
a631b9130673683f9c0395209ff49b94eb0ceac6
[ "Apache-2.0" ]
18
2015-03-11T15:42:56.000Z
2021-12-23T10:11:03.000Z
tools/makeplugin.py
HAERBINWINE/x3py
a631b9130673683f9c0395209ff49b94eb0ceac6
[ "Apache-2.0" ]
126
2015-01-19T03:28:48.000Z
2022-03-16T06:52:57.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Function: Create a plugin project based on example project. This script has been tested with ActivePython 2.7/3.2. Usage: python makeplugin.py [prjname [pkgname [srcprj [srcpkg [useswig]]]]] or double click the file 'makeplugin.py'. prjname: name of the new project. pkgname: package name of the new project, the default value is 'example'. srcprj: template (exists) project name, the default value is 'pltempl'. srcpkg: package name of the template project, the default value is 'example'. useswig: need swig files or not (y/n), the default value is 'n'. Creator: Zhang Yungui <rhcad@hotmail.com> Date: 2011.11.14 ChangeList: 1. Implemented the function: multi_replace, copyfiles, makeproj 2. Auto copy interface files and skip swig files. [2011.12.14] 3. Auto skip empty folders. [2012.02.21] """ import os, sys, re, uuid if __name__=="__main__": prjname = inputparam(1, 'New project name: ') pkgname = inputparam(2, 'Package name of the new project (default: example): ', 'example') srcprj = inputparam(3, 'Template (exists) project name (default: pltempl): ', 'pltempl') srcpkg = inputparam(4, 'Package name of the template project (default: example): ', 'example') useswig = inputparam(5, 'Need swig (y/n) ? (default: n): ', 'n') makeproj(prjname, pkgname, srcprj, srcpkg, 'n' in useswig) if len(sys.argv) < 3: raw_input("Press <ENTER> to end.")
41.517986
99
0.582741
9b56838a87136d14ec040f4d65ab94a7e2ebd723
146,532
py
Python
V1/R1/N2HF_armors_v1_r1.py
N2HF-OFFICIAL/n2hf
de4a26a3b70082cd2375cc3fe7a5c2fd09cec085
[ "MIT" ]
null
null
null
V1/R1/N2HF_armors_v1_r1.py
N2HF-OFFICIAL/n2hf
de4a26a3b70082cd2375cc3fe7a5c2fd09cec085
[ "MIT" ]
null
null
null
V1/R1/N2HF_armors_v1_r1.py
N2HF-OFFICIAL/n2hf
de4a26a3b70082cd2375cc3fe7a5c2fd09cec085
[ "MIT" ]
null
null
null
from PIL import Image import os import numpy as np import pandas as pd from random import seed from random import randint dirname = os.path.dirname('') dimensions = 600, 600 make_armors("doojunggap", 500, 54) make_armors("gyungbyungap", 500, 41) make_armors("chalgap", 34, 12113524)
163.175947
364
0.591611
9b57a3de7044f1cb8c387a458b45c232a75ebe2f
700
py
Python
maze/model/stack.py
cleuton/pythondrops
8190567fc3c0b54b4cb2465d989f1bc992ca89da
[ "Apache-2.0" ]
8
2018-06-15T05:37:41.000Z
2021-05-23T23:40:45.000Z
maze/model/stack.py
cleuton/pythondrops
8190567fc3c0b54b4cb2465d989f1bc992ca89da
[ "Apache-2.0" ]
2
2018-06-15T05:39:59.000Z
2019-08-30T01:16:30.000Z
maze/model/stack.py
cleuton/pythondrops
8190567fc3c0b54b4cb2465d989f1bc992ca89da
[ "Apache-2.0" ]
5
2018-06-15T05:37:42.000Z
2019-08-29T10:19:22.000Z
from collections import namedtuple
31.818182
61
0.594286
9b5a7ee5d76db4300a01a1e469082c5cdcc09d8b
468
py
Python
polynomials_on_simplices/calculus/test/real_interval_test.py
FAndersson/polynomials_on_simplices
f015a4772c817bfa99b0d6b726667a38a174b064
[ "MIT" ]
1
2021-03-17T11:41:21.000Z
2021-03-17T11:41:21.000Z
polynomials_on_simplices/calculus/test/real_interval_test.py
FAndersson/polynomials_on_simplices
f015a4772c817bfa99b0d6b726667a38a174b064
[ "MIT" ]
null
null
null
polynomials_on_simplices/calculus/test/real_interval_test.py
FAndersson/polynomials_on_simplices
f015a4772c817bfa99b0d6b726667a38a174b064
[ "MIT" ]
null
null
null
import sys import pytest from polynomials_on_simplices.calculus.real_interval import equivalent_periodic_element if __name__ == "__main__": pytest.main(sys.argv)
22.285714
87
0.700855
9b5b1c2f681b75f91aedc79ae49917274c836bb0
761
py
Python
client codes/client v2/get_code_when_free.py
nathaniel-security/Localhost-distributed-computing-engine
4643c22f563a969ccaf1062da17696819e00ab9a
[ "MIT" ]
null
null
null
client codes/client v2/get_code_when_free.py
nathaniel-security/Localhost-distributed-computing-engine
4643c22f563a969ccaf1062da17696819e00ab9a
[ "MIT" ]
null
null
null
client codes/client v2/get_code_when_free.py
nathaniel-security/Localhost-distributed-computing-engine
4643c22f563a969ccaf1062da17696819e00ab9a
[ "MIT" ]
null
null
null
from client_database_connection import mycursor from ftp import * from config import free config = json.loads(open('config.json').read()) node_id = config['node id'] local_path = config['local path'] while free: sql = "SELECT code_id FROM code_node where node_id = " + node_id mycursor.execute(sql) node = mycursor.fetchone() code_id = mycursor.fetchone() if(code_id is not None): free = False break hostname = ftp_hostname() password = ftp_password() user = ftp_user() sql = "SELECT code_path FROM code_data where code_id = " + code_id mycursor.execute(sql) remote_path = mycursor.fetchone() connect(hostname, user , password ,local_path ,remote_path) os.system("python run.py")
22.382353
69
0.680683
9b5be5c5ed6504a2c9ccae3984febdda2e35498d
5,862
py
Python
server/app.py
LeartKrasniqi/Sign-Language-Interpreter
46ffef29eaf3746d48654bc4430d6e921120d33e
[ "MIT" ]
3
2020-02-25T14:43:33.000Z
2020-10-10T08:42:27.000Z
server/app.py
LeartKrasniqi/Sign-Language-Interpreter
46ffef29eaf3746d48654bc4430d6e921120d33e
[ "MIT" ]
null
null
null
server/app.py
LeartKrasniqi/Sign-Language-Interpreter
46ffef29eaf3746d48654bc4430d6e921120d33e
[ "MIT" ]
1
2020-02-24T19:46:11.000Z
2020-02-24T19:46:11.000Z
import os from flask import Flask, flash, request, redirect, url_for, jsonify from flask_cors import CORS from werkzeug.utils import secure_filename import subprocess # set up text to speech map from nltk.stem import PorterStemmer from nltk.tokenize import word_tokenize # speech recognition import speech_recognition as sr recognizer = sr.Recognizer() # Create dictionary word_dict = dict() stem_dict = dict() # Create stemmer stemmer = PorterStemmer() # Read in the dictionary file dict_dir = "../img/" dict_filename = dict_dir + "dict.txt" dict_file = open(dict_filename, "r") dict_lines = dict_file.read().splitlines() # Make map of word and word stem to file for line in dict_lines: split = line.split() word = split[0] filepath = dict_dir + split[1] if word not in word_dict.keys(): word_dict[word] = filepath stem = stemmer.stem(word) if stem not in stem_dict.keys(): stem_dict[stem] = filepath # List of words that do not need a sign non_signs = ["is", "are", "be"] # The alphabet alpha = "abcdefghijklmnopqrstuvwxyz" # Translate the sentences # takes recognized_words as input and # returns a valid path to each word or letter # set up server app = Flask(__name__) UPLOAD_FOLDER_VIDEO = './videos/' UPLOAD_FOLDER_VOICE = './voice/' UPLOAD_FOLDER_IMAGE = './images/' ALLOWED_EXTENSIONS = {'mpg', 'mp4'} app = Flask(__name__) app.config['UPLOAD_FOLDER_VIDEO'] = UPLOAD_FOLDER_VIDEO app.config['UPLOAD_FOLDER_VOICE'] = UPLOAD_FOLDER_VOICE app.config['UPLOAD_FOLDER_IMAGE'] = UPLOAD_FOLDER_IMAGE CORS(app) if __name__ == '__main__': app.run(host="localhost", port=42248, debug=True)
31.686486
95
0.628796
9b5d3c5659fc7c63b174be7b4744d1de06e0f242
1,128
py
Python
main/PluginDemos/MomentOfInertia/MomentOfInertia3D/Simulation/MomentOfInertia3DSteppables.py
JulianoGianlupi/nh-cc3d-4x-base-tool
c0f4aceebd4c5bf3ec39e831ef851e419b161259
[ "CC0-1.0" ]
null
null
null
main/PluginDemos/MomentOfInertia/MomentOfInertia3D/Simulation/MomentOfInertia3DSteppables.py
JulianoGianlupi/nh-cc3d-4x-base-tool
c0f4aceebd4c5bf3ec39e831ef851e419b161259
[ "CC0-1.0" ]
null
null
null
main/PluginDemos/MomentOfInertia/MomentOfInertia3D/Simulation/MomentOfInertia3DSteppables.py
JulianoGianlupi/nh-cc3d-4x-base-tool
c0f4aceebd4c5bf3ec39e831ef851e419b161259
[ "CC0-1.0" ]
1
2021-02-26T21:50:29.000Z
2021-02-26T21:50:29.000Z
from cc3d.core.PySteppables import *
40.285714
98
0.618794
9b5d42d58638f8e19f6b1354d952d443c3e13a52
4,003
py
Python
skirt-sniffer.py
macenpav/skirt-sniffer
3ba45d5f7f22b83417525835dc594e698c4ebb1a
[ "MIT" ]
null
null
null
skirt-sniffer.py
macenpav/skirt-sniffer
3ba45d5f7f22b83417525835dc594e698c4ebb1a
[ "MIT" ]
null
null
null
skirt-sniffer.py
macenpav/skirt-sniffer
3ba45d5f7f22b83417525835dc594e698c4ebb1a
[ "MIT" ]
null
null
null
import data_module import email_module import db_module from jinja2 import Environment, FileSystemLoader from os import path import time from datetime import datetime DIR_PATH = path.dirname(path.realpath(__file__)) NEW_SKIRT_SUBJECT = r"Novinka! - {0}" NEW_PRINT_SUBJECT = r"NOV TISKY! - {0}" DAY_INIT_SUBJECT = r"Keporkak se probouz! - {0}" PAGE_LIMIT = 20 # limit to read pages so we don't deadlock while mining data if __name__ == "__main__": print("main({0}): Checking if server is available.".format(str(time.time()))) if data_module.is_server_available() is False: print("main({0}): Unable to ping server.".format(str(time.time()))) else: day_init_check() print("main({0}): Starting to mine data.".format(str(time.time()))) run_base() run_print() print("main({0}): Finished mining.".format(str(time.time())))
32.024
101
0.671496
9b5e52eda69e6b966095678067006f5bc461763d
3,661
py
Python
gos/manager.py
sergey-aganezov-jr/gos
fb4d210284f3037c5321250cb95f3901754feb6b
[ "MIT" ]
null
null
null
gos/manager.py
sergey-aganezov-jr/gos
fb4d210284f3037c5321250cb95f3901754feb6b
[ "MIT" ]
null
null
null
gos/manager.py
sergey-aganezov-jr/gos
fb4d210284f3037c5321250cb95f3901754feb6b
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from gos.configuration import Configuration from gos.exceptions import GOSTaskException, GOSExecutableContainerException from gos.executable_containers import ExecutableContainer from gos.tasks import TaskLoader
50.847222
124
0.645179
9b5f11338fa982d437506f6ebd36acb9e68351e8
2,608
py
Python
couchcrdt/crdt.py
drsm79/couch-crdt
1717a8b03a488793984d7209f6da78c395b3477f
[ "Apache-2.0" ]
null
null
null
couchcrdt/crdt.py
drsm79/couch-crdt
1717a8b03a488793984d7209f6da78c395b3477f
[ "Apache-2.0" ]
null
null
null
couchcrdt/crdt.py
drsm79/couch-crdt
1717a8b03a488793984d7209f6da78c395b3477f
[ "Apache-2.0" ]
null
null
null
import requests import json
28.347826
79
0.546012
9b5f1ca95a4bf43c73f0a6830a6c9ae4f3d79f44
134
py
Python
svreal/enums.py
sgherbst/svreal
62811a3074732554db650b8decde60997fbe8b59
[ "MIT" ]
27
2019-05-14T10:14:21.000Z
2022-01-22T03:00:05.000Z
svreal/enums.py
sgherbst/svreal
62811a3074732554db650b8decde60997fbe8b59
[ "MIT" ]
8
2020-03-16T07:38:30.000Z
2021-05-27T17:59:24.000Z
svreal/enums.py
sgherbst/svreal
62811a3074732554db650b8decde60997fbe8b59
[ "MIT" ]
3
2020-10-21T19:10:13.000Z
2022-02-23T12:34:12.000Z
from enum import Enum
19.142857
30
0.701493
9b601d1541c40d95e59c43221fab5f52ddc75afd
231
py
Python
zvt/recorders/joinquant/overall/__init__.py
Evergreen2020/zvt
446a2512d716a38a12164b6d4468a6c9de01b986
[ "MIT" ]
6
2020-09-03T10:02:00.000Z
2021-02-04T02:51:47.000Z
zvt/recorders/joinquant/overall/__init__.py
Evergreen2020/zvt
446a2512d716a38a12164b6d4468a6c9de01b986
[ "MIT" ]
2
2019-12-20T13:12:30.000Z
2020-01-03T06:24:30.000Z
zvt/recorders/joinquant/overall/__init__.py
Evergreen2020/zvt
446a2512d716a38a12164b6d4468a6c9de01b986
[ "MIT" ]
2
2020-07-08T04:15:40.000Z
2021-06-08T08:51:31.000Z
# -*- coding: utf-8 -*- from zvt.recorders.joinquant.overall.cross_market_recorder import * from zvt.recorders.joinquant.overall.margin_trading_recorder import * from zvt.recorders.joinquant.overall.stock_summary_recorder import *
46.2
69
0.822511
9b6200504eb1e628d498d1956f71cf3b490895b3
1,708
py
Python
legacy/dx/simulator/simulator_diagnoser/test/diagnosis/apt_diagnoser_test.py
GaloisInc/adapt
2ccff778d3e77505899266572f8f7caacb5b630f
[ "BSD-3-Clause" ]
2
2020-04-09T13:04:25.000Z
2021-09-24T14:17:26.000Z
legacy/dx/simulator/simulator_diagnoser/test/diagnosis/apt_diagnoser_test.py
GaloisInc/adapt
2ccff778d3e77505899266572f8f7caacb5b630f
[ "BSD-3-Clause" ]
null
null
null
legacy/dx/simulator/simulator_diagnoser/test/diagnosis/apt_diagnoser_test.py
GaloisInc/adapt
2ccff778d3e77505899266572f8f7caacb5b630f
[ "BSD-3-Clause" ]
3
2019-09-20T20:49:54.000Z
2021-09-02T17:33:47.000Z
import unittest from simulator_diagnoser.graph import InmemoryGraph from simulator_diagnoser.diagnosis import APTDiagnoser from simulator_diagnoser.matcher import Terminal, \ Sequence, \ StatelessMatcher if __name__ == '__main__': unittest.main()
31.054545
65
0.527518
9b650fbea222942a995d60c70b774dcb9b12f9c7
888
py
Python
etl/produce_map.py
hbmartin/sub9-client
0f85639412e2a2d695e9f6a56913dcb055af82b2
[ "CC-BY-4.0" ]
null
null
null
etl/produce_map.py
hbmartin/sub9-client
0f85639412e2a2d695e9f6a56913dcb055af82b2
[ "CC-BY-4.0" ]
null
null
null
etl/produce_map.py
hbmartin/sub9-client
0f85639412e2a2d695e9f6a56913dcb055af82b2
[ "CC-BY-4.0" ]
null
null
null
#!/usr/bin/env python3 """Roll up the geo6 json to produce a tree suitable for sub9 query""" __author__ = "H. Martin" __version__ = "0.1.0" import json import math from random import randint data = {} transformed = {} with open('geohash_counter_6.json', encoding='utf-8') as data_file: data = json.loads(data_file.read()) for geo6 in data: geohash_info = {} count = math.ceil(data[geo6] * 0.1) geohash_info['count'] = count geo4 = geo6[:4] if geo4 not in transformed: transformed[geo4] = {"count":0} transformed[geo4]["count"] += count geo5 = geo6[:5] if geo5 not in transformed[geo4]: transformed[geo4][geo5] = {"count":0} transformed[geo4][geo5]["count"] += count transformed[geo4][geo5][geo6] = geohash_info with open('full_map.json', 'w', encoding='utf-8') as outfile: json.dump(transformed, outfile, indent=2)
24.666667
69
0.653153
9b65e671e782ba8045e5362d7f2aa0daf9d92725
716
py
Python
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
15
2020-07-09T20:51:09.000Z
2021-11-28T21:59:02.000Z
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
148
2020-03-28T22:10:30.000Z
2021-12-19T09:22:59.000Z
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
30
2020-03-12T02:31:27.000Z
2021-07-29T02:40:36.000Z
import pytest from models.notes import NotesModel from schemas.notes import NotesSchema from tests.attributes import note_attrs
27.538462
86
0.726257
9b6659e81f23a3d9ae4d6dd42d1200115d52d82d
2,220
py
Python
src/routers/v1/endpoints/facetime.py
kal-byte/my-api
e1fccfa57cda874753d48411f7bfff06afbdb019
[ "MIT" ]
2
2021-03-13T14:43:05.000Z
2021-03-13T15:10:58.000Z
src/routers/v1/endpoints/facetime.py
kal-byte/my-api
e1fccfa57cda874753d48411f7bfff06afbdb019
[ "MIT" ]
null
null
null
src/routers/v1/endpoints/facetime.py
kal-byte/my-api
e1fccfa57cda874753d48411f7bfff06afbdb019
[ "MIT" ]
2
2021-03-13T14:42:40.000Z
2021-03-17T18:18:10.000Z
""" MIT License Copyright 2021-Present kal-byte Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import utils import polaroid from io import BytesIO from fastapi import APIRouter from fastapi.responses import StreamingResponse, JSONResponse router = APIRouter()
34.153846
102
0.763964
9b695e220684cc34d44b4b158affb4987027de4f
213
py
Python
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from tav.tmux import hook
16.384615
29
0.690141
9b6bba0de98dfc7b9557b30776b8cee5fb813b43
445
py
Python
app/accounts/migrations/0003_auto_20190323_1709.py
NjengaSaruni/Accountant-Web-Server
e77124307f235a4a446e1251d2830d7587cb8719
[ "MIT" ]
null
null
null
app/accounts/migrations/0003_auto_20190323_1709.py
NjengaSaruni/Accountant-Web-Server
e77124307f235a4a446e1251d2830d7587cb8719
[ "MIT" ]
19
2018-12-10T20:06:21.000Z
2021-06-10T21:03:31.000Z
app/accounts/migrations/0003_auto_20190323_1709.py
NjengaSaruni/Accountant-Web-Server
e77124307f235a4a446e1251d2830d7587cb8719
[ "MIT" ]
null
null
null
# Generated by Django 2.1.7 on 2019-03-23 17:09 from django.db import migrations, models
23.421053
106
0.626966
9b6c6e386630575a00a0344243a155f4ff7c4cd5
979
py
Python
src/components/sidebar1.py
DishaDH123/Disha551Dashboard
3354ff94134e6094f7e5759f17abe5d988a32198
[ "MIT" ]
null
null
null
src/components/sidebar1.py
DishaDH123/Disha551Dashboard
3354ff94134e6094f7e5759f17abe5d988a32198
[ "MIT" ]
null
null
null
src/components/sidebar1.py
DishaDH123/Disha551Dashboard
3354ff94134e6094f7e5759f17abe5d988a32198
[ "MIT" ]
null
null
null
import dash from dash import dcc from dash import html,Input, Output import dash_bootstrap_components as dbc from ..app import app from .sidebar_function_tab1 import TAB1_DROPDOWN,time_scale,date_slider,choose_fun_tab1 SIDEBAR1 = [dbc.Row("Energy Dashboard",class_name="title",style={"font-size":"30px","padding-left": "10px","padding-top": "10px"}), dbc.Row("___________________________________________"), html.Br(), dbc.Row("This dashboard figure out which factors make a difference to house temperature and humidity. You can choose the factors from the dropdown below.",class_name="description"), html.Br(), dbc.Label("Compare Across:",class_name="sub_title",style={"font-size":"20px"}), html.Br(), dbc.Row(TAB1_DROPDOWN), html.Br(), dbc.Row(id="selection_tab1"), html.Br(), dbc.Row(time_scale), html.Br(), dbc.Row(date_slider), ]
34.964286
181
0.763023
9b6d446a16c44d84b91f269a1e5ec023a880fe0e
4,176
py
Python
interbotix_examples/interbotix_moveit_interface/get_trajectory_server.py
junyaoshi/interbotix_ros_arms
ca37aa98a66acdbd17557d6808d6c32f0ad4799b
[ "BSD-2-Clause" ]
null
null
null
interbotix_examples/interbotix_moveit_interface/get_trajectory_server.py
junyaoshi/interbotix_ros_arms
ca37aa98a66acdbd17557d6808d6c32f0ad4799b
[ "BSD-2-Clause" ]
null
null
null
interbotix_examples/interbotix_moveit_interface/get_trajectory_server.py
junyaoshi/interbotix_ros_arms
ca37aa98a66acdbd17557d6808d6c32f0ad4799b
[ "BSD-2-Clause" ]
null
null
null
#!/usr/bin/env python from __future__ import print_function from moveit_python_interface import MoveGroupPythonInteface from geometry_msgs.msg import Pose import rospy from interbotix_moveit_interface.srv import GetTrajectory, GetTrajectoryResponse # flags GO_TO_START_JOINT_VALUES = False # whether to use execute a plan to go to start joint values EXECUTE_PLAN = False # whether to execute the plan generated for reaching pose goal ROBOT_NAME = 'wx200' # name of the robot DOF = 5 # robot's degrees of freedom # mesh object path dictionary MESH_OBJECT_FILENAMES = {"chair_bernhard_0146/left_leg": "furniture/env/models/assets/objects/chair_bernhard_0146/left_leg.stl", "chair_bernhard_0146/right_leg": "furniture/env/models/assets/objects/chair_bernhard_0146/right_leg.stl", "chair_bernhard_0146/seat": "furniture/env/models/assets/objects/chair_bernhard_0146/seat.stl", "table_klubbo_0743/leg1": "furniture/env/models/assets/objects/table_klubbo_0743/leg1.stl", "table_klubbo_0743/leg2": "furniture/env/models/assets/objects/table_klubbo_0743/leg2.stl", "table_klubbo_0743/leg3": "furniture/env/models/assets/objects/table_klubbo_0743/leg3.stl", "table_klubbo_0743/leg4": "furniture/env/models/assets/objects/table_klubbo_0743/leg4.stl", "table_klubbo_0743/table_top": "furniture/env/models/assets/objects/table_klubbo_0743/table_top.stl"} def generate_trajectory(req): """ Handles service request message :param req: service request message :return: service response message """ start = rospy.get_time() print("Generating joint trajectory for the following request... \n" "--- Position: [{} {} {}]\n" "--- Start joint values: {}\n" "--- Object names: {}".format(req.x, req.y, req.z, req.start_joint_values, req.object_names)) # add mesh object to scene for i in range(len(req.object_names)): object_name = req.object_names[i] object_pose = req.object_poses[i] object_size_vector3 = req.object_sizes[i] object_size = (object_size_vector3.x, object_size_vector3.y, object_size_vector3.z) try: object_filename = MESH_OBJECT_FILENAMES[object_name] if object_name in interface.scene.get_known_object_names(): interface.move_mesh(object_name, object_pose) else: interface.add_mesh(object_name, object_pose, object_filename, object_size) except KeyError: print("Unrecognized object name: {}".format(object_name)) # remove objects no longer in scene objects_no_longer_in_scene = list(set(interface.scene.get_known_object_names()) - set(req.object_names)) for object in objects_no_longer_in_scene: interface.remove_mesh(object) if GO_TO_START_JOINT_VALUES: interface.go_to_joint_state(req.start_joint_values) target_position = [req.x, req.y, req.z] trajectory_exists, plan = interface.plan_ee_position(target_position, req.start_joint_values, execute_plan=EXECUTE_PLAN) end = rospy.get_time() print("Trajectory exists?: {} ".format(trajectory_exists)) print("Trajectory sent to client!") print("Objects in scene after trajectory update: {}".format(interface.scene.get_known_object_names())) print("Processed request in {} seconds".format(end - start)) return GetTrajectoryResponse(plan.joint_trajectory, trajectory_exists) if __name__ == "__main__": interface = MoveGroupPythonInteface(robot_name=ROBOT_NAME, dof=DOF) # remove objects in moveit scene because of previous runs for name in interface.scene.get_known_object_names(): interface.scene.remove_world_object(name) s = rospy.Service('get_trajectory', GetTrajectory, generate_trajectory) print("Ready to generate trajectory.") rospy.spin()
48
130
0.677443
9b6da7ce7169ebed552ff066ea4c100e67f503a4
573
py
Python
importers/base_importer.py
lwhjon/repo-labels-cli
5a16638f45f0b13e9fdddc59b1a0952f3ba51287
[ "MIT" ]
1
2021-07-14T06:32:50.000Z
2021-07-14T06:32:50.000Z
importers/base_importer.py
lwhjon/repo-labels-cli
5a16638f45f0b13e9fdddc59b1a0952f3ba51287
[ "MIT" ]
2
2021-08-31T18:14:03.000Z
2021-12-29T18:14:25.000Z
importers/base_importer.py
lwhjon/repo-labels-cli
5a16638f45f0b13e9fdddc59b1a0952f3ba51287
[ "MIT" ]
null
null
null
""" This module contains the BaseImporter Abstract class which all other importers are inherited from. """ from abc import ABC, abstractmethod from utilities.constants import ImportModes
23.875
98
0.713787
9b6ff38b27b5eaa149ea68c6674af0e96146a1de
28
py
Python
trump/extensions/source/tx-worldbankst/__init__.py
Equitable/trump
a2802692bc642fa32096374159eea7ceca2947b4
[ "BSD-3-Clause" ]
8
2015-03-14T13:09:46.000Z
2020-08-29T17:49:52.000Z
trump/extensions/source/tx-worldbankst/__init__.py
Equitable/trump
a2802692bc642fa32096374159eea7ceca2947b4
[ "BSD-3-Clause" ]
64
2015-03-14T12:14:17.000Z
2015-08-15T12:31:42.000Z
trump/extensions/source/tx-worldbankst/__init__.py
Equitable/trump
a2802692bc642fa32096374159eea7ceca2947b4
[ "BSD-3-Clause" ]
10
2015-03-14T12:18:02.000Z
2022-01-18T21:44:27.000Z
from worldbankstext import *
28
28
0.857143
9b70b9748dd8ac6b70d6284121fe398a2d54b264
367
py
Python
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
# Imports import requests import os import sys import lcddriver import time import datetime import RPi.GPIO as GPIO import dht11 thingspeak_key = 'ZHAO5MQEKA0B93P7' temperature = 23 humidity = 35 # Send the data to Thingspeak r = requests.post('https://api.thingspeak.com/update.json', data = {'api_key':thingspeak_key, 'field1':temperature, 'field2':humidity})
19.315789
135
0.771117
9b71684b4558f4e73ca309d8159aa55dc5c42ada
51
py
Python
storage/models/__init__.py
parveenchahal/python-common
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
[ "MIT" ]
null
null
null
storage/models/__init__.py
parveenchahal/python-common
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
[ "MIT" ]
null
null
null
storage/models/__init__.py
parveenchahal/python-common
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
[ "MIT" ]
null
null
null
from ._storage_entry_model import StorageEntryModel
51
51
0.921569
9b7271707272e07905c19e8e64deead59d30237a
857
py
Python
data_utils/merge_dev_set.py
weihezhai/HatefulMemesChallenge
04f52643c0864d1efb6c0a9c674db42764f6834c
[ "MIT" ]
63
2020-12-09T18:58:16.000Z
2022-03-21T02:34:35.000Z
data_utils/merge_dev_set.py
weihezhai/HatefulMemesChallenge
04f52643c0864d1efb6c0a9c674db42764f6834c
[ "MIT" ]
5
2021-01-29T10:33:04.000Z
2021-08-25T14:15:27.000Z
data_utils/merge_dev_set.py
weihezhai/HatefulMemesChallenge
04f52643c0864d1efb6c0a9c674db42764f6834c
[ "MIT" ]
18
2020-12-11T20:36:04.000Z
2021-12-12T07:04:20.000Z
import os import json import fire if __name__ == "__main__": fire.Fire(main)
25.205882
63
0.606768
9b739e9baaf2f66a5a0221be7c0052b516ff1db9
1,324
py
Python
scripts/gen-go-pylons.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
118
2015-01-04T06:55:14.000Z
2022-01-14T08:32:41.000Z
scripts/gen-go-pylons.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
21
2015-01-03T02:16:28.000Z
2021-03-24T06:10:57.000Z
scripts/gen-go-pylons.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
53
2015-01-04T03:21:08.000Z
2021-08-04T20:52:01.000Z
#!/usr/bin/env python """Generate go-pylons.py""" import sys import textwrap import virtualenv filename = 'go-pylons.py' after_install = """\ import os, subprocess def after_install(options, home_dir): etc = join(home_dir, 'etc') ## TODO: this should all come from distutils ## like distutils.sysconfig.get_python_inc() if sys.platform == 'win32': lib_dir = join(home_dir, 'Lib') bin_dir = join(home_dir, 'Scripts') elif is_jython: lib_dir = join(home_dir, 'Lib') bin_dir = join(home_dir, 'bin') else: lib_dir = join(home_dir, 'lib', py_version) bin_dir = join(home_dir, 'bin') if not os.path.exists(etc): os.makedirs(etc) subprocess.call([join(bin_dir, 'easy_install'), '-f', 'http://pylonshq.com/download/%s', 'Pylons==%s']) """ if __name__ == '__main__': main()
25.461538
63
0.614804
9b73b142beb25313894454214e85b3ed177d34f5
3,173
py
Python
cweqgen/sphinx/utils.py
cwinpy/cweqgen
b76634f0cdd62ede3295c584027ff911897590be
[ "MIT" ]
2
2022-01-14T18:09:15.000Z
2022-01-15T22:37:29.000Z
cweqgen/sphinx/utils.py
cwinpy/cweqgen
b76634f0cdd62ede3295c584027ff911897590be
[ "MIT" ]
null
null
null
cweqgen/sphinx/utils.py
cwinpy/cweqgen
b76634f0cdd62ede3295c584027ff911897590be
[ "MIT" ]
null
null
null
import os import pkg_resources import shutil from ..equations import equations from ..definitions import EQN_DEFINITIONS def generate_equations_doc(docfile): """ Helper function to automatically generate a documentation page containing all the available equations within cweqgen. Parameters ---------- docfile: str: The output file for the documentation. """ doccontents = """ ######### Equations ######### The currently implemented equations are: """ references = """\ References ---------- """ usedreferences = [] usedrefurls = [] refcount = 1 for eqn in EQN_DEFINITIONS: eqstr = "" # create equation eq = equations(eqn) if eq.reference_string in usedreferences: refnum = usedreferences.index(eq.reference_string) + 1 else: usedreferences.append(eq.reference_string) usedrefurls.append(eq.reference_adsurl) refnum = refcount refcount += 1 eqstr += """\ {0} {1} """.format( eq.description, "-" * len(eq.description) ) eqstr += """ This equation can be accessed from the :func:`~cweqgen.equations.equations` function using the name ``{}``. """.format( eqn ) eqno = "" if eq.reference_eqno is None else f"Eqn. {eq.reference_eqno} in " eqstr += """ The generated equation ({0} [{1}]_) is: .. math:: {2} """.format( eqno, refnum, eq.equation(nocomment=True) ) eqstr += """ The fiducial values defined for this equation are: .. math:: {} """.format( eq.fiducial_equation(nocomment=True) ) eqstr += """ .. note:: These fiducial values are just those defined within this package and may not be representative of fiducial values used elsewhere in the literature. """ eqstr += """ To generate the equation as calculated at particular values, the :func:`~cweqgen.equations.equations` can be used as .. py:function:: equations("{0}", {1}) :noindex: """.format( eq.equation_name, ", ".join( [ "{}={}".format(fid, str(val)) for fid, val in eq.default_fiducial_values.items() ] ), ) # add doc string lines for line in eq.__doc__.split("\n"): eqstr += f" {line}\n" doccontents += eqstr + "\n" # add in list of references for i in range(len(usedreferences)): references += """ .. [{0}] {1} [`ADS URL <{2}>`__] """.format( (i + 1), usedreferences[i], usedrefurls[i] ) with open(docfile, "w") as fp: fp.write(doccontents + references) def generate_yamlexample_doc(docfile, eqn="h0"): """ Output an example YAML file. Parameters ---------- docfile: str The output file for the documentation. eqn: str The name of the equation for which the docstring is required. """ src = os.path.join(pkg_resources.resource_filename("cweqgen", "eqnfiles"), f"{eqn}.yaml") shutil.copyfile(src, docfile)
22.188811
98
0.570753
9b7594f95dc3f33774a8b817bdaeb1f8a8797812
3,624
py
Python
employee-project/src/FileIO.py
NischayaSharma/python-codes
f2216002a82f17a9103544f6ba361ed31eb85654
[ "MIT" ]
null
null
null
employee-project/src/FileIO.py
NischayaSharma/python-codes
f2216002a82f17a9103544f6ba361ed31eb85654
[ "MIT" ]
null
null
null
employee-project/src/FileIO.py
NischayaSharma/python-codes
f2216002a82f17a9103544f6ba361ed31eb85654
[ "MIT" ]
null
null
null
import os; import sys; FileName='FileIO.txt' try: string = os.path.dirname(os.path.realpath(__file__))+'/'+FileName; fw = open(string, "a+"); crud(); except Exception as e: print e; fw.close(); sys.exit();
30.2
213
0.63521
9b76216fa16aa9281bbd570ee1371176ada29324
4,442
py
Python
examples/cardless_credit_example.py
glendaesutanto/xendit-python
f9b131882ff7d045f2e2c6518933d1594efba3e6
[ "MIT" ]
10
2020-10-31T23:34:34.000Z
2022-03-08T19:08:55.000Z
examples/cardless_credit_example.py
glendaesutanto/xendit-python
f9b131882ff7d045f2e2c6518933d1594efba3e6
[ "MIT" ]
22
2020-07-30T14:25:07.000Z
2022-03-31T03:55:46.000Z
examples/cardless_credit_example.py
glendaesutanto/xendit-python
f9b131882ff7d045f2e2c6518933d1594efba3e6
[ "MIT" ]
11
2020-07-28T08:09:40.000Z
2022-03-18T00:14:02.000Z
import time from print_running_function import print_running_function # Hackish method to import from another directory # Useful while xendit-python isn't released yet to the public import importlib.machinery loader = importlib.machinery.SourceFileLoader("xendit", "../xendit/__init__.py") xendit = loader.load_module("xendit") def ask_cardless_credit_input(): print("Input the action that you want to use") print("0. Exit") print("1. Create Payment / Generate Checkout URL") print("2. Calculate Payment Types") try: return int(input()) except ValueError: print("Invalid input. Please type a number") return ask_cardless_credit_input() def cardless_credit_example(xendit_instance): cardless_credit_input = ask_cardless_credit_input() while cardless_credit_input != 0: if cardless_credit_input == 1: print("Running example of Create Payment / Generate Checkout URL") CreateCardlessCreditPayment.example(xendit_instance) elif cardless_credit_input == 2: print("Running example of Calculate Payment Types") CalculatePaymentType.example(xendit_instance) cardless_credit_input = ask_cardless_credit_input()
35.822581
99
0.579244
9b79ce41c55d1514dd77ba2f1d765d1a882ab8ed
2,220
py
Python
tests/test_lines.py
phipleg/trafaret-config
0063a5027e7db015e0b0b0dafd8159df409121f2
[ "Apache-2.0", "MIT" ]
26
2016-12-07T16:40:44.000Z
2020-11-09T03:27:23.000Z
tests/test_lines.py
phipleg/trafaret-config
0063a5027e7db015e0b0b0dafd8159df409121f2
[ "Apache-2.0", "MIT" ]
6
2017-10-27T13:50:21.000Z
2020-09-24T17:08:48.000Z
tests/test_lines.py
phipleg/trafaret-config
0063a5027e7db015e0b0b0dafd8159df409121f2
[ "Apache-2.0", "MIT" ]
5
2016-12-05T10:23:29.000Z
2020-06-05T15:31:24.000Z
import unittest from textwrap import dedent import trafaret as T from .util import get_err
27.75
75
0.476577
9b79f3b170c6f1c8996ced8d0a625ff3c7e18cd9
4,856
py
Python
epytope/Data/pssms/arb/mat/B_5801_9.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
7
2021-02-01T18:11:28.000Z
2022-01-31T19:14:07.000Z
epytope/Data/pssms/arb/mat/B_5801_9.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
22
2021-01-02T15:25:23.000Z
2022-03-14T11:32:53.000Z
epytope/Data/pssms/arb/mat/B_5801_9.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
4
2021-05-28T08:50:38.000Z
2022-03-14T11:45:32.000Z
B_5801_9 = {0: {'A': -0.3411047643185575, 'C': 0.003633483019123024, 'E': -0.4818751780000427, 'D': -0.48635888961606405, 'G': -0.2552323225624609, 'F': -0.18023397304713804, 'I': 0.3607439895775445, 'H': 0.020686177466924322, 'K': 0.8273437122618179, 'M': 0.47430136579724197, 'L': 0.17966127012728303, 'N': -0.3291966962696378, 'Q': -0.21345233956382428, 'P': -0.5325369892850287, 'S': -0.16301393166900496, 'R': 0.027601955371264083, 'T': -0.18363093014019005, 'W': 0.10578368712358037, 'V': 0.052805213226038004, 'Y': -0.02429605455631148}, 1: {'A': 1.174860463273255, 'C': -0.2457666452096607, 'E': -0.5906915606703014, 'D': -0.548169630828652, 'G': 0.19969510117868258, 'F': -0.36554838520842226, 'I': -0.3276255291469775, 'H': -0.5376109875970715, 'K': -0.45690036967999276, 'M': -0.041595243905379574, 'L': -0.3505575547489804, 'N': -0.31767465208943557, 'Q': -0.3475029432425459, 'P': -0.5979633564295069, 'S': 1.2852802397755638, 'R': -0.534535428563245, 'T': 0.6447770595158945, 'W': -0.441133012859596, 'V': -0.1520364358887288, 'Y': -0.50951053028935}, 2: {'A': 0.2684471724541413, 'C': -0.22902610856967154, 'E': -0.43278624501578816, 'D': -0.06934855994261531, 'G': -0.06716035432846008, 'F': 0.10455873668111254, 'I': 0.1925134837370194, 'H': -0.23149990350621824, 'K': -0.46548913891902827, 'M': 0.3464088618155669, 'L': 0.18626735624915097, 'N': 0.38542411767568263, 'Q': -0.22383835157789417, 'P': -0.48532126156662114, 'S': 0.4532418271352197, 'R': -0.4544277107989695, 'T': 0.3260679087260621, 'W': 0.15010475497333664, 'V': 0.07161428162621108, 'Y': 0.017730490237516758}, 3: {'A': 0.37784956251501206, 'C': -0.4793875343459822, 'E': -0.08902382036802833, 'D': -0.20050905903977564, 'G': -0.06495306821998638, 'F': -0.0593473711437512, 'I': 0.09933541588624818, 'H': 0.03514885697831995, 'K': -0.06116699534123581, 'M': -0.040991791908567006, 'L': -0.0835037295409453, 'N': 0.004148481569409193, 'Q': 0.1711363775698798, 'P': 0.24374294428136922, 'S': 0.2637317211760683, 'R': -0.07428765491674041, 'T': -0.20527317097312292, 'W': -0.30252432168185744, 'V': 0.011206871127331007, 'Y': -0.12549661307016982}, 4: {'A': -0.0037956386025211923, 'C': 0.3425836755273221, 'E': 0.10837411544244627, 'D': -0.10977722569677738, 'G': -0.07429577634177878, 'F': -0.05545998502340835, 'I': 0.03806137859551105, 'H': -0.14042662908810716, 'K': -0.20302056052250367, 'M': 0.1420266411631764, 'L': -0.1064722376037199, 'N': -0.17401409416144922, 'Q': 0.11997316956010566, 'P': -0.04128125080580932, 'S': 0.19196080156121637, 'R': -0.3491766626926857, 'T': 0.48839925104094956, 'W': -0.1944017253597289, 'V': 0.3636334120779938, 'Y': 0.005288600613324553}, 5: {'A': 0.024240456081329534, 'C': -0.05403424525777517, 'E': -0.1372571018612249, 'D': 0.1998462489077772, 'G': 0.03626418238439089, 'F': -0.22385026969299843, 'I': -0.007118698099601649, 'H': 0.18750955312048573, 'K': -0.25639938785996624, 'M': -0.10761999816284834, 'L': -0.07945610243767709, 'N': -0.01336954634949329, 'Q': 0.03388141345430495, 'P': 0.3792426447667947, 'S': 0.14003490093027127, 'R': -0.35413455397288635, 'T': -0.040374278317003756, 'W': 0.17171048536053823, 'V': 0.0144078763897194, 'Y': 0.3456580758311246}, 6: {'A': -0.048764474656820316, 'C': 0.12527155006022642, 'E': 0.018375613094484246, 'D': -0.14355729462432953, 'G': -0.24198435176223246, 'F': 0.5050091762270842, 'I': -0.23409484528144958, 'H': 0.26461313711055967, 'K': -0.29103757239392125, 'M': 0.10614249980976018, 'L': 0.2980575675511649, 'N': -0.12749768289935284, 'Q': -0.05399490523715788, 'P': -0.04337669219017715, 'S': -0.14150596935678242, 'R': -0.3052744786829771, 'T': -0.016085631730931502, 'W': 0.40021875630643317, 'V': -0.12139104413894072, 'Y': 0.04764866712879748}, 7: {'A': -0.2887306170747365, 'C': -0.05546020707654955, 'E': 0.19614530507925096, 'D': -0.11508919814164928, 'G': -0.12096740474241689, 'F': 0.008661990458820913, 'I': 0.06185055066826462, 'H': 0.40470050115085127, 'K': -0.13793373991315833, 'M': -0.19958425618472464, 'L': 0.171498045363748, 'N': 0.09101485071050694, 'Q': 0.31543446904424916, 'P': -0.2442195336322221, 'S': 0.137140741872122, 'R': 0.10414695150169023, 'T': 0.1017840080220198, 'W': -0.10367157482864542, 'V': -0.04055738088903421, 'Y': 0.14643767030214036}, 8: {'A': -0.5774250143899277, 'C': -0.5489099143796122, 'E': -0.5419428470896012, 'D': -0.5395040580297729, 'G': -0.5145904975923917, 'F': 0.4800720103518297, 'I': -0.1826648609200773, 'H': -0.16754627174560963, 'K': -0.594895104992003, 'M': 0.019272566780701248, 'L': -0.43483232548876344, 'N': -0.44121647814689663, 'Q': -0.43432236841340954, 'P': -0.5419428470896012, 'S': -0.5417201571462467, 'R': -0.5221447856642065, 'T': -0.5509579040144501, 'W': 1.9927421718393323, 'V': -0.5507750466260991, 'Y': 0.1924242909646485}, -1: {'slope': 0.11072004198674867, 'intercept': -0.4166818572835276}}
4,856
4,856
0.706549
9b7a95fc7a817c6bbe96dbb60f85ab236a523c5a
919
py
Python
django_requests_logger/admin.py
mabouchama/django-requests-logger
d28bae0312878cb09f355e8793e56b6a7d1e6f72
[ "MIT" ]
1
2019-02-20T09:08:15.000Z
2019-02-20T09:08:15.000Z
django_requests_logger/admin.py
mabouchama/django-requests-logger
d28bae0312878cb09f355e8793e56b6a7d1e6f72
[ "MIT" ]
4
2022-02-15T12:43:15.000Z
2022-02-22T13:23:10.000Z
django_requests_logger/admin.py
mabouchama/django-requests-logger
d28bae0312878cb09f355e8793e56b6a7d1e6f72
[ "MIT" ]
2
2022-02-10T06:36:27.000Z
2022-02-16T06:58:16.000Z
from django.contrib import admin from django.utils.translation import gettext_lazy as _ from django_requests_logger.models import RequestLog admin.site.register(RequestLog, RequestLogAdmin)
28.71875
72
0.558215
9b7acf5a00804730593a41046352d93d47c45b81
4,006
py
Python
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
14
2018-07-10T20:15:15.000Z
2022-02-10T09:55:45.000Z
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
9
2019-10-11T15:27:15.000Z
2021-08-13T12:28:52.000Z
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
4
2019-10-07T14:57:31.000Z
2021-08-20T19:17:53.000Z
# Copyright 2017 Francesco Ceccon # # 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. from enum import Enum import abc import sys from suspect.math import inf # pylint: disable=no-name-in-module def is_constant(self): return False class Objective(Expression): is_sink = True class BoundedExpression(Expression): class Constraint(BoundedExpression): is_sink = True class Variable(BoundedExpression): is_source = True class Constant(BoundedExpression): is_source = True
25.0375
85
0.658512
9b7cb7e95cec056b67de9696402880e28ea63ad1
5,662
py
Python
rubybot/cogs/memes.py
lakepower/Ruby-Bot
332d3f8bc9c8ba2902f67b59e360596778483473
[ "MIT" ]
null
null
null
rubybot/cogs/memes.py
lakepower/Ruby-Bot
332d3f8bc9c8ba2902f67b59e360596778483473
[ "MIT" ]
null
null
null
rubybot/cogs/memes.py
lakepower/Ruby-Bot
332d3f8bc9c8ba2902f67b59e360596778483473
[ "MIT" ]
null
null
null
import requests import bs4 import re import random import codecs import os from discord.ext import commands from discord.ext.commands import BucketType from cogs.utils import checks path_qaz = os.path.join(os.getcwd(), 'files', 'qaz.txt') path_riko = os.path.join(os.getcwd(), 'files', 'riko_meme') nsfw = [ "CngcndGUEAAZh8q.jpg", "Cnsqi9DUsAAtJG_.jpg", "Cnh5oJHUEAAICHv.jpg" ]
33.502959
132
0.575062
9b7cbdab3a8e39b99a930ed638449c9b5895940a
803
py
Python
src/python_parser/config.py
ttu/cubersensors-iot-azure
cdec18bb99f2316ed65179090f0f66b8791f57ca
[ "Apache-2.0" ]
1
2016-05-29T10:53:09.000Z
2016-05-29T10:53:09.000Z
src/python_parser/config.py
ttu/cubersensors-iot-azure
cdec18bb99f2316ed65179090f0f66b8791f57ca
[ "Apache-2.0" ]
null
null
null
src/python_parser/config.py
ttu/cubersensors-iot-azure
cdec18bb99f2316ed65179090f0f66b8791f57ca
[ "Apache-2.0" ]
1
2018-03-02T05:19:08.000Z
2018-03-02T05:19:08.000Z
# keys file is not included in repository import keys ROOT = "http://api.cubesensors.com" AUTH = "%s/auth" % ROOT RES = "%s/v1" % ROOT logger_name = "cubesensors_parser" # Define if should use event hub or insert data straight to db use_event_hub = False # CubeSensors config consumer_key = keys.cube_consumer_key consumer_secret = keys.cube_consumer_secret oauth_verifier = keys.cube_oauth_verifier access_token = keys.cube_access_token access_token_secret = keys.cube_access_token_secret # Azure config servicebus_namespace = keys.azure_servicebus_namespace eventhub_name = "cubesensor" eventhub_key_name = "cube_sender" eventhub_private_key = keys.cubesender_private_key # Database config db_user = keys.db_user db_password = keys.db_password db_name = keys.db_name db_server = keys.db_server
25.09375
62
0.808219
9b7d015d0188b694a8bc8e7bf62510306eb4231c
375
py
Python
airflow/ascii.py
dtardoin/airflow
4d7f413c7db3ffdb1236e7799e4fe647842e5dbd
[ "Apache-2.0" ]
1
2021-03-02T20:08:53.000Z
2021-03-02T20:08:53.000Z
airflow/ascii.py
dtardoin/airflow
4d7f413c7db3ffdb1236e7799e4fe647842e5dbd
[ "Apache-2.0" ]
null
null
null
airflow/ascii.py
dtardoin/airflow
4d7f413c7db3ffdb1236e7799e4fe647842e5dbd
[ "Apache-2.0" ]
1
2019-05-14T16:19:12.000Z
2019-05-14T16:19:12.000Z
bug = r"""\ =, .= =.| ,---. |.= =.| "-(:::::)-" |.= \\__/`-.|.-'\__// `-| .::| .::|-' Pillendreher _|`-._|_.-'|_ (Scarabaeus sacer) /.-| | .::|-.\ // ,| .::|::::|. \\ || //\::::|::' /\\ || /'\|| `.__|__.' ||/'\ ^ \\ // ^ /'\ /'\ ^ ^ """
23.4375
46
0.114667
9b7e0fc01325c4db573e5b390f7ba040016a6e45
11,092
py
Python
tooldb.py
SolidifiedRay/layout-web-tool
cefba938c1e03ea8da206ec7fb0c6d8a62f1fc1b
[ "MIT" ]
1
2020-04-01T15:05:54.000Z
2020-04-01T15:05:54.000Z
tooldb.py
SolidifiedRay/layout-web-tool
cefba938c1e03ea8da206ec7fb0c6d8a62f1fc1b
[ "MIT" ]
42
2017-05-23T17:19:19.000Z
2021-04-26T12:28:47.000Z
tooldb.py
SolidifiedRay/layout-web-tool
cefba938c1e03ea8da206ec7fb0c6d8a62f1fc1b
[ "MIT" ]
7
2017-05-04T02:13:07.000Z
2020-07-09T10:56:03.000Z
""" <Program Name> tooldb.py <Author> Lukas Puehringer <lukas.puehringer@nyu.edu> <Started> June 12, 2017 <Copyright> See LICENSE for licensing information. <Purpose> A basic collection of software supply chain tools in four categories - vcs (version control systems) - building - qa (quality assurance) - package (packaging) The tools are presented to the user on the different pages of the web wizard as options to choose from to define a custom supply chain TODO: - Update! Some of the tools might be not used at all while other popular tools are missing - Clean up! Common commands, logo, ... """ COLLECTION = { "vcs": [{ "type": "", "prog_lang": "", "name": "Git", "logo": "https://git-scm.com/images/logos/downloads/Git-Icon-1788C.png", "cmd": "git clone <repo>" }, { "type": "", "prog_lang": "", "name": "SVN", "logo": "https://subversion.apache.org/images/svn-square.jpg", "cmd": "svn checkout <repo>" }, { "type": "", "prog_lang": "", "name": "Mercurial", "logo": "https://www.mercurial-scm.org/logo-droplets-200.png", "cmd": "hg clone <repo>" }, { "type": "", "prog_lang": "", "name": "GNU Bazaar ", "logo": "http://bazaar.canonical.com/bzricons/bazaar-logo.png", "cmd": "bzr branch <remote repo> <local repo>" }, { "type": "", "prog_lang": "", "name": "Monotone", "logo": "https://www.monotone.ca/res/logo.png", "cmd": "mtn --db=<db> sync <repo>" }, { "type": "", "prog_lang": "", "name": "Fossil", "logo": "https://www.fossil-scm.org/index.html/doc/trunk/www/fossil3.gif", "cmd": "fossil clone <repo>" }, { "type": "", "prog_lang": "", "name": "Darcs", "logo": "http://darcs.net/img/logos/logo.png", "cmd": "darcs clone <repo>" }, { "type": "", "prog_lang": "", "name": "CVS", "logo": "", "cmd": "cvs co <repo>" }, { # "type": "", # "prog_lang": "", # "name": "AccuRev", # "logo": "https://pbs.twimg.com/profile_images/378800000092420461/aeab81f94d12ea387f7cae8868892112_400x400.png", # "cmd": "accurev mkstream -s <stream> -b <backing-stream>" # }, { # "type": "", # "prog_lang": "", # "name": "Veracity", # "logo": "https://discoversdkcdn.azureedge.net/runtimecontent/companyfiles/5875/3191/thumbnail.png", # "cmd": "" # }, { # "type": "", # "prog_lang": "", # "name": "ArX", # "logo": "https://arxequity.com/wp-content/themes/arx/img/logo_big_blue.png", # "cmd": "arx make-archive ArchiveName RepositoryDirectory" # }, { "type": "", "prog_lang": "", "name": "BitKeeper", "logo": "http://www.bitkeeper.org/man/BitKeeper_SN_Blue.png", "cmd": "bk clone <repo>" # }, { # "type": "", # "prog_lang": "", # "name": "SVK", # "logo": "", # "cmd": "svk commit [PATH\u2026]" # }, { # "type": "", # "prog_lang": "", # "name": "Plastic SCM", # "logo": "https://pbs.twimg.com/profile_images/378800000542266610/114e3495e712c5bc736970326ecfb9f2_400x400.png", # "cmd": "cm mkwk [name]" # }, { # "type": "", # "prog_lang": "", # "name": "Team Foundation Server", # "logo": "https://szul.blob.core.windows.net/images/team-foundation-server-2015-header.png", # "cmd": "tf get [itemspec]" }], "building": [{ "type": "make_based", "prog_lang": "", "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/150px-Tux.svg.png", "name": "make", "cmd": "make [-einpqrst] [-f makefile]... [-k|-S] [macro=value...] [target_name...]" }, { "type": "build_script_generation", "prog_lang": "", "logo": "", "name": "configure", "cmd": "./configure" }, { "type": "non_make_based", "prog_lang": "Java, C, C++", "logo": "http://antinstaller.sourceforge.net/manual/images/ant_logo_large.gif", "name": "Apache ANT", "cmd": "install, init, all" }, { "type": "non_make_based", "prog_lang": "", "logo": "http://www.scala-sbt.org/assets/typesafe_sbt_svg.svg", "name": "sbt", "cmd": "compile" }, { "type": "non_make_based", "prog_lang": "MS Visual Studio, C++", "logo": "http://www.eitcafe.com/wp-content/uploads/2016/07/msbuild.jpg", "name": "MS Build", "cmd": "MSBuild.exe MyProj.proj /property:Configuration=Debug , cl /EHsc hello.cpp" }, { "type": "non_make_based", "prog_lang": "Ruby", "logo": "", "name": "Rake", "cmd": "rake" }, { "type": "", "prog_lang": "XML(Project Object Model)", "logo": "https://maven.apache.org/images/maven-logo-black-on-white.png", "name": "Maven", "cmd": "mvn compile" }, { "type": "non_make_based", "prog_lang": "Python", "logo": "http://scons.org/images/SCons.png", "name": "Scons", "cmd": "scons foo.out" }], "qa": [{ "type": "Unit Testing", "prog_lang": "C", "name": "Check", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C", "name": "AceUnit", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C#", "name": "csUnit", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C#", # "name": "Visual Studio Unit Testing Framework", "name": "Visual Studio", "logo": "http://www.qatestingtools.com/sites/default/files/tools_shortcuts/Visual%20Studio%20Unite%20Testing%20Framework%20150.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C++", # "name": "Parasoft C/C++test", "name": "Parasoft", "logo": "https://discoversdkcdn.azureedge.net/runtimecontent/companyfiles/5703/1899/thumbnail.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C++", "name": "CppUnit", "logo": "http://www.howcsharp.com/img/0/9/cppunit-300x225.jpg", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Haskell", "name": "HUnit", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Haskell", "name": "QuickCheck", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Java", "name": "JUnit", "logo": "http://www.swtestacademy.com/wp-content/uploads/2015/11/Junit_Logo.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Java", "name": "Jtest", "logo": "http://www.bj-zhzt.com/datacache/pic/390_260_b91e82190f00f190d60d78bf53f6352b.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "JavaScript", "name": "Jasmine", "logo": "https://upload.wikimedia.org/wikipedia/en/thumb/2/22/Logo_jasmine.svg/1028px-Logo_jasmine.svg.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "JavaScript", "name": "Unit.js", "logo": "https://upload.wikimedia.org/wikipedia/en/e/ec/Unit_JS_logo.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "PHP", "name": "SimpleTest", "logo": "http://www.simpletest.org/images/simpletest-logo.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "PHP", "name": "PHPUnit", "logo": "http://4.bp.blogspot.com/-xrvHPUBqc7Y/Ucxe5ZYDVYI/AAAAAAAAAVE/cXtFm0NcE9A/s500/logo.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Python", "name": "unittest", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Python", "name": "doctest", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "R", "name": "RUnit", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "R", "name": "testthat", "logo": "https://d21ii91i3y6o6h.cloudfront.net/gallery_images/from_proof/13597/small/1466619792/rstudio-hex-testthat.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Scala", "name": "ScalaTest", "logo": "http://media.tumblr.com/ec3c87095fe8a21216c516606afffdcc/tumblr_inline_mtskzebUcv1s17bu5.jpg", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Scala", "name": "ScUnit", "logo": "", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "Travis CI", "logo": "https://cdn.travis-ci.com/images/logos/TravisCI-Mascot-1-20feeadb48fc2492ba741d89cb5a5c8a.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "Java", "name": "Jenkins", "logo": "https://www.cloudbees.com/sites/default/files/Jenkins_8.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "Java", "name": "TeamCity", "logo": "http://workingwithdevs.com/wp-content/uploads/2014/05/TeamCity-logo.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "Bamboo", "logo": "https://www.vectorcast.com/sites/default/themes/vectorsoftware/images/Bamboo-logo_clipped.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "Codeship", "logo": "http://rixrix.github.io/ci-talk-codeship/images/logo_codeship_colour.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "CircleCI", "logo": "https://circleci.com/circleci-logo-stacked-fb.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "Buildbot", "logo": "https://buildbot.net/img/nut.png", "cmd": "" }, { "type": "Linting", "prog_lang": "Python", "name": "Pylint", "logo": "https://carlchenet.com/wp-content/uploads/2013/08/pylint-logo.png", "cmd": "" }, { "type": "Linting", "prog_lang": "Python", "name": "Flake8", "logo": "", "cmd": "" }, { "type": "Linting", "prog_lang": "Python", "name": "PyChecker", "logo": "", "cmd": "" }, { "type": "Linting", "prog_lang": "Java", "name": "Checkstyle", "logo": "http://checkstyle.sourceforge.net/images/header-checkstyle-logo.png", "cmd": "" }, { "type": "Linting", "prog_lang": "Java", "name": "Coverity", "logo": "https://2015.appsecusa.org/c/wp-content/uploads/2014/07/coveritylogo.png", "cmd": "" }, { "type": "Linting", "prog_lang": "C/C++", "name": "Lint", "logo": "", "cmd": "" }, { "type": "Linting", "prog_lang": "C/C++", "name": "Cppcheck", "logo": "https://cdn.portableapps.com/CppcheckPortable_128.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C", "name": "Check", "logo": "", "cmd": "" }, ], "package": [{ "type": "", "prog_lang": "", "logo": "", "name": "Tar", "cmd": "tar -cvf afiles.tar file1 file2 file3" }, { "type": "", "prog_lang": "", "logo": "", "name": "Zip", "cmd": "" }, { "type": "", "prog_lang": "", "logo": "", "name": "Wheel", "cmd": "python setup.py bdist_wheel" }, { "type": "", "prog_lang": "", "logo": "", "name": "MSI", "cmd": "" }] }
26.857143
136
0.542102
9b7e283a083204b48c0d43c9af36980bb2c2c080
811
py
Python
operations/constant.py
anon-cand/nexpreval
e033bb9f5f25c74c44d0eb29748bf48193c185ae
[ "MIT" ]
null
null
null
operations/constant.py
anon-cand/nexpreval
e033bb9f5f25c74c44d0eb29748bf48193c185ae
[ "MIT" ]
null
null
null
operations/constant.py
anon-cand/nexpreval
e033bb9f5f25c74c44d0eb29748bf48193c185ae
[ "MIT" ]
null
null
null
from operations.operation import Operation
23.852941
63
0.588163
9b7e3f441634f0a952e1cc4ac8faf39f1d5c0e8a
3,587
py
Python
flask_tutorial/marshmallow_demo/nesting_schemas.py
ftconan/python3
eb63ba33960072f792ecce6db809866b38c402f8
[ "MIT" ]
1
2018-12-19T22:07:56.000Z
2018-12-19T22:07:56.000Z
marshmallow_demo/nesting_schemas.py
ftconan/flask-tutorial
d5164c93b5e6a6e3d2b8980e4b846adb7cb21aee
[ "MIT" ]
12
2020-03-14T05:32:26.000Z
2022-03-12T00:08:49.000Z
marshmallow_demo/nesting_schemas.py
ftconan/flask-tutorial
d5164c93b5e6a6e3d2b8980e4b846adb7cb21aee
[ "MIT" ]
1
2018-12-19T22:08:00.000Z
2018-12-19T22:08:00.000Z
# coding=utf-8 """ @author: magician @date: 2018/9/13 """ import datetime as dt from marshmallow import Schema, fields, pprint if __name__ == '__main__': user = User(name='Monty', email='monty@python.org') blog = Blog(title='Something Completely Different', author=user) result = BlogSchema().dump(blog) pprint(result) # specifying which fields to nest schema = BlogSchema2() result = schema.dump(blog) pprint(result) # nest using dot delimiters schema = SiteSchema(only=['blog.author.email']) site = { 'blog': { 'author': {'email': u'monty@python.org'} } } result = schema.dump(site) pprint(result) # only value deserialized # new_user = { # 'name': 'Steve', # 'email': 'steve@example.com', # 'friends': ['Mike', 'Joe'] # } # serialized_data = UserSchema().dump(new_user) # pprint(serialized_data) # deserialized_data = UserSchema().load(result) # pprint(deserialized_data) # two-way nesting # author = Author(name='William Faulkner') # book = Book(title='As I Lay Dying', author=author) # book_result = BookSchema().dump(book) # pprint(book_result, indent=2) # { # "id": 124, # "title": "As I Lay Dying", # "author": { # "id": 8, # "name": "William Faulkner" # } # } # author_result = AuthorSchema().dump(author) # pprint(author_result, indent=2) # { # "id": 8, # "name": "William Faulkner", # "books": [ # { # "id": 124, # "title": "As I Lay Dying" # } # ] # } # nesting a schema within itself user = User('Steve', 'steve@example.com') user.friends.append(User('Mike', 'mike@example.com')) user.friends.append(User('Joe', 'joe@example.com')) user.employer = User('Dirk', 'dirk@example.com') result = UserSchema().dump(user) pprint(result, indent=2)
23.444444
74
0.583496
9b7ec91f09b0e08306d5eb9d01d89bc063dc7870
3,906
py
Python
integration_tests/util/generate_scene.py
carderne/raster-vision
915fbcd3263d8f2193e65c2cd0eb53e050a47a01
[ "Apache-2.0" ]
1,577
2017-05-22T14:22:00.000Z
2022-03-31T02:03:25.000Z
integration_tests/util/generate_scene.py
carderne/raster-vision
915fbcd3263d8f2193e65c2cd0eb53e050a47a01
[ "Apache-2.0" ]
933
2017-05-09T20:25:02.000Z
2022-03-31T10:22:59.000Z
integration_tests/util/generate_scene.py
monocilindro/raster-vision
fc181a6f31f085affa1ee12f0204bdbc5a6bf85a
[ "Apache-2.0" ]
336
2017-05-15T16:30:44.000Z
2022-03-28T06:19:33.000Z
import random import click import numpy as np import rasterio from rasterio.transform import from_origin from rastervision.core.box import Box from rastervision.data import (RasterioCRSTransformer, ObjectDetectionLabels, ObjectDetectionGeoJSONStore) from rastervision.core.class_map import (ClassItem, ClassMap) if __name__ == '__main__': generate_scene()
33.965217
79
0.616999
9b7f4ac026f327923c4f012b100b9d4fe6b0b3e2
148
py
Python
examples/test_hanzi_dict.py
smilelight/lightDict
bd21afd90777489b6a62b9f6954f0d24c3f772d1
[ "Apache-2.0" ]
4
2020-01-15T09:54:40.000Z
2020-12-13T09:10:25.000Z
examples/test_hanzi_dict.py
smilelight/lightDict
bd21afd90777489b6a62b9f6954f0d24c3f772d1
[ "Apache-2.0" ]
null
null
null
examples/test_hanzi_dict.py
smilelight/lightDict
bd21afd90777489b6a62b9f6954f0d24c3f772d1
[ "Apache-2.0" ]
1
2021-05-28T09:40:14.000Z
2021-05-28T09:40:14.000Z
from lightdict import HanziDict hanzi_dic = HanziDict(r'D:\Data\NLP\corpus\words\hanzi.csv') print('' in hanzi_dic) x = hanzi_dic[''] print(x)
16.444444
60
0.72973
9b814e62cd1712261791628b00ae51e5874b229d
883
py
Python
src/quill/fold/wire/html_util.py
spin-systems/quill
b210f840e228295e41feaf4ff79f2cc8bd96889d
[ "MIT" ]
null
null
null
src/quill/fold/wire/html_util.py
spin-systems/quill
b210f840e228295e41feaf4ff79f2cc8bd96889d
[ "MIT" ]
14
2020-11-22T09:59:08.000Z
2021-11-02T16:05:35.000Z
src/quill/fold/wire/html_util.py
spin-systems/quill
b210f840e228295e41feaf4ff79f2cc8bd96889d
[ "MIT" ]
null
null
null
from bs4 import Tag __all__ = ["CustomHtmlTag", "Attrs", "PartialAttrs"] ######## General utility classes for tags and attrs
30.448276
81
0.682899
9b81731e40409f7877598e1a56186915df1cedd5
573
py
Python
pycess/wsgi.py
pycess/pycess
07fa4cdd59fff5d51686bd6a769d78ece38a41d5
[ "BSD-2-Clause-FreeBSD" ]
1
2015-07-07T02:36:12.000Z
2015-07-07T02:36:12.000Z
pycess/wsgi.py
pycess/pycess
07fa4cdd59fff5d51686bd6a769d78ece38a41d5
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
pycess/wsgi.py
pycess/pycess
07fa4cdd59fff5d51686bd6a769d78ece38a41d5
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
""" WSGI config for pycess project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pycess.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application() import pycess.settings if hasattr(pycess.settings, 'USE_DJ_STATIC') and pycess.settings.USE_DJ_STATIC: from dj_static import Cling application = Cling(get_wsgi_application())
26.045455
79
0.788831
9b821c976ee4f99cdb762f5c8e9e17a0905d593c
321
py
Python
Problem Solving/Algorithms/Introduction to Nim Game.py
Muntaha-Islam0019/HackerRank-Solutions
caa687aab67461aba69026d3bdc44b62c1dec1c9
[ "MIT" ]
null
null
null
Problem Solving/Algorithms/Introduction to Nim Game.py
Muntaha-Islam0019/HackerRank-Solutions
caa687aab67461aba69026d3bdc44b62c1dec1c9
[ "MIT" ]
null
null
null
Problem Solving/Algorithms/Introduction to Nim Game.py
Muntaha-Islam0019/HackerRank-Solutions
caa687aab67461aba69026d3bdc44b62c1dec1c9
[ "MIT" ]
null
null
null
from functools import reduce games = int(input()) for game in range(games): number_of_piles = int(input()) pile = list(map(int, input().rstrip().split())) result = reduce((lambda x, y: x ^ y), pile) # result = len(pile) % 2 [wont work on test case 2] print('Second' if result == 0 else 'First')
21.4
55
0.616822
9b82673b26c46b4b26d95c88f868cace6cd8a642
294
py
Python
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
104
2015-01-05T14:29:16.000Z
2021-11-08T11:20:24.000Z
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
4
2015-09-23T11:14:50.000Z
2020-03-21T06:08:34.000Z
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
16
2015-01-05T10:13:44.000Z
2022-02-14T05:21:23.000Z
import unittest from flows.statestore.django_store import StateStore from flows.statestore.tests.utils import store_state_works
24.5
58
0.765306
9b830f6c20e0821da065a595dcea7c80e7322901
4,238
py
Python
tests/test_ann.py
mtezzele/EZyRB
30e6db72d444a3a1713f0af63ceb0585350a7ecf
[ "MIT" ]
39
2016-06-30T08:21:47.000Z
2022-03-18T16:05:30.000Z
tests/test_ann.py
mtezzele/EZyRB
30e6db72d444a3a1713f0af63ceb0585350a7ecf
[ "MIT" ]
38
2016-09-21T08:45:27.000Z
2022-03-07T13:48:59.000Z
tests/test_ann.py
mtezzele/EZyRB
30e6db72d444a3a1713f0af63ceb0585350a7ecf
[ "MIT" ]
47
2016-05-20T12:44:39.000Z
2022-03-05T05:01:19.000Z
import numpy as np import torch.nn as nn from torch import Tensor, from_numpy from unittest import TestCase from ezyrb import ANN np.random.seed(17)
30.710145
82
0.558046
9b838f908501c804e2f543284ab15cfe75ddca4d
380
py
Python
ipub/params.py
ms8r/scriv2epub
a8d4ee7abc5b5bef654e40fec25605b34ed43207
[ "MIT" ]
8
2016-01-15T21:12:50.000Z
2021-10-17T18:47:40.000Z
ipub/params.py
ms8r/scriv2epub
a8d4ee7abc5b5bef654e40fec25605b34ed43207
[ "MIT" ]
null
null
null
ipub/params.py
ms8r/scriv2epub
a8d4ee7abc5b5bef654e40fec25605b34ed43207
[ "MIT" ]
null
null
null
import os.path _PATH_PREFIX = os.path.dirname(os.path.realpath(__file__)) _TEMPLATE_PATH = os.path.join(_PATH_PREFIX, 'tmpl') _TEMPLATE_EXT = '.jinja' _EPUB_SKELETON_PATH = os.path.join(_PATH_PREFIX, 'epub') _BASIC_CH_PAR_STYLE = 'par-indent' _FIRST_CH_PAR_STYLE = 'texttop' _DROP_CAP_STYLE = 'dropcap' _CLEAR_STYLE = 'clearit' _IN_PG_SEC_BREAK_STYLE = 'center-par-tb-space'
31.666667
59
0.776316
9b84b07bfeb0b1498473bf71e8cf00668429868a
1,138
py
Python
datastruct/TreeNode.py
cocobear/LeetCode-in-Python
b4ecd5cb7122467ee479f38497faaabb17e6025e
[ "MIT" ]
null
null
null
datastruct/TreeNode.py
cocobear/LeetCode-in-Python
b4ecd5cb7122467ee479f38497faaabb17e6025e
[ "MIT" ]
null
null
null
datastruct/TreeNode.py
cocobear/LeetCode-in-Python
b4ecd5cb7122467ee479f38497faaabb17e6025e
[ "MIT" ]
null
null
null
if __name__ == "__main__": print(TreeNode.constructTree([3,9,20,None,None,15,7])) print(TreeNode.constructTree([2,3,4]))
27.756098
63
0.51406
9b88125439c00c982850039874ca9e2e40963ded
17,936
py
Python
src/test_quality_measures.py
hackalog/dimension_reduction
18c54256f4b1f1fbfe0b99e86b6701e708b7c85c
[ "MIT" ]
1
2018-10-22T11:45:45.000Z
2018-10-22T11:45:45.000Z
src/test_quality_measures.py
hackalog/dimension_reduction
18c54256f4b1f1fbfe0b99e86b6701e708b7c85c
[ "MIT" ]
null
null
null
src/test_quality_measures.py
hackalog/dimension_reduction
18c54256f4b1f1fbfe0b99e86b6701e708b7c85c
[ "MIT" ]
null
null
null
import hypothesis.strategies as st from hypothesis.extra.numpy import arrays from hypothesis import given import unittest import numpy as np from sklearn.base import BaseEstimator import inspect import src.quality_measures as qm from .logging import logger # old functions to test against while refactoring def old_centering_matrix(N): ''' Returns the N x N centering matrix. ''' I_N = np.identity(N) one_N = np.matrix(np.ones(N)).transpose() J = I_N - one_N * one_N.transpose()/N return J def old_doubly_center_matrix(matrix): ''' Doubly center the matrix. That is, -J * matrix * J. Note that this matrix must be square. ''' m, n = matrix.shape assert m == n, "Matrix must be square" J = old_centering_matrix(m) new_matrix = -J * matrix * J return new_matrix / 2 def knn_to_point_untrustworthiness(high_knn, low_knn, n_neighbors=None, high_rank=None): ''' Given the n_neighbors nearest neighbors in high space and low space, together with the rank matrix, compute the value of "untrustworthiness" of a point (this is the factor that a point contributes negatively to trustworthiness). ''' if n_neighbors is None or high_rank is None: raise ValueError("n_neighbors and high_rank are required") point_scores = [] N = high_knn.shape[0] G_K = qm._trustworthiness_normalizating_factor(n_neighbors, N) for i, low in enumerate(low_knn): trust_indices = set(low).difference(set(high_knn[i])) score = 0 for j in trust_indices: score += (high_rank[i, j] - n_neighbors) * 2 / G_K point_scores.append(score) return np.array(point_scores) def old_point_untrustworthiness(high_distances=None, low_distances=None, high_data=None, low_data=None, metric='euclidean', n_neighbors=None): ''' Given high/low distances or data, compute the value of "untrustworthiness" of a point (this is the factor that a point contributes negatively to trustworthiness). ''' hd, ld, _ = qm.pairwise_distance_differences(high_distances=high_distances, low_distances=low_distances, high_data=high_data, low_data=low_data, metric=metric) if n_neighbors is None: raise ValueError("n_neighbors is required") high_rank = qm.rank_matrix(hd) low_rank = qm.rank_matrix(ld) high_knn = qm.rank_to_knn(high_rank, n_neighbors=n_neighbors) low_knn = qm.rank_to_knn(low_rank, n_neighbors=n_neighbors) point_scores = knn_to_point_untrustworthiness(high_knn, low_knn, n_neighbors=n_neighbors, high_rank=high_rank) return point_scores # Start of tests # TODO: Test various input styles. class TestEncoding(unittest.TestCase): def test_point_untrustworthiness_input(self): with self.assertRaises(ValueError): qm.point_untrustworthiness() if __name__ == '__main__': unittest.main()
42.301887
79
0.575992
9b884dfe98e3224d03e56b0ff9073cf479be11aa
797
py
Python
addons/odoo_elasticsearch/models/trend_search_mapping.py
marionumza/vocal_v12
480990e919c9410903e06e7813ee92800bd6a569
[ "Unlicense" ]
null
null
null
addons/odoo_elasticsearch/models/trend_search_mapping.py
marionumza/vocal_v12
480990e919c9410903e06e7813ee92800bd6a569
[ "Unlicense" ]
null
null
null
addons/odoo_elasticsearch/models/trend_search_mapping.py
marionumza/vocal_v12
480990e919c9410903e06e7813ee92800bd6a569
[ "Unlicense" ]
1
2021-05-05T07:59:08.000Z
2021-05-05T07:59:08.000Z
import logging _logger = logging.getLogger(__name__) from odoo import api, fields, models
30.653846
99
0.667503
9b897b3e2e2a162da4ba6ef2e1e00007c3d0d7d3
25,363
py
Python
src/python/twitter/common/app/application.py
wfarner/commons
42988a7a49f012665174538cca53604c7846ee86
[ "Apache-2.0" ]
1
2019-12-20T14:13:27.000Z
2019-12-20T14:13:27.000Z
src/python/twitter/common/app/application.py
wfarner/commons
42988a7a49f012665174538cca53604c7846ee86
[ "Apache-2.0" ]
null
null
null
src/python/twitter/common/app/application.py
wfarner/commons
42988a7a49f012665174538cca53604c7846ee86
[ "Apache-2.0" ]
1
2019-12-20T14:13:29.000Z
2019-12-20T14:13:29.000Z
# ================================================================================================== # Copyright 2011 Twitter, Inc. # -------------------------------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this work except in compliance with the License. # You may obtain a copy of the License in the LICENSE file, or 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. # ================================================================================================== from __future__ import print_function __author__ = 'Dave Buchfuhrer, Brian Wickman' try: import ConfigParser except ImportError: import configparser as ConfigParser import atexit import copy import inspect import optparse import os import shlex import sys import threading from collections import defaultdict, deque from functools import partial from twitter.common import options from twitter.common.app.module import AppModule from twitter.common.app.inspection import Inspection from twitter.common.lang import Compatibility from twitter.common.process import daemonize from twitter.common.util import topological_sort
34.791495
101
0.674644
9b89b21d0ec82cd3eb4f531c62145aac5544814d
3,838
py
Python
nas/gui/end_registration_window.py
RolandZitny/BC-NAS
df2b1c643e5dce3b48c72026b4f83f895f33b822
[ "MIT" ]
null
null
null
nas/gui/end_registration_window.py
RolandZitny/BC-NAS
df2b1c643e5dce3b48c72026b4f83f895f33b822
[ "MIT" ]
null
null
null
nas/gui/end_registration_window.py
RolandZitny/BC-NAS
df2b1c643e5dce3b48c72026b4f83f895f33b822
[ "MIT" ]
null
null
null
import base64 import os import matplotlib.pyplot as plt import cv2 import numpy as np from PyQt5 import uic from PyQt5 import QtWidgets from PyQt5 import QtMultimedia from PyQt5 import QtMultimediaWidgets from PyQt5.QtGui import QImage, QPixmap from PyQt5.QtWidgets import QDesktopWidget from nas.gui.login_stimulation_window import LoginStimulationPresentation import config directory_path = os.path.dirname(os.path.abspath(__file__)) ui_path = os.path.join(directory_path, "designs" + os.sep + "end_registration_window.ui") Ui_RegWindow, QtBaseClass = uic.loadUiType(ui_path) # Load .ui file.
32.252101
94
0.647473
9b8af184786b7b838926fd6c07d47b9fd8a6c329
445
py
Python
testing/matplotlib_test.py
deranderemark/CigarTracer
3f1172683c57dc7f28dd7517132014b23adfff90
[ "Apache-2.0" ]
null
null
null
testing/matplotlib_test.py
deranderemark/CigarTracer
3f1172683c57dc7f28dd7517132014b23adfff90
[ "Apache-2.0" ]
1
2022-02-06T15:50:07.000Z
2022-02-06T15:50:07.000Z
testing/matplotlib_test.py
deranderemark/CigarTracer
3f1172683c57dc7f28dd7517132014b23adfff90
[ "Apache-2.0" ]
null
null
null
import matplotlib.pyplot as plt # Diagramm und Achsen definieren fig, ax = plt.subplots() # Werte fr Tabelle erstellen table_data=[ ["1", 30, 34], ["2", 20, 223], ["3", 33, 2354], ["4", 25, 234], ["5", 12, 929] ] #Tabelle erstellen table = ax.table(cellText=table_data, loc='center', colLabels=['SD', 'ID', 'Score']) # Tabelle ndern table.set_fontsize(14) table.scale(1,4) ax.axis('off') #Tabelle anzeigen plt.show()
17.8
84
0.633708
9b8bb3b48e86a641ba4d24045654d0c3bccfafdb
5,242
py
Python
venv/Lib/site-packages/func_timeout/StoppableThread.py
lijj0812/UIAutoDemo
3e13380adeb6cf92410676ff7c125dbee598427f
[ "Apache-2.0" ]
1
2021-01-12T14:39:01.000Z
2021-01-12T14:39:01.000Z
venv/Lib/site-packages/func_timeout/StoppableThread.py
lijj0812/UIAutoDemo
3e13380adeb6cf92410676ff7c125dbee598427f
[ "Apache-2.0" ]
2
2021-06-16T19:56:35.000Z
2021-06-16T19:57:49.000Z
venv/Lib/site-packages/func_timeout/StoppableThread.py
lijj0812/UIAutoDemo
3e13380adeb6cf92410676ff7c125dbee598427f
[ "Apache-2.0" ]
1
2020-09-17T07:56:53.000Z
2020-09-17T07:56:53.000Z
''' Copyright (c) 2016, 2017, 2019 Timothy Savannah All Rights Reserved. Licensed under the Lesser GNU Public License Version 3, LGPLv3. You should have recieved a copy of this with the source distribution as LICENSE, otherwise it is available at https://github.com/kata198/func_timeout/LICENSE ''' import os import ctypes import threading __all__ = ('StoppableThread', 'JoinThread') # vim: set ts=4 sw=4 expandtab :
39.119403
166
0.647844
9b8fd2bf80fa07a3bd7f3ddd5254592ae0988fc9
190
py
Python
pics/admin.py
Joseph-Odhiambo/Gallary
f8dfab1149f11de94519afe597fe87f4ed28b9a5
[ "MIT" ]
1
2021-05-19T12:58:15.000Z
2021-05-19T12:58:15.000Z
pics/admin.py
HASSAN1A/Gallery
a73bd93bcecbb830b4d676c9e9dd306880cac6f2
[ "MIT" ]
null
null
null
pics/admin.py
HASSAN1A/Gallery
a73bd93bcecbb830b4d676c9e9dd306880cac6f2
[ "MIT" ]
null
null
null
from django.contrib import admin from .models import Image,Areas,Category # Register your models here. admin.site.register(Image) admin.site.register(Areas) admin.site.register(Category)
19
40
0.805263
9b902f255bd9d45e07a2e966eeb8f841dbe8fc88
1,985
py
Python
tests/lamvery/cli_test.py
rdtr/lamvery
e9334a0d258c63e6426c7cd320f691b9f21044c1
[ "MIT" ]
101
2015-11-12T11:29:20.000Z
2020-05-24T19:26:37.000Z
tests/lamvery/cli_test.py
rdtr/lamvery
e9334a0d258c63e6426c7cd320f691b9f21044c1
[ "MIT" ]
45
2015-11-13T05:43:18.000Z
2017-04-27T18:14:49.000Z
tests/lamvery/cli_test.py
marcy-terui/lamvery
e9334a0d258c63e6426c7cd320f691b9f21044c1
[ "MIT" ]
22
2016-01-26T00:12:57.000Z
2019-12-13T09:06:43.000Z
# -*- coding: utf-8 -*- from unittest import TestCase from mock import Mock, patch from lamvery.cli import ( main, init, build, configure, deploy, encrypt, encrypt_file, events, decrypt, set_alias, invoke, rollback, api, generate )
22.816092
53
0.594458
9b906d0ca190514b42e0b5edafba1d709df76a02
569
py
Python
db-test.py
alexolotl/apt-hunt
25d2a2d565b0b694a8f5e3442ba429ae99688e54
[ "MIT" ]
null
null
null
db-test.py
alexolotl/apt-hunt
25d2a2d565b0b694a8f5e3442ba429ae99688e54
[ "MIT" ]
null
null
null
db-test.py
alexolotl/apt-hunt
25d2a2d565b0b694a8f5e3442ba429ae99688e54
[ "MIT" ]
null
null
null
import sqlite3 from util import post_listing_to_slack from slackclient import SlackClient import settings sc = SlackClient(settings.SLACK_TOKEN) con = sqlite3.connect('listings.db') # with con: # con.row_factory = sqlite3.Row # cur = con.cursor() # # print("SQLite version: %s" % data) # cur.execute("SELECT * FROM Listings") # rows = cur.fetchone() # for row in rows: # print(row) # # post_listing_to_slack(sc, rows) # deletes entire table !!! # with con: # cur = con.cursor() # cur.execute("DROP TABLE IF EXISTS Listings")
22.76
50
0.669596
9b9103f77dd912b77e605c95f3235abd9dcb9a29
15,630
py
Python
src/utils.py
asrashley/dash-live
1ffbc57896e4e46855a42af6ef79a1865ebfce55
[ "Apache-2.0" ]
2
2019-11-02T06:26:29.000Z
2020-05-15T16:54:20.000Z
src/utils.py
asrashley/dash-live
1ffbc57896e4e46855a42af6ef79a1865ebfce55
[ "Apache-2.0" ]
1
2020-01-20T17:20:54.000Z
2020-01-21T08:38:30.000Z
src/utils.py
asrashley/dash-live
1ffbc57896e4e46855a42af6ef79a1865ebfce55
[ "Apache-2.0" ]
null
null
null
############################################################################# # # 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. # ############################################################################# # # Project Name : Simulated MPEG DASH service # # Author : Alex Ashley # ############################################################################# import base64 import datetime import decimal import io import json import math import os import re import time # A UTC class, see https://docs.python.org/2.7/library/datetime.html#datetime.tzinfo def dateTimeToUnixEpoch(dt): """ Convert a dateTime to number of seconds since the Unix epoch. """ epoch = datetime.datetime(year=1970, month=1, day=1, tzinfo=UTC()) return (dt - epoch).total_seconds() def toIsoDateTime(value): """ Convert a datetime to an ISO8601 formatted dateTime string. :param value: the dateTime to convert :returns: an ISO8601 formatted string version of the dateTime """ rv = value.isoformat() if value.tzinfo is None: rv += 'Z' else: # replace +00:00 timezone with Z rv = re.sub('[+-]00:00$','Z',rv) return rv def toIsoDuration(secs): """ Convert a time (in seconds) to an ISO8601 formatted duration string. :param secs: the duration to convert, in seconds :returns: an ISO8601 formatted string version of the duration """ if isinstance(secs,basestring): secs = float(secs) elif isinstance(secs, datetime.timedelta): secs = secs.total_seconds() hrs = math.floor(secs/3600) rv=['PT'] secs %= 3600 mins = math.floor(secs/60) secs %= 60 if hrs: rv.append('%dH'%hrs) if hrs or mins: rv.append('%dM'%mins) rv.append('%0.2fS'%secs) return ''.join(rv) date_hacks = [ (re.compile('Apri[^l]'),'Apr '), (re.compile('Sept[^e]'),'Sep '), (re.compile(r'(\w{3} \d{1,2},? \d{4})\s*-\s*(.*$)'), r'\1 \2' ), (re.compile(r'(\w{3} \d{1,2}), (\d{4}\s*\d{1,2}:\d{2})'), r'\1 \2' ), (re.compile(r'(\w{3})-(\d{2})$'), r'\1 \2' ), (re.compile(r'(.+) ([PCE][SD]?T)$'),r'\1') ] def parse_date(date, format=None): """Try to create a datetime from the given string""" formats = ["%Y-%m-%d", "%m/%d/%y", "%m/%d/%Y", "%b %Y", "%b %y", "%m/xx/%y", "%a %b %d %Y", "%B %d %Y %H:%M", "%b %d %Y %H:%M", "%B %d %Y", "%b %d %Y",'%a %b %d, %Y'] if format is not None: formats.insert(0,format) if not isinstance(date, basestring): date = str(date) d = date tz = datetime.timedelta(0) if re.match('.+\s+ES?T$',date): tz = datetime.timedelta(hours=5) elif re.match('.+\s+EDT$',date): tz = datetime.timedelta(hours=4) elif re.match('.+\s+PS?T$',date): tz = datetime.timedelta(hours=8) elif re.match('.+\s+PDT$',date): tz = datetime.timedelta(hours=7) for regex,sub in date_hacks: d = regex.sub(sub,d) for f in formats: try: rv = datetime.datetime.strptime(d, f) rv += tz; return rv except ValueError: pass try: return time.strptime(date) except ValueError: pass return None def dateTimeFormat(value, fmt): """ Format a date using the given format""" if not value: return value if isinstance(value, basestring): value = parse_date(value) if value is None: return value return value.strftime(fmt) duration_re = re.compile(r'^PT((?P<hours>\d+)[H:])?((?P<minutes>\d+)[M:])?((?P<seconds>[\d.]+)S?)?$') def from_isodatetime(date_time): """ Convert an ISO formated date string to a datetime.datetime or datetime.timedelta """ if not date_time: return None if date_time[:2]=='PT': match = duration_re.match(date_time) if not match: raise ValueError(date_time) hours, minutes, seconds = match.group('hours'), match.group('minutes'), match.group('seconds') secs = 0 if hours is not None: secs += int(match.group('hours'))*3600 if minutes is not None: secs += int(match.group('minutes'))*60 if seconds is not None: secs += float(match.group('seconds')) return datetime.timedelta(seconds=secs) if 'T' in date_time: try: return datetime.datetime.strptime(date_time, "%Y-%m-%dT%H:%M:%S.%fZ").replace(tzinfo=UTC()) except ValueError: pass try: return datetime.datetime.strptime(date_time, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=UTC()) except ValueError: return datetime.datetime.strptime(date_time, "%Y-%m-%dT%H:%MZ").replace(tzinfo=UTC()) if not 'Z' in date_time: try: return datetime.datetime.strptime(date_time, "%Y-%m-%d") except ValueError: return datetime.datetime.strptime(date_time, "%d/%m/%Y") return datetime.datetime.strptime(date_time, "%H:%M:%SZ").replace(tzinfo=UTC()).time() def toHtmlString(item, className=None): """Converts an object in to a form suitable for rendering in an HTML page. """ rv=item if isinstance(item,dict): if className: rv='<table class="%s">'%className else: rv='<table>' for key,val in item.iteritems(): rv.append('<tr><td>%s</td><td>%s</td></tr>'%(str(key),toHtmlString(val))) rv.append('</table>') rv = '\n'.join(rv) elif isinstance(item,(list,tuple)): rv = [] for val in item: rv.append(toHtmlString(val)) if item.__class__ == tuple: rv = ''.join(['(',','.join(rv),')']) else: rv = ''.join(['[',','.join(rv),']']) if className: rv = '<span class="%s">%s</span>'%(className,rv) elif isinstance(item,bool): if className is None: className='' rv = '<span class="bool-yes %s">&check;</span>'%className if item else '<span class="bool-no %s">&cross;</span>'%className else: if className: rv = '<span class="%s">%s</span>'%(className,str(rv)) else: rv = str(rv) return rv def flatten(items, convert_numbers=False): """Converts an object in to a form suitable for storage. flatten will take a dictionary, list or tuple and inspect each item in the object looking for items such as datetime.datetime objects that need to be converted to a canonical form before they can be processed for storage. """ if isinstance(items,dict): rv={} else: rv = [] for item in items: key = None if isinstance(items,dict): key = item item = items[key] if hasattr(item, 'toJSON'): item = item.toJSON(pure=True) elif isinstance(item,(datetime.date, datetime.datetime,datetime.time)): item = toIsoDateTime(item) elif isinstance(item,(datetime.timedelta)): item = toIsoDuration(item) elif convert_numbers and isinstance(item,long): item = '%d'%item elif isinstance(item,decimal.Decimal): item = float(item) elif isinstance(item, basestring): item = str(item).replace("'","\'") elif isinstance(item, (list, set, tuple)): item = flatten(list(item)) elif isinstance(item, dict): item = flatten(item) if callable(item): continue if key: rv[key]=item else: rv.append(item) if items.__class__ == tuple: return tuple(rv) return rv def as_python(value): """Convert the value into a string of Python code. The result is suitable for use with eval() """ if value is None: return 'None' wrap_strings = True if hasattr(value, 'toJSON'): value = value.toJSON() wrap_strings = False if isinstance(value, (list, tuple)): items = map(lambda v: as_python(v), list(value)) try: value = '[{0}]'.format(','.join(items)) except TypeError: print items raise elif isinstance(value, (dict)): items = [] clz = value.get('_type', None) for k, v in value.iteritems(): if k == '_type': continue if clz is None: items.append('"{0}": {1}'.format(k, as_python(v))) else: items.append('{0}={1}'.format(k, as_python(v))) if clz is None: value = '{' + ','.join(items) + '}' else: value = '{0}({1})'.format(clz, ','.join(items)) elif wrap_strings and isinstance(value, (basestring)): if '"' in value: value = ''.join(["'", value, "'"]) else: value = ''.join(['"', value, '"']) elif isinstance(value, (datetime.date, datetime.datetime,datetime.time)): value = 'utils.from_isodatetime("%s")'%(toIsoDateTime(value)) elif isinstance(value, (datetime.timedelta)): value = 'utils.from_isodatetime("%s")'%(toIsoDuration(value)) elif isinstance(value, decimal.Decimal): value = 'decimal.Decimal(%s)'%(value) else: value = str(value) return value def xmlSafe(value): """Convert the given string to a format that is safe for inclusion in an XML document. """ return value.replace('&','&amp;') def scale_timedelta(delta, num, denom): """Scale the given timedelta, avoiding overflows""" secs = num * delta.seconds msecs = num* delta.microseconds secs += msecs / 1000000.0 return secs / denom # # The following code is from djangoappengine/utils.py # try: from google.appengine.api import apiproxy_stub_map have_appserver = bool(apiproxy_stub_map.apiproxy.GetStub('datastore_v3')) on_production_server = have_appserver and not os.environ.get('SERVER_SOFTWARE', '').lower().startswith('devel') except ImportError: pass
32.63048
130
0.55675
9b9174eb28a0ab4b95d4146848ae09c6b7a36f4f
1,883
py
Python
network.py
YanhengWang/Draughts
ad19ccbd3c4fc0defda68c45ed8f2dd14969f2a3
[ "Apache-2.0" ]
null
null
null
network.py
YanhengWang/Draughts
ad19ccbd3c4fc0defda68c45ed8f2dd14969f2a3
[ "Apache-2.0" ]
1
2020-10-12T00:33:54.000Z
2020-10-12T00:33:54.000Z
network.py
YanhengWang/Draughts
ad19ccbd3c4fc0defda68c45ed8f2dd14969f2a3
[ "Apache-2.0" ]
null
null
null
from utils import PATH_LABEL from utils import PATH_DATA_FOLDER import pickle import torch import torch.nn as nn import torch.utils.data as dat
27.289855
92
0.677111
9b921382771a3e80faea212dc2044b24ad49e32b
6,623
py
Python
src/client/app/__init__.py
ZackPashkin/toloka-kit
8f650e5d8cdded1949ca633cf78f9b851ce839bb
[ "Apache-2.0" ]
153
2021-02-06T13:41:11.000Z
2022-03-19T17:51:01.000Z
src/client/app/__init__.py
ZackPashkin/toloka-kit
8f650e5d8cdded1949ca633cf78f9b851ce839bb
[ "Apache-2.0" ]
29
2021-01-15T12:54:37.000Z
2022-02-07T07:45:32.000Z
src/client/app/__init__.py
ZackPashkin/toloka-kit
8f650e5d8cdded1949ca633cf78f9b851ce839bb
[ "Apache-2.0" ]
17
2021-01-29T15:20:04.000Z
2022-01-30T07:21:03.000Z
__all__ = [ 'AppProject', 'App', 'AppItem', 'AppItemsCreateRequest', 'AppBatch', 'AppBatchCreateRequest' ] import datetime import decimal from enum import unique from typing import Dict, Any, List from ..primitives.base import BaseTolokaObject from ..project.field_spec import FieldSpec from ...util._extendable_enum import ExtendableStrEnum from ...util._codegen import attribute
30.380734
118
0.653782
9b926fbc1417f4ebd631923a6169eb196f0aff02
760
py
Python
WebApp/main/utility/StringUtility.py
georg-wenzel/ml-data-smell-detection
7dddd401ca1f1a830dfd8b00760659911e5b1086
[ "MIT" ]
1
2022-03-29T14:46:40.000Z
2022-03-29T14:46:40.000Z
WebApp/main/utility/StringUtility.py
georg-wenzel/ml-data-smell-detection
7dddd401ca1f1a830dfd8b00760659911e5b1086
[ "MIT" ]
null
null
null
WebApp/main/utility/StringUtility.py
georg-wenzel/ml-data-smell-detection
7dddd401ca1f1a830dfd8b00760659911e5b1086
[ "MIT" ]
1
2021-06-13T08:24:46.000Z
2021-06-13T08:24:46.000Z
# Utility functions for Strings (i.e. storing common strings once) #define common strings ERR_MISSING_KEY = "The field(s) {0} must be filled in this form." ERR_INVALID_KEY = "The field '{0}' contains an invalid value." ERR_UNAUTHORIZED = "The logged in user does not have access to this value: {0}" MSG_FINISHED_TRAINING = "Your agent {0} has finished training and can now be used." #define error string for (multiple) column mismatch #pass tuple of mismatched columns as defined by AgentUtility.dataset_all_columns_match
54.285714
138
0.709211
9b93e34b4881434ea8a11345bd79b7ea4e4e91b3
2,184
py
Python
lib/python2.7/site-packages/pyami/primefactor.py
leschzinerlab/myami-3.2-freeHand
974b8a48245222de0d9cfb0f433533487ecce60d
[ "MIT" ]
6
2018-05-10T19:12:53.000Z
2021-05-19T21:11:56.000Z
pyami/primefactor.py
vosslab/ctfeval
6cfc648f91c318c3a46a959e4771c3d16d8e741a
[ "Apache-2.0" ]
1
2017-04-15T11:04:39.000Z
2017-04-17T20:21:53.000Z
pyami/primefactor.py
vossman/ctfeval
6cfc648f91c318c3a46a959e4771c3d16d8e741a
[ "Apache-2.0" ]
1
2019-09-05T20:58:37.000Z
2019-09-05T20:58:37.000Z
#!/usr/bin/env python import sys import math maxprime = 12 twomult = 2**2 #==================== def prime_factors(n): """ Return the prime factors of the given number. """ # < 1 is a special case if n <= 1: return [1] factors = [] lastresult = n while True: if lastresult == 1: break c = 2 while True: if lastresult % c == 0: break c += 1 factors.append(c) lastresult /= c return factors #==================== #==================== #==================== #==================== #==================== #==================== def isGoodPrime(num=4, power_of_4_rule=True): """ Boxsize rules: (1) no prime factor greater than 11 (2) if greater than 4^x, must be multiple of 2^x, """ #print numa if power_of_4_rule: if num % 4 != 0: return False ### get the number of powers of 4 in number power = int(math.floor(math.log(float(num))/math.log(4.0))) ### check to make sure number is divisible by 2 to that power mod = int(2**power) if num % mod != 0: return False ### get prime factors and find maximum factors = prime_factors(num) if max(factors) > maxprime: return False return True #==================== #==================== if __name__ == "__main__": if len(sys.argv) > 1: n = int(sys.argv[1]) factors = prime_factors(n) print n, factors prev, next = getPrimeLimits(n) print "Use %d or %d instead"%(prev,next) else: print getAllPrimes()
18.991304
63
0.594322
9b94d42c4e5c72f5294c49e1d55e12f33a9b3855
2,027
py
Python
visualization/draw.py
DougMHu/roomba-obstacle-mapping
019b6108c1967c7daabe7b4795cfac7ef0e79cf7
[ "MIT" ]
3
2018-05-26T20:41:27.000Z
2020-10-19T12:40:42.000Z
visualization/draw.py
DougMHu/roomba-obstacle-mapping
019b6108c1967c7daabe7b4795cfac7ef0e79cf7
[ "MIT" ]
null
null
null
visualization/draw.py
DougMHu/roomba-obstacle-mapping
019b6108c1967c7daabe7b4795cfac7ef0e79cf7
[ "MIT" ]
1
2017-01-31T09:47:21.000Z
2017-01-31T09:47:21.000Z
# MIT License # Copyright (c) 2016 Aashiq Ahmed, Shuai Chen, Meha Deora, Douglas Hu # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import turtle turtle.setup(800,800) wn = turtle.Screen() doug = turtle.Turtle() # Draw a grid length = 5 width = 2 step = 50 #draw_row(width,[1,0]) draw_matrix([[0,1],[1,1]]) # doug.left(90) # doug.fd((width-0.5)*step) # doug.right(90) # doug.up() # doug.fd(0.5*step) # doug.down() # doug.pensize(step) # doug.fd((length-1)*step) turtle.getscreen()._root.mainloop() #doug.fd(length*step)
25.658228
80
0.716823
9b96be5064867858493bac891020397805ad69fe
251
py
Python
igphotoprofile.py
raflimkamal/python_project
6d3321612226fa15b9fcafe4a301160f63d81213
[ "MIT" ]
null
null
null
igphotoprofile.py
raflimkamal/python_project
6d3321612226fa15b9fcafe4a301160f63d81213
[ "MIT" ]
null
null
null
igphotoprofile.py
raflimkamal/python_project
6d3321612226fa15b9fcafe4a301160f63d81213
[ "MIT" ]
null
null
null
#!/usr/bin/env python # coding: utf-8 # In[2]: pip install instaloader # In[4]: import instaloader # In[6]: ig = instaloader.Instaloader() dp = input("Enter Insta Username:") ig.download_profile(dp, profile_pic_only = True) # In[ ]:
8.366667
48
0.649402
9b9ade24b6474ca9ac882881c781ddb3dc8e1ab1
2,180
py
Python
activate.py
cassidoxa/bottoman
9d04331794ffb8bb745fc175c15db6d4a1f5714c
[ "MIT" ]
null
null
null
activate.py
cassidoxa/bottoman
9d04331794ffb8bb745fc175c15db6d4a1f5714c
[ "MIT" ]
null
null
null
activate.py
cassidoxa/bottoman
9d04331794ffb8bb745fc175c15db6d4a1f5714c
[ "MIT" ]
null
null
null
import json import urllib.request from bottoman import TwitchBot import config from db.db import DatabaseManager def get_user_id_display(user): """ uses twitch's API to get a user's token with their (case insensitive) user name """ client_id = config.client_id token = "srtajsl3jjbhhtfrvk0dlsu33aytv2" header = {"Client-Id": client_id, "Authorization": f'Bearer {token}'} url = f'https://api.twitch.tv/helix/users?login={user}' req = urllib.request.Request(url, headers=header) response = urllib.request.urlopen(req).read().decode('utf-8') response = json.loads(response) return (int(response['data'][0]['id']), response['data'][0]['display_name']) def check_admin(): """ check for an admin. If no admin user, ask for one and add to chatters db. """ dbmgr = DatabaseManager('db/bottoman.db') permissions_list = [i[0] for i in dbmgr.query( "SELECT permissions \ FROM chatters").fetchall()] if 'admin' in permissions_list: return else: admin_flag = False while admin_flag is False: admin = input(f"This bot has no admin. Please enter the name of \ your twitch channel: ") double_check = input(f'The admin account will be {admin}. Is \ this correct? (y/n): ') if double_check.lower() == "y": user_id, name = get_user_id_display(admin) dbmgr.write( "INSERT INTO chatters \ VALUES (?,?,?,?,?,?)", (user_id, name.lower(), name, 'admin', 1, 0,)) dbmgr.close() admin_flag = True elif double_check.lower() == "n": continue else: print(f"Please try again.") continue return # check for admin, initialize bot, join room, send hello message check_admin() bottoman = TwitchBot() bottoman.join_room(bottoman.s) bottoman.send_message(config.join_msg) bottoman.run_time()
29.459459
77
0.559174
9b9e8192f42c44f946f004808b8e37a13a83e0b0
478
py
Python
waveshare_snake.py
AndrewCarterUK/MiniGame
6d699c045e84ee3834f23eb0483245195438eff7
[ "MIT" ]
null
null
null
waveshare_snake.py
AndrewCarterUK/MiniGame
6d699c045e84ee3834f23eb0483245195438eff7
[ "MIT" ]
null
null
null
waveshare_snake.py
AndrewCarterUK/MiniGame
6d699c045e84ee3834f23eb0483245195438eff7
[ "MIT" ]
null
null
null
from minigame.waveshare.button import Button from minigame.waveshare.display import Display from minigame.games.snake import Snake WIDTH = 20 HEIGHT = 20 STEP_TIME = 0.5 BLOCK_SIZE = 32 if __name__ == '__main__': main()
19.916667
92
0.698745
9b9f8f5cfe54f976ada38f7cf0db4c9ffc2c1571
8,636
py
Python
jumodjango/urls.py
jumoconnect/openjumo
828d993bfbb83777d10a68de6964c7d5bb2c7bd0
[ "MIT" ]
5
2015-03-11T18:59:46.000Z
2018-08-17T17:49:45.000Z
jumodjango/urls.py
kmrifat/openjumo
828d993bfbb83777d10a68de6964c7d5bb2c7bd0
[ "MIT" ]
2
2020-06-05T16:52:17.000Z
2021-02-08T20:24:26.000Z
jumodjango/urls.py
kmrifat/openjumo
828d993bfbb83777d10a68de6964c7d5bb2c7bd0
[ "MIT" ]
6
2016-02-04T00:45:30.000Z
2021-07-07T17:14:50.000Z
from api.api_v1 import api_urls from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', ) ''' RANDOM URLs ''' urlpatterns += patterns('etc.views', url(r'^about/?$', 'about', name = 'about'), url(r'^help/?$', 'help', name = 'help'), url(r'^jobs/?$', 'jobs', name = 'jobs'), url(r'^team/?$', 'team', name = 'team'), url(r'^blog/?$', 'blog', name = 'blog'), url(r'^contact/?$', 'contact', name = 'contact'), url(r'^privacy/?$', 'privacy', name = 'privacy'), url(r'^terms/?$', 'terms', name = 'terms'), url(r'^/?$', 'index', name = 'index'), url(r'^error/?$', 'throw_error', name = 'throw_error'), url(r'^health_check/?$', 'health_check', name = 'health_check'), ) ''' END OF RANDOM URLs ''' ''' API URLS ''' urlpatterns += patterns('', (r'^api/', include(api_urls())), ) ''' END API URLS ''' ''' USER URLs ''' urlpatterns += patterns('users.views', url(r'^login/?$', 'login_permalink', name = 'login_permalink'), url(r'^logout/?$', 'logout_permalink', name = 'logout_permalink'), url(r'^setup/?$', 'setup', name = 'setup'), url(r'^discover/?$', 'discover', name = 'discover'), url(r'^user/(?P<mongo_id>[a-zA-Z0-9\-_].*)/?$', 'old_user_permalink', name = 'old_user_permalink'), url(r'^forgot_password/?$', 'forgot_password', name = 'forgot_password'), url(r'^reset_password/(?P<reset_id>[a-fA-F0-9].*)/?$', 'reset_password', name = 'reset_password'), url(r'^upload_photo/?$', 'upload_photo', name = 'upload_photo'), url(r'^settings/?$', 'settings', name='settings'), url(r'^settings/notifications/?$', 'notifications', name='settings_notifications'), url(r'^settings/connect/?$', 'connect', name='settings_connect'), url(r'^settings/developer/?$', 'developer', name='settings_developer'), url(r'^users/(?P<user_id>\d*)/follow/?$', 'follow', name='follow_user'), url(r'^users/(?P<user_id>\d*)/unfollow/?$', 'unfollow', name='unfollow_user'), url(r'^users/(?P<user_id>\d*)/followers/?$', 'follower_list', name='user_followers'), url(r'^users/(?P<user_id>\d*)/followings/?$', 'following_list', name='user_followings'), url(r'^remove/?$', 'remove_user', name='remove_user') ) urlpatterns += patterns('users.ajax.views', url(r'^json/v1/user/fbid_check/?$', 'check_fbid', name = 'check_fbid'), url(r'^json/v1/user/fb_login/?$', 'fb_login', name = 'fb_login'), url(r'^json/v1/user/fbot_update/?$', 'fbot_update', name = 'fbot_update'), url(r'^json/v1/user/update/?$', 'update_user', name = 'update_user'), url(r'^json/v1/user/remove/?$', 'remove_user', name = 'remove_user'), url(r'^json/v1/user/reset_password/?$', 'reset_password', name = 'reset_password'), url(r'^json/v1/user/forgot_password/?$', 'forgot_password', name = 'forgot_password'), url(r'^json/v1/user/action/follow/?$', 'follow', name = 'follow'), ) ''' END OF USER URLs ''' ''' ISSUE URLs ''' urlpatterns += patterns('issue.views', url(r'^issue/(?P<mongo_id>[a-zA-Z0-9\-_].*)/?$', 'old_issue_permalink', name = 'old_issue_permalink'), url(r'^issuename/(?P<issuename>[a-zA-Z0-9\-_\ ].*)/?$', 'old_issuename_permalink', name = 'old_issuename_permalink'), url(r'^users/(?P<user_id>\d*)/issues/?$', 'followed_issue_list', name='followed_issue_list') ) ''' ISSUE URLs ''' ''' ORG URLs ''' urlpatterns += patterns('org.views', url(r'^org/categories.js$', 'org_categories', name = 'org_categories'), url(r'^org/claim/(?P<org_id>[0-9a-zA-Z\-_].*)/confirm/?$', 'claim_org_confirm', name = 'claim_org_confirm'), url(r'^org/claim/(?P<org_id>[0-9a-zA-Z\-_].*)/?$', 'claim_org', name = 'claim_org'), url(r'^org/create/?$', 'create_org', name = 'create_org'), url(r'^org/(?P<org_id>\d.*)/details/?$', 'details', name='details_org'), url(r'^org/(?P<org_id>[0-9a-zA-Z\-_].*)/manage/?$', 'manage_org', {'tab': 'about'}, name='manage_org'), url(r'^org/(?P<org_id>[0-9a-zA-Z\-_].*)/manage/connect/?$', 'manage_org', {'tab': 'connect'}, name='manage_org_connect'), url(r'^org/(?P<org_id>[0-9a-zA-Z\-_].*)/manage/more/?$', 'manage_org', {'tab': 'more'}, name='manage_org_more'), url(r'^org/(?P<mongo_id>[a-zA-Z0-9\-_].*)/?$', 'old_org_permalink', name = 'old_org_permalink'), url(r'^orgname/(?P<orgname>[a-zA-Z0-9\-_\ ].*)/?$', 'old_orgname_permalink', name = 'old_orgname_permalink'), url(r'^users/(?P<user_id>\d*)/orgs/?$', 'followed_org_list', name='followed_org_list') ) urlpatterns += patterns('org.ajax.views', url(r'^json/v1/org/fetch_centroid/?$', 'fetch_org_by_centroid', name = 'fetch_org_by_centroid'), url(r'^json/v1/org/update/?$', 'update_org', name = 'update_org'), url(r'^json/v1/org/remove/?$', 'remove_org', name = 'remove_org'), url(r'^json/v1/org/flag/?$', 'flag_org', name = 'flag_org'), url(r'^json/v1/org/create/?$', 'org_create', name = 'org_create'), url(r'^json/v1/org/normalize_facebook_id/?$', 'normalize_facebook_id', name = 'normalize_facebook_id'), ) ''' END OF ORG URLs ''' ''' COMMITMENT URLS ''' urlpatterns += patterns('commitment.views', url(r'^commitments/create/?$', 'create', name='create_commitment'), url(r'^commitments/(?P<commitment_id>\d*)/delete/?$', 'delete', name='delete_commitment'), url(r'^orgs/(?P<entity_id>\d*)/commitments/?$', 'list', {'model_name': 'org.Org'}, name='org_commitments'), url(r'^issues/(?P<entity_id>\d*)/commitments/?$', 'list', {'model_name': 'issue.Issue'}, name='issue_commitments'), ) ''' ACTION URLS ''' urlpatterns += patterns('action.views', url(r'^orgs/(?P<entity_id>\d*)/actions/?$', 'action_list', {'model_name': 'org.Org'}, name='org_action_list'), url(r'^issues/(?P<entity_id>\d*)/actions/?$', 'action_list', {'model_name': 'issue.Issue'}, name='issue_action_list'), ) ''' SEARCH URLS ''' urlpatterns += patterns('search.views', url(r'^json/v1/search/onebox/?$', 'autocomplete', name = 'autocomplete'), url(r'^search/?$', 'search_page', name='search_page'), url(r'^json/v1/search/?$', 'ajax_search', name='ajax_search'), url(r'^json/v1/autocomplete/?$', 'ajax_term_complete', name='ajax_term_complete') ) ''' MAILER URLS ''' urlpatterns += patterns('mailer.views', url(r'^unsubscribe/$', 'unsubscribe', name='unsubscribe'), url(r'^email/text/(?P<username>[a-zA-Z0-9\-_\ ].*)/?$', 'jumo_reader', name = 'jumo_reader'), url(r'^email/(?P<username>[a-zA-Z0-9\-_\ ].*)/?$', 'jumo_reader', name = 'jumo_reader'), #url(r'^notification/(?P<username>[a-zA-Z0-9\-_\ ].*)/?$', 'notification_email', name = 'notification_email'), ) ''' END MAILER URLS ''' ''' ADMIN URLS ''' urlpatterns += patterns('', (r'^admin/org/report/$', 'org.admin_views.report'), (r'^grappelli/', include('grappelli.urls')), (r'^admin/', include(admin.site.urls)), ) if settings.IS_DATAMINE: urlpatterns += patterns('miner.views', url(r'^related_searches/?$', 'related_searches', name='related_searches') ) #if settings.DEBUG: if True: urlpatterns += patterns('django.views.static', (r'^static/(?P<path>.*)$', 'serve', { 'document_root': settings.MEDIA_ROOT, 'show_indexes': True }),) handler500 = 'etc.views.error_500' handler404 = 'etc.views.error_404' ''' ######################################################################################### ### HEY ######################################################################### ################################################## SEE ALL THEM POUND SIGNS? ############ ######################################################################################### ############### THAT MEANS THIS IS AN IMPORTANT MSG ##################################### ######################################################################################### ################################# SO PAY ATTENTION OK? ################################## ######################################################################################### ####### EVERYTHING WILL BREAK IF THIS ISN'T THE LAST LINE OF CODE IN THIS FILE. # ######################################################################################### ################################## WE COOL? ############################################# ######################################################################################### ''' urlpatterns += patterns('etc.views', url(r'^([a-zA-Z0-9\-_].*)/?$', 'clean_url', name = 'entity_url'), )
45.452632
125
0.54736
9ba08896288342be18a3bdfe4d777157062a927c
2,830
py
Python
modules/layers.py
vliu15/munit
5789d96590519d729f89c9501eba7692fa7054ef
[ "MIT" ]
3
2021-03-04T01:48:03.000Z
2021-12-16T06:55:10.000Z
modules/layers.py
vliu15/munit
5789d96590519d729f89c9501eba7692fa7054ef
[ "MIT" ]
null
null
null
modules/layers.py
vliu15/munit
5789d96590519d729f89c9501eba7692fa7054ef
[ "MIT" ]
null
null
null
# The MIT License # # Copyright (c) 2020 Vincent Liu # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import torch import torch.nn as nn
36.753247
84
0.674558
9ba3741e685c1d558d552dcb021080523937b319
721
py
Python
lab_new/locust/locustfile.py
mwardbopp/f5-big-iq-lab
70d5b766571f8db8b3bc744e98c183dbdd500089
[ "Apache-2.0" ]
18
2018-07-17T15:17:16.000Z
2021-12-05T21:13:26.000Z
lab_new/locust/locustfile.py
mwardbopp/f5-big-iq-lab
70d5b766571f8db8b3bc744e98c183dbdd500089
[ "Apache-2.0" ]
34
2018-09-11T04:43:47.000Z
2021-04-19T15:58:50.000Z
lab_new/locust/locustfile.py
mwardbopp/f5-big-iq-lab
70d5b766571f8db8b3bc744e98c183dbdd500089
[ "Apache-2.0" ]
54
2018-07-30T12:23:33.000Z
2021-06-11T17:54:28.000Z
import time from locust import HttpUser, task, between # https://docs.locust.io/en/stable/quickstart.html
34.333333
105
0.65742
9ba44cd9d91cc8c729aafc0cddc794fc2187f3f9
25,015
py
Python
lizardanalysis/calculations/aep_pep_test.py
JojoReikun/ClimbingLizardDLCAnalysis
6cc38090217a3ffd4860ef6d06ba7967d3c10b7c
[ "MIT" ]
1
2021-03-09T19:12:44.000Z
2021-03-09T19:12:44.000Z
lizardanalysis/calculations/aep_pep_test.py
JojoReikun/ClimbingLizardDLCAnalysis
6cc38090217a3ffd4860ef6d06ba7967d3c10b7c
[ "MIT" ]
null
null
null
lizardanalysis/calculations/aep_pep_test.py
JojoReikun/ClimbingLizardDLCAnalysis
6cc38090217a3ffd4860ef6d06ba7967d3c10b7c
[ "MIT" ]
null
null
null
def aep_pep_test(**kwargs): """ Calculates two different things: 1.) The x and y coordinates of the AEP and PEP, relative to the coxa of a respective leg 2.) The swing phases and the stance phases, identifying on a frame by frame basis Return: results data frame with 30 key value pairs: x6 allocation of swing and stance phases for each foot/leg x6 x coordinates of AEP for each foot/leg x6 y coordinates for AEP for each foot/leg x6 x coordinates for PEP for each foot/leg x6 y coordinates for PEP for each foot/leg """ import os.path import pandas as pd from pandas import np from pathlib import Path from lizardanalysis.utils import animal_settings from scipy import signal import math # print("footfall_by_switches") # define necessary **kwargs: data = kwargs.get('data') data_rows_count = kwargs.get('data_rows_count') config = kwargs.get('config') filename = kwargs.get('filename') likelihood = kwargs.get('likelihood') animal = kwargs.get('animal') df_result_current = kwargs.get('df_result_current') # added in this so that you can get the estimated values from alpha # so long as that column currently resides in the data frame config_file = Path(config).resolve() # result folder for footfall plots step_detection_folder = os.path.join(str(config_file).rsplit(os.path.sep, 1)[0], "analysis-results", "step_detection") # create file path for foot fall pattern diagrams plotting_footfall_folder = os.path.join(step_detection_folder, "footfall-pattern-diagrams") # TODO: instead of hard-coding the feet and the three points for body_motion, # TODO: let the user choose based on labels available in DLC result file: Choose feet & choose body motion scorer = data.columns[1][0] feet = animal_settings.get_list_of_feet(animal) relative = False plotting_footfall_patterns = True # define cut-off value -> crops X% of frames on each side of video p_cut_off = 0.05 body_motion = {"frame": [], "mean_motion_x": []} abdomen_diff = 0 head_diff = 0 # assuming that the body from the head to the abdomen is rigid? # this for loop is used to calculate the x coordinate difference between a given frame and the previous # therefore gives you can indicator of the direction of motion # if the [row] - [row-1] > 0 , then the stick insect is moving to the right # if the [row] - [row-1] < 0, then the stick insect is moving to the left for row in range(1, data_rows_count): if data.loc[row][scorer, "head", 'likelihood'] >= likelihood and data.loc[row - 1][ scorer, "head", 'likelihood'] >= likelihood: head_diff = data.loc[row][scorer, "head"] - data.loc[row - 1][scorer, "head"] if data.loc[row][scorer, "abdomen", 'likelihood'] >= likelihood and data.loc[row - 1][ scorer, "abdomen", 'likelihood'] >= likelihood: abdomen_dif = data.loc[row][scorer, "abdomen"] - data.loc[row - 1][scorer, "abdomen"] body_motion["frame"].append(row - 1) body_motion["mean_motion_x"].append(abs((head_diff + abdomen_diff) / 2.0)) # am taking the absolute value, because if the stick insect walks to the left, then you don't want to # switch the which sign changes indicates swing/pep and which sign change indicates stance/aep. # taking the average of the differences, to determine the average 'speed' i.e. the displacement over one frame of the whole body # one class instance and one result array for every foot, since every foot needs its own counter calculators = {} results = {} # for every foot, need to do within the original for loop, so all foot calculations are performed for a given frame foot_motions = {} rel_foot_motions = {} # left the for loop for the body motion, and will now be working with for loops for the foot motion for foot in feet: foot_motions[f"{foot}"] = [] rel_foot_motions[f"rel_{foot}"] = [] # if the [row] - [row-1] > 0 , then the stick insect FOOT is moving to the right # if the [row] - [row-1] < 0, then the stick insect FOOT is moving to the left # taking an absolute value for the body and foot motions avoid issues with directions (?) foot_motion = 0 for row in range(1, data_rows_count): if data.loc[row][scorer, f"{foot}", 'likelihood'] >= likelihood and data.loc[row - 1][scorer, f"{foot}",'likelihood'] >= likelihood: foot_motion = abs(data.loc[row][scorer, f"{foot}", 'x'] - data.loc[row - 1][ scorer, f"{foot}", 'x']) foot_motions[f"{foot}"].append(foot_motion) rel_foot_motions[f"rel_{foot}"].append(foot_motion - body_motion['mean_motion_x'][row - 1]) else: foot_motions[f"foot"].append # now need to store the body motion data, the foot motion data, and the relative foot motion all in a dataframe # this dataframe within the loop is only for one foot dict_df = {'body_motion': body_motion['mean_motion_x'], 'foot_motion': foot_motions[f"{foot}"], "rel_foot_motion": rel_foot_motions[f"rel_{foot}"]} print(dict_df) df = pd.DataFrame.from_dict(dict_df) intersections = smooth_and_plot(df, data_rows_count, p_cut_off, relative, foot, filename, step_detection_folder) ###################################################################################################################### # the smooth_and_plot function returns 'intersection_dict' # intersection dict is: {"idx":[], "sign":[]} # idx = the idx of the number list/array of differences in the sign, only storing when the differences are non-zero # sign = stores the sign of the number associated with the index of the non zero number # positive => start of swing =>PEP # negative => start of stance => AEP # gives the alpha_estimation values for the rom_list = [col for col in df_result_current.columns if ("rom_angle_{}".format(foot) in col)] aep_pep_angle = [] # for loop will calculate the angle that defines the femur-coxa vector relative to the normal # to the body axis, running through the coxa of the foot of interest for angle in range(len(rom_list)): aep_pep_angle.append(90 - angle) foot_chars = list(foot) f_t_joint_lpx = [] f_t_joint_lpy = [] t_c_joint_lpx = [] t_c_joint_lpy = [] # low pass filter application of the coordinate data alone? # is this necessary b, a = signal.butter(3, 0.1, btype='lowpass', analog=False) f_t_joint_lpx = signal.filtfilt(b, a, (data.loc[:, (scorer, "{}m{}".format(foot_chars[0], foot_chars[1]), "x")])) f_t_joint_lpy = signal.filtfilt(b, a, (data.loc[:, (scorer, "{}m{}".format(foot_chars[0], foot_chars[1]), "y")])) t_c_joint_lpx = signal.filtfilt(b, a, (data.loc[:, (scorer, "{}b{}".format(foot_chars[0], foot_chars[1]), "x")])) t_c_joint_lpy = signal.filtfilt(b, a, (data.loc[:, (scorer, "{}b{}".format(foot_chars[0], foot_chars[1]), "y")])) # ensuring that the values for the keys are defined as arrays, so that you can append for the # following for loop results_aep = {"{}_x".format(foot): [], "{}_y".format(foot): []} results_pep = {"{}_x".format(foot): [], "{}_y".format(foot): []} for i in range(2, data_rows_count): if i - 2 in intersections["idx"]: # atm just leaving the likelihood check # is it worth doing, considering the alpha angles depended on those likelihoods anyway? # so you would be just checking the same likelihood even though # now calculating the Euclidean distance between the coxa label and the femur label f_t_joint_co = (f_t_joint_lpx[i], f_t_joint_lpy[i]) t_c_joint_co = (t_c_joint_lpx[i], t_c_joint_lpy[i]) distance = np.sqrt( (f_t_joint_co[0] - t_c_joint_co[0]) ** 2 + (f_t_joint_co[1] - t_c_joint_co[1]) ** 2) # calibrate distance with conversion factor # NEED TO WRITE THE CONVERSION FACTOR! distance_calib = distance # / conv_fac # results_aep = {} # results_pep = {} if intersections["sign"][i - 2] > 0: # this means you are transitioning to the swing phase, so should be PEP results_pep[f"{foot}_x"].append((math.cos(aep_pep_angle[i]) * distance_calib)) results_pep[f"{foot}_y"].append((math.sin(aep_pep_angle[i]) * distance_calib)) if intersections["sign"][i - 2] < 0: # this means you are transitioning to the stance phase so should be aep results_aep[f"{foot}_x"].append((math.cos(aep_pep_angle[i]) * distance_calib)) results_aep[f"{foot}_y"].append((math.sin(aep_pep_angle[i]) * distance_calib)) # therefore should now have two dictionaries that contain the x coordinates and the y coordinates # of the aep and the pep for each foot # one aep value and one pep value per stepping cycle ##################################################################################################################### # initializes class instance for every foot and empty result dict to be filled with the swing and stance phases: calculators[foot] = StridesAndStances() # "S10" = string of 10 characters: stance/stride + counter 000n results[foot] = calculators[foot].determine_stride_phases(intersections, data_rows_count) # rename dictionary keys of results results = {'stepphase_' + key: value for (key, value) in results.items()} results_aep = {"AEP_" + key: value for (key, value) in results_aep.items()} results_pep = {"PEP_" + key: value for (key, value) in results_pep.items()} # print("results: ", results) if plotting_footfall_patterns: """ plots a foot fall pattern diagram for every DLC result csv file/every lizard run """ plot_footfall_pattern(results, data_rows_count, filename, plotting_footfall_folder) ## need to add the result of the code here! # last step must be combining the three results dictionaries results.update(results_aep) results.update(results_pep) return results # shouldn't matter whether the stick insect walks in a straight horizontal line or not, because you're only looking at # the switch in the direction of movement # therefore, as long as the insect doesn't walk completely vertically suddenly, then the algorithm should still work ## removed the unused function, might need to put back in at some point def plot_footfall_pattern(results, data_rows_count, filename, plotting_footfall_folder): """ takes the result dataframe and creates a new dataframe for plotting. Every foot gets assigned an individual number. The dataframe is then filtered for strings containing "stride", the strides get replaced by the respective number, while all stances will be NaN. In the plot strides are therefore displayed as bars and stances are empty. """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.lines import Line2D from matplotlib.patches import Patch import os import errno df_plot = pd.DataFrame(columns=results.keys(), index=range(data_rows_count)) # filter here and only fill in stances as numbers => stances bars, strides white for i, key in enumerate(results): df_plot[key] = [i + 1 if s.startswith(b'stance') else np.NaN for s in results[key]] key_list = [key for key in df_plot.columns] colors = False if colors: cmap = plt.cm.coolwarm legend_elements = [Line2D([0], [0], color=cmap(0.), lw=4, label=key_list[0]), Line2D([0], [0], color=cmap(.33), lw=4, label=key_list[1]), Line2D([0], [0], color=cmap(.66), lw=4, label=key_list[2]), Line2D([0], [0], color=cmap(1.), lw=4, label=key_list[3]), Line2D([0], [0], color='black', lw=4, label='stance phases'), Line2D([0], [0], color='white', lw=4, label='stride phases')] fig, ax = plt.subplots() df_plot.plot(linewidth=10, color=cmap(np.linspace(0, 1, 5)), ax=ax) ax.legend(handles=legend_elements) else: legend_elements = [Line2D([0], [0], color='white', lw=1, label='1 = FL | 2 = FR | 3 = HR | 4 = HL'), Line2D([0], [0], color='black', lw=4, label='stance phases'), Line2D([0], [0], color='white', lw=4, label='stride phases')] fig, ax = plt.subplots() df_plot.plot(linewidth=10, color='black', ax=ax) ax.legend(handles=legend_elements) # saves footfall pattern diagrams as pdf in defined result folder. If folder is not extant yet, it will be created try: os.makedirs(plotting_footfall_folder) except OSError as e: if e.errno != errno.EEXIST: raise plt.savefig(os.path.join(plotting_footfall_folder, "{}.pdf".format(filename))) plt.clf() plt.close()
49.534653
136
0.625625
9ba6402b03516602907bdd9d7c0d28f9b0666716
1,601
py
Python
python/test.py
drulm/Spark_Knapsack
ef8ab8b6ac6762391b63ff29ebf857a65f98698d
[ "Apache-2.0" ]
7
2018-04-18T00:51:29.000Z
2021-05-30T12:58:36.000Z
python/test.py
darrell-ulm/Spark_Knapsack
ef8ab8b6ac6762391b63ff29ebf857a65f98698d
[ "Apache-2.0" ]
null
null
null
python/test.py
darrell-ulm/Spark_Knapsack
ef8ab8b6ac6762391b63ff29ebf857a65f98698d
[ "Apache-2.0" ]
2
2019-05-28T03:13:26.000Z
2019-11-22T19:50:14.000Z
# -------------------------------------------- # Test the Approximate Knapsack function test # -------------------------------------------- # Pull in the knapsack library. import random from pyspark.sql import SparkSession from knapsack import knapsack # Create the SparkContext. sc = SparkSession \ .builder \ .appName("Knapsack Approximation Algorithm Test") \ .getOrCreate() # Knapsack problem size. N = 10 # Setup sample data for knapsack. knapsackData = [('item_' + str(k), random.uniform(1.0, 10.0), random.uniform(1.0, 10.0)) for k in range(N)] # Make a Dataframe with item(s), weight(s), and value(s) for the knapsack. knapsackData = sc.createDataFrame(knapsackData, ['item', 'weights', 'values']) # Display the original data print "Original Data:" print knapsackData.show() print "\n" # Create a random maximum weight W = random.uniform(N * 1.3, N * 1.6) # Show the weight. print "W: " print W print "\n" # Call the knapsack greedy approximation function, with data and size 5. k = knapsack.knapsackApprox(knapsackData, W) # Show the results Dataframe. print "Selected Elements:" print k.show() print "\n" # Show totals for selected elements of knapsack. sumValues = k.rdd.map(lambda x: x["values"]).reduce(lambda x, y: x+y) sumWeights = k.rdd.map(lambda x: x["weights"]).reduce(lambda x, y: x+y) numResults = k.count() print "Totals:" print "Sum Values: ", sumValues print "Sum Weights: ", sumWeights print numResults print "\n" # ------------------------------------------ # End of Approximate Knapsack function test # ------------------------------------------
26.245902
107
0.634603
9ba65d1715a7fcfaf9934b6a6bcb75b319f1120c
413
py
Python
mysite/blog/views.py
josonle/LearningDjango
62558aa141c5872c2380e5daa336da199a54b0e1
[ "MIT" ]
1
2019-02-19T07:38:02.000Z
2019-02-19T07:38:02.000Z
mysite/blog/views.py
josonle/LearningDjango
62558aa141c5872c2380e5daa336da199a54b0e1
[ "MIT" ]
null
null
null
mysite/blog/views.py
josonle/LearningDjango
62558aa141c5872c2380e5daa336da199a54b0e1
[ "MIT" ]
null
null
null
from django.shortcuts import render,get_object_or_404 from .models import BlogArticles # Create your views here.
34.416667
80
0.79661
9ba95d022de0cbe77839799064d678253b042077
204
py
Python
tests/test_gluupostgres.py
danilosoarescardoso/cloud-native-edition
b8aa66119dc4440b1ca3741a4065c9ae7feb42fb
[ "Apache-2.0" ]
1
2021-04-04T04:25:49.000Z
2021-04-04T04:25:49.000Z
tests/test_gluupostgres.py
danilosoarescardoso/cloud-native-edition
b8aa66119dc4440b1ca3741a4065c9ae7feb42fb
[ "Apache-2.0" ]
null
null
null
tests/test_gluupostgres.py
danilosoarescardoso/cloud-native-edition
b8aa66119dc4440b1ca3741a4065c9ae7feb42fb
[ "Apache-2.0" ]
null
null
null
import pygluu.kubernetes.postgres as module0 from pygluu.kubernetes.postgres import Postgres
20.4
47
0.72549
9ba99aa02744fe90eebce52ab7ecf4ce0854c775
1,367
py
Python
Medium/918. Maximum Sum Circular Subarray/solution (1).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
3
2020-05-09T12:55:09.000Z
2022-03-11T18:56:05.000Z
Medium/918. Maximum Sum Circular Subarray/solution (1).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
null
null
null
Medium/918. Maximum Sum Circular Subarray/solution (1).py
czs108/LeetCode-Solutions
889f5b6a573769ad077a6283c058ed925d52c9ec
[ "MIT" ]
1
2022-03-11T18:56:16.000Z
2022-03-11T18:56:16.000Z
# 918. Maximum Sum Circular Subarray # Runtime: 1028 ms, faster than 5.09% of Python3 online submissions for Maximum Sum Circular Subarray. # Memory Usage: 18.6 MB, less than 33.98% of Python3 online submissions for Maximum Sum Circular Subarray. import math
35.973684
106
0.567666
9ba9d75f770e59ab5f8bd4c1745fa1e171a92981
10,644
py
Python
testing.py
gustxsr/learning-with-assemblies
4158829adf4500a9ae868ca7c64ffef90753c66b
[ "MIT" ]
null
null
null
testing.py
gustxsr/learning-with-assemblies
4158829adf4500a9ae868ca7c64ffef90753c66b
[ "MIT" ]
null
null
null
testing.py
gustxsr/learning-with-assemblies
4158829adf4500a9ae868ca7c64ffef90753c66b
[ "MIT" ]
null
null
null
import numpy as np import matplotlib.pyplot as plt from scipy.signal import convolve from matplotlib.gridspec import GridSpec import matplotlib as mpl rng = np.random.default_rng() def k_cap(input, cap_size): """ Given a vector input it returns the highest cap_size entries from cap_zie """ output = np.zeros_like(input) if len(input.shape) == 1: idx = np.argsort(input)[-cap_size:] output[idx] = 1 else: idx = np.argsort(input, axis=-1)[:, -cap_size:] np.put_along_axis(output, idx, 1, axis=-1) return output n_in = 784 # Vector of 28X28 pixels cap_size = 200 # Size of the cap sparsity = 0.1 n_rounds = 10 n_examples=800 beta = 1e0 train_path="./data/mnist/mnist_train.csv" layers=[ (2000,200)]# number of neurons in network with respective cap_size test_path="./data/mnist/mnist_test.csv" kernels=[np.ones((1, 3, 3))] classify_two=classification_mnist(kernels,train_path,test_path, n_in , sparsity, layers, beta) classify_two.train_model( 5) print(classify_two.classify( 5, test=False))
37.087108
217
0.613209
9bab281692147103f4b861c83d053ce8c6a1c16f
4,398
py
Python
src/chatstats.py
brendancsmith/cohort-facebook
a7b37d14b7152349930bc10f69cb72446d6c3581
[ "MIT" ]
null
null
null
src/chatstats.py
brendancsmith/cohort-facebook
a7b37d14b7152349930bc10f69cb72446d6c3581
[ "MIT" ]
null
null
null
src/chatstats.py
brendancsmith/cohort-facebook
a7b37d14b7152349930bc10f69cb72446d6c3581
[ "MIT" ]
null
null
null
from collections import Counter, defaultdict from datetime import datetime from statistics import mean from dateutil.parser import parse as parse_datetime from dateutil import rrule
29.918367
91
0.648931
9bac9dcd120d634f437ebef6f5de2fb78cd0ef74
741
py
Python
app/model/user_signup.py
dwdraugr/YADS
c8036d8196a3158636aaa4f1910033e70ec8ecb4
[ "Apache-2.0" ]
3
2019-09-02T11:26:58.000Z
2019-12-06T15:54:38.000Z
app/model/user_signup.py
dwdraugr/YADS
c8036d8196a3158636aaa4f1910033e70ec8ecb4
[ "Apache-2.0" ]
null
null
null
app/model/user_signup.py
dwdraugr/YADS
c8036d8196a3158636aaa4f1910033e70ec8ecb4
[ "Apache-2.0" ]
null
null
null
import app.model.model as model import hashlib
35.285714
94
0.584345
9bae71f7a1d534c3b03ab7c28df3edc847994f0b
2,125
py
Python
utils/lsms/compositional_histogram_cutoff.py
allaffa/HydraGNN
b48f75cd3fe1b0d03bae9af3e6bdc2bb29f8b9c6
[ "BSD-3-Clause" ]
1
2022-01-30T16:50:51.000Z
2022-01-30T16:50:51.000Z
utils/lsms/compositional_histogram_cutoff.py
allaffa/HydraGNN
b48f75cd3fe1b0d03bae9af3e6bdc2bb29f8b9c6
[ "BSD-3-Clause" ]
1
2022-02-03T11:45:53.000Z
2022-02-09T17:59:37.000Z
utils/lsms/compositional_histogram_cutoff.py
kshitij-v-mehta/HydraGNN
d27958270b2beb35f98e4403239e3c5c77ad4a04
[ "BSD-3-Clause" ]
null
null
null
import os import shutil import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt def compositional_histogram_cutoff( dir, elements_list, histogram_cutoff, num_bins, overwrite_data=False, create_plots=True, ): """ Downselect LSMS data with maximum number of samples per binary composition. """ if dir.endswith("/"): dir = dir[:-1] new_dir = dir + "_histogram_cutoff/" if os.path.exists(new_dir): if overwrite_data: shutil.rmtree(new_dir) else: print("Exiting: path to histogram cutoff data already exists") return if not os.path.exists(new_dir): os.makedirs(new_dir) comp_final = [] comp_all = np.zeros([num_bins]) for filename in tqdm(os.listdir(dir)): path = os.path.join(dir, filename) # This is LSMS specific - it assumes only one header line and only atoms following. atoms = np.loadtxt(path, skiprows=1) elements, counts = np.unique(atoms[:, 0], return_counts=True) # Fixup for the pure component cases. for e, elem in enumerate(elements_list): if elem not in elements: elements = np.insert(elements, e, elem) counts = np.insert(counts, e, 0) num_atoms = atoms.shape[0] composition = counts[0] / num_atoms b = find_bin(composition, num_bins) comp_all[b] += 1 if comp_all[b] < histogram_cutoff: comp_final.append(composition) new_path = os.path.join(new_dir, filename) os.symlink(path, new_path) if create_plots: plt.figure(0) plt.hist(comp_final, bins=num_bins) plt.savefig("composition_histogram_cutoff.png") plt.figure(1) w = 1 / num_bins plt.bar(np.linspace(0, 1, num_bins), comp_all, width=w) plt.savefig("composition_initial.png")
27.960526
91
0.610353
9baf6c3804173cb531cd1c2955cba4bc19bd4390
109
py
Python
CVcontact/urls.py
siavashMehran/Portfolio
a592ec51122d96e8e336365fd3cd039a7f223221
[ "MIT" ]
null
null
null
CVcontact/urls.py
siavashMehran/Portfolio
a592ec51122d96e8e336365fd3cd039a7f223221
[ "MIT" ]
null
null
null
CVcontact/urls.py
siavashMehran/Portfolio
a592ec51122d96e8e336365fd3cd039a7f223221
[ "MIT" ]
null
null
null
from django.urls import path from .views import contactMe urlpatterns = [ path('contact', contactMe) ]
13.625
30
0.724771
9bb0067ad50b3ebfd94976cc78cce86faed75925
1,256
py
Python
PointMatcher/actions/export.py
daisatojp/PointMatcher
927bd4dd676b18da763ccaab2f429f27de281710
[ "MIT" ]
2
2021-01-05T03:42:50.000Z
2022-03-16T07:17:02.000Z
PointMatcher/actions/export.py
daisatojp/PointMatcher
927bd4dd676b18da763ccaab2f429f27de281710
[ "MIT" ]
4
2021-01-07T06:28:01.000Z
2021-01-18T11:59:56.000Z
PointMatcher/actions/export.py
daisatojp/PointMatcher
927bd4dd676b18da763ccaab2f429f27de281710
[ "MIT" ]
null
null
null
import os.path as osp from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import QAction from PyQt5.QtWidgets import QFileDialog from PointMatcher.utils.filesystem import icon_path
35.885714
75
0.642516