code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python3
# 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 "Lic... | arenadata/bigtop | bigtop-packages/src/charm/zeppelin/layer-zeppelin/tests/03-zeppelin-spark-smoke.py | Python | apache-2.0 | 2,344 |
# Copyright 2011 Isaku Yamahata
# 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 b... | cyx1231st/nova | nova/tests/unit/test_block_device.py | Python | apache-2.0 | 29,345 |
from __future__ import unicode_literals
import copy
import inspect
import warnings
from itertools import chain
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.exceptions import (
NON_FIELD_ERRORS, FieldDoesNotExist, FieldError, MultipleObjectsReturned,... | alexmorozov/django | django/db/models/base.py | Python | bsd-3-clause | 70,943 |
from ctypes import *
import unittest
import struct
def valid_ranges(*types):
# given a sequence of numeric types, collect their _type_
# attribute, which is a single format character compatible with
# the struct module, use the struct module to calculate the
# minimum and maximum value allowed for this... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/ctypes/test/test_numbers.py | Python | gpl-2.0 | 9,308 |
#!/usr/bin/env python
# Copyright (c) 2009 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 sys
# [[ Gyp customisation ]] Make sure we don't pull in a system Gyp
import os.path
sys.path.insert(0, os.path.join(os.path.dirname... | PaulMcClernan/livecode | gyp/gyp_main.py | Python | gpl-3.0 | 414 |
# -*- coding: utf-8 -*-
# Copyright 2016 Jairo Llopis <jairo.llopis@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, SUPERUSER_ID
def post_init_hook(cr, registry):
"""Loaded after installing the module.
``ir.exports.line.name`` was before a char field, a... | ddico/server-tools | base_export_manager/hooks.py | Python | agpl-3.0 | 716 |
from __future__ import absolute_import
from django.contrib.auth.models import UserManager
from django.utils import timezone
from zerver.models import UserProfile, Recipient, Subscription, Realm, Stream
import base64
import ujson
import os
import string
from six.moves import range
from typing import Optional, Text
de... | sonali0901/zulip | zerver/lib/create_user.py | Python | apache-2.0 | 3,540 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-Message',
'Author': ['@harmj0y'],
'Description': ("Displays a specified message to the user."),
'Background' : True,
'OutputE... | EmpireProject/Empire | lib/modules/powershell/trollsploit/message.py | Python | bsd-3-clause | 3,349 |
""" A simple graph class """
from __future__ import division, print_function, absolute_import
class Graph(object):
''' A simple graph class
'''
def __init__(self):
''' A graph class with nodes and edges :-)
This class allows us to:
1. find the shortest path
2. find all ... | StongeEtienne/dipy | dipy/core/graph.py | Python | bsd-3-clause | 3,517 |
import time
def main(request, response):
time.sleep(float(request.GET.first(b"delay", 1000)) / 1000)
response.headers.set('Content-Type', 'text/css')
return "/* */"
| chromium/chromium | third_party/blink/web_tests/external/wpt/resource-timing/resources/delay-css.py | Python | bsd-3-clause | 178 |
# -*- coding: utf-8 -*-
#
# SelfTest/Cipher/DES.py: Self-test for the (Single) DES cipher
#
# Written in 2008 by Dwayne C. Litzenberger <dlitz@dlitz.net>
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedicat... | cipicip/appengine | test_crypto/Crypto/SelfTest/Cipher/test_DES.py | Python | apache-2.0 | 13,626 |
import json
from wal_e.blobstore import s3
from wal_e.storage.base import BackupInfo
class S3BackupInfo(BackupInfo):
def load_detail(self, conn):
if self._details_loaded:
return
uri = "{scheme}://{bucket}/{path}".format(
scheme=self.layout.scheme,
bucket=self... | x86Labs/wal-e | wal_e/storage/s3_storage.py | Python | bsd-3-clause | 567 |
import sys
def setup(core, object):
object.setStringAttribute('armor_category', '@obj_attr_n:armor_battle')
return | agry/NGECore2 | scripts/object/tangible/wearables/armor/infiltrator/armor_infiltrator_s01_gloves.py | Python | lgpl-3.0 | 118 |
# -*- coding: utf-8 -*-
# License AGPL-3: Antiun Ingenieria S.L. - Javier Iniesta
# See README.rst file on addon root folder for more details
from openerp.tests.common import TransactionCase
from openerp.exceptions import ValidationError
class TestIrExportsLineCase(TransactionCase):
def setUp(self):
sup... | MackZxh/OCA-Choice | server-tools/base_export_manager/tests/test_ir_exports_line.py | Python | lgpl-3.0 | 1,621 |
# Copyright (c) 2012 - 2015 EMC Corporation.
# 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
#
# Unle... | nikesh-mahalka/cinder | cinder/volume/drivers/emc/emc_vmax_masking.py | Python | apache-2.0 | 106,960 |
import time
import os
from django.test import TestCase
from ..lockfile import FileLock, FileLocked
def setup_fake_lock(lock_file_name):
pid = os.getpid()
lockfile = '%s.lock' % pid
try:
os.remove(lock_file_name)
except OSError:
pass
os.symlink(lockfile, lock_file_name)
class Lo... | saukrIppl/seahub | thirdpart/django_post_office-2.0.6-py2.7.egg/post_office/tests/test_lockfile.py | Python | apache-2.0 | 1,943 |
#!/usr/bin/env python
#
# Copyright 2010,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your opt... | n4hy/gnuradio | gr-digital/examples/narrowband/benchmark_add_channel.py | Python | gpl-3.0 | 4,184 |
"""
Unit tests for stem.response.
"""
__all__ = [
'control_message',
'control_line',
'events',
'getinfo',
'getconf',
'protocolinfo',
'authchallenge',
'singleline',
]
| tparks5/tor-stem | test/unit/response/__init__.py | Python | lgpl-3.0 | 183 |
# -*- coding: utf-8 -*-
import socket
import fcntl
import struct
import argparse
# http://stackoverflow.com/questions/159137/getting-mac-address
def get_mac_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15]))
retu... | wangybgit/Chameleon | wifidog-1.2.1/contrib/load-tester/common.py | Python | apache-2.0 | 1,508 |
# -*- coding: utf-8 -*-
import re
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.safestring import mark_safe
from crispy_forms.compatibility import string_types
from crispy_forms.layout import Layout
from crispy_forms.layout_slice import LayoutSlice
from crispy_forms.utils import rende... | kronicz/ecommerce-2 | lib/python2.7/site-packages/crispy_forms/helper.py | Python | mit | 14,012 |
# Copyright 2015 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... | dhalleine/tensorflow | tensorflow/contrib/quantization/python/array_ops.py | Python | apache-2.0 | 1,197 |
from __future__ import absolute_import, division, print_function
from blaze.utils import example
from odo.backends.json import JSON, JSONLines
from odo import Chunks
from blaze import symbol, discover, compute, into, resource
js = JSON(example('accounts.json'))
jss = JSONLines(example('accounts-streaming.json'))
s ... | ChinaQuants/blaze | blaze/compute/tests/test_json.py | Python | bsd-3-clause | 725 |
from django.apps import AppConfig
class ReportsConfig(AppConfig):
name = 'reports'
| BirkbeckCTP/janeway | src/reports/apps.py | Python | agpl-3.0 | 89 |
import csv
import shutil
import datetime
ORIGINAL = "rec-center-hourly.csv"
BACKUP = "rec-center-hourly-backup.csv"
DATE_FORMAT = "%m/%d/%y %H:%M"
def isTuesday(date):
return date.weekday() is 1
def withinOctober(date):
return datetime.datetime(2010, 10, 1) <= date < datetime.datetime(2010, 11, 1)
def run(... | badlogicmanpreet/nupic | examples/opf/clients/hotgym/anomaly/one_gym/remove_tuesdays.py | Python | agpl-3.0 | 1,039 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016 F5 Networks Inc.
#
# 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
# ... | adityacs/ansible | lib/ansible/modules/network/f5/bigip_selfip.py | Python | gpl-3.0 | 21,456 |
#!/usr/bin/env python
"""
numpyfilter.py INPUTFILE
Interpret C comments as ReStructuredText, and replace them by the HTML output.
Also, add Doxygen /** and /**< syntax automatically where appropriate.
"""
import sys
import re
import os
import textwrap
import optparse
import cPickle as pickle
CACHE_FILE = 'build/rst-... | numpy/datetime | doc/cdoc/numpyfilter.py | Python | bsd-3-clause | 2,858 |
# detect how many bits of precision the floating point implementation has
try:
float
except NameError:
print(0)
else:
if float("1.0000001") == float("1.0"):
print(30)
elif float("1e300") == float("inf"):
print(32)
else:
print(64)
| kerneltask/micropython | tests/feature_check/float.py | Python | mit | 275 |
# -*- coding: utf-8 -*-
import associate
import numpy as np
import matplotlib.pyplot as plt
import yaml
def loadDataset(filename):
file = open(filename)
data = file.read()
lines = data.replace(","," ").replace("\t"," ").split("\n")
D = np.array([[v.strip() for v in line.split(" ") if v.strip()!=""] for line i... | worxli/svo | svo_analysis/src/svo_analysis/analyse_dataset.py | Python | gpl-3.0 | 1,178 |
# -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Configuración
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
from core import downloadtools
from core import config
from cor... | Zanzibar82/pelisalacarta | python/main-classic/core/configuracion.py | Python | gpl-3.0 | 492 |
from ..slidesets import FileSet, INLSetInterface
##
# A basic class for reading Remark markdown files directly
class INLFileSet(FileSet, INLSetInterface):
##
# Valid parameters for the FileSet object
@staticmethod
def validParams():
params = FileSet.validParams()
params += INLSetInterface.validParams(... | danielru/moose | python/PresentationBuilder/slidesets/INLFileSet.py | Python | lgpl-2.1 | 502 |
from bokeh.plotting import figure, show, output_file
p = figure(plot_width=300, plot_height=300)
p.circle([1,2], [3,4])
# configure visual properties on a plot's title attribute
p.title.text = "Title With Options"
p.title.align = "right"
p.title.text_color = "orange"
p.title.text_font_size = "25px"
p.title.background... | phobson/bokeh | sphinx/source/docs/user_guide/source_examples/plotting_title_visuals.py | Python | bsd-3-clause | 380 |
# Ansible module to manage CheckPoint Firewall (c) 2019
#
# 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 dist... | kvar/ansible | test/units/modules/network/check_point/test_cp_mgmt_address_range.py | Python | gpl-3.0 | 4,059 |
# pylint: disable=R0903
"""
Simple test case for an annoying behavior in pylint.
"""
__revision__ = 'pouet'
class Test(object):
"""Smallest test case for reported issue."""
def __init__(self):
self._thing = None
@property
def myattr(self):
"""Getter for myattr"""
return self.... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/pylint/test/input/func_noerror_property_affectation_py26.py | Python | apache-2.0 | 461 |
"""
Provides a binary sensor which gets its values from a TCP socket.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.tcp/
"""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.component... | MungoRae/home-assistant | homeassistant/components/binary_sensor/tcp.py | Python | apache-2.0 | 941 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class ReportStockRule(models.AbstractModel):
_inherit = 'report.stock.report_stock_rule'
@api.model
def _get_rule_loc(self, rule, product_id):
""" We override this meth... | t3dev/odoo | addons/mrp/report/report_stock_rule.py | Python | gpl-3.0 | 599 |
import os, shutil, string, glob
from sphinx.util.compat import Directive
from docutils import nodes
from docutils.parsers.rst import directives
from IPython.nbconvert import html, python
from runipy.notebook_runner import NotebookRunner
class NotebookDirective(Directive):
"""Insert an evaluated notebook into a doc... | zclfly/cgt | doc/notebook_sphinxext1.py | Python | mit | 6,346 |
"""Collection of mapreduce jobs."""
import logging
from mapreduce import operation as op
from codereview.models import Account, Issue
def delete_unused_accounts(account):
"""Delete accounts for uses that don't participate in any reviews."""
email = account.user.email()
if Issue.query(Issue.owner_email == email... | v3ss0n/rietveld | admin_tasks.py | Python | apache-2.0 | 932 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack Foundation
# Copyright 2011 Canonical Ltd.
# 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... | zestrada/nova-cs498cc | nova/api/openstack/compute/contrib/flavorextradata.py | Python | apache-2.0 | 3,507 |
#!/usr/bin/env python
# ex:ts=4:sw=4:sts=4:et
# Opie recipe checksum rewriter
#
# A crude script for rewriting recipes to contain checksum information
#
# Some portions copied from oe-source-checker.py, copyright (C) 2007 OpenedHand
import os
import sys
def rewrite(recpfilename, sourcedir):
insrc = False
srcfirst ... | xifengchuo/openembedded | contrib/opie/opie_checksum_rewrite.py | Python | mit | 2,820 |
#!/usr/bin/python
#
# (c) 2018 Extreme Networks Inc.
#
# 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 late... | alexlo03/ansible | lib/ansible/modules/network/exos/exos_facts.py | Python | gpl-3.0 | 13,983 |
# Copyright(C) 2014 by Abe developers.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is dist... | gfneto/bitcoin-abe | build/lib.linux-x86_64-2.7/Abe/Chain/PpcPosChain.py | Python | agpl-3.0 | 1,130 |
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.linalg import LinAlgError
from .blas import get_blas_funcs
from .lapack import get_lapack_funcs
__all__ = ['LinAlgError', 'norm']
def norm(a, ord=None):
"""
Matrix or vector norm.
This function is able to ret... | ales-erjavec/scipy | scipy/linalg/misc.py | Python | bsd-3-clause | 4,362 |
import esccmd
from esctypes import Point
from escutil import AssertEQ, GetCursorPosition, knownBug
class CHTTests(object):
@knownBug(terminal="iTerm2", reason="iTerm2 doesn't support CHT")
def test_CHT_OneTabStopByDefault(self):
esccmd.CHT()
position = GetCursorPosition()
AssertEQ(position.x(), 9)
@... | mzp/iTerm2 | tests/esctest/tests/cht.py | Python | gpl-2.0 | 1,268 |
from flask import Flask
from flask_admin import Admin
from flask_mongoengine import MongoEngine
def setup():
app = Flask(__name__)
app.config['SECRET_KEY'] = '1'
app.config['CSRF_ENABLED'] = False
app.config['MONGODB_SETTINGS'] = {'DB': 'tests'}
db = MongoEngine()
db.init_app(app)
admin ... | irvingpop/digital-beer-menu | src/lib/flask_admin/tests/mongoengine/__init__.py | Python | gpl-2.0 | 360 |
import os as _os
__path__.append(_os.path.join(__path__[0], '..', '..', 'gen', 'ortools', 'graph'))
__path__.append(_os.path.join(__path__[0], '..', '..', '..', 'lib'))
| capturePointer/or-tools | src/ortools/graph/__init__.py | Python | apache-2.0 | 169 |
'''
Report tool
===========
This tool is a helper for users. It can be used to dump information
for help during the debugging process.
'''
import os
import sys
import time
from time import ctime
from configparser import ConfigParser
from io import StringIO
import kivy
report = []
report_dict = {} # One key value ... | BillBillBillBill/Tickeys-linux | tickeys/kivy_32/kivy/tools/report.py | Python | mit | 5,821 |
from django.conf import settings
try:
from PIL import Image
dir(Image) # Placate PyFlakes
except ImportError:
import Image
AVATAR_DEFAULT_SIZE = getattr(settings, 'AVATAR_DEFAULT_SIZE', 80)
AUTO_GENERATE_AVATAR_SIZES = getattr(settings, 'AUTO_GENERATE_AVATAR_SIZES', (AVATAR_DEFAULT_SIZE,))
AVATAR_RESIZE_M... | zackster/HipHopGoblin | hhg/avatar/settings.py | Python | bsd-3-clause | 1,294 |
import sys
if sys.version_info < (3, 7):
from ._z import ZValidator
from ._y import YValidator
from ._x import XValidator
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._z.ZValidator", "._y.YValidator", "._x.XVali... | plotly/python-api | packages/python/plotly/plotly/validators/volume/slices/__init__.py | Python | mit | 334 |
#!/usr/bin/env python
import os
import re
import json
import traceback
from subprocess import call
from Utils.WAAgentUtil import waagent
import Utils.HandlerUtil as Util
from azure.storage import BlobService
from azure.storage import TableService
call("mkdir -p ./bosh", shell=True)
call("chmod +x deploy_bosh.sh", shel... | blockapps/azure-quickstart-templates | concourse-ci/setup_devbox.py | Python | mit | 3,101 |
#! python
#
# simple LDAP server browsing example
#
import ldap
import string
from traceback import print_exc
url = "ldap://ldap.openldap.org/"
dn = "dc=openldap,dc=org"
print "Connecting to", url
l = ldap.initialize(url)
l.bind_s("", "", ldap.AUTH_SIMPLE);
lastdn = dn
dnlist = None
while 1:
#-- read a comm... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/core/ext-py/python-ldap-2.3.13/Demo/simplebrowse.py | Python | gpl-2.0 | 3,177 |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
# Copyright (C) 2004,2005,2006 4tphi Research
#
# Authors:
# {npetroni,awalters}@4tphi.net (Nick Petroni and AAron Walters)
# Michael Cohen <scudette@users.sourceforge.net>
# Mike Auty <mike.auty@gmail.com>
#
# This file is part of Volatility.
#
# Volatility ... | newyork167/volatility | volatility/plugins/addrspaces/standard.py | Python | gpl-2.0 | 5,313 |
#!/usr/bin/env python
#
# Copyright 2011-2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your optio... | EttusResearch/gnuradio | gr-digital/python/digital/qa_mpsk_snr_est.py | Python | gpl-3.0 | 4,077 |
import copy
import inspect
from importlib import import_module
from django.db import router
from django.db.models.query import QuerySet
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
def ensure_default_manager(cls):
"""
Ensures that a Model subclass contains a defa... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/django/db/models/manager.py | Python | agpl-3.0 | 10,800 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/slim/python/slim/nets/resnet_v2_test.py | Python | apache-2.0 | 18,547 |
# Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""Abstract class for RC4."""
class RC4(object):
def __init__(self, keyBytes, implementation):
if len(keyBytes) < 16 or len(keyBytes) > 256:
raise ValueError()
self.isBlockCipher = False
... | ioef/tlslite-ng | tlslite/utils/rc4.py | Python | lgpl-2.1 | 561 |
#!/usr/bin/python
import re
section = re.compile('^(Name|Name Strings?|Contact|Notice|Number|Dependencies|Overview|Issues|IP Status|Status|Version|New Procedures and Functions|New Tokens|Additions to .*|Changes to .*|Modifications to .*|Add new Section .*)\s*$')
token = re.compile('^\s+(([A-Z0-9][A-Z0-9_x]*):?\s+((... | Merg3D/Titan-Designer | thirdparty/glew-2.0.0/auto/bin/filter_spec.py | Python | gpl-3.0 | 1,271 |
# 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 ... | ido-ran/ran-smart-frame2 | web/server/lib/oauth2client/contrib/django_util/signals.py | Python | mit | 1,050 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/contrib/tensor_forest/python/kernel_tests/best_splits_op_test.py | Python | apache-2.0 | 4,532 |
#! /usr/bin/env python3
import sys
from os.path import abspath, expanduser, dirname, join
from itertools import chain
import json
import argparse
from vis import vis, unvis, VIS_WHITE
__dir__ = dirname(abspath(__file__))
OUTPUT_FILE = join(__dir__, '..', 'fixtures', 'unvis_fixtures.json')
# Add custom fixtures her... | shaunstanislaus/invoice | workspace/augmify_invoice/vendor/psy/psysh/test/tools/gen_unvis_fixtures.py | Python | gpl-2.0 | 3,123 |
# lex_ignore2.py
#
# ignore declaration as a raw string
import sys
if ".." not in sys.path: sys.path.insert(0,"..")
import ply.lex as lex
tokens = [
"PLUS",
"MINUS",
"NUMBER",
]
t_PLUS = r'\+'
t_MINUS = r'-'
t_NUMBER = r'\d+'
t_ignore = r' \t'
def t_error(t):
pass
lex.lex()
| dpac-vlsi/SynchroTrace | util/ext/ply/test/lex_ignore2.py | Python | bsd-3-clause | 306 |
from django.db.models.aggregates import StdDev
from django.db.utils import ProgrammingError
from django.utils.functional import cached_property
class BaseDatabaseFeatures(object):
gis_enabled = False
allows_group_by_pk = False
allows_group_by_selected_pks = False
empty_fetchmany_value = []
update_... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/db/backends/base/features.py | Python | artistic-2.0 | 9,883 |
"""
Steam profile/account reading and ID resolution
Copyright (c) 2010-2013, Anthony Garcia <anthony@lagg.me>
Distributed under the ISC License (see LICENSE)
"""
import time
import os
from . import api
class ProfileError(api.APIError):
pass
class ProfileNotFoundError(ProfileError):
pass
class VanityError... | miedzinski/steamodd | steam/user.py | Python | isc | 11,498 |
"""DHCPv4 Stateless clients"""
# pylint: disable=invalid-name,line-too-long
import pytest
import srv_control
import srv_msg
import misc
@pytest.mark.v4
@pytest.mark.stateless
def test_v4_stateless_with_subnet_empty_pool():
misc.test_setup()
srv_control.config_srv_subnet('192.168.50.0/24', '$(EMPTY)')
s... | isc-projects/forge | tests/dhcpv4/process/test_v4_stateless.py | Python | isc | 1,369 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Setup script.
Uses setuptools.
Long description is a concatenation of README.rst and CHANGELOG.rst.
"""
from __future__ import absolute_import, print_function
import io
import re
from glob import glob
from os.path import basename, dirname, join, splitext
from set... | Pawamoy/django-meerkat | setup.py | Python | isc | 2,512 |
'''@file lda_jer.py
contains the LdaJerLoss'''
import tensorflow as tf
import loss_computer
from nabu.neuralnetworks.components import ops
class Dist2MeanRatFracBinsLoss(loss_computer.LossComputer):
'''A loss computer that calculates the loss'''
def __call__(self, targets, logits, seq_length):
'''
... | JeroenZegers/Nabu-MSSS | nabu/neuralnetworks/loss_computers/dist2mean_rat_fracbins_loss.py | Python | mit | 1,254 |
#from django.db import models
from django.contrib.gis.db import models
from django.contrib.auth.models import AbstractUser
from django.contrib.gis.geos import GEOSGeometry
from players import models as PlayerModels
# Create your models here.
class Arena(models.Model):
title = models.CharField(max_length=255)
... | ThrowsException/CLeagueHero | arenas/models.py | Python | mit | 1,877 |
"""
Commands for dealing with command scripts.
"""
import qq
import os
class EditCommand(qq.QQCommand):
"""
Command for editing the file containing a command.
"""
name = 'cmd.edit'
shorttext = 'Edit a command'
def execute(self, command_name):
try:
inst = qq.instantiate_c... | qqtools/qqtools | cmd/cmd.py | Python | mit | 988 |
from datetime import datetime
from weighttracker import db
class Exercisejournal(db.Document):
motivation_levels = (('---', '---'),
('Not in the mood', 'Not in the mood'),
('Tired', 'Tired'),
('Average', 'Average'),
... | rdempsey/weight-tracker | models/exercisejournal.py | Python | mit | 1,456 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "livehousemap.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| takesxi-shimada/livehousemap | livehousemap/manage.py | Python | mit | 255 |
# pylint: disable=function-redefined
import codecs
import string
from enum import Enum
from itertools import accumulate
from typing import Callable, Iterable, List, Optional, Tuple, TypeVar, Union, cast
from prompt_toolkit.application.current import get_app
from prompt_toolkit.buffer import Buffer, indent, reshape_tex... | sserrot/champion_relationships | venv/Lib/site-packages/prompt_toolkit/key_binding/bindings/vi.py | Python | mit | 75,497 |
# classes for git hub authencation for GithubApi class
class GithubAuth(object):
auth_type = None
def __init__(self):
pass
def add_to_session(self, requests_session):
requests_session.auth = None
def __repr__(self):
return "%s(auth_type=%s)" % (self.__class__.__name__,
... | alikins/github-comments | github_comments/github_auth.py | Python | mit | 1,608 |
"""
WSGI config for custom_app_name 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/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJAN... | mozillazg/django-simple-projects | projects/custom_app_name/custom_app_name/wsgi.py | Python | mit | 407 |
import chalk
from autobahn.twisted.websocket import listenWS
from twisted.internet import reactor
from twisted.internet.ssl import PrivateCertificate, DefaultOpenSSLContextFactory
from twisted.protocols.tls import TLSMemoryBIOFactory
from hendrix.facilities.services import HendrixTCPServiceWithTLS
from .base import He... | jMyles/hendrix | hendrix/deploy/tls.py | Python | mit | 4,071 |
# coding=utf-8
# The MIT License (MIT)
# Copyright (c) 2016 mateor
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import sys
from betarepo.algorithms.sorting.insertionsort import insertionsort
from betarepo.algor... | mateor/betarepo | src/python/betarepo/algorithms/sorting/bin/main.py | Python | mit | 911 |
from rest_framework import authentication
from rest_framework import exceptions
from rest_framework import permissions
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from .models import Planet, YellowDwarf
from . import serializers
from drf_ember import generics
from drf... | symfonico/drf-ember | tests/views.py | Python | mit | 4,883 |
import argparse
from django.core.management.base import AppCommand
from django_seed import Seed
from django_seed.exceptions import SeederCommandError
from toposort import toposort_flatten
from collections import defaultdict
class Command(AppCommand):
help = 'Seed your Django database with fake data.'
def add... | Brobin/django-seed | django_seed/management/commands/seed.py | Python | mit | 3,862 |
from django.conf.urls import patterns, url
from viewer import views
urlpatterns = patterns('',
url(r'^$', views.home, name='home'),
url(r'^summary/download$', views.download_summary, name='download_summary'),
url(r'^meter/(?P<id>\d+)/download$', views.download_meter, name='download_meter'),
... | impactlab/jps-handoff | webapp/viewer/urls.py | Python | mit | 715 |
'''
################################## client.py #############################
# This Encoder Client invokes a remote GRPC service to encode and decode
# from a string URL to an integer value back and forth.
################################## client.py #############################
'''
import grpc
import encoder_pb2
c... | rimpybharot/CMPE273 | mid-term/client.py | Python | mit | 1,303 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-04 23:20
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | fcopantoja/sips | sips/subprocuraduria/migrations/0002_auto_20170104_1720.py | Python | mit | 753 |
############################
#
# Please complete this quiz
#
# declare an int variable named total with the value of 0
total = 0
# declare an array named numbers with all numbers 0 - 20
numbers = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
# write a for loop that processes each number
for num in numbers
... | chrisortman/CIS-121 | k0764898/quiz1.py | Python | mit | 709 |
class Attr(object):
def __init__(self, name, value, display_value=None):
if type(name) is not str:
raise Exception("name should be string")
self.name = name
self.value = value
self.display_value = display_value
class Tree(object):
def __init__(self, name, desc):
... | amarghosh/mp4viewer | src/tree.py | Python | mit | 1,137 |
# -*- test-case-name: xquotient.test.test_mimepart -*-
import itertools
import quopri, binascii, rfc822
from zope.interface import implements
from twisted.python import log
from epsilon.extime import Time
from axiom import item, attributes, iaxiom
from xquotient import mimepart, equotient, mimeutil, exmess, iquot... | twisted/quotient | xquotient/mimestorage.py | Python | mit | 24,158 |
from .. import Provider as DateTimeProvider
class Provider(DateTimeProvider):
def day_of_week(self) -> str:
day = self.date("%w")
DAY_NAMES = {
"0": "सोमवार",
"1": "मंगलवार",
"2": "बुधवार",
"3": "गुरुवार",
"4": "जुम्मा",
"5": ... | joke2k/faker | faker/providers/date_time/hi_IN/__init__.py | Python | mit | 1,065 |
#!/usr/bin/python
#
# Filename:
#
# Version: 1.0.0
#
# Author: Joe Gervais (TryCatchHCF)
#
# Summary:
#
# Part of the DumpsterFire Toolset. See documentation at https://github.com/TryCatchHCF/DumpsterFire
#
#
# Description:
#
#
# Example:
#
#
import urllib, time, random
from FireModules.fire_module_base_class impo... | TryCatchHCF/DumpsterFire | FireModules/Websurfing/tinder.py | Python | mit | 1,528 |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
def stringifyPos(position):
return "{0}x{1}".format(position[0],position[1])
with open('day3.dat') as datafile:
alldata = datafile.readline()
currpos = ([0,0], [0,0])
maxx = 0
minx = 0
maxy = 0
miny = 0
activesanta = 0
hits = {}... | jborlik/AdventOfCode2015 | day3.py | Python | mit | 1,773 |
import os
import platform
import subprocess
import uuid
def _call(args):
return subprocess.call(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
def _copy_available(command):
if platform.system() == "Windows":
return _call(["where", command]) == 0
return _call(["which", command]) == 0
def... | oslab-fr/lesspass | cli/lesspass/clipboard.py | Python | mit | 1,377 |
import os
import textwrap
import glob
from os.path import join, curdir, pardir
import pytest
from pip.utils import rmtree
from tests.lib import (pyversion, pyversion_tuple,
_create_test_package, _create_svn_repo, path_to_url)
from tests.lib.local_repos import local_checkout
from tests.lib.pat... | graingert/pip | tests/functional/test_install.py | Python | mit | 23,715 |
# Use a better method to count the cities within 16,000 meters of a volcano,
# because it doesn't double-count stuff.
import ogr
# Open the layers as in listing 7.1 instead of reset reading.
shp_ds = ogr.Open(r'D:\osgeopy-data\US')
volcano_lyr = shp_ds.GetLayer('us_volcanos_albers')
cities_lyr = shp_ds.GetLayer('citi... | cgarrard/osgeopy-code | Chapter7/listing7_2.py | Python | mit | 794 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
# pylint: disable=too-few-public-methods, unnecessary-pass
"""
driloader.commands
------------------
Abstraction for all external command calls.
"""
import subprocess
class CommandError(Exception):
""" Custom exception class for Co... | lucasmello/Driloader | driloader/utils/commands.py | Python | mit | 2,452 |
""" Compares out function with the results of the old
implementation that comes from matplotlib
"""
from __future__ import print_function
from __future__ import division
import matplotlib.pyplot as plt
plt.ioff()
import matplotlib as mpl
from plotting import make_test_data, draw
from hillshade import INTENSITY_... | titusjan/hill_shading | compare_intensity.py | Python | mit | 2,346 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Ver 18 - 15 November 2017 -
import time
import string
import sys
import mysql.connector
from mysql.connector import errorcode, pooling
from db import *
import datetime
#from threading import Thread
import multiprocessing as mp
from multiprocessing import Queue
from multipro... | theflorianmaas/dh | Python/dhproc/p_cmd_in.py | Python | mit | 3,867 |
from Tkinter import *
class Index(object):
def __init__(self):
self.root = Tk()
self.root.title("Multi-Interface Tool")
self.root.geometry("768x512")
self.root.resizable(0, 0)
self.label = Label(self.root, name="holderLabel", text="")
self.label.pack(pady=5)
... | James226/pyMI | UI/GUI/index.py | Python | mit | 766 |
#!/bin/env python
"""
The MIT License
Copyright (c) 2010 The Chicago Tribune & Contributors
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 ... | juddy/beeswithmachineguns | beeswithmachineguns/bees.py | Python | mit | 10,439 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun May 28 17:58:48 2017
@author: moamin
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
file_read = open('pairall_pearson_coefficients.txt', 'r')
pearson = []
p_value = []
count = 0
significant_pairs = []
sa... | ruhulsbu/WEAT4TwitterGroups | Python_Codebase/pearson_correlation_pvalue_histogram.py | Python | mit | 4,624 |
"""
"""
import datetime
import time
def sub_sample_1_1_now():
return datetime.datetime.now()
def sub_sample_1_1_today():
return datetime.date.today()
def sub_sample_1_1_sleep(seconds):
datetime.time.sleep(seconds)
def sub_sample_1_1_time():
return time.time()
| alisaifee/hiro | tests/emulated_modules/sub_module_1/sub_sample_1_1.py | Python | mit | 285 |
from .helper import _create_invoker
from .. import all_content_types
# Mirror traditional version to avoid having to import one more module
from ..routing import (
by_content_type, by_command, by_chat_command, by_text, by_data, by_regex,
process_key, lower_key, upper_key
)
def make_routing_table(obj, keys, pr... | nickoala/telepot | telepot/aio/routing.py | Python | mit | 1,548 |
import os
from boto import connect_s3
from boto.s3.key import Key
import requests
import uuid
# http://stackoverflow.com/a/42493144
def upload_url_to_s3(image_url):
image_res = requests.get(image_url, stream=True)
image = image_res.raw
image_data = image.read()
fname = str(uuid.uuid4())
conn = c... | reneepadgham/diverseui | utils.py | Python | mit | 647 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import fnmatch
from glob import glob
import os
import logging
import plpacker.utils
LOGGER = logging.getLogger(__name__)
class FileSet(object):
# pylint: disable=too-few-public-methods
def __init__(... | digitalrounin/py-lambda-packer | plpacker/fileset.py | Python | mit | 3,518 |
# -*- encoding:utf-8 -*-
from __future__ import unicode_literals
MESSAGES = {
"%d min remaining to read": "zostáva %d minút na čítanie",
"(active)": "",
"Also available in:": "Tiež dostupné v:",
"Archive": "Archív",
"Categories": "Kategórie",
"Comments": "Komentáre",
"LANGUAGE": "Slovenčina... | JohnTroony/nikola | nikola/data/themes/base/messages/messages_sk.py | Python | mit | 1,451 |
import csv
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from openslides.agenda.models import Speaker
from openslides.utils.views import View
class CSVExportView(View):
"""
View to export the lists of speakers of all agenda items as csv.
"""
def get(self, re... | normanjaeckel/openslides-csv-export | openslides_csv_export/views.py | Python | mit | 1,203 |