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 |
|---|---|---|---|---|---|---|
from configure import Configuration, ConfigurationError
from ksgen import docstring, yaml_utils, utils
from ksgen.tree import OrderedTree
from ksgen.yaml_utils import LookupDirective
from docopt import docopt, DocoptExit
import logging
import os
import re
import yaml
VALUES_KEY = '!value'
DEFAULTS_TAG = 'defaults'
lo... | tkammer/infrared | tools/ksgen/ksgen/settings.py | Python | gpl-3.0 | 15,945 | 0.000815 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from contextlib import contextmanager
import re
from cartouche._portability import u
from .errors import CartoucheError
from .nodes import (Node, Raises, Except, Note, Warning, Returns, Arg, Yields,
Attribute, Usage, ensure_terminal_bl... | rob-smallshire/cartouche | cartouche/parser.py | Python | bsd-3-clause | 17,022 | 0.001646 |
from utils import utils
from artifacts import scw_artifact
url_mapping = {}
current_vrt = utils.get_json(utils.VRT_FILENAME)
scw_artifact.write_artifact_file(
scw_artifact.generate_urls(current_vrt['content'], url_mapping)
)
| bugcrowd/vulnerability-rating-taxonomy | lib/generate_artifacts.py | Python | apache-2.0 | 228 | 0 |
#!/usr/bin/env python
""" Python Character Mapping Codec for ROT13.
See http://ucsub.colorado.edu/~kominek/rot13/ for details.
Written by Marc-Andre Lemburg ([email protected]).
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
... | ktan2020/legacy-automation | win/Lib/encodings/rot_13.py | Python | mit | 2,697 | 0.011123 |
# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
from __future__ import print_function
import os
import sys
import psycopg2
__all__ = ('DB_CONNECTION_STR... | Connexions/cnx-upgrade | cnxupgrade/tests/__init__.py | Python | agpl-3.0 | 2,755 | 0.001452 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2017 Andrey Antukh <[email protected]>
# Copyright (C) 2014-2017 Jesús Espino <[email protected]>
# Copyright (C) 2014-2017 David Barragán <[email protected]>
# Copyright (C) 2014-2017 Alejandro Alonso <[email protected]>
# Copyright (C) 2014-2017 Anler Hernández ... | dayatz/taiga-back | tests/integration/resources_permissions/test_auth_resources.py | Python | agpl-3.0 | 2,107 | 0 |
from fabric.api import *
from fabric.contrib.files import exists
import fabric
counter = 0
@roles('master')
def start_spark():
run('/home/mdindex/scripts/startSystems.sh')
@roles('master')
def stop_spark():
run('/home/mdindex/scripts/stopSystems.sh')
@roles('master')
def start_zookeeper():
run('/home/md... | mitdbg/mdindex | scripts/fabfile/utils.py | Python | mit | 2,214 | 0.006775 |
# -*- coding: utf-8 -*-
import 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 'EmailUserHandler.to_ident'
db.add_column('form_builder_emailuserhandler', 'to_ident',
... | j00bar/django-widgy | widgy/contrib/form_builder/south_migrations/0010_auto__add_field_emailuserhandler_to_ident__chg_field_formsubmission_cr.py | Python | apache-2.0 | 9,301 | 0.007526 |
# -*- coding: utf-8 -*-
# © 2013 - Guadaltech - Alberto Martín Cortada
# © 2015 - AvanzOSC - Ainara Galdona
# © 2014-2016 - Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
class L10nEsAeatMod303Report(models.Mode... | Endika/l10n-spain | l10n_es_aeat_mod303/models/mod303.py | Python | agpl-3.0 | 9,035 | 0 |
from Crypto.PublicKey import RSA
from Crypto.Cipher import AES, PKCS1_OAEP
file_in = open("encrypted_data.bin", "rb")
private_key = RSA.import_key(open("private.pem").read())
enc_session_key, nonce, tag, ciphertext = [ file_in.read(x) for x in (private_key.size_in_bytes(), 16, 16, -1) ]
# Decrypt the session key wi... | siwells/teaching_set09103 | code/topic_11/decrypt.py | Python | gpl-3.0 | 616 | 0.00487 |
# coding=utf-8
#Converts a csv contining country codes and numerical values, to json
#Years should be given in the header, like this:
#
# land, 1980, 1981, 1982
# se, 12, 13, 11
# fi 7, 10, 14
import csv
import json
import argparse
import os.path
import sys
import math
#Check if file exists
def is_... | jplusplus/thenmap-v0 | generators/utils/convert-csv-to-json.py | Python | gpl-2.0 | 2,991 | 0.030181 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from django.contrib.auth.models import User
from django.db.utils import IntegrityError
from django.core.exceptions import ValidationError
from loans.models import Business
class BusinessTestCase(TestCase):
'''
Cr... | Amandil/django-tech-test | loans/tests/tests_model_business.py | Python | bsd-3-clause | 5,699 | 0.031409 |
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import toolz
import numpy as np
import theano
import theano.tensor as T
from .. import utils
from .inits import ZeroInit
ENABLE_TEST_VALUE = theano.config.compute_test_value != "off"
VALID_TAGS = set("""
input
o... | diogo149/treeano | treeano/core/variable.py | Python | apache-2.0 | 7,794 | 0 |
#!/usr/bin/python
import unittest
import os
import sys
# simple magic for using scripts within a source tree
basedir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if os.path.isdir(os.path.join(basedir, 'virttest')):
sys.path.append(basedir)
from virttest import utils_params
BASE_DICT = {
'im... | spcui/avocado-vt | selftests/unit/test_utils_params.py | Python | gpl-2.0 | 3,700 | 0.001622 |
from __future__ import print_function
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.PyMol import MolViewer
from rdkit.Chem.Subshape import SubshapeBuilder,SubshapeObjects,SubshapeAligner
from rdkit.six.moves import cPickle
import copy
m1 = Chem.MolFromMolFile('test_data/square1.mol')
m2 = Chem.... | soerendip42/rdkit | rdkit/Chem/Subshape/testCombined.py | Python | bsd-3-clause | 1,702 | 0.03349 |
# Copyright 2011 VMware, 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 ... | chitr/neutron | neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py | Python | apache-2.0 | 89,243 | 0.000179 |
"""
Constants for testing purposes
"""
DUMMY_REDIRECT_URL = u'https://example.com/edx/redirect'
| tanmaykm/edx-platform | openedx/core/djangoapps/oauth_dispatch/tests/constants.py | Python | agpl-3.0 | 97 | 0 |
from MaKaC.webinterface.rh import conferenceDisplay
def index(req,**params):
return conferenceDisplay.RHAbstractBook(req).process(params)
def test(req,**params):
return conferenceDisplay.RHAbstractBook(req).process(params)
| belokop-an/agenda-tools | code/htdocs/confAbstractBook.py | Python | gpl-2.0 | 233 | 0.017167 |
############################ Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <[email protected]> #
# Copyright 2012 Zearin <[email protected]> ... | ahmad88me/PyGithub | github/GithubException.py | Python | lgpl-3.0 | 5,277 | 0.007391 |
import tkinter as tk
import sys
import json
import sys
from tkinter import filedialog
from tkinter import Spinbox
from tkinter import Canvas
from tkinter import RIGHT
from tkinter import ttk
from PIL import Image, ImageTk
from core.readAlgoFile import readAlgo
from core.readAlgoFile import getAlgoList
from core.ConfigP... | neuropoly/axonsegpy | axonsegpy/GUI.py | Python | mit | 4,301 | 0.016043 |
# -*- coding: utf-8 -*-
"""
Thread forms
"""
import os, hashlib
from django.conf import settings
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.files.storage import FileSystemStorage
from project.manager_frontend.forms import CrispyFormMixin
from project.utils.import... | sveetch/recalbox-manager | project/manager_frontend/forms/bios.py | Python | mit | 3,935 | 0.009911 |
#!/usr/bin/env python
from ethereum.tools import tester
from ethereum.tools.tester import TransactionFailed
from pytest import raises
from utils import fix, longTo32Bytes
from constants import LONG, YES, NO
def test_escapeHatch(contractsFixture, cash, market):
controller = contractsFixture.contracts['Controller'... | AugurProject/augur-core | tests/trading/test_tradingEscapeHatch.py | Python | gpl-3.0 | 2,511 | 0.007168 |
__all__ = ["core"] | alfiyansys/a-reconsidered-sign | algorithms/__init__.py | Python | gpl-3.0 | 18 | 0.055556 |
# ===============================================================================
# Copyright 2019 ross
#
# 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/LICE... | USGSDenverPychron/pychron | pychron/pyscripts/contexts.py | Python | apache-2.0 | 1,376 | 0 |
# -*- coding: utf-8 -*-
#################################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Julius Network Solutions SARL <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under th... | ncliam/serverpos | openerp/custom_modules/school_link/school.py | Python | agpl-3.0 | 39,903 | 0.00599 |
#!/usr/bin/python -u
#
# imports the API description and fills up a database with
# name relevance to modules, functions or web pages
#
# Operation needed:
# =================
#
# install mysqld, the python wrappers for mysql and libxml2, start mysqld
# - mysql-server
# - mysql
# - php-mysql
# - MySQL-python
# Chan... | taget/libvirt | docs/index.py | Python | lgpl-2.1 | 37,181 | 0.007504 |
'''
@author: David W.H. Swenson
'''
from __future__ import division
from __future__ import absolute_import
from builtins import zip
from past.utils import old_div
from builtins import object
import os
from nose.tools import (assert_equal, assert_not_equal, assert_almost_equal)
from nose.plugins.skip import SkipTest
... | jhprinz/openpathsampling | openpathsampling/tests/test_toy_dynamics.py | Python | lgpl-2.1 | 12,227 | 0.005561 |
import tft_ir_api as IR
var_u = IR.RealVE("u", 0, (-100.0 - 0.0000001), (100.0 + 0.0000001))
var_v = IR.RealVE("v", 1, (20.0 - 0.000000001), (20000.0 + 0.000000001))
var_T = IR.RealVE("T", 2, (-30.0 - 0.000001), (50.0 + 0.000001))
t1 = IR.BE("+", 4, IR.FConst(331.4), IR.BE("*", 3, IR.FConst(0.6), var_T))
t... | soarlab/FPTuner | examples/primitives/doppler-1.py | Python | mit | 477 | 0.020964 |
from hazelcast.serialization.bits import *
from hazelcast.protocol.builtin import FixSizedTypesCodec
from hazelcast.protocol.client_message import OutboundMessage, REQUEST_HEADER_SIZE, create_initial_buffer
from hazelcast.protocol.builtin import StringCodec
from hazelcast.protocol.builtin import DataCodec
# hex: 0x011... | hazelcast/hazelcast-python-client | hazelcast/protocol/codec/map_unlock_codec.py | Python | apache-2.0 | 1,021 | 0.002938 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-29 05:42
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0025_auto_20170626_0008'),
]
operations = [
migrations.AlterModelOptions(
... | r26zhao/django_blog | blog/migrations/0026_auto_20170629_1342.py | Python | mit | 467 | 0.002179 |
import os
import sys
from optparse import OptionParser, NO_DEFAULT
import imp
import django
from google.appengine._internal.django.core.management.base import BaseCommand, CommandError, handle_default_options
from google.appengine._internal.django.utils.importlib import import_module
# For backwards compatibility: ge... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/_internal/django/core/management/__init__.py | Python | bsd-3-clause | 17,576 | 0.001707 |
from webob import Request, Response
import re
def not_found(request, response):
response.status = 404
response.write("404 Not Found")
class Route(object):
default_methods = ['GET']
def __init__(self, path, handler, methods=None):
self.path = path
self.handler = handler
if meth... | xstrengthofonex/code-live-tutorials | python_web_development/templating/router.py | Python | mit | 1,680 | 0.002976 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import theano
import theano.tensor as T
import numpy as np
from .. import activations, initializations
from ..utils.theano_utils import shared_scalar, shared_zeros, alloc_zeros_matrix
from ..layers.core import Layer, MaskedLayer
from six.moves import range... | stephenbalaban/keras | keras/layers/recurrent.py | Python | mit | 29,818 | 0.001375 |
# Logic for listing and running tests.
#
# * @author Ben Gardner October 2009
# * @author Guy Maurel October 2015
# * @author Matthew Woehlke June 2018
#
import argparse
import os
import subprocess
import sys
from .ansicolor import printc
from .config import config, all_tests, FAIL_ATTRS, PASS_AT... | nivekkagicom/uncrustify | tests/test_uncrustify/utilities.py | Python | gpl-2.0 | 7,537 | 0.000133 |
import itertools
from unittest import TestCase
from turgles.buffer import ChunkBuffer, ShapeBuffer, BufferManager
from turgles.memory import TURTLE_MODEL_DATA_SIZE, TURTLE_COLOR_DATA_SIZE
MODEL_ZEROS = [0] * TURTLE_MODEL_DATA_SIZE
MODEL_ONES = [1] * TURTLE_MODEL_DATA_SIZE
MODEL_TWOS = [2] * TURTLE_MODEL_DATA_SIZE
MOD... | AllTheWayDown/turgles | turgles/tests/test_buffers.py | Python | mit | 11,668 | 0.000086 |
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
###############Credits############################################... | kailIII/emaresa | trunk.pe/account_financial_report/wizard/__init__.py | Python | agpl-3.0 | 1,490 | 0.000671 |
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | pplu/botocore | tests/__init__.py | Python | apache-2.0 | 17,369 | 0.000058 |
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals, absolute_import
import os
import platform
try:
from ConfigParser import ConfigParser
except ImportError:
from configparser import ConfigParser
def get_sudo_username():
"""
Check 'SUDO_USER' var if in environment and return a tuple with ... | simodalla/pygmount | pygmount/utils/utils.py | Python | bsd-3-clause | 2,197 | 0 |
# Copyright The Plasma Project.
# See LICENSE.txt for details.
"""
Test helpers and classes
"""
import inspect
def dict_for_slots(obj):
"""
"""
slots = []
for cls in inspect.getmro(obj.__class__):
if hasattr(cls, '__slots__'):
slots += cls.__slots__
return dict(zip(slots, [... | hydralabs/plasma | plasma/test/util.py | Python | mit | 354 | 0 |
from arza.misc.platform import jit
from arza.types.space import isany
from arza.runtime import error
from arza.runtime.routine.code_routine import CodeRoutine
from arza.runtime.routine.native_routine import NativeRoutine
from arza.types import api, space
def complete_or_interrupt_native_routine(func):
def func_wr... | gloryofrobots/obin | arza/runtime/routine/routine.py | Python | gpl-2.0 | 2,553 | 0.001567 |
from django.contrib.auth.models import User
from django_countries import countries
def get_user(user_id):
user = User.objects.get(id=user_id)
return user
def get_user_profile(user_id):
user = User.objects.get(id=user_id)
return user.profile
def get_ambassadors(country_code=None):
ambassadors = []
a... | ercchy/coding-events | web/processors/user.py | Python | mit | 2,185 | 0.026545 |
import tkinter
import string
from ctypes import windll
import os
'''
for d in string.ascii_uppercase:
if os.path.exists("%s:\\" % (d)):
print("Drive letter '%s' is in use." % (d))
'''
'''
def get_drives():
drives = []
bitmask = windll.kernel32.GetLogicalDrives()
for letter in string.ascii_uppe... | deviantenigma/Savegame-backup-Utility | ignore_fortestingpurposesonly.py | Python | gpl-3.0 | 1,345 | 0.007435 |
import matplotlib.pyplot as plt
import numpy as np
from kaftools.filters import KlmsFilter
from kaftools.kernels import GaussianKernel
from kaftools.utils.shortcuts import plot_series, plot_squared_error
from kaftools.sparsifiers import NoveltyCriterion
if __name__ == "__main__":
# Cargar datos
data = np.load... | Canas/kaftools | examples/klms_pretrained.py | Python | mit | 1,192 | 0.004195 |
from django.test import TestCase
from core.models import User, Group, Host
class Access_Test(TestCase):
fixtures = ['test_users.json','test_groups','test_hosts.json']
def test_superuser_can_all(self):
admin = User.objects.get(pk=1)
# Access to host
host = Host.objects.get(pk=1)
... | redhat-cip/numeter | web-app/numeter_webapp/core/tests/group_restriction.py | Python | agpl-3.0 | 1,907 | 0.003146 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main_window.ui'
#
# Created: Wed Jan 7 16:57:08 2015
# by: PyQt5 UI code generator 5.2.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi... | shubhamshuklaer/compiler_main | main_window_ui.py | Python | gpl-3.0 | 1,476 | 0.001355 |
#
# 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... | apache/incubator-airflow | airflow/providers/google/cloud/example_dags/example_translate_speech.py | Python | apache-2.0 | 3,199 | 0.00125 |
"""
Settings for the LMS that runs alongside the CMS on AWS
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=W0401, W0614
from .dev import *
MODULESTORE = {
'default': {
'ENGINE': 'xmodule.modulestore.draft.Dra... | pelikanchik/edx-platform | lms/envs/cms/preview_dev.py | Python | agpl-3.0 | 430 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from urllib.parse import urljoin, urlsplit
from django.db import migrations, models
def forwards(apps, schema_editor):
MenuItem = apps.get_model('external_services', 'MenuItem')
items = (MenuItem.objects.all()
.exclude(service=None)
... | teemulehtinen/a-plus | external_services/migrations/0011_menuitem_menu_url.py | Python | gpl-3.0 | 1,720 | 0.003488 |
from concurrent.futures import ThreadPoolExecutor
import docker
import functools
# Common threaded executor for asynchronous jobs.
# Required for the AsyncDockerClient to operate.
_executor = ThreadPoolExecutor(1)
class AsyncDockerClient:
"""Provides an asynchronous interface to dockerpy.
All Client interfa... | simphony/simphony-remote | remoteappmanager/docker/async_docker_client.py | Python | bsd-3-clause | 2,391 | 0 |
"""n_answers migration
Revision ID: 7927d63d556
Revises: 1eb5febf4842
Create Date: 2014-08-08 14:02:36.738460
Delete the "n_answers" field from the "info" attribute/column as it is not used.
"""
# revision identifiers, used by Alembic.
revision = '7927d63d556'
down_revision = '1eb5febf4842'
from alembic import op
i... | PyBossa/pybossa | alembic/versions/7927d63d556_n_answers_migration.py | Python | agpl-3.0 | 1,841 | 0.008691 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/covid-19-open-data | src/pipelines/epidemiology/de_covid_19_germany_gae.py | Python | apache-2.0 | 2,120 | 0.000943 |
from django.db import migrations, models
from django.conf import settings
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... | eduNEXT/edx-platform | lms/djangoapps/course_goals/migrations/0001_initial.py | Python | agpl-3.0 | 1,064 | 0.00282 |
##########################################################################
#
# Copyright (c) 2011-2012, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# ... | DoubleNegativeVisualEffects/gaffer | python/GafferUITest/ProgressBarTest.py | Python | bsd-3-clause | 2,664 | 0.034535 |
import unittest
from aiourlstatus import app
class TestEmpty(unittest.TestCase):
def test_no_urls(self):
data = ''
urls, len_urls = app.find_sort_urls(data)
self.assertEqual(urls, [])
self.assertEqual(len_urls, 0)
class TestTXT(unittest.TestCase):
def test_parse_text(self):
... | riverrun/aiourlstatus | tests/parse_test.py | Python | gpl-3.0 | 990 | 0.008081 |
# -*- 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... | addition-it-solutions/project-all | addons/account_followup/account_followup.py | Python | agpl-3.0 | 28,847 | 0.010122 |
import os
import traceback,sys
CONFIG_FOLDER = "Configs"
def load_config(name):
try:
module = __import__("%s.%s" % (CONFIG_FOLDER,name), fromlist=["Config"])
except ImportError:
# Display error message
traceback.print_exc(file=sys.stdout)
raise ImportError("Failed to import mo... | sondree/Master-thesis | Python MOEA/utility.py | Python | gpl-3.0 | 592 | 0.015203 |
# Copyright 2019 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | jesseengel/magenta | magenta/models/gansynth/lib/train_util.py | Python | apache-2.0 | 18,904 | 0.006083 |
import numpy as np
from scipy.ndimage.filters import convolve
from scipy.ndimage import maximum_filter, gaussian_filter
from .. import MaskSeparationBase, SeparationException
from ..benchmark import HighLowPassFilter
from ... import AudioSignal
from ... import vamp_imported
import numpy as np
import scipy.signal
if v... | interactiveaudiolab/nussl | nussl/separation/primitive/melodia.py | Python | mit | 15,856 | 0.006244 |
import re
from enum import Enum
from context import ParsingContext
class UnrollerState(Enum):
START = 0
NAMES = 1
VALUES = 2
END = 3
class Unroller(object):
should_unroll_big = False
def __init__(self, unroll_big):
self.brackets_stack = []
self.names = []
self.value... | xklakoux/spock2kotlin | unroller.py | Python | mit | 6,026 | 0.002489 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino
#
# The licence is in the file __manifest__.py
#
###################... | eicher31/compassion-modules | logging_compassion/wizards/subscribe_logs.py | Python | agpl-3.0 | 789 | 0 |
import numpy
import chainer
from chainer import functions
from chainer import testing
@testing.parameterize(*testing.product({
'shape': [(4, 3, 2), (1,), (1, 2, 3, 4, 5, 6)],
'Wdim': [0, 1, 3],
'dtype': [numpy.float16, numpy.float32, numpy.float64],
}))
@testing.fix_random()
@chainer.testing.backend.inje... | pfnet/chainer | tests/chainer_tests/functions_tests/activation_tests/test_prelu.py | Python | mit | 1,845 | 0 |
from django.test import TestCase
from mock import Mock, patch
from paymentexpress.facade import Facade
from paymentexpress.gateway import AUTH, PURCHASE
from paymentexpress.models import OrderTransaction
from tests import (XmlTestingMixin, CARD_VISA, SAMPLE_SUCCESSFUL_RESPONSE,
SAMPLE_DECLINED_RESPO... | django-oscar/django-oscar-paymentexpress | tests/facade_tests.py | Python | bsd-3-clause | 7,334 | 0.001364 |
# -*- coding: utf-8 -*-
# Copyright (c)2013 Rackspace US, 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/LIC... | rackerlabs/heat-pyrax | pyrax/cloudcdn.py | Python | apache-2.0 | 7,833 | 0.000766 |
import os
WAGTAIL_ROOT = os.path.dirname(__file__)
STATIC_ROOT = os.path.join(WAGTAIL_ROOT, 'test-static')
MEDIA_ROOT = os.path.join(WAGTAIL_ROOT, 'test-media')
MEDIA_URL = '/media/'
DATABASES = {
'default': {
'ENGINE': os.environ.get('DATABASE_ENGINE', 'django.db.backends.sqlite3'),
'NAME': os.... | inonit/wagtail | wagtail/tests/settings.py | Python | bsd-3-clause | 4,667 | 0.000429 |
# coding: utf-8
from fabkit import task
from fablib.mongodb import MongoDB
mongodb = MongoDB()
@task
def setup():
mongodb.setup()
return {'status': 1}
| syunkitada/fabkit-repo | fabscript/openstack/mongodb.py | Python | mit | 163 | 0 |
#!/usr/bin/env python3
# Advent of Code 2016 - Day 7, Part One
import sys
import re
from itertools import islice
def window(seq, n=2):
"Returns a sliding window (of width n) over data from the iterable"
" s -> (s0,s1,...s[n-1]), (s1,s2,...,sn), ... "
it = iter(seq)
result = tuple(i... | mcbor/adventofcode | 2016/day07/day07-pt1.py | Python | mit | 1,067 | 0.00656 |
"""
Compatible with py2 and py3, inspired by jinjin2, future, etc
common types & functions:
name 2.x 3.x
------------ ----------- -----------
unichr unichr chr
unicode unicode str
range xrange range
string_types (str, unicode)... | wwfifi/uliweb | uliweb/utils/_compat.py | Python | bsd-2-clause | 10,959 | 0.00365 |
#!/usr/bin/env python3
## Estimates errors using Monte Carlo sampling
# Hamish Silverwood, GRAPPA, UvA, 23 February 2015
import numpy as np
import gl_helper as gh
import pdb
import pickle
import sys
import numpy.random as rand
import matplotlib.pyplot as plt
#TEST this will eventually go outside
def ErSamp_gauss_l... | PascalSteger/gravimage | programs/gi_mc_errors.py | Python | gpl-2.0 | 2,025 | 0.011852 |
# -*- coding: utf-8 -*-
#
# Copyright 2013 - 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 requir... | dzimine/mistral | mistral/api/controllers/v1/execution.py | Python | apache-2.0 | 4,285 | 0.000233 |
""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP855.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
... | zephyrplugins/zephyr | zephyr.plugin.jython/jython2.5.2rc3/Lib/encodings/cp855.py | Python | epl-1.0 | 34,106 | 0.019615 |
'''
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 use this ... | samiunn/incubator-tinkerpop | gremlin-python/src/main/jython/tests/structure/test_graph.py | Python | apache-2.0 | 4,417 | 0.001132 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2020_05_01/operations/_route_filters_operations.py | Python | mit | 27,222 | 0.004629 |
def foo():
# type: () -> int
print(42)
return 42
res = fo<caret>o() | jwren/intellij-community | python/testData/refactoring/inlineFunction/removingTypeComment/main.py | Python | apache-2.0 | 81 | 0.037037 |
# encoding: utf-8
__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"
'''
Holds some constants/settings related to celery.
'''
from androlyze.settings import *
############################################################
#---Max retry wait time
##################################... | nachtmaar/androlyze | androlyze/celery/CeleryConstants.py | Python | mit | 1,276 | 0.003135 |
#!/usr/bin/env python2
# coding=utf-8
"""
Defines gitver commands
"""
import re
import os
import sys
from string import Template
from termcolors import term, bold
from git import get_repo_info
from gitver.storage import KVStore
from sanity import check_gitignore
from defines import CFGDIR, PRJ_ROOT, CFGDIRNAME
from ... | manuelbua/gitver | gitver/commands.py | Python | apache-2.0 | 15,445 | 0.000129 |
# -*- coding: utf-8 -*-
"""
Created on Sun Aug 2 19:02:52 2015
@author: piotr at nicecircuits.com
"""
from libraryManager.symbol import symbol
from libraryManager.symbolPrimitive import *
from libraryManager.defaults import defaults
from libraryManager.common import *
class symbolIC(symbol):
"""
IC symbol g... | NiceCircuits/pcbLibraryManager | src/pcbLibraryManager/symbols/symbolsIC.py | Python | cc0-1.0 | 3,334 | 0.013197 |
import sklearn.cross_validation as cv
import sklearn.dummy as dummy
from sklearn.mixture import GMM
from sklearn.hmm import GMMHMM
from sklearn import linear_model, naive_bayes
import collections
import itertools
import pandas as pd
from testResults import TestResults
from counters import *
import utils as utils
cla... | phihes/sds-models | sdsModels/models.py | Python | mit | 12,892 | 0.000853 |
"""
WSGI config for polychart 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`... | Polychart/builder | server/polychart/wsgi.py | Python | agpl-3.0 | 1,058 | 0 |
#!/bin/env python
import os, sys
def usage():
print "%s WORK_DIR [num_results]" % sys.argv[0]
sys.exit(1)
try:
work_dir = sys.argv[1]
except:
print "you must specify your DenyHosts WORK_DIR"
usage()
try:
num = int(sys.argv[2])
except:
num = 10
fname = os.path.join(work_dir, "users-inval... | mobiledayadmin/DenyHosts | scripts/restricted_from_invalid.py | Python | gpl-2.0 | 884 | 0.013575 |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
# We use the inorder to find which elements are left and right of the curr element.
# And the post order to start with the fir... | saisankargochhayat/algo_quest | leetcode/106. Construct Binary Tree from Inorder and Postorder Traversal/soln.py | Python | apache-2.0 | 978 | 0.00818 |
#!/usr/bin/python
# Copyright (c) 2014 Wladimir J. van der Laan
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Run this script from the root of the repository to update all translations from
transifex.
It will do the follo... | moneta-project/moneta-2.0.1.0 | contrib/devtools/update-translations.py | Python | mit | 6,780 | 0.00649 |
from __future__ import absolute_import, print_function, division
from pony.py23compat import basestring
from functools import wraps
from contextlib import contextmanager
from pony.orm.core import Database
from pony.utils import import_module
def raises_exception(exc_class, msg=None):
def decorator(func... | Ahmad31/Web_Flask_Cassandra | flask/lib/python2.7/site-packages/pony/orm/tests/testutils.py | Python | apache-2.0 | 4,752 | 0.008207 |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any, Dict, Optional
if False:
import zerver.tornado.event_queue
descriptors_by_handler_id = {} # type: Dict[int, zerver.tornado.event_queue.ClientDescriptor]
def get_descriptor_by_handler_id(handler_id):
# type:... | christi3k/zulip | zerver/tornado/descriptors.py | Python | apache-2.0 | 821 | 0.00609 |
from pycp2k.inputsection import InputSection
class _basis4(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Default_keyword = []
self._name = "BASIS"
self._repeated_default_keywords = {'Default_keyword': 'DEFAULT_KEYWORD'}
self._attributes = ['Default_key... | SINGROUP/pycp2k | pycp2k/classes/_basis4.py | Python | lgpl-3.0 | 328 | 0.006098 |
import io
import sys
import pytest
import progressbar
def test_nowrap():
# Make sure we definitely unwrap
for i in range(5):
progressbar.streams.unwrap(stderr=True, stdout=True)
stdout = sys.stdout
stderr = sys.stderr
progressbar.streams.wrap()
assert stdout == sys.stdout
assert... | WoLpH/python-progressbar | tests/test_stream.py | Python | bsd-3-clause | 2,391 | 0 |
'''
Designs oligos for a pre RNA-seq selection method
'''
### imports ###
import sys
import os
import numpy as np
def readFastaFile(fastaFilePath):
'''
Given a path to a multiline fasta file, reads the file, returning two lists - one containing the sequences, the other containing the headers
inputs: path to a fas... | jenhantao/preRNA-seq_OligoDesigner | makeAllOligos.py | Python | bsd-2-clause | 2,270 | 0.031718 |
import pytest
import salt.engines
from tests.support.mock import MagicMock, patch
def test_engine_module_name():
engine = salt.engines.Engine({}, "foobar.start", {}, {}, {}, {}, name="foobar")
assert engine.name == "foobar"
def test_engine_title_set():
engine = salt.engines.Engine({}, "foobar.start", {}... | saltstack/salt | tests/pytests/unit/engines/test_engines.py | Python | apache-2.0 | 595 | 0.003361 |
import os
import re
import json
def createSpeciesJson(source_data_path):
# create the species.json file using data from the specified path
# traverse directories looking for dirs named "1km". If it's
# path matches this pattern:
# .../<taxon-name>/models/<species-name>/1km
# then record that as ... | jcu-eresearch/climas-ng | webapp/climasng/data/datafinder.py | Python | apache-2.0 | 2,719 | 0.004046 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2017 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#... | MDAnalysis/mdanalysis | testsuite/MDAnalysisTests/coordinates/test_dms.py | Python | gpl-2.0 | 3,032 | 0.00033 |
#############
# ECE 612 Spring 2017
# Joe Parrish
#
# Use the same logic from SpectrumTester.py to generate multiple sine waves
# but write that output to a .wav file for file based testing of the project code
#############
import wave
import argparse
import numpy as np
def generate_sample_file(test_freqs, test_amps... | parrisha/raspi-visualizer | samples/WavGenerator.py | Python | mit | 1,233 | 0.024331 |
__author__ = 'Andrew Williamson <[email protected]>'
| Atothendrew/XcodeBuildIncrementer | XcodeBuildIncrementer/__init__.py | Python | mit | 60 | 0 |
# -*- coding: utf-8 -*-
"""Init and utils."""
from zope.i18nmessageid import MessageFactory
_ = MessageFactory('dpf.sitetheme')
def initialize(context):
"""Initializer called when used as a Zope 2 product."""
| a25kk/dpf | src/dpf.sitetheme/dpf/sitetheme/__init__.py | Python | mit | 217 | 0 |
# Copyright (c) Mathias Kaerlev 2012.
# This file is part of Anaconda.
# Anaconda 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.
# ... | joaormatos/anaconda | mmfparser/data/chunkloaders/extdata.py | Python | gpl-3.0 | 1,201 | 0.004163 |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class User(AbstractUser):
# First Name and Last Name do not... | GeoMatDigital/django-geomat | geomat/users/models.py | Python | bsd-3-clause | 493 | 0 |
__author__ = 'Volodya'
from model.recordfields import RecordFields
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ['number of records', 'file'])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f... | Spasley/python | generator/record.py | Python | apache-2.0 | 1,285 | 0.005447 |
from django.apps import AppConfig
class ResearchersConfig(AppConfig):
name = 'researchers'
| luisen14/treatment-tracking-project | treatment_tracker/researchers/apps.py | Python | apache-2.0 | 97 | 0 |
#
# Copyright (C) 2017 FreeIPA Contributors. See COPYING for license
#
from __future__ import absolute_import
import binascii
import os
import psutil
import re
import subprocess
import textwrap
import pytest
from unittest.mock import patch, mock_open
from ipaplatform.paths import paths
from ipapython import ipaut... | encukou/freeipa | ipatests/test_ipaserver/test_install/test_installutils.py | Python | gpl-3.0 | 7,877 | 0.000127 |
import requests
from bs4 import BeautifulSoup
def getMemes():
memep1URL="http://www.quickmeme.com/page/1/"
memep2URL="http://www.quickmeme.com/page/2/"
memep3URL="http://www.quickmeme.com/page/3/"
memep4URL="http://www.quickmeme.com/page/4/"
memep5URL="http://www.quickmeme.com/page/5/"
memep6UR... | Jolopy/MizzyChan | mizzychan/app/crawl/rucrawler.py | Python | gpl-3.0 | 67,999 | 0.018721 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | thaim/ansible | lib/ansible/module_utils/network/checkpoint/checkpoint.py | Python | mit | 19,463 | 0.003853 |
# -*- coding: utf-8 -*-
"""
pidSim.py
A simulation of a vision control to steering PID loop accounting for communication and
processing latency and variation; demonstrates the impact of variation
to successful control when the control variable (CV) has direct influence on
the process variable (PV)
This allows student... | RocketRedNeck/PythonPlayground | pidSim.py | Python | mit | 18,070 | 0.008356 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.