repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
codeeu/coding-events
web/forms/event_form.py
# -*- coding: utf-8 -*- from django import forms from django_countries.fields import countries from api.models import Event from api.models.events import EventTheme, EventAudience class AddEventForm(forms.ModelForm): email_errors = { 'required': u'Please enter a valid email, so we can contact you in case...
DFEC-R2D2/r2d2
pygecko/i2c.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ############################################## # The MIT License (MIT) # Copyright (c) 2018 Kevin Walchko # see LICENSE for full details ############################################## from pygecko.multiprocessing import geckopy from pygecko.test import GeckoSimpleProcess ...
zayfod/pyfranca
pyfranca/franca_processor.py
import os from collections import OrderedDict from pyfranca import franca_parser, ast class ProcessorException(Exception): def __init__(self, message): super(ProcessorException, self).__init__() self.message = message def __str__(self): return self.message class Processor(object):...
indico/indico
indico/modules/categories/views.py
# This file is part of Indico. # Copyright (C) 2002 - 2022 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from flask import request from markupsafe import escape from indico.modules.admin.views import WPAdmin fr...
Cysu/Person-Reid
reid/utils/gui_images_gallery.py
#!/usr/bin/python2 # -*- coding: utf-8 -*- from PySide import QtGui from reid.utils.gui_utils import ndarray2qimage from reid.utils.gui_flow_layout import FlowLayout class ImagesGallery(QtGui.QWidget): """Images Gallery (ImagesGallery) The ImagesGallery class is a widget that display images in a QHBoxLayou...
tatiwa/mythree.js
utils/exporters/blender/2.63/scripts/addons/io_mesh_threejs/export_threejs.py
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
benedictpaten/marginAlign
scripts/substitutions.py
from margin.utils import AlignedPair, getFastaDictionary, getFastqDictionary, samIterator import os, sys from optparse import OptionParser import pysam import xml.etree.cElementTree as ET from jobTree.src.bioio import reverseComplement, prettyXml, system from itertools import product class SubstitutionMatrix(): ""...
KirstieJane/UCHANGE_ProcessingPipeline
NSPN_RenumberParcellationVolume.py
#!/usr/bin/env python ''' NSPN_RenumberParcellationVolume.py Created on 12th September 2017 by Kirstie Whitaker kw401@cam.ac.uk This code renumbers the output of mri_aparc2aseg so that all values are consecutive integers and that they match with the volume in fsaverageSubP space. For example, the 500.aparc.nii.gz fi...
liffiton/ATLeS
src/analyze.py
#!/usr/bin/env python3 import argparse import importlib import pkgutil from analysis import scripts def main(): parser = argparse.ArgumentParser(description='Analyze ATLeS experiment tracks.') subparsers = parser.add_subparsers() # Make the subcommand required in Python 3.3+ (https://stackoverflow.com/a...
aasensio/pyiacsun
pyiacsun/machinelearn/kmeans.py
import numpy as np __all__ = ['kmeans'] def distancia(media, matriz): """Calcula la distancia euclideana desde la media hasta cada vector en la matriz """ res = [] for i in matriz: res.append(np.sum((media - i)**2.)) return res def kmeans(datos_fila, nGrupos, umbral=None): """Cal...
un33k/django-smartfields
smartfields/utils.py
import os, errno, uuid, threading from django.conf import settings from django.core import validators from django.core.files import base, temp from django.utils.encoding import force_text from django.utils.six.moves import queue as six_queue try: from django.utils.deconstruct import deconstructible except ImportEr...
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/route_table.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
Kzulfazriawan/stigma-game-demo
application/controller/resources/Character.py
import os from core import Files class Character(object): ''' ''' stigma = { 'usual': os.path.join(format(Files.rootpath), 'assets', 'image', 'character', 'stigma', 'usual.png'), 'talk': os.path.join(format(Files.rootpath), 'assets', 'image', 'character', 'stigma', 'talk.png'), 's...
Tanych/CodeTracking
382-Linked-List-Random-Node/solution.py
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def __init__(self, head): """ @param head The linked list's head. Note that the head is guanranteed to be not null, so it contains a...
sunchuanleihit/vimrc
sources_non_forked/YouCompleteMe/python/ycm/base.py
# Copyright (C) 2011, 2012 Google Inc. # # This file is part of YouCompleteMe. # # YouCompleteMe is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any late...
wavycloud/pyboto3
pyboto3/kinesisvideosignalingchannels.py
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud 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, p...
PeterGrace/pi_director
pi_director/controllers/controllers.py
import shlex from pi_director.models.models import ( DBSession, RasPi, Tags, Logs ) from sqlalchemy import desc from datetime import datetime def get_pis(): PiList = DBSession.query(RasPi).filter(RasPi.uuid != "default").order_by(desc(RasPi.lastseen)).all() return PiList def get_logs(uuid):...
cbrentharris/epoch-helpers
epoch_helpers/months_since_epoch.py
from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta EPOCH = datetime(1970, 1, 1) def months_between_dates(d1, d2): return (d1.year - d2.year) * 12 + d1.month - d2.month def months_since_epoch(year, month, day): return months_between_dates(datetime(year, month, day), EPOC...
vjFaLk/frappe
frappe/utils/__init__.py
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt # util __init__.py from __future__ import unicode_literals, print_function from werkzeug.test import Client import os, re, sys, json, hashlib, requests, traceback from .html_utils import sanitize_html import frappe fro...
uio-cees/willibr-TE-pipeline
scripts/classifier.py
#!/usr/bin/env python """ FINISHED, William Brynildsen """ from Bio import SeqIO import sys, argparse if __name__ == '__main__': parser = argparse.ArgumentParser(description= '') parser.add_argument('-i', '--input', action='store', help='', type=argparse.FileType('r'), default = '-') parser.add_argument('-c',...
crf1111/Bio-Informatics-Learning
Bio-StrongHold/src/Local_Alignment_with_Affine_Gap_Penalty.py
from Bio import SeqIO from Bio.SubsMat.MatrixInfo import blosum62 def local_alignment_affine_gap_penalty(v, w, scoring_matrix, sigma, epsilon): ''' Returns the score and local alignment substrings for strings v, w with the given scoring matrix, gap opening penalty sigma, and gap extension penalty epsilon. ...
np-overflow/minecraft-commander
mcpy_simplified/minecraft.py
from connection import Connection from location import Location from processReturnMsg import processReturnMsg import json import requests import sys def create_connection(name, url): global conn, playerName, serverUrl serverUrl = url + "/" + name playerName = name # conn = Connection(name, url) print "Connection...
gillesB/azulejo
azulejo/configuration.py
# This file is part of azulejo # # Author: Pedro and Gilles # # This code takes care of setting up or loading configurations and shortcuts. # The configurations are saved as json files. There is one config file, which contains the path # to the currently selected shortcut file. # The shortcut files contain the shortcut...
rmyers/dtrove
dtrove/tests/test_datastores.py
from django.template import TemplateDoesNotExist from dtrove.datastores.base import BaseManager from dtrove.datastores.mysql import MySQLManager from .base import * class BaseDatastoreTests(DtroveTest): def setUp(self): self.datastore = create_datastore() self.instance = create_instance() ...
yeleman/snisi
snisi_trachoma/migrations/0002_auto_20140905_1608.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('snisi_trachoma', '0001_initial'), ] operations = [ migrations.AlterField( model_name='aggttbacklogmissionr', ...
openkamer/openkamer
document/migrations/0050_remove_dossier_is_active.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-10-26 20:17 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('document', '0049_document_types'), ] operations = [ migrations.RemoveField( ...
wavycloud/pyboto3
pyboto3/dynamodbstreams.py
''' The MIT License (MIT) Copyright (c) 2016 WavyCloud 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, p...
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_11_01/operations/_azure_firewalls_operations.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
viniciuschiele/flask-webapi
flask_webapi/permissions.py
""" Provides a set of classes for authorization. """ from abc import ABCMeta, abstractmethod from flask import request class Permission(metaclass=ABCMeta): """ A base class from which all permission classes should inherit. """ @abstractmethod def has_permission(self): """ Returns...
viniciusd/DCO1008---Digital-Signal-Processing
projeto2/common.py
import numpy as np from scipy import fftpack class Fft: def __init__(self, x, *, sample_rate=None, padded=False): if sample_rate is None: raise ValueError('You must determine the sample rate') fs = sample_rate if padded: padding_to = int(2**np.ceil(np.log2(len(x))...
concentricsky/django-sky-ckeditor
ckeditor/helpers.py
import jingo import jinja2 from django.contrib.contenttypes.models import ContentType import re ImageUploadClass = None try: from skycms.structure.models import ImageUpload ImageUploadClass = ImageUpload except ImportError: pass @jingo.register.function def object_url(content_type_id, id): try: ...
xuru/pyvisdk
pyvisdk/do/vm_das_update_error_event.py
import logging from pyvisdk.exceptions import InvalidArgumentError ######################################## # Automatically generated, do not edit. ######################################## log = logging.getLogger(__name__) def VmDasUpdateErrorEvent(vim, *args, **kwargs): '''The event records that an error occur...
joelcan/tools-eth-contract-dev
pyethereum/pyethereum/_version.py
""" Version management with versioneer https://github.com/warner/python-versioneer Distribution through PyPI 1: git tag 0.6.31 2: python setup.py register sdist upload Distributiuon through github (i.e. users use github to generate tarballs with git archive) 1: git tag 0.6.31 2: git push; git push -...
cz-fish/ants
main.py
#!/usr/bin/env python from Player import * from Cards import * from Game import * import random import sys def print_card(card, verbose): str = card[C_NAME] + " (" if verbose: str += "costs " if card[C_COST][0]: str += "%d bricks " % card[C_COST][0] if card[C_COST][1]: str += "%d arms " % card[C_COST][1] if ...
DailyActie/Surrogate-Model
01-codes/tensorflow-master/tensorflow/python/ops/clip_ops.py
# Copyright 2015 Google Inc. All Rights Reserved. # # 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 a...
dezounet/datadez
setup.py
#!/usr/bin/env python from setuptools import setup setup( name="datadez", version="0.1.dev", description="Inspect, filter and balance your dataset", keywords=["dataset", "inspect", "filter", "balance"], author="dezounet", maintainer="dezounet", author_email="dezonthenet@gmail.com", lic...
benjiboi214/mmpl-wagtail
site/venues/utilities.py
import os from django.conf import settings from venues.services import get_gmaps_image def get_and_write_image(photo_reference, name): '''Given a photo reference and filepath for the image, get data from gmaps and write the file to the media directory for eventual storage in django model. Return the file ...
phalgun/sharq
tests/test_queue.py
# -*- coding: utf-8 -*- # Copyright (c) 2014 Plivo Team. See LICENSE.txt for details. import os import unittest from datetime import date from sharq import SharQ from sharq.exceptions import BadArgumentException class SharQTest(unittest.TestCase): """ The SharQTest contains test cases which validate the SharQ...
interactiveinstitute/watthappened
python_modules/couchdbkit/schema/properties.py
# -*- coding: utf-8 - # # This file is part of couchdbkit released under the MIT license. # See the NOTICE for more information. """ properties used by Document object """ import decimal import datetime import re import time try: from collections import MutableSet, Iterable def is_iterable(c): retur...
diego-d5000/MisValesMd
env/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/setuptools/package_index.py
"""PyPI and direct package downloading""" import sys, os.path, re, urlparse, urllib, urllib2, shutil, random, socket, cStringIO import httplib from pkg_resources import * from distutils import log from distutils.errors import DistutilsError try: from hashlib import md5 except ImportError: from md5 impo...
JRMeyer/Autotrace
under-development/analysis/neutralSubtraction.py
import csv import sys, math import pylab as p from numpy import * from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm class NeutralSubtraction(): def __init__(self, contours, neutral): '''center points determined by transforming the point (426, 393) several times with peterotron...
edublancas/titanic
pipeline/old_prepare_for_training.py
import pandas as pd df = pd.read_csv('data/combined_with_features.csv', index_col='id') #Convert sex to binary variable df.sex = df.sex.map({'male':0, 'female':1}) #df.drop('sex', axis=1, inplace=True) #df.drop('p_class', axis=1, inplace=True) #Name dummies name_dummies = pd.get_dummies(df.name, prefix='name').asty...
piyanatk/sim
scripts/fg1p/cal_mc_stats_mp.py
import os import argparse import multiprocessing import itertools from datetime import datetime import xarray as xr from scipy.stats import moment def get_stats(obs_dataarray): noise_var = obs_dataarray['noise_var'].values obs_arr = obs_dataarray['obs'].stack(s=['y', 'x']).values m2_biased = moment(obs_a...
benitesf/Skin-Lesion-Analysis-Towards-Melanoma-Detection
features_extraction/methods/second_feature_extraction.py
import numpy as np from skimage.color import rgb2gray, rgb2hsv, rgb2lab, rgb2luv from scipy.stats import skew from sklearn.metrics.cluster import entropy import time def features(img, kernels): """ Implements a function to calculate the feature extraction from a block of image Parameters ---------- ...
wchuanghard/CS110-Python_Programming
p2_part1/regression-in.py
__author__ = 'williamchuang' import sys print("Please use something like: $ python3 regression-in.py labdata.txt") if len(sys.argv) != 2: print("Incorrect command line arguments, please use something like:") print("$ python3 regression-in.py labdata.txt") sys.exit(1) filename = sys.argv[1] # get the argumen...
Azure/azure-sdk-for-python
sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_source_control_configuration_client_enums.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
markEarvin/password-tracker
ferris/tests/test_edge_caching.py
from ferrisnose import AppEngineWebTest from ferris.core.controller import Controller, route from ferris.components import edge_cache class Cachable(Controller): class Meta: components = (edge_cache.EdgeCache,) @route def public(self): self.components.edge_cache('public') return '...
dreid/edn
edn/_ast.py
"""Abstract syntax for edn. Roughly speaking, every edn element gets its own terml symbol. Thus, an edn stream consisting of a vector of two strings, e.g.:: ["foo" "bar"] Will be mapped to:: Vector((String(u'foo'), String(u'bar'))) Beyond that:: #foo 42 <=> TaggedValue(Symbol('foo'), 42) :my/keyword <=> ...
Stocastico/AI_MOOC
Exercises/Exercise_2/src/playerAI_3.py
from random import randint from BaseAI_3 import BaseAI import time score_map = {0:0, 2:1, 4:2, 8:3, 16:4, 32:5, 64:6, 128:7, 256:8, 512:9, 1024:10, 2048:100, 4096:...
Azure/azure-sdk-for-python
sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/aio/operations/_web_application_firewall_policies_operations.py
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
vervacity/ggr-project
scripts/upload_zenodo.py
import os import sys import json import requests def _upload_file( filename, full_path_filename, bucket_url, params): """ we pass the file object (fp) directly to the request as the data to be uploaded the target URL is a combination of the buckets link with the desired filena...
Darrel12/FFAudX
prop.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'properties.ui' # # Created by: PyQt5 UI code generator 5.5.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObje...
yarox24/binent
binent.py
#!/usr/bin/env python import argparse import math import os import platform import sys try: import numpy except: print "Numpy library not installed. To fix this: " print "pip install numpy" sys.exit(-2) VERSION = "0.3 (beta)" PROJECT_SITE = "https://github.com/yarox24/binent" # PARSER def entropy_float(...
tavendo/AutobahnPython
autobahn/twisted/wamp.py
############################################################################### # # The MIT License (MIT) # # Copyright (c) Crossbar.io Technologies GmbH # # 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 ...
FeatherCoin/Feathercoin
test/functional/rpc_txoutproof.py
#!/usr/bin/env python3 # Copyright (c) 2014-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test gettxoutproof and verifytxoutproof RPCs.""" from test_framework.messages import CMerkleBlock, Fro...
phoenixding/scdiff
scdiff/KF2.py
#/usr/bin/env python #----------------------------------------------------------------------- # author: import random import numpy as np #======================================================================= # Kalman Filter implementation # Implements a linear Kalman filter. class KalmanFilterLinear: def __in...
mattjmorrison/django-webflow
src/example/templatetags/webflow.py
from django import template from django.core.urlresolvers import reverse register = template.Library() @register.simple_tag def webflow_step_url(step_name): return reverse('webflow_step', kwargs={'step_name':step_name}) @register.tag(name="webflow_management") def webflow_management(parser, token): return Web...
GregoryShen/Flaskk
config.py
import os basedir = os.path.abspath(os.path.dirname(__file__)) class Config: SECRET_KEY = os.environ.get('SECRET_KEY') or "\xb3\xce\xb5\x97(\xa1\xd6\xb3`6\xb9\xf5v\xacy\x8a\x86\x1do\\\xf4\xe7T" SQLALCHEMY_COMMIT_ON_TEARDOWN = True SSL_DISABLE = False SQLALCHEMY_RECORD_QUERIES = True BABEL_DEFAULT_...
tobynance/simple_mud
test/test_training_handler.py
import unittest import os os.environ["SIMPLE_MUD_LOAD_PLAYERS"] = "false" from logon_handler import LogonHandler from player import PlayerDatabase, Player import training_handler from training_handler import TrainingHandler from test_utils import MockProtocol, stats_message ##########################################...
okfnepal/election-nepal
electionNepal/urls.py
from __future__ import unicode_literals from landing.views import dataset_preview from landing.views import data_filter from django.conf.urls import include, url from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.views.i18n import set_language from mezzanine.core.views import ...
ccpgames/eve-metrics
web2py/setup_app.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This is a setup.py script generated by py2applet Usage: python setup.py py2app """ copy_apps = False copy_scripts = True copy_site_packages = True remove_build_files = True make_zip = True zip_filename = "web2py_osx" from setuptools import setup...
stevearc/python-pike
git_hooks/hook.py
#!/usr/bin/env python # GENERATED BY devbox==0.1.0-93-gf9f448f """ Run selected checks on the current git index This file was carefully constructed to have no dependencies on other files in the ``devbox`` package. This allows it to be embedded directly in a project instead of requiring devbox to be installed. """ imp...
shawnohare/image-classifier
main.py
from __future__ import print_function import numpy as np import mahotas as mh import itertools from glob import glob from mahotas.features import surf from sklearn import cross_validation from sklearn.linear_model.logistic import LogisticRegression from sklearn.externals import joblib # for load/dumping classifiers fro...
coinapi/coinapi-sdk
oeml-sdk/python/test/test_order_execution_report_all_of.py
""" OEML - REST API This section will provide necessary information about the `CoinAPI OEML REST API` protocol. <br/> This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> <br/><br/> Implemented Standards: * [HTT...
bdfoster/blumate
blumate/components/lock/demo.py
""" Demo lock platform that has two fake locks. For more details about this platform, please refer to the documentation https://home-assistant.io/components/demo/ """ from blumate.components.lock import LockDevice from blumate.const import STATE_LOCKED, STATE_UNLOCKED # pylint: disable=unused-argument def setup_plat...
yunjey/pytorch-tutorial
tutorials/03-advanced/image_captioning/build_vocab.py
import nltk import pickle import argparse from collections import Counter from pycocotools.coco import COCO class Vocabulary(object): """Simple vocabulary wrapper.""" def __init__(self): self.word2idx = {} self.idx2word = {} self.idx = 0 def add_word(self, word): if not wo...
dbischof90/sdetools
simulation/strong/explicit/rk.py
from simulation.scheme import Scheme class Order_10(Scheme): def __init__(self, sde, parameter, steps, **kwargs): super().__init__(sde, parameter, steps, **kwargs) def propagation(self, x, t): drift = self.drift(x, t) diffusion = self.diffusion(x, t) dW = self.dW[-1] ...
msbmsb/markov_brain
test_markov_brain.py
#!/usr/bin/env python """ test_markov_brain.py Script to test the markov_brain.Brain class. Author: Mitchell Bowden <mitchellbowden AT gmail DOT com> Version: 0.1 License: MIT License: http://creativecommons.org/licenses/MIT/ Last Changed: 08 Sep 2010 URL: http://github.com/msbmsb/markov_bra...
daniel20162016/my-first
read_xml_all/calcul_matrix_je_le_qui_dans_de_192_matrix_good_compare_1.py
# -*- coding: utf-8 -*- """ Created on Mon Oct 31 15:45:22 2016 @author: wang """ #from matplotlib import pylab as plt #from numpy import fft, fromstring, int16, linspace #import wave from read_wav_xml_good_1 import* from matrix_24_2 import* from max_matrix_norm import* import numpy as np # open a wave file filename...
mrGeen/eden
static/scripts/tools/build.sahana.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # # run as: # python web2py.py -S eden -M -R applications/eden/static/scripts/tools/build.sahana.py # or # python web2py.py -S eden -M -R applications/eden/static/scripts/tools/build.sahana.py -A gis # # # Built with code/inspiration from MapFish, OpenLayers & Michael C...
drulutz/expup
expup.py
#=============================================================# # # # EL EXPRESO DEL DEPORTE # # ExpUp - Image Uploader # #-------------------------------------------------------------# ...
pugpe/FizzBuzz
fizzbuzz_test.py
# -*- encoding:utf-8 -*- import unittest import doctest from fizzbuzz import FizzBuzz from pprint import pprint as pp class FizzBuzzTest(unittest.TestCase): def testTres(self): self.assertEqual(FizzBuzz(3), 'Fizz') def testCinco(self): self.assertEqual(FizzBuzz(5), 'Buzz') def testSeis(self): self.assertEqu...
arruda/git-stats-all
git_stats_all.py
# -*- coding: utf-8 -*- import os import subprocess import click GIT_STATS_PROJECTS_PATH = os.environ.get('GIT_STATS_PROJECTS_PATH', None) def which(program): """ Return full path to exec if it exist in PATH, or else return None """ def is_exe(fpath): return os.path.isfile(fpath) and os.acc...
numberoverzero/finder
__init__.py
from flask import Flask from finder.util import set_root, load_file_config, load_env_config env_vars = [ 'SQLALCHEMY_DATABASE_URI' ] app = Flask(__name__) # Set root folder for loading files set_root(__file__) load_file_config(app.config, '.config') load_env_config(app.config, env_vars, overwrite_null=False) i...
dndtools/docker
prod-v1.0.0/files/local.py
# -*- coding: utf-8 -*- import os import random import string DIRNAME = os.path.dirname(os.path.abspath(__file__)) # Change this to False if you run it in development DEBUG = True TEMPLATE_DEBUG = DEBUG # See https://docs.djangoproject.com/en/1.6/ref/settings/#databases for reference DATABASES = { 'default': { ...
rajujha373/OurNoticeBoardv2.0
notes/migrations/0005_auto_20170725_2323.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-07-25 17:53 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('notes', '0004_auto_20170725_2322'), ] operations = [ migratio...
itdxer/neupy
examples/reinforcement_learning/rl_cartpole.py
import os import random import argparse from collections import deque import gym import numpy as np from neupy import layers, algorithms, utils, storage utils.reproducible() CURRENT_DIR = os.path.abspath(os.path.dirname(__file__)) FILES_DIR = os.path.join(CURRENT_DIR, 'files') CARTPOLE_WEIGHTS = os.path.join(FILES_...
rohitranjan1991/home-assistant
homeassistant/components/shelly/sensor.py
"""Sensor for Shelly.""" from __future__ import annotations from collections.abc import Mapping from dataclasses import dataclass from typing import Final, cast from aioshelly.block_device import Block from homeassistant.components.sensor import ( SensorDeviceClass, SensorEntity, SensorEntityDescription,...
s-tar/project_kate
kernel/file.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import hashlib from bottle import FileUpload from entities.s_file import File from kernel.config import config from kernel.db import Database import os import uuid import shutil __author__ = 'mr.S' root = os.path.dirname(os.path.abspath(os.path.join(__file__,...
donfaq/cnn-rnn
network/model.py
import config import tensorflow as tf import tensorflow.contrib.slim as slim import numpy as np FLAGS = tf.app.flags.FLAGS class Model: def __init__(self, inputs, is_training, keep_prob): self.inputs = inputs self.is_training = is_training self.keep_prob = keep_prob self.logits = ...
dotskapes/dotSkapes
languages/fr.py
# coding: utf8 { '%Y-%m-%d': '%Y-%m-%d', '%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S', 'Cannot be empty': 'Cannot be empty', 'Client IP': 'Client IP', 'Description': 'Description', 'E-mail': 'E-mail', 'First name': 'First name', 'Group ID': 'Group ID', 'Invalid email': 'Invalid email', 'Last name': 'Last name', 'Name': 'Na...
truveris/py-mdstat
mdstat/__init__.py
# Copyright 2015-2016, Truveris Inc. All Rights Reserved. from __future__ import absolute_import from .device import parse_device from .utils import group_lines __version__ = "1.0.4" def parse_unused_devices(line): if not line.startswith("unused devices: "): raise ValueError("invalid unused device lin...
CrankOne/castlib
setup.py
# Copyright (c) 2016 Renat R. Dusaev <crank@qcrypt.org> # Author: Renat R. Dusaev <crank@qcrypt.org> # # 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 ...
bourneagain/pythonBytes
topNinFolder.py
import sys import glob import os import subprocess from collections import defaultdict,Counter #import Counter def topn(dir): file_list=[] # for file_name,dir_name,path_nath in os.walk(dir): # print path_nath top=defaultdict(lambda :0) cmd="find "+dir+" -type f" p=subprocess.Popen(cmd,stdout=subprocess.PIPE,std...
mockingbird2/EPIC-ness
flask_app/database_connection.py
from credentials_hana import db_HOST, db_PORT, db_USER, db_PASSWORD import pyhdb class DatabaseConnection: def __init__(self, queryName): self.path = queryName self._connector = None def __str__(self): return str(self.path) def __eq__(self, name): if type(name) == str: return self.__str__ == name els...
rays/ipodderx-core
BitTorrent/Connecter.py
# The contents of this file are subject to the BitTorrent Open Source License # Version 1.1 (the License). You may not copy or use this file, in either # source code or executable form, except in compliance with the License. You # may obtain a copy of the License at http://www.bittorrent.com/license/. # # Software di...
lukius/mts
common/attacks/tools/timeleak.py
import SimpleHTTPServer import SocketServer import threading import time import urlparse from common.tools.converters import BytesToHex class TimeLeakingWebServer(object): ADDRESS = '127.0.0.1' PORT = 8080 TIMING_LEAK = 0.015 def __init__(self, message, hmac, timing_leak=None): self...
JarnoRFB/qtpyvis
network/layers/caffe_layers.py
""" See https://github.com/netaz/caffe2any/blob/master/topology.py for some inspiration. """ from . import layers from caffe.proto import caffe_pb2 import google.protobuf.text_format from network.util import remove_batch_dimension, convert_data_format from functools import wraps def channels_last(shape_fn): """Che...
gogogoutham/coinchoose-scraper
scrape.py
""" Core scraper for coinchoose.com. """ import coinchoose from datetime import datetime import logging import os import pg import sys import traceback # Configuration logging.basicConfig( level=logging.INFO, format='%(asctime)s %(levelname)s:%(message)s', datefmt='%m/%d/%Y %I:%M:%S %p') def saveToFile(c...
Azure-Samples/hdinsight-dotnet-python-azure-storage-shared-access-signature
Python/SASToken.py
import time from azure.storage import AccessPolicy from azure.storage.blob import BlockBlobService, ContentSettings, ContainerPermissions from datetime import datetime, timedelta # The name of the new Shared Access policy policy_name = 'readandlistonly' # The Storage Account Name storage_account_name = 'mystore' sto...
jachris/cook
examples/cpp/vscode.py
#!/usr/bin/env python3 """This is a **proof-of-concept** VSCode project generator.""" import json import os import platform import subprocess from collections import defaultdict subprocess.check_call(['cook', '--results']) with open('results.json') as file: content = json.load(file) VSCODE = '.vscode' PROPS = ...
kjoenth/nicecast-trackupdate
plugins/NicecastTarget.py
# Copyright (c) 2010 Sean M. Graham <www.sean-graham.com> # # 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, modif...
dessn/sn-bhm
dessn/framework/bias_test.py
import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm from scipy.optimize import minimize from dessn.framework.simulations.snana import SNANASimulation def investigate_color(sim_names): fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(5, 5)) bins = np.linspace(-4, 4, 100) for ...
tlksio/tlksio
talks/migrations/0003_auto_20170324_1733.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-24 17:33 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('talks', '0002_profile'), ] operations = [ migrations.AddField( ...
jtackaberry/stagehand
stagehand/coffee.py
import os import re import asyncio import logging import hashlib from subprocess import Popen, PIPE from .toolbox.utils import which from .toolbox import tostr, tobytes log = logging.getLogger('stagehand.web.coffee') class CSCompileError(ValueError): pass def cscompile(src, dst=None, is_html=None): if not ...
pddg/exchange_music_server
api.py
from flask import Flask, request, abort, jsonify import json import hashlib from datetime import datetime from session import Session import models app = Flask(__name__) app.config['JSON_AS_ASCII'] = False def create_user_response(user_data): return jsonify({ "id": user_data.id, "name": user_dat...
notagoat/Ebooker
scraper.py
#!/usr/bin/env python import tweepy, time, re, sys import apiconfig t = open('Tweets.txt', 'w') #Default file name def limithandler(cursor): #Handles limits and pagination while True: try: yield cursor.next() except tweepy.RateLimitError: print("Limit hit. Sleeping") ...
Robbie1977/TGscripts
warpSignalToTemplatePreserveWarp.py
import os, re, shutil, subprocess, datetime, socket cmtkdir = '/disk/data/VFBTools/cmtk/bin/' Tfile = '/disk/data/VFB/IMAGE_DATA/Janelia2012/TG/template/flyVNCtemplate.nrrd' outdir = '/disk/data/VFB/IMAGE_DATA/Janelia2012/TG/logs/' fo = open("FLsigWarp.txt",'r') filelist = fo.readlines() fo.close() ...
aholkner/bacon
scripts/bin2cpp.py
import argparse import os.path import zlib def encode_data(data): lines = [] for i in range(0, len(data), 16): bytes = data[i:i+16] line = ' ' + ', '.join(hex(ord(byte)) for byte in bytes) + ',\n' lines.append(line) return ''.join(lines) def create_header(name): return '''//...
AdaptivePELE/AdaptivePELE
AdaptivePELE/freeEnergies/oldScripts/dg/firstSnapshots.py
import glob import os import argparse import numpy as np def parseArguments(): desc = "Copies first n steps of trajectories in data folder to current folder" parser = argparse.ArgumentParser(description=desc) parser.add_argument("-s", "--steps", type=int, help="Number of steps") #Not ready for bootstra...