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 -*-
import logging
logger = logging.getLogger(__name__)
import requests
import os
from django.core.management.base import NoArgsCommand
from apps.subscribers.models import Ticket
class Command(NoArgsCommand):
help = 'Loops through all subscribers and marks each ticket appropriately.'
d... | bryanveloso/avalonstar-tv | apps/subscribers/management/commands/updatetickets.py | Python | apache-2.0 | 2,623 |
import collections
class Solution:
def numSimilarGroups(self, A):
UF = {}
for i in range(len(A)): UF[i] = i
def find(x):
if x != UF[x]:
UF[x] = find(UF[x])
return UF[x]
def union(x, y):
UF.setdefault(x, x)
UF.setdefault(... | zuun77/givemegoogletshirts | leetcode/python/839_similar-string-groups.py | Python | apache-2.0 | 1,451 |
import abc
from OHA.helpers.converters.BaseConverter import BaseConverter
__author__ = 'indrajit'
__email__ = 'eendroroy@gmail.com'
class LengthConverter(BaseConverter):
def __init__(self, _value, _from=None, _to=None):
super(LengthConverter, self).__init__(_value, _from, _to)
def _supported_units(... | openhealthalgorithms/openhealthalgorithms | OHA/helpers/converters/LengthConverter.py | Python | apache-2.0 | 1,483 |
#!/usr/bin/python3
import rem_backend.query_data as qd
import rem_backend.propagation_model_estimation as pm
import threading
import _thread
__author__ = "Daniel Denkovski", "Valentin Rakovic"
__copyright__ = "Copyright (c) 2017, Faculty of Electrical Engineering and Information Technologies, UKIM, Skopje, Macedonia"... | danieldUKIM/controllers_dockers | rem_console/REM_console.py | Python | apache-2.0 | 2,275 |
# Copyright 2017 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... | zlpmichelle/crackingtensorflow | wide_deep/wide_deep.py | Python | apache-2.0 | 8,315 |
from dronekit import connect
import time
import argparse
import pprint
import rospy
import copy
from gf_beacon.srv import *
import hostapd
import beaconencoder
import findap
class sample_beacon_data:
def __init__(self, connect_string):
print "init"
self.missing_AP = False
try:
... | geofrenzy/utm-mbsb | beacon/dkbeacon.py | Python | apache-2.0 | 5,335 |
#Thanks for the approach https://github.com/ML-Person/My-solution-to-Avito-Challenge-2018 (@nikita)
import pandas as pd
import numpy as np
import gc
import os
import re
import pickle
import string
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
from sklearn.preproces... | Diyago/Machine-Learning-scripts | DEEP LEARNING/Kaggle Avito Demand Prediction Challenge/stem to SVD.py | Python | apache-2.0 | 8,068 |
# Jinja2 filters for user creation help
# Needed for chage
def daysSinceEpoc( _unused=0 ):
import datetime
return (datetime.datetime.utcnow() - datetime.datetime(1970,1,1)).days
# Boilerplate code to add filter to Jinja2
class FilterModule(object):
def filters(self):
return { 'daysSinceEpoc': daysSinc... | jmalacho/ansible-examples | filter_plugins/users.py | Python | apache-2.0 | 344 |
import logging
import numpy as np
from ray.tune.automl.search_policy import AutoMLSearcher
logger = logging.getLogger(__name__)
LOGGING_PREFIX = "[GENETIC SEARCH] "
class GeneticSearch(AutoMLSearcher):
"""Implement the genetic search.
Keep a collection of top-K parameter permutations as base genes,
the... | stephanie-wang/ray | python/ray/tune/automl/genetic_searcher.py | Python | apache-2.0 | 9,413 |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from abc import ABCMeta, abstractmethod
from pathlib import PurePath
from textwrap import dedent
from typing import List, Tuple, Type
from unittest.mock import Mock
import pytest
from pa... | wisechengyi/pants | src/python/pants/rules/core/test_test.py | Python | apache-2.0 | 8,678 |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.patches import PathPatch
from matplotlib.path import Path
from matplotlib.transforms import Bbox
from scipy import stats
x = np.linspace(0, 1, 200)
pdfx = stats.beta(2, 5).pdf(x)
path = Path(np.array([x, pdfx]).transpose())
patch = P... | arviz-devs/arviz | doc/logo/generate_logo.py | Python | apache-2.0 | 1,282 |
import temperanotes
import pytest, bisect
@pytest.fixture
def idiot_temp():
temp = [1, 1.05, 1.1, 1.15, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9] # not a temperament, just a set of numbers for testing
assert len(temp) == 12 # need 12 notes for th... | davidedelvento/temperanotes | test_temperanotes.py | Python | apache-2.0 | 9,430 |
from app import setup
app = setup()
| OniOni/ril | wsgi.py | Python | apache-2.0 | 37 |
# Copyright 2020 The TensorFlow 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | tensorflow/graphics | tensorflow_graphics/projects/points_to_3Dobjects/transforms/transforms.py | Python | apache-2.0 | 12,632 |
"""ApacheParser is a member object of the ApacheConfigurator class."""
import copy
import fnmatch
import logging
import os
import re
import subprocess
import sys
import six
from certbot import errors
from certbot_apache import constants
logger = logging.getLogger(__name__)
class ApacheParser(object):
"""Class... | jsha/letsencrypt | certbot-apache/certbot_apache/parser.py | Python | apache-2.0 | 27,616 |
# 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... | jamielennox/python-kiteclient | kiteclient/tests/v1/utils.py | Python | apache-2.0 | 1,915 |
# 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... | klmitch/nova | nova/tests/unit/compute/test_provider_config.py | Python | apache-2.0 | 17,242 |
# =========================================================================
# Copyright 2012-present Yunify, Inc.
# -------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the Licens... | yunify/qingcloud-cli | qingcloud/cli/iaas_client/actions/router/describe_router_vxnets.py | Python | apache-2.0 | 1,841 |
import sys
from PyQt4 import QtGui
from dependence_repo_manager.core.manager import RepoManager
from dependence_repo_manager.core.main_window import MainWindow
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
manager = RepoManager()
manager.config()
mainWin = MainWindow(manager)
main... | xcgspring/dependence_repo | manager/dependence_repo_manager/main.py | Python | apache-2.0 | 357 |
import json
from collections import OrderedDict
from inspect import signature
from warnings import warn
import numpy as np
from sklearn.base import BaseEstimator
class Configuration(object):
def __init__(self, name, version, params):
if not isinstance(name, str):
raise ValueError()
if... | allenai/document-qa | docqa/configurable.py | Python | apache-2.0 | 6,024 |
# This script has to run using the Python executable found in:
# /opt/mgmtworker/env/bin/python in order to properly load the manager
# blueprints utils.py module.
import argparse
import logging
import utils
class CtxWithLogger(object):
logger = logging.getLogger('internal-ssl-certs-logger')
utils.ctx = CtxWi... | cloudify-cosmo/cloudify-manager-blueprints | components/manager-ip-setter/scripts/create-internal-ssl-certs.py | Python | apache-2.0 | 1,346 |
from measures.generic.GenericMeasure import GenericMeasure
import measures.generic.Units as Units
class StartedSearches(GenericMeasure):
"""Total number of started searches"""
def __init__(self, period, simulationTime):
GenericMeasure.__init__(self, r'DEBUG .*? - Peer [0-9]+ started search for parameters .*? ([... | unaguil/hyperion-ns2 | experiments/measures/multicast/StartedSearches.py | Python | apache-2.0 | 437 |
import logging
class BorgSingleton:
_shared_state = {}
def __init__(self):
self.__dict__ = self._shared_state
class LoggerSetup(BorgSingleton):
"""Logger setup convenience class"""
DEFAULT_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
def __init__(self, logger_name, ... | kevgraham7/toolbox | python/samples/git-tools/util/log_setup.py | Python | apache-2.0 | 1,033 |
#!/usr/bin/env python3
from flask import Flask, request, render_template
import os
import json
import time
import datetime
from smarthomemongo import SmartHomeDB
app = Flask(__name__)
smartDB = SmartHomeDB()
@app.route('/')
def index():
records = smartDB.getCurrentStats('raspberry')
if( 'timestamp' in records.keys... | bharath2020/SmartHome | temperature_server.py | Python | apache-2.0 | 1,401 |
clock.addListener("clockStopped", "python", "clock_stopped")
def clock_stopped():
print("The clock has been stopped") | MyRobotLab/myrobotlab | src/main/resources/resource/Clock/clock_6_clock_stopped.py | Python | apache-2.0 | 122 |
# Setup file for package int_methods
from setuptools import setup
setup(name="int_methods",
version="0.0.1",
install_requires=["quark==0.0.1"],
py_modules=['int_methods'],
packages=['int_methods', 'int_methods_md'])
| bozzzzo/quark | quarkc/test/emit/expected/py/int-methods/setup.py | Python | apache-2.0 | 242 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
import traceback
from sis_provisioner.dao.uw_account import get_all_uw_accounts
from sis_provisioner.csv import get_filepath
from sis_provisioner.csv.user_writer import make_import_user_csv_files
from sis_provisioner.... | uw-it-aca/bridge-sis-provisioner | sis_provisioner/csv/writer.py | Python | apache-2.0 | 1,345 |
from itertools import *
for i, s in zip(count(), repeat('over-and-over', 5)):
print(i, s)
| jasonwee/asus-rt-n14uhp-mrtg | src/lesson_algorithms/itertools_repeat_zip.py | Python | apache-2.0 | 96 |
from SamplingAccuracyEvaluation import SamplingAlgorithm as SA
from SamplingAccuracyEvaluation import AccuracyEvaluation as AE
from SamplingAccuracyEvaluation import PrintGraph as PG
from SamplingAccuracyEvaluation import StatisticalCalculation as SC
import operator
def populationListGenerate(filePath, target):
pr... | dke-knu/i2am | i2am-app/AlgorithmSelectionEngine/SamplingAccuracyEvaluation/SamplingAccuracyEvaluation.py | Python | apache-2.0 | 3,665 |
### This program intends to combine same GSHF in citation tree, and sort them according to the first letter of title;
### Author: Ye Gao
### Date: 2017-11-7
import csv
file = open('NodeCheckList.csv', 'rb')
reader = csv.reader(file)
NodeCheckList = list(reader)
file.close()
#print NodeCheckList
FirstRow = NodeChec... | sortsimilar/Citation-Tree | markstress.py | Python | apache-2.0 | 1,287 |
import urllib2
from lxml import etree
####################################################################
# API
####################################################################
class Scrape_Quora:
regexpNS = "http://exslt.org/regular-expressions"
@staticmethod
def get_name(user_name):
url =... | hansika/pyquora | scrape_quora/pyquora.py | Python | apache-2.0 | 3,445 |
# Copyright (c) 2017 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 ... | openstack/networking-odl | networking_odl/ml2/port_status_update.py | Python | apache-2.0 | 5,546 |
def rewrite_keywords(journal_like):
bib = journal_like.bibjson()
kwords = [k.lower() for k in bib.keywords]
bib.set_keywords(kwords)
return journal_like
| DOAJ/doaj | portality/migrate/20191128_2056_keywords_to_lower/operations.py | Python | apache-2.0 | 169 |
# Copyright 2019 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-core/cirq/interop/quirk/cells/input_cells.py | Python | apache-2.0 | 2,927 |
# 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 | bin/analysis/cfg/gc.py | Python | apache-2.0 | 1,289 |
'''
Kurgan AI Web Application Security Analyzer.
http://www.kurgan.com.br/
Author: Glaudson Ocampos - <glaudson@vortexai.com.br>
Created in May, 11th 2016.
'''
import requests
import config
import sys
import warnings
import validators
sys.path.append('../')
class Target(object):
host = None
method = ''
... | glaudsonml/kurgan-ai | libs/Target.py | Python | apache-2.0 | 2,614 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | NitorCreations/aws-utils | opt/nitor/library/ec2_ami_find.py | Python | apache-2.0 | 9,762 |
from typing import Union
from ray.rllib.models.action_dist import ActionDistribution
from ray.rllib.utils.annotations import override
from ray.rllib.utils.exploration.exploration import TensorType
from ray.rllib.utils.exploration.soft_q import SoftQ
from ray.rllib.utils.framework import try_import_tf, try_import_torch... | ray-project/ray | rllib/utils/exploration/slate_soft_q.py | Python | apache-2.0 | 1,483 |
import tweepy
import os
from flask import Flask, make_response, jsonify
CONSUMER_KEY = os.environ['CATCHMEMEALL_TWITTER_CONSUMER_TOKEN']
CONSUMER_SECRET = os.environ['CATCHMEMEALL_TWITTER_CONSUMER_SECRET']
app = Flask(__name__)
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
api = tweepy.API(auth)
@app.ro... | mapado/CatchMemeAll | twitter_server.py | Python | apache-2.0 | 763 |
from guardian.shortcuts import get_perms
from rest_framework import serializers as ser
from rest_framework.exceptions import ValidationError
from reviews.workflow import Workflows
from api.actions.serializers import ReviewableCountsRelationshipField
from api.base.utils import absolute_reverse, get_user_auth
from api.... | aaxelb/osf.io | api/preprint_providers/serializers.py | Python | apache-2.0 | 5,102 |
# Copyright 2011 the Melange 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 agreed to in wr... | rhyolight/nupic.son | app/soc/mapreduce/process_org_apps.py | Python | apache-2.0 | 2,473 |
from __future__ import absolute_import
from typing import Any
from django.utils.translation import ugettext as _
from django.conf import settings
from django.contrib.auth import authenticate, login, get_backends
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponseForb... | peiwei/zulip | zerver/views/__init__.py | Python | apache-2.0 | 58,738 |
# -*- 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 | samples/generated_samples/aiplatform_v1beta1_generated_job_service_update_model_deployment_monitoring_job_async.py | Python | apache-2.0 | 1,983 |
# 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... | changsimon/trove | trove/extensions/mgmt/volume/service.py | Python | apache-2.0 | 1,428 |
"""Module to debug python programs"""
import sys
import traceback
def getAllStacks():
code = []
for threadId, stack in sys._current_frames().iteritems():
code.append("\n# ThreadID: %s" % threadId)
for filename, lineno, name, line in traceback.extract_stack(stack):
code.append('File... | netixx/python-tools | tools/debugger.py | Python | apache-2.0 | 674 |
'''
@auther:fangxiao
'''
import apibinding.api_actions as api_actions
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.iam2_operations as iam2_ops
import zstackwoodpecker.operations.affini... | zstackio/zstack-woodpecker | integrationtest/vm/simulator/iam2/test_iam2_project_vpc_cascade_delete.py | Python | apache-2.0 | 8,266 |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | a10networks/acos-client | acos_client/version.py | Python | apache-2.0 | 641 |
# 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... | leezu/mxnet | python/mxnet/gluon/contrib/estimator/event_handler.py | Python | apache-2.0 | 33,227 |
import random
import threading
from collections import defaultdict
import logging
import time
from typing import Any, Dict, List, Optional
from ray.autoscaler.node_provider import NodeProvider
from ray.autoscaler.tags import TAG_RAY_CLUSTER_NAME, TAG_RAY_NODE_NAME, \
TAG_RAY_LAUNCH_CONFIG, TAG_RAY_NODE_KIND, \
... | pcmoritz/ray-1 | python/ray/autoscaler/_private/aliyun/node_provider.py | Python | apache-2.0 | 12,663 |
#!/usr/bin/env python2.5
#
# Copyright 2011 the Melange 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 applic... | SRabbelier/Melange | app/soc/modules/gsoc/views/org_app.py | Python | apache-2.0 | 2,789 |
import unittest
from mopidy_tunein import Extension
class ExtensionTest(unittest.TestCase):
def test_get_default_config(self):
ext = Extension()
config = ext.get_default_config()
self.assertIn("[tunein]", config)
self.assertIn("enabled = true", config)
def test_get_config_s... | kingosticks/mopidy-tunein | tests/test_extension.py | Python | apache-2.0 | 483 |
#
# UpdateLogger.py
#
"""
package oompa.tracking
TODO: stil waffling about whether to log two-columns - "datetime {json}" or "{json-with-datetime-field}"
"""
import json
import os
from datetime import datetime
class UpdateLogger:
"""
records updates for later replay
"""
def __init__(self, c... | sjtsp2008/oompa | oompa/tracking/UpdateLogger.py | Python | apache-2.0 | 6,922 |
from helper import unittest, PillowTestCase, py3
from PIL import Image
class TestLibPack(PillowTestCase):
def pack(self):
pass # not yet
def test_pack(self):
def pack(mode, rawmode):
if len(mode) == 1:
im = Image.new(mode, (1, 1), 1)
else:
... | 1upon0/rfid-auth-system | GUI/printer/Pillow-2.7.0/Tests/test_lib_pack.py | Python | apache-2.0 | 5,896 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import tensorflow as tf
__all__ = [
'Initializer', 'Zeros', 'Ones', 'Constant', 'RandomUniform', 'RandomNormal', 'TruncatedNormal',
'deconv2d_bilinear_upsampling_initializer'
]
class Initializer(object):
"""Initializer base class: all initial... | zsdonghao/tensorlayer | tensorlayer/initializers.py | Python | apache-2.0 | 7,005 |
input = """
% Atom bug shouldn't be derived, as the body of the rule
% should be false. Auxiliary atoms shouldn't be printed
% out, as they are censored.
d(1).
d(2).
d(3).
bug :- 1 < #count{V : d(V)} <= 2.
"""
output = """
% Atom bug shouldn't be derived, as the body of the rule
% should be false. Auxiliary atoms s... | veltri/DLV2 | tests/parser/aggregates.count.assignment.1.test.py | Python | apache-2.0 | 429 |
"""Component to make instant statistics about your history."""
import datetime
import logging
import math
import voluptuous as vol
from homeassistant.components import history
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_ENTITY_ID,
CONF_NAME,
CONF_STAT... | leppa/home-assistant | homeassistant/components/history_stats/sensor.py | Python | apache-2.0 | 10,823 |
#!/usr/bin/env python
"""This utility installs an engage extension into a deployment home.
"""
import os
import os.path
import sys
from optparse import OptionParser
import shutil
import re
import logging
logger = logging.getLogger(__name__)
# enable importing from the python_pkg sub-directory
base_src_dir=os.path.ab... | quaddra/engage | install_extension.py | Python | apache-2.0 | 7,602 |
# -*- coding: UTF-8 -*-
import requests
from bs4 import BeautifulSoup, UnicodeDammit
import time
import os
import re
import log
import tools
class Get(object):
# timeout, retry_interval -> seconds
def __init__(self, url='', timeout=5, retry=5, retry_interval=2, proxies={}, headers={}, download_file=None, sav... | BD777/WindPythonToy | comm/network.py | Python | apache-2.0 | 7,827 |
# -*- coding: utf-8 -*-
'''
Created on 17/2/16.
@author: love
'''
import paho.mqtt.client as mqtt
import json
import ssl
def on_connect(client, userdata, flags, rc):
print("Connected with result code %d"%rc)
client.publish("Login/HD_Login/1", json.dumps({"userName": user, "passWord": "Hello,anyone!"}),qos=0,re... | liangdas/mqantserver | client/mqtt_chat_client.py | Python | apache-2.0 | 2,416 |
def joke():
return 'Knock Knock. Who is there?'
| cloudfoundry/python-buildpack | fixtures/setup_py/funniest/__init__.py | Python | apache-2.0 | 52 |
# Copyright 2015-2016 Palo Alto Networks, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | PaloAltoNetworks/minemeld-core | minemeld/collectd.py | Python | apache-2.0 | 2,672 |
from osrf_pycommon.process_utils import asyncio
from osrf_pycommon.process_utils.async_execute_process import async_execute_process
from osrf_pycommon.process_utils import get_loop
from .impl_aep_protocol import create_protocol
loop = get_loop()
@asyncio.coroutine
def run(cmd, **kwargs):
transport, protocol = y... | ros2/ci | ros2_batch_job/vendor/osrf_pycommon/tests/unit/test_process_utils/impl_aep_asyncio.py | Python | apache-2.0 | 505 |
# subprocess - Subprocesses with accessible I/O streams
#
# For more information about this module, see PEP 324.
#
# Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se>
#
# Licensed to PSF under a Contributor Agreement.
# See http://www.python.org/2.4/license for licensing details.
r"""subprocess - Subpr... | moto-timo/ironpython3 | Src/StdLib/Lib/subprocess.py | Python | apache-2.0 | 64,399 |
import json
import httplib
import requests
import six
import pyaml
from six.moves.urllib.parse import urljoin
from st2actions.runners.pythonrunner import Action
__all__ = [
'PostResultAction'
]
def _serialize(data):
return pyaml.dump(data)
def format_possible_failure_result(result):
'''
Error resu... | meirwah/st2contrib | packs/hubot/actions/post_result.py | Python | apache-2.0 | 5,619 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-bigquery | samples/magics/conftest.py | Python | apache-2.0 | 1,166 |
# pylint: disable=redefined-outer-name, comparison-with-callable
"""Test helper functions."""
import gzip
import importlib
import logging
import os
import sys
from typing import Any, Dict, List, Optional, Tuple, Union
import cloudpickle
import numpy as np
import pytest
from _pytest.outcomes import Skipped
... | arviz-devs/arviz | arviz/tests/helpers.py | Python | apache-2.0 | 21,624 |
##
# Copyright (c) 2008-2015 Apple 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... | red-hood/calendarserver | txdav/caldav/datastore/scheduling/imip/test/test_inbound.py | Python | apache-2.0 | 15,369 |
import io
from molotov.api import get_fixture
_UNREADABLE = "***WARNING: Molotov can't display this body***"
_BINARY = "**** Binary content ****"
_FILE = "**** File content ****"
_COMPRESSED = ('gzip', 'compress', 'deflate', 'identity', 'br')
class BaseListener(object):
async def __call__(self, event, **options... | loads/ailoads | molotov/listeners.py | Python | apache-2.0 | 3,733 |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
"""
Tests for running and managing PostgreSQL with Flocker.
"""
from unittest import skipUnless
from uuid import uuid4
from pyrsistent import pmap, freeze, thaw
from twisted.python.filepath import FilePath
from twisted.trial.unittest import TestCase
from ... | runcom/flocker | flocker/acceptance/test_postgres.py | Python | apache-2.0 | 8,587 |
# 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 use ... | cloudkick/libcloud | libcloud/compute/deployment.py | Python | apache-2.0 | 3,855 |
from __future__ import absolute_import
from hamcrest.library import *
from hamcrest.core import *
| eve-basil/common | tests/__init__.py | Python | apache-2.0 | 98 |
# 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/pymql | test/best_hrid_test.py | Python | apache-2.0 | 3,260 |
# Copyright 2018 The trfl 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... | deepmind/trfl | trfl/sequence_ops_test.py | Python | apache-2.0 | 17,471 |
# 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... | sxjscience/tvm | python/tvm/relay/op/_transform.py | Python | apache-2.0 | 26,343 |
# 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... | failys/CAIRIS | cairis/test/test_AssetAPI.py | Python | apache-2.0 | 13,606 |
from muntjac.api import VerticalLayout, Link
from muntjac.terminal.theme_resource import ThemeResource
from muntjac.terminal.external_resource import ExternalResource
class LinkCurrentWindowExample(VerticalLayout):
_CAPTION = 'Open Google'
_TOOLTIP = 'http://www.google.com'
_ICON = ThemeResource('../sam... | rwl/muntjac | muntjac/demo/sampler/features/link/LinkCurrentWindowExample.py | Python | apache-2.0 | 1,076 |
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from include.dataset_fnames import generate_station_data_fname
from include.feature_lists import numeric_features
from xgboost import XGBRegressor
def numeric_df_missing_values_summary():
for i, station_id in enumerate(s... | zakkum42/Bosch | src/03-feature_engineering/missing_values_numeric.py | Python | apache-2.0 | 3,477 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-28 02:28
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('webcore', '0003_auto_20170427_1825'),
]
operations = [
migrations.RemoveField(
... | Nikita1710/ANUFifty50-Online-Mentoring-Platform | project/fifty_fifty/webcore/migrations/0004_auto_20170428_0228.py | Python | apache-2.0 | 459 |
"""Elementwise operators"""
from __future__ import absolute_import as _abs
import tvm
from .. import tag
from ..util import get_const_int
@tvm.tag_scope(tag=tag.ELEMWISE)
def relu(x):
"""Take relu of input x.
Parameters
----------
x : tvm.Tensor
Input argument.
Returns
-------
y :... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/python/topi/nn/elemwise.py | Python | apache-2.0 | 1,936 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Intel Corp.
#
"""
Interface for all resource control plugins.
"""
from abc import ABCMeta, abstractmethod
from ..plugin import DeclareFramework
@DeclareFramework('provisioner')
class Provisioner(object, metaclass=ABCMeta):
PROVISIONER_KEY = "provisioner"
PROVISIO... | intel-ctrlsys/actsys | actsys/control/provisioner/provisioner.py | Python | apache-2.0 | 3,948 |
# Copyright 2021 The TensorFlow 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 agreed to ... | tensorflow/similarity | tensorflow_similarity/retrieval_metrics/bndcg.py | Python | apache-2.0 | 5,659 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | tensorflow/datasets | tensorflow_datasets/image_classification/imagenet_sketch/__init__.py | Python | apache-2.0 | 744 |
# Copyright 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 agre... | sajeeshcs/nested_projects_keystone | keystone/common/base64utils.py | Python | apache-2.0 | 13,107 |
#!/usr/bin/env python3
import argparse
import random
import time
def bin(number):
return "{0:5b}".format(number).replace(' ','0')
def initialize(population):
return [bin(random.randint(0,31)) for x in range(0, population)]
def evaluate(population):
tuples = []
suma = 0
end = False
for chav... | VictorRodriguez/personal | ec-ea/practices/pract2/sga.py | Python | apache-2.0 | 2,812 |
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
row = len(grid)
col = len(grid[0])
dp = [[0]*col for i in range(row)]
minPath = 0
return self.findPath(grid, row-1, col-1, dp)
def findPath(self, grid, i, j, dp):
#print(i,j, min... | saisankargochhayat/algo_quest | leetcode/64.MinSumPath/soln.py | Python | apache-2.0 | 951 |
# Copyright 2017 Huawei Technologies Co.,LTD.
# 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
#
# Unl... | openstack/nomad | cyborg/api/controllers/base.py | Python | apache-2.0 | 2,260 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | cvandeplas/plaso | plaso/formatters/mac_securityd.py | Python | apache-2.0 | 1,215 |
#
# 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 n... | wangyixiaohuihui/spark2-annotation | python/pyspark/sql/utils.py | Python | apache-2.0 | 4,112 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import os
import sqlite3
import sys
from collections import OrderedDict, defaultdict
from functools import wraps
from warnings import warn
import numpy as np
import pyproj
import regex
from cf_units import Unit
from compliance_checker import cfutil
from c... | aodn/compliance-checker | compliance_checker/cf/cf.py | Python | apache-2.0 | 220,804 |
# Copyright 2017 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... | Xeralux/tensorflow | tensorflow/contrib/py2tf/pyct/static_analysis/live_values.py | Python | apache-2.0 | 4,891 |
class Error(object):
def __init__(self, code, msg=None, data=None):
self.code = code
self.msg = msg
self.data = data
def __str__(self):
err = self.to_dict()
return str(err)
def to_dict(self):
err = {}
err['err_code'] = self.code
if self.m... | 827992983/mylib | python/error.py | Python | apache-2.0 | 545 |
#!/bin/python3
# Testscript for template generation and deploying
from cloud_provider.amazon import Amazon
from template.template import CloudFormationTemplate
from pprint import pprint
if __name__ == "__main__":
# Amazon Settings
region = "eu-west-1"
stack_name = 'TestStack'
# Template settings
... | magreiner/orchestration-tools | template_testing.py | Python | apache-2.0 | 859 |
#
# Parse tree nodes
#
import cython
cython.declare(sys=object, os=object, time=object, copy=object,
Builtin=object, error=object, warning=object, Naming=object, PyrexTypes=object,
py_object_type=object, ModuleScope=object, LocalScope=object, ClosureScope=object, \
Struct... | hpfem/cython | Cython/Compiler/Nodes.py | Python | apache-2.0 | 322,384 |
from lxml import etree
from anansi.xml import XMLMessage,gen_element,XMLError
class TCCError(Exception):
def __init__(self,msg):
super(TCCError,self).__init__(msg)
class TCCMessage(XMLMessage):
def __init__(self,user,comment=""):
super(TCCMessage,self).__init__(gen_element('tcc_request'))
... | ewanbarr/anansi | anansi/tcc/tcc_utils.py | Python | apache-2.0 | 4,234 |
"""Copyright 2008 Orbitz WorldWide
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... | graphite-server/graphite-web | webapp/graphite/app_settings.py | Python | apache-2.0 | 2,450 |
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
sys.path.insert(0, os.getcwd() + '/../../tools/')
import wb
import trf
import wer
def process_nbest(fread, fwrite):
nEmptySentNum = 0
with open(fread, 'rt') as f1, open(fwrite, 'wt') as f2:
for a in [line.split() for line in f1]:
... | wbengine/SPMILM | egs/chime4/run_trf_2.py | Python | apache-2.0 | 4,455 |
# 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
# distribu... | quantumlib/OpenFermion-Cirq | openfermioncirq/variational/ansatzes/swap_network_trotter_hubbard.py | Python | apache-2.0 | 10,098 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | alfasin/st2 | st2client/st2client/models/core.py | Python | apache-2.0 | 11,745 |
import os
from configurations import values
from django.conf import global_settings
class DjangoSettings(object):
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = values.SecretValue()
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
INSTALLED_APPS = (
'djan... | gotche/django-basic-project | project_name/project_name/settings/base.py | Python | apache-2.0 | 1,387 |
import sys, os, math
import time
import numpy as np
from pandas.io.parsers import read_csv
from sklearn.decomposition import PCA
from sklearn.cross_validation import StratifiedShuffleSplit
from sklearn import metrics
import sklearn.svm as svm
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes impo... | flyingpoops/kaggle-digit-recognizer-team-learning | plot.py | Python | apache-2.0 | 1,298 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.