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
#!/usr/local/bin/python #items=[('a','b'),(1,2)] #b=dict(items) #print b #c=dict(name='c',age=42) #print c #print len(c) #c['sex']='female' #print c #del c['age'] #print c #print 'sex' in c #c['age']=25 #print c #print c.clear() #print c #x={'name':'a','age':'14'} #y=x #print y #z=y.copy() #z.clear() #print x #print y ...
Vayne-Lover/Python
dictionary/test1.py
Python
apache-2.0
828
""" Optional integration with django-any-Imagefield """ from __future__ import absolute_import from django.db import models from fluent_utils.django_compat import is_installed if is_installed('any_imagefield'): from any_imagefield.models import AnyFileField as BaseFileField, AnyImageField as BaseImageField else:...
edoburu/django-fluent-utils
fluent_utils/softdeps/any_imagefield.py
Python
apache-2.0
1,856
# -*- coding: utf-8 -*- # Copyright 2013 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...
GoogleChrome/chromium-dashboard
api/metricsdata.py
Python
apache-2.0
7,840
# # Copyright 2013 Nicolas Lamirault <nicolas.lamirault@gmail.com>. # # 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 ...
nlamirault/python-freeboxclient
freeboxclient/simple.py
Python
apache-2.0
1,473
import argparse import logging import netaddr import os from oslo_utils import encodeutils from oslo_utils import importutils import six from . import exceptions from ..i18n import _ ON_STATE = "ON" OFF_STATE = "OFF" def env(*vars, **kwargs): for v in vars: value = os.environ.get(v) if value: ...
anythingrandom/eclcli
eclcli/network/networkclient/common/utils.py
Python
apache-2.0
10,377
# coding: utf-8 __author__ = 'linlin' import os import logging import re import pdb logger = logging.getLogger(__name__) ################################################################ root_dir = '/home/linlin/time/0903_classify_false_start/1003_raw_features/' separator = '\t\t' #####################################...
linkinwong/word2vec
src/crf-paper-script/preprocessor6_ssr_rep_increase_5_scale.py
Python
apache-2.0
8,443
''' Copyright 2016, EMC, Inc. Author(s): George Paulos ''' import os import sys import subprocess # set path to common libraries sys.path.append(subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip("\n") + "/test/common") import fit_common # Select test group here using @attr from nose.plugin...
tldavies/RackHD
test/tests/rackhd20/test_rackhd20_api_files.py
Python
apache-2.0
3,026
#! /usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'maxim' import six import unittest import numpy as np import hyperengine as hype from hyperengine.base import NamedDict class NamedDictTest(unittest.TestCase): def test_embedded_dict(self): spec = hype.spec.new({ 'foo': { 'bar': { ...
maxim5/hyper-engine
hyperengine/tests/named_dict_test.py
Python
apache-2.0
3,262
"""Adding Email Templates Revision ID: 3d723944025f Revises: 148ca74a6d3 Create Date: 2015-01-23 12:28:20.581924 """ # revision identifiers, used by Alembic. revision = '3d723944025f' down_revision = '148ca74a6d3' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade():...
Code4SA/pmg-cms-2
migrations/versions/3d723944025f_adding_email_templates.py
Python
apache-2.0
1,337
# # Copyright 2012 Sonya Huang # # 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...
sonya/eea
py/wiod/parsers/eia.py
Python
apache-2.0
2,800
# Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 from .doc import selfdoc # noqa: F401 from .elaborate import elaborate # noqa: F401 from .generate import generate # noqa: F401 from .generate_tb import generate_tb # n...
lowRISC/opentitan
util/tlgen/__init__.py
Python
apache-2.0
465
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import unittest import numpy as np import tensorflow as tf from sklearn.utils import shuffle from tqdm import tqdm import tensorlayer as tl from tensorlayer.cost import cross_entropy_seq from tensorlayer.models.seq2seq_with_attention import Seq2seqLuongAttentio...
zsdonghao/tensorlayer
tests/models/test_seq2seq_with_attention.py
Python
apache-2.0
3,633
# Copyright 2020 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...
tensorflow/model-optimization
tensorflow_model_optimization/python/core/api/quantization/keras/default_8bit/default_8bit_transforms/__init__.py
Python
apache-2.0
2,949
input = """ 1 2 0 0 1 3 0 0 1 4 0 0 1 5 0 0 1 6 2 1 7 8 1 7 2 1 6 8 1 8 0 0 1 9 2 1 10 11 1 10 2 1 9 11 1 11 0 0 1 12 2 1 13 14 1 13 2 1 12 14 1 14 0 0 1 15 2 1 16 17 1 16 2 1 15 17 1 17 0 0 2 18 2 0 2 12 6 1 1 1 0 18 2 19 2 0 2 15 9 1 1 1 0 19 0 6 a(b,2) 9 a(b,1) 12 a(a,2) 15 a(a,1) 4 c(a) 5 c(b) 7 na(b,2) 10 na(b,1) ...
alviano/wasp
tests/asp/cautious/count.example5.cautious.asp.test.py
Python
apache-2.0
418
import telnetlib import time IP = '184.105.247.70' PORT = 23 TIMEOUT = 6 username = 'pyclass' password = '88newclass' # get connection with IP, port and timeout my_conn = telnetlib.Telnet(IP, PORT, TIMEOUT) # send username and password output = my_conn.read_until('sername:', TIMEOUT) my_conn.write(username + '\n')...
sbyount/pynet_test
class2ex2a.py
Python
apache-2.0
642
# -*- coding: utf-8 -*- # Copyright (C) 2020 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 ...
openstack/taskflow
releasenotes/source/conf.py
Python
apache-2.0
9,270
from vishnu.session import Session from vishnu.backend import PyMemcache def memcache_client(sid=None): if sid is None: sid = Session.generate_sid() config = PyMemcache() client = config.client_from_config(sid) return client def test_load(): sid = Session.generate_sid() client_a = ...
anomaly/vishnu
tests/backend/client/memcache/test_pymemcache.py
Python
apache-2.0
1,393
# Copyright 2010-2011 OpenStack Foundation # Copyright 2013 IBM Corp. # 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/license...
phenoxim/nova
nova/api/openstack/compute/views/images.py
Python
apache-2.0
6,081
''' Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. This module creates N nodes and sends X messages randomly between nodes and records any failures. The messages are sent in blocks of 100 and then it waits and does it again. Created on Jul 7, 2014 @author...
danfleck/Class-Chord
network-client/src/tests/ParallelStressTest.py
Python
apache-2.0
6,454
"""Base Bolt classes.""" from __future__ import absolute_import, print_function, unicode_literals from collections import defaultdict import os import signal import sys import threading import time import warnings import logging from six import iteritems, reraise, PY3 from .base import Component from .ipc import (re...
singhdev/streamparse
streamparse/bolt.py
Python
apache-2.0
16,210
# -*- coding: utf-8 -*- """The Viper analysis plugin CLI arguments helper.""" from plaso.analysis import viper from plaso.cli.helpers import interface from plaso.cli.helpers import manager from plaso.lib import errors class ViperAnalysisArgumentsHelper(interface.ArgumentsHelper): """Viper analysis plugin CLI argum...
dc3-plaso/plaso
plaso/cli/helpers/viper_analysis.py
Python
apache-2.0
3,976
""" Analytical template tags and filters. """ from __future__ import absolute_import import logging from django import template from django.template import Node, TemplateSyntaxError from django.utils.importlib import import_module from templatetags.utils import AnalyticalException TAG_LOCATIONS = ['head_top', 'hea...
linkedin/indextank-service
storefront/templatetags/analytical.py
Python
apache-2.0
2,352
# 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/text/quac/quac_test.py
Python
apache-2.0
1,116
# Copyright 2013 IBM Corp # 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 appl...
openstack/tempest-lib
tempest_lib/services/compute/certificates_client.py
Python
apache-2.0
1,435
import time import json from datetime import datetime, timedelta from world import world, res_filename from bigml.api import HTTP_CREATED from bigml.api import HTTP_OK from bigml.api import HTTP_ACCEPTED from bigml.api import FINISHED from bigml.api import FAULTY from bigml.api import get_status import read_dataset_st...
ShaguptaS/python
bigml/tests/create_dataset_steps.py
Python
apache-2.0
5,400
from datetime import datetime class Logger(object): FATAL = 0 ERROR = 1 WARN = 2 INFO = 3 DEBUG = 4 TRACE = 5 def __init__(self, f, log_level=3): level = int(log_level) if level < 0 or level > Logger.TRACE: raise Exception("Invalid Log Level %d" % level) ...
zmap/ztag
ztag/log.py
Python
apache-2.0
1,994
import re from sqlalchemy.sql import func from sqlalchemy.types import String, TypeDecorator # https://bitbucket.org/zzzeek/sqlalchemy/issues/3729/using-array_agg-around-row-function-does class ArrayOfRecord(TypeDecorator): _array_regexp = re.compile(r"^\{(\".+?\")*\}$") _chunk_regexp = re.compile(r'"(.*?)"...
getsentry/zeus
zeus/db/func.py
Python
apache-2.0
1,373
# Copyright 2019 The Bazel 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 applicable law...
bazelbuild/bazel-bench
utils/logger.py
Python
apache-2.0
1,409
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
GoogleCloudPlatform/buildpacks
builders/testdata/python/functions/conflicting_dependencies/main.py
Python
apache-2.0
926
import codecs import os import re from setuptools import setup, find_packages ################################################################### NAME = "miniboa" PACKAGES = find_packages(where="src") META_PATH = os.path.join("src", "miniboa", "__init__.py") KEYWORDS = ["mud", "tcp", "telnet"] CLASSIFIERS = [ "...
shmup/miniboa
setup.py
Python
apache-2.0
2,304
import os import base64 from requests import Session, Request from OpenSSL import crypto url = 'http://ct.googleapis.com/aviator/ct/v1/get-roots' s = Session() r = Request('GET', url) prepped = r.prepare() r = s.send(prepped) if r.status_code == 200: roots = r.json() # RFC 6962 defines the cert...
wgoulet/CTPyClient
fetchroots.py
Python
apache-2.0
1,184
# # 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...
dhuang/incubator-airflow
airflow/www/decorators.py
Python
apache-2.0
3,563
import sys from textwrap import dedent import numpy as np import pandas as pd import xarray as xr from xarray.core import formatting from . import raises_regex class TestFormatting: def test_get_indexer_at_least_n_items(self): cases = [ ((20,), (slice(10),), (slice(-10, None),)), ...
jhamman/xarray
xarray/tests/test_formatting.py
Python
apache-2.0
12,536
# # 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 us...
vikkyrk/incubator-beam
sdks/python/apache_beam/runners/dataflow/internal/dependency_test.py
Python
apache-2.0
16,889
"""jwzthreading.py Contains an implementation of an algorithm for threading mail messages, as described at http://www.jwz.org/doc/threading.html. To use: Create a bunch of Message instances, one per message to be threaded, filling in the .subject, .message_id, and .references attributes. You can use the .messa...
txsl/mail-trends
jwzthreading.py
Python
apache-2.0
10,294
# -*- coding:utf-8 -*- # # Copyright (C) 2008 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
couchbasedeps/git-repo
git_config.py
Python
apache-2.0
21,644
import tensorflow as tf from preprocessing import resize def preprocess_image(image, output_height, output_width, is_training=False): image = tf.image.convert_image_dtype(image, dtype=tf.float32) image = resize.preprocess_image(image, output_height, output_width, is_training) image = tf.subtract(image, 0.5...
pjaehrling/finetuneAlexVGG
preprocessing/inception/resize.py
Python
apache-2.0
375
"""Support for Sensibo wifi-enabled home thermostats.""" import asyncio import logging import aiohttp import async_timeout import voluptuous as vol from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA from homeassistant.components.climate.const import ( DOMAIN, SUPPORT_TARGET_TEMPERATURE, ...
aequitas/home-assistant
homeassistant/components/sensibo/climate.py
Python
apache-2.0
12,247
#!/usr/bin/env python import os, sys, webbrowser try: from subprocess import getstatusoutput # Python3 except: from commands import getstatusoutput # Python2 def shell_command(command): # do the command and print the output cmdResults = getstatusoutput(command) if True: # not cmdResults[0]: for...
cclauss/In-Harms-Way
server/run_django.py
Python
apache-2.0
727
# Copyright (c) 2003-2014 CORE Security Technologies # # This software is provided under under a slightly modified version # of the Apache Software License. See the accompanying LICENSE file # for more information. # # $Id: lsad.py 1106 2014-01-19 14:17:01Z bethus@gmail.com $ # # Author: Alberto Solino # # Description:...
hecchi777/S3-SlaacSecuritySolution
impacket-0.9.11/impacket/dcerpc/v5/lsad.py
Python
apache-2.0
57,687
class IncrementedNamedInt: _last_int = 0 _names = {} @classmethod def get(cls, name): cls._last_int += 1 cls._names[cls._last_int] = name return cls._last_int @classmethod def name_of(cls, int): return cls._names[int] @classmethod def get_for_name(cls, ...
buxx/synergine
synergine/lib/eint.py
Python
apache-2.0
471
# Generated by Django 3.1.13 on 2021-09-16 07:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("github", "0003_githubusertoken"), ] operations = [ migrations.AddField( model_name="githubwebhookmessage", name="er...
comic/comic-django
app/grandchallenge/github/migrations/0004_auto_20210916_0746.py
Python
apache-2.0
769
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
elibixby/gcloud-python
gcloud/error_reporting/test_client.py
Python
apache-2.0
5,284
import time from django import forms from django.forms.util import ErrorDict from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.utils.crypto import salted_hmac, constant_time_compare from django.utils.encoding import force_text from django.utils.text import get_text_...
boldprogressives/django-opendebates
opendebates/opendebates_comments/forms.py
Python
apache-2.0
7,408
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # 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...
ntt-sic/heat
heat/tests/test_ceilometer_alarm.py
Python
apache-2.0
15,354
import json import os import re import shutil import subprocess import sys import tempfile import textwrap import time import venv # type: ignore import zipfile from typing import Dict from argparse import ArgumentParser from dataclasses import dataclass from pathlib import Path from urllib.request import urlopen f...
fishtown-analytics/dbt
scripts/build-dbt.py
Python
apache-2.0
29,183
#!/usr/bin/python # -*- coding: utf-8 -*- # Hive Appier Framework # Copyright (c) 2008-2021 Hive Solutions Lda. # # This file is part of Hive Appier Framework. # # Hive Appier Framework is free software: you can redistribute it and/or modify # it under the terms of the Apache License as published by the Apach...
hivesolutions/appier
src/appier/test/model.py
Python
apache-2.0
28,833
# # Copyright (c) SAS Institute 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 w...
sassoftware/rmake3
rmake/build/buildjob.py
Python
apache-2.0
12,119
# pylint:disable=consider-using-with from typing import List, Dict import json import subprocess import argparse import tempfile import os import itertools from collections import defaultdict import angr UNIQUE_STRING_COUNT = 20 # strings longer than MAX_UNIQUE_STRING_LEN will be truncated MAX_UNIQUE_STRING_LEN = 70...
angr/angr
angr/flirt/build_sig.py
Python
bsd-2-clause
10,375
############################################################################### # Copyright 2015-2020 University of Florida. All rights reserved. # This file is part of UF CTS-IT's NACCulator project. # Use of this source code is governed by the license found in the LICENSE file. #######################################...
ctsit/nacculator
nacc/uds3/np/builder.py
Python
bsd-2-clause
5,859
import numpy as np def conjunction(stats, ps=None): """Run a conjunction test. Parameters ---------- stats : np.array([float, ...]) A list of statistics, e.g *t*-values. ps : np.array([float, ...]), None A list of (optional) p-values matching elements in stats. ...
parenthetical-e/modelmodel
stats.py
Python
bsd-2-clause
1,951
#! /usr/bin/env python # -*- mode: python; coding: utf-8 -*- # Copyright 2018 the HERA Collaboration # Licensed under the 2-clause BSD license. """Gather correlator log outputs and log them into M&C.""" import sys import json import redis import socket import logging from astropy.time import Time from hera_mc impor...
HERA-Team/hera_mc
scripts/mc_listen_to_corr_logger.py
Python
bsd-2-clause
3,281
#!/usr/bin/env python import os, re, sys ## assert (len(sys.argv) == 2) PATH_SRC = sys.argv[1] PATH_BIN = sys.argv[2] FILENAME_CMK = os.path.join (PATH_SRC, 'CMakeLists.txt') FILENAME_PRE = os.path.join (PATH_SRC, 'config.h.in.pre') FILENAME_NEW = os.path.join (PATH_BIN, 'config.h.in') # Parse CMakeLists.txt with ...
http2d/core
config.h.in.pre-update.py
Python
bsd-2-clause
1,111
# ***************************************************************************** # Copyright (c) 2020, Intel Corporation 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 sou...
IntelLabs/hpat
examples/series/series_idxmin.py
Python
bsd-2-clause
1,752
import json from channels import Group as ChannelGroup from django.contrib.sites.shortcuts import get_current_site from django.db import transaction from django.db.models import Q from registration import signals from registration.models import RegistrationProfile from registration.views import RegistrationView from r...
awemulya/fieldsight-kobocat
onadata/apps/users/viewsets.py
Python
bsd-2-clause
10,959
import uuid from datetime import datetime from unittest import TestCase import pytz import colander from unicore.comments.service.models import ( COMMENT_MAX_LENGTH, COMMENT_CONTENT_TYPES, COMMENT_MODERATION_STATES, COMMENT_STREAM_STATES) from unicore.comments.service.schema import ( Comment, Flag, Banned...
universalcore/unicore.comments
unicore/comments/service/tests/test_schema.py
Python
bsd-2-clause
9,303
# encoding: utf-8 from __future__ import unicode_literals from django.test import TestCase from simple_auth.models import Password class ModelTests(TestCase): def test_save_object(self): Password.objects.create( name="My test", password="ajdkjkjakdj", )
bennylope/django-simple-auth
tests/test_models.py
Python
bsd-2-clause
302
# simple class generator helper #Ange Albertini, BSD licence 2011 import struct def make_utf8(s): return "".join(["\x01", struct.pack(">H", len(s)), s]) def make_class(i): return "".join(["\x07", struct.pack(">H", i)]) def make_nat(name, type): return "".join(["\x0C", struct.pack(">H", name)...
angea/corkami
src/java/java.py
Python
bsd-2-clause
1,502
""" Fetch whole SNMP table ++++++++++++++++++++++ Send a series of SNMP GETNEXT requests using the following options: * with SNMPv1, community 'public' * over IPv4/UDP * to an Agent at demo.snmplabs.com:161 * for some columns of the IF-MIB::ifEntry table * with MIB lookup enabled * stop when response OIDs leave the s...
etingof/pysnmp
examples/hlapi/v1arch/asyncore/sync/manager/cmdgen/pull-whole-snmp-table.py
Python
bsd-2-clause
1,481
#!/usr/bin/env python # -*- coding: utf-8 -*- import json import sys from utils.benchmark import get_matrix # Generate a json-formatted problem from a MDVRP file. # Those benchmarks use double precision for matrix costs and results # are usually reported with 2 decimal places. As a workaround, we # multiply all costs...
VROOM-Project/vroom-scripts
src/mdvrp_to_json.py
Python
bsd-2-clause
3,918
# # Copyright (c) 2016, AnyWi Technologies BV # 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 conditi...
AnyWi/py-ubnt-airviewer
airviewer.py
Python
bsd-2-clause
11,342
from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals __all__ = [ "__title__", "__summary__", "__uri__", "__version__", "__author__", "__email__", "__license__", "__copyright__", ] __title__ = "stockpile" __summary__ = "Generic file storage abstraction"...
pombredanne/stockpile
stockpile/__about__.py
Python
bsd-2-clause
539
import sys import sherpa.astro.ui as ui import numpy as np import datastack x1 = np.arange(50)+2 y1 = x1**2 x2 = np.arange(10) y2 = x2**1.9 * 2 x3 = np.arange(60) y3 = x3**2.1 * 4 ds = datastack.DataStack() ds[1].load_arrays(x1, y1) # ID required (autonumbering possible but potential problems) ds[2].load_arrays(x2,...
taldcroft/datastack
test_pure_oo.py
Python
bsd-2-clause
844
from django.db import models from tastypie.resources import ModelResource from tastypie.authentication import ApiKeyAuthentication from tastypie.authorization import DjangoAuthorization from tastypie.throttle import CacheThrottle from tastypie.validation import FormValidation from gateway_backend.tasks import url_sho...
victorpoluceno/shortener_frontend
rest_api/api.py
Python
bsd-2-clause
1,486
#!/usr/bin/env python import numpy import random import logging import itertools import collections from friendloc.base import gob from friendloc.base.models import Edges, User, Tweets from friendloc.base import gisgraphy, twitter, utils NEBR_KEYS = ['rfriends','just_followers','just_friends','just_mentioned'] @go...
JeffAMcGee/friendloc
friendloc/explore/sprawl.py
Python
bsd-2-clause
13,724
from Cython.Compiler import Options from Cython.Compiler import PyrexTypes from Cython.Compiler.Visitor import CythonTransform from Cython.Compiler.StringEncoding import EncodedString from Cython.Compiler.AutoDocTransforms import ( ExpressionWriter as BaseExpressionWriter, AnnotationWriter as BaseAnnotationWrit...
mpi4py/mpi4py
conf/cyautodoc.py
Python
bsd-2-clause
9,170
from linot.Plugins.PluginBase import PluginBase from linot.LinotArgParser import LinotParser from nose.tools import ok_ from nose.tools import raises class MockLine: def __init__(self): self.msg_recv = [] self.msg_text = [] def sendMessageToClient(self, recv, msg): self.msg_recv.appen...
hpeter/Linot
test_temp/Plugins/TestPluginBase.py
Python
bsd-2-clause
1,918
from .components_generic import System from .ports_library import FluidPort, MechPort, CustomPort class Duct(System): def __init__(self, name='n/a'): super().__init__() self.name = name self.params['fl_in'] = FluidPort() self.outputs['fl_out'] = FluidPort() self.set() ...
adriendelsalle/unsysap
unsysap/components_library.py
Python
bsd-2-clause
4,949
# -*- coding: utf-8 -*- """ Creates a very basic one-page html file for reporting a test run. """ from __future__ import absolute_import from behave.formatter.base import Formatter from behave.formatter.css import BasicTheme from behave.compat.collections import Counter import xml.etree.ElementTree as ET import base64...
kymbert/behave
behave/formatter/html.py
Python
bsd-2-clause
15,092
# -*- coding: utf-8 -*- # Copyright 2016 by Luc Saffre. # License: BSD, see LICENSE for more details. """Defines the :rst:dir:`directory`, :rst:dir:`tickets_table` and :rst:dir:`entry_intro` directives. .. rst:directive:: directory Inserts a table containing three columns 'title', 'author' and 'date', and one row fo...
khchine5/atelier
atelier/sphinxconf/dirtables.py
Python
bsd-2-clause
6,048
# template global functions # make sure not to conflict with built-ins: # http://jinja.pocoo.org/docs/2.9/templates/#list-of-global-functions from flask.helpers import url_for as _url_for from flask_paginate import Pagination def paginate(page, total, per_page, config): record_name = config['MOMO_PAGINATION_RECO...
shichao-an/momo
momo/plugins/flask/functions.py
Python
bsd-2-clause
1,505
#!/usr/bin/env python """ @package mi.dataset.driver.vel3d_l.wfp @file marine-integrations/mi/dataset/driver/vel3d_l/wfp/vel3d_l_wfp_recovered_driver.py @author Tapana Gupta @brief Driver for the vel3d_l_wfp instrument Release notes: Initial Release """ from mi.core.log import get_logger from mi.dataset.dataset_pa...
JeffRoy/mi-dataset
mi/dataset/driver/vel3d_l/wfp/vel3d_l_wfp_recovered_driver.py
Python
bsd-2-clause
2,021
""" Django-Datamaps provides helper functions compatible with datamaps.js. """ __version__ = '0.2.2'
rochapps/django-datamaps
datamaps/__init__.py
Python
bsd-2-clause
103
import pickle import requests from hashlib import md5 import os user_home = os.getenv('USERPROFILE') or os.getenv('HOME') session_file_name = os.path.join(user_home, ".uva_session") session_checksum_name = os.path.join(user_home, ".uva_session_checksum") def exist_session_file(): try: open(session_file_name) op...
young-geng/UVaClient
session_store.py
Python
bsd-2-clause
1,089
import unittest import subprocess import sys from numba.tests.support import TestCase class TestNumbaImport(TestCase): """ Test behaviour of importing Numba. """ def run_in_subproc(self, code, flags=None): if flags is None: flags = [] cmd = [sys.executable,] + flags + ["-...
gmarkall/numba
numba/tests/test_import.py
Python
bsd-2-clause
2,535
from math import atan2, cos, radians, sin, sqrt import numpy as np import scipy.ndimage as im from bokeh.document import Document from bokeh.embed import file_html from bokeh.models import (Column, ColumnDataSource, GMapOptions, GMapPlot, Grid, Label, Line, LinearAxis, PanTool, Patches, ...
ericmjl/bokeh
examples/models/file/trail.py
Python
bsd-3-clause
4,605
""" Oracle database backend for Django. Requires cx_Oracle: http://cx-oracle.sourceforge.net/ """ from __future__ import unicode_literals import decimal import re import platform import sys import warnings def _setup_environment(environ): # Cygwin requires some special voodoo to set the environment variables ...
adambrenecki/django
django/db/backends/oracle/base.py
Python
bsd-3-clause
40,557
# -*- coding: utf-8 -*- from django import template from django.db import models from django.utils.html import escape register = template.Library() class TreeTrunkNode(template.Node): """ Render the first few levels of a topic tree as an unordered HTML list. """ def __init__(self, model_name, levels=...
indexofire/gravoicy
gravoicy/libs/category/templatetags/__init__.py
Python
bsd-3-clause
2,558
from __future__ import division, absolute_import, print_function import numpy as np from numpy.compat import long from numpy.core import (array, arange, atleast_1d, atleast_2d, atleast_3d, vstack, hstack, newaxis, concatenate, stack) from numpy.testing import (TestCase, assert_, assert_raises, ...
behzadnouri/numpy
numpy/core/tests/test_shape_base.py
Python
bsd-3-clause
11,890
""" Django-site-news constants. These are for convenience. """ # Category defaults DOWNTIME = 30 CHANGES = 20 INFO = 10
glesica/django-site-news
site_news/constants.py
Python
bsd-3-clause
122
""" The deletions subsystem managers bulk deletes as well as cascades. It attempts to optimize around various patterns while using a standard approach to do so. For example, let's say you want to delete an organization: >>> from sentry import deletions >>> task = deletions.get(model=Organization) >>> work = True >>> ...
gencer/sentry
src/sentry/deletions/__init__.py
Python
bsd-3-clause
4,094
# -*- coding: utf-8 -*- # # Copyright (C) 2016 Andi Albrecht, albrecht.andi@gmail.com # # This module is part of python-sqlparse and is released under # the BSD License: https://opensource.org/licenses/BSD-3-Clause from sqlparse import sql from sqlparse import tokens as T from sqlparse.utils import recurse, imt T_NUM...
zorroz/microblog
flask/lib/python2.7/site-packages/sqlparse/engine/grouping.py
Python
bsd-3-clause
11,428
from zeit.cms.i18n import MessageFactory as _ import copy import grokcore.component as grok import lxml.objectify import zeit.cms.content.property import zeit.cms.interfaces import zeit.cms.syndication.feed import zeit.cms.syndication.interfaces import zeit.content.cp.blocks.block import zeit.content.cp.interfaces impo...
ZeitOnline/zeit.content.cp
src/zeit/content/cp/blocks/teaser.py
Python
bsd-3-clause
7,905
class UnsupportedSavedReportError(Exception): """ For unknown (discontinued/legacy) saved-reports """ pass class UnsupportedScheduledReportError(Exception): """ For unknown (discontinued/legacy) scheduled-reports """ pass class ReportNotFound(Exception): pass
dimagi/commcare-hq
corehq/apps/saved_reports/exceptions.py
Python
bsd-3-clause
302
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-02-16 14:19 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mylocation', '0004_delete_portterminal'), ] operations = [ migrations.Rename...
chadgates/locmaster
mylocation/migrations/0005_auto_20160216_1419.py
Python
bsd-3-clause
1,700
from django.core.urlresolvers import reverse from rest_framework import serializers from casenotes.api import CaseNoteSerializer from .. import models class ViewTicketSerializer(serializers.ModelSerializer): case_note = CaseNoteSerializer() claim_url = serializers.SerializerMethodField() resolve_url = s...
Kvoti/ditto
ditto/tickets/api/serializers.py
Python
bsd-3-clause
900
#!/usr/bin/python2.6 import sys, string, os, time, fnmatch, imgFG, markup, re from markup import oneliner as o from numpy import * import pdb abi = ["DTB-004", "DTB-009", "DTB-024Pro", "DTB-030", "DTB-034", "DTB-036", "DTB-046", "DTB-049", "DTB-053", "DTB-064", "DTB-073"] naive = ["DTB-003", "DTB-005", "DTB-011", ...
UCSC-MedBook/MedBook_
tools/old-external-tools/shazam/abiFG.py
Python
bsd-3-clause
14,508
import datetime import os from django.db import models from django.core.files.base import ContentFile from django.core.files.storage import get_storage_class from django.utils.translation import ugettext as _ from django.utils.hashcompat import md5_constructor from django.utils.encoding import smart_str from django.db...
Temesis/django-avatar
avatar/models.py
Python
bsd-3-clause
6,049
from django.conf.global_settings import MIDDLEWARE_CLASSES from settings_default import INSTALLED_APPS DEBUG = True TEMPLATE_DEBUG = DEBUG SECRET_KEY = 'please-generate-your-secret-key' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'sqlite.db', } } # FACEBOOK_APP...
teknolab/django.org.tr
project/local_settings-example.py
Python
bsd-3-clause
1,149
import unittest import types """ TODO: - tests for exact extraction for a known mp3 - tests for writing """ from tagger.id3v1 import * from tagger.exceptions import * from tagger.constants import * class ID3v1LoadTest(unittest.TestCase): def testLoadReadOnly(self): id3 = ID3v1(self.filename, ID3_FILE_READ) pri...
Ciantic/pytagger
tests/test_id3v1.py
Python
bsd-3-clause
2,378
import pickle import pytest import sys from collections import defaultdict from unittest.mock import Mock, patch from kombu import Connection, Consumer, Producer, Exchange, Queue from kombu.exceptions import MessageStateError from kombu.utils import json from kombu.utils.functional import ChannelPromise from t.mock...
ZoranPavlovic/kombu
t/unit/test_messaging.py
Python
bsd-3-clause
24,456
# Generated by Django 2.0.2 on 2018-02-03 17:07 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('stein', '0054_delete_classification_relation'), ] operations = [ migrations.DeleteModel( name='Classification', ), ]
GeoMatDigital/django-geomat
geomat/stein/migrations/0055_delete_classification_model.py
Python
bsd-3-clause
313
""" Convert a Python string to its native type. The reason this module exists because there is a need to handle arguments with the syntax `--opt KEY=VAL` where `KEY` will be used as a keyword argument somewhere and `VAL` is expected to be a native Python type. This module was built with click in mind, which is an exc...
geowurster/str2type
str2type/__init__.py
Python
bsd-3-clause
3,276
from setuptools import setup, find_packages import sys, os here = os.path.abspath(os.path.dirname(__file__)) README = open(os.path.join(here, 'README.rst')).read() NEWS = open(os.path.join(here, 'NEWS.txt')).read() version = '0.1.4' setup(name='django-nested-formset', description='Nest Django formsets for mu...
nyergler/nested-formset
setup.py
Python
bsd-3-clause
1,386
""" Axilent Client functionality for Dox. """ from sharrock.client import HttpClient, ResourceClient, ServiceException from dox.config import get_cfg from dox.utils import slugify def _get_resource(app,resource,library=True): """ Gets a resource client. """ cfg = get_cfg() apikey_setting = 'library...
Axilent/Dox
dox/client.py
Python
bsd-3-clause
2,050
import itertools import numpy as np from numpy.testing import ( assert_, assert_equal, assert_array_equal, assert_almost_equal, assert_raises, suppress_warnings, assert_raises_regex, assert_allclose ) # Setup for optimize einsum chars = 'abcdefghij' sizes = np.array([2, 3, 4, 5, 4, 3, 2, 6, 5, 4, 3]) glob...
WarrenWeckesser/numpy
numpy/core/tests/test_einsum.py
Python
bsd-3-clause
44,838
from ..system_uri import IETF_LANGUAGE_TAG from .coding import Coding from .lazy import lazyprop class LocaleConstants(object): """Attributes for built in locales Additions may be defined in persistence files, base values defined within for easy access and testing """ def __iter__(self): ...
uwcirg/true_nth_usa_portal
portal/models/locale.py
Python
bsd-3-clause
817
import sys import numpy as np from PyQt4.QtCore import QTimer from pyqtgraph.Qt import QtGui, QtCore import pyqtgraph as pg from timestamp import now_timestamp from numpy_buffer import RingBuffer class MyApplication(QtGui.QApplication): def __init__(self, *args, **kwargs): super(MyApplication, self).__i...
scls19fr/numpy-buffer
samples/sample_pyqtgraph_no_datetime.py
Python
bsd-3-clause
1,706
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Generated from FHIR 3.0.0.11832 on 2017-03-22. # 2017, SMART Health IT. import io import json import os import unittest from . import compartmentdefinition from .fhirdate import FHIRDate class CompartmentDefinitionTests(unittest.TestCase): def instantiate_fro...
all-of-us/raw-data-repository
rdr_service/lib_fhir/fhirclient_3_0_0/models/compartmentdefinition_tests.py
Python
bsd-3-clause
3,668
from django.test import TestCase, Client from django.core.management import call_command from django.conf import settings class TestViews(TestCase): def setUp(self): self.client = Client() args = [] opts = {'dumpfile': settings.MEDIA_ROOT + 'test_db_dump.xml', 'verbosity': 0} cmd ...
carlosp420/VoSeq
blast_local_full/tests/test_views.py
Python
bsd-3-clause
538