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 |
|---|---|---|---|---|---|
from model.contact import Contact
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try:
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 5
f = "date\\contacts.json"
for o, a... | IrinaZI/Python_training | generator/contact.py | Python | apache-2.0 | 2,034 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- encoding: utf-8 -*-
#
# 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
#
# Un... | citrix-openstack-build/ironic | ironic/db/sqlalchemy/migrate_repo/versions/007_add_extra_created_updated_to_chassis.py | Python | apache-2.0 | 1,120 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abst... | dturner-tw/pants | src/python/pants/util/process_handler.py | Python | apache-2.0 | 1,071 |
# fixfastq.py
# runs through a fastq file and throws out all reads that don't make sense
# Usage: nohup cat ddx5_ActD_R1_test.fastq | parallel -j 8 --pipe -L3000 python fixfastq.py > ddx5_ActD_R1_test_ofn.fastq &
import fileinput
def writeLines(lines):
if len(lines[1]) != len(lines[3]): return
for l in li... | bdo311/chirpseq-analysis | fixfastq.py | Python | apache-2.0 | 716 |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2021 DeepMind Technologies Limited. 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... | deepmind/neural_testbed | neural_testbed/bandit/thompson.py | Python | apache-2.0 | 7,000 |
# Copyright 2019 Aerospike, 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, ... | aerospike/aerospike-admin | lib/view/sheet/render/__init__.py | Python | apache-2.0 | 2,681 |
from setuptools import setup, find_packages
setup(
name='mzident_writer',
version='0.0.5',
packages=find_packages(),
install_requires=["lxml"]
) | mobiusklein/mzidentml_writer | setup.py | Python | apache-2.0 | 174 |
#MenuTitle: Set Subscript and Superscript Parameters
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Measures your superior and inferior figures and derives subscript/superscript X/Y offset/size parameters.
"""
import vanilla, math
from Foundation import NSPoint
c... | mekkablue/Glyphs-Scripts | Font Info/Set Subscript and Superscript Parameters.py | Python | apache-2.0 | 15,776 |
import unittest
import simple_db_migrate
import os
import sys
from StringIO import StringIO
from mock import patch, Mock
class RunTest(unittest.TestCase):
def setUp(self):
config_file = '''
DATABASE_HOST = os.getenv('DB_HOST') or 'localhost'
DATABASE_USER = os.getenv('DB_USERNAME') or 'root'
DATABASE_PASS... | johnnymo87/simple-db-migrate | tests/run_test.py | Python | apache-2.0 | 15,634 |
# Copyright (c) 2015 Hitachi Data Systems.
# 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... | NetApp/manila | manila/data/helper.py | Python | apache-2.0 | 10,000 |
"""Rocket.Chat notification service."""
import logging
from rocketchat_API.APIExceptions.RocketExceptions import (
RocketAuthenticationException,
RocketConnectionException,
)
from rocketchat_API.rocketchat import RocketChat
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_DATA,
... | lukas-hetzenecker/home-assistant | homeassistant/components/rocketchat/notify.py | Python | apache-2.0 | 2,332 |
#!/usr/bin/env python2.7
import sys
from sqlalchemy import Table, Column, Integer, String, ForeignKey, Sequence
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, backref
Base = declarative_base()
def init_db():
Base.metadata.create_all(engine)
def drop_db():
Bas... | fs714/drcontroller | drcontroller/db/models.py | Python | apache-2.0 | 5,315 |
#!/usr/bin/env python
from brian import *
duration = 1*second
N_sims = 1
lif_eq = ['dV/dt = (V_rest-V)/tau_mem : volt']
V_rest = 0*mV
V_reset = 0*mV
V_th = 15*mV
t_refr = 2*ms
tau_mem = 10*msecond
N_in = 2000
f_in = 5*Hz
involt_exc = 0.35*mV
involt_inh = -0.2*mV
inp = PoissonGroup(N_in, f_in)
nrns = NeuronGroup(N_si... | achilleas-k/brian-scripts | lif_ing.py | Python | apache-2.0 | 1,159 |
from functools import lru_cache
from typing import List, Optional
from .constant import UNICODE_SECONDARY_RANGE_KEYWORD
from .utils import (
is_accentuated,
is_ascii,
is_case_variable,
is_cjk,
is_emoticon,
is_hangul,
is_hiragana,
is_katakana,
is_latin,
is_punctuation,
is_sep... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/charset_normalizer/md.py | Python | apache-2.0 | 17,654 |
import random
class World:
MAX_WIDTH = 100
MAX_HEIGHT = 100
map = []
colors = ['#FDFDFD', 'AA00A0']
def __init__(self):
for i in range(self.MAX_WIDTH):
self.map.append([])
for j in range(self.MAX_HEIGHT):
self.map[i].append(random.choice(self.color... | pugovok/lupland | world.py | Python | apache-2.0 | 324 |
# 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 u... | Huyuwei/tvm | tests/python/frontend/onnx/test_forward.py | Python | apache-2.0 | 52,747 |
# Copyright 2015 Objectif Libre
#
# 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 agr... | stackforge/cloudkitty-dashboard | cloudkittydashboard/dashboards/project/rating/views.py | Python | apache-2.0 | 2,650 |
import pytest
from dcos import jsonitem
from dcos.errors import DCOSException
@pytest.fixture(params=range(6))
def bad_object(request):
return [
'{"key":value}',
'this is a string',
'4.5',
'4',
'true',
'[1,2,3]',
][request.param]
@pytest.fixture(params=range(... | mesosphere/dcos-cli | tests/test_jsonitem.py | Python | apache-2.0 | 5,239 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-datalabeling | samples/generated_samples/datalabeling_v1beta1_generated_data_labeling_service_get_evaluation_job_sync.py | Python | apache-2.0 | 1,533 |
# Copyright 2017 CodiLime
#
# 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, softwar... | codilime/veles | python/veles/dis/reg.py | Python | apache-2.0 | 2,710 |
input = """
1 2 0 0
1 3 0 0
1 4 0 0
1 5 0 0
1 6 0 0
1 7 0 0
1 8 0 0
1 9 0 0
1 10 0 0
1 11 0 0
1 12 0 0
1 13 0 0
1 14 0 0
1 15 0 0
1 16 0 0
1 17 0 0
1 18 0 0
1 19 0 0
1 20 0 0
1 21 0 0
1 22 0 0
1 23 0 0
1 24 0 0
1 25 0 0
1 26 0 0
1 27 0 0
1 28 0 0
1 29 0 0
1 30 0 0
1 31 0 0
1 32 0 0
1 33 0 0
1 34 0 0
1 35 0 0
1 36 0 0
1... | alviano/wasp | tests/asp/cautious/graph.colouring.3.40.5_4.asp.cautious.asp.test.py | Python | apache-2.0 | 23,424 |
import logging
from functools import partial
from multiprocessing.dummy import Pool as ThreadPool
from taskcat._s3_sync import S3Sync
from taskcat.exceptions import TaskCatException
LOG = logging.getLogger(__name__)
class S3APIResponse:
def __init__(self, x):
self._http_code = x["ResponseMetadata"]["HTT... | aws-quickstart/taskcat | taskcat/_s3_stage.py | Python | apache-2.0 | 1,070 |
from copy import deepcopy
from indy_node.test import waits
from stp_core.loop.eventually import eventually
from plenum.common.constants import VERSION
from indy_common.constants import FORCE
from indy_node.test.upgrade.helper import bumpedVersion, checkUpgradeScheduled, \
check_no_loop, sdk_ensure_upgrade_sent
fr... | spivachuk/sovrin-node | indy_node/test/upgrade/test_pool_upgrade_no_loop_force.py | Python | apache-2.0 | 1,295 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import shutil
import tempfile
import unittest
import six
from pathspec import ... | twitter/pants | tests/python/pants_test/base/test_filesystem_build_file.py | Python | apache-2.0 | 12,278 |
# Copyright 2014: Mirantis 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 b... | amit0701/rally | rally/plugins/openstack/context/keystone/users.py | Python | apache-2.0 | 11,325 |
from .codes import (
PASS,
FAILED
)
from .utils import (
validate_list
)
class Response:
def __init__(self, items):
if isinstance(items, dict):
self.__dict__.update(items)
def __getitem__(self, item):
return self.__dict__[item]
def __setitem__(self, key, value):
... | MissionCriticalCloud/cosmic | cosmic-core/test/integration/tests/cosmic/common.py | Python | apache-2.0 | 13,182 |
import os.path
from setuptools import setup
about = {}
version_path = os.path.join(os.path.dirname(__file__), 'staticconf', 'version.py')
with open(version_path) as f:
exec(f.read(), about)
setup(
name="PyStaticConfiguration",
version=about['version'],
provides=["staticconf"],
author="Daniel Nephi... | dnephin/PyStaticConfiguration | setup.py | Python | apache-2.0 | 1,197 |
# Copyright 2021 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, ... | google-research/falken | service/api/unique_id.py | Python | apache-2.0 | 813 |
#
# Copyright 2016 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 | upload/daemon/tests/uploader_test.py | Python | apache-2.0 | 23,064 |
from collections import Counter
import pandas as pd
# Le o CSV e cria o data frame
data_frame = pd.read_csv('buscas.csv')
# Le as colunas de dados
X_df = data_frame[['home', 'busca', 'logado']]
# Le a coluna de resultado
Y_df = data_frame['comprou']
# Extrai os dummies para substituir os dados categoricos
Xdummies_d... | wesleyegberto/courses-projects | ia/machine-learning-introducao-classificacao/classifica_buscas.py | Python | apache-2.0 | 1,718 |
#!/usr/bin/env python
# Copyright 2013-present Barefoot Networks, 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... | p4lang/p4c-bm | setup.py | Python | apache-2.0 | 4,221 |
#!/usr/bin/env python2.7
# John Vivian
# Fall-2015
"""
Toil pipeline for exome variant analysis
Tree Structure of variant pipeline (per sample)
/-------> 14 --\
0------------> 5 ------------> 15 ------> 17 ---> 18
/ / \ \ / \ \-------> 16 --/
1 2 3 4 6 7
... | fnothaft/toil-scripts | src/toil_scripts/exome_variant_pipeline/exome_variant_pipeline.py | Python | apache-2.0 | 34,065 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-23 03:15
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | toss-app/toss-backend | toss/activities/migrations/0001_initial.py | Python | apache-2.0 | 1,169 |
# 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 agreed to in... | cloudevents/sdk-python | samples/http-json-cloudevents/client.py | Python | apache-2.0 | 2,002 |
from tests import testsSetup
testsSetup
from paperThinRest.test.baseRestTestCase import BaseRestTestCase
class Test(BaseRestTestCase):
def testCrud(self):
data = self.expect(status=201).post('/projects/',data={'title':'something'}).json
self.assertNotEqual(data.get('created'), None)
d... | viktorasm/paper-thin-rest | exampleProject/tests/testProjects.py | Python | apache-2.0 | 768 |
#!/usr/bin/python
# Copyright 2015 Google.
#
# 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... | google/compare-codecs | lib/encoder_configuration_unittest.py | Python | apache-2.0 | 2,207 |
#!/usr/bin/env python
#
# Copyright (C) 2012 LeZiZi Studio
#
# 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 r... | lezizi/A-Framework | python/local-source/AFConnector.py | Python | apache-2.0 | 1,497 |
"""
Synthetic data loaders for testing.
"""
from bcolz import ctable
from numpy import (
arange,
array,
float64,
full,
iinfo,
uint32,
)
from pandas import DataFrame, Timestamp
from six import iteritems
from sqlite3 import connect as sqlite3_connect
from .base import PipelineLoader
from .frame ... | otmaneJai/Zipline | zipline/pipeline/loaders/synthetic.py | Python | apache-2.0 | 8,291 |
#!/usr/bin/env python
import argparse
from cStringIO import StringIO
import logging
from math import ceil
from multiprocessing import Pool
import time
import urlparse
import boto
parser = argparse.ArgumentParser(description="Transfer large files to S3",
prog="s3-mp-upload")
parser.add_argument("src", type=fil... | jbrehm/s3-multipart | s3-mp-upload.py | Python | apache-2.0 | 6,867 |
from unittest import mock
from django.conf import settings
from django.test import TestCase, override_settings
from daiquiri.jobs.tests.mixins import SyncTestMixin
from daiquiri.query.models import QueryJob, Example
@override_settings(QUERY_ANONYMOUS=True)
@mock.patch(settings.ADAPTER_DATABASE + '.submit_query', mo... | aipescience/django-daiquiri | daiquiri/tap/tests/test_sync.py | Python | apache-2.0 | 1,765 |
from collections import namedtuple
import pytest
import requests
from awx.api.versioning import reverse
@pytest.mark.django_db
class TestHostInsights:
def test_insights_bad_host(self, get, hosts, user, mocker):
mocker.patch.object(requests.Session, 'get')
host = hosts(host_count=1)[0]
... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/tests/functional/api/test_host_insights.py | Python | apache-2.0 | 5,733 |
#!/usr/bin/python3 -W all
# prepare-data.py: prepare data of file 2012-nl.csv for experiments
# usage: prepare-data.py < 2012-nl.csv
# notes:
# 1. collapses labels 5 and 6 to 5
# 2. moves labels 7-13 to 6-12
# 3. removes duplicate tweets
# 20170929 erikt(at)xs4all.nl
import csv
import sys
ID = 0
LABEL = 9
def conve... | online-behaviour/machine-learning | prepare-data.py | Python | apache-2.0 | 756 |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import base
from models import Post, Comment
from google.appengine.api import users, images, memcache
from google.appengine.ext import ndb, blobstore
from google.appengine.ext.webapp import blobstore_handlers
class FeedHandler(base.BaseHandler):
def get(self):
... | presveva/tornei_all_italiana | bacheca.py | Python | apache-2.0 | 4,558 |
import inspect
from typing import Any, Callable, Dict, Optional, Type, Union
import starlette.requests
from fastapi import Depends, FastAPI
from ray._private.utils import import_attr
from ray.ml.checkpoint import Checkpoint
from ray.ml.predictor import Predictor, DataBatchType
from ray.serve.http_util import ASGIHTTP... | ray-project/ray | python/ray/serve/model_wrappers.py | Python | apache-2.0 | 4,194 |
from unittest import mock
import cumtest
class TestCLIEdit(cumtest.CumCLITest):
FOLLOW = {'url': ('https://manga.madokami.al/Manga/M/MO/MOLE/'
'Molester%20Man'),
'alias': 'molester-man', 'name': 'Molester Man'}
def setUp(self):
super().setUp()
series = self... | Hamuko/cum | tests/test_cli_edit.py | Python | apache-2.0 | 2,130 |
import json
from ct.models import *
from django.contrib.auth.models import User
from django.utils import dateparse, timezone
from datetime import datetime
import codecs
def store_errors(q, concept, parentUL, conceptIDdict=None):
'store error models associated with question'
errorModels = []
courseletsMap ... | derdmitry/socraticqs2 | mysite/ct/load_json.py | Python | apache-2.0 | 9,131 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from future.builtins.disabled import *
import re
from ._common import *
class Customize(SubCommand):
def __init__(self, *args, **kwargs):
super(Customize, self).__i... | dahuebi/vsmomi | vsmomi/commands/customize.py | Python | apache-2.0 | 3,426 |
#! /usr/bin/env python
# Copyright 2016 WebAssembly Community Group participants
#
# 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
... | ddcc/binaryen | scripts/spidermonkify.py | Python | apache-2.0 | 2,172 |
#for small Solr Cores, use Luke
#for large Solr Cores, use rows=0to50000
from __future__ import print_function
from pprint import pprint
import json, requests, sys, os, argparse
def lukeHandler(solrURL, outF):
lukeURL = "http://" + os.environ["SOLR_SIM_USER"]+":"+os.environ["SOLR_SIM_PASS"]+ "@" + solrURL.s... | harsham05/new590DR | src/fetch_all_solr_doc_ids.py | Python | apache-2.0 | 1,941 |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | moto-timo/robotframework | src/robot/libraries/Process.py | Python | apache-2.0 | 39,800 |
# 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... | aselle/tensorflow | tensorflow/contrib/eager/python/examples/revnet/blocks_test.py | Python | apache-2.0 | 9,119 |
__author__ = 'Viktor Winkelmann'
__all__ = ['DataRecognizer', 'PluginManager', 'ProtocolDissector'] | vikwin/pcapfex | core/Plugins/__init__.py | Python | apache-2.0 | 99 |
"""
Copyright 2017-present Airbnb, 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, sof... | airbnb/streamalert | streamalert_cli/lookup_tables/handler.py | Python | apache-2.0 | 12,263 |
import os
import synapse.tests.utils as s_test
import synapse.common as s_common
import synapse.lib.output as s_output
import synapse.lib.msgpack as s_msgpack
import synapse.tools.storm as s_t_storm
class StormCliTest(s_test.SynTest):
async def test_tools_storm(self):
async with self.getTestCore() as co... | vertexproject/synapse | synapse/tests/test_tools_storm.py | Python | apache-2.0 | 7,931 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | mbohlool/client-python | kubernetes/client/models/v1_pod_list.py | Python | apache-2.0 | 6,459 |
#
# 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 required by applicable la... | ceejatec/git-repo | git_config.py | Python | apache-2.0 | 19,314 |
"""
Django settings for TheWeather project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import... | edugr87/proyecto-iv | TheWeather/settings.py | Python | artistic-2.0 | 3,944 |
'''
Defines a dialog box for the user to edit a flight.
'''
import wx
from wx.lib import masked
import pytz
import flight
from flight import format_date, format_time
from flight import string_to_datetime, datetime_to_wx
from airport import NoSuchAirportError
import airport
# TODO: move out into utility module
def se... | futurulus/falcon | edit.py | Python | bsd-2-clause | 14,558 |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import xml.etree.ElementTree as ET
from indra.assemblers.pysb import PysbAssembler
import indra.assemblers.pysb.assembler as pa
from indra.assemblers.pysb.assembler import Policy, Param
from indra.assemblers.pysb.pre... | pvtodorov/indra | indra/tests/test_pysb_assembler.py | Python | bsd-2-clause | 42,841 |
"""
To flash the msp430 board, the following program can be used:
http://www.ti.com/tool/msp430-flasher
"""
from .arch import Msp430Arch
__all__ = ["Msp430Arch"]
| windelbouwman/ppci-mirror | ppci/arch/msp430/__init__.py | Python | bsd-2-clause | 166 |
#!/usr/bin/env python
__author__ = 'Casey Bryant'
from nose.plugins.attrib import attr
from pyon.datastore.datastore import DatastoreManager, DatastoreFactory
from pyon.core.bootstrap import CFG
from pyon.util.int_test import IonIntegrationTestCase
@attr('INT', group='datastore')
class TestCoverage(IonIntegrationT... | ooici/pyon | pyon/ion/test/test_coverage.py | Python | bsd-2-clause | 2,789 |
"""
It contains all the projects that can be ignored in graph. For example, there
are many Mozilla libs with large download stat which are not really used by
community. See issue #22
"""
FLAGS = {
"rackspace-novaclient":
"https://github.com/rackerlabs/rackspace-novaclient",
"manifestparser": "https://pypi.... | chhantyal/py3readiness | src/flags.py | Python | bsd-2-clause | 1,145 |
"""
Renderers
"""
from collections import OrderedDict
from rest_framework import renderers
from . import utils
class JSONRenderer(renderers.JSONRenderer):
"""
Render a JSON response per the JSON API spec:
{
"data": [{
"type": "companies",
"id": 1,
"attributes"... | hnakamur/django-rest-framework-json-api | rest_framework_json_api/renderers.py | Python | bsd-2-clause | 5,181 |
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Written (W) 2013 Heiko Strathmann
Written (W) 2013 Dino Sejdinovic
"""
fro... | karlnapf/kameleon-mcmc | kameleon_mcmc/experiments/scripts/flower/flower.py | Python | bsd-2-clause | 3,224 |
#!/usr/bin/env python3
# -*- coding:utf-8; mode:python3; indent-tabs-mode:nil; tab-width:4; -*-
""" Cached JSONized ATS files retrieved as JSON objects.
JSON data may also be returned to stdout, for use from the command line.
"""
import json
import os
import subprocess
import sys
from . import environment
# Cache... | Hibou57/PostiATS-Utilities | postiats/jsonized.py | Python | bsd-2-clause | 13,384 |
import logging
import copy
from troposphere import Ref, Output, GetAtt, Tags, FindInMap, If, Equals
from troposphere import ec2, autoscaling, ecs
from troposphere.autoscaling import Tag as ASTag
from troposphere.iam import Role, InstanceProfile, Policy
from awacs.helpers.trust import get_default_assumerole_policy
fr... | remind101/stacker_blueprints | stacker_blueprints/empire/minion.py | Python | bsd-2-clause | 10,176 |
from services import Service
from exceptions import NoSuchService
from ports import parse_ports_dict
class Project(object):
def __init__(self, name, host):
self.name = name
host.project = self
self.host = host
self.services = []
self.groups = []
def __repr__(self):
... | cameronmaske/skipper | skipper/project.py | Python | bsd-2-clause | 1,538 |
"""
Integration tests for disco_dynamodb.py
"""
import json
from random import randint
from tests.helpers.integration_helpers import IntegrationTest
MOCK_TABLE_NAME = "IntegrationTest"
CREATE_CMD = "disco_dynamodb.py create --env {0} --config test/test_dynamodb_create.json --wait"
DELETE_CMD = "disco_dynamodb.py del... | amplifylitco/asiaq | tests/integration/test_disco_dynamodb.py | Python | bsd-2-clause | 3,256 |
# -*- coding: utf-8 -*-
from django.test import TestCase
from django_choices_flow import Choices
mexican_food_list = ((1, 'nacho'), (2, 'qualcamole'), (3, 'taco'))
brazil_food_list = ((4, 'burger'), (5, 'pizza'), (6, 'feijoada'))
class MyChoices(Choices):
FOODS = (('mexican', mexican_food_list),
(... | valdergallo/django-choices-flow | tests/test_subchoices.py | Python | bsd-2-clause | 768 |
import zmq
from argparse import ArgumentParser
from pymavlink import mavutil
def main():
parser = ArgumentParser()
parser.add_argument("--device", help="MAVLink device to add to zmq", required=True)
parser.add_argument("--zmq", help="zmq url", required=True)
parser.add_argument("--prefix", help="Prefi... | btashton/mavlink-zmq | bridge/mavlink-zmq-bridge.py | Python | bsd-2-clause | 1,405 |
import subprocess
import time
import json
import functools
import argparse
from colorama import init, Fore, Back, Style
def identity(*args):
if len(args) == 1:
return args[0]
return args
def unique(xs, sort=False, key=identity):
if sort:
items = sorted(xs, key=key)
else:
items... | mrschyte/taskwarrior-hooks | mergetool/taskmerge.py | Python | bsd-2-clause | 4,514 |
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2018 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Class for reading and writing uvfits files."""
import os
import copy
import warnings
import numpy as np
from astropy import constants as const
from astropy.time import Time
from astro... | HERA-Team/pyuvdata | pyuvdata/uvdata/uvfits.py | Python | bsd-2-clause | 69,235 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Miscellany of wrapper scripts for command-line bioinformatics tools, public data downloaders and other generic routines.
"""
from jcvi.apps.base import dmain
if __name__ == "__main__":
dmain(__file__)
| tanghaibao/jcvi | jcvi/apps/__main__.py | Python | bsd-2-clause | 258 |
# Adding other items
import strategy
import strategy.sample
import strategy.immediate
import strategy.hammer
import strategy.engulfing
import collections
dispatch = collections.OrderedDict([
('hammer', strategy.hammer.HammerStrategy),
('engulfing', strategy.engulfing.EngulfingStrategy),
('sample', strategy... | joequant/sptrader | strategy/strategylist.py | Python | bsd-2-clause | 410 |
"""
@package mi.instrument.seabird.sbe26plus_v2.driver
@file mi/instrument/seabird/sbe16plus_v2/driver.py
@author David Everett
@brief Driver base class for sbe16plus V2 CTD instrument.
"""
__author__ = 'David Everett'
__license__ = 'Apache 2.0'
import time
import re
from mi.core.log import get_logger, get_loggin... | rmanoni/mi-instrument | mi/instrument/seabird/sbe16plus_v2/driver.py | Python | bsd-2-clause | 87,807 |
# Django settings for example project.
import os
BASE_DIR = os.path.dirname(__file__)
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'example.db', # Or path to ... | mlavin/django-selectable | example/example/settings.py | Python | bsd-2-clause | 4,833 |
import csv
import sys
import typing
import collections
from pathlib import Path
import chardet
import warnings
import pycldf.dataset
from pathlib import Path
from csvw.dsv import UnicodeDictReader
from beastling.util import log
def sniff(filename, default_dialect: typing.Optional[csv.Dialect] = csv.excel):
"""... | lmaurits/BEASTling | beastling/fileio/datareaders.py | Python | bsd-2-clause | 14,572 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fsforms', '0067_submissionofflinesite_temporary_site'),
]
operations = [
migrations.AddField(
model_name='submis... | awemulya/fieldsight-kobocat | onadata/apps/fsforms/migrations/0068_submissionofflinesite_fieldsight_form.py | Python | bsd-2-clause | 513 |
#!/usr/bin/env python
"""demonstrate the use of getopt and optparse to parse the command line"""
import getopt, sys, os, shutil
usage = """
Usage: %s [-h | --help] [-d dir | --directory dir] [-i | --confirm] file1 file2 ...
moves file1 file2 ... to the destination directory dir
""" % sys.argv[0]
def getopt_par... | sniemi/SamPy | sandbox/src1/TCSE3-3rd-examples/src/py/examples/cmlparsing.py | Python | bsd-2-clause | 2,155 |
from django.conf import settings
from django.test.signals import setting_changed
from rest_framework.settings import APISettings
DEFAULTS = {
'USE_SESSION_AUTH': True,
'SECURITY_DEFINITIONS': {
'basic': {
'type': 'basic'
}
},
'LOGIN_URL': getattr(settings, 'LOGIN_URL', None... | pombredanne/django-rest-swagger | rest_framework_swagger/settings.py | Python | bsd-2-clause | 1,484 |
from __future__ import print_function
import sys
import time
import Pyro4
import Pyro4.util
from random import randint
sys.excepthook = Pyro4.util.excepthook
def test_servo(servo):
for i in range(10):
# Set the servo arm to 0 degrees
servo.setAngle(0)
print('Set angle to 0')
time... | ktkirk/HSSI | grovekit/client.py | Python | bsd-2-clause | 2,914 |
from dateutils import DateUtils
import datetime
import unittest
CURRENT_YEAR = datetime.datetime.now().year
class TestDateUtils(unittest.TestCase):
def test_last_day_of_month(self):
self.assertEqual(DateUtils.last_day_of_month(2019, 3), 31)
self.assertEqual(DateUtils.last_day_of_month(2018, 7), 3... | mrobinson/phpreport-report | tests.py | Python | bsd-2-clause | 7,609 |
# Copyright 2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
from d3build.package import ExternalPackage
def pkg_config(build):
flags = build.pkg_config('alsa')
return None, build.target.module().add_flags... | depp/sglib | script/sglib/external/alsa.py | Python | bsd-2-clause | 548 |
import os
from django.contrib.auth.models import User
from django.conf import settings
from django.db import models
from django.db.models.signals import (
post_save)
from django.dispatch import receiver
from elasticgit import EG
from elasticinit import TestStory
from backend.utils import push_to_git
import uuid
fro... | MinaProject/backend | backend/models.py | Python | bsd-2-clause | 3,326 |
#!/usr/bin/env python2
#!/usr/bin/env python
#!/usr/bin/python
###############################################################################
### COPYRIGHT NOTICE FOLLOWS. DO NOT REMOVE
###############################################################################
### Copyright (c) 2016 - 2020 SQLEXEC LLC
###
### Pe... | MichaelDBA/pg_maint | pg_maint.py | Python | bsd-2-clause | 11,478 |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 4 11:59:01 2014
@author: sb238920
"""
import numpy as np
def compute_mvt_confounds(movconf_file):
"""Computes mouvement confounds
Parameters
==========
movconf_file: path
path for the movement parameters
Returns
=======
confounds_d... | rphlypo/parietalretreat | confound.py | Python | bsd-2-clause | 1,383 |
# coding=utf8
# Based on yibo's R script and JianXiao's Python script
from scipy import sparse
from sklearn.feature_selection import SelectPercentile, f_classif, chi2
import pandas as pd
import numpy as np
from scipy import sparse as ssp
import pylab as plt
from sklearn.preprocessing import LabelEncoder,LabelBinarizer,... | natesholland/talking-data-kaggle | classify-neural-nets-with-hours.py | Python | bsd-2-clause | 8,754 |
### This plan is named 9999-* to have it after 999-load.py where xpdacq is configured ####
### Created by Sanjit Ghose 28th Aug, 2017 during new BS/xpdAcq/an upgrades ########
from xpdacq.beamtime import _configure_area_det
import os
import numpy as np
import itertools
from bluesky.plans import (scan, count, list_sca... | NSLS-II-XPD/ipython_ophyd | profile_collection/startup/9999-acq-plans.py | Python | bsd-2-clause | 3,169 |
"""
AMI bake code."""
from __future__ import print_function
from ConfigParser import NoOptionError
from collections import OrderedDict, defaultdict
from subprocess import check_output
import datetime
import logging
import getpass
import re
import time
from os import path
import boto
import boto.ec2
import boto.excepti... | Angakkuit/asiaq-aws | disco_aws_automation/disco_bake.py | Python | bsd-2-clause | 28,053 |
#!/usr/bin/python
"""
Bottom up rewrite generator
---------------------------
This script takes as input a description of patterns and outputs a
matcher class that can match trees given the patterns.
Patterns are specified as follows::
reg -> ADDI32(reg, reg) 2 (. add NT0 NT1 .)
reg -> MULI32(reg, reg) 3 ... | windelbouwman/ppci-mirror | ppci/codegen/burg.py | Python | bsd-2-clause | 14,548 |
import sys
import subprocess
from path import path
def set_up_virtualenv_and_requirements(airship, bucket, **extra):
from airship.deployer import DeployError
requirements_file = bucket.folder / 'requirements.txt'
if requirements_file.isfile():
config = airship.config.get('python', {})
inde... | mgax/airship | airship/contrib/python/__init__.py | Python | bsd-2-clause | 2,464 |
# -*- coding: utf-8 -*-
import yt.mods as yt
import numpy as np
mu0 = 1.25663706e-6
gamma = 1.6666
@yt.derived_field(take_log=False, units=r'kg m^{-3}')
def density(field, data):
return data['density_pert'] + data['density_bg']
@yt.derived_field(take_log=False, units=r'T')
def mag_field_x(field, data):
retur... | Cadair/scipy2014plotting | yt_fields.py | Python | bsd-2-clause | 5,015 |
from webapp.models.user import User
class TestMainController:
def test_home(self, client):
rv = client.get('/')
assert rv.status_code == 200
def test_login(self, client, session):
admin = User('admin', 'supersafepassword')
session.add(admin)
session.commit()
... | CarlEkerot/flask-orm | tests/controllers/test_main_controller.py | Python | bsd-2-clause | 1,153 |
def safe_float(obj):
'safe version of float()'
try:
retval = float(obj)
except (TypeError,ValueError),diag:
retval = str(diag)
return retval
def main():
'handles all the data processing'
log=open('cardlog.txt','w')
try:
ccfile=open('carddata.txt','r')
... | github641/python-journey | safe_float_10.3.7.py | Python | bsd-2-clause | 880 |
"""SCons.Tool.PharLapCommon
This module contains common code used by all Tools for the
Phar Lap ETS tool chain. Right now, this is linkloc and
386asm.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
#... | frew/simpleproto | scons-local-1.1.0/SCons/Tool/PharLapCommon.py | Python | bsd-2-clause | 5,131 |
# 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 field 'DMUserProfile.klass'
db.add_column('accounts_dmuserprofile', 'klass', self.gf('... | team-xue/xue | xue/accounts/migrations/0013_add_class_field.py | Python | bsd-3-clause | 7,179 |
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on
Network monitoring, controls & Application development, testing, debugging.
:copyright: (c) 2013-present by Abhinav Singh and contributors.
:license: BSD, see LICENSE... | abhinavsingh/proxy.py | tests/http/parser/test_proxy_protocol.py | Python | bsd-3-clause | 3,504 |
#!/usr/bin/env python
#
# -----------------------------------------------------------------------------
# Copyright (c) 2015 Daniel Standage <daniel.standage@gmail.com>
# Copyright (c) 2015 Indiana University
#
# This file is part of genhub (http://github.com/standage/genhub) and is
# licensed under the BSD 3-claus... | standage/genhub | scripts/genhub-namedup.py | Python | bsd-3-clause | 868 |
#!/usr/bin/env python
import unittest
import playercontext
class PlayerContextTestCase(unittest.TestCase):
def test_FromString(self):
src = open('testdata/context1.txt').read()
pc = playercontext.PlayerContext.FromString(src)
self.assertEqual(pc.balance, 95.03029999999998)
self.assertEqual(pc.player... | compbrain/Athena-SCG-Bot | src/playercontext_test.py | Python | bsd-3-clause | 593 |
try:
from unittest.mock import patch, Mock, PropertyMock, MagicMock # noqa: E501
except ImportError:
from mock import patch, Mock, PropertyMock, MagicMock # noqa: F401
| PaesslerAG/django-performance-testing | tests/testapp/sixmock.py | Python | bsd-3-clause | 178 |