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
#coding=utf-8 import codecs import logging import numpy as np import os from collections import defaultdict # define a logger logging.basicConfig(format="%(message)s", level=logging.INFO) def load_embedding(filename, embedding_size): """ load embedding """ embeddings = [] word2idx = defaultdict(...
gallupliu/QA
preprocess/data_helper.py
Python
apache-2.0
4,978
import torch import torch.nn as nn import os import numpy as np import torchvision from torch.utils.data import DataLoader import torchvision.transforms as transforms import ray from ray import tune from ray.tune.schedulers import create_scheduler from ray.tune.integration.horovod import (DistributedTrainableCreator,...
pcmoritz/ray-1
release/horovod_tests/workloads/horovod_test.py
Python
apache-2.0
4,752
# coding=utf-8 # Copyright 2022 The TensorFlow Datasets 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 appl...
tensorflow/datasets
tensorflow_datasets/import_public_api_test.py
Python
apache-2.0
852
import pytest import ray from ray import tune pytest.importorskip("horovod") try: from ray.tune.integration.horovod import ( DistributedTrainableCreator, _train_simple, _train_validate_session) except ImportError: pass # This shouldn't be reached - the test should be skipped. @pytest.fixture def r...
pcmoritz/ray-1
python/ray/tune/tests/test_horovod.py
Python
apache-2.0
3,092
# Copyright 2013 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
rahulunair/nova
nova/objects/security_group_rule.py
Python
apache-2.0
4,586
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import Table, Column, Integer, ForeignKey from sqlalchemy.orm import relationship from models.base import Base, get_or_create db = SQLAlchemy() class Group(Base): __tablename__ = 'group' id = db.Column(db.String(50), unique=True, primary_key=True) subscr...
blackmad/snippets
models/group.py
Python
apache-2.0
556
""" Component to interface with various media players. For more details about this component, please refer to the documentation at https://home-assistant.io/components/media_player/ """ import asyncio from datetime import timedelta import functools as ft import hashlib import logging import os from random import Syste...
eagleamon/home-assistant
homeassistant/components/media_player/__init__.py
Python
apache-2.0
28,502
#!/usr/bin/env python #-*- coding: ascii -*- from __future__ import print_function import sys import platform def copy_to_dst(src_name, dst_dir): print("Copy %s to %s" % (src_name, dst_dir)) import shutil shutil.copy(src_name, dst_dir) #cfg, address_model=32/64, version_type=debug/release; def getEnvInfo(address...
bigvat/vat
common.py
Python
apache-2.0
3,323
"""Test deCONZ gateway.""" from copy import deepcopy import pydeconz import pytest from homeassistant import config_entries from homeassistant.components import deconz, ssdp from homeassistant.helpers.dispatcher import async_dispatcher_connect from tests.async_mock import Mock, patch from tests.common import MockCon...
titilambert/home-assistant
tests/components/deconz/test_gateway.py
Python
apache-2.0
6,047
#!/usr/bin/python import probe_config as conf import socket import re import os import tempfile import shutil class Swift: def __init__(self, myname, is_storage): self.myname = myname print "Myname = " + self.myname self.allnodes = conf.swift_nodes print "all nodes=" + str(self.allnodes) self.all_ips = [so...
SimbaService/Simba
server/scripts/probe/swift.py
Python
apache-2.0
8,605
"""Support for interfacing with Monoprice 6 zone home audio controller.""" import logging import voluptuous as vol from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA from homeassistant.components.media_player.const import ( SUPPORT_SELECT_SOURCE, SUPPORT_TURN_OFF, SUPPORT...
joopert/home-assistant
homeassistant/components/monoprice/media_player.py
Python
apache-2.0
7,123
# -*- 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/vlans/vlan/members/member/interface_ref/__init__.py
Python
apache-2.0
5,581
# Copyright 2016 Pure Storage Inc. # See LICENSE file for details.
PureStorage-OpenConnect/purestorage-flocker-driver
tests/utils/__init__.py
Python
apache-2.0
66
# Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, soft...
google/hotel-ads-etl-tool
hotel_ads_beam_utils/hotel_ads_beam_utils/do_fn.py
Python
apache-2.0
1,021
# encoding: utf-8 # Licensed to Hortonworks, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Hortonworks, Inc. licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you ...
hortonworks/hortonworks-sandbox
apps/pig/src/pig/migrations/0006_auto__del_logs__add_field_job_status__add_field_job_email_notification.py
Python
apache-2.0
9,272
# Copyright 2019 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google-research/remixmatch
ablation/ab_cta_remixmatch_noweak.py
Python
apache-2.0
3,534
#!/usr/bin/env python # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 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 Licen...
quattor/aquilon
tests/broker/test_add_alias.py
Python
apache-2.0
18,764
#!/usr/local/bin/python # -- coding: utf-8 -- # # Subroutine defs inspired by http://nltk.org/book/ # -- gene at ology dot net not dot com # # Import functionality. from __future__ import division import nltk def generate_model(cfdist, word, num=15): for i in range(num): print word, word = cfdist...
ology/NLTK-Study
Defs.py
Python
artistic-2.0
1,971
# -*- coding: utf-8 -*- from baseframe import _, __ from coaster.auth import current_auth from coaster.utils import nullstr from lastuser_core.models import UserEmail, UserEmailClaim, UserPhone, UserPhoneClaim from lastuser_core.utils import strip_phone, valid_phone import baseframe.forms as forms __all__ = [ 'Em...
hasgeek/lastuser
lastuser_ui/forms/profile.py
Python
bsd-2-clause
5,174
from . import Range from . import Style from . import Format from .DataTypes import DataTypes from . import six from datetime import datetime from safe_xml import replace_invalid_xml_chars class Worksheet(object): def __init__(self, name, workbook, data=None): self._columns = 0 # cache this for speed self._name =...
scraperwiki/spreadsheet-download-tool
pyexcelerate/Worksheet.py
Python
bsd-2-clause
4,340
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function) import pytest from .. import Backend from . import AVAILABLE_BACKENDS @pytest.mark.parametrize('key', AVAILABLE_BACKENDS) def test_Dummy(key): be = Backend(key) d0 = be.Dummy() d1 = be.Dummy() assert d0 == d0 ...
bjodah/sym
sym/tests/test_Dummy.py
Python
bsd-2-clause
339
#!/usr/bin/env python """Test propagate_counts up relationships as well as parent-child links.""" import sys import os # from itertools import combinations # import collections as cx from goatools.go_enrichment import GOEnrichmentStudy from goatools.base import get_godag from goatools.test_data.genes_NCBI_10090_Prote...
tanghaibao/goatools
tests/test_propagate_counts_w_relationships.py
Python
bsd-2-clause
3,155
# coding: utf-8 import os import celery import logging from django.apps import apps from django.conf import settings # http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html # Attempt to determine the project name from the directory containing this file PROJECT_NAME = os.path.basename(os.path.di...
kobotoolbox/kobocat
onadata/celery.py
Python
bsd-2-clause
1,357
#!/usr/bin/python '''test that the build and run results are OK''' # threads.heapprof should have 2 call stacks allocating 1024 blocks each import commands, sys print 'testing that *.heapprof files contain the expected results...' assert commands.getoutput("grep ' 1024 ' threads.heapprof | wc -l").strip() == '2' sec...
yosefk/heapprof
ok.py
Python
bsd-2-clause
823
import logging import warnings import collections from six import add_metaclass from functools import partial logger = logging.getLogger(__name__) class Param(object): "Describes a single parameter and defines a method for cleaning inputs." def __init__(self, default=None, allow_list=False, description=None,...
bruth/restlib2
restlib2/params.py
Python
bsd-2-clause
5,458
# ingest policy domain code import logging import init_domain class IngestPolicyDomain: def __init__(self, host="irods421.irodslocal"): self.logger = logging.getLogger(__name__) self.host = host self.logger.info("initializing IngestPolicyDomain()") def initialize_domain(self): ...
michael-conway/policy-domains
ingest-domain/rules/src/ingest_policy_domain.py
Python
bsd-2-clause
1,404
import csv import sys from indra.literature import pubmed_client from collections import OrderedDict from matplotlib import pyplot as plt import pickle import numpy as np import boto3 import botocore import os from indra.literature import id_lookup from indra.literature import crossref_client from texttable import Text...
jmuhlich/indra
models/ras_220_genes/get_ras_pmids.py
Python
bsd-2-clause
8,882
# # This file is part of LiteX-Boards. # # Copyright (c) 2022 Ilia Sergachev <ilia@sergachev.ch> # SPDX-License-Identifier: BSD-2-Clause from litex.build.generic_platform import * from litex.build.xilinx import XilinxPlatform, VivadoProgrammer # IOs -------------------------------------------------------------------...
litex-hub/litex-boards
litex_boards/platforms/xilinx_kv260.py
Python
bsd-2-clause
1,483
from brb import BrbMatcher from greeter import GreetingMatcher from sifter import SifterMatcher from googleplus import ArthurGooglePlusMatcher from gifter import GifterMatcher from sandwich import SandwichMatcher from cletus import CletusMatcher from jenkins import JenkinsMatcher from volunteer import VolunteerMatcher ...
honza/nigel
matchers/__init__.py
Python
bsd-2-clause
453
from numpy import sin, linspace, pi, array, empty from pylab import plot, show, title, xlabel, ylabel, subplot from scipy import fft, arange, signal from obspy.segy.core import readSEGY # # Input Parameters Block # filename='test.sgy'; Lowcut = 8 # Low frequency Highcut = 60 # High frequency or...
toastar/Python-Segy-Bandpass
freq.py
Python
bsd-2-clause
1,915
""" Some generic utility routines for number handling and calculating (specific) variances """ import logging import itertools import numpy from tkp.utility import containers from tkp.utility.memoize import Memoize from tkp.sourcefinder import utils from tkp.sourcefinder import stats from tkp.sourcefinder import extra...
mkuiack/tkp
tkp/sourcefinder/image.py
Python
bsd-2-clause
37,453
import statsmodels.api as sm from . import common_fields from . import make_gaps from . import tools from .device_event import make_alarm_event def apply_loess(solution, num_days, gaps): """Solves the blood glucose equation over specified period of days and applies a loess smoothing regression to the da...
tidepool-org/dfaker
dfaker/cbg.py
Python
bsd-2-clause
2,185
# 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...
edx/django-openid-auth
example_consumer/urls.py
Python
bsd-2-clause
2,002
try: from unittest.mock import patch except ImportError: from mock import patch from logger.inspector import Inspector from unittest import TestCase class MockCollection(object): def __init__(self, website_id, collection_id, website_acron_in_filename): self.website_id = website_id self.c...
scieloorg/Logger
tests/test_inspector.py
Python
bsd-2-clause
2,902
#!/usr/bin/env python """Test CompareGOsCli""" import os from goatools.cli.compare_gos import CompareGOsCli __copyright__ = "Copyright (C) 2016-2019, DV Klopfenstein, H Tang, All rights reserved." REPO = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../") def test_example(): """Test CompareGOsCli""...
tanghaibao/goatools
tests/test_compare_gos.py
Python
bsd-2-clause
1,038
from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration import os import shutil import time import platform class grpcConan(ConanFile): name = "grpc" version = "1.27.3" description = "Google's RPC library and framework." topics = ("conan", "grpc", "rpc") url ...
google/orbit
third_party/conan/recipes/grpc/conanfile.py
Python
bsd-2-clause
5,670
import Adafruit_BBIO.GPIO as GPIO import Adafruit_BBIO.ADC as ADC import mplayer as mp from time import sleep from random import randint from math import floor def checkKnob(potPin): # LOL return randint(0,1) # needs to be replaced by GPIO data value = ADC.read(potPin) return floor(24 * value) def main()...
jtrip/ChronoVision
TimeWarp.py
Python
bsd-2-clause
1,937
"""Base class to represent datastore.""" import dateutil.parser import dateutil.tz from apscheduler.jobstores import sqlalchemy as sched_sqlalchemy from sqlalchemy import select from sqlalchemy import desc from ndscheduler import constants from ndscheduler import settings from ndscheduler import utils from ndschedul...
DurgaChowdary/ndscheduler
ndscheduler/core/datastore/providers/base.py
Python
bsd-2-clause
7,862
from PyTVAL3.solver.ftvcs_al_TVL2p import ftvcs_al_TVL2p def TVAL3(A,b,dim,opts): ''' Returns: [U,out] Accordingly choose the code based on the model selected by the user. 1) TV model: min sum ||D_i u||. s.t. Au = b 2) TV/L2 model: min sum ||D_i u|| + mu/2||Au-b||_2^2 Pl...
sophie63/FlyLFM
stanford_lfanalyze_v0.4/lflib/solvers/PyTVAL3/__init__.py
Python
bsd-2-clause
753
# -*- coding: utf-8 -*- # # pyXlsxTemplate documentation build configuration file, created by # sphinx-quickstart on Mon Apr 29 17:00:08 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. ...
warpri81/pyXlsxTemplate
sphinx/conf.py
Python
bsd-2-clause
8,021
#! /usr/bin/env python """Read infofiles. """ import glob import os, os.path import sys import threading import time import skytools import cc.util from cc import json from cc.daemon import CCDaemon from cc.message import is_msg_req_valid from cc.reqs import InfofileMessage class InfoStamp: def __init__(self,...
markokr/cc
cc/daemon/infosender.py
Python
bsd-2-clause
5,065
'''Autogenerated by get_gl_extensions script, do not edit!''' from OpenGL import platform as _p from OpenGL.GL import glget EXTENSION_NAME = 'GL_SGIX_texture_lod_bias' _p.unpack_constants( """GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190""", globals()) def glIni...
frederica07/Dragon_Programming_Process
PyOpenGL-3.0.2/OpenGL/raw/GL/SGIX/texture_lod_bias.py
Python
bsd-2-clause
504
#!/usr/bin/env python # "manhole" entry point, friendlier ipython startup to remote container __author__ = 'Dave Foster <dfoster@asascience.com>' def main(): import sys, os, re, errno, json, socket from pkg_resources import load_entry_point r = re.compile('manhole-(\d+).json') if len(sys.argv) == 2...
scionrep/scioncc
src/scripts/manhole.py
Python
bsd-2-clause
3,942
from datetime import datetime from os.path import abspath, join, dirname import alabaster # Alabaster theme + mini-extension html_theme_path = [alabaster.get_path()] extensions = ['alabaster', 'sphinx.ext.intersphinx', 'sphinx.ext.doctest'] # Paths relative to invoking conf.py - not this shared file html_theme = 'al...
mkusz/invoke
sites/shared_conf.py
Python
bsd-2-clause
1,189
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals import logging import logging.config import os import time import forklift import redis import requests import xmlrpc2.client from apscheduler.scheduler import Scheduler from .config import Config, default...
crateio/carrier
carrier/core.py
Python
bsd-2-clause
2,194
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from .aws import Action as BaseAction from .aws import BaseARN service_name = "Amazon AppIntegrations" prefix = "app-integrations" class Action(BaseAction): def __init__(self, action: str = None) -...
cloudtools/awacs
awacs/app_integrations.py
Python
bsd-2-clause
1,748
def extractInacloudspaceWordpressCom(item): ''' Parser for 'inacloudspace.wordpress.com' ''' vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title']) if not (chp or vol) or "preview" in item['title'].lower(): return None tagmap = [ ('Drunken Exquisiteness', 'Drunken Exquisiteness', ...
fake-name/ReadableWebProxy
WebMirror/management/rss_parser_funcs/feed_parse_extractInacloudspaceWordpressCom.py
Python
bsd-3-clause
658
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from typing import List, Optional import torch.nn as nn import torch.nn.functional as F logger = logging.getLogger(__name__)...
hfp/libxsmm
samples/deeplearning/sparse_training/fairseq/fairseq/modules/fairseq_dropout.py
Python
bsd-3-clause
1,687
# -*- coding: utf-8 -*- """ pyfire.auth.backends ~~~~~~~~~~~~~~~~~~~~ Credential validation backends :copyright: 2011 by the pyfire Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ import warnings class InvalidAuthenticationError(Exception): """Raised upo...
IgnitedAndExploded/pyfire
pyfire/auth/backends.py
Python
bsd-3-clause
1,345
# ============================================================================= # Authors: PAR Government # Organization: DARPA # # Copyright (c) 2016 PAR Government # All rights reserved. # # # adapted from https://github.com/enmasse/jpeg_read #==========================================================================...
rwgdrummer/maskgen
maskgen/analytics/dctAnalytic.py
Python
bsd-3-clause
17,525
from setuptools import setup, find_packages model_blocks = __import__('model_blocks') readme_file = 'README.rst' try: long_description = open(readme_file).read() except IOError, err: sys.stderr.write("[ERROR] Cannot find file specified as " "``long_description`` (%s)\n" % readme_file) sys.exit(1) ...
mjumbewu/django-model-blocks
setup.py
Python
bsd-3-clause
1,497
# vim: set sw=2 ts=2 softtabstop=2 expandtab: import abc class AnalyserBaseClass(metaclass=abc.ABCMeta): def __init__(self, resultDict): # Quick sanity checks assert isinstance(resultDict, dict) assert 'exit_code' in resultDict assert 'log_file' in resultDict assert 'out_of_memory' in resultDict ...
symbooglix/boogie-runner
BoogieRunner/Analysers/AnalyserBase.py
Python
bsd-3-clause
1,536
""" Makes IPython import all of your projects models when shell is started. 1. Save as ipy_user_conf.py in project root 2. ./manage.py shell 3. profit """ import IPython.ipapi ip = IPython.ipapi.get() def main(): imported = "\nImported models:\n\n" try: from django.db.models.loading import get_mod...
jordic/django_tiny_shop
demo/ipy_user_conf.py
Python
bsd-3-clause
632
from django.conf.urls.defaults import patterns urlpatterns = patterns("jimi.catalog.views", (r"^/?$", "all_categories"), (r"^(?P<slug>[-\w]+)/$", "node", {}, "node"), )
bhell/jimi
jimi/jimi/catalog/urls.py
Python
bsd-3-clause
178
from fjord.base.tests import eq_, TestCase from fjord.feedback.models import ResponseMappingType from fjord.feedback.tests import ResponseFactory from fjord.search.index import chunked from fjord.search.tests import ElasticTestCase class ChunkedTests(TestCase): def test_chunked(self): # chunking nothing y...
rlr/fjord
fjord/search/tests/test_index.py
Python
bsd-3-clause
1,052
# -*- coding: utf-8 -*- # Copyright 2017 GIG Technology NV # # 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...
threefoldfoundation/app_backend
plugins/tff_backend/handlers/cron.py
Python
bsd-3-clause
4,468
import datetime from django.conf import settings from django.db.models import Q from django.utils import timezone from django.core.cache import cache from funfactory.urlresolvers import reverse from airmozilla.main.models import ( Event, Channel, EventHitStats, most_recent_event ) from airmozilla.mai...
lcamacho/airmozilla
airmozilla/main/context_processors.py
Python
bsd-3-clause
12,078
from django.http import HttpRequest import fudge import random from ._utils import TestCase from .. import context_processors from ..context_processors import media_url, static_url class TestOfMediaUrlContextProcessor(TestCase): def generate_fake_request(self, is_secure=False): request = fudge.Fake(HttpR...
texastribune/armstrong.base
armstrong/base/tests/context_processors.py
Python
bsd-3-clause
3,000
""" **GitHubAccount** Represents an account at GitHub. - Matches a link that looks like it goes to a GitHub profile page. - Returns the "your site" URL from the user's GitHub profile. - Use on the command line: ``github:username``. """ from __future__ import print_function, division import re import requests from l...
brenns10/social
social/accounts/github.py
Python
bsd-3-clause
2,234
# -*- coding: utf-8 -*- # Copyright (c) 2014 Simon Jagoe and Enthought Ltd. # All rights reserved. # # This software may be modified and distributed under the terms # of the 3-clause BSD license. See the LICENSE.txt file for details. from __future__ import absolute_import, unicode_literals import json import os from...
sjagoe/usagi
usagi/plugins/var_loaders.py
Python
bsd-3-clause
7,260
import os import socket from airflow import DAG from airflow.contrib.hooks import SSHHook from airflow.operators import PythonOperator from airflow.operators import BashOperator from airflow.operators import BranchPythonOperator from airflow.hooks.mysql_hook import MySqlHook from airflow.hooks import RedisHook from air...
vipul-tm/DAG
dags-ttpl/sync.py
Python
bsd-3-clause
19,607
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 = 30, transform = "Fisher", sigma = 0.0, exog_count = 100, ar_order = 12);
antoinecarme/pyaf
tests/artificial/transf_Fisher/trend_MovingMedian/cycle_30/ar_12/test_artificial_32_Fisher_MovingMedian_30_12_100.py
Python
bsd-3-clause
266
""" LICENCE ------- Copyright 2013 by Kitware, Inc. All Rights Reserved. Please refer to KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. """ # -*- coding: utf-8 -*- from _abcoll import Iterable from collections import deque import l...
anguoyang/SMQTK
OLD_ROOT/Backend/SMQTK_Backend/FeatureMemory.py
Python
bsd-3-clause
80,904
# Copyright (C) 2011, 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...
xin3liang/platform_external_chromium_org_third_party_WebKit
Tools/Scripts/webkitpy/common/checkout/baselineoptimizer.py
Python
bsd-3-clause
17,896
import pytest from torrt.rpc.transmission import TransmissionRPC, TransmissionRPCException @pytest.fixture def transmission(): rpc = TransmissionRPC() return rpc def test_auth(response_mock): transmission = TransmissionRPC(user='wrong', password='wrongwrong') with response_mock( f'POST {t...
idlesign/torrt
tests/rpc/test_transmission.py
Python
bsd-3-clause
2,194
# encoding: 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 model 'UserProfile' db.create_table('users_userprofile', ( ('id', self.gf('django.db....
wd5/jangr
users/migrations/0001_initial.py
Python
bsd-3-clause
4,060
import sys import os from colormath.color_objects import LabColor, RGBColor from PIL import Image def rgb_to_lab(img_data): return [RGBColor(r,b,g).convert_to('lab') for (r,g,b) in img_data] def compute_difference(lab1, lab2): return sum([l1.delta_e(l2, mode='cie1976') for (l1, l2) in zip(lab1, lab2)]) dir =...
sirikata/sirikata
scripts/test/cdn_screenshot_eval.py
Python
bsd-3-clause
836
import vtk import numpy as np import matplotlib.pyplot as plt def vtkmatrix_to_numpy(matrix): m = np.ones((4, 4)) for i in range(4): for j in range(4): m[i, j] = matrix.GetElement(i, j) return m """ Get transformation from viewpoint coordinates to real-world coordinates. (tmat) """ ...
lucasplus/MABDI
scripts/Plot_Depth_Image_To_Z.py
Python
bsd-3-clause
4,777
import datetime import urlparse from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.db.models import Q from django.http import Http404 from dja...
rpgplanet/django-postman
postman/views.py
Python
bsd-3-clause
12,521
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Animation' db.create_table(u'aldryn_wow_animation', ( ...
narayanaditya95/aldryn-wow
aldryn_wow/south_migrations/0001_initial.py
Python
bsd-3-clause
5,058
from ignition.dsl.riemann import * q = Conserved('q') rho, rhou, E = q.fields(['rho', 'rhou', 'E']) u = rhou / rho gamma = Constant('gamma') P = gamma * (E - .5 * u * rhou) f = [rhou, P + u * rhou, u * (E + P)] #generate(f, q, "euler_kernel.py") G = Generator() G.flux = f G.conserved = q G.eig_method = "nu...
IgnitionProject/ignition
demo/dsl/riemann/euler.py
Python
bsd-3-clause
356
#!/usr/bin/env python3 #-*- coding: utf-8 -*- import tornado.web import tornado.websocket import tornado.httpserver import tornado.ioloop import logging import json from threading import Thread from queue import Queue # Handle WebSocket clients clients = [] ### Handler ----------------------------------------------...
dorneanu/pyTCP2WS
lib/WebSocketServer.py
Python
bsd-3-clause
3,326
"""Pauli operators and states""" from sympy import I, Mul, Add, Pow, exp, Integer from sympsi import Operator, Ket, Bra from sympsi import ComplexSpace from sympy.matrices import Matrix from sympy.functions.special.tensor_functions import KroneckerDelta __all__ = [ 'SigmaX', 'SigmaY', 'SigmaZ', 'SigmaMinus', 'Sig...
sympsi/sympsi
sympsi/pauli.py
Python
bsd-3-clause
23,329
""" Copyright (c) 2015 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ from __future__ import unicode_literals import pytest from atomic_reactor.core import DockerTasker from atomic_reactor.inner import DockerBu...
fatherlinux/atomic-reactor
tests/plugins/test_check_and_set_rebuild.py
Python
bsd-3-clause
4,173
# -*- coding: utf-8 -*- # # pypet documentation build configuration file, created by # sphinx-quickstart on Wed Sep 4 12:12:59 2013. # # This file is execfile()d with the current directory f_set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All...
SmokinCaterpillar/pypet
doc/source/conf.py
Python
bsd-3-clause
10,941
############################################################################### ## ## 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/tests/utils.py
Python
bsd-3-clause
13,151
import json import requests class OnaApiClient(object): """ Client for Ona's API :param string username: The username to log into Ona with. :param string password: The password to log into Ona with. :param string url: The full URL of the Ona API. Defaults to ``https://ona.io/api/v1``. ...
praekelt/go-imali-yethu-js
python_scripts/ona.py
Python
bsd-3-clause
2,303
from random import randint as _randint from threading import Lock from photon import IDENT from photon.util.files import read_json, write_json from photon.util.locations import search_location from photon.util.structures import dict_merge from photon.util.system import get_timestamp, shell_notify class Meta(object)...
spookey/photon
photon/meta.py
Python
bsd-3-clause
4,438
from corehq.apps.change_feed.data_sources import SOURCE_COUCH VALUE_TAG = '#value' def map_types(item, mapping, override_root_keys=None): if isinstance(item, dict): return convert_property_dict(item, mapping, override_root_keys=override_root_keys) elif isinstance(item, list): return [map_type...
dimagi/commcare-hq
corehq/pillows/base.py
Python
bsd-3-clause
2,290
try: # python 3.5+ from typing import Union, Tuple, TypeVar try: # python 3.5.3+ from typing import Type except ImportError: pass T = TypeVar('T') except ImportError: pass try: # python 3+ from inspect import signature except ImportError: from funcsigs import signature t...
smarie/python-classtools-autocode
autoclass/autoclass_.py
Python
bsd-3-clause
12,616
import zeit.cms.interfaces import zeit.cms.testing import zeit.content.dynamicfolder.testing class EditDynamicFolder(zeit.cms.testing.BrowserTestCase): layer = zeit.content.dynamicfolder.testing.DYNAMIC_LAYER def test_check_out_and_edit_folder(self): b = self.browser b.open('http://localhost...
ZeitOnline/zeit.content.dynamicfolder
src/zeit/content/dynamicfolder/browser/tests/test_folder.py
Python
bsd-3-clause
873
from configobj import ConfigObj config = ConfigObj() config.filename = "config_example.cfg" config['APIs'] = { 'bot_nick': "@coolbot", 'telegram_chatlink': 'https://api.telegram.org/bot', 'dictionary_link': 'https://dictionary.yandex.net/api/v1/dicservice.json/lookup?', 'translator_link': 'https://tran...
NickVeld/e_cardbot
config_example_generator.py
Python
bsd-3-clause
1,369
""" ========================================================================= GPML regression: predicting Carbon Dioxide Concentration ========================================================================= This example is based on the example condacted by Carl Edward Rasmussen, available at http://learning.eng.cam...
depet/scikit-learn
examples/gpml/co2.py
Python
bsd-3-clause
2,535
import logging from appscake import helpers from django.shortcuts import render from django.shortcuts import render_to_response from appscake.forms import CommonFields from django.http import HttpResponse from django.http import HttpResponseRedirect # When deploying on virtual machines without IaaS support. CLUSTER_...
DrOctogon/appscake-rewrite
appscake/views.py
Python
bsd-3-clause
1,604
# -*- coding: utf-8 -*- # # TSgettoolbox documentation build configuration file, created by # sphinx-quickstart on Mon Jun 10 23:11:56 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # ...
timcera/tsgettoolbox
docs/conf.py
Python
bsd-3-clause
8,064
# Tai Sakuma <tai.sakuma@gmail.com> import numbers ##__________________________________________________________________|| def cmp_obj_list_almost_equal(list1, list2, rtol=1e-05, atol=1e-08): if not len(list1) == len(list2): return False for obj1, obj2 in zip(list1, list2): if not cmp_obj_almost...
TaiSakuma/scribblers
tests/compare_obj.py
Python
bsd-3-clause
1,134
import os import tempfile import shutil from django.test import TransactionTestCase from django.core.exceptions import ValidationError from django.core.files.uploadedfile import UploadedFile from django.contrib.auth.models import Group from django.db import IntegrityError from hs_core import hydroshare from hs_core.h...
ResearchSoftwareInstitute/MyHPOM
hs_app_netCDF/tests/test_netcdf_metadata.py
Python
bsd-3-clause
34,897
# pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103 from __future__ import absolute_import, division, print_function import pytest from .. import qtutil from ...external.qt import QtGui from ...external.qt.QtCore import Qt from mock import MagicMock, patch from ..qtutil import GlueDataDialog from ..qtutil import pr...
JudoWill/glue
glue/qt/tests/test_qtutil.py
Python
bsd-3-clause
13,748
from __future__ import absolute_import, print_function from mock import patch import unittest import logging import bokeh.document as document from bokeh.application import Application from bokeh.application.handlers import FunctionHandler from bokeh.client import pull_session, push_session, ClientSession from bokeh....
DuCorey/bokeh
bokeh/tests/test_client_server.py
Python
bsd-3-clause
37,673
#! /usr/bin/env python2.7 # -*- coding: utf-8 -*- from django.conf.urls import url, patterns, include from category.views import CategoryListView, CategoryCreateView, CategoryDetailView, CategoryUpdateView from category.views import TagListView, TagDetailView, TagCreateView, TagUpdateView urlpatterns = patterns('',...
aneumeier/category
oldcategory/urls.py
Python
bsd-3-clause
1,181
# Created By: Virgil Dupras # Created On: 2009-09-19 # Copyright 2010 Hardcoded Software (http://www.hardcoded.net) # # This software is licensed under the "BSD" License as described in the "LICENSE" file, # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licens...
hsoft/musicguru
qt/fs_model.py
Python
bsd-3-clause
7,759
# -*- coding: utf-8 -*- # # Test documentation build configuration file, created by # sphinx-quickstart on Sat Feb 21 22:42:03 2009. # # This file is execfile()d with the current directory set to its containing dir. # # The contents of this file are pickled, so don't put values in the namespace # that aren't pi...
pythonbyexample/PBE
dbetut/conf.py
Python
bsd-3-clause
6,209
from django.conf import settings from cid.locals import generate_new_cid from cid.locals import get_cid from cid.locals import set_cid class CidMiddleware: """ Middleware class to extract the correlation id from incoming headers and add them to outgoing headers """ def __init__(self, get_respons...
snowball-one/cid
cid/middleware.py
Python
bsd-3-clause
1,889
#----------------------------------------------------------------------------- # Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors. # All rights reserved. # # The full license is in the file LICENSE.txt, distributed with this software. #-------------------------------------------------------------------...
bokeh/bokeh
bokeh/plotting/glyph_api.py
Python
bsd-3-clause
25,080
#!/usr/bin/env python ''' Copyright (C) 2020, WAFW00F Developers. See the LICENSE file for copying permission. ''' NAME = 'SEnginx (Neusoft)' def is_waf(self): schemes = [ self.matchContent(r'SENGINX\-ROBOT\-MITIGATION') ] if any(i for i in schemes): return True return False
EnableSecurity/wafw00f
wafw00f/plugins/senginx.py
Python
bsd-3-clause
310
from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from example.apps.things.models import Thing class ThingAdmin(admin.ModelAdmin): fieldsets = ( (None, { 'fields': ('name', 'slug', 'image', 'description'), }), (_(u'Dates'), { ...
benspaulding/django-epio-example
example/apps/things/admin.py
Python
bsd-3-clause
661
# Generated by Django 2.2 on 2021-06-11 08:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('donation', '0004_donorinfo'), ] operations = [ migrations.AddField( model_name='donorinfo', name='is_indian', ...
PARINetwork/pari
donation/migrations/0005_donorinfo_is_indian.py
Python
bsd-3-clause
383
import logging from datetime import datetime import pymongo from bson import ObjectId from scout.constants import CASE_STATUSES, REV_ACMG_MAP from .case_events import CaseEventHandler from .variant_events import VariantEventHandler COMMENT_LEVELS = ["global", "specific"] LOG = logging.getLogger(__name__) class E...
Clinical-Genomics/scout
scout/adapter/mongo/event.py
Python
bsd-3-clause
17,111
import unittest import pgshapely from shapely.geometry import Point class TestPoints(unittest.TestCase): database = "test" user = "test" password = "test" def setUp(self): conn = pgshapely.connect(database=self.database, user=self.user, password=self.password) cursor = co...
skwash/pgshapely
pgshapely/tests/test_points.py
Python
bsd-3-clause
1,826
outfile=open("helloworld.txt","w") for num1 in range(1,10): for num2 in range(1,10): if num2<=num1 : outfile.write("{}*{}={} ".format(num2, num1 ,num1 * num2)) outfile.write(" \n") outfile.flush() outfile.close() infile=open("helloworld.txt","r") for line in infile.readlines(): print...
sinomiko/project
python_project/python/PythonProj/ReadWriteFile.py
Python
bsd-3-clause
1,234