code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# coding=utf-8
import pymongo
import re
from math import exp
from datetime import date, datetime
connection = pymongo.MongoClient("")
db = connection.dataservices
ads = db.ads
# 1 - Указан ли адрес
# 2 - Указаны ли контактные данные
# 3 - Наличие фотографий Больше 1, тоже плюс
# 4 - Давность подачи объявления
# 5 - У... | nesterione/core-of-my-services | scripts/run_ads_ranking.py | Python | apache-2.0 | 2,535 |
# -*- 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-resource-manager | samples/generated_samples/cloudresourcemanager_v3_generated_tag_bindings_create_tag_binding_sync.py | Python | apache-2.0 | 1,572 |
"""
"""
from .datasets import Dataset;
from.mnist import get_mnist_data;
__all__ = ['get_mnist_data', 'Dataset'];
| nryant/tensorflow_mnist_examples | mnist_lib/datasets/__init__.py | Python | apache-2.0 | 115 |
# 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... | luoyetx/mxnet | tests/python/unittest/test_operator.py | Python | apache-2.0 | 247,358 |
import json
import os
import re
import unittest2 as unittest
from stacktester import openstack
class ImagesTest(unittest.TestCase):
def setUp(self):
self.os = openstack.Manager()
host = self.os.config.nova.host
port = self.os.config.nova.port
def tearDown(self):
pass
... | rackspace-titan/stacktester | stacktester/tests/test_images.py | Python | apache-2.0 | 2,430 |
# Copyright 2019, The TensorFlow Federated 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 o... | tensorflow/federated | tensorflow_federated/python/core/impl/compiler/tensorflow_computation_factory.py | Python | apache-2.0 | 23,589 |
MAX_DVSWITCH_LENGTH = 60
QS_NAME_PREFIX = 'QS'
VLAN = 'VLAN'
NAME_FORMAT = '{0}_{1}_{2}_{3}_{4}'
class DvPortGroupNameGenerator(object):
@staticmethod
def generate_port_group_name(dv_switch_name, vlan_id, vlan_type):
dv_switch_name = dv_switch_name[:MAX_DVSWITCH_LENGTH]
return NAME_FORMAT.form... | QualiSystems/vCenterShell | package/cloudshell/cp/vcenter/network/dvswitch/name_generator.py | Python | apache-2.0 | 495 |
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import KFold
from xgboost import XGBRegressor
from keras.wrappers.scikit_learn import KerasRegressor
from ionyx import Experiment
from ionyx.contrib.keras_builder import KerasBuilder
from ionyx.datasets import DataSetLoader
print('Beginni... | jdwittenauer/ionyx | tests/experiment_test.py | Python | apache-2.0 | 2,290 |
# Copyright (c) 2013 Rackspace Hosting
#
# 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... | luzheqi1987/nova-annotation | nova/tests/unit/virt/xenapi/test_driver.py | Python | apache-2.0 | 3,973 |
from __future__ import print_function
# Copyright 2017 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 ap... | google/myelin-acorn-electron-hardware | cpu_socket_minispartan_daughterboard/fpga-without-cpu/rom_from_vhdl.py | Python | apache-2.0 | 1,278 |
#!/usr/bin/python2.4
#
# Copyright 2008 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... | ratio/google-app-engine-django | appengine_django/db/base.py | Python | apache-2.0 | 5,014 |
# Copyright (c) 2017-2018, NVIDIA 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 by ... | mlperf/training_results_v0.5 | v0.5.0/nvidia/submission/code/object_detection/pytorch/maskrcnn_benchmark/config/__init__.py | Python | apache-2.0 | 650 |
#!/usr/bin/env python3
#####
#
# Title: ST.py
# Author: Dan Clegg
# Copyright: 2016, Dan Clegg
# LICENSE: Apache 2.0
#
#####
import requests
import string
import urllib3.contrib.pyopenssl # Necessary to get around Python 3 ssl errors when calling an https endpoint
from parse import *
from lxml import etree
def POST(... | danclegg/python-CAS-RESTful-client | ST.py | Python | apache-2.0 | 750 |
# Copyright 2016-2020 The Matrix.org Foundation C.I.C.
# Copyright 2020 Sorunome
#
# 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 ... | matrix-org/synapse | synapse/handlers/room_member.py | Python | apache-2.0 | 72,282 |
# 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 | t5_closed_book_qa/t5_cbqa/tasks.py | Python | apache-2.0 | 11,010 |
import matplotlib.pyplot as plt
import numpy as np
def plot_image(masked_bands, title=None, figsize=(10, 10)):
fig = plt.figure(figsize=figsize)
ax = fig.add_subplot(1, 1, 1)
show(ax, masked_bands)
if title:
ax.set_title(title)
ax.set_axis_off()
def show(axis, bands, alpha=True):
"""... | planetlabs/notebooks | jupyter-notebooks/landsat-ps-comparison/visual.py | Python | apache-2.0 | 1,976 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import gzip
import paddle.v2 as paddle
import network_conf
import reader
from utils import *
def infer(topology, data_dir, model_path, word_dict_path, label_dict_path,
batch_size):
def _infer_a_batch(inferer, test_batch, ids_2_word, id... | zhaopu7/models | text_classification/infer.py | Python | apache-2.0 | 3,061 |
#!/usr/bin/env python
# Copyright (c) 2015 Sergey Bunatyan <sergey.bunatyan@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
#
# Un... | sbunatyan/tavrida | tavrida/proxies.py | Python | apache-2.0 | 5,991 |
"""
Main entry point for the Flask API. The API will provide
"""
# an interface to communicate with Dronekit instances
from flask import jsonify, Flask
from flask import abort, request
from flask import make_response
import dronepool
import threadrunner
app = Flask(__name__)
api_base_url = '/dronesym/api/flask'
# re... | scorelab/DroneSym | dronesym-python/flask-api/src/main.py | Python | apache-2.0 | 2,989 |
#!/usr/bin/env python
#parser {} mode f5config to csv
import sys
import re
REG_IP=re.compile(r'[1-9][0-9]*(\.[0-9]+){3}')
REG_INDENT=re.compile('^[ ]*')
EOF='{'
FOE='}'
""" config for read argv of subcmd"""
BLOCK_SUBCMD = (
"members",
"origins",
"rules",
)
NONBLOCK_SUBCMD = (
... | dkluffy/dkluff-code | code/f5tools/configparse_f5.py | Python | apache-2.0 | 3,488 |
"""This module implements a class that..."""
from __future__ import print_function, unicode_literals
from builtins import range
import logging
from kivy.app import App
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.properties import StringProperty
from kivy.uix.popup import Popup
from MU... | hajicj/MUSCIMarker | MUSCIMarker/mlclass_selection.py | Python | apache-2.0 | 7,891 |
# -*- 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 | samples/generated_samples/dialogflow_v2_generated_entity_types_batch_create_entities_sync.py | Python | apache-2.0 | 1,747 |
import SimpleHTTPServer
import SocketServer
import sys
PORT = 1548
class MyHTTPHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
log_file = open('logfile.txt', 'w')
def log_message(self, format, *args):
self.log_file.write("%s - - [%s] %s\n" %
(self.client_address[0],
... | suensummit/erjsTesting | testServer.py | Python | apache-2.0 | 549 |
# Copyright (c) 2017 Ansible, Inc.
# All Rights Reserved.
from django.conf.urls import url
from awx.api.views import (
JobList,
JobDetail,
JobStart,
JobCancel,
JobRelaunch,
JobCreateSchedule,
JobJobHostSummariesList,
JobJobEventsList,
JobActivityStreamList,
JobStdout,
JobNo... | wwitzel3/awx | awx/api/urls/job.py | Python | apache-2.0 | 1,601 |
# Copyright 2016 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... | google/citest | tests/json_predicate/path_transforms_test.py | Python | apache-2.0 | 1,687 |
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 11 15:04:25 2014
@author: mgaldzic
"""
# Example of Non-unit Stoichiometries
model = '''
model pathway()
S1 + S2 -> 2 S3; k1*S1*S2
3 S3 -> 4 S4 + 6 S5; k2*S3^3
end
'''
import tellurium as te
r = te.loadAntimonyModel(model) | violasox/tellurium | examples/tellurium-files/nonUnitStoichiometries.py | Python | apache-2.0 | 293 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import json
from Libraries.Singleton.Singleton import Singleton
import Libraries.ErrorDefine as ED
from Libraries.DBModel import *
from Platform.ConfigCenter.ConfigCenter import ConfigCenter
from Platform.LogCenter.Lo... | Danceiny/HackGirlfriend | Platform/ZuiwanCenter/ZuiwanDBManager.py | Python | apache-2.0 | 7,371 |
import inspect
import logging
import os
import socket
import subprocess
import sys
import textwrap
import threading
import time
import traceback
import salt.utils.files
import salt.utils.win_runas
import yaml
from tests.support.case import ModuleCase
from tests.support.helpers import with_system_user
from tests.suppor... | saltstack/salt | tests/integration/utils/test_win_runas.py | Python | apache-2.0 | 23,623 |
from aisikl.events import action_event
from .component import Component, is_true
class Action(Component):
def __init__(self, dialog, id, type, parent_id, properties, element):
super().__init__(dialog, id, type, parent_id, properties, element)
self.accessible = properties.get('accessible', True)
... | fmfi-svt/votr | aisikl/components/action.py | Python | apache-2.0 | 2,773 |
# -*- coding: utf-8 -*-
"""
Utility functions, like date conversion and digit conversion
"""
__all__ = [
"Trie",
"arabic_digit_to_thai_digit",
"bahttext",
"collate",
"countthai",
"delete_tone",
"dict_trie",
"digit_to_text",
"display_thai_char",
"emoji_to_thai",
"eng_to_thai... | PyThaiNLP/pythainlp | pythainlp/util/__init__.py | Python | apache-2.0 | 2,215 |
# -*- encoding: utf-8 -*-
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.core.urlresolvers import reverse_lazy
from django.vie... | pkimber/checkout | example_checkout/urls.py | Python | apache-2.0 | 2,467 |
from django.urls import path
from . import views
from adminlte_full.adminlte import config
urlpatterns = [
path('', views.index),
path('', views.index, name=config['ADMINLTE_REGISTRATION_ENDPOINT']),
path('terms/', views.terms),
path('profile/', views.profile, name=config['ADMINLTE_PROFILE_ENDPOINT']... | kyzima-spb/django-adminlte-full | example/demo/urls.py | Python | apache-2.0 | 325 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Lukas Kemmer
#
# 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... | lukas-ke/faint-graphics-editor | build-sys/build_sys/gen_text_expressions.py | Python | apache-2.0 | 4,002 |
# Copyright 2020 The UniqueRandomizer 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 agre... | google-research/unique-randomizer | unique_randomizer/stochastic_beam_search.py | Python | apache-2.0 | 7,609 |
#!/usr/bin/env python
import os
from argparse import ArgumentParser
from threaded_ssh import ThreadedClients
from ServerConfig import Storage
from ServerConfig import TellStore
from ServerConfig import Kudu
from ServerConfig import Cassandra
from ServerConfig import Microbench
def startMBClient(populate = False, uoutF... | tellproject/helper_scripts | mbclient.py | Python | apache-2.0 | 2,085 |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/benchmarks | scripts/tf_cnn_benchmarks/batch_allreduce.py | Python | apache-2.0 | 25,715 |
##
# Copyright (c) 2014-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 | contrib/od/test/test_live.py | Python | apache-2.0 | 14,432 |
# 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... | nathanbjenx/cairis | cairis/gui/ConcernAssociationListCtrl.py | Python | apache-2.0 | 5,001 |
#!/usr/bin/env python
"""
Problem Definition :
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
NOTE: Do not c... | vivekpabani/projecteuler | python/017/problem_017.py | Python | apache-2.0 | 1,758 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | shengwen1994/calvin-base | setup.py | Python | apache-2.0 | 2,480 |
from CTFd import create_app
from CTFd.models import *
from sqlalchemy_utils import database_exists, create_database, drop_database
from sqlalchemy.engine.url import make_url
def create_ctfd(ctf_name="CTFd", name="admin", email="admin@ctfd.io", password="password", setup=True):
app = create_app('CTFd.config.Testin... | semprix/CTFIgniter | payload/CTFd/tests/helpers.py | Python | apache-2.0 | 3,681 |
#!/usr/bin/env python
'''
API v1.0 Command and Control (C2) routes for Mission Control
'''
__author__ = 'Edna Donoughe'
from flask import jsonify
from ooiservices.app.main import api
from ooiservices.app.models import Array
import json
from ooiservices.app.main.errors import bad_request
from ooiservices.app.main.authe... | birdage/ooi-ui-services | ooiservices/app/main/c2_mission.py | Python | apache-2.0 | 9,042 |
# Copyright 2018,2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | sony/nnabla | python/test/function/test_broadcast_to.py | Python | apache-2.0 | 3,832 |
"""
Satellite PostgreSQL database queries
=====================================
This module contains the following parsers:
SatelliteAdminSettings - command ``psql -d foreman -c 'select name, value, "default" from settings where name in (\'destroy_vm_on_host_delete\', \'unregister_delete_host\') --csv'``
------------... | RedHatInsights/insights-core | insights/parsers/satellite_postgresql_query.py | Python | apache-2.0 | 11,542 |
import datetime
from django.contrib.sessions.models import Session
from celery import task
from celery.utils.log import get_task_logger
from brainindex.index import create_thought, update_thought, delete_thought, CREATE, UPDATE, DELETE
logger = get_task_logger(__name__)
@task(ignore_result = True)
def clear_exp... | michaupl/braincloud | brainblog/tasks.py | Python | apache-2.0 | 745 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: mango
@contact: w4n9@sina.com
@create: 16/7/1
hail hydra!
"""
__author__ = "mango"
__version__ = "0.1"
from multiprocessing import Process, Queue
import uuid
def process(q):
"""
test process
"""
content = str(uuid.uuid4())
for i in ra... | w4n9H/PythonSkillTree | Distributed/ProcessThread/LocalProcessQueue.py | Python | apache-2.0 | 752 |
#! /usr/bin/env python
# Python script for the Interoute Virtual Data Centre API:
# Name: dcg_member_listing.py
# Purpose: List the properties and membership of Direct Connect Groups
# Requires: class VDCApiCall in the file vdc_api_call.py
# See the repo: https://github.com/Interoute/API-fun-and-education
#
# You... | Interoute/API-fun-and-education | dcg_member_listing.py | Python | apache-2.0 | 10,474 |
# !/user/bin/python
# -*- coding: utf-8 -*-
#- Author : (DEK) Devendra Kavthekar
# Write a program to generate and print another tuple whose values are
# even numbers in the given tuple (1,2,3,4,5,6,7,8,9,10).
# Hints:
# Use "for" to iterate the tuple
# Use tuple() to generate a tuple from a list.
def main():
v... | dek-odoo/python-samples | python exercises/dek_program043.py | Python | apache-2.0 | 546 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python-sdk | groupdocs/models/CreateFolderResponse.py | Python | apache-2.0 | 1,154 |
# 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, ... | GoogleCloudDataproc/dataprocmagic | googledataprocauthenticator/controllerwidget/createsessionwidget.py | Python | apache-2.0 | 10,212 |
import pytest
import numpy as np
import pandas as pd
from unittest import mock
import os
import yaml
import mlflow.statsmodels
import mlflow.utils
import mlflow.pyfunc.scoring_server as pyfunc_scoring_server
from mlflow import pyfunc
from mlflow.models.utils import _read_example
from mlflow.models import M... | mlflow/mlflow | tests/statsmodels/test_statsmodels_model_export.py | Python | apache-2.0 | 16,600 |
#!/usr/bin/env python3
# Copyright 2020 The gRPC 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 l... | stanley-cheung/grpc | tools/buildgen/extract_metadata_from_bazel_xml.py | Python | apache-2.0 | 46,207 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2011 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | genius1611/horizon | django-openstack/django_openstack/tests/api_tests.py | Python | apache-2.0 | 52,607 |
# -*- coding: utf-8 -*-
"""Definition of modules for collecting data from GRR hosts."""
import datetime
import os
import re
import threading
import time
import zipfile
from grr_api_client import errors as grr_errors
from grr_response_proto import flows_pb2, timeline_pb2
from dftimewolf.lib.collectors.grr_base import... | Onager/dftimewolf | dftimewolf/lib/collectors/grr_hosts.py | Python | apache-2.0 | 22,227 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 30 17:32:10 2017
@author: giangblackk
"""
from osgeo import ogr, osr
import networkx as nx
import numpy as np
def calculateGeometryLength(pointList, sourceSRS, destSRS):
line = ogr.Geometry(ogr.wkbLineString)
transform = osr.CoordinateTran... | Giangblackk/hanoi_road_map_analysis | preprocess/from_road_to_graph.py | Python | apache-2.0 | 8,626 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.engine.platform import Platform
from pants.engine.process import FallibleProcessResult, Process
from pants.testutil.rule_runner import QueryRule, RuleRunner
def test_platform_... | pantsbuild/pants | src/python/pants/engine/platform_test.py | Python | apache-2.0 | 735 |
# 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/map_at_k.py | Python | apache-2.0 | 5,306 |
from src.base.test_cases import TestCases
class ReverseWordsTestCases(TestCases):
def __init__(self):
super(ReverseWordsTestCases, self).__init__()
self.__add_test_case__("Example Test 1", ("the sky is blue"), ("blue is sky the"))
self.__add_test_case__("Test 2", (" "), (""))
self._... | hychrisli/PyAlgorithms | src/tests/part1/q151_test_reverse_words.py | Python | apache-2.0 | 539 |
#!/usr/bin/python
import sys
import keystoneclient.v2_0.client
import glance.context
from glance.openstack.common import cfg
import glance.openstack.common.log as logging
import glance.registry.context
import glance.db.sqlalchemy.api as db_api
LOG = logging.getLogger(__name__)
LOG.addHandler(logging.StreamHandler(... | tylertian/Openstack | openstack F/glance/tools/migrate_image_owners.py | Python | apache-2.0 | 3,200 |
#/***********************************************************************
# * Licensed Materials - Property of IBM
# *
# * IBM SPSS Products: Statistics Common
# *
# * (C) Copyright IBM Corp. 1989, 2020
# *
# * US Government Users Restricted Rights - Use, duplication or disclosure
# * restricted by GSA ADP Schedule Co... | IBMPredictiveAnalytics/GATHERMD | src/GATHERMD.py | Python | apache-2.0 | 14,615 |
from pexpect import pxssh
import ConfigParser
class jobChecker():
config_path = './config.lisa.ini'
s = pxssh.pxssh()
def readConfig(self):
self.config.read(self.config_path)
self.hostname = self.config.get('Credentials', 'hostname')
self.username = self.config.get('Credentials'... | metamarkovic/jobChecker | jobChecker_lisa.py | Python | apache-2.0 | 2,923 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
"""
TR-55 Model Implementation
A mapping between variable/parameter names found in the TR-55 document
and variables used in this program are as follows:
* `precip` is referred to as P... | lliss/tr-55 | tr55/model.py | Python | apache-2.0 | 14,151 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Ericsson AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | EricssonResearch/calvin-base | calvin/runtime/south/calvinlib/mathlib/Arithmetic.py | Python | apache-2.0 | 2,888 |
# -*- 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-channel | samples/generated_samples/cloudchannel_v1_generated_cloud_channel_service_get_channel_partner_link_sync.py | Python | apache-2.0 | 1,520 |
"""Compat module to handle files security on Windows and Linux"""
from __future__ import absolute_import
import errno
import os # pylint: disable=os-module-forbidden
import stat
import sys
from typing import List
try:
import ntsecuritycon
import win32security
import win32con
import win32api
impor... | stweil/letsencrypt | certbot/certbot/compat/filesystem.py | Python | apache-2.0 | 29,674 |
from . import logger
from . import TemplateHelper as TH
from . import RegexHelper as re
from . import Actions as A
from . import ClassActions as CA
from . import SublimeHelper as SH
from .SublimeHelper import ViewHelper as VH
log = logger.get(__name__)
class PropertyAction(A.Action):
"""Stores info on property act... | nchursin/ApexIntentionActions | helpers/PropertyActions.py | Python | apache-2.0 | 6,366 |
#
# Copyright (c) 2013-2019 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 which... | spohnan/geowave | python/src/main/python/pygw/query/vector/vector_query_constraints_factory.py | Python | apache-2.0 | 2,300 |
# -*- coding: utf-8 -*-
'''
Compendium of generic DNS utilities
'''
# Import salt libs
import salt.utils
import socket
# Import python libs
import logging
log = logging.getLogger(__name__)
def __virtual__():
'''
Generic, should work on any platform (including Windows). Functionality
which requires depe... | victorywang80/Maintenance | saltstack/src/salt/modules/dnsutil.py | Python | apache-2.0 | 8,951 |
"""Websocket API for Z-Wave JS."""
import json
from aiohttp import hdrs, web, web_exceptions
import voluptuous as vol
from zwave_js_server import dump
from homeassistant.components import websocket_api
from homeassistant.components.http.view import HomeAssistantView
from homeassistant.components.websocket_api.connect... | turbokongen/home-assistant | homeassistant/components/zwave_js/api.py | Python | apache-2.0 | 8,923 |
__author__ = 'cmantas'
from tools import *
from json import loads
ms = take_single("select metrics from mahout_kmeans_text where k=15 and documents=90300 and dimensions=53235;")[0]
mj = loads(ms)
cols = iter(["#727272", '#f1595f', '#79c36a', '#599ad3', '#f9a65a','#9e66ab','#cd7058', '#d77fb3'])
def timeline2vaslue... | project-asap/IReS-Platform | asap-tools/experiments/depricated/handler/metrics.py | Python | apache-2.0 | 1,434 |
from fingered import *
import random
import csv
import sys
def caac():
records = random.randrange(200,500)
inst3=Xf("r")
inst3.setStats(records,2,(2,records/10),[-1,0],[False,False],0,40000)
inst3.FormData()
inst4=Xf("s")
inst4.setStats(100,2,(2,10),[-1,0],[False,True],0,40000)
inst4.FormData()
print inst3
... | vishnuprathish/constrained-data-generator | file1.py | Python | apache-2.0 | 1,614 |
# 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... | HybridF5/jacket | jacket/api/compute/openstack/compute/legacy_v2/server_metadata.py | Python | apache-2.0 | 7,172 |
#!/usr/bin/env python
""" """
# Script information for the file.
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca)"
__version__ = ""
__date__ = ""
__copyright__ = "Copyright (c) 2011 Hendrix Demers"
__license__ = ""
# Standard library modules.
import unittest
import logging
import os.path
import tempfile
i... | drix00/pymcxray | pymcxray/serialization/test_Serialization.py | Python | apache-2.0 | 6,459 |
#!/usr/bin/python
#
# Copyright 2014 Huawei Technologies Co. Ltd
#
# 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... | kidchang/compassv2-api | bin/query_switch.py | Python | apache-2.0 | 4,969 |
# Copyright (c) 2012-2016, Marco Elver <me AT marcoelver.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 by applica... | melver/bibmanage | lib/python/bibman/commands/sync.py | Python | apache-2.0 | 10,182 |
from rest_framework import serializers as ser
from modularodm.exceptions import ValidationValueError
from api.base.exceptions import InvalidModelValueError
from api.base.serializers import AllowMissing, JSONAPIRelationshipSerializer, HideIfDisabled, \
PrefetchRelationshipsSerializer
from website.models import Use... | acshi/osf.io | api/users/serializers.py | Python | apache-2.0 | 10,270 |
# Copyright 2019 The ROBEL 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... | google-research/robel | robel/dkitty/utils/scripted_reset.py | Python | apache-2.0 | 7,355 |
import sys
import models
import model_utils
import math
import numpy as np
import video_level_models
import tensorflow as tf
import utils
import tensorflow.contrib.slim as slim
from tensorflow import flags
FLAGS = flags.FLAGS
class BiUniLstmModel(models.BaseModel):
def create_model(self, model_input, vocab_size, nu... | wangheda/youtube-8m | youtube-8m-wangheda/all_frame_models/biunilstm_model.py | Python | apache-2.0 | 2,542 |
# 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 agr... | hkumarmk/oslo.messaging | tests/test_exception_serialization.py | Python | apache-2.0 | 11,234 |
# Copyright 2013 NEC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | sebrandon1/tempest | tempest/lib/services/compute/aggregates_client.py | Python | apache-2.0 | 4,901 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | bravomikekilo/mxconsole | mxconsole/util/decorator_utils_test.py | Python | apache-2.0 | 4,173 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from datetime import datetime
from flask_admin.form import DateTimePickerWidget
from wtforms import DateTimeField, SelectField
from flask_wtf import Form
class DateTime... | opensignal/airflow | airflow/www/forms.py | Python | apache-2.0 | 898 |
#!/usr/bin/env python
#===============================================================================
# Copyright 2017 Geoscience Australia
#
# 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... | alex-ip/geophys_utils | geophys_utils/_dem_utils.py | Python | apache-2.0 | 15,195 |
"""
taskmaster.cli.master
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from taskmaster.util import parse_options
from taskmaster.constants import (DEFAULT_LOG_LEVEL,
DEFAULT_ADDRESS, DEFAULT_BUFFER_SIZE)
def run(... | dcramer/taskmaster | src/taskmaster/cli/master.py | Python | apache-2.0 | 1,378 |
#!/usr/bin/env python
# import modules needed
from pprint import pprint as pp
import json, yaml
# initialize list and dict
my_list = []
my_dict = {'key1': 'val1','key2': 'val2', 'key3': {'subkey1': 'subval1', 'subkey2': 'subval2'}}
my_list = range(10)
my_list.append(my_dict)
# dump to json
with open('json.txt', 'w')... | tomjshine/pynet | week1/ex6.py | Python | apache-2.0 | 454 |
# Copyright 2014-2016 Ivan Kravets <me@ikravets.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 by applicable law or... | valeros/platformio | platformio/platforms/linux_x86_64.py | Python | apache-2.0 | 1,419 |
from typing import List
import numpy as np
import functools
from federatedml.ensemble.boosting.hetero.hetero_secureboost_guest import HeteroSecureBoostingTreeGuest
from federatedml.param.boosting_param import HeteroFastSecureBoostParam
from federatedml.ensemble.basic_algorithms import HeteroFastDecisionTreeGuest
from f... | FederatedAI/FATE | python/federatedml/ensemble/boosting/hetero/hetero_fast_secureboost_guest.py | Python | apache-2.0 | 8,618 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | openstack/neutron-lib | neutron_lib/tests/unit/db/test_model_query.py | Python | apache-2.0 | 2,803 |
# File to calculate properties for a molecule and add these properties back to the molecules
# property to be calculate will be put in using a request.header string
from java import lang
from com.im.lac.types import MoleculeObject, MoleculeObjectIterable
lang.System.loadLibrary('GraphMolWrap')
from org.RDKit import *
i... | InformaticsMatters/squonk | components/rdkit-camel/src/main/python/find_props/find_props.py | Python | apache-2.0 | 1,538 |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | openstack/tacker | tacker/tests/functional/sol_kubernetes/vnflcm/test_kubernetes_multi_ns.py | Python | apache-2.0 | 6,554 |
# Generated by Django 3.1.6 on 2021-04-06 07:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("cases", "0002_auto_20210305_1248"),
]
operations = [
migrations.AlterField(
model_name="rawimageuploadsession",
name... | comic/comic-django | app/grandchallenge/cases/migrations/0003_auto_20210406_0753.py | Python | apache-2.0 | 738 |
# -*- coding: utf-8 -*-
"""
ecoop
====
ecoop_ utility functions to automatize the building of the Ecosystem Status Report for the NE-LME.
.. _ecoop: https://github.com/epifanio/ecoop
.. _ecoop-project: http://tw.rpi.edu/web/project/ECOOP
"""
from distutils.core import setup
import os
import sys
import subprocess
i... | tetherless-world/ecoop | pyecoop/setup.py | Python | apache-2.0 | 4,856 |
"""
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 this ... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/ZOOKEEPER/package/scripts/zookeeper_server.py | Python | apache-2.0 | 6,914 |
eight_layer = Font.glyphs["eight-qs"].layers[0]
i_layer = Font.glyphs['i-qs'].layers[0] = eight_layer.copyDecomposedLayer()
XHEIGHT = 500
WIDTH = 600
for path in i_layer.paths:
for node in path.nodes:
# mess with node.x and node.y
node.x = WIDTH - node.x
| adiabatic/abbots-morton-experiment | glyph-generation scripts/eight2i.py | Python | apache-2.0 | 277 |
"""
hashdd_filemagic.py
@brad_anton
License:
Copyright 2015 hashdd.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 by applicable l... | hashdd/pyhashdd | hashdd/features/hashdd_filemagic.py | Python | apache-2.0 | 872 |
# 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... | briancurtin/python-openstacksdk | examples/image/delete.py | Python | apache-2.0 | 928 |
from mock import MagicMock
import docker.errors
from requests.exceptions import ConnectionError
import datetime
class ClientMock():
def __init__(self):
def __logs(i, stream=False):
if stream:
return ("this is line {}".format(l) for l in xrange(1, 100))
else:
... | hmrc/captain | captain/tests/util_mock.py | Python | apache-2.0 | 36,205 |
# -*- coding: utf-8 -*-
#
# Google Cloud Bigtable documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 24 16:48:39 2015.
#
# 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
# autogenerat... | joerideturck/gcloud-python-bigtable | docs/conf.py | Python | apache-2.0 | 11,326 |
#!/usr/bin/env python3
###
###
###
### Jesse Leigh Patsolic
### 2017 <jpatsol1@jhu.edu>
### S.D.G
#
import argparse
from intern.remote.boss import BossRemote
from intern.resource.boss.resource import *
from intern.utils.parallel import block_compute
import configparser
import requests
import numpy as np
from numpy ... | neurodata/synaptome-stats | collman15v2/201710/annoStats.py | Python | apache-2.0 | 8,903 |
#!/usr/bin/env python2.7
'''
Copyright 2018 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 t... | kubeflow/examples | mnist/web-ui/mnist_client.py | Python | apache-2.0 | 3,348 |