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 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 applicable ... | hopshadoop/hops-tensorflow | yarntf/examples/slim/nets/inception.py | Python | apache-2.0 | 1,614 |
import json
from uuid import uuid4
from wmt.flask import create_app
from nose.tools import (assert_equal, assert_is_instance, assert_dict_equal,
assert_list_equal, assert_less_equal)
from .tools import (assert_401_unauthorized, assert_404_not_found,
assert_403_forbidden, as... | mcflugen/wmt-rest | wmt/flask/tests/test_sims.py | Python | mit | 2,948 |
#!/usr/bin/env python
# Copyright (c) 2011 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 code
import getpass
import logging
import os
import sys
ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..... | nicko96/Chrome-Infra | appengine/chromium_status/tools/remote_api.py | Python | bsd-3-clause | 2,605 |
import os
import sys
import numpy as np
sys.path.append("/usr/custom/pyLIMA-1.0.0")
from pyLIMA import event, telescopes, microlmodels
from pyLIMA_functions import chi2_telescope
t_0 = 2456900.
u_0 = 0.1
t_E = 50.
pi_E_N = 0.6
pi_E_E = 0.8
pi_E_N = -pi_E_N
pi_E_E = -pi_E_E
file_1 = "test_1000_piE.txt"
data_1 = np.... | rpoleski/MulensModel | examples/run_time_tests/pyLIMA_setup_2_1000.py | Python | mit | 735 |
from django.db import models
class Task(models.Model):
title = models.CharField(max_length=255, blank=False)
link = models.CharField(max_length=512, blank=False)
description = models.CharField(max_length=2048, blank=False)
# key = models.CharField(max_length=512, blank=False)
class Meta:
... | dockerparis/Hive | doct/app/models.py | Python | mit | 1,371 |
"""YAUS URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based... | KareemSalah/YAUS | YAUS/urls.py | Python | mit | 893 |
#!/usr/bin/env python
# Copyright 2015 Software Freedom Conservancy
# Copyright 2008-2009 WebDriver committers
# Copyright 2008-2009 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 ... | clavery/selenium | setup.py | Python | apache-2.0 | 3,776 |
"""
.. module:: artist_attribute_type
The **Artist Attribute Type** Model.
PostgreSQL Definition
---------------------
The :code:`artist_attribute_type` table is defined in the MusicBrainz Server as:
.. code-block:: sql
CREATE TABLE artist_attribute_type ( -- replicate (verbose)
id SER... | marios-zindilis/musicbrainz-django-models | musicbrainz_django_models/models/artist_attribute_type.py | Python | gpl-2.0 | 947 |
# Copyright 2022 Google 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-2.0
#
# Unless required by applicable law o... | GoogleCloudPlatform/declarative-resource-client-library | python/services/iam/alpha/role.py | Python | apache-2.0 | 11,213 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 - 2017 Jannes Höke <uno@jhoeke.de> and Karho Yau
#
# 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 Fr... | pythonalliance/uno2bot | game.py | Python | agpl-3.0 | 3,863 |
#!/usr/bin/env python
import copy
import importlib
import logging
import logging.handlers
import os
import re
import sys
import six
from saml2 import root_logger, BINDING_URI, SAMLError
from saml2 import BINDING_SOAP
from saml2 import BINDING_HTTP_REDIRECT
from saml2 import BINDING_HTTP_POST
from saml2 import BINDIN... | kawamon/hue | desktop/core/ext-py/pysaml2-4.9.0/src/saml2/config.py | Python | apache-2.0 | 17,845 |
# 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
# distrib... | nttcom/eclcli | eclcli/api/utils.py | Python | apache-2.0 | 3,128 |
import os, sys
import threading
from skitai import DB_PGSQL, DB_SQLITE3, DB_REDIS, DB_MONGODB, DB_SYN_PGSQL, PROTO_SYN_HTTP, PROTO_SYN_HTTPS
from ..corequest.httpbase import cluster_manager, task, sync_proxy
from ..corequest.dbi import cluster_manager as dcluster_manager, task as dtask
from sqlphile import Template
fro... | hansroh/skitai | skitai/wastuff/async_service.py | Python | mit | 8,934 |
# Copyright 2018 FOREST AND BIOMASS ROMANIA SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountAccountTag(models.Model):
_inherit = "account.account.tag"
account_ids = fields.Many2many(
comodel_name="account.account",
relation... | OCA/account-financial-tools | account_menu/models/account_tag.py | Python | agpl-3.0 | 385 |
#!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| ... | huiyiqun/check_mk | cmk/translations.py | Python | gpl-2.0 | 3,117 |
###
# Test that decorators return the appropriate object.
# David Huard
# June 21, 2007
###
###
# TODO
# ----
# Add test for deterministic
# Check discrete and binary stochastics
# Test the distribution instantiators.
###
from numpy.testing import *
import pymc
from pymc import Sampler, data, stochastic, deterministi... | matthew-brett/pymc | pymc/tests/test_instantiation.py | Python | mit | 3,371 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import string
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.utils.tex... | averagehuman/django-instance | instance/models.py | Python | bsd-3-clause | 3,371 |
# -*- coding: utf-8 -*-
# Copyright 2013 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 require... | endlessm/chromium-browser | third_party/catapult/third_party/gsutil/gslib/tests/testcase/unit_testcase.py | Python | bsd-3-clause | 16,831 |
from flask import current_app
from sqlalchemy.orm.exc import NoResultFound
from app import celery
from app.dao.events_dao import dao_get_event_by_id, dao_update_event
from app.errors import PaypalException
from app.payments.paypal import PayPal
@celery.task(bind=True)
def create_update_paypal_button_task(self, event... | NewAcropolis/api | app/na_celery/paypal_tasks.py | Python | mit | 1,513 |
"""
Generalized additive models
Requirements for smoothers
--------------------------
smooth(y, weights=xxx) : ? no return ? alias for fit
predict(x=None) : smoothed values, fittedvalues or for new exog
df_fit() : degress of freedom of fit ?
Notes
-----
- using PolySmoother works for AdditiveModel, and GAM with P... | hlin117/statsmodels | statsmodels/sandbox/gam.py | Python | bsd-3-clause | 15,421 |
import os
import shutil
import random
import string
from types import SimpleNamespace
from subprocess import Popen, PIPE, STDOUT
import pytest
from golem.cli import commands
from golem.core import settings_manager, suite, test, session, page, utils
from golem.report.execution_report import get_execution_data, suite_e... | lucianopuccio/golem | tests/conftest.py | Python | mit | 11,214 |
#! /usr/bin/python3.6
# -*- coding: utf-8 -*-
#
# Demonstrates why use typing - this does not and it will fail. Why?
#
import typing
from typing import Dict
def get_first_name(full_name: str) -> str:
return full_name.split(" ")[0]
fallback_name: Dict[str, str] = {
"first_name": "UserFirstName",
"last_n... | jeffsilverm/presentation | whats_new_in_python_3.6/python2_files/typing_epic_fail_BUT.py | Python | gpl-2.0 | 614 |
from __future__ import absolute_import
from . import backend as K
class Constraint(object):
def __call__(self, p):
return p
def get_config(self):
return {"name": self.__class__.__name__}
class MaxNorm(Constraint):
def __init__(self, m=2):
self.m = m
def __call__(self, p):
... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/keras/constraints.py | Python | gpl-2.0 | 1,076 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import django
from django.db import models
from django import forms
import offermaker
class MyForm(forms.Form):
product = forms.ChoiceField(
label='Product',
choices=(
('', '---... | kkujawinski/django-offermaker | offermaker/tests2/models.py | Python | lgpl-3.0 | 1,502 |
#!/usr/bin/env python
import os
import sys
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
},
MIDDLEWARE=(),
... | mlavin/django-selectable | runtests.py | Python | bsd-2-clause | 1,061 |
#!/usr/bin/env python
# [08/06/13] Challenge #134 [Easy] N-Divisible Digits
# url: http://www.reddit.com/r/dailyprogrammer/comments/1jtryq/080613_challenge_134_easy_ndivisible_digits/
def main():
n, m = map(int, raw_input().split())
i = 10**n - 1
result = None
while i > 0:
if i % m == 0... | miguelgazela/reddit-dailyprogrammer | challenge_134.py | Python | mit | 539 |
# encoding: utf-8
from __future__ import print_function
import os
from argparse import ArgumentParser
from websocket_server import start_server
from db import database
from models import __all__, User
import migrations
parser = ArgumentParser()
subparsers = parser.add_subparsers()
parser_start = subparsers.add_parser... | patrickporto/python-box | server/__main__.py | Python | mit | 2,071 |
import errno
import mailbox
import os
import threading
import mailpile.mailboxes
from mailpile.i18n import gettext as _
from mailpile.i18n import ngettext as _n
from mailpile.mailboxes import MBX_ID_LEN, NoSuchMailboxError
from mailpile.util import *
class MailpileMailbox(mailbox.mbox):
"""A mbox class that supp... | laborautonomo/Mailpile | mailpile/mailboxes/mbox.py | Python | apache-2.0 | 6,202 |
# 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 ... | rjschwei/azure-sdk-for-python | azure-keyvault/azure/keyvault/generated/models/key_bundle.py | Python | mit | 1,749 |
"""
A theano / pylearn2 wrapper for Alex Krizhevsky's cuda-convnet
software.
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2010-2012, Universite de Montreal"
__credits__ = ["Ian Goodfellow"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
__email__ = "pylearn-dev@googlegroups"
"""
This module ... | junbochen/pylearn2 | pylearn2/sandbox/cuda_convnet/__init__.py | Python | bsd-3-clause | 3,207 |
#-*- coding: utf-8 -*-
"""
Unit tests for video-related REST APIs.
"""
import csv
import json
import re
from datetime import datetime
from functools import wraps
from StringIO import StringIO
from contextlib import contextmanager
import dateutil.parser
import ddt
import pytz
from django.conf import settings
from djang... | philanthropy-u/edx-platform | cms/djangoapps/contentstore/views/tests/test_videos.py | Python | agpl-3.0 | 56,071 |
##
# Copyright 2009-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | pescobar/easybuild-easyblocks | easybuild/easyblocks/m/mrtrix.py | Python | gpl-2.0 | 5,093 |
"""
Unit tests for layout functions.
"""
import os, sys
import tempfile
from nose import SkipTest
from nose.tools import assert_equal
import networkx as nx
class TestLayout(object):
@classmethod
def setupClass(cls):
global numpy
try:
import numpy
except ImportError:
... | JaneliaSciComp/Neuroptikon | Source/lib/CrossPlatform/networkx/drawing/tests/test_layout.py | Python | bsd-3-clause | 1,709 |
from indy import ledger
import json
import pytest
@pytest.mark.asyncio
async def test_build_get_txn_request_works(did_trustee):
seq_no = 1
expected_response = {
"identifier": did_trustee,
"operation": {
"type": "3",
"data": 1,
"ledgerId": 1
}
}
... | Artemkaaas/indy-sdk | wrappers/python/tests/ledger/test_build_get_txn_request.py | Python | apache-2.0 | 901 |
# shortest edit distance algorithm
# an example of dynamical programing
from ex_class_tree import tree
strr = raw_input('Input the original and the target string\n').split()
origin = strr[0]
target = strr[1]
o = len(origin)
t = len(target)
def f(i,j):
if origin[i] == target[j]:
return 0
else:
... | WilliamRy/python_ex | edit_distance_problem/ad_shorteditdistance.py | Python | mit | 1,979 |
'''
Created on 01.11.2013
@author: gena
'''
from PyQt4 import QtGui
from escore.well import Well
class WellWidget(QtGui.QDialog):
'''
Widget to edit well type (reference or experiment) and reference concentration
'''
def __init__(self, well, parent=None):
'''
Constructor
'''
... | GennadiyZakharov/elisasolver | src/esgui/wellwidget.py | Python | lgpl-3.0 | 2,750 |
# Copyright 2013 Raihan Kibria
#
# This file is part of Pyco https://github.com/rkibria/Pyco
#
# Pyco 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 ... | rkibria/Pyco | consolewidget.py | Python | gpl-3.0 | 5,045 |
#!/usr/bin/env python3
#
# Tests the MCMC Controller.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import os
import pints
import pints.io
import pints.toy
import un... | martinjrobins/hobo | pints/tests/test_mcmc_controller.py | Python | bsd-3-clause | 74,685 |
'''module to define a class to present a list of thumbnails'''
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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 ... | tiancj/emesene | emesene/gui/gtkui/IconView.py | Python | gpl-3.0 | 8,303 |
# encoding: utf-8
# module samba.dcerpc.lsa
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/lsa.so
# by generator 1.135
""" lsa DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class lsarpc(__dcerpc.ClientConnection):
"""
lsarpc(binding, lp_ctx=None, credentials=None) -> connect... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/lsa/lsarpc.py | Python | gpl-2.0 | 13,215 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.style.use('ggplot')
cols1 = [
"problem",
"p1_e1",
"p1_e2",
"p1_e3",
"p1_e4",
"p2_e2",
"p2_e3",
"p2_e4",
"p3_e3",
"p3_e4",
"p4_e4",
"p4_e6",
"p4_e8",
"p4_e12",
... | verdverm/pypge | experiments/post_process/08_speedup/graph.py | Python | mit | 2,559 |
#!/usr/bin/env python
__author__ = "Mike McCann"
__copyright__ = "Copyright 2012, MBARI"
__credits__ = ["Chander Ganesan, Open Technology Group"]
__license__ = "GPL"
__maintainer__ = "Mike McCann"
__email__ = "mccann at mbari.org"
__status__ = "Development"
__doc__ = '''
This is the STOQS database model. The database... | PiRSquared17/stoqs | stoqs/models.py | Python | gpl-3.0 | 25,081 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import sys
if sys.version_info[0] == 3:
xrange = range
from .shared import shared_function
class TimeSecondary:
... | ericdill/asv | test/benchmark/time_secondary.py | Python | bsd-3-clause | 667 |
from nose.tools import * # flake8: noqa
from api.base import settings
from tests.base import ApiTestCase
# The versions below are specifically for testing purposes and do not reflect the actual versioning of the API.
# If changes are made to this list, or to DEFAULT_VERSION, please reflect those changes in:
# api/... | acshi/osf.io | api_tests/base/test_versioning.py | Python | apache-2.0 | 6,291 |
###################################################################################################
# Author: Jodi Jones <venom@gen-x.co.nz>
# URL: https://github.com/VeNoMouS/Sick-Beard
#
# This file is part of Sick Beard.
#
# Sick Beard is free software: you can redistribute it and/or modify
# it under the terms of t... | AlexBoogaard/Sick-Beard-Torrent-Edition | sickbeard/providers/torrentleech.py | Python | gpl-3.0 | 10,354 |
#!/usr/bin/env python
#Copyright (c) 2011, Paul Jennings <pjennings-tstat@pjennings.net>
#All rights reserved.
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above... | JoakimLindbom/agocontrol | devices/radiothermostat/TStatAPI.py | Python | gpl-3.0 | 6,819 |
from __future__ import print_function # Python 2/3 compatibility
import boto3
import json
import decimal
dynamodb = boto3.resource('dynamodb', region_name='us-east-2')
table = dynamodb.Table('catalogue')
with open("objets_22_06_17_v2.json") as json_file:
catalogue = json.load(json_file,encoding='utf-8')
for... | lexdum/sharebot | push_to_dynamodb.py | Python | epl-1.0 | 1,024 |
"""Pluggable auth modules for Home Assistant."""
from __future__ import annotations
import importlib
import logging
import types
from typing import Any
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant import data_entry_flow, requirements
from homeassistant.const import CONF_... | jawilson/home-assistant | homeassistant/auth/mfa_modules/__init__.py | Python | apache-2.0 | 5,419 |
#!/usr/bin/env python
import sys, re, os.path
import json
import logging
from pprint import pformat
from string import Template
if sys.version_info[0] >= 3:
from io import StringIO
else:
from cStringIO import StringIO
# list of class names, which should be skipped by wrapper generator
# the list is loaded fr... | zzjkf2009/Midterm_Astar | opencv/modules/java/generator/gen_java.py | Python | mit | 47,317 |
#!/usr/bin/env python
"""
read hosts format device names from stdin (ip,name)
get sysName, sysDescr
"""
import fileinput
from snmp_helper import snmp_get_oid, snmp_extract
COMMUNITY_STRING = 'galileo'
SNMP_PORT = 161
IP = '184.105.247.70'
OID = '.1.3.6.1.2.1.1.1.0'
for line in fileinput.input():
print "\n%s" %l... | patrebert/pynet_cert | class2/ex4.py | Python | apache-2.0 | 629 |
# refilling_switch_off.py by JB@KIT 12/2015 jochen.braumueller@kit.edu
# client script to be run on the control machine (Raspberry Pi) to switch on nitrogen refilling, server script needs to be running
# use: only from remote as emergency
# This program is free software; you can redistribute it and/or modify
# it unde... | qkitgroup/qkit | qkit/services/raspi_misc/nitrogen/refilling_switch_off.py | Python | gpl-2.0 | 2,038 |
import datetime
import io
import os
import pytest
import re
import subprocess
from io import StringIO
from unittest import mock
from dcicutils.qa_utils import override_environ
from ..generate_production_ini import FourfrontDeployer
TEMPLATE_DIR = FourfrontDeployer.TEMPLATE_DIR
build_ini_file_from_template = Fourfro... | 4dn-dcic/fourfront | deploy/tests/test_generate_production_ini.py | Python | mit | 21,104 |
# -*- coding: utf-8 -*-
#
# s3fields unit tests
#
# To run this script use:
# python web2py.py -S eden -M -R applications/eden/modules/unit_tests/s3/s3fields.py
#
import unittest
from gluon.languages import lazyT
from gluon.dal import Query
from s3.s3fields import *
# ==================================================... | gnarula/eden_deployment | modules/unit_tests/s3/s3fields.py | Python | mit | 47,235 |
""" Utilities for testing TDMS reading
"""
import binascii
from contextlib import contextmanager
import os
from io import BytesIO
import struct
import tempfile
import numpy as np
from nptdms import tdms
try:
long
except NameError:
# Python 3
long = int
def string_hexlify(input_string):
"""Return h... | adamreeve/npTDMS | nptdms/test/util.py | Python | lgpl-3.0 | 9,937 |
# validate.py
# -*- coding: utf-8 -*-
# pylint: disable=
#
# A Validator object.
#
# Copyright (C) 2005-2014:
# (name) : (email)
# Michael Foord: fuzzyman AT voidspace DOT org DOT uk
# Mark Andrews: mark AT la-la DOT com
# Nicola Larosa: nico AT tekNico DOT net
# Rob Dennis: rdennis AT gmail DOT com
# Eli Courtwright: ... | psychopy/versions | psychopy/contrib/configobj/validate.py | Python | gpl-3.0 | 46,989 |
from django.db import transaction
from django.conf import settings
from django.contrib import admin
from django.contrib.auth.forms import UserCreationForm, UserChangeForm, AdminPasswordChangeForm
from django.contrib.auth.models import User, Group
from django.contrib import messages
from django.core.exceptions import Pe... | bufferapp/buffer-django-nonrel | django/contrib/auth/admin.py | Python | bsd-3-clause | 6,585 |
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404, redirect
from django.utils import timezone
from django.utils.http import is_safe_url
from django.utils.translation import gettext as _
from django.views.decorators.http import require_POST
from wagtail.admin import mess... | kaedroho/wagtail | wagtail/admin/views/pages/lock.py | Python | bsd-3-clause | 1,923 |
from unittest.mock import patch
from emupy6502.memory_controller import MemoryController
from emupy6502.registers import Registers
from emupy6502.opcodes import OpCode
def test_set_NZ_non_zero_positive():
registers = Registers()
registers.set_NZ(1)
assert registers.negative_flag == False
assert regis... | crispg72/6502py | tests/test_registers.py | Python | mit | 1,549 |
"""
Trigger Twisted XMLRPC server with an SSH manhole. Supports SSL.
This provides a daemonized Twisted reactor loop, Trigger and client
applications do not have to co-habitate. Using the XMLRPC server model, all
Trigger compatibility tasks can be executed using simple XMLRPC clients that
call the appropriate method w... | coxley/trigger | trigger/contrib/xmlrpc/server.py | Python | bsd-3-clause | 7,760 |
## http://stackoverflow.com/questions/1944569/how-do-i-write-good-correct-package-init-py-files
# __all__ = ['foofactories', 'tallFoos', 'shortfoos', 'medumfoos',
# 'santaslittlehelperfoo', 'superawsomefoo', 'anotherfoo']
# # deprecated to keep older scripts who import this from breaking
# from foo.foofactor... | I2Cvb/hyper_learn | src/sampling_strategy/__init__.py | Python | mit | 462 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | haxwithaxe/qutebrowser | tests/integration/features/test_yankpaste.py | Python | gpl-3.0 | 1,565 |
'''David Naccache based Identity-Based Encryption
| From: "David Naccache Secure and Practical Identity-Based Encryption Section 4"
| Available from: http://eprint.iacr.org/2005/369.pdf
* type: encryption (identity-based)
* setting: bilinear groups (asymmetric)
:Authors: Gary Belvin
:Date: 06/2011
'''
from c... | lferr/charm | charm/schemes/ibenc/ibenc_waters05.py | Python | lgpl-3.0 | 4,212 |
"""Usage: run.py [--host=<host>] [--port=<port>] [--debug | --no-debug]
--host=<host> set the host address or leave it to 0.0.0.0.
--port=<port> set the port number or leave it to 5000.
"""
from docopt import docopt
arguments = docopt(__doc__, version='0.1dev')
host = arguments['--host']
port = arguments['--port... | wd15/corr | corr-cloud/run.py | Python | mit | 485 |
#!/usr/bin/env python
#
# Copyright 2012 Dominic Rout
#
# 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 ... | domrout/python-twitter-wrapper | twitterwrapper/__init__.py | Python | apache-2.0 | 826 |
# import_export_batches/controllers_ballotpedia.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from .models import create_batch_from_json_wrapper, BATCH_HEADER_MAP_BALLOT_ITEMS_TO_BALLOTPEDIA_BALLOT_ITEMS, \
BATCH_HEADER_MAP_CANDIDATES_TO_BALLOTPEDIA_CANDIDATES, BATCH_HEADER_MAP_CONTEST_OFFICES_T... | wevote/WeVoteServer | import_export_batches/controllers_ballotpedia.py | Python | mit | 3,545 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | davidvon/pipa-pay-server | site-packages/pbr/__init__.py | Python | apache-2.0 | 610 |
#!/usr/bin/env python
"""
Artificial Intelligence for Humans
Volume 3: Deep Learning and Neural Networks
Python Version
http://www.aifh.org
http://www.jeffheaton.com
Code repository:
https://github.com/jeffheaton/aifh
Copyright 2015 by Jeff Heaton
Licensed under the Apache License, V... | PeterLauris/aifh | vol3/vol3-python-examples/examples/example_iris_anneal.py | Python | apache-2.0 | 4,527 |
# Generated by Django 2.2.10 on 2020-03-15 17:25
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("zerver", "0269_gitlab_auth"),
]
operations = [
migrations.AddField(
model_name="huddle",
... | rht/zulip | zerver/migrations/0270_huddle_recipient.py | Python | apache-2.0 | 508 |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import HttpCase, tagged
@tagged('post_install', '-at_install')
class TestSitemap(HttpCase):
def setUp(self):
super(TestSitemap, self).setUp()
self.cats = self.env['product.public.category'].create([{
... | jeremiahyan/odoo | addons/website_sale/tests/test_sitemap.py | Python | gpl-3.0 | 838 |
from django.db import models
import hashlib
import uuid
from datetime import datetime
from django.utils import timezone
salt = 'authsecretkey'
atoken_lifetime = 300
rtoken_lifetime = 36000
agcode_lifetime = 15
# Create your models here.
class User(models.Model):
uname = models.CharField(max_length=100, primary_... | Boris-Barboris/rsoi | lab01/authserver/lab01_authserver/lab01_authserver_app/models.py | Python | mit | 4,989 |
"""Copyright (c) 2008 Texas A&M University
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | Frikanalen/mltplayout | lib/twistedschedule/test/__init__.py | Python | gpl-3.0 | 1,072 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | AlexanderSk/fail2ban | fail2ban/server/banmanager.py | Python | gpl-2.0 | 5,493 |
# forkbomb is a module that partitions arbitrary workloads
# among N seperate forks, for a configurable N, and
# collates results upon return, as if it never forked.
#
# Copyright 2007, Red Hat, Inc
# Michael DeHaan <mdehaan@redhat.com>
#
# This software may be freely redistributed under the terms of the GNU
# general ... | caglar10ur/func | func/forkbomb.py | Python | gpl-2.0 | 4,584 |
"""
A component which allows you to update your custom cards and components.
For more details about this component, please refer to the documentation at
https://github.com/custom-components/custom_updater
"""
import logging
import os.path
from datetime import timedelta
import voluptuous as vol
from aiohttp import web... | shire210/Shire-HA | custom_components/custom_updater.py | Python | mit | 11,681 |
# Joey Velez-Ginorio
# Gridworld Implementation
# ---------------------------------
from mdp import MDP
from grid import Grid
from scipy.stats import uniform
from scipy.stats import beta
from scipy.stats import expon
import numpy as np
import random
import pyprind
import matplotlib.pyplot as plt
class GridWorld(MDP):... | joeyginorio/Action-Understanding-with-Rational-Rules | model_src/grid_world.py | Python | mit | 9,591 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-09 20:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bb', '0021_player_is_active'),
]
operations = [
migrations.AlterModelOptions... | yemmitt/bb_website | bb_django/mysite/bb/migrations/0022_auto_20170209_2115.py | Python | mit | 771 |
from __future__ import absolute_import
import time
import itertools
from nose import SkipTest
from celery.datastructures import ExceptionInfo
from celery.tests.utils import Case
def do_something(i):
return i * i
def long_something():
time.sleep(1)
def raise_something(i):
try:
raise KeyError... | mozilla/firefox-flicks | vendor-local/lib/python/celery/tests/concurrency/test_pool.py | Python | bsd-3-clause | 2,347 |
# -*- coding: utf-8 -*-
#
# Copyright 2015 Simone Campagna
#
# 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... | simone-campagna/invoice | tests/unittests/test_invoice_main_stats_client.py | Python | apache-2.0 | 5,269 |
import socket
import time
class SensorTCPServer:
'''
Server for Galileo with connected ANT HRM
'''
def startServer(self, serverAddr, handler):
'''
Open a new socket and bind it to serverAddr
'''
self.handler = handler
self.socket = socket.socket()
self.s... | nputikhin/simple-ant-hrm | SimpleHRMServer/sensorserver.py | Python | mit | 2,312 |
#!/usr/bin/env python
# Copyright 2014-2019 The PySCF Developers. 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
#
# U... | gkc1000/pyscf | pyscf/prop/nsr/uks.py | Python | apache-2.0 | 2,350 |
from oldowan.mtconvert import seq2sites, sites2seq, str2sites
from oldowan.fasta import fasta
from string import translate
import pandas as pd
import sys
sys.path.append('../../scripts')
from utils import *
## load metadata
metadata = pd.read_csv('metadata.csv', index_col=0)
region = range2region(metadata.ix[0, 'SeqR... | ryanraaum/african-mtdna | popdata_sources/lippold2014/process.py | Python | cc0-1.0 | 1,543 |
"""
.. module:: pipeline
:platform: Unix, OSX
:synopsis: A wrapper module for executing commands and logging their output.
.. moduleauthor:: Daniel Gaston <daniel.gaston@dal.ca>
"""
import sys
import subprocess as sub
def run_and_log_command(command, logfile):
"""This function uses the python subprocess... | dgaston/ddbio-ngsflow | ddb_ngsflow/pipeline.py | Python | mit | 1,788 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import lib.jobs as jobs
import lib.utils as utils
from django.utils.translation import ugettext as _
logger = logging.getLogger('uprilogger')
def toggle_vpn(state):
try:
if state in ['yes', 'no']:
try:
... | usableprivacy/upribox | upribox_interface/vpn/jobs.py | Python | gpl-3.0 | 2,800 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 OpenStack, LLC
#
# Copyright 2011 Fourth Paradigm Development, Inc.
#
# Licensed under the Apach... | CiscoSystems/dashboard-quantum-beta | openstack-dashboard/tools/install_venv.py | Python | apache-2.0 | 5,195 |
# coding: utf-8
# In[ ]:
import ensembles as en
import pandas as pd
import numpy as np
import xgboost as xgb
import category_encoders as ce
from sklearn import datasets, linear_model, preprocessing, grid_search
from sklearn.preprocessing import Imputer, PolynomialFeatures, StandardScaler
from sklearn.tree import Dec... | unnati-xyz/ensemble-package | ensembles/Examples/Multi Layer Perceptron/Multi Layer Perceptron.py | Python | mit | 3,812 |
#! /usr/bin/env python
#
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) Michigan State University, 2009-2015. It is licensed under
# the three-clause BSD license; see LICENSE.
# Contact: khmer-project@idyll.org
#
from __future__ import print_function
import sys
import khmer
impo... | F1000Research/khmer | sandbox/stoptag-abundance-hist.py | Python | bsd-3-clause | 1,219 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import serialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import... | tysonholub/twilio-python | twilio/rest/chat/v1/service/channel/__init__.py | Python | mit | 20,375 |
from django.contrib import admin
from apps.models import Weibo, Topic, Category, Comment, Tags, UserProfile
# Register your models here.
admin.site.register(Weibo)
admin.site.register(Topic)
admin.site.register(Category)
admin.site.register(Comment)
admin.site.register(Tags)
admin.site.register(UserProfile)
| WeiBoS1/WeiBo | apps/admin.py | Python | apache-2.0 | 311 |
#!/usr/bin/env python
from setuptools import setup
setup(
name='chronos',
version='0.3',
description='An ncurses stopwatch/timer.',
long_description=open('README.rst').read() + "\n\n" + open('HISTORY.rst').read(),
author='Nick Sinopoli',
author_email='nsinopoli@gmail.com',
url='http://git.... | NSinopoli/chronos | setup.py | Python | bsd-3-clause | 1,214 |
from .base import Format
from .csv_context import Csv
from .cxt import iter_cxt_lines, Cxt
from .fimi import Fimi, read_concepts_dat, write_concepts_dat
from .python_literal import PythonLiteral
from .table import Table
from .wiki_table import WikiTable
__all__ = ['Format',
'Csv',
'iter_cxt_lines... | xflr6/concepts | concepts/formats/__init__.py | Python | mit | 464 |
from django import forms
from django.contrib import admin
from pagedown.widgets import AdminPagedownWidget
from events.models import Event
class EventsForm(forms.ModelForm):
description = forms.CharField(widget=AdminPagedownWidget())
class EventsAdmin(admin.ModelAdmin):
form = EventsForm
admin.site.regist... | StephenOrJames/UBinE | events/admin.py | Python | mit | 343 |
# This file is part of PARPG.
# PARPG 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.
# PARPG is distributed in the hope ... | parpg/parpg | parpg/gui/actionsbox.py | Python | gpl-3.0 | 2,938 |
#!/usr/bin/env python3
# Sprax Lines 2016.09.26 Written for Python 3.5
'''Output some dates.'''
import argparse
import datetime as dt
from datetime import date
from datetime import datetime
import re
import time
import text_ops
from utf_print import utf_print
# DAY_CODES = ['Mnd', 'Tsd', 'Wnd', 'Thd', 'F... | sprax/python | txt/dates.py | Python | lgpl-3.0 | 8,668 |
import argparse
import joblib
from sklearn import metrics
def cluster_metrics(kmodel, vector_space):
""" Calculates unsupervised clustering metrics for a kmeans model.
Args:
kmodel (:obj: `sklearn.cluster.KMeans`): The kmeans model that
will be evaluated.
vector_space (sparse matr... | theovasi/browsewiki | toolset/cluster_metrics.py | Python | mit | 1,491 |
"""Test the Vultr switch platform."""
import json
import unittest
from unittest.mock import patch
import pytest
import requests_mock
import voluptuous as vol
from homeassistant.components import vultr as base_vultr
from homeassistant.components.vultr import (
ATTR_ALLOWED_BANDWIDTH,
ATTR_AUTO_BACKUPS,
ATT... | partofthething/home-assistant | tests/components/vultr/test_switch.py | Python | apache-2.0 | 6,036 |
# Copyright 2014-2020 by Christopher C. Little.
# This file is part of Abydos.
#
# Abydos 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 versio... | chrislit/abydos | abydos/distance/_lcsstr.py | Python | gpl-3.0 | 4,745 |
import os
import warnings
from datetime import datetime
from ..auth import auth
from ..constants import INSECURE_REGISTRY_DEPRECATION_WARNING
from ..utils import utils
class DaemonApiMixin(object):
def events(self, since=None, until=None, filters=None, decode=None):
if isinstance(since, datetime):
... | KaranToor/MA450 | google-cloud-sdk/lib/third_party/docker/docker/api/daemon.py | Python | apache-2.0 | 2,707 |
#-*- encoding: utf-8 -*-
"""Classes and functions for representing DNA sequences.
.. module:: sequence
.. moduleauthor:: Niklas Mähler <niklas.mahler@gmail.com>
"""
import re
import string
class Sequence(object):
"""Represent a DNA sequence.
:param seq: a string representing a DNA sequence. Bases A, C,
... | maehler/seqpoet | seqpoet/sequence.py | Python | mit | 1,802 |
import classes
import SimpleGUICS2Pygame.simpleguics2pygame as simplegui
###################
# Constants
###################
# Canvas size
WIDTH = 700
HEIGHT = 620
# Starting coordinates for initial state, goal state and input key
X_POS_PUZZLE = 50
Y_POS_PUZZLE = 80
X_POS_INPUT = 400
Y_POS_INPUT = 200
X_POS_GOAL =... | Daytron/8-puzzle-solver | source/eightPuzzle.py | Python | mit | 28,893 |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 25 13:08:19 2015
@author: jgimenez
"""
from PyQt4 import QtGui, QtCore
from postpro_ui import Ui_postproUI
from PyFoam.RunDictionary.ParsedParameterFile import ParsedParameterFile
from PyFoam.RunDictionary.BoundaryDict import BoundaryDict
import os
from matplotlib.figure... | jmarcelogimenez/petroSym | petroSym/postpro.py | Python | gpl-2.0 | 6,201 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.