text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
import json
import zipfile
from io import BytesIO
from ..constants import BULK_API
from ..api.base import BestBuyCore
from ..utils.exceptions import BestBuyBulkAPIError
class BestBuyBulkAPI(BestBuyCore):
def _api_name(self):
return BULK_API
def archive(self, name, file_format):
"""BestBuy ge... | lv10/bestbuyapi | bestbuyapi/api/bulk.py | Python | mit | 3,123 | 0.000961 |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from UM.Math.Vector import Vector
class Ray:
def __init__(self, origin = Vector(), direction = Vector()):
self._origin = origin
self._direction = direction
self._inverse_direction = 1.0 / di... | thopiekar/Uranium | UM/Math/Ray.py | Python | lgpl-3.0 | 767 | 0.006519 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.exceptions import ObjectDoesNotExist
from django.views.decorators.cache import never_cache
from django.http import HttpResponse, HttpResponseRedirect
from session_csrf import anonymous_csrf
from ..models import ... | mozilla/BanHammer | BanHammer/blacklist/views/zlb.py | Python | bsd-3-clause | 9,627 | 0.006232 |
#!/usr/bin/env python
# Copyright 2012 Cisco Systems, 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... | igor-toga/local-snat | neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py | Python | apache-2.0 | 41,399 | 0.000121 |
from unittest import TestCase
from plivo import plivoxml
from tests import PlivoXmlTestCase
class RecordElementTest(TestCase, PlivoXmlTestCase):
def test_set_methods(self):
expected_response = '<Response><Record action="https://foo.example.com" callbackMethod="GET" ' \
'callbac... | plivo/plivo-python | tests/xml/test_recordElement.py | Python | mit | 1,989 | 0.003017 |
# 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... | julianwang/cinder | cinder/db/sqlalchemy/migrate_repo/versions/004_volume_type_to_uuid.py | Python | apache-2.0 | 5,948 | 0 |
from twisted.trial import unittest
from tipsip.header import Headers
from tipsip.header import Header, AddressHeader, ViaHeader
class HeadersTest(unittest.TestCase):
def test_construct(self):
aq = self.assertEqual
at = self.assertTrue
h = Headers({'Subject': 'lunch'}, f='John', to='abacab... | ivaxer/tipsip | tipsip/tests/test_header.py | Python | isc | 2,901 | 0.002413 |
# Reference: http://hetland.org/coding/python/levenshtein.py
def levenshtein(a,b):
"Calculates the Levenshtein distance between a and b."
n, m = len(a), len(b)
if n > m:
# Make sure n <= m, to use O(min(n,m)) space
a,b = b,a
n,m = m,n
current = range(n+1)
for i in ra... | singhj/locality-sensitive-hashing | utils/levenshtein.py | Python | mit | 745 | 0.016107 |
# -*-mode: python; py-indent-offset: 4; tab-width: 8; coding: iso-8859-1 -*-
# DLLM (non-linear Differentiated Lifting Line Model, open source software)
#
# Copyright (C) 2013-2015 Airbus Group SAS
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Pub... | matthieu-meaux/DLLM | examples/broken_wing/test_broken_wing.py | Python | gpl-2.0 | 1,720 | 0.005814 |
"""Store various constants here"""
from enum import Enum
# Maximum file upload size (in bytes).
MAX_CONTENT_LENGTH = 1 * 1024 * 1024 * 1024
# Authentication/account creation constants
PWD_HASH_ALGORITHM = 'pbkdf2_sha256'
SALT_SIZE = 24
MIN_USERNAME_LENGTH = 2
MAX_USERNAME_LENGTH = 32
MIN_PASSWORD_LENGTH = 8
MAX_PASSW... | ASCIT/donut-python | donut/constants.py | Python | mit | 2,372 | 0.000422 |
import os
import re
import subprocess
from utils import whereis_exe
class osx_voice():
def __init__(self, voice_line):
mess = voice_line.split(' ')
cleaned = [ part for part in mess if len(part)>0 ]
self.name = cleaned[0]
self.locality = cleaned[1]
self.desc = cleaned[2].... | brousch/saythis2 | tts_engines/osx_say.py | Python | mit | 888 | 0.003378 |
# -*- coding: utf-8 -*-
# <standard imports>
from __future__ import division
import random
import otree.models
import otree.constants
from otree.db import models
from otree import widgets
from otree.common import Currency as c, currency_range, safe_json
from otree.constants import BaseConstants
from otree... | NlGG/experiments | Experimental Games on Networks/otree_code/network/models.py | Python | mit | 3,635 | 0.009134 |
# coding=utf-8
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import sys
from int... | UnrememberMe/pants | testprojects/src/python/interpreter_selection/python_3_selection_testing/test_py2.py | Python | apache-2.0 | 554 | 0.012635 |
# -*- coding: utf-8 -*-
import json
from vilya.libs import api_errors
from vilya.models.project import CodeDoubanProject
from vilya.views.api.utils import RestAPIUI, api_require_login, jsonize
from vilya.views.api.repos.product import ProductUI
from vilya.views.api.repos.summary import SummaryUI
from vilya.views.api.... | xtao/code | vilya/views/api/repos/__init__.py | Python | bsd-3-clause | 4,261 | 0 |
import datetime
import pytz
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.translation import trans_real
from . import global_tz
from .forms import TimeZoneForm
from .utils import guess_tz_from_lang
def get_tz_from_request(request):
if hasattr(request, 'sessi... | paluh/django-tz | django_tz/middleware.py | Python | bsd-2-clause | 1,766 | 0.002831 |
""" Miscellaneous routines and constants.
"""
import logging, sys, traceback
import os.path
import astviewer.qtpy
import astviewer.qtpy._version as qtpy_version
from astviewer.version import DEBUGGING, PROGRAM_NAME, PROGRAM_VERSION, PYTHON_VERSION
from astviewer.qtpy import QtCore, QtWidgets
logger=logging.getLogger(... | titusjan/astviewer | astviewer/misc.py | Python | mit | 6,180 | 0.004854 |
from base_uri import URI
class HomeURI(URI):
path = '/'
| LINKIWI/modern-paste | app/uri/main.py | Python | mit | 62 | 0 |
# -*- coding: utf-8 -*-
from .hooks import post_init_hook
from . import models
from . import tests
| acsone/server-tools | base_name_search_improved/__init__.py | Python | agpl-3.0 | 99 | 0 |
r"""
Solve Poisson equation in 1D with homogeneous Dirichlet bcs on the domain [0, inf)
\nabla^2 u = f,
The equation to solve for a Laguerre basis is
(\nabla u, \nabla v) = -(f, v)
"""
import os
import sys
from sympy import symbols, sin, exp, lambdify
import numpy as np
from shenfun import inner, grad, Tes... | spectralDNS/shenfun | demo/laguerre_dirichlet_poisson1D.py | Python | bsd-2-clause | 1,587 | 0.00252 |
from __future__ import absolute_import, division, print_function
from itertools import chain
from dynd import nd
import datashape
from datashape.internal_utils import IndexCallable
from datashape import discover
from functools import partial
from ..dispatch import dispatch
from blaze.expr import Projection, Field
from... | vitan/blaze | blaze/data/core.py | Python | bsd-3-clause | 6,508 | 0.000154 |
"""An AdaNet evaluator implementation in Tensorflow using a single graph.
Copyright 2018 The AdaNet 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
https://www.ap... | tensorflow/adanet | adanet/core/evaluator.py | Python | apache-2.0 | 4,624 | 0.00519 |
from django.db import models
from django.contrib.auth.models import User
from datetime import datetime
from django.utils.timezone import now
from shelf.models import BookItem
# Create your models here.
class Rental(models.Model):
who = models.ForeignKey(User)
what = models.ForeignKey(BookItem)
when = models... | KredekPth/Kurs_django | rental/models.py | Python | mit | 564 | 0.031915 |
#Defaults - overridable via. pypayd.conf or command-line arguments
DEFAULT_KEYPATH = '0/0/1'
DEFAULT_TICKER = 'dummy'
DEFAULT_CURRENCY = 'USD'
DEFAULT_WALLET_FILE = 'wallet.txt'
DEFAULT_WALLET_PASSWORD = "foobar"
DEFAULT_MNEMONIC_TYPE = "electrumseed"
DB = None
DEFAULT_DB = "pypayd.db"
DEFAULT_TESTNET_DB = "pypayd_tes... | pik/pypayd | pypayd/config.py | Python | mit | 1,595 | 0.013166 |
#
# Unit Tests for the colors.py functions
#
# Rajul Srivastava (rajul09@gmail.com)
#
import unittest
import logging
import numpy as np
import ginga.colors
class TestError(Exception):
pass
class TestColors(unittest.TestCase):
def setUp(self):
self.logger = logging.getLogger("TestColors")
self.color_list_... | rupak0577/ginga | ginga/tests/test_colors.py | Python | bsd-3-clause | 4,797 | 0.0271 |
# Copyright 2018 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... | mlperf/training_results_v0.7 | Google/benchmarks/resnet/implementations/resnet-cloud-TF2.0-tpu-v3-32/resnet_imagenet_main.py | Python | apache-2.0 | 12,959 | 0.007408 |
import numpy
scale = 1000
def unit(v):
return (v / numpy.linalg.norm(v))
def angle(v1, v2):
v1_u = unit(v1)
v2_u = unit(v2)
angle = numpy.arccos(numpy.dot(v1_u, v2_u))
if numpy.isnan(angle):
if (v1_u == v2_u).all():
return 0.0
else:
return numpy.pi
retu... | bepo13/destinydb-stl-generator-v0 | src/DestinyModelGenStl.py | Python | mit | 6,240 | 0.005769 |
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
from ryu.ofproto import ether
from ryu.lib.packet import packet
from ryu.lib.packet import ether... | ray6/sdn | actualSDN.py | Python | mit | 14,660 | 0.007572 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import nerve
import os
import cgi
import traceback
import urllib.parse
class WSGIHandler (nerve.Server):
def __init__(self, **config):
super().__init__(**config)
def __call__(self, environ, start_response):
#nerve.logs.redirect(environ['wsgi.errors... | transistorfet/nerve | nerve/http/servers/wsgi.py | Python | gpl-3.0 | 3,372 | 0.007711 |
import logging
from ._base import Service
from ..domain import Template
log = logging.getLogger(__name__)
class TemplateService(Service):
def __init__(self, template_store, **kwargs):
super().__init__(**kwargs)
self.template_store = template_store
def all(self):
"""Get all templat... | CptSpaceToaster/memegen | memegen/services/template.py | Python | mit | 1,885 | 0.000531 |
"""
GUI progressbar decorator for iterators.
Includes a default (x)range iterator printing to stderr.
Usage:
>>> from tqdm_gui import tgrange[, tqdm_gui]
>>> for i in tgrange(10): #same as: for i in tqdm_gui(xrange(10))
... ...
"""
# future division is important to divide integers and get as
# a result preci... | dhaase-de/dh-python-dh | dh/thirdparty/tqdm/_tqdm_gui.py | Python | mit | 13,510 | 0 |
"""Test code for pooling"""
import numpy as np
import tvm
import topi
import math
from topi.util import get_const_tuple
pool_code = {
"avg": 0,
"max": 1
}
def verify_pool(n, ic, ih, kh, sh, padding, pool_type, ceil_mode, count_include_pad=True):
iw = ih
kw = kh
sw = sh
pt, pl, pb, pr = padding
... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/tests/python_cpp/test_topi_pooling.py | Python | apache-2.0 | 5,140 | 0.006226 |
""" Cisco_IOS_XR_infra_objmgr_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR infra\-objmgr package configuration.
This module contains definitions
for the following management objects\:
object\-group\: Object\-group configuration
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
All rig... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_infra_objmgr_cfg.py | Python | apache-2.0 | 90,489 | 0.018323 |
import json
from treeherder.log_parser.parsers import (EmptyPerformanceData,
PerformanceParser)
def test_performance_log_parsing_malformed_perfherder_data():
"""
If we have malformed perfherder data lines, we should just ignore
them and still be able to parse th... | KWierso/treeherder | tests/log_parser/test_performance_parser.py | Python | mpl-2.0 | 1,056 | 0 |
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import gc
import sys
from types import FrameType
from itertools import chain
# From http://code.activestate.com/recipes/523004-find-cyclical-references/
def print_cycles(objects, ... | magus424/powerline | powerline/lib/debug.py | Python | mit | 3,036 | 0.027339 |
from datetime import datetime
from collections import defaultdict
DEFAULT_RELEASE = datetime(1970, 1, 1)
_SORT_KEY = lambda eps: eps[0].released or DEFAULT_RELEASE
class PodcastGrouper(object):
"""Groups episodes of two podcasts based on certain features
The results are sorted by release timestamp"""
... | gpodder/mygpo | mygpo/administration/group.py | Python | agpl-3.0 | 1,212 | 0.00165 |
from __future__ import print_function, unicode_literals
from future.builtins import open
import os
import re
import sys
from contextlib import contextmanager
from functools import wraps
from getpass import getpass, getuser
from glob import glob
from importlib import import_module
from posixpath import join
from mezza... | okfnepal/election-nepal | fabfile.py | Python | mit | 21,828 | 0.000321 |
"""cascade folder deletes to imapuid
Otherwise, since this fk is NOT NULL, deleting a folder which has associated
imapuids still existing will cause a database IntegrityError. Only the mail
sync engine does such a thing. Nothing else should be deleting folders,
hard or soft.
This also fixes a problem where if e.g. so... | nylas/sync-engine | migrations/versions/034_cascade_folder_deletes_to_imapuid.py | Python | agpl-3.0 | 4,899 | 0.000408 |
import string
import socket
import base64
import sys
class message:
def __init__(self, name="generate" ):
if name == "generate":
self.name=socket.gethostname()
else:
self.name=name
self.type="gc"
self.decoded=""
def set ( self, content=" " ):
... | LibraryBox-Dev/LibraryBox-core | piratebox_origin/piratebox/piratebox/python_lib/messages.py | Python | gpl-3.0 | 1,109 | 0.038774 |
import giwyn.lib.settings.settings
from git import *
def list_git_projects():
print("List of git projects:")
#end="" -> avoid last '\n' character
for git_object in giwyn.lib.settings.settings.GIT_OBJECTS:
print(git_object)
def push_ready_projects():
print("Repository to push...")
any_repo_... | k0pernicus/giwyn | giwyn/lib/gitconf/commands.py | Python | gpl-3.0 | 1,268 | 0.005521 |
# -*- coding: utf-8 -*-
from ..common import get_module_class
class Parser(object):
@staticmethod
def get(parser_name):
clazz = get_module_class(parser_name, __name__)
return clazz()
def loads(self, content):
return content
def dumps(self, content):
return content
... | DataCanvasIO/pyDataCanvas | datacanvas/dataset/parser/parser.py | Python | apache-2.0 | 435 | 0 |
from django.db import models
from django.utils import timezone
import pytz
import datetime
def hash(n):
n = int(n)
return ((0x0000FFFF & n)<<16) + ((0xFFFF0000 & n)>>16)
class EventInstance(object):
def __init__(self, event, event_time, date):
self.date = date.date()
self.time = date.time(... | dirjud/pickup | event/models.py | Python | gpl-2.0 | 3,032 | 0.01715 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('www', '0010_expo_info_url'),
]
operations = [
migrations.RenameField(
model_name='expo',
old_name='i... | themaxx75/lapare-bijoux | lapare.ca/lapare/apps/www/migrations/0011_auto_20151022_2037.py | Python | bsd-3-clause | 375 | 0 |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Urls(models.Model):
longurl = models.CharField(max_length=256)
shorturl = models.CharField(max_length=128)
| rodrigobersan/X-Serv-18.1-Practica1 | project/acorta/models.py | Python | gpl-2.0 | 219 | 0.004566 |
import RoleManagement
import bot_logger
import purger
async def run_op(client, message, bot_log):
levels = {
'admin': ['admin'],
'high': ['admin', 'moderator', 'panda bat'],
'medium': ['trial moderator', 'moderator', 'admin', 'panda bat'],
'low': ['@everyone']
... | alexandergraul/pvs-bot | launcher.py | Python | gpl-3.0 | 1,561 | 0.000641 |
# -*- coding: utf-8 -*-
"""
14. Using a custom primary key
By default, Django adds an ``"id"`` field to each model. But you can override
this behavior by explicitly adding ``primary_key=True`` to a field.
"""
from django.conf import settings
from django.db import models, transaction, IntegrityError
from fields impor... | grangier/django-11599 | tests/modeltests/custom_pk/models.py | Python | bsd-3-clause | 5,234 | 0.001911 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use t... | takeshineshiro/horizon | openstack_dashboard/dashboards/project/access_and_security/tabs.py | Python | apache-2.0 | 5,203 | 0 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-batch/azure/batch/models/pool_evaluate_auto_scale_parameter.py | Python | mit | 1,498 | 0 |
def deposit(materials, life, sea, climate):
contributions = []
depositkeys = set()
for m in materials:
t = 0
i = len(m.substance) - 1
sources = []
keys = set()
while t < m.total:
dt = m.total - t
layer = m.substance[i]
if layer['thi... | tps12/Tec-Nine | rock/sedimentary.py | Python | gpl-3.0 | 2,309 | 0.004764 |
"""Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - ... | svanschalkwyk/datafari | windows/python/Lib/test/test_io.py | Python | apache-2.0 | 120,213 | 0.001406 |
class NipapError(Exception):
""" NIPAP base error class.
"""
error_code = 1000
class NipapInputError(NipapError):
""" Erroneous input.
A general input error.
"""
error_code = 1100
class NipapMissingInputError(NipapInputError):
""" Missing input.
Most input is passed ... | SoundGoof/NIPAP | nipap/nipap/errors.py | Python | mit | 1,301 | 0.000769 |
# 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/v2019_07_01/operations/_snapshots_operations.py | Python | mit | 46,204 | 0.004697 |
# !/usr/bin/env python
# -*- coding: UTF-8 -*-
# Copyright (c) 2012-2015 Christian Schwarz
#
# 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 limitat... | T-002/pycast | pycast/common/decorators.py | Python | mit | 2,987 | 0.002009 |
# -*- coding: utf-8 -*-
"""
pygments.plugin
~~~~~~~~~~~~~~~
Pygments setuptools plugin interface. The methods defined
here also work if setuptools isn't installed but they just
return nothing.
lexer plugins::
[pygments.lexers]
yourlexer = yourmodule:YourLexer
formatter pl... | davy39/eric | ThirdParty/Pygments/pygments/plugin.py | Python | gpl-3.0 | 1,903 | 0 |
import os
import time
from config import ComponentBase
from transcode import Transcoder
class MediaDiscovery(ComponentBase):
DURATION_FORMAT = '%H:%M:%S'
MAX_DEPTH = 4
def __init__(self, library):
super(MediaDiscovery, self).__init__()
self.library = library
def search(self, paths,... | s-knibbs/py-web-player | pywebplayer/discover.py | Python | gpl-2.0 | 2,070 | 0.000483 |
# -*- coding: utf-8 -*-
import time
from datetime import timedelta
class CookieJar:
def __init__(self, pluginname, account=None):
self.cookies = {}
self.plugin = pluginname
self.account = account
def add_cookies(self, clist):
for c in clist:
name = c.split("\t")[5... | vuolter/pyload | src/pyload/core/network/cookie_jar.py | Python | agpl-3.0 | 1,007 | 0.000993 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
| caulagi/hubot-py-wtf | test/code/bad.py | Python | mit | 46 | 0.021739 |
import logging
from dummy.models import Test
from dummy.utils import git
from dummy.storage import StorageProvider
from dummy import config
logger = logging.getLogger( __name__ )
def discover_targets( args ):
targets = []
if args.alltargets:
for t in config.TARGETS.keys():
targets.append( t )
elif len( args... | ElessarWebb/dummy | src/dummy/utils/argparser.py | Python | mit | 1,745 | 0.05616 |
# Copyright 2015-2016 Open Source Robotics Foundation, 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 applicabl... | osrf/docker_templates | docker_templates/library.py | Python | apache-2.0 | 2,737 | 0.000731 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
def _default_visible_expense_policy(self):
visibility = self.user_has_groups('hr_expense.group_hr_expense... | ddico/odoo | addons/sale_expense/models/product_template.py | Python | agpl-3.0 | 1,032 | 0.001938 |
#!/usr/bin/python3
# @begin:license
#
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
#
# 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 y... | odahoda/noisicaa | noisicaa/builtin_nodes/pianoroll_track/track_ui.py | Python | gpl-2.0 | 53,058 | 0.001809 |
"""Accessors for an app's local configuration
The local configuration is loaded from a YAML file. The default
configuration is "local.yaml", in the app's root.
An app's local configuration can change depending on the current
environment, i.e., development and production.
For example,
pirate: ninja
robot:
de... | tantalor/megaera | megaera/local.py | Python | mit | 1,305 | 0.010728 |
"""
=========================================================================
Non-parametric between conditions cluster statistic on single trial power
=========================================================================
This script shows how to compare clusters in time-frequency
power estimates between condition... | adykstra/mne-python | tutorials/stats-sensor-space/plot_stats_cluster_time_frequency.py | Python | bsd-3-clause | 4,873 | 0 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import logging
from .render import render_tablature
__all__ = ['render_tablature']
| pignacio/chorddb | chorddb/terminal/__init__.py | Python | gpl-3.0 | 190 | 0 |
import functools
import os
import numpy as np
import pygmo as pg
from simulation import simulate, statistical
from solving import value_function_list
from util import constants as cs, param_type
class HumanCapitalSearchProblem(object):
def fitness(self, params_nparray, gradient_eval=False):
params_param... | mishpat/human-capital-search | humancapitalsearch.py | Python | mit | 4,080 | 0.007108 |
"""Sourcecounts
s is flux in Jy and n is number > s per str
"""
import numpy as N
s=N.array([ 9.9999997e-05, 0.00010328281, 0.00010667340, 0.00011017529, 0.00011379215, 0.00011752774, 0.00012138595, \
0.00012537083, 0.00012948645, 0.00013373725, 0.00013812761, 0.00014266209, 0.00014734542, 0.00015218249, 0.000157178... | lofar-astron/PyBDSF | bdsf/sourcecounts.py | Python | gpl-3.0 | 12,587 | 0.025582 |
from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
def _makeunicodes(f):
import re
lines = iter(f.readlines())
unicodes = {}
for line in lines:
if not line: continue
num, name = line.split(';')[:2]
if name[0] == '<': continue # "<control>", etc.
num = int(num... | MitchTalmadge/Emoji-Tools | src/main/resources/PythonScripts/fontTools/unicode.py | Python | gpl-3.0 | 1,057 | 0.037843 |
# @file get_svn_revision.py
# Fetch the subversion revision number from the repository
#
# @copyright (c) 2006,2014 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file ... | ATNF/askapsdp | Tools/Dev/rbuild/askapdev/rbuild/utils/get_svn_revision.py | Python | gpl-2.0 | 1,823 | 0.002743 |
import os
import rospy, rospkg
import sys
import math
import yaml
from itertools import izip_longest
from operator import add, sub
from qt_gui.plugin import Plugin
from python_qt_binding import loadUi
from python_qt_binding.QtWidgets import QWidget
from PyQt5 import QtGui, QtWidgets, QtCore
from rqt_plot.rosplot impo... | Georacer/last_letter | rqt_dashboard/src/rqt_dashboard/dashboard.py | Python | gpl-3.0 | 16,075 | 0.029425 |
import ctypes
class C_struct:
"""Decorator to convert the given class into a C struct."""
# contains a dict of all known translatable types
types = ctypes.__dict__
@classmethod
def register_type(cls, typename, obj):
"""Adds the new class to the dict of understood types."""
cls.types[typename] = obj
def __... | ActiveState/code | recipes/Python/576734_C_struct_decorator/recipe-576734.py | Python | mit | 1,507 | 0.033842 |
#!/usr/bin/env python
command += testshade("-g 256 256 --center -od uint8 -o Cout out.tif test")
outputs = [ "out.txt", "out.tif" ]
| svenstaro/OpenShadingLanguage | testsuite/texture-withderivs/run.py | Python | bsd-3-clause | 133 | 0.015038 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
from frappe import msgprint, _
def execute(filters=None):
if not filters: filters = {}
invoice_list = get... | ThiagoGarciaAlves/erpnext | erpnext/accounts/report/sales_register/sales_register.py | Python | agpl-3.0 | 7,220 | 0.024931 |
# 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... | cshallue/models | research/object_detection/meta_architectures/faster_rcnn_meta_arch_test.py | Python | apache-2.0 | 17,423 | 0.004018 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class SaleOrderCancel(models.TransientModel):
_inherit = 'sale.order.cancel'
display_delivery_alert = fields.Boolean('Delivery Alert', compute='_compute_display_delivery_al... | ygol/odoo | addons/sale_stock/wizard/sale_order_cancel.py | Python | agpl-3.0 | 553 | 0.003617 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | DeepThoughtTeam/tensorflow | tensorflow/python/ops/constant_op.py | Python | apache-2.0 | 7,338 | 0.004361 |
"""
==========================
PySpecKit ASCII Reader
==========================
Routines for reading in ASCII format spectra. If atpy is not installed,
will use a very simple routine for reading in the data.
.. moduleauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com>
.. moduleauthor:: Jordan Mirocha <mirochaj@gma... | keflavich/pyspeckit-obsolete | pyspeckit/spectrum/readers/txt_reader.py | Python | mit | 5,045 | 0.010109 |
import pygame
# Import the android module. If we can't import it, set it to None - this
# lets us test it, and check to see if we want android-specific behavior.
try:
import android
except ImportError:
android = None
# Event constant.
TIMEREVENT = pygame.USEREVENT
# The FPS the game runs at.
FPS = 30
# Colo... | kallimachos/archive | andpygame/android_example.py | Python | gpl-3.0 | 1,612 | 0.001861 |
import os
import unittest
from vsg.rules import iteration_scheme
from vsg import vhdlFile
from vsg.tests import utils
sTestDir = os.path.dirname(__file__)
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_300_test_input.vhd'))
dIndentMap = utils.read_indent_file()
lExpected = []
lExpected.ap... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/iteration_scheme/test_rule_300.py | Python | gpl-3.0 | 1,279 | 0.003909 |
from datetime import datetime, timedelta
from pprint import pprint
from django import forms
from utils.functions import shift_years
from .models import (
NfEntrada,
PosicaoCarga,
)
class NotafiscalChaveForm(forms.Form):
chave = forms.CharField(
widget=forms.TextInput())
class NotafiscalRelFor... | anselmobd/fo2 | src/logistica/forms.py | Python | mit | 5,361 | 0.000187 |
# -*- encoding: utf-8 -*-
# $Id: __init__.py,v 1.8.2.10 2012/02/03 23:04:01 customdesigned Exp $
#
# This file is part of the pydns project.
# Homepage: http://pydns.sourceforge.net
#
# This code is covered by the standard Python License. See LICENSE for details.
#
# __init__.py for DNS class.
__version__ = '2.3.6'
... | hansroh/aquests | aquests/protocols/dns/pydns/__init__.py | Python | mit | 2,174 | 0.00276 |
# Copyright 2012 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 writing, so... | tanglei528/nova | nova/virt/disk/vfs/guestfs.py | Python | apache-2.0 | 8,034 | 0 |
from pathlib import Path
import pytest
from loguru import logger
from libretime_shared.logging import (
DEBUG,
INFO,
create_task_logger,
level_from_name,
setup_logger,
)
@pytest.mark.parametrize(
"name,level_name,level_no",
[
("error", "error", 40),
("warning", "warning",... | LibreTime/libretime | shared/tests/logging_test.py | Python | agpl-3.0 | 1,238 | 0.000808 |
# Based on STScI's JWST calibration pipeline.
from __future__ import print_function
import os
import subprocess
import sys
from setuptools import setup, find_packages, Extension, Command
from glob import glob
# Open the README as the package long description
readme = open('README.rst', 'r')
README_TEXT = readme.read... | Nat1405/newer-nifty | setup.py | Python | mit | 1,483 | 0.003372 |
# (c) 2013, Michael DeHaan <michael.dehaan@gmail.com>
# Stephen Fromm <sfromm@gmail.com>
# Brian Coca <briancoca+dev@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... | bezhermoso/home | lib/ansible/runner/action_plugins/assemble.py | Python | gpl-3.0 | 4,340 | 0.002995 |
from collections import namedtuple
Datapoint = namedtuple("Datapoint", "phrase sentiment")
| ahmedshabib/evergreen-gainsight-hack | sentiment Analyser/samr/data.py | Python | mit | 93 | 0 |
import pytest
from hangups import channel
@pytest.mark.parametrize('input_,expected', [
(b'79\n[[0,["c","98803CAAD92268E8","",8]\n]\n,[1,[{"gsid":"7tCoFHumSL-IT6BHpCaxLA"}]]\n]\n',
('98803CAAD92268E8', '7tCoFHumSL-IT6BHpCaxLA')
),
])
def test_parse_sid_response(input_, expected):
assert channel._par... | j16sdiz/hangups | hangups/test/test_channel.py | Python | mit | 2,184 | 0.000936 |
# 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... | drpngx/tensorflow | tensorflow/contrib/data/python/ops/unique.py | Python | apache-2.0 | 2,748 | 0.005459 |
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout,Submit
from .models import Details, Feedback
from crispy_forms.bootstrap import TabHolder, Tab
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class AddmeForm(forms.ModelForm):
cla... | Thuruv/pilgrim | blood/forms.py | Python | mit | 537 | 0.007449 |
'''
common XBMC Module
Copyright (C) 2011 t0mm0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Th... | mrknow/filmkodi | script.mrknow.urlresolver/lib/urlresolver9/lib/net.py | Python | apache-2.0 | 12,168 | 0.002959 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | mlperf/training_results_v0.7 | Fujitsu/benchmarks/resnet/implementations/implementation_open/mxnet/3rdparty/tvm/vta/python/vta/testing/simulator.py | Python | apache-2.0 | 2,565 | 0.00039 |
#!/usr/bin/env python3
# Copyright (c) 2014 Pawel Rozlach, Brainly.com sp. z o.o.
#
# 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 re... | vespian/inventory_tool | inventory_tool/object/ippool.py | Python | apache-2.0 | 8,065 | 0.00062 |
from __future__ import absolute_import
from __future__ import print_function
import ujson
from django.http import HttpResponse
from mock import patch
from typing import Any, Dict, List, Text, Union
from zerver.lib.actions import (
do_change_is_admin,
do_set_realm_property,
do_deactivate_realm,
)
from ze... | christi3k/zulip | zerver/tests/test_realm.py | Python | apache-2.0 | 10,099 | 0.000594 |
import copy
from django.utils import six
class MergeDict(object):
"""
A simple class for creating new "virtual" dictionaries that actually look
up values in more than one dictionary, passed in the constructor.
If a key appears in more than one of the given dictionaries, only the
first occurrence ... | makinacorpus/django | django/utils/datastructures.py | Python | bsd-3-clause | 14,882 | 0.001344 |
#!/usr/bin/env python
#-----------------------------------------------------------------------------
# Copyright (c) 2016--, Evguenia Kopylova, Jad Kanbar, SevenBridges dev team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software... | ekopylova/tcga-1 | python_scripts/cgc_create_tcga_workflow_task.py | Python | bsd-3-clause | 20,620 | 0.000533 |
"""Unit tests for wx.Gauge.
Methods yet to test:
__init__, Create, Pulse"""
import unittest
import wx
import wxtest
import testControl
class GaugeTest(testControl.ControlTest):
def setUp(self):
self.app = wx.PySimpleApp()
self.frame = wx.Frame(parent=None)
self.testControl = wx.Gauge(par... | ifwe/wxpy | src/tests/wxPythonTests/testGauge.py | Python | mit | 2,410 | 0.005809 |
#!/usr/bin/env python
# -*- encoding: utf-8
from __future__ import division, print_function
from tagassess.dao.helpers import FilteredUserItemAnnotations
from tagassess.dao.pytables.annotations import AnnotReader
from tagassess.index_creator import create_occurrence_index
from tagassess.probability_estimates.precomput... | flaviovdf/tag_assess | src/scripts/PrecisionRecall.py | Python | bsd-3-clause | 4,909 | 0.010593 |
# -*- 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 model 'HistoricalArticle'
db.create_table(u'core_historicalartic... | 1flow/1flow | oneflow/core/migrations/0101_auto__add_historicalarticle.py | Python | agpl-3.0 | 62,707 | 0.007926 |
"""
Color definitions are used as per CSS3 specification:
http://www.w3.org/TR/css3-color/#svg-color
A few colors have multiple names referring to the sames colors, eg. `grey` and `gray` or `aqua` and `cyan`.
In these cases the LAST color when sorted alphabetically takes preferences,
eg. Color((0, 255, 255)).as_name... | samuelcolvin/pydantic | pydantic/color.py | Python | mit | 16,607 | 0.001505 |
class Frame:
def __init__(self,width,height,color):
self.width = width
self.height = height
self.data = []
for h in range(height):
row = []
for w in range(width):
row.append(color)
self.data.append(row)
def clear(self,color):
for h in range(self.height):
for w in range(self.width):
s... | keyvank/pyglare | pyglare/image/frame.py | Python | mit | 343 | 0.061224 |
# The Hazard Library
# Copyright (C) 2012-2017 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.
#... | gem/oq-hazardlib | openquake/hazardlib/const.py | Python | agpl-3.0 | 4,670 | 0.000428 |
from sympy import symbols, diff, N, Matrix
import numpy as np
from task4 import get_euler_dt
X1, X2, X3 = symbols('X1 X2 X3')
def get_vorticity_tensor(eq1, eq2, eq3):
vkl = get_euler_dt(eq1, eq2, eq3)
wkl = 0.5*(vkl - np.transpose(vkl))
return N(Matrix(wkl), 2)
def get_vorticity_components(eq1, eq2, eq3)... | toomastahves/math-pg | pkmkt2_code/task6.py | Python | unlicense | 625 | 0.0096 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.