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 |
|---|---|---|---|---|---|
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from past.builtins import xrange
def ReLU(x):
return np.maximum(0, x)
class TwoLayerNet(object):
"""
A two-layer fully-connected neural network. The net has an input dimension of
N, a hidden layer dimension of H, and p... | luoshao23/ML_algorithm | Deep_Learning/CNN/neural_net.py | Python | mit | 12,533 |
import siconos.numerics as sn
import scipy.sparse
import numpy as np
import copy
from siconos.tests_setup import working_dir
data_dir = working_dir + '/data/'
dbl_eps = np.finfo(np.float).eps
def check_size(sa, sb):
assert sa[0] == sb[0]
assert sa[1] == sb[1]
def compare_with_SBM(sbmat, mat):
print('... | radarsat1/siconos | numerics/swig/tests/test_linalg.py | Python | apache-2.0 | 4,657 |
import struct
boolean = struct.Struct("<?")
uint8 = struct.Struct("<B")
uint16 = struct.Struct("<H")
uint32 = struct.Struct("<I")
uint64 = struct.Struct("<Q")
int8 = struct.Struct("<b")
int16 = struct.Struct("<h")
int24 = struct.Struct("<L")
int32 = struct.Struct("<i")
int64 = struct.Struct("<q")
float32 = struct.S... | SkippsDev/Py-Slither | src/packet/BufferTypes.py | Python | mit | 442 |
# Django Lookup Dict is a django app that enables you use a django model
# the Python dict way.
# Copyright (C) 2014 Mohamed Hendawy
# This file is part of Django Lookup Dict.
from lookup import LookupDict
| hendawy/django_lookup_dict | django_lookup_dict/__init__.py | Python | mit | 209 |
# Copyright 2011-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import subprocess
import sys
import portage
from portage import os
from portage import _unicode_decode
from portage.const import PORTAGE_BIN_PATH, PORTAGE_PYM_PATH, USER_CONFIG_PATH
from portage.process import f... | devurandom/portage | pym/portage/tests/emerge/test_simple.py | Python | gpl-2.0 | 12,141 |
# -*- coding: utf-8 -*-
#
# MetaTerm - A terminology management application written in Python
# Copyright (C) 2014 Diego Beraldin
#
# 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... | diegoberaldin/MetaTerm | src/model/dataaccess/schema.py | Python | gpl-3.0 | 5,572 |
import random
numbers = '1234567890'
letters = 'qwertyuiopasdfghjklzxcvbnm'
letters_caps = 'QWERTYUIOPLKJHGFDSAZXCVBNM'
symbols = '!@#$%^&*()_+=~`:"<>?|\;,."`'
def create_password(leng):
"""
Creates a random password.
Arguments - leng, an integer, has to be multiple of 4.
"""
password = ''
lis... | Flavyoo/Coding_Past_Time | PasswordCreator.py | Python | mit | 1,952 |
import os
import subprocess
import sys
def get_current_keyboard_layout():
main_command = subprocess.Popen(('setxkbmap', '-query'), stdout=subprocess.PIPE)
pipe_command = subprocess.check_output(('grep', 'layout'), stdin=main_command.stdout)
main_command.wait()
final_output = pipe_command.decode('utf-8... | tiagoprn/devops | bin/show_current_keyboard_layout.py | Python | mit | 582 |
from pyspark import SparkConf, SparkContext
from jsonrpc.authproxy import AuthServiceProxy
import json
import sys
#This is batch processing of bitcoind (locally run bitcoin daemon)
#RPC (Remote Procedure Call) block's json stored
#in HDFS. Currently 187,990 blocks' json representation is
#stored in HDFS. The HDFS file... | tariq786/datafying_bitcoin | sp_batch_hdfs.py | Python | gpl-3.0 | 3,652 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | DirectXMan12/nova-hacking | nova/utils.py | Python | apache-2.0 | 33,085 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/r-factoextra/package.py | Python | lgpl-2.1 | 2,151 |
import torch
import torch.nn as nn
import torch.nn.functional as F
class AnyBatchGRUCell(nn.Module):
'''GRU Cell that supports N1 x N2 x ... x Nk x D shape data'''
def __init__(self, input_dim, hidden_dim):
super().__init__()
self.linear_ih = nn.Linear(input_dim, 3 * hidden_dim)
self.li... | isaachenrion/jets | src/architectures/utils/any_batch_gru_cell.py | Python | bsd-3-clause | 659 |
#!/usr/bin/python
# Copyright: (c) 2018, Johannes Brunswicker <johannes.brunswicker@gmail.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_versio... | resmo/ansible | lib/ansible/modules/web_infrastructure/sophos_utm/utm_aaa_group_info.py | Python | gpl-3.0 | 3,411 |
#!/usr/bin/env python
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | googleads/google-ads-python | examples/extensions/update_sitelink.py | Python | apache-2.0 | 3,961 |
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) Vauxoo (<http://www.vauxoo.com>).
# All Rights Reserved
# #############Credits######################################################
... | Jgarcia-IAS/SAT | openerp/addons-extra/ifrs_report-8.0.0.6/controller_report_xls/controllers/__init__.py | Python | agpl-3.0 | 1,386 |
"""
Implementa um vetor bidimensional (versão 2 - mais completa)
"""
from numbers import Real
import math
class Vetor:
"""
Vetor bidimensional que implementa soma, subtração, multiplicação por escalar etc.
>>> v1 = Vetor(3, -2)
>>> v1
Vetor(3, -2)
>>> v2 = Vetor(1, 1)
>>> v2
Vetor(1, ... | opensanca/trilha-python | 02-python-oo/aula-03/exemplos/vetor2.py | Python | mit | 2,316 |
# -*- coding: utf8 -*-
# Copyright (C) 2015 - Philipp Temminghoff <phil65@kodi.tv>
# This program is Free Software see LICENSE file for details
from __future__ import absolute_import
from __future__ import unicode_literals
from builtins import str
import datetime
import functools
import hashlib
import json
import o... | phil65/script.module.kodi65 | lib/kodi65/utils.py | Python | lgpl-2.1 | 16,241 |
# -*- coding: utf-8 -*-
from collections import defaultdict
from itertools import chain
from functools import wraps
from operator import itemgetter
from multiprocessing import (
current_process,
SimpleQueue,
Process,
)
from time import sleep
import logging
import sys
import traceback
from retrying import ... | ATRAN2/Futami | futami/ami.py | Python | gpl-2.0 | 7,977 |
from .negate import negate
from pyramda.private.asserts import assert_equal
def negate_test():
assert_equal(negate(5), -5)
| jackfirth/pyramda | pyramda/math/negate_test.py | Python | mit | 129 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2012 Pexego Sistemas Informáticos All Rights Reserved
# $Marta Vázquez Rodríguez$ <marta@pexego.es>
#
# This program is free software: you can redistribute it and/or modify
# it unde... | ELNOGAL/CMNT_00040_2016_ELN_addons | eln_reports/report/stock_picking/stock_picking_out_std_report_parser.py | Python | agpl-3.0 | 1,350 |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function
#
# Standard imports
#
import sys
import glob, os
import pdb
#from distutils.extension import Extension
#
# setuptools' sdist command ignores MANIFEST.in
#
#from distuti... | PYPIT/COS_REDUX | setup.py | Python | bsd-2-clause | 3,186 |
#
# Copyright 2012-2018 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | nirs/vdsm | lib/vdsm/gluster/api.py | Python | gpl-2.0 | 32,550 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
bagel.py
-------
:copyright: (c) 2016 by Adam Schwartz
Evaluate template code and render file(s)
1. Read template as string from stdin or source_file(s)
2. Extract code from the template
3. Evaluate with subprocess call
4. Substitute ... | anschwa/bagel | bagel/bagel.py | Python | mit | 4,153 |
import os
from nose.tools import assert_not_equal, assert_equal
from hyperspy.api import load
my_path = os.path.dirname(__file__)
class TestFindPeaks1DOhaver():
def setUp(self):
self.spectrum = load(
my_path +
"/test_find_peaks1D_ohaver/test_find_peaks1D_ohaver.hdf5")
def te... | to266/hyperspy | hyperspy/tests/signal/test_find_peaks1D_ohaver.py | Python | gpl-3.0 | 690 |
__author__ = 'gliberat'
| willmendesneto/fp_redis_server | tests/unit/__init__.py | Python | mit | 24 |
# Copyright 2012 Dean Troyer
# Copyright 2011 OpenStack LLC.
# 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-... | dtroyer/drstack | drstack/add.py | Python | apache-2.0 | 1,216 |
#!/usr/bin/python
import subprocess
import textwrap, argparse
import pymysql
#can use this also
#import MySQLdb
parserarg = argparse.ArgumentParser(
prog='buildBLC.py',
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent('''\
build a BLC file from data stored in ... | daniparera/MCR | BLC/generateSQL/buildBLC.py | Python | gpl-2.0 | 2,407 |
#!/usr/bin/env python
# Copyright 2014 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.
import argparse
import glob
import hashlib
import os
import shutil
import subprocess
import sys
import bootstrap
from util import ROO... | nicko96/Chrome-Infra | bootstrap/build_deps.py | Python | bsd-3-clause | 6,236 |
"""
byceps.blueprints.shop.order.signals
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from blinker import Namespace
shop_signals = Namespace()
order_placed = shop_signals.signal('order-placed')
order_canceled = shop_signals.si... | m-ober/byceps | byceps/blueprints/shop/order/signals.py | Python | bsd-3-clause | 390 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015-2016 Alessandro Amici
#
from pytest_nodev import utils
def test_import_coverage():
"""Fix the coverage by pytest-cov, that may trigger after pytest_nodev is already imported."""
from imp import reload # Python 2 and 3 reload
reload(utils)
| alexamici/pytest-wish | tests/test_utils.py | Python | mit | 302 |
# -*- coding: utf-8 -*-
"""
flask.ext.social.utils
~~~~~~~~~~~~~~~~~~~~~~
This module contains the Flask-Social utils
:copyright: (c) 2012 by Matt Wright.
:license: MIT, see LICENSE for more details.
"""
import collections
from importlib import import_module
from flask import current_app, url_fo... | bdh1011/cupeye | venv/lib/python2.7/site-packages/flask_social/utils.py | Python | bsd-3-clause | 1,957 |
__all__ = ["wordlists", "roles", "bnc", "processes", "verbs",
"uktous", "tagtoclass", "queries", "mergetags"]
from corpkit.dictionaries.bnc import _get_bnc
from corpkit.dictionaries.process_types import processes
from corpkit.dictionaries.process_types import verbs
from corpkit.dictionaries.roles import ro... | interrogator/corpkit | corpkit/dictionaries/__init__.py | Python | mit | 774 |
from MafiaBot.MafiaItem import MafiaItem
from MafiaBot.MafiaAction import MafiaAction
class FakeBackgroundCheck(MafiaItem):
def __init__(self, name, receiveday=0):
super(FakeBackgroundCheck, self).__init__(name, receiveday)
self.type = MafiaItem.CHECK
self.fake = True
def ReceiveItem... | LLCoolDave/MafiaBot | MafiaBot/Items/FakeBackgroundCheck.py | Python | mit | 1,784 |
#!/usr/bin/python
# Copyright (c) 2015 Mirantis 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... | dmitrymex/example-oslo-messaging | example_rpc_server.py | Python | apache-2.0 | 2,010 |
# -*- coding: utf-8 -*-
#
#
# Authors: Adrien Peiffer
# Copyright (c) 2014 Acsone SA/NV (http://www.acsone.eu)
# All Rights Reserved
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences result... | charbeljc/account-financial-tools | account_journal_period_close/tests/test_account_journal_period_close.py | Python | agpl-3.0 | 9,410 |
from unittest.mock import patch
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.test import TestCase
from django.urls import reverse
from rest_framework.test import APITestCase
from apps.volontulo.factories import UserFactory
ENDPOINT_URL = reverse('password... | magul/volontulo | backend/apps/volontulo/tests/views/api/test_password_change.py | Python | mit | 3,028 |
import json
from tests.test_helper import *
from braintree.test.credit_card_numbers import CreditCardNumbers
from braintree.test.nonces import Nonces
from braintree.dispute import Dispute
import braintree.test.venmo_sdk as venmo_sdk
class TestTransaction(unittest.TestCase):
def test_sale_returns_risk_data(self):
... | mapleoin/braintree_python | tests/integration/test_transaction.py | Python | mit | 104,875 |
# -*- coding: utf-8 -*-
#
# This file is part of PyBuilder
#
# Copyright 2011-2020 PyBuilder Team
#
# 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/l... | pybuilder/pybuilder | src/main/python/pybuilder/plugins/python/pymetrics_plugin.py | Python | apache-2.0 | 1,969 |
import os
import tempfile
import pytz
from django import VERSION as DJANGO_VERSION
from django.contrib.auth import views as auth_views
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, Permission
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.... | nimasmi/wagtail | wagtail/admin/tests/test_account_management.py | Python | bsd-3-clause | 36,641 |
"""Discovers Chromecasts on the network using mDNS/zeroconf."""
import logging
import socket
from threading import Event
from uuid import UUID
import zeroconf
DISCOVER_TIMEOUT = 5
_LOGGER = logging.getLogger(__name__)
class CastListener:
"""Zeroconf Cast Services collection."""
def __init__(self, add_call... | dominikkarall/pychromecast | pychromecast/discovery.py | Python | mit | 8,608 |
# 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
# d... | jianghuaw/nova | nova/api/openstack/placement/handler.py | Python | apache-2.0 | 9,268 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/aegean/package.py | Python | lgpl-2.1 | 1,902 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# cmus-notify documentation build configuration file, created by
# sphinx-quickstart on Sat Apr 15 17:46:57 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
... | AntoineGagne/cmus-notify | docs/conf.py | Python | mit | 5,101 |
#!/usr/bin/env python
import glob, os, sys
import PRIRecord
import Table
class ShaftEncodingChecker:
kDupeTable = Table.Table(
( '%3d', 'Dup' ),
( '%5d', 'Shaft' ),
( '%6.2f', 'Az' ),
( '%6d', 'Indx A' ),
( '%7d', 'Seq # A' ),
( '%17.6f', 'IRIG A' ),
( '%6d... | bradhowes/sidecar | Scripts/pypri.py | Python | mit | 21,395 |
#! usr/bin/env python
# coding: utf8
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
"""
metalex is general tool for lexicographic and metalexicographic activities
Copyright (C) 2017 by Elvis MBONING
This program is free software: you ... | Levis0045/MetaLex | metalex/ocrtext/normalizeText.py | Python | agpl-3.0 | 11,920 |
from __future__ import absolute_import
import os
path = os.path
import random
from random import randrange
random.seed(2)
from myhdl import *
from myhdl.conversion import verify
NRTESTS = 10
def binaryOps(
Bitand,
Bitor,
Bitxor,
FloorDiv,
LeftShif... | gw0/myhdl | myhdl/test/conversion/toVHDL/test_ops.py | Python | lgpl-2.1 | 12,103 |
#!/usr/bin/env python
from runtest import TestBase
import subprocess as sp
TDIR='xxx'
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'abc', """
{"traceEvents":[
{"ts":58348873444,"ph":"B","pid":5231,"name":"main"},
{"ts":58348873444,"ph":"B","pid":5231,"name":"a"},
{"ts":5834887344... | andrewjss/uftrace | tests/t101_dump_chrome.py | Python | gpl-2.0 | 1,111 |
import common
import struct
def FindRadio(zipfile):
try:
return zipfile.read("RADIO/radio.img")
except KeyError:
return None
def FullOTA_InstallEnd(info):
try:
bootloader_img = info.input_zip.read("RADIO/bootloader.img")
except KeyError:
print "no bootloader.img in target_files; skipping inst... | indashnet/InDashNet.Open.UN2000 | android/device/asus/deb/releasetools.py | Python | apache-2.0 | 6,678 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('ml', '0005_auto_20150420_0526'),
]
operations = [
migrations.AlterUniqueTogether(
name='machine_learning_model',... | sqlviz/sqlviz | ml/migrations/0006_auto_20150427_0746.py | Python | mit | 409 |
#!/usr/bin/env python3
from os import environ, system
from subprocess import Popen
print('\nQuake III Team Arena')
print('Link: https://store.steampowered.com/app/2350/QUAKE_III_Team_Arena/\n')
home = environ['HOME']
core = home + '/bin/games/steam-connect/steam-connect-core.py'
logo = home + '/bin/games/steam-connec... | noirhat/bin | games/quake-3-team-arena.py | Python | gpl-2.0 | 509 |
import os
from waterbutler.core import metadata
class BaseCloudFilesMetadata(metadata.BaseMetadata):
@property
def provider(self):
return 'cloudfiles'
class CloudFilesFileMetadata(BaseCloudFilesMetadata, metadata.BaseFileMetadata):
@property
def name(self):
return os.path.split(se... | Johnetordoff/waterbutler | waterbutler/providers/cloudfiles/metadata.py | Python | apache-2.0 | 1,763 |
import plugin
ldap, ldap_rh = plugin.get("ldap", "ldap_redhat")
LOG = plugin.logger(__name__)
when, lapse = '9am', '24h'
def run():
for search in ["James Whitehurst", "mrc", "Perry M", "lpeer", "Alvaro Lopez Ortega", "jpena", "Michal Pryc"]:
chain = ldap.get_report_chain(search)
LOG.debug(search... | alobbs/autome | scripts/ldapme.py | Python | mit | 463 |
#!/usr/bin/env python
'''Convert Project Euler solution to base64 encoding for adding to tests.
Usage:
convert <answer>
convert (-h | --help)
Options:
-h --help Show this screen.
'''
from docopt import docopt
import base64
def convert(answer: str) -> bytes:
return base64.b64encode(answer.encode(... | cryvate/project-euler | project_euler/framework/convert.py | Python | mit | 438 |
# -*- coding: utf-8 -*-
#
# altimetry tools documentation build configuration file, created by
# sphinx-quickstart on Wed Oct 9 16:46:52 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... | rdussurget/py-altimetry | doc-source/conf.py | Python | lgpl-3.0 | 8,048 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Face.district_id'
db.add_column(u'faces_face', 'district_... | RuralIndia/pari | pari/faces/migrations/0006_auto__add_field_face_district_id.py | Python | bsd-3-clause | 11,120 |
from django.test import TestCase
from django.test.utils import override_settings
from django.conf import settings
from django.core import management
import unittest2 as unittest
from wagtail.wagtailsearch import models, get_search_backend
from wagtail.wagtailsearch.backends.db import DBSearch
from wagtail.wagtailsearch... | sahat/wagtail | wagtail/wagtailsearch/tests/test_backends.py | Python | bsd-3-clause | 6,230 |
#!/usr/bin/env python
"""\
Game button module.
"""
class Button(object):
def __init__(self, x, y):
self._x = x
self._y = y
def x(self):
return self._x
def y(self):
return self._y
| samitheberber/Tuqqna | tuqqna/core/button.py | Python | mit | 229 |
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from stdnum import iban
from sql import operators, Literal, Null
from sql.conditionals import Case
from trytond.model import ModelView, ModelSQL, fields
__all__ = ['Bank', '... | kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/bank/bank.py | Python | gpl-3.0 | 5,527 |
#-*- coding: utf-8 -*-
from .grant import Grant
from ..endpoint import AuthorizationEndpoint
class ImplicitGrant(Grant):
"""
The implicit grant type is used to obtain access tokens (it does not
support the issuance of refresh tokens) and is optimized for public
clients known to operate a particular r... | uptown/django-town | django_town/oauth2/grant/implicitgrant.py | Python | mit | 2,061 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import pytest
import json
import itertools
from unittest import SkipTest
from numpy.testing import assert_equal, assert_almost_equal
f... | kcompher/FreeDiscovUI | freediscovery/server/tests/test_various.py | Python | bsd-3-clause | 2,424 |
# -*- coding: iso-8859-1 -*-
import pyjd
#Ui components
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.FlowPanel import FlowPanel
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.Label import Label
from pyjamas.ui.Image import Image
from pyjamas.ui.SimplePanel import SimplePanel
from py... | minghuascode/pyj | examples/flowpanel/FlowPanel.py | Python | apache-2.0 | 1,863 |
__author__ = 'ralmn'
| ralmn/CMAsk | cmask/__init__.py | Python | unlicense | 21 |
"""
Sphinx Gallery
==============
"""
import os
# dev versions should have "dev" in them, stable should not.
# doc/conf.py makes use of this to set the version drop-down.
__version__ = '0.8.0.dev0'
def glr_path_static():
"""Returns path to packaged static files"""
return os.path.abspath(os.path.join(os.path.... | Titan-C/sphinx-gallery | sphinx_gallery/__init__.py | Python | bsd-3-clause | 351 |
#!/usr/bin/env python3
"""
max3v2.py : Deliberately broken code for returning the largest of three numbers
Copyright (C) Simon D. Levy 2016
This file is part of ISCPP.
ISCPP is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free ... | simondlevy/ISCPP | Chapter07/max3v2.py | Python | gpl-3.0 | 1,119 |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to us... | EmanueleCannizzaro/scons | test/MSVC/pch-basics.py | Python | mit | 2,054 |
"""
WSGI config for BlogSite project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | mfslog/TBlog | src/BlogSite/BlogSite/wsgi.py | Python | apache-2.0 | 1,142 |
# -*- coding: utf-8 -*-
"""Parse a MT940 ING file."""
##############################################################################
#
# Copyright (C) 2013-2015 Therp BV <http://therp.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pub... | lbelorgey/bank-statement-import | account_bank_statement_import_mt940_nl_ing/account_bank_statement_import.py | Python | agpl-3.0 | 1,824 |
from django.contrib.auth.models import User
from django.test import TestCase
from ..models import Node, Subject
from ..testhelper import TestHelper
class TestBaseNode(TestCase, TestHelper):
def setUp(self):
self.add(nodes="uio:admin(uioadmin).ifi:admin(ifiadmin,ifitechsupport)")
self.add(nodes="u... | vegarang/devilry-django | devilry/apps/core/tests/basenode.py | Python | bsd-3-clause | 1,801 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2014 sids <sids@siddharth-dev>
#
# Distributed under terms of the MIT license.
"""
Get users from checkins
"""
from utils import *
import sys
def get_users_from_checkins(filename, user_file):
tuples = read_csv_file_and_return_tuples(... | tribhuvanesh/foursquare-influence | data_prep/get_friendship_localized.py | Python | mit | 1,545 |
# A Behavior-based system
from pyrobot.brain.fuzzy import *
from pyrobot.brain.behaviors import *
from pyrobot.brain.behaviors.core import * # Stop
import math
from random import random
import time
class Avoid (Behavior):
def setup(self): # called when created
self.Effects('translate', .3)
self... | emilydolson/forestcat | pyrobot/plugins/brains/BBWanderAndCapture.py | Python | agpl-3.0 | 3,124 |
# -*- coding: utf-8 -*-
#
# Vintager documentation build configuration file, created by
# sphinx-quickstart on Mon Apr 18 21:44:40 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | liang-chen/Vintager | docs/conf.py | Python | mit | 10,384 |
# pypo2phppo unit tests
# Author: Wil Clouser <wclouser@mozilla.com>
# Date: 2009-12-03
from io import BytesIO
from translate.convert import test_convert
from translate.tools import pypo2phppo
class TestPyPo2PhpPo:
def test_single_po(self):
inputfile = b"""
# This user comment refers to: {0}
#. This dev... | miurahr/translate | translate/tools/test_pypo2phppo.py | Python | gpl-2.0 | 1,681 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-03-24 17:57
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('share', '0025_auto_20170315_1544'),
]
o... | CenterForOpenScience/SHARE | share/migrations/0026_auto_20170324_1757.py | Python | apache-2.0 | 930 |
"""Order 29: Open image with image url.
First, please install scikit-image
Refer to http://www.jb51.net/article/115136.htm
If install scipy failure, see https://www.youtube.com/watch?v=7GRl3gjkZN8
If has ImportError: DLL load failed, please download numpy wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
a... | flyingSprite/spinelle | task_inventory/order_1_to_30/order_29_open_image_with_url.py | Python | mit | 725 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
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, version 2 of the License (GPLv2).
This program is distributed in the hope that it will be useful, b... | biologyguy/public_scripts | ensembl_scraper.py | Python | gpl-2.0 | 3,745 |
from allianceauth.services.hooks import MenuItemHook, UrlHook
from allianceauth import hooks
from . import urls
class SrpMenu(MenuItemHook):
def __init__(self):
MenuItemHook.__init__(self, 'Ship Replacement',
'fa fa-money fa-fw',
'srp:management... | Adarnof/allianceauth | allianceauth/srp/auth_hooks.py | Python | gpl-2.0 | 699 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | BorgERP/borg-erp-6of3 | addons/account/account_invoice.py | Python | agpl-3.0 | 95,869 |
"""The tests for Netatmo device triggers."""
import pytest
import homeassistant.components.automation as automation
from homeassistant.components.device_automation import DeviceAutomationType
from homeassistant.components.netatmo import DOMAIN as NETATMO_DOMAIN
from homeassistant.components.netatmo.const import (
... | home-assistant/home-assistant | tests/components/netatmo/test_device_trigger.py | Python | apache-2.0 | 10,377 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Vincent MOUTIA"
__copyright__ = "Copyright 2016, Republicube"
__credits__ = ["Vincent MOUTIA"]
__license__ = "GPL"
__version__ = "Version 3, 29 June 2007"
__maintainer__ = "Vincent MOUTIA"
__email__ = "vincent.moutia@gmail.com"
__status__ = "Development"
im... | diamonedge/RepubliCube | uDataDatasetPage.py | Python | gpl-3.0 | 1,792 |
# Copyright 2013 - 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
#
# Unless required by applicable law or agreed to in writi... | ed-/solum | solum/common/exception.py | Python | apache-2.0 | 8,731 |
def rotate(A):
return A[1:] + A[:1]
def part1(n):
s = [(0,0,1)]
x, y = 0, 0
i = 2
j = 1
while i <= n:
for _ in range(j):
if i > n:
break
if j%2 == 0:
x -= 1
else:
x += 1
s.append((x,y,i))
... | kevinlmadison/advent_of_code | 3_year_2017/day03/aoc3.py | Python | gpl-3.0 | 1,544 |
# 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... | alsrgv/tensorflow | tensorflow/python/tools/api/generator/create_python_api.py | Python | apache-2.0 | 22,313 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of Mylar.
#
# Mylar 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 vers... | evilhero/mylar | mylar/webstart.py | Python | gpl-3.0 | 7,551 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('autodeploy', '0013_auto_20150817_1250'),
]
operations = [
migrations.AlterField(
model_name='pro... | mkalioby/AutoDeploy | webapp/autoDeploy/autodeploy/migrations/0014_auto_20160514_1317.py | Python | gpl-2.0 | 657 |
#!/usr/bin/env python
#
# Copyright 2004,2007,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 ... | RedhawkSDR/integration-gnuhawk | qa/tests/qa_pll_freqdet.py | Python | gpl-3.0 | 6,026 |
import datetime
import itertools
import unittest
from copy import copy
from django.db import (
DatabaseError, IntegrityError, OperationalError, connection,
)
from django.db.models import Model
from django.db.models.deletion import CASCADE, PROTECT
from django.db.models.fields import (
AutoField, BigIntegerFiel... | sgzsh269/django | tests/schema/tests.py | Python | bsd-3-clause | 97,864 |
# Unit tests for typecast functions in django.db.backends.util
from django.db.backends import util as typecasts
import datetime, unittest
TEST_CASES = {
'typecast_date': (
('', None),
(None, None),
('2005-08-11', datetime.date(2005, 8, 11)),
('1990-01-01', datetime.date(1990, 1, 1)... | jamslevy/gsoc | thirdparty/google_appengine/lib/django/tests/regressiontests/db_typecasts/tests.py | Python | apache-2.0 | 2,055 |
from flask import Blueprint
blueprint = Blueprint('home', __name__, template_folder='templates')
from app.home import endpoints
| buckbaskin/Insight | flaskserver/app/home/__init__.py | Python | apache-2.0 | 131 |
# The Hazard Library
# Copyright (C) 2012-2016 GEM Foundation
#
# 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.
#... | rcgee/oq-hazardlib | openquake/hazardlib/tests/correlation_test.py | Python | agpl-3.0 | 6,453 |
## python
import os
import shutil
import re
import math
import sys
import pwd
import time
import random
import socket
import string
import inspect
import subprocess
import cPickle
## appion
from appionlib import apDisplay
####
# This is a low-level file with NO database connections
# Please keep it this way
####
#=... | vossman/ctfeval | appionlib/apParam.py | Python | apache-2.0 | 17,708 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | adviti/melange | thirdparty/google_appengine/google/storage/speckle/python/tool/google_sql.py | Python | apache-2.0 | 6,404 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2010, Gerendi Sandor Attila'
__docformat__ = 'restructuredtext en'
"""
RTF tokenizer and token parser. v.1.0 (1/17/2010)
Author: Gerendi Sandor Attila
At this poin... | jelly/calibre | src/calibre/ebooks/rtf/preprocess.py | Python | gpl-3.0 | 11,983 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.utils.html import format_html
from ..models import DatabaseMaintenanceTask
class DatabaseMaintenanceTaskAdmin(admin.ModelAdmin):
list_select_re... | globocom/database-as-a-service | dbaas/maintenance/admin/database_maintenance_task.py | Python | bsd-3-clause | 2,758 |
'''Basic strict go game logic.
'''
import enum
import re
import numpy as np
import itertools as it
@enum.unique
class State(enum.Enum):
empty = 0
black = 1
white = 2
@property
def enemy(self):
'Return the enemy of this player (for empty, return self).'
if self is State.black:
... | DouglasOrr/Snippets | sillygo/sillygo/game.py | Python | mit | 9,570 |
from kernel.controllers import blueprint
@blueprint.route('/tools')
def tools():
from kernel.models.core import tool_session, Tool
ids = []
names = []
rows = tool_session.query(Tool.id, Tool.name)
for row in rows:
ids.append(row[0])
names.append(row[1])
from flask import render_template
return rende... | Mimalef/paasta | src/kernel/controllers/tools.py | Python | mit | 400 |
from django.db import models
from django.utils import timezone
class Reindexing(models.Model):
"""Used to flag when an elasticsearch reindexing is occuring."""
start_date = models.DateTimeField(default=timezone.now)
alias = models.CharField(max_length=255)
old_index = models.CharField(max_length=255, ... | diox/zamboni | lib/es/models.py | Python | bsd-3-clause | 1,624 |
from ImageScripter import *
from elan import *
Say('two')
| kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/elan/Backup Pools/test2/2_two.py | Python | gpl-3.0 | 60 |
"""
Contains the core building blocks of the framework.
"""
import math
from copy import deepcopy
import pandas as pd
import numpy as np
import cython as cy
class Node(object):
"""
The Node is the main building block in bt's tree structure design.
Both StrategyBase and SecurityBase inherit Node. It cont... | dingmingliu/quanttrade | bt/core.py | Python | apache-2.0 | 37,660 |
import lcm
from lilylcm import 03Citrus
def my_handler(channel, data):
msg = 03Citrus.decode(data)
print("Received message on channel /"%s/"" % channel)
print(" value = %s" % str(msg.value))
print("")
lc = lcm.LCM()
subscription = lc.subscribe("03Citrus", my_handler)
try:
while True:
... | WeirdCoder/LilyPadOS | 04Dan/RandomStuff/listener.py | Python | mit | 403 |
'''Main simulation run: Simulation of a stationary bump.'''
from __future__ import absolute_import, print_function, division
from numpy.random import choice
from nest.hl_api import NESTError
from grid_cell_model.models.parameters import getOptParser
from grid_cell_model.models.gc_net_nest import BasicGridCellNetwork
... | MattNolanLab/ei-attractor | grid_cell_model/simulations/common/simulation_stationary.py | Python | gpl-3.0 | 3,476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.