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 |
|---|---|---|---|---|---|
# Copyright (c) 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | eayunstack/neutron | neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py | Python | apache-2.0 | 12,113 |
from hubs.ha import haremote as ha
from hubs.ha.hasshub import HAnode, RegisterDomain
from controlevents import CEvent, PostEvent, ConsoleEvent, PostIfInterested
from utils import timers
import functools
# noinspection PyTypeChecker
class Thermostat(HAnode): # deprecated version
def __init__(self, HAitem, d):
sup... | kevinkahn/softconsole | hubs/ha/domains/__oldthermostat.py | Python | apache-2.0 | 3,386 |
import json
import time
import jps
class MessageHolder(object):
def __init__(self):
self.saved_msg = []
def __call__(self, msg):
self.saved_msg.append(msg)
def test_pubsub_with_serialize_json():
holder = MessageHolder()
sub = jps.Subscriber('/serialize_hoge1', holder,
... | OTL/jps | test/test_serialize.py | Python | apache-2.0 | 697 |
# -*- 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... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_generated_aiplatform_v1beta1_metadata_service_query_context_lineage_subgraph_async.py | Python | apache-2.0 | 1,624 |
"""
Network Config
==============
Manage the configuration on a network device given a specific static config or template.
:codeauthor: Mircea Ulinic <ping@mirceaulinic.net> & Jerome Fleury <jf@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`NAPALM proxy minio... | saltstack/salt | salt/states/netconfig.py | Python | apache-2.0 | 34,222 |
# 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_rule_with_operations.py | Python | apache-2.0 | 9,436 |
#!/usr/bin/env python2.7
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import os
import re
from collections import namedtuple
import buckutils as buck
import javautils as java
# Example:
# timestamp level command tid clas... | shs96c/buck | programs/fixes/source_only_abi/autofix_source_only_abi_warnings.py | Python | apache-2.0 | 6,379 |
#!/usr/bin/env python
"""Executable for the Earth Engine command line interface.
This executable starts a Python Cmd instance to receive and process command
line input entered by the user. If the executable is invoked with some
command line arguments, the Cmd is launched in the one-off mode, where
the provided argumen... | gena/earthengine-api | python/ee/cli/eecli.py | Python | apache-2.0 | 2,385 |
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This f... | awsdocs/aws-doc-sdk-examples | lambda_functions/codecommit/MyCodeCommitFunction.py | Python | apache-2.0 | 2,083 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
GeepsSpStats
A QGIS plugin
Spatial Statistics by PySAL
-------------------
begin : 2014-07-01
git sha : $F... | Gaia3D/GeepsSpatialStatistic | mainPlugin.py | Python | apache-2.0 | 10,903 |
# Explains/tests Issues:
# https://github.com/ray-project/ray/issues/6928
# https://github.com/ray-project/ray/issues/6732
import argparse
from gym.spaces import Discrete, Box
import numpy as np
from ray.rllib.agents.ppo import PPOTrainer
from ray.rllib.examples.env.random_env import RandomEnv
from ray.rllib.examples... | robertnishihara/ray | rllib/examples/mobilenet_v2_with_lstm.py | Python | apache-2.0 | 1,849 |
# 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... | GoogleCloudPlatform/appengine-blobstoremgmt-python | src/app/__init__.py | Python | apache-2.0 | 644 |
# -*- coding: utf-8 -*-
from setuptools import setup
NAME = "apicaller"
DESCRIPTION = "APICaller makes the creating API client library easier."
AUTHOR = "Jan Češpivo"
AUTHOR_EMAIL = "jan.cespivo@gmail.com"
URL = "https://github.com/cespivo/apicaller"
VERSION = '0.1.2a'
setup(
name=NAME,
version=VERSION,
... | jancespivo/apicaller | setup.py | Python | apache-2.0 | 869 |
# 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 (t... | apache/incubator-allura | ForgeSVN/forgesvn/tests/model/test_svnimplementation.py | Python | apache-2.0 | 5,921 |
# 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
# distributed under t... | openstack/python-openstacksdk | openstack/baremetal/v1/node.py | Python | apache-2.0 | 38,102 |
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy-Lcdplate',
version=get_versio... | gimunu/mopidy-lcdplate | setup.py | Python | apache-2.0 | 1,406 |
"""
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
Example:
Given a = 1 and b = 2, return 3.
"""
class Solution(object):
def getSum(self, a, b):
"""
:type a: int
:type b: int
:rtype: int
"""
while a != 0 and b != 0:
... | danielsunzhongyuan/my_leetcode_in_python | sum_of_two_integers_371.py | Python | apache-2.0 | 536 |
# Copyright (c) 2015 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/licenses/LICEN... | viktorTarasov/PyKMIP | kmip/demos/pie/create.py | Python | apache-2.0 | 1,766 |
import base64
import binascii
import json
import re
import uuid
import warnings
import zlib
from collections import deque
from types import TracebackType
from typing import ( # noqa
TYPE_CHECKING,
Any,
Dict,
Iterator,
List,
Mapping,
Optional,
Sequence,
Tuple,
Type,
Union,
... | arthurdarcet/aiohttp | aiohttp/multipart.py | Python | apache-2.0 | 32,819 |
__author__ = 'bett'
import MySQLdb as db
import pandas.io.sql as psql
from config import db_config
def getData(symbols,start,end):
database = db.connect(**db_config)
data=psql.frame_query("SELECT * FROM tbl_historical where start", database)
return data;
if(__name__=='__main__'):
getData('00000... | dingmingliu/quanttrade | quanttrade/core/data.py | Python | apache-2.0 | 350 |
import SocketServer
from abc import ABCMeta, abstractmethod
import json
import requests
import six
from .. import LOG as _LOG
from ..signal.signal import DEFAULT_ORCHESTRATOR_URL
from ..signal.event import LogEvent
LOG = _LOG.getChild(__name__)
@six.add_metaclass(ABCMeta)
class SyslogInspectorBase(object):
de... | AkihiroSuda/earthquake | pyearthquake/inspector/syslog.py | Python | apache-2.0 | 2,555 |
#!/usr/bin/python
class Solution:
# @param {string} s
# @return {boolean}
def isValid(self, s):
slist=' '.join(s).split(' ')
print slist
stack=[]
for item in slist:
if item in ('[','{','('):
stack.append(item)
else:
if len(stack)==0:
return False
elif stack[-1:][0]==self.rev(item):... | aertoria/MiscCode | stack.py | Python | apache-2.0 | 585 |
# -*- 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, Version 2.0 (the
#... | Fokko/incubator-airflow | tests/contrib/operators/test_ecs_operator.py | Python | apache-2.0 | 11,678 |
"""A spectral clusterer class to perform clustering."""
import numpy as np
from spectralcluster import constraint
from spectralcluster import custom_distance_kmeans
from spectralcluster import laplacian
from spectralcluster import refinement
from spectralcluster import utils
RefinementName = refinement.RefinementName... | wq2012/SpectralCluster | spectralcluster/spectral_clusterer.py | Python | apache-2.0 | 8,653 |
# -*- coding: utf-8 -*-
# Copyright 2015 Spanish National Research Council
#
# 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... | LIP-Computing/occi-net | ooi/wsgi/parsers.py | Python | apache-2.0 | 5,430 |
import time
def progress(index, size, for_what='当前进度', step=10):
block_size = int(size / step)
if index % block_size == 0:
crt = int(index / block_size)
print('%s ==> [%d / %d]' % (for_what, crt, step))
def log_time():
def _log_time(func):
# func()
def wrapper(*args, **kw... | DannyLee1991/article_cosine_similarity | utils/log.py | Python | apache-2.0 | 873 |
from pytz import utc
from datetime import datetime
from django.db import models
from django.conf import settings
from django.core.exceptions import ValidationError
from django.dispatch import receiver
from django.db.models.signals import pre_save, post_save
from django_pgjson.fields import JsonBField
from simple_hist... | nagyistoce/geokey | geokey/contributions/models.py | Python | apache-2.0 | 13,888 |
# Copyright (c) 2018 PaddlePaddle 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 app... | chengduoZH/Paddle | python/paddle/fluid/tests/unittests/test_group_norm_op.py | Python | apache-2.0 | 8,301 |
#
# Copyright 2017 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 applicable law or... | informatics-isi-edu/microscopy | youtube/youtubecli/setup.py | Python | apache-2.0 | 1,075 |
from . import series
from . import images
def _setup():
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
formatter = logging.Formatter('[%(name)s] %(levelname)s %(message)s')
ch = logging.StreamHandler()
ch.setFormatter(formatter)
logger.addHandler(ch)
_set... | jwittenbach/thunder | thunder/__init__.py | Python | apache-2.0 | 347 |
# -*- coding: utf-8 -*-
import unittest
from copy import deepcopy
from openprocurement.api.tests.base import snitch
from openprocurement.tender.belowthreshold.adapters import TenderBelowThersholdConfigurator
from openprocurement.tender.belowthreshold.tests.base import (
TenderContentWebTest,
test_bids,
tes... | openprocurement/openprocurement.tender.belowthreshold | openprocurement/tender/belowthreshold/tests/award.py | Python | apache-2.0 | 14,334 |
# Copyright 2014 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, ... | dstrockis/outlook-autocategories | lib/unit_tests/test__helpers.py | Python | apache-2.0 | 6,951 |
# -*- coding: utf-8 -*-
import pytest
from model.group import Group
from fixture.application import Application
@pytest.fixture
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
def test_add_group(app):
app.session.login(username="admin", password="secret")... | fleksso99/python_training | test/test_add_group.py | Python | apache-2.0 | 422 |
# coding: utf-8
#
# Esri start of added imports
import sys, os, arcpy
# Esri end of added imports
# Esri start of added variables
g_ESRI_variable_1 = 'lyrFC'
g_ESRI_variable_2 = 'lyrTmp'
g_ESRI_variable_3 = 'ID'
g_ESRI_variable_4 = 'lyrOut'
g_ESRI_variable_5 = ';'
# Esri end of added variables
#---------------------... | pshowalter/solutions-geoprocessing-toolbox | clearing_operations/scripts/PointTargetGRG.py | Python | apache-2.0 | 24,658 |
# -*- coding: utf-8 -*-
from datetime import datetime
from datetime import date
from datetime import timedelta
import re
import Entity.User as User
import Entity.Event as Event
import Entity.RepeatingEvent as RepeatingEvent
import Responder
def createSingleEvent(name, place, date):
event = Event.getByDate(date)
... | ThomasPfeiffer/SCWKbot | Logic/EventController.py | Python | apache-2.0 | 3,381 |
# coding=utf-8
import logging
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.conf import settings
from accounts.authentication import PersonaAuthenticationBackend, PERSONA_VERIFY_URL
__author__ = 'peter'
User = get_user_model()
@patch('a... | PeterHo/mysite | accounts/tests/test_authentication.py | Python | apache-2.0 | 3,148 |
from restclients.canvas import Canvas
#from restclients.models.canvas import ExternalTool
class ExternalTools(Canvas):
def get_external_tools_in_account(self, account_id):
"""
Return external tools for the passed canvas account id.
https://canvas.instructure.com/doc/api/external_tools.htm... | jeffFranklin/uw-restclients | restclients/canvas/external_tools.py | Python | apache-2.0 | 1,719 |
# Copyright 2015 Cloudbase Solutions.
# 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... | cloudbase/neutron | neutron/agent/windows/utils.py | Python | apache-2.0 | 3,141 |
#!/usr/bin/env python
### <command interpreter="python">send_to_cgd.py
### $pipeline_output $endpoint $cgd_url $output $runid $barcodeid $qcversion
### </command>
### Galaxy wrapper for cgd_client.jar.
### CGD_CLIENT is hard coded, but this is not expected to move.
import argparse
import subprocess
from subproc... | jhl667/galaxy_tools | tools/jhl_tools/send_to_cgd.py | Python | apache-2.0 | 2,897 |
from django.apps import AppConfig
class InstaappConfig(AppConfig):
name = 'instaapp'
| rocity/dj-instagram | djinstagram/instaapp/apps.py | Python | apache-2.0 | 91 |
# 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... | elibixby/gcloud-python | gcloud/resource_manager/project.py | Python | apache-2.0 | 10,587 |
import io
import os
import re
import abc
import csv
import sys
import email
import pathlib
import zipfile
import operator
import functools
import itertools
import collections
from configparser import ConfigParser
from contextlib import suppress
from importlib import import_module
from importlib.abc import MetaPathFind... | batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/importlib/metadata.py | Python | apache-2.0 | 16,174 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('groups', '0001_initial'),
]
oper... | yrchen/CommonRepo | commonrepo/groups/migrations/0002_group_members.py | Python | apache-2.0 | 508 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
from front.views import *
from front.views import views as front_views
from django.views.decorators.csrf import csrf_exempt
if not settings.DEBUG:
s = {'SSL': settings.ENABL... | Solanar/CMPUT410-Project | DisSoNet/DisSoNet/urls.py | Python | apache-2.0 | 2,954 |
#!/usr/bin/env python3
"""
Copyright 2015 Stefano Benvenuti <ste.benve86@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required ... | stebenve86/poem_reader | utilities/add_poem.py | Python | apache-2.0 | 1,540 |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
""" Storage layer python client
"""
__author__ = "Praveen Garg, Amarendra K Sinha"
__copyright__ = "Copyright (c) 2017 OSIsoft, LLC"
__license__ = "Apache 2.0"
__version__ = "${VERSION}"
import aiohttp
import http.client
imp... | foglamp/FogLAMP | python/foglamp/common/storage_client/storage_client.py | Python | apache-2.0 | 21,779 |
# Copyright 2016 Sotera Defense Solutions 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 agre... | Sotera/aggregate-micro-paths | hive-streaming/conf/config.py | Python | apache-2.0 | 3,321 |
#!/usr/bin/python
# Copyright (c) 2016 Red Hat
#
# 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... | openstack/renderspec | renderspec/distloader.py | Python | apache-2.0 | 2,522 |
#----------------------------------------------------------------------------------
# Introdução a Programação de Computadores - IPC
# Universidade do Estado do Amazonas - UEA
#
# Adham Lucas da Silva Oliveira 1715310059
# Alexandre Marques Uchôa 1715310028
# André Luís Laborda Neves ... | jucimarjr/IPC_2017-1 | lista04/lista04_lista02_questao11.py | Python | apache-2.0 | 1,164 |
from django.conf.urls import patterns,url
from main import views
urlpatterns = patterns('',
url(r'^$',views.index,name='index'),
url(r'^tags/$',views.tags,name='tags'),
url(r'^tags/(?P<tag_name>\w+)/$',views.tag,name='tag'),
url(r'^add_link/$',views.add_link,name='add_link'),
) | davischau/CMPUT410Lab6 | bookmarks/main/urls.py | Python | apache-2.0 | 295 |
# Copyright 2016 NOKIA
#
# 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... | naveensan1/nuage-openstack-neutron | nuage_neutron/plugins/common/service_plugins/l3.py | Python | apache-2.0 | 57,131 |
import re
from lxml import etree
from nxpy.util import tag_pattern, whitespace_pattern
class Flow(object):
def __init__(self):
self.routes = []
def export(self):
flow = etree.Element('flow')
if len(self.routes):
for route in self.routes:
flow.append(route.... | Kent1/nxpy | nxpy/flow.py | Python | apache-2.0 | 4,735 |
# 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... | klmitch/glance | glance/api/v2/image_tags.py | Python | apache-2.0 | 4,348 |
'''
@author: Michael Wan
@since : 2014-11-08
'''
from math import log
import operator
def createDataSet():
dataSet = [[1, 1, 'yes'],
[1, 1, 'yes'],
[1, 0, 'no'],
[0, 1, 'no'],
[0, 1, 'no']]
labels = ['no surfacing','flippers']
#cha... | onehao/opensource | pyml/inaction/ch03/decisiontree/trees.py | Python | apache-2.0 | 4,087 |
#!/usr/bin/env python3
# Copyright 2019 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | open-power-ref-design-toolkit/cluster-genesis | scripts/python/show_status.py | Python | apache-2.0 | 6,393 |
#
# Copyright 2016 IBM
#
# 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, softw... | openstack/ceilometer | ceilometer/tests/unit/publisher/test_prometheus.py | Python | apache-2.0 | 4,934 |
# Lint as: python3
# 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 ... | tensorflow/lingvo | lingvo/tasks/car/waymo/waymo_decoder.py | Python | apache-2.0 | 13,038 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | rogerthat-platform/rogerthat-backend | src-test/rogerthat_tests/mobicage/capi/test_feature_version.py | Python | apache-2.0 | 1,999 |
from __future__ import absolute_import, print_function, division
from pony.py23compat import basestring
from functools import wraps
from contextlib import contextmanager
from pony.orm.core import Database
from pony.utils import import_module
def raises_exception(exc_class, msg=None):
def decorator(func... | Ahmad31/Web_Flask_Cassandra | flask/lib/python2.7/site-packages/pony/orm/tests/testutils.py | Python | apache-2.0 | 4,752 |
"""Tabular QL agent"""
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
import framework
import utils
DEBUG = False
GAMMA = 0.5 # discounted factor
TRAINING_EP = 0.5 # epsilon-greedy parameter for ... | xunilrj/sandbox | courses/MITx/MITx 6.86x Machine Learning with Python-From Linear Models to Deep Learning/project5/rl/agent_dqn.py | Python | apache-2.0 | 6,756 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | petewarden/tensorflow | tensorflow/python/keras/initializers/initializers_v2.py | Python | apache-2.0 | 35,507 |
import sys
import os
import pandas as pd
from collections import defaultdict
import numpy as np
dirname = sys.argv[1]
path = os.path.join(dirname, "weights.tsv")
with open(path ,"r") as f:
df = pd.read_csv(f, sep="\t")
df = df[df["iter"] == 5]
fc2r = defaultdict(list)
features = set()
for event, event_df in df.... | kedz/cuttsum | trec2015/sbin/cross-validation/best-feats.py | Python | apache-2.0 | 1,444 |
from graphics import *
from Button import *
from CreateNewUserScreen import *
from ChangePasswordScreen import *
import os
class StartScreen:
def is_game_in_progress(self,gid):
for filename in os.listdir("games"):
if str(gid) == filename:
return True
return Fa... | itsallvoodoo/csci-school | CSCI220/Week 15 - FINAL/Scrabble/StartScreen.py | Python | apache-2.0 | 2,963 |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/terraform-python-testing-helper | test/test_args.py | Python | apache-2.0 | 4,448 |
# 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
# distributed unde... | noironetworks/heat | heat/tests/engine/tools.py | Python | apache-2.0 | 11,355 |
# -*- coding: 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
#
# Unless required by applicable law or agreed to in writing, software
... | biln/airflow | airflow/example_dags/example_python_operator.py | Python | apache-2.0 | 1,774 |
# Copyright 2014
# The Cloudscaling Group, 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... | MayankGo/ec2-api | ec2api/config.py | Python | apache-2.0 | 2,017 |
# Copyright (c) 2013 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 by applicable law or agreed to in writ... | rnirmal/savanna | savanna/tests/integration/test_config/test_cluster_config.py | Python | apache-2.0 | 6,861 |
from sqlalchemy import *
from test.lib import *
class FoundRowsTest(fixtures.TestBase, AssertsExecutionResults):
"""tests rowcount functionality"""
__requires__ = ('sane_rowcount', )
@classmethod
def setup_class(cls):
global employees_table, metadata
metadata = MetaData(testing.db)
... | ioram7/keystone-federado-pgid2013 | build/sqlalchemy/test/sql/test_rowcount.py | Python | apache-2.0 | 2,260 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | jayceyxc/hue | apps/oozie/src/oozie/management/commands/oozie_setup.py | Python | apache-2.0 | 7,491 |
# 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, ... | google/fedjax | fedjax/fedjax_test.py | Python | apache-2.0 | 1,219 |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
from tests import pyunit_utils
import h2o
from h2o.utils.typechecks import assert_is_type
from h2o.exceptions import H2OConnectionError, H2OServerError, H2OValueError
import tempfile
import shutil
import os
def h2oinit():
"""
Pytho... | h2oai/h2o-3 | h2o-py/tests/testdir_apis/H2O_Init/h2o.init_test.py | Python | apache-2.0 | 5,839 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
class PRIORITY:
LOWEST = -100
LOWER = -50
LOW = -10
NORMAL = 0
HIGH = 10
HIGHER = 50
HIGHEST = 100
class SORT_ORDER:
FIRST = 0
SECOND = 1
... | michaelhidalgo/7WCSQ | Tools/SQLMap/sqlmap/lib/core/enums.py | Python | apache-2.0 | 10,079 |
from __future__ import print_function, division
import cPickle
import gzip
import os
import sys
import timeit
import numpy
import theano
from theano import tensor
import mdn_one_ahead
# parameters
batch_size = 100
L1_reg=0.00
L2_reg=0.0001
n_epochs=200
learning_rate = 0.001
momentum = 0.9
sigma_in = 320
mixing_in = ... | markstoehr/structured_gaussian_mixtures | structured_gaussian_mixtures/mdn_experiment_one_ahead.py | Python | apache-2.0 | 5,886 |
# 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 | kws_streaming/layers/lstm.py | Python | apache-2.0 | 10,610 |
#!/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/tests/test_polypod/test_resolvers/test_core_resolver.py | Python | apache-2.0 | 9,111 |
# 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 | axial/config_imagenet32.py | Python | apache-2.0 | 1,760 |
# Copyright 2017-2018 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ... | rsavordelli/aws-support-tools | Cognito/decode-verify-jwt/decode-verify-jwt.py | Python | apache-2.0 | 2,958 |
# Lint as: python3
# 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 ... | tensorflow/lingvo | lingvo/tasks/mt/model_test.py | Python | apache-2.0 | 35,425 |
from django.apps import AppConfig
class FundConfig(AppConfig):
name = 'fund'
| szu-stu/ezFund | fund/apps.py | Python | apache-2.0 | 83 |
# https://www.reddit.com/r/learnpython/comments/82ucgu/calling_an_input_inside_a_def_function/
def main():
while True:
word = raw_input('Enter a word: ')
if word == '-1':
break
not_ = '' if word[:] == word[::-1] else ' not'
print "Word '%s' is%s a palindrome" % (word, no... | bandarji/lekhan | python/reddit/palindrome.py | Python | apache-2.0 | 332 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Cisco Systems, 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-... | rossella/neutron | quantum/plugins/cisco/db/nexus_db_v2.py | Python | apache-2.0 | 4,960 |
from django.test import TestCase
from tenancy.filters import *
from tenancy.models import Tenant, TenantGroup
class TenantGroupTestCase(TestCase):
queryset = TenantGroup.objects.all()
filterset = TenantGroupFilterSet
@classmethod
def setUpTestData(cls):
parent_tenant_groups = (
... | digitalocean/netbox | netbox/tenancy/tests/test_filters.py | Python | apache-2.0 | 3,818 |
# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | werkt/bazel | src/test/py/bazel/bazel_windows_cpp_test.py | Python | apache-2.0 | 32,128 |
# 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 | tf3d/utils/voxel_utils.py | Python | apache-2.0 | 21,191 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Ponzoni, Nelson"
__copyright__ = "Copyright 2015"
__credits__ = ["Ponzoni Nelson"]
__maintainer__ = "Ponzoni Nelson"
__contact__ = "npcuadra@gmail.com"
__email__ = "npcuadra@gmail.com"
__license__ = "GPL"
__version__ = "1.0.0"
_... | lerker/cupydle | cupydle/dnn/gridSearch.py | Python | apache-2.0 | 4,741 |
from .responses import InstanceMetadataResponse
url_bases = ["http://169.254.169.254"]
instance_metadata = InstanceMetadataResponse()
url_paths = {"{0}/(?P<path>.+)": instance_metadata.metadata_response}
| spulec/moto | moto/instance_metadata/urls.py | Python | apache-2.0 | 207 |
# Copyright (c) 2014 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 by applicable law or agreed to in writing, so... | mgrygoriev/CloudFerry | cloudferrylib/os/network/neutron.py | Python | apache-2.0 | 73,241 |
from suds.client import Client
from nova import exception
from nova import db
import logging
logging.getLogger('suds').setLevel(logging.INFO)
def update_for_run_instance(service_url, region_name, server_port1, server_port2, dpid1, dpid2):
# check region name
client = Client(service_url + "?wsdl")
client... | nii-cloud/dodai-compute | nova/virt/dodai/ofc_utils.py | Python | apache-2.0 | 2,420 |
# 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, ... | google-research/sound-separation | models/train/data_meeting_io.py | Python | apache-2.0 | 23,738 |
# -*- coding: utf-8 -*-
#
# Copyright 2011-2018 Matt Austin
#
# 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 applicabl... | mattaustin/django-thummer | thummer/templatetags/thummer.py | Python | apache-2.0 | 3,380 |
"""Support for RFXtrx covers."""
import logging
from homeassistant.components.cover import CoverEntity
from homeassistant.const import CONF_DEVICES, STATE_OPEN
from homeassistant.core import callback
from . import (
CONF_AUTOMATIC_ADD,
CONF_DATA_BITS,
CONF_SIGNAL_REPETITIONS,
DEFAULT_SIGNAL_REPETITION... | tchellomello/home-assistant | homeassistant/components/rfxtrx/cover.py | Python | apache-2.0 | 3,963 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
sys.path.insert(0,'..')
import tensorflow as tf
import numpy as np
import itertools
import pickle
import os
import re
import inception_v4
os.environ['CUDA_VISIBLE_DEVICES'] = ''
def atoi(text):
... | xwzy/triplet-deep-hash-pytorch | triplet-deep-hash-pytorch/src/extract_feature/convert_weights/convert_weights_to_keras.py | Python | apache-2.0 | 1,736 |
# ===============================================================================
# Copyright 2016 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/licenses... | UManPychron/pychron | pychron/furnace/firmware/server.py | Python | apache-2.0 | 5,682 |
"""
WSGI config for cg4 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cg4.settings")
from django.core.wsgi impo... | cybojenix/projects_reward_system | cg4/wsgi.py | Python | apache-2.0 | 381 |
# -*- coding: utf-8 -*-
from .database import BaseMessage
from .records import RecordUpdateMessage, RecordDeleteMessage, RecordCreateMessage
from ..exceptions import PyOrientBadMethodCallException
from ..constants import COMMAND_OP, FIELD_BOOLEAN, FIELD_BYTE, FIELD_CHAR, \
FIELD_INT, FIELD_LONG, FIELD_SHORT, FIELD_... | orientechnologies/pyorient | pyorient/messages/commands.py | Python | apache-2.0 | 19,879 |
import time
from typing import List
from paasta_tools.deployd.common import DelayDeadlineQueueProtocol
from paasta_tools.deployd.common import PaastaThread
from paasta_tools.deployd.workers import PaastaDeployWorker
from paasta_tools.metrics.metrics_lib import BaseMetrics
class MetricsThread(PaastaThread):
def _... | Yelp/paasta | paasta_tools/deployd/metrics.py | Python | apache-2.0 | 4,472 |
import os
import setuptools
module_path = os.path.join(os.path.dirname(__file__), 'url_for_s3.py')
version_line = [line for line in open(module_path)
if line.startswith('__version__')][0]
__version__ = version_line.split('__version__ = ')[-1][1:][:-2]
setuptools.setup(
name="url-for-s3",
ver... | Jaza/url-for-s3 | setup.py | Python | apache-2.0 | 1,123 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-23 23:54
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):
dependencies = [
migrations.swapp... | LennonChin/Django-Practices | MxShop/apps/trade/migrations/0004_auto_20171023_2354.py | Python | apache-2.0 | 1,497 |
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
import subprocess
import sys
from textwrap import dedent
from twitter.common.contextutil import pushd
from pex.testing import temporary_content
def assert_entry_points(entry_... | mzdanieltest/pex | tests/test_bdist_pex.py | Python | apache-2.0 | 1,373 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.