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 |
|---|---|---|---|---|---|
PROVIDERS = [
'allauth.socialaccount.providers.bitbucket',
'allauth.socialaccount.providers.github',
'allauth.socialaccount.providers.google'
]
SOCIALACCOUNT_PROVIDERS = \
{'facebook':
{'SCOPE': ['email', 'public_profile', 'user_friends'],
'AUTH_PARAMS': {'auth_type': 'reauthenticate'},
... | leonardo-modules/leonardo-module-auth | leonardo_module_oauth/settings.py | Python | apache-2.0 | 578 |
from django import template
from django.db import models
from django.db.models import Count
from templatetag_sugar.register import tag
from templatetag_sugar.parser import Name, Variable, Constant, Optional, Model
from taggit.managers import TaggableManager
from taggit.models import TaggedItem, Tag
from taggit_templa... | Venturi/oldcms | env/lib/python2.7/site-packages/taggit_templatetags/templatetags/taggit_extras.py | Python | apache-2.0 | 2,775 |
from model.user import User
from random import randrange
def test_modify_user(app):
if app.user.count() == 0:
app.user.create(User(firstname="Mikhail"))
old_users = app.user.get_user_list()
index = randrange(len(old_users))
user = User(firstname="new_name1")
user.id = old_users[index].id
... | kovernik/python_training | test/test_modify_user.py | Python | apache-2.0 | 569 |
def add_data_source(dashboard, datasource):
"""Attach a Grafana data source to all panels in a dashboard."""
for row in dashboard.rows:
for panel in row.panels:
setattr(panel, "dataSource", datasource)
return dashboard
| google/grr | monitoring/grafana/grr_grafanalib_dashboards/util.py | Python | apache-2.0 | 235 |
'''
Created on 13.11.2013
@author: northernstars
'''
from os import listdir, getcwd
from os.path import isfile, isdir
from math import sqrt, atan2, degrees, radians, cos, sin, atan
from cv2 import imread, cvtColor, threshold, getRotationMatrix2D, warpAffine, findContours
from cv2 import arcLength, approxPolyDP, conve... | NorthernStars/MR-Vision | mrVision/src/mrVision/imageLibs/markerrecognition.py | Python | apache-2.0 | 8,172 |
'''
Copyright (C) 2005-17 www.interpss.org
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 b... | interpss/DeepMachineLearning | ipss.dml/py/c_graph/single_net_random/predict_branch_q_random.py | Python | apache-2.0 | 3,216 |
# -*- coding: utf-8 -*-
import datetime
class Deltagare:
id = ""
Foernamn = ""
Efternamn = ""
Personnummer = ""
Ledare = False
Epost = ""
MobilNr = ""
Attending = True
def __init__(self, id, Foernamn, Efternamn, Personnummer, ledare, epost="", mobilNr="", attending=True):
... | martin-green/skojjt | sensus.py | Python | apache-2.0 | 2,922 |
__source__ = 'https://leetcode.com/problems/exclusive-time-of-functions/'
# Time: O(n)
# Space: O(n)
#
# Description: Leetcode # Exclusive Time of Functions
#
# Given the running logs of n functions that are executed in a nonpreemptive single threaded CPU,
# find the exclusive time of these functions.
#
# Each functio... | JulyKikuAkita/PythonPrac | cs15211/ExclusiveTimeOfFunctions.py | Python | apache-2.0 | 10,188 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2014-11-24 22:27:45
import sys
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname... | nicozhang/pyspider | setup.py | Python | apache-2.0 | 3,503 |
# -*- coding:utf-8 -*-
# Copyright 2015 NEC Corporation. #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); #
# you may not use this file except in compliance with the License... | y-higuchi/odenos | src/test/python/org/o3project/odenos/remoteobject/transport/test_message_dispatcher.py | Python | apache-2.0 | 38,107 |
#!/usr/bin/env python
"""
Send email in Python
"""
import ConfigParser
import smtplib
import sys
def str2list(s):
# Helper function for sendemail()
# If input is a string, convert it to list.
# If it is a list, keep it as is
if type(s) is str:
return [s]
elif type(s) is list:
return... | lijunxyz/codedrop | sendemail/sendemail.py | Python | apache-2.0 | 2,730 |
"""Tests for cli"""
import contextlib
import io
import itertools
import json
import random
import subprocess
import sys
import traceback
from os import path
from unittest import mock
import numpy as np
import pytest
from egtaonline import api
from egtaonline import mockserver
from gameanalysis import gamegen
from game... | egtaonline/quiesce | test/test_script.py | Python | apache-2.0 | 20,077 |
from sklearn import *
import sklearn
import pandas as pd
import numpy as np
import xgboost as xgb
import lightgbm as lgb
from time import gmtime, strftime
import numpy.random as rng
from multiprocessing.dummy import Pool
import h5py
import concurrent.futures
from sklearn.cross_validation import KFold
from keras.model... | ifuding/Kaggle | PMRCN/Code/fd.py | Python | apache-2.0 | 21,036 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleapis/python-bigquery | google/cloud/bigquery/format_options.py | Python | apache-2.0 | 4,402 |
import pytest
from selenium import webdriver
from webdriver.page_objects import PageObjectContainer
from webdriver.test_connect_page import TestCase
class TestHawtioLogsPage(TestCase):
@pytest.fixture(autouse=True)
def setup(self, base_url: str, console_ip: str, pages: PageObjectContainer, selenium: webdrive... | jdanekrh/dispatch-console-tests | webdriver/test_hawtio_logs_page.py | Python | apache-2.0 | 1,032 |
from pyramid.settings import aslist
from .. import __version__
MONITOR_BUCKET = "monitor"
MONITOR_BUCKET_PATH = "/buckets/{}".format(MONITOR_BUCKET)
CHANGES_COLLECTION = "changes"
CHANGES_COLLECTION_PATH = "{}/collections/{}".format(
MONITOR_BUCKET_PATH, CHANGES_COLLECTION
)
CHANGES_RECORDS_PATH = "{}/records".f... | mozilla-services/kinto-dist | kinto-remote-settings/src/kinto_remote_settings/changes/__init__.py | Python | apache-2.0 | 996 |
# Copyright 2017 Calico 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, ... | calico/basenji | basenji/gene.py | Python | apache-2.0 | 3,501 |
# 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/models_sub/__init__.py | Python | apache-2.0 | 634 |
# import Jsoup
from urllib import quote, quote_plus
#from org.jsoup import Jsoup
import requests
#from BeautifulSoup import BeautifulSoup
from bs4 import BeautifulSoup
from urlparse import urljoin
def html(html):
return [BeautifulSoup(html, "html.parser")]
class AbstractParser:
def __init__(self):
#self.url = u... | facoy/facoy | Evaluation/SEParser_soup.py | Python | apache-2.0 | 7,864 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from numpy.testing import assert_approx_equal, assert_allclose
from UliEngineering.Physics.RF import *
from UliEngineering.EngineerIO import auto_format
import numpy as np
import unittest
class TestRF(unittest.TestCase):
def test_quality_factor(self):
assert_a... | ulikoehler/UliEngineering | tests/Physics/TestRF.py | Python | apache-2.0 | 1,106 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [('auvsi_suas', '0011_remove_ir'), ]
operations = [
migrations.CreateModel(
name='MissionClockEvent',
fields=[
... | justineaster/interop | server/auvsi_suas/migrations/0012_missionclockevent.py | Python | apache-2.0 | 828 |
"""This platform allows several lights to be grouped into one light."""
import asyncio
from collections import Counter
import itertools
from typing import Any, Callable, Iterator, List, Optional, Tuple, cast
import voluptuous as vol
from homeassistant.components import light
from homeassistant.components.light import... | GenericStudent/home-assistant | homeassistant/components/group/light.py | Python | apache-2.0 | 11,779 |
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | bigswitch/neutron | neutron/plugins/ml2/drivers/type_gre.py | Python | apache-2.0 | 3,251 |
# -*- 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-securitycenter | samples/generated_samples/securitycenter_v1p1beta1_generated_security_center_test_iam_permissions_sync.py | Python | apache-2.0 | 1,628 |
# Copyright (c) 2017-2019 Uber Technologies, Inc.
# SPDX-License-Identifier: Apache-2.0
import math
import pytest
import torch
from torch.nn.functional import pad
import pyro.distributions as dist
from pyro.distributions.util import broadcast_shape
from pyro.ops.gamma_gaussian import (
GammaGaussian,
gamma_a... | uber/pyro | tests/ops/test_gamma_gaussian.py | Python | apache-2.0 | 12,361 |
# Generated by Django 2.2.13 on 2020-07-18 09:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('comments', '0004_auto_20180528_1554'),
]
operations = [
migrations.AlterField(
model_name='diventicomment',
name='l... | flavoi/diventi | diventi/comments/migrations/0005_auto_20200718_1151.py | Python | apache-2.0 | 748 |
#! /usr/bin/env python3
# -*- 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 requi... | googleapis/python-area120-tables | scripts/fixup_tables_v1alpha1_keywords.py | Python | apache-2.0 | 6,502 |
# -*- coding: utf-8 -*-
"""
Unit tests for the da.util.daemon module.
---
type:
python_module
validation_level:
v00_minimum
protection:
k00_public
copyright:
"Copyright 2016 High Integrity Artificial Intelligence Systems"
license:
"Licensed under the Apache License, Version 2.0 (the License);
... | wtpayne/hiai | a3_src/h70_internal/da/util/spec/spec_daemon.py | Python | apache-2.0 | 1,672 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | skuda/client-python | kubernetes/test/test_v1_service_account.py | Python | apache-2.0 | 867 |
import pytest
from awx.main.models import SystemJobTemplate
@pytest.mark.parametrize("extra_data", [
'{ "days": 1 }',
'{ "days": 100 }',
'{ "days": 0 }',
{"days": 0},
{"days": 1},
{"days": 13435},
])
def test_valid__clean_extra_data_system_jobs(extra_data):
accepted, rejected, errors = Sy... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/tests/unit/models/test_system_jobs.py | Python | apache-2.0 | 1,947 |
# 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... | akshayms/eho | eho/server/middleware/auth_valid.py | Python | apache-2.0 | 2,226 |
from cyborg import Page, Scraper
class TakeawayScraper(Scraper):
def scrape(self, data, response):
for place_div in response.find("div.restaurant"):
if place_div.has_class("offlineRestaurant"):
continue
header_link = place_div.get("h2 a")
header_id = in... | hzxscyq/cyborg | example/scrapers/justeat/takeaway.py | Python | apache-2.0 | 426 |
# -*- 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-dialogflow | samples/generated_samples/dialogflow_generated_dialogflow_v2_intents_list_intents_sync.py | Python | apache-2.0 | 1,494 |
# Copyright 2017 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 acc... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/sockeye/sockeye/lexicon.py | Python | apache-2.0 | 14,849 |
# Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | yeming233/rally | rally/plugins/openstack/cfg/senlin.py | Python | apache-2.0 | 836 |
# Copyright 2011 Justin Santa Barbara
# 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... | bswartz/cinder | cinder/api/v1/snapshots.py | Python | apache-2.0 | 6,922 |
# coding: utf-8
#
# Copyright 2021 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | kevinlee12/oppia | core/domain/blog_services_test.py | Python | apache-2.0 | 19,579 |
# 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/input_preprocessors.py | Python | apache-2.0 | 138,042 |
#! /usr/bin/python
"""
Name : UEFtrans.py
Author : David Boddie <david@boddie.net>
Created : Sun 08th July 2001
Last updated : Thu 26th July 2001
Purpose : Catalogue UEF archives or add and remove files.
WWW : http://www.david.boddie.net/Software/Python/UEFtrans/
History:
0.10 (Wed 11th July 2001)
Fi... | google/myelin-acorn-electron-hardware | third_party/uef-utils/UEFtrans.py | Python | apache-2.0 | 51,007 |
# 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 ... | curoverse/libcloud | libcloud/dns/types.py | Python | apache-2.0 | 3,618 |
raise DeprecationWarning("ray.sgd has been moved to ray.train.")
| ray-project/ray | python/ray/sgd/__init__.py | Python | apache-2.0 | 66 |
import json
from gputils import *
from whois import read_aliases
from country import read_countries
from pagelang import CountrylangProvider
domain_coords = json.load(open(get_data_path('wikidata.json')))
aliases = read_aliases()
countries = read_countries()
def write_json(var_name, data, path):
f = gp_open(path... | shilad/geo-provenance | py/make_js.py | Python | apache-2.0 | 1,295 |
from copy import copy
from .base import Algorithm
class FIFOAlgorithm(Algorithm):
def compute(self):
table = []
cache = []
data = self.data[::-1]
while len(data):
item = data.pop()
if item not in cache:
if len(cache) == self.cache_size:
... | vtemian/uni-west | second_year/os/exams/round2/paging/algorithms/fifo.py | Python | apache-2.0 | 448 |
# 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 applic... | tensorflow/io | tests/test_documentation.py | Python | apache-2.0 | 1,660 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | aselle/tensorflow | tensorflow/python/framework/ops.py | Python | apache-2.0 | 222,504 |
import traceback
import itertools
import json as rapidjson
import logging
import pytz
from datetime import datetime
BUILTIN_ATTRS = {
'args', 'asctime', 'created', 'exc_info', 'exc_text', 'filename',
'funcName', 'levelname', 'levelno', 'lineno', 'module', 'msecs',
'message', 'msg', 'name', 'pathname', 'pr... | jellybean4/yosaipy2 | yosaipy2/core/logging/formatters.py | Python | apache-2.0 | 2,681 |
"""Matplotlib Posterior predictive plot."""
import logging
import platform
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import animation, get_backend
from ....stats.density_utils import get_bins, histogram, kde
from ...kdeplot import plot_kde
from ...plot_utils import _scale_fig_size
from . impo... | arviz-devs/arviz | arviz/plots/backends/matplotlib/ppcplot.py | Python | apache-2.0 | 15,729 |
"""
This code was generated by Codezu.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
"""
from mozurestsdk.mozuclient import default as default_client
from mozurestsdk.mozuurl import MozuUrl;
from mozurestsdk.urllocation import UrlLocation
from mozure... | sanjaymandadi/mozu-python-sdk | mozurestsdk/commerce/customer/customeraccount.py | Python | apache-2.0 | 14,160 |
from clint.textui import progress
import requests
import os
import sys
import tarfile
import floyd
from floyd.cli.utils import get_cli_version
from floyd.manager.auth_config import AuthConfigManager
from floyd.exceptions import (AuthenticationException, AuthorizationException,
BadGatewayE... | mckayward/floyd-cli | floyd/client/base.py | Python | apache-2.0 | 7,084 |
import os
import sys
import spacy
import argparse
import collections
import logging
import numpy as np
parser = argparse.ArgumentParser(
description="Generates a new set of vectors corresponding to a "
"vocabulary and dumps it into a file called `w2v.npy`."
" For any give word, if ... | mindgarage/Ovation | tools/load_w2v.py | Python | apache-2.0 | 1,179 |
from histogram_hash import *
import matplotlib.pyplot as plt
if __name__ == '__main__':
num_bins = 16
# result = histogram_matrix("data/red.jpg", num_bins=num_bins)
# result = histogram_matrix("data/green.jpg", num_bins=num_bins)
# result = histogram_matrix("data/blue.jpg", num_bins=num_bins)
resu... | scirag/elastic-search-image-indexing | example2.py | Python | apache-2.0 | 1,134 |
# 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... | cloudera/Impala | tests/custom_cluster/test_insert_behaviour.py | Python | apache-2.0 | 5,841 |
#!/usr/bin/env python
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License");... | zouzhberk/ambaridemo | demo-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py | Python | apache-2.0 | 14,338 |
# Copyright (c) 2015 App Annie Inc. All rights reserved.
from random import randint
from collections import OrderedDict
from bitarray import bitarray
def serialize(L, zip=True):
m = MinSpace(L)
return m.convert()
class MinSpace(object):
def __init__(self, input_list, flag_len=2, flag_step=[4, 5, 6, 13]):... | szhang-aa/hbase_save_store | min_space.py | Python | apache-2.0 | 4,051 |
# Foremast - Pipeline Tooling
#
# Copyright 2018 Gogo, 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... | gogoair/foremast | src/foremast/dns/__main__.py | Python | apache-2.0 | 1,646 |
#
# 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... | apache/incubator-airflow | airflow/sensors/time_delta.py | Python | apache-2.0 | 2,207 |
# -*- coding: utf-8 -*-
# code-10.py
"""
Dependência: Matplotlib, NumPy, NetworkX
Executar no prompt: pip install matplotlib
Executar no prompt: pip install numpy
Executar no prompt: pip install scipy
Executar no prompt: pip install networkx
*** Atenção:
Este arquivo deverá executado no mesmo diretório do arquivo lesm... | franciscomoura/data-science-and-bigdata | introducao-linguagens-estatisticas/mineracao-dados-python/codigo-fonte/code-10.py | Python | apache-2.0 | 1,161 |
import os
from flask import Flask
from flask.ext.bootstrap import Bootstrap
from flask import render_template
from flaskext.markdown import Markdown
app = Flask(__name__)
Bootstrap(app)
Markdown(app)
VERSION=0.1
@app.route("/")
def hello():
welcome_path = "{}/markdown/welcome.md".format(os.path.dirname(__file__... | nsg/tachyon | app/app.py | Python | apache-2.0 | 524 |
# Copyright 2022 The Magenta 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 ... | magenta/note-seq | note_seq/melodies_lib_test.py | Python | apache-2.0 | 18,215 |
import base64
import jobs
import bottle
import json
import time
import uuid
import re
import picarus_takeout
import functools
import msgpack
from driver import PicarusManager
from parameters import PARAM_SCHEMAS_SERVE
from model_factories import FACTORIES
# These need to be set before using this module
thrift_lock = N... | bwhite/picarus | server/tables.py | Python | apache-2.0 | 38,204 |
################################################################################
# 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... | greghogan/flink | flink-python/pyflink/table/expressions.py | Python | apache-2.0 | 19,340 |
# Copyright 2013 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 ... | wavemind/gcb17ml | tests/functional/model_models.py | Python | apache-2.0 | 25,805 |
#!/usr/bin/env python
import shlex
import subprocess
import logging
import os
import fcntl
import select
import time
class InteractiveProcess(object):
def __init__(self, cmds, **kwargs):
timeout = kwargs.pop('timeout', -1)
if timeout > 0:
cmds = ['timeout', '--signal=KILL', '%ds' % t... | Zexi/vbmc-qemu | virtbmc/procutils.py | Python | apache-2.0 | 4,611 |
# coding=utf-8
import pyglfw.pyglfw as glfw
from OpenGL.GL import *
from math import *
class Render(object):
def __init__(self, viewport):
glDisable(GL_DEPTH_TEST)
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
def __call__(self, *args):
... | lhl/vrdev | 002-pyopengl/examples/drawing.py | Python | apache-2.0 | 2,951 |
# 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, ... | FeliciaLim/oss-fuzz | infra/cifuzz/fuzz_target_test.py | Python | apache-2.0 | 15,284 |
# 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, ... | kubeflow/kfp-tekton-backend | sdk/python/tests/dsl/component_bridge_tests.py | Python | apache-2.0 | 8,135 |
from colorama import Fore, Style
from orcid import PublicAPI
__author__ = 'cwilli34'
class OrcidSearchResults:
"""Using the Orcid Public API."""
def __init__(self, sandbox=False):
"""Initialize public API for class.
Parameters
----------
:param sandbox: boolean
... | crcresearch/orcidfind | orcidsearch/search.py | Python | apache-2.0 | 10,295 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Piston Cloud Computing, Inc.
# Copyright 2012-2013 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | ruslanloman/nova | nova/compute/api.py | Python | apache-2.0 | 186,283 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import unittest
fro... | pgroudas/pants | tests/python/pants_test/subsystem/test_subsystem.py | Python | apache-2.0 | 1,420 |
import logging
logger = logging.getLogger("xml2kinto")
| mozilla-services/xml2kinto | xml2kinto/logger.py | Python | apache-2.0 | 56 |
# -*- coding: utf-8-*-
import os
import sys
import logging
import yaml
import re
from lib.voice.baseVoice import AbstractVoiceEngine
import lib.appPath
def create_daemon(daemon_callback=None,args=()):
'''
创建守护进程,daemon_callback 为运行守护进程的函数, args为对应运行函数参数
'''
#产生子进程,而后父进程退出
try:
if os.fork(... | weedge/doubanFmSpeackerPi | lib/util.py | Python | apache-2.0 | 3,647 |
#
# 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... | apache/incubator-airflow | airflow/providers/google/cloud/example_dags/example_spanner.py | Python | apache-2.0 | 8,373 |
# 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... | tonybaloney/st2 | st2tests/st2tests/action_aliases.py | Python | apache-2.0 | 5,319 |
import ibis.expr.types as ir
import ibis.expr.operations as ops
import ibis.util as util
import ibis.common as com
def _list_to_tuple(x):
if isinstance(x, list):
x = tuple(x)
return x
class Window(object):
"""
A generic window function clause, patterned after SQL window clauses for
the ... | deepfield/ibis | ibis/expr/window.py | Python | apache-2.0 | 10,684 |
from discomll import dataset
from discomll.ensemble import distributed_weighted_forest_rand
train = dataset.Data(data_tag=["http://ropot.ijs.si/data/lymphography/train/xaaaaa.gz",
"http://ropot.ijs.si/data/lymphography/train/xaaabj.gz"],
data_type="gzip",
... | romanorac/discomll | discomll/examples/big_data/dwfr_lymphography.py | Python | apache-2.0 | 1,627 |
# -*- coding: utf-8 -*-
from multiprocessing import Process, Queue
import time, random
def write(q):
for value in ['A', 'B', 'C']:
print 'Put %s to queue...' % value
q.put(value)
time.sleep(random.random())
def read(q):
while True:
value = q.get(True)
print 'Get %s fr... | hewentian/python-learning | src/python27/progress_thread/queue.py | Python | apache-2.0 | 529 |
import codecs
from config import *
import sys, simplejson as json
import MySQLdb as mdb
USAGE = '''
Usage: LyricJam.py {scrape|import} arg
Examples:
import file.json
Import file.json into the lyric database
'''
class LyricJam:
def __init__(self):
self.con = mdb.connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, ... | iwxfer/pycrap | LyricJam.py | Python | apache-2.0 | 3,861 |
# sort langs files
import os
for file in os.listdir("."):
if not "lang" in file or file.split(".")[-1] <> "py": continue
f = open(file, "r")
lines, part1, part2, part3 = [], [], [], []
if not len(f.readlines()) > 1:
for line in f.readlines():
for line in line.split("\r"):
... | mcolombo87/OrangeInstaller | OrangeInstaller/OrangeInstaller/languages/sortLangs.py | Python | apache-2.0 | 811 |
# -*- 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 | airflow/gcp/operators/bigtable.py | Python | apache-2.0 | 19,439 |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/google-auth-library-python | noxfile.py | Python | apache-2.0 | 4,700 |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | google/uncertainty-baselines | baselines/diabetic_retinopathy_detection/utils/metric_utils.py | Python | apache-2.0 | 10,351 |
'''
Created on 23 juin 2013
Function to write a e-mail
@author: dgourillon
'''
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
import time
gmail_user = "mail.ccmd@gmail.com"
gmail... | Northshoot/maestro | master/mail_sender.py | Python | apache-2.0 | 1,460 |
#!/usr/bin/env python
import logging
import os
import struct
import sys
from pif_ir.bir.instance import BirInstance
from pif_ir.bir.utils.exceptions import BIRError
logging.basicConfig(level=logging.INFO)
logging.info("RUNNING TEST: %s" % __file__)
def transmit_packet(out_port, packet):
pass
if len(sys.argv) > ... | OpenNetworkingFoundation/PIF-Open-Intermediate-Representation | pif_ir/bir/tests/test_instance.py | Python | apache-2.0 | 1,377 |
import numpy as np
from emukit.test_functions import sixhumpcamel_function
def test_sixhumpcamel_minima():
"""
Test some known values at minima
"""
sixhumpcamel, _ = sixhumpcamel_function()
minimum = -1.0316 # value of function at minima
assert np.isclose(sixhumpcamel(np.array([[0.0898, -0.7... | EmuKit/emukit | tests/emukit/test_functions/test_sixhumpcamel.py | Python | apache-2.0 | 695 |
import tweepy
import api_keys
import json
import argparse
import argcomplete
auth = tweepy.OAuthHandler(api_keys.consumer_key, api_keys.consumer_secret)
auth.set_access_token(api_keys.access_token, api_keys.access_secret)
api = tweepy.API(auth,wait_on_rate_limit=True)
parser = argparse.ArgumentParser(description='... | motazsaad/tweets-collector | tweepy_search.py | Python | apache-2.0 | 1,481 |
# 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... | eharney/cinder | cinder/tests/unit/volume/drivers/test_lvm_driver.py | Python | apache-2.0 | 47,734 |
from vtke.data_array import DataArray
def test_serialize_data_ascii():
da = DataArray()
da.type = 'Int32'
da.format = 'ascii'
da.data = (12, 213, 34)
assert da._serialize_data() == '12 213 34'
def test_serialize_data_binary_ints():
da = DataArray()
da.type = 'Int64'
da.format = 'bin... | KE-works/vtke | tests/test_data_array.py | Python | apache-2.0 | 1,710 |
#! Python3
# PhoneAndEmail.py - Find phone numbers (in US format) and emails in a buffer.
import pyperclip, re
phoneRegex = re.compile(r'''(
(\d{3}|\(\d{3}\))? # country code
(\s|-|\.)? # separator
(\d{3}) # first three digits
(\s... | 0verchenko/Utils | PhoneAndEmail.py | Python | apache-2.0 | 1,247 |
import importlib
# Note that we delay import of app to the functions which need it,
# since we may want to load plugins during app creation too, and otherwise
# we'd get circular import problems
class PluginException(Exception):
pass
def load_class_raw(classpath):
modpath = ".".join(classpath.split(".")[:-1]... | JiscPER/magnificent-octopus | octopus/lib/plugin.py | Python | apache-2.0 | 1,917 |
# -*- 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, soft... | devdattakulkarni/test-solum | functionaltests/api/camp/v1_1/test_platform.py | Python | apache-2.0 | 3,247 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2012-2013 eNovance <licensing@enovance.com>
#
# Author: Julien Danjou <julien@danjou.info>
#
# 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
#
# h... | rackerlabs/instrumented-ceilometer | ceilometer/central/manager.py | Python | apache-2.0 | 3,092 |
# encoding: utf8
from __future__ import unicode_literals
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
PermissionsMixin,
)
from django.db import models
from imagekit.models import ImageSpecField, ProcessedImageField
from imagekit.processors import ResizeToFill
from brasilcomv... | brasilcomvc/brasilcomvc | brasilcomvc/accounts/models.py | Python | apache-2.0 | 3,641 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright © 2012 eNovance <licensing@enovance.com>
#
# Author: Julien Danjou <julien@danjou.info>
#
# 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 Lice... | rackerlabs/instrumented-ceilometer | ceilometer/tests/objectstore/test_swift_middleware.py | Python | apache-2.0 | 12,296 |
from flask_httpauth import HTTPBasicAuth
from ..models import Node
auth = HTTPBasicAuth()
@auth.verify_password
def verify_password(username, password):
node = Node.query.filter_by(username=username).first()
if node is None:
return False
if node.verify_access():
return node.verify_password(password)
else:
r... | CMPUT404W16/social-dist | fbook/api/bauth.py | Python | apache-2.0 | 332 |
# Copyright 2018 The Batfish Open Source Project
#
# 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... | batfish/pybatfish | tests/client/test_resthelper.py | Python | apache-2.0 | 1,380 |
# the model gets created
# in this file specific layers can be defined and changed
# the default data contains 40 x 1200 x 3 data as defined by the input dataformat
# if the data for test and validation is change the first layer format can change
# model contains a sequential keras model that can be applied with differ... | alex-ta/Fontinator | NeuralNet/Alex/models/model_09.py | Python | apache-2.0 | 947 |
# Copyright (c) 2017 Orange.
# 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 a... | openstack/networking-bgpvpn | bgpvpn_dashboard/dashboards/project/bgpvpn/tabs.py | Python | apache-2.0 | 2,049 |
# 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 the... | mrunge/openstack_horizon | openstack_horizon/dashboards/project/data_processing/nodegroup_templates/panel.py | Python | apache-2.0 | 932 |
__all__ = ['twitt_bot.py', 'book_quotes_bot.py', 'quotes_twitt_bot'] | Devgrapher/quotes_twitt_bot | src/__init__.py | Python | apache-2.0 | 68 |
# 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 | ForgeChat/forgechat/tests/functional/test_root.py | Python | apache-2.0 | 1,083 |