code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# 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... | keras-team/keras | keras/layers/pooling/average_pooling2d.py | Python | apache-2.0 | 5,314 |
import tty, sys
import curses, datetime, locale
from decimal import Decimal
import getpass
import electrum
from electrum.util import format_satoshis, set_verbosity
from electrum.bitcoin import is_address, COIN, TYPE_ADDRESS
from electrum.transaction import TxOutput
from .. import Wallet, WalletStorage
_ = lambda x:x
... | asfin/electrum | electrum/gui/text.py | Python | mit | 18,184 |
# -*- coding: utf-8 -*-
"""
Evic is a USB programmer for devices based on the Joyetech Evic VTC Mini.
Copyright ยฉ Jussi Timperi
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... | Ban3/python-evic | evic/aprom.py | Python | gpl-3.0 | 3,377 |
import numpy as np
import numba as nb
import matplotlib.pyplot as plt
def calc_ber(e_array):
return np.mean(np.abs(e_array))
# Imitate static variable for a python function using decorate and setattr
def static_vars(**kwargs):
'''
@static_vars(counter=0)
def foo():
foo.counter += 1
pri... | jskDr/jamespy_py3 | wireless/nb_polar_r9.py | Python | mit | 19,618 |
"""
Test lldb data formatter subsystem.
"""
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class NamedSummariesDataFormatterTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp().
TestBase.setUp(se... | endlessm/chromium-browser | third_party/llvm/lldb/test/API/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py | Python | bsd-3-clause | 4,739 |
# 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 req... | rajalokan/glance | glance/tests/unit/base.py | Python | apache-2.0 | 2,727 |
from socket import socket, AF_INET, SOCK_STREAM
connection = socket(AF_INET, SOCK_STREAM)
connection.connect(("127.0.0.1", 9001))
while True:
data = raw_input("Input: ")
if(data == "??q"):
exit(0)
connection.send(data)
| haklabbeograd/descon-2016-badge | examples/TCP/tcpclient.py | Python | mit | 244 |
from __future__ import print_function, division
from itertools import product
from sympy.core.sympify import _sympify, sympify
from sympy.core.basic import Basic
from sympy.core.singleton import Singleton, S
from sympy.core.evalf import EvalfMixin
from sympy.core.numbers import Float
from sympy.core.compatibility imp... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/sets/sets.py | Python | mit | 51,206 |
import collections
import unittest
from zoonado import iterables
class IterablesTests(unittest.TestCase):
def test_drain_on_list(self):
data = ["foo", 1, "bar", 9]
result = list(iterables.drain(data))
self.assertEqual(len(data), 0)
self.assertEqual(result, [9, "bar", 1, "foo"])... | wglass/zoonado | tests/test_iterables.py | Python | apache-2.0 | 1,016 |
from collections import Counter
"""
Given two strings, a & b,
that may or may not be of the same length
determine the minimum number of character deletions required to make
a and b anagrams. Any characters can be deleted from either of the strings.
For example, 'bacdc' and 'dcbac' are anagrams, but 'bacdc' and 'dc... | jackchi/interview-prep | strings/makingAnagrams.py | Python | mit | 1,047 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Get stats about your activity.
Example:
- my_activity.py for stats for the current week (last week on mondays).
- my_activ... | jankeromnes/depot_tools | my_activity.py | Python | bsd-3-clause | 33,215 |
"""An example config::
artifactor:
log_dir: /home/test/workspace/cfme_tests/artiout
per_run: test #test, run, None
reuse_dir: True
squash_exceptions: False
threaded: False
server_address: 127.0.0.1
server_port: 21212
server_enabled: True
plugi... | okolisny/integration_tests | fixtures/artifactor_plugin.py | Python | gpl-2.0 | 9,099 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser 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 distributed in the hope that it will ... | daftano/interactive-tutorials | suds/client.py | Python | apache-2.0 | 25,972 |
import unittest
from test import support
class LongExpText(unittest.TestCase):
def test_longexp(self):
REPS = 65580
l = eval("[" + "2," * REPS + "]")
self.assertEqual(len(l), REPS)
def test_main():
support.run_unittest(LongExpText)
if __name__=="__main__":
test_main()... | Orav/kbengine | kbe/src/lib/python/Lib/test/test_longexp.py | Python | lgpl-3.0 | 322 |
from pysys.constants import *
from pysys.basetest import BaseTest
from pysys.utils.filegrep import filegrep
class XpybuildBaseTest(BaseTest):
def xpybuild(self, args=None, buildfile='test.xpybuild.py', shouldFail=False, stdouterr='xpybuild', env=None, setOutputDir=True, **kwargs):
"""
Runs xpybuild against the sp... | xpybuild/xpybuild | tests/test_framework/xpybuild/xpybuild_basetest.py | Python | apache-2.0 | 4,545 |
#
# Copyright (c) 2008--2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | moio/spacewalk | backend/server/handlers/app/__init__.py | Python | gpl-2.0 | 798 |
"""
Module contains GUI thread and GUI slots
"""
#---------------------------Imports---------------------------------------------
import os
import sys
from PyQt4 import QtGui
from PyQt4.QtCore import QThreadPool
from pyPdf import PdfFileReader
from scanning_qthread.ui.ui.main_UI import Ui_MainWindow
from scanni... | AeroNotix/pdftotif | main.py | Python | bsd-3-clause | 6,017 |
import pytest
import os
from collections import namedtuple
from flask import Flask, jsonify
from flask_influxdb import InfluxDB
App = namedtuple("App", ["ctx", "client"])
influx_db = InfluxDB()
def create_app(config: str) -> Flask:
app = Flask(__name__)
app.config.from_pyfile(config)
influx_db.init_ap... | Ombitron/flask-influxdb | tests/conftest.py | Python | bsd-3-clause | 1,574 |
import appuifw as ui
import globalui
from pytriloquist import Const
from pytriloquist.btclient import BluetoothError
from pytriloquist.gui import Dialog
from pytriloquist.gui.settings import SettingsDialog
from pytriloquist.gui.app import ApplicationsDialog
from pytriloquist.gui.input import InputDialog
cla... | danielfm/pytriloquist | src/client/pytriloquist/gui/main.py | Python | bsd-3-clause | 4,846 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/pdfgen/textobject.py
__version__=''' $Id$ '''
__doc__="""
PDFTextObject is an efficient way to add text to a Canvas. Do not
instantiate directly, obtai... | BackupTheBerlios/pixies-svn | pixies/reportlab/pdfgen/textobject.py | Python | gpl-2.0 | 14,031 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-18 16:17
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('report_ia', '0030_auto_201... | jefke-glider/gliding | ato/report_ia/migrations/0031_auto_20170118_1617.py | Python | mit | 807 |
# Find Element by Point
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
# Create a geometry to mesh
box = geompy.MakeBoxDXDYDZ(100,100,10... | FedoraScientific/salome-smesh | doc/salome/examples/viewing_meshes_ex02.py | Python | lgpl-2.1 | 1,358 |
#
# Copyright 2017 the original author or authors.
#
# 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... | opencord/voltha | voltha/adapters/adtran_onu/adtran_onu.py | Python | apache-2.0 | 11,066 |
#
# ovirt-engine-setup -- ovirt engine setup
# Copyright (C) 2013-2015 Red Hat, 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
#
# Unl... | walteryang47/ovirt-engine | packaging/setup/plugins/ovirt-engine-common/base/dialog/titles.py | Python | apache-2.0 | 2,303 |
descr = """
Odes is a scikit toolkit for scipy to add some extra ode solvers.
At present it provides dae solvers you can use, extending the capabilities
offered in scipy.integrade.ode.
LICENSE: the license of odes is the same as scipy, new BSD.
"""
DISTNAME = 'scikits.odes'
DESCRIPTION = 'A pytho... | logicabrity/odes | common.py | Python | bsd-3-clause | 1,492 |
#* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
import os
im... | harterj/moose | python/mms/runner.py | Python | lgpl-2.1 | 4,868 |
""" Shadow DOM test.
First download files from PyPI.
Then search for them on a multi-layered Shadow DOM page.
This uses the "::shadow" selector for piercing shadow-root elements.
Here's the URL that contains Shadow DOM: chrome://downloads/ """
from seleniumbase import BaseCase
class ShadowDo... | seleniumbase/SeleniumBase | examples/test_shadow_dom.py | Python | mit | 3,463 |
# 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 ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/aio/operations/_virtual_machine_extensions_operations.py | Python | mit | 24,026 |
#!/usr/bin/python -tt
"""O(n+m) (where 'n' is size of text and 'm' is size of search string) time
solution to problem 3-25 from /The Algorithm Design Manual/, 2nd ed., by Steven
Skiena
"""
import sys
def add_to_count(search_string):
"""Counts occurrences of each character in specified string.
Args:
... | mschruf/python | Algorithm_Design_Manual/3-25.py | Python | cc0-1.0 | 1,953 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import copy
import logging
from math import ceil
from flask import jsonify, request
from sqlalchemy.orm.exc import NoResultFound
from flexget.plugins.list.pending_list import ... | qk4l/Flexget | flexget/api/plugins/pending_list.py | Python | mit | 10,970 |
import sys
import json
import logging
import re
# float_pat = re.compile(r'^-?\d+(?:\.\d+)?(e-?\d+)?$')
# charfloat_pat = re.compile(r'^[\[,\,]-?\d+(?:\.\d+)?(e-?\d+)?$')
float_pat = re.compile(r'^-?\d+\.\d+(e-?\d+)?$')
charfloat_pat = re.compile(r'^[\[,\,]-?\d+\.\d+(e-?\d+)?$')
scinot_geom_pat = re.compile(r'^[\[,\,... | whosonfirst/py-mapzen-whosonfirst-geojson | mapzen/whosonfirst/geojson/__init__.py | Python | bsd-3-clause | 5,171 |
"""
Copyright (c) 2018, Arm Limited
SPDX-License-Identifier: Apache-2.0
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... | mbedmicro/mbed | UNITTESTS/unit_test/test.py | Python | apache-2.0 | 6,943 |
#!/usr/bin/env python
import time
from guppi_daq.guppi_utils import *
# Attach to status shared mem
g = guppi_status()
while (1):
try:
g.read()
g.update_with_gbtstatus()
g.write()
except:
pass
time.sleep(1)
| nrao/FLAG-Beamformer-Devel | src/vegas_hpc/to_delete/guppi_gbtstatus_loop.py | Python | gpl-2.0 | 253 |
__author__ = 'ntrepid8'
| MaaSiveNet/maasive-py | tests/__init__.py | Python | mit | 24 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... | googleads/google-ads-python | google/ads/googleads/v10/enums/types/payment_mode.py | Python | apache-2.0 | 1,172 |
import numpy as np
import urllib
import os
import argparse
from sklearn.cross_validation import train_test_split
from astroML.plotting import setup_text_plots
import empiriciSN
from MatchingLensGalaxies_utilities import *
from astropy.io import fits
import GCRCatalogs
import pandas as pd
from GCR import GCRQuery
sys.pa... | LSSTDESC/Twinkles | utils/catalog_production/add_om10_properties.py | Python | mit | 15,129 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | ChameleonCloud/horizon | openstack_auth/tests/unit/test_utils.py | Python | apache-2.0 | 4,892 |
# Copyright 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 requ... | shakamunyi/nova | nova/api/openstack/compute/extensions.py | Python | apache-2.0 | 1,345 |
"""
This package combines the common.ncml with existing pyNN classes
Author: Thomas G. Close (tclose@oist.jp)
Copyright: 2012-2014 Thomas G. Close.
License: This file is part of the "NineLine" package, which is released under
the MIT Licence, see LICENSE for details.
"""
from __future__ import abso... | tclose/PyPe9 | pype9/simulate/neuron/cells/base.py | Python | mit | 25,342 |
from bokeh.embed import autoload_server
def test():
script = autoload_server(model = None, app_path="/main")
# this is pretty hacky -- flask can't pass its GET request parameters directly, so we have to do it this way
# `script` is a string that looks like this (the first character is a newline):
"""
... | phantomlinux/IoT-tracking | VAUGHN/bokeh_server/test.py | Python | apache-2.0 | 1,200 |
# -*- coding: utf-8 -*-
"""
eventlogging unit tests
~~~~~~~~~~~~~~~~~~~~~~~
This module contains tests for :module:`eventlogging.factory`.
"""
from __future__ import unicode_literals
import unittest
import eventlogging
import eventlogging.factory
def fail_at_third_yield(uri, **kwargs):
yield "yield #1"
... | Facerafter/starcitizen-tools | extensions/EventLogging/server/tests/test_factory.py | Python | gpl-3.0 | 2,552 |
from collections import namedtuple
from flask import abort, request
from functools import wraps, partial
from subprocess import check_output
import grp
import os
import pwd
__all__ = ['authenticate', 'requires_auth']
def authenticate():
"""Authenticate a user using Synology's authenticate.cgi
If the user i... | bwynants/spksrc | spk/subliminal/src/app/application/auth.py | Python | bsd-3-clause | 2,064 |
import pytest
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pandas.core.indexes.period as period
from pandas.compat import lrange, PY3, text_type, lmap
from pandas import (Period, PeriodIndex, period_range, offsets, date_range,
Series, Index)
class TestPeriodIndex... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/pandas/tests/indexes/period/test_construction.py | Python | mit | 19,404 |
###
# Copyright 2016 Hewlett Packard Enterprise, 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 ... | HewlettPackard/python-proliant-sdk | src/redfish/ris/ris.py | Python | apache-2.0 | 29,757 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""base64decod.py"""
__version__ = "0.1"
__author__ = "Elian"
__copyright__ = "(C) 2016-2017 Elian. GNU GPL 3."
import base64
# --=] Main [=----------------------------------------------------------------------------
chr_base64 = raw_input("Base64 string? ")
print base64... | Elian-0x/practice-python | base64decod.py | Python | gpl-3.0 | 343 |
# Copyright 2020 Makani Technologies LLC
#
# 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... | google/makani | analysis/system_design/site.py | Python | apache-2.0 | 3,837 |
# SConsBuildFramework - Copyright (C) 2014, 2015, Nicolas Papier.
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation.
# Author Nicolas Papier
import os, collections
from os.path import dirname, exists, isdir, isfile, join
from sbfArchives import ... | npapier/sbf | src/sbfEmscripten.py | Python | gpl-3.0 | 4,081 |
#! /usr/bin/env python
# -*- coding: Latin-1 -*-
# Bataille de de cartes
from exercice_12_07 import JeuDeCartes
jeuA = JeuDeCartes() # instanciation du premier jeu
jeuB = JeuDeCartes() # instanciation du second jeu
jeuA.battre() # mรฉlange de chacun
jeuB.battre()
pA, pB = 0, 0 ... | widowild/messcripts | exercice/python2/solutions/exercice_12_08.py | Python | gpl-3.0 | 908 |
"""A Usage vector implementation used in a DNC.
This Usage vector is implemented as defined in the DNC architecture in
DeepMind's Nature paper:
http://www.nature.com/nature/journal/vaop/ncurrent/full/nature20101.html
Author: Austin Derrow-Pinion
"""
import collections
import sonnet as snt
import tensorflo... | derrowap/DNC-TensorFlow | src/dnc/usage.py | Python | mit | 10,813 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: LiSnB
# @Date: 2014-06-06 22:23:23
# @Last Modified by: LiSnB
# @Last Modified time: 2014-06-06 23:48:49
# @Email: lisnb.h@gmail.com
"""
# @comment here:
"""
import chardet_
if __name__ == '__main__':
print chardet_.detect('aBuf')
... | lisnb/intelliSeg | sysargtutorial.py | Python | mit | 336 |
# Copyright 2015 gRPC authors.
#
# 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... | GoogleCloudPlatform/grpc-gcp-python | tests/grpc_gcp_test/unit/_channel_ready_future_test.py | Python | apache-2.0 | 3,655 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Sergey Sobko'
__email__ = 'S.Sobko@profitware.ru'
__copyright__ = 'Copyright 2013, The Profitware Group'
from sympy.core.symbol import Symbol
class Wire(object):
_options = None
def __init__(self, **kwargs):
self._options = {
... | MIEMHSE/circuitrylib | circuitry/adapters/visual/wires.py | Python | mit | 925 |
from __future__ import absolute_import, print_function
from sentry.testutils import APITestCase
class SharedGroupDetailsTest(APITestCase):
def test_simple(self):
self.login_as(user=self.user)
group = self.create_group()
event = self.create_event(group=group)
url = '/api/0/shared... | nicholasserra/sentry | tests/sentry/api/endpoints/test_shared_group_details.py | Python | bsd-3-clause | 980 |
"""List of Lists sparse matrix class
"""
__docformat__ = "restructuredtext en"
__all__ = ['lil_matrix', 'isspmatrix_lil']
from bisect import bisect_left
import numpy as np
from ._base import spmatrix, isspmatrix
from ._index import IndexMixin, INT_TYPES, _broadcast_arrays
from ._sputils import (getdtype, isshape, ... | grlee77/scipy | scipy/sparse/_lil.py | Python | bsd-3-clause | 18,214 |
"""
@author: Bohdan Mushkevych
@author: Brian Curtin
http://code.activestate.com/lists/python-ideas/8982/
"""
import numbers
import threading
from datetime import datetime, timedelta
class RepeatTimer(threading.Thread):
""" This class triggers every number of seconds """
def __init__(self, interval, call_back... | mushkevych/launch.py | system/repeat_timer.py | Python | bsd-3-clause | 2,844 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 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.apach... | denismakogon/trove-guestagent | trove_guestagent/common/exception.py | Python | apache-2.0 | 10,007 |
# -*- coding: utf-8 -*-
"""
Class_LabExperimBased provides functionalities for data handling of data obtained in lab experiments in the field of (waste)water treatment.
Copyright (C) 2016 Chaim De Mulder
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General P... | cdemulde/wwdata | wwdata/Class_LabExperimBased.py | Python | agpl-3.0 | 7,474 |
# -*- coding: utf-8 -*-
##--------------------------------------#######
# Surfaces #
##--------------------------------------#######
# WxGeometrie
# Dynamic geometry, graph plotter, and more for french mathematic teachers.
# Copyright (C) 2005-2013 Nicolas Pourcelot
#
# ... | wxgeo/geophar | wxgeometrie/modules/surfaces/__init__.py | Python | gpl-2.0 | 13,095 |
__version__ = '0.1.0b1'
| hartror/webargs-marshmallow | webargs_marshmallow/__init__.py | Python | mit | 24 |
import hashlib
import math
DEFAULT_HASHING_BUFFER_SIZE = int(math.pow(2,16))
def hash_file_in_chunks(filename, hash_object,
buffer_size=DEFAULT_HASHING_BUFFER_SIZE):
with open(filename, 'rb') as file:
chunk = file.read(buffer_size)
while chunk:
hash_object.update(chunk)
... | c0yote/sandbox | scripts/hash.py | Python | unlicense | 1,607 |
import pygame as pg
from src.physics import Vector
class Sprite(object):
def __init__(self, path=None, img=None, size=None):
if path:
self.img = pg.image.load(path)
elif img:
self.img = img
if size:
self.scale(size)
def draw(self, display, pos=(0,0), size=(0,0), rot=0):
display.blit(self.img,(pos[... | LittleSmaug/summercamp2k17 | src/game/sprite.py | Python | gpl-3.0 | 404 |
## This file is a workaround for Github issue #24
__version_tuple__ = (1, 2, 39)
__version__ = '.'.join(map(str, __version_tuple__))
| spirrello/spirrello-pynet-work | applied_python/lib/python2.7/site-packages/version_info/version.py | Python | gpl-3.0 | 133 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import sockjsroom
# Setup library
setup(
# Pypi name
name = "sockjsroom",
# Release version
version = sockjsroom.__version__,
# Associated package
packages = find_packages(),
# Author
author... | Deisss/python-sockjsroom | setup.py | Python | mit | 1,075 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-12-12 15:10
from __future__ import unicode_literals
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0021_issue_views'... | goyal-sidd/BLT | website/migrations/0022_auto_20161212_1510.py | Python | agpl-3.0 | 624 |
import unittest
from flexmock import flexmock_teardown
from tests.util.global_reactor import cisco_switch_ip, \
cisco_auto_enabled_switch_ssh_port, cisco_auto_enabled_switch_telnet_port
from tests.util.protocol_util import SshTester, TelnetTester, with_protocol
class TestCiscoAutoEnabledSwitchProtocol(unittest.T... | mlecours/fake-switches | tests/cisco/test_cisco_auto_enabled_switch.py | Python | apache-2.0 | 1,464 |
from tempfile import SpooledTemporaryFile, NamedTemporaryFile
from bottle import request
from warcio.archiveiterator import ArchiveIterator
from warcio.limitreader import LimitReader
from har2warc.har2warc import har2warc
import codecs
from warcio.warcwriter import BufferWARCWriter, WARCWriter
from warcio.timeutils ... | webrecorder/webrecorder | webrecorder/webrecorder/models/importer.py | Python | apache-2.0 | 34,037 |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... | tempbottle/ironpython3 | Tests/test_interactive.py | Python | apache-2.0 | 34,787 |
from p2pool.bitcoin import networks
PARENT = networks.nets['franko']
SHARE_PERIOD = 15 # seconds target spacing
CHAIN_LENGTH = 24*60*60//10 # shares
REAL_CHAIN_LENGTH = 24*60*60//10 # shares
TARGET_LOOKBEHIND = 200 # shares coinbase maturity
SPREAD = 30 # blocks
IDENTIFIER = 'be43F5b8c6924210'.decode('hex')
PREFIX = '... | ptcrypto/p2pool-adaptive | p2pool/networks/franko.py | Python | gpl-3.0 | 839 |
"""
.. module:: fhmm
:platform: Unix
:synopsis: Contains methods for training and fitting Factorials HMMs.
.. moduleauthor:: Phil Ngo <ngo.phil@gmail.com>
.. moduleauthor:: Miguel Perez <miguel.a.perez4@gmail.com>
.. moduleauthor:: Stephen Suffian <stephen.suffian@gmail.com>
.. moduleauthor:: Sabina Tomkins <sab... | dssg/wikienergy | disaggregator/fhmm.py | Python | mit | 13,680 |
import monetdb.sql
import os, sys, time
port = int(os.environ['MAPIPORT'])
db = os.environ['TSTDB']
host = os.environ['MAPIHOST']
dbh = monetdb.sql.Connection(port=port,database=db,hostname=host,autocommit=True)
cursor = dbh.cursor();
cursor.execute('select p.*, "location", "count", "column" from storage(), (sele... | zyzyis/monetdb | sql/benchmarks/tpch/fileleak/Tests/leaks.SQL.py | Python | mpl-2.0 | 592 |
# -*- coding: utf-8 -*-
from odoo import api, fields, models, tools
from odoo.exceptions import UserError
import os
from odoo.tools import misc
import re
# ๆๆฌ่ฎก็ฎๆนๆณ๏ผๅทฒๅฎ็ฐ ๅ
ๅ
ฅๅ
ๅบ
CORE_COST_METHOD = [('average', u'ๅ
จๆไธๆฌกๅ ๆๅนณๅๆณ'),
('std',u'ๅฎ้ขๆๆฌ'),
('fifo', u'ๅ
่ฟๅ
ๅบๆณ'),
]
... | luoguizhou/gooderp_addons | core/models/res_company.py | Python | agpl-3.0 | 2,323 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Python Bindings for CPUInfo
#
# Copyright (C) 2009 Per รyvind Karlsen <peroyvind@mandriva.org>
# CPUInfo Copyright (C) 2007-2008 Gwenole Beauchesne
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public L... | DrakXtools/cpuinfo | src/bindings/python/setup.py | Python | gpl-2.0 | 2,370 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('askapp', '0012_auto_20170203_1436'),
]
operations = [
migrations.RenameField(
model_name='post',
old... | BanzaiTokyo/akihabara-tokyo | askapp/migrations/0013_auto_20170206_0748.py | Python | apache-2.0 | 542 |
import sys
import requests
import json
import apis
def square(n):
""" Square numbers
>>> square(2)
4
>>> square(3)
8
"""
return n**n
def dispatcher(command, arg):
""" Does things """
if command == "weather":
print("Here's the weather forcast for "+arg)
print(ap... | bribri1018/personal-assistant | jarvis.py | Python | mit | 1,531 |
from __future__ import absolute_import
from __future__ import print_function
import math
from bisect import bisect_right
import array
from six.moves import map
from six.moves import range
from six.moves import zip
try:
import pyhash
hash_func = pyhash.murmur2_x64_64a()
HASH_LEN = 64
raise ImportError
e... | windreamer/dpark | dpark/hyperloglog.py | Python | bsd-3-clause | 3,324 |
# Copyright (C) 2011-2012 CRS4.
#
# This file is part of Seal.
#
# Seal 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.
#
# Seal is dis... | ilveroluca/seal | seal/lib/mr/emit_sam_link.py | Python | gpl-3.0 | 2,113 |
from cloudbot import hook
from cloudbot.util import http
api_root = 'http://api.rottentomatoes.com/api/public/v1.0/'
movie_search_url = api_root + 'movies.json'
movie_reviews_url = api_root + 'movies/%s/reviews.json'
@hook.command('rt')
def rottentomatoes(inp, bot=None):
"""rt <title> -- gets ratings for <title>... | Zarthus/CloudBotRefresh | plugins/rottentomatoes.py | Python | gpl-3.0 | 1,312 |
import datetime
import os
import subprocess
from flask import render_template, redirect, request, url_for, flash,\
current_app, make_response
from . import auth
from .forms import LoginForm, AdminAddForm, AdminEditForm,\
ChangePasswordForm, ResetPasswordForm,\
Res... | jyundt/oval | app/auth/views.py | Python | gpl-2.0 | 12,971 |
from elizabeth.core.providers import (
Address, Business, ClothingSizes,
Code, Datetime, Development, File,
Food, Hardware, Internet, Numbers,
Path, Personal, Science, Structured,
Text, Transport, UnitSystem, Generic
)
| wikkiewikkie/elizabeth | elizabeth/core/__init__.py | Python | mit | 239 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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) an... | tersmitten/ansible | lib/ansible/playbook/task.py | Python | gpl-3.0 | 19,649 |
# 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 applica... | jart/tensorflow | tensorflow/contrib/autograph/converters/continue_statements_test.py | Python | apache-2.0 | 2,568 |
#!/usr/bin/env python
"""
Execute a graph cut on a region image based on some foreground and background markers.
Copyright (C) 2013 Oskar Maier
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, eithe... | loli/medpy | bin/medpy_graphcut_label_wsplit.py | Python | gpl-3.0 | 5,799 |
#!/usr/bin/env python
"""
This script checks whether DNS entries for ips in the given subnet could be removed from DNS.
Copyright 2013 by Reiner Rottmann (reiner@rottmann.it). Released under the BSD license.
"""
import os
import sys
import socket
import logging
from optparse import OptionParser
logging.basicConfig(f... | rrottmann/scripts | uips.py | Python | bsd-3-clause | 2,202 |
# -*- coding: utf-8 -*-
import gevent.monkey
gevent.monkey.patch_all()
import gevent
from gevent.queue import Queue
import twitter
from threading import Thread
import time
import re
# change here, change in setup.py
__version__ = "0.2.3"
class CorrectionsException(Exception):
pass
class Correct(object):
"... | sysr-q/corrections | corrections/__init__.py | Python | mit | 5,330 |
from pyramid.response import Response
from pyramid.view import view_config
import os
import sys
import time
import json
from datetime import datetime, timedelta
from lxml import etree, html
from config import Config
import logging
log = logging.getLogger(__name__)
import networkx as nx
from networkx.readwrite impor... | MLR-au/esrc-cnex | service/app/Network.py | Python | bsd-3-clause | 10,719 |
# Copyright 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 requ... | rakeshmi/cinder | cinder/tests/unit/api/v2/test_types.py | Python | apache-2.0 | 8,430 |
"""
Utilities for dealing with JSON.
"""
import simplejson
from xmodule.modulestore import EdxJSONEncoder
class EscapedEdxJSONEncoder(EdxJSONEncoder):
"""
Class for encoding edx JSON which will be printed inline into HTML
templates.
"""
def encode(self, obj):
"""
Encodes JSON tha... | Semi-global/edx-platform | openedx/core/lib/json_utils.py | Python | agpl-3.0 | 533 |
# 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... | mavenlin/tensorflow | tensorflow/python/kernel_tests/constant_op_test.py | Python | apache-2.0 | 31,617 |
import datetime
from socorro.cron.crontabber_app import CronTabberApp
from socorro.lib.datetimeutil import utc_now
from socorro.unittest.cron.jobs.base import IntegrationTestBase
class TestCleanRawADILogsCronApp(IntegrationTestBase):
def _setup_config_manager(self, days_to_keep=None):
return super(TestC... | Tayamarn/socorro | socorro/unittest/cron/jobs/test_clean_raw_adi_logs.py | Python | mpl-2.0 | 2,174 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('chat', '0004_task_args'),
]
operations = [
migrations.AddField(
model_name='message',
name='nick',
... | Eduard90/grissli | chat/migrations/0005_auto_20151109_1746.py | Python | gpl-2.0 | 944 |
class BaseLineParser(object):
""""""
@staticmethod
def get_instance():
pass
def __init__(self):
""""""
self._function_name = ""
self._function_signature = ""
def load(self, line):
raise NotImplementedError()
def get_function_name(self, line=None):
... | andymeneely/attack-surface-metrics | attacksurfacemeter/loaders/base_line_parser.py | Python | mit | 596 |
# Under MIT licence, see LICENCE.txt
import unittest
from RULEngine.Game.Ball import Ball
from RULEngine.Game.Game import Game
from RULEngine.Game.Referee import Referee
from RULEngine.Util.Pose import Pose
from RULEngine.Util.Position import Position
from RULEngine.Util.game_world import GameWorld
from RULEngine.Uti... | wonwon0/StrategyIA | tests/Algorithm/test_node.py | Python | mit | 4,056 |
"""Coverage.py's main entrypoint."""
import os
import sys
bundled_coverage_path = os.getenv('BUNDLED_COVERAGE_PATH')
if bundled_coverage_path:
sys_path_backup = sys.path
sys.path = [p for p in sys.path if p != bundled_coverage_path]
from coverage.cmdline import main
sys.path = sys_path_backup
else:
... | allotria/intellij-community | python/helpers/coverage_runner/run_coverage.py | Python | apache-2.0 | 1,772 |
##############################################################################
#
# Odoo module for Transport Sale
# Copyright (C) 2004-2010 Alien Group (<http://www.alien-group.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publ... | silvau/Addons_Odoo | transport_sale/__init__.py | Python | gpl-2.0 | 980 |
"""
General tests for all estimators in sklearn.
"""
# Authors: Andreas Mueller <amueller@ais.uni-bonn.de>
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
from __future__ import print_function
import os
import warnings
import sys
import traceback
import inspect
import pickle
import pkg... | flightgong/scikit-learn | sklearn/tests/test_common.py | Python | bsd-3-clause | 44,181 |
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_published_recently(self):
... | gnhuy91/django-tutorial-docker | apps/polls/models.py | Python | mit | 696 |
"""
atomorder/parse_args.py
Parses command line arguments and overwrites setting defaults
"""
from . import settings
import argparse
import sys
description = ""
epilog = ""
parser = argparse.ArgumentParser(
description = description,
formatter_class = argparse.RawDescriptionHelpFormatter,
ep... | larsbratholm/atomorder | atomorder/parse_args.py | Python | mit | 2,393 |
import cavejohnson
cavejohnson.set_github_status("drewcrawford/DCAKit", "a5840df1d9cf2f1176c63e81009361d7850a3dd9", "pending") | kiancheong/CaveJohnson | test.py | Python | mit | 126 |
from ctypes import *
from MelAPI.ctype_util import *
from enum import IntEnum
import struct
import tempfile
import os
#import h5py
#import pickle
#from reward import computeRewards
import numpy as np
import itertools
@pretty_struct
class Stick(Structure):
_fields = [
('x', c_float),
('y', c_float),
]
de... | Gurvan/MelAPI | MelAPI/ssbm.py | Python | mit | 4,610 |
import time
import numpy
import libopf_py
from scikits.learn import datasets, svm, metrics
digits = datasets.load_digits()
# To apply an classifier on this data, we need to flatten the image, to
# turn the data in a (samples, feature) matrix:
n_samples = len(digits.images)
data = digits.images.reshape((n_samples, -... | victormatheus/LibOPF | examples/handwritten.py | Python | bsd-2-clause | 2,112 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.