repo_name
stringlengths
5
104
path
stringlengths
4
248
content
stringlengths
102
99.9k
kvar/ansible
lib/ansible/modules/network/fortios/fortios_system_replacemsg_traffic_quota.py
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, Inc. # # 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 3 of the Lic...
andrius-preimantas/purchase-workflow
purchase_order_force_number/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2013 Agile Business Group sagl # (<http://www.agilebg.com>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public ...
dragorosson/heat
heat/db/sqlalchemy/migrate_repo/versions/064_raw_template_predecessor.py
# # 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 # ...
charris/numpy
numpy/lib/mixins.py
"""Mixin classes for custom array types that don't inherit from ndarray.""" from numpy.core import umath as um __all__ = ['NDArrayOperatorsMixin'] def _disables_array_ufunc(obj): """True when __array_ufunc__ is set to None.""" try: return obj.__array_ufunc__ is None except AttributeError: ...
thaim/ansible
lib/ansible/modules/cloud/google/gcp_resourcemanager_project.py
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2017 Google # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** # ...
infilect/ml-course1
week4/attention_ocr/python/datasets/unittest_utils.py
# Copyright 2017 The TensorFlow Authors 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 applicab...
emersonsoftware/ansiblefork
lib/ansible/galaxy/role.py
######################################################################## # # (C) 2015, Brian Coca <bcoca@ansible.com> # # This file is part of Ansible # # Ansible 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...
likelyzhao/mxnet
example/speech-demo/io_func/feat_readers/common.py
import numpy import os class ByteOrder: LittleEndian, BigEndian = range(2) class FeatureException(Exception): def __init__(self,msg): self.msg = msg def __str__(self): return repr(self.msg) def ReadLabel(filename): labels = numpy.loadtxt(filename, ndmin=1) return labels.astype(numpy.int32) class BaseRea...
OpenUpgrade-dev/OpenUpgrade
addons/fleet/migrations/8.0.0.1/post_migration.py
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2014 Akretion # (<http://www.akretion.com>). # # This program is free software: you can redistribute it and/or modify # it unde...
Tesora/tesora-tempest
tempest/api/compute/test_extensions.py
# Copyright 2012 OpenStack Foundation # 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 requ...
orvi2014/kitsune
kitsune/kbadge/tasks.py
from django.conf import settings from django.contrib.sites.models import Site from celery import task from tower import ugettext as _ from kitsune.sumo.decorators import timeit from kitsune.sumo import email_utils @task() @timeit def send_award_notification(award): """Sends the award notification email :ar...
inclement/kivy
kivy/uix/behaviors/button.py
''' Button Behavior =============== The :class:`~kivy.uix.behaviors.button.ButtonBehavior` `mixin <https://en.wikipedia.org/wiki/Mixin>`_ class provides :class:`~kivy.uix.button.Button` behavior. You can combine this class with other widgets, such as an :class:`~kivy.uix.image.Image`, to provide alternative buttons th...
keen99/SickRage
tornado/test/gen_test.py
from __future__ import absolute_import, division, print_function, with_statement import contextlib import datetime import functools import sys import textwrap import time import platform import weakref from tornado.concurrent import return_future, Future from tornado.escape import url_escape from tornado.httpclient i...
rdo-management/neutron
neutron/openstack/common/eventlet_backdoor.py
# Copyright (c) 2012 OpenStack Foundation. # Administrator of the National Aeronautics and Space Administration. # 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 a...
moreati/numpy
runtests.py
#!/usr/bin/env python """ runtests.py [OPTIONS] [-- ARGS] Run tests, building the project first. Examples:: $ python runtests.py $ python runtests.py -s {SAMPLE_SUBMODULE} $ python runtests.py -t {SAMPLE_TEST} $ python runtests.py --ipython $ python runtests.py --python somescript.py $ python...
Slezhuk/ansible
lib/ansible/modules/network/nxos/nxos_vpc_interface.py
#!/usr/bin/python # # This file is part of Ansible # # Ansible 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 later version. # # Ansible is distribut...
infinity0/obfsproxy
obfsproxy/network/buffer.py
class Buffer(object): """ A Buffer is a simple FIFO buffer. You write() stuff to it, and you read() them back. You can also peek() or drain() data. """ def __init__(self, data=''): """ Initialize a buffer with 'data'. """ self.buffer = bytes(data) def read(self,...
Ormod/Diamond
src/diamond/handler/archive.py
# coding=utf-8 """ Write the collected stats to a locally stored log file. Rotate the log file every night and remove after 7 days. """ from Handler import Handler import logging import logging.handlers class ArchiveHandler(Handler): """ Implements the Handler abstract class, archiving data to a log file ...
waseem18/oh-mainline
vendor/packages/Django/tests/regressiontests/servers/tests.py
# -*- encoding: utf-8 -*- """ Tests for django.core.servers. """ from __future__ import unicode_literals import os import socket try: from urllib.request import urlopen, HTTPError except ImportError: # Python 2 from urllib2 import urlopen, HTTPError from django.core.exceptions import ImproperlyConfigured ...
AlericInglewood/3p-google-breakpad
src/tools/gyp/pylib/gyp/generator/scons.py
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import gyp import gyp.common import gyp.SCons as SCons import os.path import pprint import re # TODO: remove when we delete the last WriteList() call in this mo...
adamwwt/chvac
venv/lib/python2.7/site-packages/sqlalchemy/events.py
# sqlalchemy/events.py # Copyright (C) 2005-2015 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """Core event interfaces.""" from . import event, exc from .pool import Pool f...
eharney/nova
nova/api/openstack/compute/views/limits.py
# Copyright 2010-2011 OpenStack Foundation # 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...
calamityman/ansible-modules-extras
network/openvswitch_bridge.py
#!/usr/bin/python #coding: utf-8 -*- # (c) 2013, David Stygstra <david.stygstra@gmail.com> # # Portions copyright @ 2015 VMware, Inc. # # This file is part of Ansible # # This module is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Fre...
tokyo-jesus/university
src/python/koans/python3/runner/path_to_enlightenment.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # The path to enlightenment starts with the following: import unittest from koans.about_asserts import AboutAsserts from koans.about_strings import AboutStrings from koans.about_none import AboutNone from koans.about_lists import AboutLists from koans.about_list_assignme...
arjunsinghy96/coala
tests/core/CircularDependencyErrorTest.py
import unittest from coalib.core.CircularDependencyError import CircularDependencyError class CircularDependencyErrorTest(unittest.TestCase): def test_default_message(self): with self.assertRaises(CircularDependencyError) as cm: # test the default case (names is None) raise Circu...
Shrews/PyGerrit
webapp/django/test/testcases.py
import re import unittest from urlparse import urlsplit, urlunsplit from xml.dom.minidom import parseString, Node from django.conf import settings from django.core import mail from django.core.management import call_command from django.core.urlresolvers import clear_url_caches from django.db import transaction from dj...
tsdmgz/ansible
lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py
#!/usr/bin/python # coding: utf-8 -*- # (c) 2017, Wayne Witzel III <wayne@riotousliving.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1...
Microvellum/Fluid-Designer
win64-vc/2.78/python/lib/imp.py
"""This module provides the components needed to build your own __import__ function. Undocumented functions are obsolete. In most cases it is preferred you consider using the importlib module's functionality over this module. """ # (Probably) need to stay in _imp from _imp import (lock_held, acquire_lock, release_lo...
hsaputra/tensorflow
tensorflow/python/keras/_impl/keras/layers/embeddings_test.py
# Copyright 2016 The TensorFlow Authors. 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 applica...
mycodeday/crm-platform
payment_ogone/models/ogone.py
# -*- coding: utf-'8' "-*-" from hashlib import sha1 import logging from lxml import etree, objectify from pprint import pformat import time from urllib import urlencode import urllib2 import urlparse from openerp.addons.payment.models.payment_acquirer import ValidationError from openerp.addons.payment_ogone.controll...
e-gob/plataforma-kioscos-autoatencion
scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/windows/win_msg.py
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, Jon Hawkesworth (@jhawkesworth) <figs@unity.demon.co.uk> # # This file is part of Ansible # # Ansible 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, eith...
esplinr/foodcheck
wsgi/foodcheck_proj/south/tests/__init__.py
from __future__ import print_function #import unittest import os import sys from functools import wraps from django.conf import settings from south.hacks import hacks # Make sure skipping tests is available. try: # easiest and best is unittest included in Django>=1.3 from django.utils import unittest except I...
amrdraz/brython
www/src/Lib/encodings/mac_arabic.py
""" Python Character Mapping Codec generated from 'VENDORS/APPLE/ARABIC.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_map) def decode(self,input,errors='st...
WillGuan105/django
tests/gis_tests/relatedapp/tests.py
from __future__ import unicode_literals from django.contrib.gis.db.models import F, Collect, Count, Extent, Union from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.geos import GEOSGeometry, MultiPoint, Point from django.db import connection from django.test import TestCase, skipUnlessDBF...
jose36/plugin.video.live.ProyectoLuzDigital-
servers/adfly.py
# -*- coding: utf-8 -*- #------------------------------------------------------------ # pelisalacarta - XBMC Plugin # Conector para adfly (acortador de url) # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ #------------------------------------------------------------ import urlparse,urllib2,urllib,re import os...
diegoguimaraes/django
tests/reserved_names/models.py
""" 18. Using SQL reserved names Need to use a reserved SQL name as a column name or table name? Need to include a hyphen in a column or table name? No problem. Django quotes names appropriately behind the scenes, so your database won't complain about reserved-name usage. """ from django.db import models from django....
837468220/python-for-android
python3-alpha/python3-src/Lib/test/test_codecs.py
from test import support import unittest import codecs import locale import sys, _testcapi, io class Queue(object): """ queue: write bytes at one end, read bytes from the other end """ def __init__(self, buffer): self._buffer = buffer def write(self, chars): self._buffer += chars ...
nuclearsandwich/autokey
src/lib/qtui/dialogs.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2011 Chris Dekter # # 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 3 of the License, or # (at your option) any late...
AKFourSeven/antoinekougblenou
old/wiki/includes/zhtable/Makefile.py
#!/usr/bin/python # -*- coding: utf-8 -*- # @author Philip import tarfile as tf import zipfile as zf import os, re, shutil, sys, platform pyversion = platform.python_version() islinux = platform.system().lower() == 'linux' if pyversion[:3] in ['2.6', '2.7']: import urllib as urllib_request import codecs o...
snehasi/servo
tests/wpt/web-platform-tests/referrer-policy/generic/subresource/subresource.py
import os, sys, json, urlparse, urllib def get_template(template_basename): script_directory = os.path.dirname(os.path.abspath(__file__)) template_directory = os.path.abspath(os.path.join(script_directory, "..", ...
ysung-pivotal/incubator-hawq
tools/bin/gppylib/pgconf.py
#!/usr/bin/env python # $Id: $ """ postgresql.conf configuration file reader Module contents: readfile() - Read postgresql.conf file class gucdict - Container for postgresql.conf settings class setting - Holds one setting class ConfigurationError - a subclass of EnvironmentError Example: import li...
kristerhedfors/xnet
xnet/packages/urllib3/request.py
# urllib3/request.py # Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt) # # This module is part of urllib3 and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php try: from urllib.parse import urlencode except ImportError: from urllib import urlencod...
912/M-new
virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/creation.py
from django.conf import settings from django.db.backends.postgresql_psycopg2.creation import DatabaseCreation from django.utils.functional import cached_property class PostGISCreation(DatabaseCreation): geom_index_type = 'GIST' geom_index_ops = 'GIST_GEOMETRY_OPS' geom_index_ops_nd = 'GIST_GEOMETRY_OPS_ND...
redhat-cip/horizon
openstack_dashboard/dashboards/admin/defaults/urls.py
# Copyright 2013 Kylin, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
YakindanEgitim/EN-LinuxClipper
thrift/transport/TZlibTransport.py
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
nmercier/linux-cross-gcc
win32/bin/Lib/email/errors.py
# Copyright (C) 2001-2006 Python Software Foundation # Author: Barry Warsaw # Contact: email-sig@python.org """email package exception classes.""" class MessageError(Exception): """Base class for errors in the email package.""" class MessageParseError(MessageError): """Base class for message...
camradal/ansible
lib/ansible/module_utils/lxd.py
# -*- coding: utf-8 -*- # (c) 2016, Hiroaki Nakamura <hnakamur@gmail.com> # # This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to th...
ramcn/demo3
venv/lib/python3.4/site-packages/rest_framework/authtoken/south_migrations/0001_initial.py
# -*- coding: utf-8 -*- from south.db import db from south.v2 import SchemaMigration try: from django.contrib.auth import get_user_model except ImportError: # django < 1.5 from django.contrib.auth.models import User else: User = get_user_model() class Migration(SchemaMigration): def forwards(self, ...
ychen820/microblog
y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/contrib/sessions/backends/cached_db.py
""" Cached, database-backed sessions. """ from django.conf import settings from django.contrib.sessions.backends.db import SessionStore as DBStore from django.core.cache import cache KEY_PREFIX = "django.contrib.sessions.cached_db" class SessionStore(DBStore): """ Implements cached, database backed sessions...
e-gob/plataforma-kioscos-autoatencion
scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/plugins/action/netconf_config.py
# # Copyright 2016 Peter Sprygada <psprygada@ansible.com> # # This file is part of Ansible # # Ansible 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...
fharenheit/template-spark-app
src/main/python/ml/sql_transformer.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
friend0/tower
tower/server/server.py
""" The server module is responsible for managng the threaded UDP socket server. This server is used to communicate with Matlab/Simulink simulations. It will be renamed appropriately soon @todo: rename this module to indicate it's role in any Matlab connections """ from __future__ import absolute_import, division, pr...
maartenq/pcrunner
tests/test_configuration.py
# tests/test_configuration.py # vim: ai et ts=4 sw=4 sts=4 ft=python fileencoding=utf-8 from io import StringIO from pcrunner.configuration import ( read_check_commands, read_check_commands_txt, read_check_commands_yaml, ) def test_read_check_commmands_txt_with_extra_lines(): fd = StringIO( ...
lorian1333/netcopy
netcopy.py
#!/usr/bin/env python #Protocol: # num_files:uint(4) # repeat num_files times: # filename:string # size:uint(8) # data:bytes(size) import sys, socket import os from time import time DEFAULT_PORT = 52423 PROGRESSBAR_WIDTH = 50 BUFSIZE = 1024*1024 CONNECTION_TIMEOUT = 3.0 RECEIVE_TIMEOUT = 5.0 if os.name == "nt...
leejz/meta-omics-scripts
query_ncbi_lineage_from_mgrast_md5.py
#!/usr/bin/env python """ -------------------------------------------------------------------------------- Created: Jackson Lee 11/4/14 This script reads in a tab delimited file of annotations and queries asynchronously the MGRAST REST API to parse back the original ncbi tax_id entry. This script then uses the ncb...
posborne/mlcollection
mlcollection/lib/collaborativefiltering/pearson.py
"""Implementation of Pearson collaborative filtering algorithm""" from math import sqrt, pow from mlcollection.lib.collaborativefiltering.collaborativefilterbase import \ AbstractCollaborativeFilter from operator import itemgetter from scipy import stats, isnan __author__ = 'Paul Osborne <osbpau@gmail.com>' class...
grantstephens/pyluno
setup.py
from setuptools import setup, find_packages with open('pyluno/meta.py') as f: exec(f.read()) setup( name='pyluno', version=__version__, packages=find_packages(exclude=['tests']), description='A Luno API for Python', author='Cayle Sharrock/Grant Stephens', author_email='grant@stephens.co.za'...
underlost/GamerNews
gamernews/apps/news/fields.py
import re from django.db.models import fields from django.template.defaultfilters import slugify def _unique_slugify(instance, value, slug_field_name='slug', queryset=None, slug_separator='-'): slug_field = instance._meta.get_field(slug_field_name) slug_len = slug_field.max_length # Sort out the initial s...
TheDSCPL/SSRE_2017-2018_group8
Projeto/Python/cryptopy/crypto/keyedHash/hmacHash.py
# -*- coding: utf-8 -*- """ hmacHash.py Implemention of Request for Comments: 2104 HMAC: Keyed-Hashing for Message Authentication HMAC is a mechanism for message authentication using cryptographic hash functions. HMAC can be used with any iterative cryptographic hash function, e.g., MD5, SHA-1, i...
koxudaxi/BacklogPy
tests/backlog/test_base.py
from __future__ import absolute_import import six if six.PY3: from unittest import TestCase, mock else: import sys if sys.version_info < (2, 7, 0): from unittest2 import TestCase else: from unittest import TestCase import mock from BacklogPy.base import BacklogBase class TestBa...
msabramo/pycobertura
tests/test_cobertura.py
import mock import lxml.etree as ET from .utils import make_cobertura def test_parse_path(): from pycobertura import Cobertura xml_path = 'foo.xml' with mock.patch('pycobertura.cobertura.os.path.exists', return_value=True): with mock.patch('pycobertura.cobertura.ET.parse') as mock_parse: ...
RyanEggert/space-lander
rocket_control/printvals.py
import time from usb_vendor import PIC_USB import traceback # Product IDs: Master PIC is 0x0004, Rocket PIC is 0x0005, Barge PIC is 0x0006 comms = PIC_USB(0x0005) def main(): print("START") loop_time = .2 # How often to run the main loop, in seconds while True: start_time = time.clock() # ...
gingi99/research_dr
python/FPgrowth/orange_fpgrowth.py
# coding: utf-8 # python 3.5 import Orange from orangecontrib.associate.fpgrowth import * import pandas as pd import numpy as np import sys import os from collections import defaultdict from itertools import chain from itertools import combinations from itertools import compress from itertools import product from sklea...
chriskuech/wavelab
pitchanalysis.py
#!/usr/bin/env python """ pitchanalysis.py -- Christopher Kuech cjkuech@gmail.com -- Requires: Python 2.7 Instructions: python pitchanalysis.py [wav-file-name] """ import matplotlib from math import log matplotlib.use("TkAgg") from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib.fig...
mohikhsan/px-labeler
px-labeler/pxgui/ui_pxmarkerdialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'pxmarkerdialog.ui' # # Created by: PyQt5 UI code generator 5.8.1 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_PxMarkerDialog(object): def setupUi(self, PxMarkerDialog): ...
wnavarre/email-dictator
web/run_on.py
import sys import os import files.io from StringIO import StringIO from constants import * added_path = os.path.join(os.path.dirname(os.path.abspath(os.path.dirname(__file__))), "script") sys.path.append(added_path) import script import mess sys.path.pop() def full_file(pointer): pointer.seek(0) return pointe...
zegra1989/pytree
rtree.py
# -*- coding:utf-8 -*- # 使用 UTF-8 import sys reload(sys) sys.setdefaultencoding("utf-8") import sys from heap import Heap class Rectangle(object): """docstring for Rectangle""" def __init__(self, dimension, entry=None): super(Rectangle, self).__init__() self.dimension = dimension se...
DeppSRL/open_bilanci
bilanci_project/bilanci/settings/staging.py
"""Production settings and globals.""" from base import * ########## HOST CONFIGURATION # See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production MAIN_HOST = ['openbilanci.staging.deppsviluppo.org',] # Allowed hosts expansion: needed for servizi ai Comuni HOSTS_COMUNI = [ 'novar...
chuck1/web_sheets
old/web_sheets_django/manage.py
#!/usr/bin/env python3 import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web_sheets_django.settings.local") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason....
angelsanz/linkstore
linkstore/links.py
import os from os import path import sqlite3 from .link import Link class Links(object): def __init__(self): self._links = {} def add(self, link): self._links[link.url] = link def find_by_tag(self, tag): return [link for link in self._links.values() if tag in link.tags] def...
sigma-geosistemas/django-tenants
dts_test_project/dts_test_project/settings.py
""" Django settings for dts_test_project project. For more information on this file, see https://docs.djangoproject.com/en/1.6/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.6/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR...
kyon-bll/.dotfiles
.emacs.d/elpa/jedi-core-20191011.1750/jediepcserver.py
#!/usr/bin/env python """ Jedi EPC server. Copyright (C) 2012 Takafumi Arakaki Author: Takafumi Arakaki <aka.tkf at gmail.com> This file is NOT part of GNU Emacs. Jedi EPC server 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 So...
frascoweb/frasco
frasco/angular/__init__.py
from frasco.ext import * from frasco.assets import expose_package, register_assets_builder from frasco.utils import join_url_rule from flask import render_template import os import json import re import htmlmin import codecs class FrascoAngular(Extension): name = "frasco_angular" defaults = {"static_dir": Non...
econne01/flask_blog
app/app.py
""" Configuration for Flask app """ import os import urllib from flask import (Flask, abort, flash, Response) from playhouse.flask_utils import FlaskDB ADMIN_PASSWORD = 'secret' APP_DIR = os.path.dirname(os.path.realpath(__file__)) DATABASE = 'sqliteext:///%s' % os.path.join(APP_DIR, 'blog.db') DEBUG = False SECRET_...
daveinnyc/various
python-practice/class_demos.py
# Notes on classes class Sample(): def __init__(self, name, number): self.name = name self.number = number def print_values(self): print(f"name: {self.name}") print(f"number: {self.number}") class SampleWithProperties(): def __init__(self, name, number)...
thelazier/dash
contrib/devtools/security-check.py
#!/usr/bin/env python3 # Copyright (c) 2015-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Perform basic ELF security checks on a series of executables. Exit status will be 0 if successful, and...
guillon/mdi
examples/mini/scripts/generate_executions.py
#!/usr/bin/env python # # Machine Description Interface C API # # This software is delivered under the terms of the MIT License # # Copyright (c) 2016 STMicroelectronics # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation # files (the "Softwar...
shtalinberg/django-actions-logger
actionslog/settings.py
# """Django Actions Log settings file.""" # from __future__ import unicode_literals from django.conf import settings from django.utils.translation import ugettext_lazy as _ CREATE = 100 SUCCESS = 110 ACTIVATE = 130 AUTH = 150 VIEW = 180 UPDATE = 200 SUSPEND = 250 UNSUSPEND = 260 DELETE = 300 TERMINATE = 500 FAILED =...
pygeo/pycmbs
pycmbs/tests/test_icon.py
# -*- coding: utf-8 -*- """ This file is part of pyCMBS. (c) 2012- Alexander Loew For COPYING and LICENSE details, please refer to the LICENSE file """ import unittest from pycmbs.icon import Icon class TestPycmbsIcon(unittest.TestCase): def setUp(self): # requires local installation of ICON sample files...
tlake/advent-of-code
2016/day07_internet_protocol_version_7/python/src/part2.py
#!/usr/bin/env python """Docstring.""" import re from functools import reduce from collections import Counter from common import get_input class SSLTester: """.""" def __init__(self, input_list=[]): """Initialize.""" self.input_list = input_list def find_aba(self, seq): """Retu...
rahulg/eulerswift
setup.py
import sys import EulerPy try: from setuptools import setup except ImportError: from distutils.core import setup def readme(): with open('README.rst') as f: return f.read() def requirements(): install_requires = [] with open('requirements.txt') as f: for line in f: ins...
pythonkr/pyconkr-2014
pyconkr/forms.py
from django import forms from django.utils.translation import ugettext_lazy as _ from django_summernote.widgets import SummernoteInplaceWidget from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from .models import Speaker, Program class EmailLoginForm(forms.Form): email = forms.Emai...
mandrive/FlaskTest
__init__.py
import logging from logging.handlers import RotatingFileHandler from flask import Flask, render_template from flask_login import LoginManager from flask_restful import Api from flask_wtf.csrf import CsrfProtect from itsdangerous import URLSafeTimedSerializer from sqlalchemy import create_engine import AppConfig from R...
vetlehjelmtvedt/TranscriptApp
sttClient.py
# # Copyright IBM Corp. 2014 # # 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, soft...
luisalves05/shortener-url
src/apps/miudo/views.py
import uuid from random import randint from django.shortcuts import render from django.http import HttpResponseRedirect from .models import Url def index(request): if request.session.has_key("has_url"): url = request.session.get("has_url") del request.session['has_url'] return render(req...
plusplus7/EasyMemo2
server.py
import tornado.web import tornado.ioloop import os from handlers import * urls = [ (r'/', IndexHandler), (r'/api/(?P<action>[a-zA-Z0-9-_]+)', ApiServiceHandler), (r'/about', AboutHandler), ] settings = { "static_path" : os.path.join(os.path.dirname(__file__), "static"), "template_path" : os...
APSL/kaneda
kaneda/queues/rq.py
from __future__ import absolute_import import logging try: from redis import Redis from rq import Queue except ImportError: Redis = None Queue = None from kaneda.exceptions import ImproperlyConfigured from .base import BaseQueue class RQQueue(BaseQueue): """ RQ queue :param queue: que...
the-blue-alliance/the-blue-alliance
src/backend/api/main.py
from json import JSONDecodeError from flask import Blueprint, Flask, make_response, Response from flask_cors import CORS from google.appengine.api import wrap_wsgi_app from werkzeug.routing import BaseConverter from backend.api.handlers.district import ( district_events, district_list_year, district_ranki...
gmjosack/modlunky
setup.py
#!/usr/bin/env python from distutils.core import setup execfile('modlunky/version.py') with open('requirements.txt') as requirements: required = requirements.read().splitlines() kwargs = { "name": "modlunky", "version": str(__version__), "packages": ["modlunky"], "scripts": ["bin/modlunky"], ...
grantjenks/pyannote-core
pyannote/core/__init__.py
#!/usr/bin/env python # encoding: utf-8 # The MIT License (MIT) # Copyright (c) 2014 CNRS # 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 ...
ellisdg/3DUnetCNN
unet3d/utils/normalize.py
import numpy as np def zero_mean_normalize_image_data(data, axis=(0, 1, 2)): return np.divide(data - data.mean(axis=axis), data.std(axis=axis)) def foreground_zero_mean_normalize_image_data(data, channel_dim=4, background_value=0, tolerance=1e-5): data = np.copy(data) if data.ndim == channel_dim or data...
timrchavez/capomastro
projects/templatetags/projects_tags.py
from django.template.base import Library from django.core.urlresolvers import reverse from projects.models import ProjectBuild register = Library() @register.simple_tag() def build_url(build_id): """ Fetches the ProjectBuild for a given build_id, if any. """ try: build = ProjectBuild.object...
walidsa3d/shaman
shaman/providers/api.py
from allocine import allocine from constants import * from elcinema import elcinema from imdb import imdby as Imdb from rotten import rotten from tmdb import tmdb def search(query, site): if site == "imdb": provider = Imdb() elif site == "elcinema": provider = elcinema() elif site == "rott...
nicoddemus/pytest
src/_pytest/logging.py
"""Access and control log capturing.""" import logging import os import re import sys from contextlib import contextmanager from io import StringIO from pathlib import Path from typing import AbstractSet from typing import Dict from typing import Generator from typing import List from typing import Mapping from typing ...
sarojaerabelli/HVGS
CareerTinderServer/CareerTinder/migrations/0005_auto_20160918_0221.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-18 06:21 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('CareerTinder', '0004_auto_20160918_0152'), ] operations = [ migrations.RenameField(...
mic4ael/indico
indico/util/passwords.py
# This file is part of Indico. # Copyright (C) 2002 - 2020 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 __future__ import unicode_literals import bcrypt class BCryptPassword(object): def __init__(se...
bsiegfreid/tkdraw
tkdraw/config.py
import os from appdirs import AppDirs class Config: def __init__(self): self.app_dir = get_app_dir() def save_geometry(self, window): path = os.path.join(self.app_dir, 'geometry.conf') print(path) with open(path, "w") as conf: conf.write(window.geometry()) de...
thonkify/thonkify
src/lib/sparkpost/tornado/base.py
import json from tornado import gen from tornado.httpclient import AsyncHTTPClient, HTTPError from .exceptions import SparkPostAPIException class TornadoTransport(object): @gen.coroutine def request(self, method, uri, headers, **kwargs): if "data" in kwargs: kwargs["body"] = kwargs.pop("d...
injectnique/KnuckleHeadedMcSpazatron
GenericBytecode.py
#!C:\Python27\python.exe # Filename: GenericBytecode.py # -*- coding: utf-8 -*- import os import Settings ''' Generic Bytecode Simply add, remove or modify bytecode for use in KHMS ''' createFrame = ['aload_0', 'getfield', 'aload_0', 'dup', 'getfield', 'dup_x1', 'iconst_1', 'iadd', 'putfield', 'il...
simonz05/activity-feed
tests/test_utility.py
# -*- coding: utf-8 -*- import unittest from activity_feed import ActivityFeed class UtilityTest(unittest.TestCase): def test_key(self): 'should return the correct key for the non-aggregate feed' a = ActivityFeed() self.assertEquals(a.feed_key('david'), 'activity_feed:david') def tes...