code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2017 The DLT2T 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 or ... | renqianluo/DLT2T | DLT2T/tpu/tpu_trainer_lib_test.py | Python | apache-2.0 | 2,212 |
from selenium.webdriver.common.by import By
from webium import BasePage, Finds
class LinksPage(BasePage):
links = Finds(by=By.TAG_NAME, value='a')
def __init__(self):
super(LinksPage, self).__init__(url='http://wargaming.net')
if __name__ == '__main__':
page = LinksPage()
page.open()
pr... | wgnet/webium | examples/8_finds.py | Python | apache-2.0 | 368 |
# -*- coding: utf-8 -*-
"""
Module for the generation of docx format documents.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (the L... | wtpayne/hiai | a3_src/h70_internal/da/report/html_builder.py | Python | apache-2.0 | 2,607 |
import GPy
import numpy as np
from scipy.optimize import check_grad
from emukit.bayesian_optimization.acquisitions import MultipointExpectedImprovement
from emukit.model_wrappers import GPyModelWrapper
# Tolerance needs to be quite high since the q-EI is also an approximation.
TOL = 5e-3
# Tolerance for the gradient ... | EmuKit/emukit | tests/emukit/bayesian_optimization/test_multipoint_expected_improvement.py | Python | apache-2.0 | 2,394 |
import pytest
import mlflow.spark
from mlflow.exceptions import MlflowException
from tests.spark.autologging.utils import _get_or_create_spark_session
@pytest.mark.large
def test_enabling_autologging_throws_for_missing_jar():
# pylint: disable=unused-argument
spark_session = _get_or_create_spark_session(jar... | mlflow/mlflow | tests/spark/autologging/datasource/test_spark_datasource_autologging_missing_jar.py | Python | apache-2.0 | 512 |
# Copyright 2012 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... | BeenzSyed/tempest | tempest/api/compute/floating_ips/test_floating_ips_actions.py | Python | apache-2.0 | 5,488 |
# -*- 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-dialogflow-cx | google/cloud/dialogflowcx_v3beta1/services/pages/async_client.py | Python | apache-2.0 | 32,025 |
__author__ = "Manuel Escriche <mev@tid.es>"
import os, pickle, base64, requests
from datetime import datetime
from kconfig import trackersBook, trackersBookByKey
from kconfig import tComponentsBook
from kernel.Jira import JIRA
class DataEngine:
class DataObject:
def __init__(self, name, storage):
... | flopezag/fiware-backlog | kernel/DataFactory.py | Python | apache-2.0 | 5,015 |
# Copyright (c) 2012 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 ... | Juniper/nova | nova/console/websocketproxy.py | Python | apache-2.0 | 7,594 |
#!/usr/local/bin python
from __future__ import print_function
import psutil
import time
import getopt
import sys
import django_initial
from QueueDB.models import Training
vrt_mem_list = []
mem_list = []
cpu_list = []
read_list = []
write_list = []
def get_mem(pid):
running_process = psutil.Process(pid)
if ru... | liyao001/BioQueue | worker/ml_collector.py | Python | apache-2.0 | 3,685 |
"""
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
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distr... | googleinterns/nlu-seq2graph | src/trainer.py | Python | apache-2.0 | 15,345 |
#!BPY
"""
Name: 'TerasologyBlockShapeExport'
Blender: 260
Group: 'Export'
Tooltip: 'Export a Terasology Block Shape'
"""
bl_info = {
"name": "Terasology Block Shape Export",
"description": "Exporter for producing Terasology Block Shape files",
"author": "Immortius",
"version": (1, 1),
"blender": (2, ... | rapodaca/Terasology | blender_addons/io_mesh_terasology/__init__.py | Python | apache-2.0 | 3,098 |
# 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... | petewarden/tensorflow | tensorflow/python/keras/engine/compile_utils_test.py | Python | apache-2.0 | 32,114 |
import jsonrpclib
from pprint import pprint
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
ip = '184.105.247.72'
port = '443'
username = 'admin1'
password = '99saturday'
switch_url = 'https://{}:{}@{}:{}'.format(username, password, ip, port)
switch_url = switch_url + '/command-api'
rem... | stianpy/pynet_test | class7/connect_python_arista_api.py | Python | apache-2.0 | 450 |
# Copyright 2018 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... | mlperf/inference_results_v0.5 | closed/Google/code/gnmt/tpu-gnmt/home/kbuilder/mlperf-inference/google3/third_party/mlperf/inference/gnmt/nmt/tpu/distributed_iterator_utils.py | Python | apache-2.0 | 11,852 |
# -*- coding: utf-8 -*-
""" Thermodynamic analysis for Flux-Based Analysis
.. moduleauthor:: pyTFA team
"""
from .thermo.tmodel import ThermoModel
| EPFL-LCSB/pytfa | pytfa/__init__.py | Python | apache-2.0 | 151 |
# Copyright (c) 2015 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 requir... | eayunstack/neutron | neutron/pecan_wsgi/hooks/policy_enforcement.py | Python | apache-2.0 | 11,798 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 Nicira Networks, 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.apach... | noelbk/neutron-juniper | neutron/plugins/openvswitch/ovs_neutron_plugin.py | Python | apache-2.0 | 29,802 |
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | grahamhayes/designate | designate/objects/adapters/api_v2/zone.py | Python | apache-2.0 | 2,504 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Intel Corp.
#
"""
Resource Pool Remove Plugin
"""
from control.commands.command import CommandResult
from control.plugin.manager import DeclarePlugin
from .resource_pool import ResourcePoolCommand
@DeclarePlugin('resource_pool_remove', 100)
class ResourcePoolRemoveComman... | intel-ctrlsys/actsys | actsys/control/commands/resource_pool/resource_pool_remove.py | Python | apache-2.0 | 933 |
# 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... | blomquisg/heat | heat/common/utils.py | Python | apache-2.0 | 10,575 |
# -*- coding: utf-8 -*-
#
# Monary documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 9 13:39:38 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | aherlihy/Monary | doc/conf.py | Python | apache-2.0 | 8,410 |
from activities.models import Message
from categories.models import Category, Keyword
from constance import config
from employees.models import Employee, Location, Position, Role
from events.models import Event, EventActivity
from stars.models import Badge
from django.conf import settings
from django.contrib.sites.mode... | belatrix/BackendAllStars | administrator/views.py | Python | apache-2.0 | 30,608 |
# 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... | SUSE-Cloud/glance | glance/tests/integration/legacy_functional/base.py | Python | apache-2.0 | 7,145 |
# coding=utf-8
# Copyright 2020 The Nested-Transformer 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 appli... | google-research/nested-transformer | train.py | Python | apache-2.0 | 15,926 |
import urllib2
import json
import sys
import os
import wunderData
def get_coord(exifdict):
'''
Purpose: The purpose of this script is to extract the Latitude and Longitude from the EXIF data
Inputs: exifdict: structure storing the image's EXIF data.
Outputs: coords: A tuple of the... | Aerolyzer/Aerolyzer | aerolyzer/location.py | Python | apache-2.0 | 3,932 |
#!/usr/bin/env python
"""Tests for API call routers."""
from absl import app
from grr_response_core.lib.rdfvalues import structs as rdf_structs
from grr_response_core.lib.util import compatibility
from grr_response_proto import tests_pb2
from grr_response_server import access_control
from grr_response_server.gui impo... | google/grr | grr/server/grr_response_server/gui/api_call_router_test.py | Python | apache-2.0 | 4,408 |
class Strings:
ADD_SUPERVISOR = "You are now connected with "
START_MONITORING = " wants to monitor you, click to allow"
ACCEPTED_MONITORING= "You started monitoring "
STOP_MONITORING_SUPERVISE = " canceled monitoring"
STOP_MONITORING_SUPERVISOR = " is no longer monitoring you"
APPLICATION_ANOMA... | tweiss1234/Cras | strings.py | Python | apache-2.0 | 824 |
# Copyright (c) 2010-2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | xiaoguoai/ec-dev-swift | swift/common/utils.py | Python | apache-2.0 | 85,284 |
""" CISCO_ETHERLIKE_EXT_MIB
The MIB module to describe generic objects for
ethernet\-like network interfaces.
This MIB provides ethernet\-like network interfaces
information that are either excluded by EtherLike\-MIB
or specific to Cisco products.
"""
import re
import collections
from enum import Enum
from y... | 111pontes/ydk-py | cisco-ios-xe/ydk/models/cisco_ios_xe/CISCO_ETHERLIKE_EXT_MIB.py | Python | apache-2.0 | 17,254 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2015 Mirantis, 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... | eayunstack/fuel-ostf | fuel_health/tests/smoke/test_vcenter.py | Python | apache-2.0 | 20,161 |
"""Auto-generated file, do not edit by hand. FO metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_FO = PhoneMetadata(id='FO', country_code=298, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[2-9]\\d{5}', possible_number_pattern='\... | titansgroup/python-phonenumbers | python/phonenumbers/data/region_FO.py | Python | apache-2.0 | 1,769 |
#!/usr/bin/python
from twisted.internet import reactor
from twisted.web import http
from twisted.web.proxy import Proxy, ProxyRequest, ProxyClientFactory, ProxyClient
from PIL import ImageFile
from PIL.ImageFile import Parser
from StringIO import StringIO
class InterceptingProxyClient(ProxyClient):
def __init__(se... | tobiashochguertel/postman-proxy_server.py | twisted-proxy.py | Python | apache-2.0 | 2,098 |
# Copyright 2020 The SQLFlow 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 o... | sql-machine-learning/sqlflow | python/runtime/tensorflow/__init__.py | Python | apache-2.0 | 679 |
from jobman import DD, expand, flatten
import pynet.layer as layer
from pynet.model import *
from pynet.layer import *
from pynet.datasets.mnist import Mnist, Mnist_Blocks
import pynet.datasets.spec as spec
import pynet.datasets.mnist as mnist
import pynet.datasets.transfactor as tf
import pynet.datasets.mapping as ma... | hycis/Pynet | hps/models/Laura_Two_Layers.py | Python | apache-2.0 | 2,815 |
import copy
import logging
from datetime import datetime
import six
from sqlalchemy.orm import (
class_mapper, object_session, properties, attributes)
from sqlalchemy.orm.collections import InstrumentedList
from sqlalchemy.exc import InvalidRequestError, IntegrityError
from sqlalchemy.orm.exc import MultipleResult... | postatum/nefertari-sqla | nefertari_sqla/documents.py | Python | apache-2.0 | 28,898 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Hernán M. Foffani
#
# 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... | hfoffani/pddl-lib | pddlpy/__init__.py | Python | apache-2.0 | 665 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "asuna.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| rogeliorv/asuna | manage.py | Python | apache-2.0 | 250 |
# -*- coding: utf-8 -*-
# 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... | googleads/google-ads-python | google/ads/googleads/v9/errors/types/shared_set_error.py | Python | apache-2.0 | 1,240 |
#!/usr/bin/env python
# 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... | ayshrimali/Appium-UIAutomation | automation/mobile/uicomponents.py | Python | apache-2.0 | 2,002 |
# Copyright 2020 DeepMind Technologies 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed t... | deepmind/jraph | jraph/examples/lstm.py | Python | apache-2.0 | 5,350 |
from sys import maxsize
class Contact:
def __init__(self, firstname=None, lastname=None, homephone=None, nickname=None, mobilephone=None, workphone=None,
email=None, email2=None, email3=None, fax=None, id=None, address=None, all_phones_from_home_page=None,
all_emails_from_home_p... | schukinp/python_training | model/contact.py | Python | apache-2.0 | 1,233 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-07 15:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('thresher', '0001_initial'),
]
operations = [
migrations.AlterField(
... | Goodly/TextThresher | thresher/migrations/0002_auto_20170607_1544.py | Python | apache-2.0 | 473 |
# (c) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.
# 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... | Paul-Ezell/cinder-1 | cinder/volume/drivers/san/hp/hp_3par_common.py | Python | apache-2.0 | 113,633 |
from django.db import models
# Create your models here.
from djangotoolbox.fields import ListField, EmbeddedModelField
from django_mongodb_engine.storage import GridFSStorage
gridfs_storage = GridFSStorage()
class Cordinates(models.Model):
lat = models.FloatField(null=False, blank=False)
lng = models.FloatFi... | zalmanu/Enjoy-City-Admin | admin/models.py | Python | apache-2.0 | 2,126 |
# Copyright 2013 Red Hat, 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... | HybridF5/jacket | jacket/compute/image/download/file.py | Python | apache-2.0 | 7,388 |
"""ENV Str"""
# standard library
import os
import re
from pathlib import Path
from typing import Any, Dict, Union
class _EnvPath(type(Path()), Path): # pylint: disable=E0241
"""A stub of Path with additional attribute."""
# store for the original value passed to EnvPath
original_value = None
class Env... | ThreatConnect-Inc/tcex | tcex/pleb/env_path.py | Python | apache-2.0 | 1,603 |
import time
import random
def timer(calls=1):
def decorator(func):
def wrapper(*args):
t1 = time.time()
for i in range(calls):
func(*args)
t2 = time.time()
print(t2 - t1)
return wrapper
return decorator
# demos:
if __name__ == "__... | spencerpomme/coconuts-on-fire | timerdeco.py | Python | apache-2.0 | 718 |
"""Support for Rflink Cover devices."""
import logging
import voluptuous as vol
from homeassistant.components.cover import PLATFORM_SCHEMA, CoverDevice
from homeassistant.const import CONF_NAME, CONF_TYPE, STATE_OPEN
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.restore_state import ... | Teagan42/home-assistant | homeassistant/components/rflink/cover.py | Python | apache-2.0 | 5,550 |
"""
Authenication and Authorization tests which require DC/OS Enterprise.
Currently test against root marathon. Assume we will want to test these
against MoM EE
"""
import common
import dcos
import pytest
import shakedown
from urllib.parse import urljoin
from dcos import marathon
from shakedown import credentials, e... | Caerostris/marathon | tests/system/marathon_auth_common_tests.py | Python | apache-2.0 | 2,070 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
'''
Copyright 2014-2015 Teppo Perä
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... | justanr/py3traits | src/pytraits/core/singleton.py | Python | apache-2.0 | 2,036 |
# Copyright 2014 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 required ... | Mirantis/tempest | tempest/api/compute/admin/test_quotas_negative.py | Python | apache-2.0 | 7,143 |
import setuptools
version = '1.8.0'
setuptools.setup(
name='six',
version=version,
url='https://pypi.python.org/packages/source/s/six/six-%s.tar.gz' % version,
license='MIT License',
author='Benjamin Peterson',
author_email='benjamin@python.org'
)
| Scalr/packages | pkgs/six/setup.py | Python | apache-2.0 | 274 |
# 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/examples | lite/examples/speech_commands/ml/export/convert_keras_to_quantized.py | Python | apache-2.0 | 6,406 |
import os
import platform
import re
from optparse import OptionParser, OptionGroup
from typing import List
from . import __version__
_properties = {}
_options = {}
def get_option(option: str) -> str:
try:
return _options[option]
except KeyError:
return None
def get_property(key: str, defa... | KarlGong/ptest | ptest/config.py | Python | apache-2.0 | 12,010 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | snerg/train.py | Python | apache-2.0 | 11,308 |
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import os.path
import shutil
import time
def get_protocol_data():
filename = "protocol.csv"
raw_data = []
try:
inp = open(filename, mode='r', encoding='utf-8')
lines = inp.readlines()
for line in lines:
fields = line.rstr... | inspoy/BounceArena | tools/protocol/protocol.py | Python | apache-2.0 | 13,731 |
#
# 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
# ... | steveb/heat | heat/tests/engine/service/test_stack_create.py | Python | apache-2.0 | 18,029 |
#!/usr/bin/env python
"""
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");... | alexryndin/ambari | ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/nimbus_prod.py | Python | apache-2.0 | 2,557 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tongwang01/tensorflow | tensorflow/python/ops/array_ops.py | Python | apache-2.0 | 86,939 |
#!/usr/bin/env python
import datetime
# import os for file system functions
import os
# import json
import json
# import regex
import re
# for date parsing
import time
# import flickrapi
# `easy_install flickrapi` or `pip install flickrapi`
import flickrapi
# main program
def fetch(api_key, api_secret):
# create a... | photo/export-flickr | fetch.py | Python | apache-2.0 | 5,401 |
#
# Copyright (c) 2017 Intel Corporation
# SPDX-License-Identifier: BSD-2-Clause
#
from numba import compiler, typing
from numba.targets import cpu
from numba import types
from numba.targets.registry import cpu_target
from numba import config
from numba.annotations import type_annotations
from numba.ir_utils import co... | jriehl/numba | numba/tests/test_copy_propagate.py | Python | bsd-2-clause | 3,628 |
#!/usr/bin/python
'''
Copyright (c) 2013-2014, Magnus Skjegstad / Forsvarets Forskningsinstitutt (FFI)
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 ... | MagnusS/p2p-dprd | python/p2pdprd_types.py | Python | bsd-2-clause | 11,004 |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
import llvm
from numba import *
from numba import nodes
from numba.typesystem import is_obj, promote_to_native
from numba.codegen.codeutils import llvm_alloca, if_badval
from numba.codegen import debug
class ObjectCoercer(object... | shiquanwang/numba | numba/codegen/coerce.py | Python | bsd-2-clause | 8,887 |
#
# Copyright (c) dushin.net All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the foll... | fadushin/esp8266 | micropython/ulog/ulog/mqtt_sink.py | Python | bsd-2-clause | 2,794 |
# Version: 6.3
# Architecture: i386
# CompanyName: Microsoft Corporation
# FileDescription: NT Layer DLL
# FileVersion: 6.3.9600.17031 (winblue_gdr.140221-1952)
# InternalName: ntdll.dll
# LegalCopyright: Microsoft Corporation. All rights reserved.
# OriginalFilename: ntdll.dll
# ProductName: Microsoft Windows Operati... | atlas0fd00m/CanCat | cancat/vstruct/defs/windows/win_6_3_i386/ntdll.py | Python | bsd-2-clause | 239,574 |
import angr
import logging
l = logging.getLogger(name=__name__)
class deallocate(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, addr, length): #pylint:disable=unused-argument
# return code (see deallocate() docs)
r = self.state.solver.ite_cases((
(addr % 0x... | angr/angr | angr/procedures/cgc/deallocate.py | Python | bsd-2-clause | 1,857 |
# ------------------- start ML blackbox ----------------------------
# the details here aren't fully important
from textblob import TextBlob
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.svm import SVC
from sklearn.pipeline import Pipeline
from sklearn.grid_search import Gri... | opalytics/opalytics-ticdat | examples/expert_section/ml_spam/ml_spam.py | Python | bsd-2-clause | 3,570 |
"""
Initialization of utils.
Couple handy-dandy functions:
"""
from __future__ import absolute_import
from . import basics
from . import blender
from . import math | marklescroart/bvp | bvp/utils/__init__.py | Python | bsd-2-clause | 165 |
""" Small helper to convert binary data into text and vice-versa.
"""
import binascii
from .chunk import chunks
def bin2asc(data: bytes):
""" Encode binary data as ascii. If it is a large data set, then use a
list of hex characters.
"""
if len(data) > 30:
res = []
for part in chunk... | windelbouwman/ppci-mirror | ppci/utils/binary_txt.py | Python | bsd-2-clause | 892 |
from numpy import any, array, array_str, concatenate, dot, intersect1d
from numpy import nonzero, ravel, setdiff1d, zeros
from numpy.linalg import lstsq, norm
def active_constraints(A, b, x):
"""Return a set of active constraints
"""
dx = b - dot(A, x)
if any(dx > 0):
raise ValueError('x is inf... | escorciav/amcs211 | hw5/hw5_1.py | Python | bsd-2-clause | 3,638 |
import simuvex
from simuvex.s_type import SimTypeTop, SimTypeLength
import logging
l = logging.getLogger("simuvex.procedures.libc.memcpy")
class memcpy(simuvex.SimProcedure):
#pylint:disable=arguments-differ
def run(self, dst_addr, src_addr, limit):
# TODO: look into smarter types here
self.a... | zhuyue1314/simuvex | simuvex/procedures/libc___so___6/memcpy.py | Python | bsd-2-clause | 1,566 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jkyeung/XlsxWriter | xlsxwriter/test/comparison/test_chart_axis23.py | Python | bsd-2-clause | 1,661 |
from django.contrib.auth.models import update_last_login
from django.contrib.auth.signals import user_logged_in
from ngw.core.models import Contact
# Ugly work around for NOT using update_last_login that is hardcoded in
# crontrib.auth :
user_logged_in.disconnect(update_last_login)
class NgwAuthBackend(object):
... | nirgal/ngw | core/authbackend.py | Python | bsd-2-clause | 1,058 |
emk.module_paths.append(emk.abspath("modules"))
c, revision = emk.module("c", "revision")
emk.depend("$:build:$/revision" + c.obj_ext, "revision.h")
| kmackay/emk | tutorial/5_modules/emk_rules.py | Python | bsd-2-clause | 149 |
# Scraper for California's Second District Court of Appeal
# CourtID: calctapp_2nd
# Court Short Name: Cal. Ct. App.
from juriscraper.opinions.united_states.state import cal
class Site(cal.Site):
def __init__(self):
super(Site, self).__init__()
self.url = 'http://www.courtinfo.ca.gov/cgi-bin/opini... | brianwc/juriscraper | opinions/united_states/state/calctapp_2nd.py | Python | bsd-2-clause | 472 |
import ast
from collections import defaultdict
from contextlib import ExitStack, contextmanager
from functools import singledispatch
from typing import Any, Dict, Iterable, List, Optional, Set, Tuple, Union
from breakfast.position import Position
from breakfast.source import Source
from tests import make_source
Qua... | thisfred/breakfast | tests/test_attempt_12.py | Python | bsd-2-clause | 21,250 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | jmcnamara/XlsxWriter | xlsxwriter/test/comparison/test_chart_format23.py | Python | bsd-2-clause | 1,541 |
# -*- coding: UTF-8 -*-
# Copyright 2015-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
# go gfktest
# python manage.py test
from __future__ import unicode_literals
from builtins import str
# from lino.utils.test import DocTest
from lino.utils.djangotest import WebIndexTestCase
from django.db impo... | khchine5/book | lino_book/projects/gfktest/test_gfk.py | Python | bsd-2-clause | 4,261 |
# Generated by Django 3.1.13 on 2021-10-22 11:04
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('core', '0025_auto_20211022_1104'),
]
operations = [
migrations.AlterField(
model_name='path',
name='uui... | GeotrekCE/Geotrek-admin | geotrek/core/migrations/0026_auto_20211022_1104.py | Python | bsd-2-clause | 426 |
# =============================================================================
# asr9k
#
# Copyright (c) 2016, Cisco Systems
# 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 o... | anushreejangid/csm-ut | csmpe/core_plugins/csm_node_status_check/ios_xe/plugin.py | Python | bsd-2-clause | 2,529 |
import scurve.progress as progress
import StringIO
class TestInplace:
def test_basic(self):
s = StringIO.StringIO()
c = progress.Inplace(stream=s)
assert s.getvalue() == ''
c.tick(10)
assert s.getvalue() == '\r10'
c.tick(10000)
assert s.getvalue() == '\r10... | butterworth1492/Visualizing-Cavity-Viruses | scurve/test/test_progress.py | Python | bsd-2-clause | 748 |
import os
import unittest
import sys
import inmembrane
import inmembrane.tests
from inmembrane import helpers
from inmembrane.plugins import lipop1
from inmembrane.tests.PluginTestBase import PluginTestBase
class TestLipoP(PluginTestBase):
_plugin_name = "lipop1"
def test_lipop1(self):
if not self.... | boscoh/inmembrane | inmembrane/tests/test_lipop1.py | Python | bsd-2-clause | 1,098 |
from __future__ import unicode_literals
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group, AnonymousUser
from django.contrib.contenttypes.models import ContentType
from django.template import Template, Context, TemplateSyntaxError
from django.t... | rmgorman/django-guardian | guardian/testapp/tests/test_tags.py | Python | bsd-2-clause | 6,449 |
"""
The WCS package provides functions to parse World Coordinate System (WCS)
coordinates for solar images as well as convert between various solar
coordinate systems. The solar coordinates supported are
* Helioprojective-Cartesian (HPC): The most often used solar coordinate
system. Describes positions on the Sun ... | Alex-Ian-Hamilton/sunpy | sunpy/wcs/__init__.py | Python | bsd-2-clause | 2,364 |
#!/usr/bin/python
import memcache
import json
print "Content-Type: application/json"
print
mc = memcache.Client(['127.0.0.1:11211'], debug=0)
data = mc.get_multi(["meta", "latest"])
print(json.dumps(data, separators=(",", ":")))
| Selfnet/dashboard | cgi/latest.json.py | Python | bsd-2-clause | 232 |
import time
import threading
import logging
import serial
import io
import sim900
import sys
if __name__ == "__main__":
#this is a bad file for recording the diode temps and voltages
#eventually it will be merged with recording the resistance bridges
#and actually use the sim900 file functions
#cre... | ColumbiaCMB/kid_readout | kid_readout/equipment/record_all_old.py | Python | bsd-2-clause | 2,287 |
# -*- Mode: Python; tab-width: 4 -*-
# Copyright (c) 2005-2010 Slide, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyrig... | slideinc/notifier | notifier/command.py | Python | bsd-3-clause | 4,827 |
# Copyright (c) 2014,2015,2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Work with custom color tables.
Contains a tools for reading color tables from files, and creating instances based on a
specific set of constraints (e.g. step size) for ... | jrleeman/MetPy | metpy/plots/ctables.py | Python | bsd-3-clause | 8,974 |
import os
from setuptools import setup
def read(fname):
with open(fname) as fhandle:
return fhandle.read()
def readMD(fname):
# Utility function to read the README file.
full_fname = os.path.join(os.path.dirname(__file__), fname)
if 'PANDOC_PATH' in os.environ:
import pandoc... | OpenGov/grid_walker | setup.py | Python | bsd-3-clause | 1,495 |
from urllib import quote
from django import forms
from django.contrib import admin
from django.db import models
from django.utils.html import escape, format_html
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from pycon.sponsorship.models import SponsorLevel, Spo... | PyCon/pycon | pycon/sponsorship/admin.py | Python | bsd-3-clause | 6,184 |
from django.conf import settings
from django.db.models import Q
from libs.django_utils import render_to_response
from django.views.generic import ListView
from springboard.models import IntranetApplication
from django.contrib.auth.decorators import login_required
from alerts.models import Alert
class SpringBoard(List... | instituteofdesign/django-lms | apps/springboard/views.py | Python | bsd-3-clause | 1,051 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import entropy.mixins
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('templates', '__firs... | publica-io/django-publica-pages | pages/migrations/0001_initial.py | Python | bsd-3-clause | 1,903 |
import parsenvy
def test_list_several(monkeypatch):
monkeypatch.setenv("foo", "bar,baz,barf")
assert parsenvy.list("foo") == ["bar", "baz", "barf"]
def test_list_one(monkeypatch):
monkeypatch.setenv("foo", "bar")
assert parsenvy.list("foo") == ["bar"]
def test_list_one_comma(monkeypatch):
monk... | nkantar/Parsenvy | tests/test_list.py | Python | bsd-3-clause | 648 |
import logging
from couchdbkit import ResourceNotFound
from couchdbkit.ext.django.loading import get_db
from django.http import (
HttpResponseBadRequest,
HttpResponseForbidden,
)
from casexml.apps.case.xform import get_case_updates, is_device_report
from corehq.apps.domain.decorators import (
check_domain_m... | qedsoftware/commcare-hq | corehq/apps/receiverwrapper/views.py | Python | bsd-3-clause | 7,843 |
import hyperdex.client
import smtplib
from bitcoin.core import COIN, b2lx
import bitcoin.wallet
import bitcoin.rpc
try:
from bitcoin.case58 import CBitcoinAddress
except:
from bitcoin.wallet import CBitcoinAddress
from config import SERVER_DB_ADDRESS, MAIL_USERNAME, MAIL_PASSWORD, NAME
c = hyperdex.client.C... | bloomark/f13x | assign_public_addresses.py | Python | bsd-3-clause | 2,207 |
#! /usr/bin/env python
# Tests the Python module.
from __future__ import print_function, division
from math import *
import numpy as np
from periodicitytest import periodicitytest
import random
def pertest_noise_wrapper(T, max_tau):
noisy_T = T + np.random.uniform(0.0, nu, len(T))
return periodicitytest(noisy_T, ma... | neurophysik/periodicitytest | tests/periodicitytest_test.py | Python | bsd-3-clause | 4,691 |
"""
ProofResourceStrategy is the real implementation of initializing the resource
data for ProofResource. There can be multiple strategies for one ProofResource.
Main considerations are configure file, database (may use a ProofInstance),
XML file.
This is the base class with all interfaces needed by ProofResource. Eac... | mattduan/proof | ProofResourceStrategy.py | Python | bsd-3-clause | 946 |
#!/usr/bin/env python
# Realizado por: Roberto Arias (@bettocr)
#
# Permite encender y apagar luces leds
#
import RPi.GPIO as GPIO, time, os
GPIO.setmode(GPIO.BCM)
on = 0 # luces encendidas
MAX=5200 # luminocidad maxima antes de encender el led, entre mayor mas oscuro
PIN=23 # pin al relay
PINRC=24 #pin qu... | bettocr/rpi-proyecto-final | opt/luz.py | Python | bsd-3-clause | 874 |
"""
Makes possible reporter classes,
which are triggered on particular events and may provide information to the user,
may do something else such as checkpointing, or may do both.
"""
from __future__ import division, print_function
import time
from neat.math_util import mean, stdev
from neat.six_util import itervalue... | drallensmith/neat-python | neat/reporting.py | Python | bsd-3-clause | 5,924 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.