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 |
|---|---|---|---|---|---|
""" Cisco_IOS_XR_parser_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR parser package configuration.
This module contains definitions
for the following management objects\:
parser\: Parser configuration
Copyright (c) 2013\-2015 by Cisco Systems, Inc.
All rights reserved.
"""
import... | abhikeshav/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_parser_cfg.py | Python | apache-2.0 | 21,226 |
#!/usr/bin/env python
#
# Copyright (C) 2013-2016 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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 a... | jhuttner/dx-toolkit | src/python/dxpy/scripts/dx_app_wizard.py | Python | apache-2.0 | 20,783 |
# Copyright (c) 2014 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 law or agreed to... | openstack/swift | swift/common/middleware/s3api/controllers/s3_acl.py | Python | apache-2.0 | 2,097 |
"""
Support for TPLink lights.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/light.tplink/
"""
import logging
import colorsys
import time
from homeassistant.const import (CONF_HOST, CONF_NAME)
from homeassistant.components.light import (
Light, AT... | ewandor/home-assistant | homeassistant/components/light/tplink.py | Python | apache-2.0 | 6,927 |
# -*- 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/mpls/lsps/static_lsps/static_lsp/transit/state/__init__.py | Python | apache-2.0 | 43,391 |
from control import BaseControl
from Tkinter import Menu as TkMenu, BooleanVar
class MenuItem(object):
def __init__(self, menu, title, **kwargs):
self._menu = menu
if kwargs.get('checkbox'):
# Checkbox menu item
self._checkvar = BooleanVar()
self._checkvar.set(kw... | todd-x86/tkplus | menu.py | Python | apache-2.0 | 2,534 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# file: hello.py
print('Hello!Python!')
| virus-warnning/pysamples | beginner/000-hello/hello.py | Python | apache-2.0 | 87 |
from disco.core import result_iterator
from discomll import dataset
from discomll.regression import locally_weighted_linear_regression
training_data = dataset.Data(data_tag=["test:regression_data1", "test:regression_data2"],
data_type="chunk",
id_index=0,
... | romanorac/discomll | discomll/examples/regression/locally_weighted_linear_regression_ddfs.py | Python | apache-2.0 | 871 |
"""
navdoon.destination.file
------------------------
Define destinations to flush metrics to files
"""
from navdoon.destination.stream import Stream, CsvStream
from navdoon.pystdlib.typing import Any
class TextFile(Stream):
"""Destination to flush metrics to a file"""
def __init__(self, name):
# ty... | farzadghanei/navdoon | navdoon/destination/file.py | Python | apache-2.0 | 1,149 |
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | google/eclipse2017 | geo/app/app/backend/eclipse2017_app.py | Python | apache-2.0 | 1,466 |
# 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
# ... | NeCTAR-RC/heat | heat/tests/test_validate.py | Python | apache-2.0 | 48,353 |
import vtk
class VtkAdaptor:
def __init__(self, **kwargs):
self.point_count = 0
self.face_count = 0
self.points = None
self.polys = None
self.poly_data = None
self.scalars = None
def create_empty_mesh(self):
self.pcoords = vtk.vtkFloatArray()
se... | cwant/tessagon | tessagon/adaptors/vtk_adaptor.py | Python | apache-2.0 | 1,395 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | citrix-openstack-build/oslo.cache | oslo_cache/backends/mongo.py | Python | apache-2.0 | 23,697 |
#!/usr/bin/env python
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | GoogleCloudPlatform/professional-services | examples/dataflow-dlp-hash-pipeline/scripts/hasher.py | Python | apache-2.0 | 4,114 |
# Copyright (c) 2014 LINBIT HA Solutions GmbH
# 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
#
... | os-cloud-storage/openstack-workload-disaster-recovery | contrib/cinder/volume/drivers/drbdmanagedrv.kilo.py | Python | apache-2.0 | 21,317 |
# Copyright 2015 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... | chris-chris/tensorflow | tensorflow/contrib/rnn/python/kernel_tests/core_rnn_cell_test.py | Python | apache-2.0 | 34,704 |
import sys, os
sys.path.insert(1, "../../../")
import h2o, tests
import numpy as np
from sklearn import ensemble
from sklearn.metrics import roc_auc_score
def ecologyGBM(ip,port):
#Log.info("Importing ecology_model.csv data...\n")
ecology_train = h2o.import_file(path=h2o.locate("smalldata/gbm_test/... | bospetersen/h2o-3 | h2o-py/tests/testdir_algos/gbm/pyunit_ecologyGBM.py | Python | apache-2.0 | 4,088 |
#!/usr/bin/env python
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Copyright 2016 Intel Corporation
#
# 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/lice... | handknitted/vagrant_snap | processor/rolling_average/rolling_average_processor.py | Python | apache-2.0 | 5,420 |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/mike/catkin_ws/install/include".split(';') if "/home/mike/catkin_ws/install/include" != "" else []
PROJECT_CATKIN_DEPENDS = "sensor_msgs;tf;urdf;diagnostic_updater;schunk_libm5api;libntcan;libpca... | mikewrock/phd_backup_full | build/phd/catkin_generated/pkg.installspace.context.pc.py | Python | apache-2.0 | 658 |
"""Support for Australian BOM (Bureau of Meteorology) weather service."""
import datetime
import ftplib
import gzip
import io
import json
import logging
import os
import re
import zipfile
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor... | fbradyirl/home-assistant | homeassistant/components/bom/sensor.py | Python | apache-2.0 | 11,621 |
import os
CONFIGURATION_NAME = 'ResourcesManager.conf'
SEPARATOR = ' = '
NEW_LINE = '\n'
TRUE = 'true'
FALSE = 'false'
FOLDER_NAME = 'ResourcesManager'
PROCESSED_FILES_FILE_NAME = 'processed.list'
PENDING_FILES_FILE_NAME = 'pending.list'
DEFAULT_EVENT_BUS_NAME = 'EventBus'
DEFAULT_KEYS = 'CFBundleURLTypes, UIAppFonts'... | IljaKosynkin/ResourcesManager | ResourceManager/scripts/Configuration.py | Python | apache-2.0 | 4,487 |
# Copyright (c) 2010-2012 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 law or agree... | openstack/swift | test/probe/common.py | Python | apache-2.0 | 30,724 |
# Copyright 2015 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... | annarev/tensorflow | tensorflow/python/keras/losses.py | Python | apache-2.0 | 76,501 |
from __future__ import absolute_import, division, unicode_literals
import glob
import logging
import operator
import os
import re
import sys
from mopidy import backend
from mopidy.m3u import translator
from mopidy.models import Playlist, Ref
logger = logging.getLogger(__name__)
class M3UPlaylistsProvider(backend.... | dbrgn/mopidy | mopidy/m3u/playlists.py | Python | apache-2.0 | 4,154 |
"""
Stdin: N/A
Stdout: N/A
Author: Jey Han Lau
Date: Nov 16
"""
import argparse
import sys
import codecs
import imp
import operator
import random
import os
import cPickle
import time as tm
import tensorflow as tf
import numpy as np
from geo_model import TGP
from util import *
#parse... | jhlau/twitter-deepgeo | geo_train.py | Python | apache-2.0 | 8,962 |
'''
Atomix project, plot_atoms.py, (TODO: summary)
Copyright (c) 2015 Stanford University
Released under the Apache License v2.0. See the LICENSE file for details.
Author(s): Manu Bansal
'''
import sys, os
from pyparse_util import *
import matplotlib
import matplotlib.pyplot as plt
FIGSIZE_PLOT_ATOMS = (70,70)
def pl... | manub686/atomix | tracescripts/plot_atoms.py | Python | apache-2.0 | 18,714 |
# 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/tools/compatibility/tf_upgrade_v2.py | Python | apache-2.0 | 43,754 |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2015] Michał Szczygieł, M4GiK Software
#
# 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... | Dev-Cloud-Platform/Dev-Cloud | dev_cloud/database/models/installed_applications.py | Python | apache-2.0 | 1,472 |
import treeprint
import copy
def traverse(tree,ident = 1):
me = treeprint.treeprinter(tree)
me.printt()
class node:
def __init__(self,name = ""):
self.parent = None
self.children = [] # stack with all the nocdes
self.name = name
self.attr = {}
def appendchild(self,name=N... | christ2go/pycal | src/tree/node.py | Python | apache-2.0 | 2,033 |
# Copyright (c) 2013-2016, Freja Nordsiek
# 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, this list of conditions ... | frejanordsiek/hdf5storage | tests/test_ndarray_O_field.py | Python | bsd-2-clause | 3,240 |
raise "no longer used since 20050302"
#coding: latin1
## Copyright 2004-2005 Luc Saffre
## This file is part of the Lino project.
## Lino 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 ... | lsaffre/timtools | timtools/oogen/generators.py | Python | bsd-2-clause | 2,798 |
from pandas import *
import numpy as num
from pysal import *
import os, glob
from osgeo import ogr
import csv
from pyGDsandbox.dataIO import df2dbf, dbf2df
import uuid
from pyproj import Proj, transform
from shapely.geometry import Polygon, shape
from osgeo import ogr, osr
import fiona
#read in data from geodatabase
d... | vickyting0910/opengeocoding | 1norman.py | Python | bsd-2-clause | 5,441 |
# Copyright (c) 2017, Djaodjin 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | djaodjin/djaodjin-deployutils | deployutils/apps/django/management/commands/decrypt_session.py | Python | bsd-2-clause | 1,698 |
#!/usr/bin/env python
import pandas as pd
import rosbag_pandas
import sys, os, pdb
from PIL import Image
from io import BytesIO
sys.path.append(os.path.abspath('../..')) # Not clean
from annotate_base import AnnotateBase
class BagReader(AnnotateBase):
def __init__(self, num_actions=2, newtopic=True):
sup... | jon-courtney/cnn-autonomous-drone | shared/bagreader.py | Python | bsd-2-clause | 1,056 |
# -*- coding: UTF-8 -*-
# Copyright 2016-2017 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from lino.api import _
from lino_xl.lib.lists.models import *
# from lino_xl.lib.coachings.mixins import Coachable
from lino_tera.lib.contacts.models import Partner
class List(... | lino-framework/tera | lino_tera/lib/lists/models.py | Python | bsd-2-clause | 1,138 |
import os.path
EMULATED_VERSION = 'Muck2.2fb7.00'
MAX_VARS = 54
HISTORY_FILE = os.path.expanduser("~/.mufsim_history")
# vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
| revarbat/mufsim | mufsim/configs.py | Python | bsd-2-clause | 184 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2011 Umeå University
#
# 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... | rohe/pysaml2-3 | src/saml2/client_base.py | Python | bsd-2-clause | 30,922 |
# coding: utf-8
class Semantics:
def _default(self, ast):
return ast
def clean_label(self, label):
return label.replace(':', '')
def conjugated_verb(self, ast):
return {'t': ast[0],
'v': {'t': ast[1], 'v': ast[2]}}
def formatted(self, ast):
return {'t': ast[0], 'v': ast[1]}
... | kasahorow/kwl | kwl2text/semantics.py | Python | bsd-2-clause | 4,068 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import pprint
from subprocess import Popen, PIPE
import os
from future.tests.base import CodeHandler, unittest
class TestFuturizeSimple(CodeHandler):
"""
This class contains snippets of Python 2 code (invalid Python 3) ... | talishte/ctigre | env/lib/python2.7/site-packages/future/tests/test_futurize.py | Python | bsd-2-clause | 16,106 |
"""Core control stuff for Coverage."""
import atexit, os, random, socket, sys
from coverage.annotate import AnnotateReporter
from coverage.backward import string_class
from coverage.codeunit import code_unit_factory, CodeUnit
from coverage.collector import Collector
from coverage.config import CoverageConfig
from cov... | akiokio/centralfitestoque | src/.pycharm_helpers/coverage/control.py | Python | bsd-2-clause | 25,880 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#=======================================================================
#
# hash_tester.py
# --------------
# This program sends several commands to the coretest_hashed subsystem
# in order to verify the SHA-1, SHA-256 and SHA-512/x hash function
# cores. The program will ... | secworks/coretest_hashes | src/sw/hash_tester.py | Python | bsd-2-clause | 42,650 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lexicon', '0046_auto_20160428_1703'),
]
operations = [
migrations.AddField(
model_name='language',
n... | lingdb/CoBL-public | ielex/lexicon/migrations/0047_language_sortrankinclade.py | Python | bsd-2-clause | 410 |
import os
import json
import time
from datetime import datetime
from django.conf import settings
from django import template
from django.template.loader import get_template
from django.template import TemplateSyntaxError
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.serializers... | CI-WATER/django-tethys_gizmos | tethys_gizmos/templatetags/tethys_gizmos.py | Python | bsd-2-clause | 8,658 |
import copy
import functools
import logging
import archinfo
from ..errors import SimIRSBError, SimIRSBNoDecodeError, SimValueError
from .engine import SuccessorsMixin
from .. import sim_options as o
from ..misc.ux import once
from ..state_plugins.inspect import BP_AFTER, BP_BEFORE
from ..state_plugins.unicorn_engine ... | angr/angr | angr/engines/unicorn.py | Python | bsd-2-clause | 16,522 |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import os
import re
import logging
import requests
from indra.literature import pubmed_client
# Python3
try:
from functools import lru_cache
# Python2
except ImportError:
from functools32 import lru_cache
l... | jmuhlich/indra | indra/literature/crossref_client.py | Python | bsd-2-clause | 6,819 |
try:
from setuptools import setup
from setuptools import Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy
ext = Extension("CyNewtonRaphson",sources=["CyNewtonRaphson.pyx"],include_dirs=[numpy.ge... | tmaiwald/OSIM | OSIM/Simulation/CyCircuitAnalysis/setup.py | Python | bsd-2-clause | 491 |
import ctypes as ct
import sdl2 as sdl
from ed2d.platforms import sdl2keymap as keymap
from ed2d.events import Events
from ed2d import cursor
MOUSE_LEFT = 1
MOUSE_MIDDLE = 2
MOUSE_RIGHT = 3
MOUSE_EX1 = 4
MOUSE_EX2 = 5
class SystemEvents(object):
''' Handles Event stuff... '''
def __init__(self):
sdl... | explosiveduck/ed2d | ed2d/platforms/sdl2events.py | Python | bsd-2-clause | 3,068 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
spider_list = """douyu lol 频道
拉勾数据
网易公开课
果壳 mooc 公开课
网易大学
leetcode
other oj
"""
| sharkspeed/dororis | packages/python/scrapy/example0/example0/spiders/spider_list.py | Python | bsd-2-clause | 167 |
"""
@package mi.dataset.driver.dosta_abcdjm.cspp.test.test_driver
@file marine-integrations/mi/dataset/driver/dosta_abcdjm/cspp/driver.py
@author Mark Worden
@brief Test cases for dosta_abcdjm_cspp driver
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/dsa/test_driver
$ bin/dsa/test... | ooici/marine-integrations | mi/dataset/driver/dosta_abcdjm/cspp/test/test_driver.py | Python | bsd-2-clause | 18,459 |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, print_function, division,
absolute_import)
from django import forms
from .models import Post
class PostForm(forms.ModelForm):
class Meta:
model = Post
fields = ('title', 'content', 'author')
| roam/machete | tests/forms.py | Python | bsd-2-clause | 306 |
# coding: utf-8
from django.db import migrations, models
import onadata.apps.logger.fields
class Migration(migrations.Migration):
dependencies = [
('logger', '0008_add_instance_is_synced_with_mongo_and_xform_has_kpi_hooks'),
]
operations = [
migrations.AddField(
model_name='i... | kobotoolbox/kobocat | onadata/apps/logger/migrations/0009_add_posted_to_kpi_field_to_logger_instance.py | Python | bsd-2-clause | 466 |
# -*- coding: utf-8 -*-
"""
S-expr parser, a LISP front-end for Python
"""
import re
class Parser(object):
RE_NUM = re.compile(r'^[+-]?[0-9]+(\.[0-9]+)?')
RE_STR = re.compile(r'^\"(\\\\|\\\"|[^"])*\"', re.DOTALL)
RE_SYM = re.compile(r'^[^0-9\s\(\)\[\]{}\",][^\s\(\)\[\]{}\",]*')
RE_LITE... | kuangyh/chord | src/solo/sexpr.py | Python | bsd-2-clause | 3,554 |
#
# This file is part of pysnmp software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pysnmp/license.html
#
import socket
import sys
from pysnmp import error
from pysnmp.carrier.asyncore.dgram import udp
from pysnmp.carrier.asyncore.dgram import udp6
from pysnmp.hlapi.t... | etingof/pysnmp | pysnmp/hlapi/v1arch/asyncore/transport.py | Python | bsd-2-clause | 4,270 |
from django.conf import settings
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Drop and re-create the database"
def handle_noargs(self, **options):
if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.postgresql_psycopg2':
... | fergalmoran/dss | spa/management/commands/drop.py | Python | bsd-2-clause | 1,735 |
#!/usr/bin/env python
from distutils.core import setup, Extension
setup(
name = "h264decode",
version = "0.1",
description = "Module for simple decoding of raw H264 streams with external avcC (ISO/IEC 14496:15)",
ext_modules = [Extension( "h264decode",
sources=["yuvframe.c", "decoder.c", "h264decode.c"],
... | tzwenn/pyh264decode | setup.py | Python | bsd-2-clause | 417 |
from unipath import FSPath as Path
from djangobench.base_settings import *
INSTALLED_APPS = ['template_render']
TEMPLATE_DIRS = [Path(__file__).parent.child('templates').absolute()]
ROOT_URLCONF = 'template_render.urls'
| alex/djangobench | djangobench/benchmarks/template_render/settings.py | Python | bsd-3-clause | 221 |
from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
from pandas.compat import (
is_platform_arm,
is_platform_mac,
)
from pandas.errors import UnsupportedFunctionCall
from pandas import (
DataFrame,
DatetimeIndex,
MultiIndex,
Series,
Timedelta,
Timest... | gfyoung/pandas | pandas/tests/window/test_rolling.py | Python | bsd-3-clause | 42,869 |
from .permission import *
from .user import *
from .comment import *
from .post import *
from .tag import *
from .link import *
| finron/finepy | fine/models/__init__.py | Python | bsd-3-clause | 128 |
#! /usr/bin/python
'''
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.
For example,
Given [3,2,1,5,6,4] and k = 2, return 5.
Note:
You may assume k is always valid, 1 <= k <= array's length.
'''
class Solution:
# @para... | shub0/algorithm-data-structure | python/find_kth_element.py | Python | bsd-3-clause | 1,814 |
from datetime import timedelta
from celery.task import Task, PeriodicTask
from celery.registry import tasks
from .models import EnrolledDeployedQuestionsAnswered, create_record_enrolled_deployed_questions_answered
class CreateSystemReport(Task):
def run(self, **kwargs):
if kwargs.has_key('role'):
... | unicefuganda/edtrac | edtrac_project/rapidsms_edtrac/education/tasks.py | Python | bsd-3-clause | 1,089 |
"""
mweigert@mpi-cbg.de
"""
from __future__ import absolute_import, print_function
import sys
from PyQt5 import QtGui, QtCore, QtWidgets
from time import time
from spimagine import MainWidget, DemoData, NumpyData, DataModel, qt_exec
from spimagine.gui.glwidget import GLWidget
from spimagine import logger
#logger... | maweigert/spimagine | tests/test_gui/test_widget.py | Python | bsd-3-clause | 771 |
###############################################################################
##
## Copyright (C) 2014-2015, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | hjanime/VisTrails | vistrails/gui/ports_pane.py | Python | bsd-3-clause | 31,553 |
import os
import logging
import signal
import time
import errno
import traceback
import sys
from ..logs import setup_logs
log = logging.getLogger(__name__)
def call_in_child(module_name, func_name='main'):
pid = os.fork()
if pid:
log.info('Started child %s:%s (%d)' % (module_name, func_name, pid))
... | westernx/sgcache | sgcache/commands/auto.py | Python | bsd-3-clause | 2,079 |
from dimagi.ext.couchdbkit import Document
from django.core.management.base import LabelCommand, CommandError
from corehq.apps.domain.models import OldDomain
from corehq.apps.domain.shortcuts import create_domain, create_user
from corehq.apps.domain.utils import normalize_domain_name
from corehq.apps.users.models impor... | puttarajubr/commcare-hq | corehq/apps/domain/management/commands/migrate_domain_names.py | Python | bsd-3-clause | 3,679 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from auto_nag.bzcleaner import BzCleaner
class LeaveOpen(BzCleaner):
def __init__(self):
super(LeaveOpen, ... | mozilla/bztools | auto_nag/scripts/leave_open.py | Python | bsd-3-clause | 1,050 |
#pylint: disable=E1101,W0232,W0141,E1103,E1002,W0232,R0201,R0903,R0904,C0302
#pylint: disable=C0103
'''The overtime application encapsulates some common functionality
with the overtime approval queues in the timetracker application.
'''
import datetime
from django.db import models
from django.conf import settings
from... | AeroNotix/django-timetracker | overtime/models.py | Python | bsd-3-clause | 5,530 |
"""
Author: Dr. John T. Hwang <hwangjt@umich.edu>
This package is distributed under New BSD license.
Random sampling.
"""
import numpy as np
from smt.sampling_methods.sampling_method import SamplingMethod
class Random(SamplingMethod):
def _compute(self, nt):
"""
Compute the requested number of ... | bouhlelma/smt | smt/sampling_methods/random.py | Python | bsd-3-clause | 665 |
import pandas as pd
import numpy as np
import pyaf.HierarchicalForecastEngine as hautof
import pyaf.Bench.TS_datasets as tsds
import datetime
#get_ipython().magic('matplotlib inline')
def train_and_force_fail(b , error_message):
try:
df = b.mPastData;
lEngine = hautof.cHierarchicalForeca... | antoinecarme/pyaf | tests/basic_checks/hierarchy_checks_date_column_bad_storage.py | Python | bsd-3-clause | 960 |
# Copyright (C) 2012 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | youtube/cobalt | third_party/blink/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py | Python | bsd-3-clause | 18,577 |
"""
Wrapper around the ``dateutil.rrule`` module.
Provides more consistent behavior with the rfc2445 specification,
notably differing from `dateutil.rrule`` in the handling of the
`dtstart` parameter and the additional handling of a `dtend`
parameter. Also, the `byweekday` parameter in `dateutil.rrule` is
`byday` in t... | linux2400/django-recurrence | recurrence/base.py | Python | bsd-3-clause | 48,398 |
from .core import api
from .models import Message
api.create_api(Message, url_prefix='/api/v1')
| NYCPython/irclogs | irclogs/api.py | Python | bsd-3-clause | 97 |
for i in range(100):
print i+1;
| lang010/acit | uva/10177/input.py | Python | bsd-3-clause | 36 |
# -*- coding: utf-8 -*-
"""
Display the current transfer rates of a tor instance
Configuration parameters:
cache_timeout: An integer specifying the cache life-time of the modules
output in seconds (default 2)
control_address: The address on which the Tor daemon listens for control
connections (... | docwalter/py3status | py3status/modules/tor_rate.py | Python | bsd-3-clause | 4,540 |
from __future__ import unicode_literals
from django.apps import AppConfig
class ShowurlsConfig(AppConfig):
name = 'showurls'
| Niklas9/django-showurls | django_showurls/apps.py | Python | bsd-3-clause | 132 |
# canonical.py - functions for converting systems to canonical forms
# RMM, 10 Nov 2012
from .exception import ControlNotImplemented
from .lti import issiso
from .statesp import StateSpace
from .statefbk import ctrb, obsv
from numpy import zeros, shape, poly, iscomplex, hstack, dot, transpose
from numpy.linalg import... | roryyorke/python-control | control/canonical.py | Python | bsd-3-clause | 7,940 |
# System built-in modules
import time
from datetime import datetime
import sys
import os
from multiprocessing import Pool
# Project dependency modules
import pandas as pd
pd.set_option('mode.chained_assignment', None) # block warnings due to DataFrame value assignment
import lasagne
# Project modules
sys.path.append('... | zaxliu/deepnap | experiments/kdd-exps/experiment_DynaQNN_130_Feb14_0026.py | Python | bsd-3-clause | 5,180 |
#!/usr/bin/env python3
from setuptools import setup
import os
import re
main_py = open(os.path.join('lib', 'urlwatch', '__init__.py')).read()
m = dict(re.findall("\n__([a-z]+)__ = '([^']+)'", main_py))
docs = re.findall('"""(.*?)"""', main_py, re.DOTALL)
m['name'] = 'urlwatch'
m['author'], m['author_email'] = re.ma... | lechuckcaptain/urlwatch | setup.py | Python | bsd-3-clause | 909 |
from __future__ import unicode_literals
import hashlib
import json
import os
import posixpath
import re
try:
from collections import OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict # Python 2.6
except:
from django.core.exceptions import ImproperlyConfigured
... | dsanders11/django-future-staticfiles | django_future_staticfiles/storage.py | Python | bsd-3-clause | 14,915 |
import itertools
def calc_key(new_data_perm, old_data, heuristic):
return sum([heuristic(new, old) for (new, old) in zip(new_data_perm, old_data)])
def find_best_match(old_data, new_data, heuristic):
"""
Finds the best way to align arbitrary new data with old data. Tests all possible
permutations of t... | cuauv/software | vision/modules/will_common.py | Python | bsd-3-clause | 621 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from io import BytesIO
import logging
import os
import re
import struct
import sys
from .compat import sysconfig, detect_encoding, ZipFi... | tequa/ammisoft | ammimain/WinPython-64bit-2.7.13.1Zero/python-2.7.13.amd64/Lib/site-packages/pip/_vendor/distlib/scripts.py | Python | bsd-3-clause | 15,256 |
from tornado.web import RequestHandler
from swampdragon.default_settings import SwampDragonSettings
from django.conf import settings as django_settings
def get_host():
host = django_settings.DRAGON_URL
if host.endswith('/'):
return host[:-1]
return host
class SettingsHandler(RequestHandler):
... | sahlinet/swampdragon | swampdragon/settings_provider.py | Python | bsd-3-clause | 690 |
##########################################################################
#
# Copyright (c) 2017, John Haddon. 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 so... | appleseedhq/gaffer | python/GafferDelightTest/__init__.py | Python | bsd-3-clause | 2,045 |
#!/usr/bin/python
######
# b64calc: test buffer and overflow calculation
###
#
# Copyright (C) 2012 Jimmy Scott #jimmy#inet-solutions#be#. Belgium.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:... | jimmy-scott/prcat | test/b64calc.py | Python | bsd-3-clause | 2,305 |
# coding: utf-8
import string
import unittest
import random
import os
import platform
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from pyperclip import _executable_exists, HAS_DISPLAY
from pyperclip.clipboards import (init_osx_clipboard,
init_gtk_clip... | ZEDGR/pyperclip | tests/test_copy_paste.py | Python | bsd-3-clause | 3,313 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page_module
from telemetry import story
class BlankPage(page_module.Page):
def __init__(self, url, page_set):
super... | SaschaMester/delicium | tools/perf/page_sets/blank_page.py | Python | bsd-3-clause | 578 |
# -*- coding: utf-8 -*-
'''
Local settings
- Run in Debug mode
- Use console backend for emails
- Add Django Debug Toolbar
- Add django-extensions as app
'''
from .common import * # noqa
# DEBUG
# ------------------------------------------------------------------------------
DEBUG = env.bool('DJANGO_DEBUG', default... | angryjoe/propertytrack | config/settings/local.py | Python | bsd-3-clause | 1,920 |
from django.db import models
import fernet_fields as fields
class EncryptedText(models.Model):
value = fields.EncryptedTextField()
class EncryptedChar(models.Model):
value = fields.EncryptedCharField(max_length=25)
class EncryptedEmail(models.Model):
value = fields.EncryptedEmailField()
class Encry... | orcasgit/django-fernet-fields | fernet_fields/test/models.py | Python | bsd-3-clause | 641 |
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='django-filebrowser-no-grappelli',
version='3.5.7',
description='Media-Management no Grappelli',
long_description = read('README.rst'),
url = 'h... | haight6716/filebrowser | setup.py | Python | bsd-3-clause | 1,362 |
from abc import ABCMeta, abstractmethod
import logging
import json
import pandas as pd
from six import with_metaclass
# doctest-only imports
from topik.preprocessing import preprocess
from topik.readers import read_input
from topik.tests import test_data_path
from topik.intermediaries.persistence import Persistor
re... | lewismc/topik | topik/models/model_base.py | Python | bsd-3-clause | 3,158 |
import datetime
import elasticsearch_dsl.filter as es_filter
from elasticsearch_dsl import aggs, query, SF
from rest_framework.filters import BaseFilterBackend
from mkt.games.constants import GAME_CATEGORIES
class DailyGamesFilter(BaseFilterBackend):
"""
Randomly chooses 4 games, one from each featured game... | Hitechverma/zamboni | mkt/games/filters.py | Python | bsd-3-clause | 1,969 |
from swampdragon_auth.socketconnection import HttpDataConnection
from .online import user_manager
class Connection(HttpDataConnection):
def __init__(self, session):
self._user = None
super(Connection, self).__init__(session)
def on_heartbeat(self):
if self.user:
user_manag... | jonashagstedt/swampdragon-notifications | swampdragon_notifications/notification_connection.py | Python | bsd-3-clause | 590 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07.
# 2019, SMART Health IT.
import os
import io
import unittest
import json
from . import verificationresult
from .fhirdate import FHIRDate
class VerificationResultTests(unittest.TestCase):
def instantiate_from(... | all-of-us/raw-data-repository | rdr_service/lib_fhir/fhirclient_4_0_0/models/verificationresult_tests.py | Python | bsd-3-clause | 1,737 |
from .id3 import Id3Estimator
from . import id3
from .export import export_graphviz
from .export import export_text
__all__ = ['Id3Estimator', 'export_graphviz', 'export_text']
| svaante/decision-tree-id3 | id3/__init__.py | Python | bsd-3-clause | 178 |
from setuptools import setup, find_packages
version = '1.0.7'
LONG_DESCRIPTION = """
How to use django-bootstrap-pagination
----------------------------
``django-bootstrap-pagination`` allows for easy Digg-style pagination without modifying
your views.
There are really 5 steps to setting it up with your projects (n... | tgdn/django-bootstrap-pagination | setup.py | Python | bsd-3-clause | 4,189 |
from django.conf.urls.defaults import patterns, url
from django.views.decorators.cache import cache_page
from django.views.i18n import javascript_catalog
urlpatterns = patterns('pto.views',
url(r'^$', 'home', name='pto.home'),
url(r'^calculate_pto\.json$', 'calculate_pto', name='pto.calculate_pto'),
# Ja... | kumar303/pto-planner | apps/pto/urls.py | Python | bsd-3-clause | 491 |
import datetime
import re
import time
from collections import namedtuple
from django.conf import settings
from django.core.management.base import BaseCommand
from trello import ResourceUnavailable, TrelloClient
from core.models import Event
# Create new command
class Command(BaseCommand):
help = 'Syncs event i... | DjangoGirls/djangogirls | core/management/commands/sync_events_dashboard.py | Python | bsd-3-clause | 3,541 |
import os
import datetime
import time
from ...utils import parse_utc
from .. import run_python_module
from .base import BaseTestApp
class TestNbGraderSubmit(BaseTestApp):
def _release_and_fetch(self, assignment, exchange, cache):
self._copy_file("files/test.ipynb", "release/ps1/p1.ipynb")
run_py... | dementrock/nbgrader | nbgrader/tests/apps/test_nbgrader_submit.py | Python | bsd-3-clause | 4,574 |
"""
Wrappers over Docker resource types to aid in setup/teardown of and interaction
with Docker resources.
"""
import functools
from docker import models
from seaworthy.helpers import DockerHelper
from seaworthy.stream.logs import stream_logs, wait_for_logs_matching
from seaworthy.stream.matchers import RegexMatcher... | praekeltfoundation/seaworthy | seaworthy/definitions.py | Python | bsd-3-clause | 16,642 |
r"""
Compute homogenized elastic coefficients for a given heterogeneous linear
elastic microstructure, see [1] for details or [2] and [3] for a quick
explanation. The mixed formulation, where displacements and pressures are
as unknowns, is used in this example.
[1] D. Cioranescu, J.S.J. Paulin: Homogenization in ope... | lokik/sfepy | examples/homogenization/linear_homogenization_up.py | Python | bsd-3-clause | 6,704 |
# flake8: noqa
from .util.frametools import (stata_merge, group_id, winsorize, df_to_list)
from .util.gentools import (
force_df, force_list, force_iterable, generate_chunks, base2int, int2base)
from .util.io import (
save_cli, read, write, load_or_build, loadbuild_cli, try_pickle,
load_or_build_direct, con... | dmsul/econtools | econtools/__init__.py | Python | bsd-3-clause | 738 |