code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
"""ThreatConnect TI Campaign"""
# standard library
from typing import TYPE_CHECKING
# first-party
from tcex.api.tc.v2.threat_intelligence.mappings.group.group import Group
if TYPE_CHECKING:
# first-party
from tcex.api.tc.v2.threat_intelligence.threat_intelligence import ThreatIntelligence
class Campaign(Gro... | ThreatConnect-Inc/tcex | tcex/api/tc/v2/threat_intelligence/mappings/group/group_types/campaign.py | Python | apache-2.0 | 1,625 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nebula, Inc.
# Copyright 2013 Alessio Ababilov
# Copyright 2013 Grid Dynamics
# Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complia... | aababilov/python-marconiclient | marconiclient/common/apiclient/auth/response.py | Python | apache-2.0 | 6,051 |
# Generates alternating frames of a checkerboard pattern.
Q_STARTING_INDEX = 150
UNIVERSE_LIGHTS = 144 #144 for side 1, #116 for side 2
flip = 0
for i in range(1,200): # 5 seconds * 40 / second (frame)
print "Record Cue " + str(Q_STARTING_INDEX + i)
for j in range (1, UNIVERSE_LIGHTS * 3, 1): # 3 channels / l... | ScienceWorldCA/domelights | backend/scripts/checkerboard.py | Python | apache-2.0 | 510 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | guillaume-philippon/aquilon | lib/aquilon/worker/commands/map_service.py | Python | apache-2.0 | 3,474 |
# coding=utf-8
# Copyright 2015 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 os
from pant... | digwanderlust/pants | contrib/cpp/src/python/pants/contrib/cpp/tasks/cpp_compile.py | Python | apache-2.0 | 3,678 |
# Copyright 2013 OpenStack Foundation
#
# 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 l... | julianwang/cinder | cinder/volume/drivers/rbd.py | Python | apache-2.0 | 40,525 |
# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the License);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... | SVilgelm/CloudFerry | cloudferry/lib/base/migration.py | Python | apache-2.0 | 3,610 |
# Copyright 2014 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.0
#
# Unless requir... | nash-x/hws | neutron/db/vpn/vpn_validator.py | Python | apache-2.0 | 4,980 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import random
sys.path.append('.')
from twisted.internet import reactor
import marionette_tg.driver
import marionette_tg.multiplexer
import marionette_tg.record_layer
import marionette_tg.updater
EVENT_LOOP_FREQUENCY_S = 0.01
AUTOUPDATE_DELAY = 5
class Mari... | irdan/marionette | marionette_tg/__init__.py | Python | apache-2.0 | 6,400 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: contextlib
import sys
from functools import wraps
from warnings import warn
__all__ = ['contextmanager', 'nested', 'closing']
class GeneratorContextManager(object):
def __init__(self, gen):
self.gen = gen
def __enter__(self):
... | DedMemez/ODS-August-2017 | contextlib.py | Python | apache-2.0 | 2,267 |
""" P1 tests for Dedicating Guest Vlan Ranges
"""
# Import Local Modules
from marvin.cloudstackAPI import *
from marvin.cloudstackTestCase import *
from marvin.lib.base import *
from marvin.lib.common import *
from marvin.lib.utils import *
from nose.plugins.attrib import attr
class TestDedicateGuestVlanRange(cloudst... | remibergsma/cosmic | cosmic-core/test/integration/smoke/test_guest_vlan_range.py | Python | apache-2.0 | 4,610 |
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.
import sys
sys.path.append("./CommonTestScripts")
import Test
doc = atfDocService.OpenNewDocument(editor)
#===================== 0: root ==================================
Test.Equal(0, Test.GetEnumerableCount(treeLister.TreeView.GetChil... | mindbaffle/ATF | Test/FunctionalTests/DomTreeEditorTestScripts/AddAllItems.py | Python | apache-2.0 | 20,874 |
import codecs
from setuptools import setup
with codecs.open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name="shadowsocks",
version="2.8.2.1",
license='http://www.apache.org/licenses/LICENSE-2.0',
description="A fast tunnel proxy that help you get through firewalls",
... | gitchs/shadowsocks | setup.py | Python | apache-2.0 | 1,323 |
#!/usr/bin/python
#
# Copyright 2008 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 app... | kdlucas/pyrering | lib/baserunner_test.py | Python | apache-2.0 | 10,873 |
__author__ = 'Joe Linn'
#import pylastica
import pylastica.response
class Response(pylastica.response.Response):
def __init__(self, response_data, action, op_type):
"""
@param response_data:
@type response_data: dict or str
@param action:
@type action: pylastica.bulk.actio... | jlinn/pylastica | pylastica/bulk/response.py | Python | apache-2.0 | 926 |
#
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... | yashdsaraf/scancode-toolkit | tests/extractcode/test_patch.py | Python | apache-2.0 | 72,541 |
# Copyright 2001 by Tarjei Mikkelsen. All rights reserved.
# Copyright 2007 by Michiel de Hoon. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Code to work with the KEGG En... | poojavade/Genomics_Docker | Dockerfiles/gedlab-khmer-filter-abund/pymodules/python2.7/lib/python/Bio/KEGG/Enzyme/__init__.py | Python | apache-2.0 | 10,978 |
# 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 ... | Itxaka/st2 | st2actions/tests/unit/test_paramiko_ssh.py | Python | apache-2.0 | 9,657 |
# Copyright 2013 NEC Corporation.
# 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... | nuagenetworks/tempest | tempest/lib/services/compute/aggregates_client.py | Python | apache-2.0 | 4,667 |
"""Auto-generated file, do not edit by hand. GG metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_GG = PhoneMetadata(id='GG', country_code=44, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[135789]\\d{6,9}', possible_length=(7, 9,... | gencer/python-phonenumbers | python/phonenumbers/data/region_GG.py | Python | apache-2.0 | 1,706 |
import requests
import logging
from fetcher import fetch
from os.path import join
from urlobj import URLObj
from urllib.parse import urljoin, urlsplit, urlunsplit
class RobotsParser:
def __init__(self, domain):
self.domain = domain
# Check if the file even exists first.
def exists(self):
r... | get9/monkeyshines | robotsparser.py | Python | apache-2.0 | 1,038 |
"""Tests for the init module."""
import asyncio
from asynctest import Mock, patch
from pyheos import CommandError, const
import pytest
from homeassistant.components.heos import (
ControllerManager,
async_setup_entry,
async_unload_entry,
)
from homeassistant.components.heos.const import (
DATA_CONTROLL... | fbradyirl/home-assistant | tests/components/heos/test_init.py | Python | apache-2.0 | 7,448 |
# 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 ... | chregu/cf-php-varnish-buildpack | extensions/composer/extension.py | Python | apache-2.0 | 16,172 |
"""Defines the data needed for executing a job"""
from __future__ import unicode_literals
import logging
import os
from numbers import Integral
from job.configuration.data.data_file import DATA_FILE_PARSE_SAVER, DATA_FILE_STORE
from job.configuration.data.exceptions import InvalidData
from job.configuration.results.j... | ngageoint/scale | scale/job/configuration/data/job_data.py | Python | apache-2.0 | 35,293 |
# 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... | hfp/tensorflow-xsmm | tensorflow/python/kernel_tests/list_ops_test.py | Python | apache-2.0 | 51,102 |
from rest_framework import permissions
from rest_framework.permissions import BasePermission
class IsAuthenticatedOrCreate(permissions.IsAuthenticated):
def has_permission(self, request, view):
if request.method == 'POST':
return True
return super(IsAuthenticatedOrCreate, self).has_perm... | CornellProjects/hlthpal | web/project/main/permissions.py | Python | apache-2.0 | 624 |
#!/usr/bin/env python
"""Load all flows so that they are visible in the registry."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
# pylint: disable=unused-import
# These imports populate the Flow registry
from grr_response_server.flows.general import ad... | dunkhong/grr | grr/server/grr_response_server/flows/general/registry_init.py | Python | apache-2.0 | 1,568 |
input = raw_input();
print input
| dheerajgoudb/Hackerrank | Python/Introduction/Reading_raw_input.py | Python | apache-2.0 | 33 |
# -*- coding: utf-8 -*-
# flake8: noqa
# Disable Flake8 because of all the sphinx imports
#
# 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 licens... | owlabs/incubator-airflow | docs/conf.py | Python | apache-2.0 | 17,740 |
"""Support for Hangouts."""
import logging
from hangups.auth import GoogleAuthError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.conversation.util import create_matcher
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASS... | mezz64/home-assistant | homeassistant/components/hangouts/__init__.py | Python | apache-2.0 | 4,741 |
import asyncio
import inspect
import logging
from typing import List, Tuple, Callable, NamedTuple
from lightbus.schema.schema import Parameter
from lightbus.message import EventMessage
from lightbus.client.subclients.base import BaseSubClient
from lightbus.client.utilities import validate_event_or_rpc_name, queue_exce... | adamcharnock/lightbus | lightbus/client/subclients/event.py | Python | apache-2.0 | 12,494 |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/traffic_engineering/tlvs/tlv/link/sub_tlvs/sub_tlv/__init__.py | Python | apache-2.0 | 37,904 |
try:
from django.apps import AppConfig
except ImportError:
pass
else:
class GargoyleAppConfig(AppConfig):
name = 'gargoyle'
def ready(self):
try:
import nexus
except ImportError:
pass
else:
from gargoyle.nex... | blueprinthealth/gargoyle | gargoyle/apps.py | Python | apache-2.0 | 417 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v10/resources/types/recommendation.py | Python | apache-2.0 | 31,171 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 文档测试
class Dict(dict):
'''
Simple dict but also support access as x.y style
>>> d1 = Dict()
>>> d1['x'] = 100
>>> d1.x
100
>>> d1.y = 200
>>> d1['y']
200
>>> d2 = Dict(a=1, b=2, c='3')
>>> d2.c
'3'
>>> d2['empty']
Traceback (... | henryneu/Python | sample/mydict2.py | Python | apache-2.0 | 836 |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 21 20:05:40 2016
@author: lucia
"""
def funcion1():
print('Primera funcion de mi projecttwo')
print('Modifico la primera funcion 2')
| luciamc/projecttwo | funcion1.py | Python | apache-2.0 | 190 |
import asyncio
from itertools import compress
import traceback
from proxypool.rules.rule_base import CrawlerRuleBase
from proxypool.utils import page_download, page_download_phantomjs, logger, Result
class ProxyCrawler(object):
"""Crawl proxies according to the rules."""
def __init__(self, proxies, rules=No... | arrti/proxypool | proxypool/proxy_crawler.py | Python | apache-2.0 | 4,906 |
import hashlib
from unittest import TestCase
import uuid
from falcon import request
from stoplight import validate
from stoplight.exceptions import ValidationFailed
from deuce.transport import validation as v
from deuce.transport.wsgi import errors
class MockRequest(object):
pass
class InvalidSeparatorError(E... | rackerlabs/deuce | deuce/tests/test_validation.py | Python | apache-2.0 | 21,839 |
from selenium_test_case import SeleniumTestCase
class DocsTest(SeleniumTestCase):
def test_links_between_pages(self):
self.open_path('/help')
self.assert_text_present('Frequently Asked Questions')
self.click_and_wait('link=Terms of Service')
self.assert_text_present('Terms of Serv... | Princessgladys/googleresourcefinder | tests/docs_test.py | Python | apache-2.0 | 2,824 |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'pyphrb'
from .import index
from flask import render_template
from model import NameFrom
@index.route('/', methods=['GET', 'POST'])
def index():
name = None
form = NameFrom()
if form.validate_on_submit():
name = form.name.data
form.name.data... | pyphrb/myweb | app/index/view.py | Python | apache-2.0 | 394 |
config = {
"interfaces": {
"google.spanner.admin.database.v1.DatabaseAdmin": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": [],
},
"retry_params": {
"default": {
... | tseaver/google-cloud-python | spanner/google/cloud/spanner_admin_database_v1/gapic/database_admin_client_config.py | Python | apache-2.0 | 2,633 |
from django.conf import settings
from django.db import models
from django.core.cache import cache
from django.dispatch import receiver
from seahub.base.fields import LowerCaseCharField
from seahub.profile.settings import EMAIL_ID_CACHE_PREFIX, EMAIL_ID_CACHE_TIMEOUT
from registration.signals import user_registered
cl... | skmezanul/seahub | seahub/profile/models.py | Python | apache-2.0 | 3,686 |
# Copyright 2014 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.0
#
# Unless requir... | gaolichuang/neutron-fwaas | neutron_fwaas/services/firewall/drivers/cisco/csr_firewall_svc_helper.py | Python | apache-2.0 | 10,054 |
from collections import deque
class onetimequeue(object):
def __init__ (self):
self._q = deque()
self._seen = set()
def push(self, obj):
if obj in self._seen:
return
self._seen.add(obj)
self._q.append(obj)
def pop(self):
return self._q.popleft()
def __len__(self):
return ... | bniemczyk/symbolic | symath/datastructures/onetimequeue.py | Python | bsd-2-clause | 333 |
from flask_wtf import Form
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import DataRequired
class LoginForm(Form):
username = StringField('ID or Email Address', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
submit = S... | ACM-CSUSB/Website | service/forms/login.py | Python | bsd-2-clause | 370 |
from datetime import datetime
from unittest import skipIf
import copy
import uuid
from cassandra.cqlengine import ValidationError as CQLValidationError
from django.core import validators
from django.forms import fields
from common.models import CassandraFamilyMember
from django_cassandra_engine.test import TestCase a... | r4fek/django-cassandra-engine | testproject/common/tests/test_django_cassandra_models.py | Python | bsd-2-clause | 15,971 |
import datetime
from pystogram.tree import PrefixTree
SECOND = 1
MINUTE = SECOND * 60
HOUR = MINUTE * 60
DAY = HOUR * 24
MONTH = DAY * 30
YEAR = DAY * 365
# The multiplier applied when testing timestamp interval to guess a resolution.
# A value of 2.0 means the timestamp interval must be greater than 24 mon... | claymation/pystogram | pystogram/histogram.py | Python | bsd-2-clause | 3,484 |
import logging
import traceback
from functools import wraps
import os
import re
from django.conf import settings
from django.db import connection
from django.db.models import ManyToManyField
logger = logging.getLogger(__name__)
def debug_pg_notices(f):
@wraps(f)
def wrapped(*args, **kwargs):
r = No... | GeotrekCE/Geotrek-admin | geotrek/common/utils/postgresql.py | Python | bsd-2-clause | 6,597 |
# -*- 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 unique constraint on 'Assessment', fields ['user', 'sample_result']
db.create_unique('assessment', ... | chop-dbhi/varify-data-warehouse | vdw/assessments/migrations/0007_auto__add_unique_assessment_user_sample_result.py | Python | bsd-2-clause | 20,310 |
from django.test import TestCase, Client
from sendgrid import utils, signals
import json
class SignalTestCase(TestCase):
def setUp(self):
self.client = Client()
self.email_data = {'subject': 'Test Subject',
'body': 'Hi, I am a test body',
'fr... | resmio/django-sendgrid | sendgrid/tests/test_signals.py | Python | bsd-2-clause | 3,625 |
#! /usr/bin/env python
import signal
import pickle
import platform
import socket
import time
from pika import BasicProperties
import portbuild.qthreads as qthreads
import portbuild.torrent as torrent
import portbuild.util as util
ready = []
class AgentProducer(qthreads.QueueProducerThread):
def __init__(self):
... | flz/portbuild-ng | bin/qmanager-agent.py | Python | bsd-2-clause | 3,560 |
"""
WSGI config for auth_example 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_APPLICATI... | 18F/django-rest-swagger | tests/auth_example/auth_example/wsgi.py | Python | bsd-2-clause | 1,437 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Michael Droettboom All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, t... | mdboom/freetypy | docstrings/bitmap.py | Python | bsd-2-clause | 5,308 |
# -*- coding: UTF-8 -*-
# Copyright 2009-2014 by Luc Saffre.
# License: BSD, see file LICENSE for more details.
"""
Documented in :ref:`dpy`.
"""
import logging
logger = logging.getLogger(__name__)
from StringIO import StringIO
import os
import imp
from decimal import Decimal
from django.conf import settings
fro... | lsaffre/north | north/dpy.py | Python | bsd-2-clause | 31,247 |
__version__ = '0.0.9'
__author__ = 'Igor Vasilcovsky'
| vasilcovsky/pytinypng | pytinypng/__init__.py | Python | bsd-2-clause | 54 |
### extends 'class_empty.py'
### block ClassImports
# NOTICE: Do not edit anything here, it is generated code
from . import gxapi_cy
from geosoft.gxapi import GXContext, float_ref, int_ref, str_ref
### endblock ClassImports
### block Header
# NOTICE: The code generator will not replace the code in this block
### end... | GeosoftInc/gxpy | geosoft/gxapi/GXRA.py | Python | bsd-2-clause | 5,242 |
from JumpScale import j
class test_complextype_user_osismodelbase(j.code.classGetJSRootModelBase()):
"""
group of users
"""
def __init__(self):
pass
self._P_id=0
self._P_organization=""
self._P_name=""
self._P_emails=list()
self._P_groups=list()
s... | Jumpscale/jumpscale6_core | apps/osis/logic/test_complextype/user/test_complextype_user_osismodelbase.py | Python | bsd-2-clause | 5,069 |
import matplotlib as mpl
mpl.rcParams['font.size'] = 14
from morphforge.stdimports import *
from morphforgecontrib.stdimports import *
eqnset_txt_na = """
define_component hh_na {
i = g * (v-erev) * m**3*h
m_inf = m_alpha_rate / (m_alpha_rate + m_beta_rate)
m_tau = 1.0 / (m_alpha_rate + m_beta... | mikehulluk/morphforge | doc/srcs_generated_examples/python_srcs/poster1.py | Python | bsd-2-clause | 4,063 |
# Copyright (c) 2015, Anthony Schmieder
# Use of this source code is governed by the 2-clause BSD license that
# can be found in the LICENSE.txt file.
"""Loads and manages art assets"""
import pyglet
import os
_ASSET_PATHS = ["res"]
_ASSET_FILE_NAMES = [
"black_key_down.png",
"black_key_up.png",
"white_ke... | aschmied/keyzer | ui/assetmanager.py | Python | bsd-2-clause | 1,180 |
#!/usr/bin/env python3
# Copyright 2015 Dietrich Epp.
# This file is part of SGGL. SGGL is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
import glgen.__main__
glgen.__main__.main()
| depp/sggl | sggl.py | Python | bsd-2-clause | 232 |
#!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
requirements = [ 'pyte', 'docopt' ]
try:
import asyncio
except ImportError:
requirements.append('asyncio')
setup(
name='libpymux',
author='Jonathan Slenders',
version='... | jonathanslenders/libpymux | setup.py | Python | bsd-2-clause | 617 |
from celery.app.task import BaseTask
from sphinx.ext import autodoc
class TaskDocumenter(autodoc.DataDocumenter):
@classmethod
def can_document_member(cls, member, membername, isattr, parent):
if isinstance(member, BaseTask):
return True
def setup(app):
app.add_autodocumenter(TaskDocumenter)
| melinath/django-kiki | docs/_ext/kikidocs.py | Python | bsd-2-clause | 305 |
"""
Copyright (c) 2016-2017, Kir Chou
https://github.com/note35/sinon/blob/master/LICENSE
A set of functions for handling known error
"""
def __exception_helper(msg, exception=Exception): #pylint: disable=missing-docstring
raise exception(msg)
def mock_type_error(obj): #pylint: disable=missing-docstring
erro... | note35/sinon | sinon/lib/util/ErrorHandler.py | Python | bsd-2-clause | 2,133 |
# coding: utf-8
import os
from difflib import SequenceMatcher
from unicodedata import normalize
def remove_diacritics(s):
try:
s = normalize('NFKD', s)
except TypeError:
s = normalize('NFKD', unicode(s, "utf-8"))
finally:
return s.encode('ASCII', 'ignore').decode('ASCII')
def rem... | scieloorg/xylose | xylose/aff_validator.py | Python | bsd-2-clause | 3,052 |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 11 13:55:17 2014
@author: sm1fg
This is the main module to construct a magnetohydrostatic solar atmosphere,
given a specified magnetic network of self-similar magnetic flux tubes and
save the output to gdf format.
To select an existing configuration change the import as... | Cadair/pysac | examples/mhs_atmosphere/spruit_atmosphere.py | Python | bsd-2-clause | 12,258 |
# django-openid-auth - OpenID integration for django.contrib.auth
#
# Copyright (C) 2007 Simon Willison
# Copyright (C) 2008-2013 Canonical Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions o... | somcomltd/django-openid-auth | example_consumer/settings.py | Python | bsd-2-clause | 5,789 |
# -*- 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):
# Changing field 'Field.choices'
db.alter_column(u'forms_field', 'choice... | Afnarel/django-forms-builder | forms_builder/forms/south_migrations/0014_auto__chg_field_field_choices.py | Python | bsd-2-clause | 8,984 |
from pymacaron.log import pymlogger
import multiprocessing
from math import ceil
from pymacaron.config import get_config
log = pymlogger(__name__)
# Calculate resources available on this container hardware.
# Used by pymacaron-async, pymacaron-gcp and pymacaron-docker
def get_gunicorn_worker_count(cpu_count=None):... | erwan-lemonnier/klue-microservice | pymacaron/resources.py | Python | bsd-2-clause | 1,638 |
import base64
import hashlib
import logging
import re
import urllib
import urlparse
import xmlrpclib
import redis
import requests
import lxml.html
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.db import transaction
from d... | crateio/crate.pypi | crate/pypi/processor.py | Python | bsd-2-clause | 23,954 |
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User, Group
from .endpoint import Endpoint
DEFAULT_STORE_SLUG = getattr(settings, 'DEFAULT_STORE_SLUG', 'public')
class Store(models.Model):
slug = models.SlugField(primary_key=True)
name = models.CharField(m... | ox-it/humfrey | humfrey/sparql/models.py | Python | bsd-3-clause | 1,393 |
import faker
import faker.providers
import faker.providers.address
import faker.providers.address.cs_CZ
import faker.providers.address.de_DE
import faker.providers.address.el_GR
import faker.providers.address.en
import faker.providers.address.en_AU
import faker.providers.address.en_CA
import faker.providers.address.en_... | jjhelmus/berryconda | recipes/faker/run_test.py | Python | bsd-3-clause | 7,740 |
#!/usr/bin/env python3
import cv2
import numpy as np
from vision import camera_message_framework
import itertools
import time
shape = (500, 500, 3)
size = 1
for dim in shape:
size *= dim
def image_of(axes):
im = np.zeros(shape, dtype=np.uint8)
im[:, :, axes] = 255
return im
black = image_of([]), 'bl... | cuauv/software | vision/utils/image_ordering_test.py | Python | bsd-3-clause | 877 |
import unittest
import tempfile
from jsonconfigparser import JSONConfigParser, NoSectionError, ParseError
class JSONConfigTestCase(unittest.TestCase):
def test_init(self):
JSONConfigParser()
def test_read_string(self):
cf = JSONConfigParser()
cf.read_string((
'[section]\... | bwhmather/json-config-parser | jsonconfigparser/tests/__init__.py | Python | bsd-3-clause | 6,075 |
#coding=utf-8
"""
Command-line interface utilities for Trigger tools. Intended for re-usable
pieces of code like user prompts, that don't fit in other utils modules.
"""
__author__ = 'Jathan McCollum'
__maintainer__ = 'Jathan McCollum'
__email__ = 'jathan.mccollum@teamaol.com'
__copyright__ = 'Copyright 2006-2012, AO... | sysbot/trigger | trigger/utils/cli.py | Python | bsd-3-clause | 9,769 |
# Copyright (c) 2006 The Regents of The University of Michigan
# 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 copyright
# notice, this list ... | ayoubg/gem5-graphics | gem5-gpu/tests/quick/se_gpu/20.bh/test.py | Python | bsd-3-clause | 1,653 |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... | ContinuumIO/ashiba | enaml/enaml/qt/qt_color_dialog.py | Python | bsd-3-clause | 5,551 |
# -*- coding: utf-8 -*-
"kanbanpad.com API v1 library for Python"
from kanbanpad import _version
VERSION = _version.tuple
__author__ = "Marek Wywia\xc5\x82"
__contact__ = "onjinx@gmail.com"
__homepage__ = "http://github.com/onjin/python-kanbanpad"
__version__ = _version.dotted
| onjin/python-kanbanpad | kanbanpad/__init__.py | Python | bsd-3-clause | 281 |
from collections import namedtuple
from datetime import date, datetime, timedelta
from cms.models import CMSPlugin
from django.db import models
from django.utils.formats import date_format, time_format
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from ..c... | leprikon-cz/leprikon | leprikon/models/orderables.py | Python | bsd-3-clause | 11,902 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import get_language, to_locale
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .conf import settings
from .models import FacebookComments
class FacebookCommentsPlugin(CMSPluginBase):... | mishbahr/djangocms-fbcomments | djangocms_fbcomments/cms_plugins.py | Python | bsd-3-clause | 1,136 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("AdaBoostClassifier" , "iris" , "mysql")
| antoinecarme/sklearn2sql_heroku | tests/classification/iris/ws_iris_AdaBoostClassifier_mysql_code_gen.py | Python | bsd-3-clause | 137 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'TtTrip.date'
db.add_column(u'timetable_tttrip', 'date',
... | hasadna/OpenTrain | webserver/opentrain/timetable/migrations/0006_auto__add_field_tttrip_date.py | Python | bsd-3-clause | 2,370 |
from __future__ import unicode_literals
from django.contrib.syndication.views import Feed
from django.shortcuts import get_object_or_404
from .models import Category
class CategoryFeed(Feed):
def get_object(self, request, slug):
return get_object_or_404(Category.objects.categories(), slug=slug)
de... | eliostvs/django-kb | kb/category/feeds.py | Python | bsd-3-clause | 846 |
#!/usr/bin/env python
# Copyright (c) 2009, Purdue University
# 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 copyright notice, this
# l... | stephenlienharrell/roster-dns-management | roster-config-manager/setup.py | Python | bsd-3-clause | 3,685 |
# -*- coding: utf-8 -*-
# ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# @... | giltis/scikit-xray | skxray/core/constants/xrs.py | Python | bsd-3-clause | 10,527 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 0, transform = "Logit", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingMedian/cycle_0/ar_/test_artificial_32_Logit_MovingMedian_0__100.py | Python | bsd-3-clause | 263 |
#!/usr/bin/python
"""
Small web application to retrieve information from uniprot and itag for
a given compound.
The idea is that for one compound we are able to find out in which
reactions it is involved and what are the proteins involved in these
reactions. For each of these proteins we can find if there are genes a... | PBR/chebi2gene | chebi2gene.py | Python | bsd-3-clause | 17,793 |
import sys
from craystack import cf
if len(sys.argv) < 4:
print "Usage: %s <key> <subkey> <path>" % sys.argv[0]
sys.exit(2)
_, key, subkey, filename = sys.argv
with open(filename) as f:
content = f.read()
cf.insert(key, {subkey: content})
print "Uploaded %s to %s/%s (%s bytes)" % (filename, key,... | rbranson/craystack | upload.py | Python | bsd-3-clause | 343 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-present, CloudZero, Inc. All rights reserved.
# Licensed under the BSD-style license. See LICENSE file in the project root for full license information.
import pytest
from reactor.aws.cloudtrail import traverse_map, CloudTrailEvent
def test_traverse_map():
d = {'x': ... | Cloudzero/cloudzero-reactor-aws | test/unit/aws/test_unit_cloudtrail.py | Python | bsd-3-clause | 4,413 |
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from six.moves import map
def get_user_model():
"""
R... | elliotthill/django-oscar | oscar/core/compat.py | Python | bsd-3-clause | 4,157 |
from ...io.managers.context_manager import ContextManager
COLLISION_STRATEGIES = ['fail', 'replace']
class SQLClient:
"""SQLClient class is a client to run SQL queries in a CARTO account.
It also provides basic SQL utilities for analyzing and managing tables.
Args:
credentials (:py:class:`Creden... | CartoDB/cartoframes | cartoframes/data/clients/sql_client.py | Python | bsd-3-clause | 11,090 |
import cv2
import fitparse
import os
fname = 'V0280048.MP4'
fitfile ='2018-06-01-12-13-33.fit'
vidcap = cv2.VideoCapture(fname)
success,image = vidcap.read()
success
count = 0
if success:
stream = fname.split('.')[-2]
os.mkdir(stream)
while success:
cv2.imwrite("{}/{}_frame{}.jpg".format(stream,strea... | GFZ-Centre-for-Early-Warning/REM_RRVS | permanent-tools/VIRB360/extract_frames.py | Python | bsd-3-clause | 1,214 |
# -*- coding: utf-8 -*-
"""
Functions for calculation of potential and actual evaporation
from meteorological data.
Potential and actual evaporation functions
==========================================
- E0: Calculate Penman (1948, 1956) open water evaporation.
- Em: Calculate evaporation according to... | timcera/mettoolbox | src/mettoolbox/evaplib.py | Python | bsd-3-clause | 23,762 |
# Authors: Robert Luke <mail@robertluke.net>
#
# License: BSD (3-clause)
from configparser import ConfigParser, RawConfigParser
import glob as glob
import re as re
import os.path as op
import numpy as np
from ..base import BaseRaw
from ..constants import FIFF
from ..meas_info import create_info, _format_dig_points
f... | Teekuningas/mne-python | mne/io/nirx/nirx.py | Python | bsd-3-clause | 13,599 |
import click
from .. import templates
@click.group()
def generate():
pass
@generate.command()
@click.argument('name')
@click.option('--path', required=True)
@click.pass_context
def blueprint(ctx, name, path):
app = ctx.obj
templates.extract_template(
'snippets/blueprint.py',
app.get_bluep... | vmalloc/weber-cli | weber/cli/generate.py | Python | bsd-3-clause | 427 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import (
force_text, python_2_unicode_compatible)
from django.utils.translation import ugettext_lazy as _
from select_multiple_field.models import Se... | kelvinwong-ca/django-select-multiple-field | test_projects/django14/suthern/models.py | Python | bsd-3-clause | 1,575 |
import os
from django import forms
from pontoon.base.models import (
Locale,
ProjectLocale,
User,
UserProfile
)
from pontoon.sync.formats import SUPPORTED_FORMAT_PARSERS
class NoTabStopCharField(forms.CharField):
widget = forms.TextInput(attrs={'tabindex': '-1'})
class NoTabStopFileField(forms... | participedia/pontoon | pontoon/base/forms.py | Python | bsd-3-clause | 4,967 |
# proxy module
from __future__ import absolute_import
from chaco.tools.legend_highlighter import *
| enthought/etsproxy | enthought/chaco/tools/legend_highlighter.py | Python | bsd-3-clause | 99 |
# ~*~ coding: utf-8 ~*~
"""Module that contains a Marshmallow schema that generate JSON schemas.
JSON Schemas can be a pain to write by hand. For example, the product
requirements change, thus your schema changes. If you are maintaining your
schemas by hand, you have to go through all of them and update them, or, even... | croscon/fleaker | fleaker/marshmallow/json_schema.py | Python | bsd-3-clause | 7,584 |
"""Algorithms for partial fraction decomposition of rational functions. """
from __future__ import print_function, division
from sympy.polys import Poly, RootSum, cancel, factor
from sympy.polys.polytools import parallel_poly_from_expr
from sympy.polys.polyoptions import allowed_flags, set_defaults
from sympy.polys.p... | AunShiLord/sympy | sympy/polys/partfrac.py | Python | bsd-3-clause | 14,785 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import object
import requests
import types
from datetime import datetime, timedelta
from pprint import pformat
import urllib.request, urllib.parse, urllib... | native2k/lvbRequester | lvbRequester/lvbRequester.py | Python | bsd-3-clause | 9,165 |