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 |
|---|---|---|---|---|---|
"""Create a KAF file for each act in a FoLiA file
Usage: python folia2kaf.py <file in> <output dir>
Or: ./generate_kaf.sh <dir in> <dir out>
"""
from lxml import etree
from bs4 import BeautifulSoup
from embem.emotools.bs4_helpers import act, sentence, word, speaker_turn, note
import argparse
import os
_folia_pos2kaf_... | NLeSC/embodied-emotions-scripts | embem/kaf-tag/folia2kaf.py | Python | apache-2.0 | 4,195 |
from prime import isPrime
summ = 0 # count = 0
i = 1
while i <= 100:
if isPrime(i):
summ = summ + i # count = count + 1
i = i + 1
print 'Sum of primes from 1 to 100 :', summ # count | brijeshrakholia/iCode | day3/count.py | Python | apache-2.0 | 195 |
from math import sqrt
def convert_product_id_to_name(id):
"""
Given product id number, return product name
"""
product_id_to_name = {}
if id in product_id_to_name:
return product_id_to_name[id]
else:
return id
def cosine_similarity(rating1, rating2):
dot_product = 0
l... | dolel13/GeekNightRecommendationEngine | algorithms/recommend.py | Python | apache-2.0 | 2,701 |
# 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... | dmlc/tvm | tests/python/unittest/test_tir_schedule_tensorize.py | Python | apache-2.0 | 16,079 |
# Copyright (c) 2013 The Johns Hopkins University/Applied Physics Laboratory
# 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/... | eayunstack/python-cinderclient | cinderclient/tests/unit/v2/test_volume_encryption_types.py | Python | apache-2.0 | 4,019 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | DirectXMan12/nova-hacking | nova/api/ec2/cloud.py | Python | apache-2.0 | 80,859 |
from ...utils.helpers import CacheDict
from ...exceptions import SmtlibError
from .expression import *
from functools import lru_cache
import copy
import logging
import operator
logger = logging.getLogger(__name__)
UNSIGN_MASK = (1 << 256) - 1
class Visitor:
""" Class/Type Visitor
Inherit your class visi... | montyly/manticore | manticore/core/smtlib/visitors.py | Python | apache-2.0 | 34,588 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | zhangg/trove | trove/guestagent/datastore/service.py | Python | apache-2.0 | 15,157 |
"""Example of specifying an autoregressive action distribution.
In an action space with multiple components (e.g., Tuple(a1, a2)), you might
want a2 to be sampled based on the sampled value of a1, i.e.,
a2_sampled ~ P(a2 | a1_sampled, obs). Normally, a1 and a2 would be sampled
independently.
To do this, you need both... | robertnishihara/ray | rllib/examples/autoregressive_action_dist.py | Python | apache-2.0 | 2,502 |
#!/usr/bin/python
# Copyright (c) 2015 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | trustedanalytics/platform-ansible | library/kadduser.py | Python | apache-2.0 | 2,667 |
#!/usr/bin/env python
import os
import unittest
import logging.config
from testcore import tests_from_modules
from test_django import run_django_tests
# anybody who references django needs this before loading
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_tester.settings'
# add any non-django modules to be tested h... | emory-libraries/eulcore-history | test/test_all.py | Python | apache-2.0 | 812 |
"""
@Author Jaret Deprin
@Usage
import jarets_mysql_wrapper
# All parameters are required even if user/pass are empty
c = jarets_mysql_wrapper.Mysql(DBHOST="localhost", DBNAME="test", DBUSER="", DBPASS="")
# Stage query
c.__stage = True
Will print queries / values but not execute them.
# Select statment... | jdeprin/python_tools | General/jarets_mysql_wrapper.py | Python | apache-2.0 | 4,654 |
from __future__ import absolute_import
import logging
import numbers
from threading import Lock
import kafka.common
from kafka.common import (
OffsetRequest, OffsetCommitRequest, OffsetFetchRequest,
UnknownTopicOrPartitionError
)
from kafka.util import ReentrantTimer
log = logging.getLogger("kafka")
AUTO_C... | CrowdStrike/kafka-python | kafka/consumer/base.py | Python | apache-2.0 | 5,435 |
#!/usr/bin/env python
"""
Copyright 2010-2018 University Of Southern California
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 appli... | SCECcode/BBP | bbp/comps/wcc_siteamp_cfg.py | Python | apache-2.0 | 2,652 |
#!/usr/bin/env python
#_*_encoding:utf-8_*_
# encoding:utf-8
import os,sys
import httplib2,hashlib
import commands
http = httplib2.Http()
def l_main(cmd):
if cmd == 'l_version' :return l_version()
if cmd == 'l_update' :return l_update()
if cmd == 'l_pwd' :return l_pwd()
#if cmd == 'l_restart' :return l_restart()... | selboo/starl-mangle | Agent/Server/l_command.py | Python | apache-2.0 | 1,864 |
import requests
import json
import re
'''
This script will not work until $TOKEN_FILE_PATH
is replaced with an actual path.
'''
token_file = "$TOKEN_FILE_PATH"
file_id = "2f97081c-7e84-4a93-91a8-fee860769f8e"
data_endpt = "https://api.gdc.cancer.gov/data/{}".format(file_id)
with open(token_file, "r") as token:
... | NCIP/gdc-docs | docs/API/Users_Guide/scripts/Download_Files_Token.py | Python | apache-2.0 | 794 |
def checkPassword(attempts, password):
def check():
while True:
attemp = yield
if attemp == password:
yield True
checker = check()
for i, attempt in enumerate(attempts):
next(checker)
if checker.send(attempt):
return i + 1
ret... | emirot/codefights | intro/checkPassword.py | Python | apache-2.0 | 327 |
# pylint: disable=invalid-name, line-too-long, unused-variable, too-many-locals
"""Region in python"""
import numpy as np
def entry_index(batch, w, h, outputs, classes, coords, location, entry):
n = int(location/(w*h))
loc = location%(w*h)
return batch*outputs + n*w*h*(coords+classes+1) + entry*w*h + loc
... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/python/topi/testing/region_python.py | Python | apache-2.0 | 2,571 |
# coding: utf-8
#
# Copyright (c) 2013 OpenStack Foundation
# 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
#
# Unle... | savi-dev/heat | heat/openstack/common/db/sqlalchemy/migration.py | Python | apache-2.0 | 10,063 |
from django.db import models
from django.conf import settings
if not getattr(settings, 'DACH_CONFIG').get('storage', None):
__all__ = ['DachObject']
class DachManager(models.Manager):
def get_or_none(self, *args, **kwargs):
try:
return self.get(*args, **kwargs)
... | ffaraone/dach | dach/models.py | Python | apache-2.0 | 620 |
import numpy as np
import lightgbm as lgb
from ..component_converter import ComponentConverterBase
from federatedml.protobuf.generated.boosting_tree_model_meta_pb2 import BoostingTreeModelMeta
from federatedml.protobuf.generated.boosting_tree_model_param_pb2 import BoostingTreeModelParam, \
DecisionTreeModelParam, ... | FederatedAI/FATE | python/federatedml/protobuf/homo_model_convert/lightgbm/gbdt.py | Python | apache-2.0 | 11,746 |
# This is the second 'http' example, demoing the interplay of 'drivers'
from snabbdom import span, input, div
'''
!!! If not explicitly imported, the (slider) 'input' will be overridden by the (dialog box) 'input' from the Python runtime.
This should somehow be avoidable without introducing lots of aliases, e.g. ... | QQuick/Transcrypt | transcrypt/demos/cyclejs_demo/component_demos/labeled_slider/labeled_slider.py | Python | apache-2.0 | 2,859 |
#!/usr/bin/env python
# Copyright 2015, Kevin Carter.
#
# 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 ... | cloudnull/cloudlib | setup.py | Python | apache-2.0 | 2,113 |
# bibframe
from versa import I
BFZ = I('http://bibfra.me/vocab/')
BFLC = I('http://bibframe.org/vocab/')
#A way to register services to specialize bibframe.py processing
#Maps URL to callable
g_services = {}
def register_service(coro, iri=None):
iri = iri or coro.iri
g_services[iri] = coro
return
| uogbuji/pybibframe | lib/__init__.py | Python | apache-2.0 | 315 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.codegen.thrift.target_types import (
ThriftSourcesGeneratorTarget,
ThriftSourceTarget,
)
from pants.engine.target import BoolField
class ScroogeFinagleBoolField... | pantsbuild/pants | src/python/pants/backend/codegen/thrift/scrooge/additional_fields.py | Python | apache-2.0 | 683 |
"""The code in this module is mostly copy/pasted out of the distutils2 source
code, as recommended by Tarek Ziade. As such, it may be subject to some change
as distutils2 development continues, and will have to be kept up to date.
I didn't want to use it directly from distutils2 itself, since I do not want it
to be a... | ioram7/keystone-federado-pgid2013 | build/d2to1/d2to1/util.py | Python | apache-2.0 | 20,437 |
class ReleaseExistsError(Exception):
pass
class InvalidPath(Exception):
pass
class DocumentNotFound(Exception):
pass
| yshalenyk/ocds.storage | ocds/storage/errors.py | Python | apache-2.0 | 133 |
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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... | mathslinux/ceilometer | ceilometer/tests/unit/event/test_endpoint.py | Python | apache-2.0 | 6,738 |
from setuptools import setup
import codecs
with codecs.open('README.md', encoding='utf-8') as readme_file:
long_description = readme_file.read()
setup(
name="hep_ml",
version='0.6.0',
description="Machine Learning for High Energy Physics",
long_description=long_description,
long_description_c... | iamfullofspam/hep_ml | setup.py | Python | apache-2.0 | 1,649 |
import itertools
from streamparse import storm
class WordSpout(storm.Spout):
def initialize(self, stormconf, context):
self.words = itertools.cycle(['dog', 'cat',
'zebra', 'elephant'])
def nextTuple(self):
word = next(self.words)
storm.emit([word... | thedrow/streamparse | examples/leinproj/_resources/resources/words.py | Python | apache-2.0 | 342 |
# Copyright (c) 2013 NEC Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | zhhf/charging | charging/openstack/common/middleware/request_id.py | Python | apache-2.0 | 1,334 |
import time
from server import app
from server.db import diary as db_diary
from server.logic import user as logic_user
from server.util import safetyutils
from server.db import event_log as db_log
logger = app.logger
def sync_data(user_id, sync_token, sync_items, need_pull):
"""Upsert client data, sync_items, i... | wingjay/jianshi | server/server/logic/sync.py | Python | apache-2.0 | 7,553 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
class NoFilter(object):
def __init__(self):
pass
def __call__(self, x, update=True):
return np.asarray(x)
# http://www.johndcook.com/blog/standard_deviation/
clas... | alanamarzoev/ray | python/ray/rllib/ppo/filter.py | Python | apache-2.0 | 3,442 |
#-*- coding:utf-8 -*-
from __future__ import absolute_import, division, print_function, with_statement
import sys
import signal
import random
import time
import logging
import requests
import multiprocessing
import time
import os
from turbo import app
from turbo.conf import app_config
from turbo import register
from... | tao12345666333/app-turbo | turbo/test/session_test.py | Python | apache-2.0 | 2,845 |
"""
tests.pytests.unit.beacons.test_load
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Load beacon test cases
"""
import pytest
import salt.beacons.load as load
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {load: {"__context__": {}, "__salt__": {}}}
... | saltstack/salt | tests/pytests/unit/beacons/test_load.py | Python | apache-2.0 | 1,268 |
# Copyright 2021 Google LLC. 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 o... | GoogleCloudPlatform/declarative-resource-client-library | python/services/appengine/domain_mapping.py | Python | apache-2.0 | 9,711 |
# -*- coding: utf-8 -*-
from models.contact import Contact
import random
import pytest
def test_edit_contact(app, db, check_ui):
with pytest.allure.step('Given a non-empty contact list'):
if len(db.get_contact_list()) == 0:
app.contact.add(Contact(first_name="Contact_for_editing"))
old... | rgurevych/python_for_testers | tests/test_edit_contact.py | Python | apache-2.0 | 1,406 |
# Copyright 2019 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/tensorboard | tensorboard/plugins/hparams/hparams_minimal_demo.py | Python | apache-2.0 | 11,029 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | ContextLogic/luigi | luigi/task_register.py | Python | apache-2.0 | 8,272 |
import json
import urllib.request
from nflh.games import Game
class Video:
def __init__(self, id_, desc, url):
self.id_ = id_
self.desc = desc
self.url = url
def __str__(self):
return self.id_ + " - " + self.desc + "\n" + self.url
def get_highest_bit_rate_clip(self, cli... | twbarber/nfl-highlight-bot | nflh/videos.py | Python | apache-2.0 | 963 |
# Задача 2. Вариант 10.
# Напишите программу, которая будет выводить на экран наиболее понравившееся вам
# высказывание, автором которого является Юстиниан. Не забудьте о том, что
# автор должен быть упомянут на отдельной строке.
# Колеганов Никита Сергеевич
# 29.05.2016
print("Весьма несправедливо не принимать подарк... | Mariaanisimova/pythonintask | PINp/2014/Koleganov_N_S/task_2_10.py | Python | apache-2.0 | 734 |
# 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/cnrm-blueprints | test/lib/downloads.py | Python | apache-2.0 | 2,284 |
# Copyright 2011 Nicholas Bray
#
# 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... | ncbray/pystream | sandbox/lattice.py | Python | apache-2.0 | 2,025 |
# pylint: disable=wrong-or-nonexistent-copyright-notice
from typing import Any, Dict, FrozenSet, Iterable, Tuple, TYPE_CHECKING, Union
import numpy as np
from cirq import linalg, protocols, value
from cirq._compat import proper_repr
from cirq.ops import raw_types
if TYPE_CHECKING:
import cirq
class MixedUnitary... | quantumlib/Cirq | cirq-core/cirq/ops/mixed_unitary_channel.py | Python | apache-2.0 | 5,301 |
extensions = []
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'The StackLight Elasticsearch-Kibana Plugin for Fuel'
copyright = u'2016, Mirantis Inc.'
version = '1.1'
release = '1.1.0'
exclude_patterns = []
pygments_style = 'sphinx'
html_theme = 'default'
html_static_path... | saqibarfeen/iota-influxdb-grafana | iota-elasticsearch-kibana/doc/source/conf.py | Python | apache-2.0 | 749 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import hashlib
import json
import logging
import math
import os
import subprocess
import threading
import time
from collections import defaultdict
import numpy as np
import ray.services as services... | ujvl/ray-ng | python/ray/autoscaler/autoscaler.py | Python | apache-2.0 | 36,206 |
# ===============================================================================
# Copyright 2011 Jake Ross
#
# 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/licens... | UManPychron/pychron | pychron/hardware/adc/__init__.py | Python | apache-2.0 | 785 |
#Author: Pieter Lewyllie, pilewyll@cisco.com
from app import app as application
import config
if __name__ == "__main__":
application.run() | plewyllie/yangre-gui | wsgi.py | Python | apache-2.0 | 143 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/python-ironicclient | ironicclient/v1/deploy_template.py | Python | apache-2.0 | 4,538 |
# -*- coding: utf-8 -*-
"""
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, Versio... | cloudControl/s3-image-load | src/s3-image-download.py | Python | apache-2.0 | 3,210 |
"""Tests for letsencrypt-auto"""
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from contextlib import contextmanager
from functools import partial
from json import dumps
from os import chmod, environ
from os.path import abspath, dirname, exists, join
import re
from shutil import copy, rmtree
import soc... | thanatos/lets-encrypt-preview | letsencrypt-auto-source/tests/auto_test.py | Python | apache-2.0 | 13,742 |
"""Tests for selectors.py."""
import unittest
import unittest.mock
from asyncio import selectors
class FakeSelector(selectors._BaseSelectorImpl):
"""Trivial non-abstract subclass of BaseSelector."""
def select(self, timeout=None):
raise NotImplementedError
class _SelectorMappingTests(unittest.Tes... | bslatkin/pycon2014 | lib/asyncio-0.4.1/tests/test_selectors.py | Python | apache-2.0 | 6,463 |
# 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... | mistercrunch/panoramix | superset/connectors/connector_registry.py | Python | apache-2.0 | 6,020 |
# Copyright 2011 OpenStack Foundation # 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 req... | n0ano/gantt | gantt/tests/scheduler/test_host_filters.py | Python | apache-2.0 | 72,910 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1_nfs_volume_source.py | Python | apache-2.0 | 5,884 |
# Log Parser for RTI Connext.
#
# Copyright 2016 Real-Time Innovations, 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
#
# ... | iblancasa/rticonnextdds-logparser | src/events/events.py | Python | apache-2.0 | 14,138 |
"""
R objects as Python objects.
The module is structured around the singleton r of class R,
that represents an embedded R.
License: GPLv3.0 (although a dual license can be worked out)
"""
import os, sys
import array
import itertools
import rpy2.rinterface as rinterface
import rpy2.rlike.container as rlc
import co... | lbouma/Cyclopath | pyserver/bin/rpy2/robjects/__init__.py | Python | apache-2.0 | 8,577 |
import theano.tensor as T
def linrect(x):
return T.maximum(0,x)
def sigmoid(x):
return T.nnet.sigmoid(x)
def tanh(x):
return T.tanh(x)
def softmax(x):
return T.nnet.softmax(x)
def conv2d(*args,**kwargs):
return T.nnet.conv2d(*args,**kwargs)
def linear(x):
return x
| terkkila/cgml | cgml/activations/activations.py | Python | apache-2.0 | 297 |
# -*- coding: ascii -*-
u"""
:Copyright:
Copyright 2017
Andr\xe9 Malo or his licensors, as applicable
:License:
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/lic... | ndparker/tdi3 | tests/unit/markup/__init__.py | Python | apache-2.0 | 809 |
import argparse
import collections
import subprocess
DESCRIPTION = """Process a git repo's history and list out all the files in
order of their hotness.
Hotness is the number of lines that have been modified. This count excludes
changes due to creation/deletion of entire files. E.g. if a file is created
with 10 lines... | colinhowe/hotfilefinder | hotfilefinder/__init__.py | Python | apache-2.0 | 4,081 |
# Copyright 2015 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... | anthrotype/nototools | nototools/noto_fonts.py | Python | apache-2.0 | 15,453 |
"""
Wrapper over nilearn to visualise brain connectome
"""
import colorsys
import sys
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
from nilearn import plotting
from maybrain import constants as ct
def plot_connectome(brain,
only_nodes=False,
node_p... | RittmanResearch/maybrain | maybrain/plotting/connectome.py | Python | apache-2.0 | 5,028 |
# -*- 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-aiplatform | google/cloud/aiplatform_v1beta1/types/feature.py | Python | apache-2.0 | 5,547 |
#!/usr/bin/env python
# Copyright 2013-2015 David Mohr
#
# 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... | squisher/stella | stella/test/benchmark.py | Python | apache-2.0 | 10,596 |
# coding: utf-8
#
# Copyright 2018 The Oppia 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 requi... | AllanYangZhou/oppia | extensions/actions/AnswerSubmit/AnswerSubmit.py | Python | apache-2.0 | 1,907 |
#!/usr/bin/env python
__author__ = 'ilkin safarli'
import unittest
from FrequencyTransformer import *
from sklearn.feature_extraction.text import CountVectorizer
count_vect = CountVectorizer()
counts = count_vect.fit_transform(["hello world"])
class TestFrequencyTransformer(unittest.TestCase):
def test_fit(self):... | kinimesi/rscore | unit_tests/test_FrequencyTransformer.py | Python | apache-2.0 | 645 |
# Copyright 2015 - Alcatel-Lucent
#
# 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 wri... | openstack/vitrage | vitrage/tests/base.py | Python | apache-2.0 | 4,909 |
# Brett (Berty) Fischler and Hunter (Kenneth) Wapman
# October 2014
# kNN Implementation for Senior Design Project
from collections import Counter
import sets
import math
import sys
import os
from math import isinf
# Minimum normalized RSSI value detected; used as "not detected" value
MIN_DETECTED = 0
COEFF_JACCARD =... | TeamSirius/Utilities | kNN2.py | Python | apache-2.0 | 12,752 |
# Copyright 2014 IBM Corp.
#
# 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 t... | luzheqi1987/nova-annotation | nova/tests/unit/integrated/v3/test_floating_ip_dns.py | Python | apache-2.0 | 3,759 |
# -*- coding: utf-8 -*-
'''
Manage the information in the hosts file
'''
# Import python libs
import os
# Import salt libs
import salt.utils
import salt.utils.odict as odict
# pylint: disable=C0103
def __get_hosts_filename():
'''
Return the path to the appropriate hosts file
'''
# TODO: Investigate ... | victorywang80/Maintenance | saltstack/src/salt/modules/hosts.py | Python | apache-2.0 | 5,355 |
"""sandcage_django_example URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='... | sandcage/sandcage-api-django | src/sandcage_django_example/urls.py | Python | apache-2.0 | 868 |
from OpenSSL import crypto
from os import path, makedirs, remove
from datetime import datetime
import re
from shutil import copy
import sys
import os
key_dir = 'keys'
index_file = os.path.join(key_dir, 'index.txt')
class SSLCertificateGenerator:
key_dir = None
index_file = None
serial = No... | kevenli/scrapydd | scrapydd/ssl_gen.py | Python | apache-2.0 | 15,483 |
# selection.py
# This is an selection sort example
# <Chad Hobbs>
def selection_sort(list2):
for i in range(0, len (list2)): # Step through entire list
min = i # Minimum value equals outside range
for j in range(i + 1, len(list2)): ... | itsallvoodoo/csci-school | CSCI220/Week 12 - APR02-06/selection.py | Python | apache-2.0 | 874 |
import logging
import settings
from logging.handlers import SysLogHandler
from copy import copy
def initSyslogLogger():
"""
Configure syslog loggers
:return: syslog log handler
"""
# close any zombie handlers for root logger
for handler in copy(logging.getLogger().handlers):
logging.... | khorsmann/dsiprouter | gui/sysloginit.py | Python | apache-2.0 | 1,293 |
# -*- coding: utf-8 -*-
from model.group import Group
#@pytest.mark.parametrize("group", testdata, ids=[repr(x) for x in testdata])
def test_testAddGroup1(app, db, json_groups):
group = json_groups
old_groups = db.get_group_list()
app.group.create(group)
# assert len(old_groups) + 1 == app.group.count()... | krzychPG/QACourses_traning | test/test_add_group.py | Python | apache-2.0 | 484 |
###
# Copyright 2015-2020, Institute for Systems Biology
#
# 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... | isb-cgc/ISB-CGC-Webapp | scripts/create_api_token.py | Python | apache-2.0 | 1,734 |
from copy import copy
import importlib
import numpy as np
import re
import os
import sys
from .. import lu
from .. import utils
LUI_MODEL_MAP = {'annual': 'cropland',
'nitrogen': 'cropland',
'cropland': 'cropland',
'pasture': 'pasture',
'perennial':... | ricardog/raster-project | projections/lui/luh2.py | Python | apache-2.0 | 3,892 |
# -*- coding: utf-8 -*-
# pylint: disable-msg=W0232
# pylint-version = 0.7.0
#
# Copyright 2004-2005 André Malo or his licensors, as applicable
#
# 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... | m-tmatma/svnmailer | src/lib/svnmailer/notifier/news.py | Python | apache-2.0 | 2,291 |
# 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... | ghchinoy/tensorflow | tensorflow/python/ops/ragged/ragged_tensor.py | Python | apache-2.0 | 86,181 |
from datetime import datetime
from django.utils.timezone import utc
import mock
import pytest
from awx.main.models import (JobEvent, ProjectUpdateEvent, AdHocCommandEvent,
InventoryUpdateEvent, SystemJobEvent)
@pytest.mark.parametrize('job_identifier, cls', [
['job_id', JobEvent],
... | wwitzel3/awx | awx/main/tests/unit/models/test_events.py | Python | apache-2.0 | 2,034 |
from eight_mile.utils import get_version
import tensorflow as tf
if not tf.executing_eagerly():
from baseline.tf.lm.training.feed import *
else:
from baseline.tf.lm.training.eager import *
from baseline.tf.lm.training.distributed import *
| dpressel/baseline | baseline/tf/lm/training/__init__.py | Python | apache-2.0 | 251 |
from django import forms
from models import SignUp
class SignUpForm(forms.ModelForm):
class Meta:
model = SignUp | sonnykr/blog | SignUps/forms.py | Python | apache-2.0 | 126 |
""" Cisco_IOS_XR_ipv4_acl_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR ipv4\-acl package operational data.
This module contains definitions
for the following management objects\:
ipv4\-acl\-and\-prefix\-list\: Root class of IPv4 Oper schema tree
Copyright (c) 2013\-2015 by Cisco Sy... | abhikeshav/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ipv4_acl_oper.py | Python | apache-2.0 | 94,935 |
# Copyright 2016 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... | Intel-Corporation/tensorflow | tensorflow/python/ops/linalg/linear_operator_low_rank_update.py | Python | apache-2.0 | 19,994 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/polypod/compiler/converter.py | Python | apache-2.0 | 2,997 |
from core.models.identity import Identity
from rest_framework import serializers
from .quota_serializer import QuotaSerializer
from .allocation_serializer import AllocationSerializer
class IdentitySerializer(serializers.ModelSerializer):
created_by = serializers.ReadOnlyField(source='creator_name')
credential... | CCI-MOC/GUI-Backend | api/v1/serializers/identity_serializer.py | Python | apache-2.0 | 811 |
# coding=utf-8
# Copyright 2022 The Deeplab2 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 applicable law ... | google-research/deeplab2 | data/testdata/create_test_data.py | Python | apache-2.0 | 7,692 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 EMBL - European Bioinformatics Institute
#
# 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/LICEN... | EBI-Metagenomics/emgapi | tests/api/test_fulltextindex.py | Python | apache-2.0 | 4,961 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... | FederatedAI/FATE | python/federatedml/transfer_variable/transfer_class/hetero_boosting_transfer_variable.py | Python | apache-2.0 | 1,448 |
#__BEGIN_LICENSE__
# Copyright (c) 2015, United States Government, as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All rights reserved.
#
# The xGDS platform is licensed under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance ... | xgds/xgds_video | xgds_video/util.py | Python | apache-2.0 | 11,763 |
#
# Copyright (c) 2015 Autodesk 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 l... | autodesk-cloud/ochothon | images/portal/resources/toolset/toolset/commands/deploy.py | Python | apache-2.0 | 17,510 |
# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
# Copyright (c) 2011, 2012 Open Networking Foundation
# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
# See the file LICENSE.pyloxi which should have been included in the source distribution
# Automatically generated by LOXI from ... | floodlight/loxigen-artifacts | pyloxi3/loxi/of14/bundle_prop.py | Python | apache-2.0 | 3,649 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='sql4json',
version='0.3.0',
description='Python SQL library and command line for querying JSON documents',
author='Brian Hendriks',
url='http://github.com/bheni/sql4json',
packages=['sql4json', 'sql4json.boolean_expressio... | bheni/sql4json | setup.py | Python | apache-2.0 | 377 |
# @MUNTJAC_COPYRIGHT@
# @MUNTJAC_LICENSE@
"""For uploading files from client to server."""
from warnings import warn
from muntjac.ui.abstract_component import AbstractComponent
from muntjac.ui.component import \
IFocusable, Event as ComponentEvent
from muntjac.terminal.stream_variable import \
IStreamVaria... | rwl/muntjac | muntjac/ui/upload.py | Python | apache-2.0 | 25,882 |
#!/usr/bin/python
'''
Prolog wrapper for docker images submission to batch systems
Created on Oct 28, 2015
@author: mariojmdavid@gmail.com
'''
import time
import os
import peUtils
if __name__ == '__main__':
print '==========================================='
ti = time.time()
param = peUtils.getOptions(... | LIP-Computing/pelogw | src/prolw.py | Python | apache-2.0 | 1,690 |
# -*- coding: utf-8 -*-
"""Console script for Raster Foundry"""
import logging
import click
from .commands import process_upload
logger = logging.getLogger("rf")
@click.group()
@click.option("--verbose/--quiet")
def run(verbose):
"""Console script for raster_foundry_batch_tasks."""
if verbose:
lo... | raster-foundry/raster-foundry | app-tasks/rf/src/rf/cli.py | Python | apache-2.0 | 479 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | dtroyer/python-openstackclient | openstackclient/tests/functional/identity/v3/test_project.py | Python | apache-2.0 | 5,083 |
# Copyright 2013-2014 MongoDB, 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 writin... | yeroon/mongo-connector | tests/test_elastic.py | Python | apache-2.0 | 11,885 |
from .error_info import TypescriptErrorInfo
from .go_to_definition import TypescriptGoToDefinitionCommand
from .go_to_type import TypescriptGoToTypeCommand
from .nav_to import TypescriptNavToCommand
from .quick_info import TypescriptQuickInfo, TypescriptQuickInfoDoc
from .save import TypescriptSave
from .show_doc impor... | fongandrew/TypeScript-Sublime-JSX-Plugin | typescript/commands/__init__.py | Python | apache-2.0 | 1,897 |
# Copyright 2013-2015 ARM Limited
#
# 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... | freedomtan/workload-automation | wlauto/utils/android.py | Python | apache-2.0 | 13,224 |