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 |
|---|---|---|---|---|---|
# Github-flavored markdown parsing
# Thanks to http://blog.freedomsponsors.org/markdown_formatting/
import itertools
import misaka
from markupsafe import Markup
from pygments import highlight
from pygments.formatters.html import HtmlFormatter
from pygments.lexers import get_lexer_by_name
from pygments.util import Clas... | daboross/dabo.guru | content/util/gh_markdown.py | Python | apache-2.0 | 2,238 |
"""Allow users to set and activate scenes."""
import importlib
import logging
import voluptuous as vol
from homeassistant.const import CONF_PLATFORM, SERVICE_TURN_ON
from homeassistant.core import DOMAIN as HA_DOMAIN
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity_component import En... | leppa/home-assistant | homeassistant/components/scene/__init__.py | Python | apache-2.0 | 2,906 |
"""
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.
Example:
Input: [1,2,1,3,2,5]
Output: [3,5]
Note:
The order of the result is not important. So in the above example, [5, 3] is also correct... | danielsunzhongyuan/my_leetcode_in_python | single_number_iii_260.py | Python | apache-2.0 | 781 |
__author__ = 'saeedamen' # Saeed Amen
#
# Copyright 2016-2020 Cuemacro - https://www.cuemacro.com / @cuemacro
#
# 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/LI... | cuemacro/finmarketpy | finmarketpy/curve/volatility/fxoptionspricer.py | Python | apache-2.0 | 13,613 |
#!/usr/bin/env python2.5
#
# Copyright 2009 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/gci/models/task.py | Python | apache-2.0 | 12,127 |
# 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 os
import tim... | UnrememberMe/pants | contrib/go/tests/python/pants_test/contrib/go/tasks/test_go_compile.py | Python | apache-2.0 | 4,270 |
# licensed under the Apache License 2.0
# github.com/masoncodes
# masoncodes.me
import os
import shutil
print("This installer is PROOF OF CONCEPT AND IS NOT REQUIRED TO BE RUN.")
print("Before you begin, please ensure you have downloaded the latest version of masonCLI.")
print("Where should masonCLI be insta... | masoncodes/masonCLI | installer.py | Python | apache-2.0 | 699 |
import json
import gzip as gz
class TextCleaner(object):
def __init__(self):
characters_to_replace = ',.&!+:;?"#()\'*+,./<=>@[\\]^_`{|}~\n'
self.remove_white_map = dict((ord(char), u' ') for char in characters_to_replace)
def clean_text(self, text):
"""
Replaces some character... | benbo/QPR_CP1 | load_data.py | Python | apache-2.0 | 2,364 |
# 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... | quantumlib/OpenFermion-FQE | src/fqe/lib/linalg.py | Python | apache-2.0 | 2,498 |
#!/usr/bin/python
#
# Copyright 2008 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 app... | kdlucas/pyrering | lib/baserunner.py | Python | apache-2.0 | 18,344 |
from __future__ import division
import numpy as np
import math
import sys
import copy
from typing import Dict, Tuple, List
class NeuralNetwork:
"""
A neural network implimentation that uses Numpy Matricies to do most of the calculations
"""
def __init__(self, num_inputs, num_outputs, num_in_hidden_... | MaxRobinson/CS449 | project6/NeuralNetworkFast.py | Python | apache-2.0 | 15,693 |
# 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... | mrunge/openstack_horizon | openstack_horizon/test/integration_tests/pages/changepasswordpage.py | Python | apache-2.0 | 2,977 |
import json
from pathlib import Path
from resolwe import process
from resolwe.process import (
Cmd,
DataField,
DirField,
FileField,
FloatField,
GroupField,
IntegerField,
JsonField,
ListField,
Persistence,
Process,
SchedulingClass,
StringField,
UrlField,
)
from re... | genialis/resolwe | resolwe/process/tests/processes/python_test.py | Python | apache-2.0 | 18,394 |
import json
import logging
import tornado.web
import tornado.gen
import tornado.iostream
from raven.contrib.tornado import SentryMixin
from waterbutler import tasks
from waterbutler.core import utils
from waterbutler.core import signing
from waterbutler.core import exceptions
from waterbutler.server import settings
f... | Johnetordoff/waterbutler | waterbutler/server/api/v0/core.py | Python | apache-2.0 | 5,410 |
#
# Copyright 2016 The BigDL 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 ... | intel-analytics/BigDL | python/orca/src/bigdl/orca/learn/pytorch/pytorch_metrics.py | Python | apache-2.0 | 17,141 |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/ipu/test_log_softmax_op_ipu.py | Python | apache-2.0 | 3,785 |
# 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 | openstack/tests/unit/load_balancer/test_listener.py | Python | apache-2.0 | 3,791 |
#!/usr/bin/env python
import datetime
import email
import imaplib
import psycopg2
import re
import smtplib
import sys
import time
import yaml
from email.mime.text import MIMEText
CHANGELOG_TIMELIMIT = datetime.timedelta(minutes=30)
def generate_changelog_name():
d = datetime.datetime.now()
offset = d.day % ... | zooniverse/jiscmail-bounces | process_bounces.py | Python | apache-2.0 | 3,188 |
#!/usr/bin/python
#
# Copyright (c) SAS Institute 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... | sassoftware/rbuild | rbuild_test/functionaltest/commandbasedtest/checkouttest.py | Python | apache-2.0 | 11,234 |
# -*- coding: utf-8 -*-
from __future__ import (
print_function,
division,
unicode_literals,
absolute_import
)
# Local imports.
from natsort.compat.py23 import PY_VERSION, cmp_to_key
# Make the strxfrm function from strcoll on Python2
# It can be buggy (especially on BSD-based systems),
# so prefer ic... | NixaSoftware/CVis | venv/lib/python2.7/site-packages/natsort/compat/locale.py | Python | apache-2.0 | 3,591 |
def add_new_idx_to_hand(base_idx, new_idx, add_to_sensor, const):
if add_new(base_idx, new_idx, const, 'thumb', 'all'):
pass
elif add_new(base_idx, new_idx, const, 'finger_1', 'all'):
pass
elif add_new(base_idx, new_idx, const, 'finger_2', 'all'):
pass
elif add_new(base_idx, new_... | joergsimon/gesture-analysis | utils/index_management.py | Python | apache-2.0 | 7,884 |
#!/usr/bin/env python
import logging
import argparse
import sqlline
parser = argparse.ArgumentParser()
parser.add_argument('--debug', '-d', action='store_true')
parser.add_argument('url')
args = parser.parse_args()
if args.debug:
logging.basicConfig(level=logging.DEBUG)
with sqlline.SqlLine() as sqlline:
sq... | Pirionfr/pyPhoenix | examples/shell.py | Python | apache-2.0 | 416 |
# stdlib
from typing import Dict
# third party
from fastapi import FastAPI
from fastapi.responses import JSONResponse
from starlette.middleware.cors import CORSMiddleware
# grid absolute
from grid.api.router import api_router
from grid.core.config import settings
from grid.logger.handler import get_log_handler
app =... | OpenMined/PySyft | packages/grid/backend/grid/main.py | Python | apache-2.0 | 1,388 |
# coding=utf-8
# Copyright 2014 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)
from pants.backend.j... | dturner-tw/pants | src/python/pants/backend/jvm/targets/java_tests.py | Python | apache-2.0 | 2,581 |
# Copyright 2015 The Meson development team
# 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 ... | pexip/meson | mesonbuild/modules/pkgconfig.py | Python | apache-2.0 | 27,270 |
import logging
import pynetbox
import requests
from django.conf import settings
class NetBox(object):
"""
Class used to interact with the NetBox API.
"""
logger = logging.getLogger("peering.manager.netbox")
def __init__(self, *args, **kwargs):
self.api = None
if settings.NETBOX_... | respawner/peering-manager | netbox/api.py | Python | apache-2.0 | 1,658 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | google/pinotify | appengine/auth.py | Python | apache-2.0 | 1,262 |
# file test_binfile/test_eudora.py
#
# Copyright 2011 Emory University Libraries
#
# 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
#... | emory-libraries/eulcommon | test/test_binfile/test_eudora.py | Python | apache-2.0 | 1,830 |
# -*- coding: iso-8859-15 -*-
__author__ = 'daniel'
import logging
from Transaction import Buy, Deposit, Dividend, Earning, Fee, Sell, Split, Tax, Transfer, Withdrawal
def _convert_units_by_transaction_type(transaction_type, units):
if transaction_type.lower().startswith(u'övf till'):
return -units
... | dahuuhad/Stocks | parser/Parser.py | Python | apache-2.0 | 4,457 |
# Copyright 2022 The Deluca 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 w... | google/deluca | deluca/lung/utils/nn/shallow_boundary_model.py | Python | apache-2.0 | 1,325 |
#!/usr/bin/env python
import base64
import rsa
import six
from st2common.runners.base_action import Action
class AwsDecryptPassworData(Action):
def run(self, private_key, password_data):
# copied from:
# https://github.com/aws/aws-cli/blob/master/awscli/customizations/ec2/decryptpassword.py#L96... | StackStorm/st2cd | actions/aws_decrypt_password_data.py | Python | apache-2.0 | 1,133 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Hewlett Packard Enterprise Development LP
#
# 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
#
# U... | vivekramamoorthy/topology_lib_tcpdump | lib/topology_lib_tcpdump/library.py | Python | apache-2.0 | 4,430 |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from .models import iam_backend, User
class IamResponse(BaseResponse):
def attach_role_policy(self):
policy_arn = self._get_param('PolicyArn')
role_name = self._get_param('RoleName')
iam_backend.attach_r... | kefo/moto | moto/iam/responses.py | Python | apache-2.0 | 47,155 |
import os
import shutil
from crawler.crawler import ArchiveCrawler
c = ArchiveCrawler()
def crawler_sample_archive_test():
try:
c.sample(1)
print "crawler_sample_archive_test: PASS"
except Exception as err:
print err
print "crawler_sample_archive_test: FAIL"
def crawler_ge... | ksparakis/apekit | tests/crawler_test.py | Python | apache-2.0 | 937 |
#!/usr/bin/env python
"""
Copyright 2017 Matt Settles
Created June 8, 2017
"""
from optparse import OptionParser
import os
import sys
import time
import traceback
import signal
from subprocess import Popen
from subprocess import PIPE
def sp_bwa_index(ref, overwrite=False):
if os.path.isfile(ref):
if os.p... | ucdavis-bioinformatics/proc10xG | process_mapping.py | Python | apache-2.0 | 16,762 |
from nn_wtf.data_sets import DataSets
from nn_wtf.neural_network_graph import NeuralNetworkGraph
from nn_wtf.tests.util import create_train_data_set, train_data_input, \
create_vector, allow_fail, train_neural_network
import unittest
__author__ = 'Lene Preuss <lene.preuss@gmail.com>'
# pylint: disable=missing-doc... | lene/nn-wtf | nn_wtf/tests/predictor_test.py | Python | apache-2.0 | 1,834 |
"""Hello World API implemented using Google Cloud Endpoints.
Defined here are the ProtoRPC messages needed to define Schemas for methods
as well as those methods defined in an API.
"""
import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remote
package = "blaxcy"
c... | sers-cy/blaxcy | helloworld_api.py | Python | apache-2.0 | 1,510 |
# Copyright 2016 Quora, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | manannayak/asynq | asynq/py3/test_base.py | Python | apache-2.0 | 1,487 |
from quark_runtime import *
import test1
import test2
import test3
import test4
def call_main(): import sys; main(_List(sys.argv[1:]))
def main(args):
test1.go();
test2.go();
test3.go();
test4.go();
| bozzzzo/quark | quarkc/test/emit/expected/py/constructors/constructors/__init__.py | Python | apache-2.0 | 218 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | rzarzynski/tempest | tempest/scenario/test_server_basic_ops.py | Python | apache-2.0 | 4,155 |
# Copyright 2015 Metaswitch 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 applicable law or agreed to in w... | alexhersh/libcalico | calico_containers/pycalico/block.py | Python | apache-2.0 | 18,415 |
# -*- 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-domains | google/cloud/domains_v1beta1/services/domains/transports/grpc.py | Python | apache-2.0 | 33,443 |
# Make sure to include any Metrics your want exported below!
| great-expectations/great_expectations | contrib/capitalone_dataprofiler_expectations/capitalone_dataprofiler_expectations/metrics/__init__.py | Python | apache-2.0 | 61 |
# Copyright 2016 Cloudbase Solutions Srl
#
# 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... | alexcoman/arestor | arestor/api/__init__.py | Python | apache-2.0 | 1,680 |
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA 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 in the top-level directory
# of this distribution and at:
#
# http:... | hirokihamasaki/irma | common/common/compat.py | Python | apache-2.0 | 1,100 |
import sys
from JumpScale import j
import JumpScale.lib.ms1
import JumpScale.baselib.redis
redis=j.clients.redis.getRedisClient("localhost",9999)
secret=j.tools.ms1.getCloudspaceSecret(\
login=j.console.askString("ms1 login"),\
password=j.console.askString("ms1 passwd"), \
clouds... | Jumpscale/play | jumpscale_ms1/config.py | Python | apache-2.0 | 508 |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import dataclass
from pants.backend.go.go_sources import load_go_binary
from pants.backend.go.go_sources.load_go_binary import LoadedGoBinary, LoadedGoBinaryRequest
from ... | pantsbuild/pants | src/python/pants/backend/go/util_rules/pkg_analyzer.py | Python | apache-2.0 | 1,294 |
def my_function(a, b):
"""Returns a * b.
>>> my_function(['A', 'B'], 3) #doctest: +NORMALIZE_WHITESPACE
['A', 'B',
'A', 'B',
'A', 'B']
This does not match because of the extra space after the [ in
the list.
>>> my_function(['A', 'B'], 2) #doctest: +NORMALIZE_WHITESPACE
[ 'A', '... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_developer_tools/doctest_normalize_whitespace.py | Python | apache-2.0 | 367 |
def permutationIsPalindrome(word):
alphabet = [0]*26
for letter in word:
alphabet[translateLetterInIx(letter)] = ~alphabet[translateLetterInIx(letter)]
if sum(alphabet) < -1:
return False
else:
return True
def translateLetterInIx(letter):
return ord(letter) - 97
print(per... | katchengli/tech-interview-prep | interview_cake/ic30.py | Python | apache-2.0 | 964 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2014 Netheos (http://www.netheos.net)
#
# 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 req... | netheosgithub/pcs_api | python/pcs_api/oauth/oauth2_bootstrap.py | Python | apache-2.0 | 1,976 |
#!/usr/bin/env python3
""" 航空器事故数据转换
:author Wang Weiwei <email>weiwei02@vip.qq.com / weiwei.wang@100credit.com</email>
:sine 2017/8/20
:version 1.0
"""
import datetime
import gzip
import os
import pickle
import sys
# gzip文件的模数
GZIP_MAGIC = b"\x1F\x8B"
class IncidentError(Exception):
pass
class... | weiwei02/Technical--Documentation | python/src/base/file/convert_incidents.py | Python | apache-2.0 | 9,364 |
# -*- coding: utf-8 -*-
#
# Copyright 2017 Mycroft AI 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 ... | linuxipho/mycroft-core | mycroft/util/parse.py | Python | apache-2.0 | 10,108 |
#from: https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/
# import the necessary packages
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
import cv2
# initialize the camera and grab a reference to the raw camera capture
camera = PiCamera()... | weedge/doubanFmSpeackerPi | test/simpleImage.py | Python | apache-2.0 | 595 |
#MenuTitle: Save Selected Glyphs as PNG
# -*- coding: utf-8 -*-
__doc__="""
Saves selected glyphs as PNGs. Uses ascender and descender for top and bottom edges of the images.
"""
def transform(shiftX=0.0, shiftY=0.0, rotate=0.0, scale=1.0):
"""
Returns an NSAffineTransform object for transforming layers.
"""
myTra... | schriftgestalt/Mekka-Scripts | App/Save as PNGs.py | Python | apache-2.0 | 3,198 |
# -*- coding: utf-8 -*-
'''
Installation of NPM Packages
============================
These states manage the installed packages for node.js using the Node Package
Manager (npm). Note that npm must be installed for these states to be
available, so npm states should include a requisite to a pkg.installed state
for the ... | victorywang80/Maintenance | saltstack/src/salt/states/npm.py | Python | apache-2.0 | 8,055 |
import logging
from airflow.configuration import conf
from airflow.executors.base_executor import BaseExecutor
from airflow.executors.local_executor import LocalExecutor
from airflow.executors.sequential_executor import SequentialExecutor
# TODO Fix this emergency fix
try:
from airflow.executors.celery_executor i... | jason-z-hang/airflow | airflow/executors/__init__.py | Python | apache-2.0 | 1,235 |
# -*- coding: utf-8 -*-
# Copyright (2017-2018) Hewlett Packard Enterprise Development LP
#
# 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
#
# U... | HewlettPackard/oneview-redfish-toolkit | oneview_redfish_toolkit/api/manager.py | Python | apache-2.0 | 3,184 |
#!/usr/bin/env python
import csv
from os import listdir
from os import walk
import os,sys
# -*- coding: utf-8
#Variable para la ruta al directorio
path = '/s3mnt2/all_years/'
#Lista vacia para incluir los archivos
lstFiles = []
#lista vacia para incluir directorio y archivo
lstFiles2 = []
#Lista con todos los fichero... | eilarraza/CrimePrevention- | scripts/unionMasiva.py | Python | apache-2.0 | 1,526 |
# Copyright 2021 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-google/cirq_google/workflow/quantum_runtime_test.py | Python | apache-2.0 | 5,893 |
from wtforms import Form, BooleanField, StringField, PasswordField, validators
from wtforms.validators import DataRequired, Email
class LoginForm(Form):
username = StringField('Username', [validators.Length(min=4, max=20)])
password = PasswordField('Password', [
validators.Length(min=6),
valid... | disfear86/mushcloud | app/forms.py | Python | apache-2.0 | 1,728 |
from collections import defaultdict
from operator import itemgetter
urls = open('all_github_urls.txt', 'r').read().split('\n')[:-1]
url_dict = defaultdict(int)
for url in urls:
url_dict[url] += 1
sorted_list = sorted(url_dict.items(), key=itemgetter(1),reverse=True)
print(len(set(sorted_list)))
| chaconnewu/awesome-augmented | replicates.py | Python | apache-2.0 | 302 |
# Copyright 2014 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 required by applicable ... | prasanna08/oppia | scripts/run_backend_tests.py | Python | apache-2.0 | 16,674 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-31 05:58
from __future__ import unicode_literals
import django.core.validators
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('partner', '0011_partnerprofil... | unicef/un-partner-portal | backend/unpp_api/apps/partner/migrations/0012_auto_20170831_0558.py | Python | apache-2.0 | 1,314 |
"""
.. module: security_monkey.auditors.CIS4_124_Auditor
:platform: Unix
.. version:: $$VERSION$$
.. moduleauthor:: Pritam D. Gautam <pritam.gautam@nuagedm.com> @nuagedm
"""
from security_monkey.auditor import Auditor, Entity
from security_monkey.watchers.security_group import SecurityGroup
from security_monkey... | stackArmor/security_monkey | security_monkey/auditors/custom/cis/cis4x.py | Python | apache-2.0 | 7,403 |
# 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 applicable law or agreed to in writing, s... | felixbb/forseti-security | tests/common/data_access/project_dao_test.py | Python | apache-2.0 | 7,808 |
'''
From BIFF8 on, strings are always stored using UTF-16LE text encoding. The
character array is a sequence of 16-bit values4. Additionally it is
possible to use a compressed format, which omits the high bytes of all
characters, if they are all zero.
The following tables describe the standard format of ... | sternshus/arelle2.7 | svr-2.7/arelle/xlwt/UnicodeUtils.py | Python | apache-2.0 | 4,919 |
# 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... | firebase/firebase-cpp-sdk | scripts/gha/test_simulator.py | Python | apache-2.0 | 25,967 |
# Copyright 2016 Autodesk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | Autodesk/molecular-design-toolkit | moldesign/utils/json_extension.py | Python | apache-2.0 | 1,405 |
"""This file has only one function: to provide a correctly configured
DcosApiSession object that will be injected into the pytest 'dcos_api_session' fixture
via the make_session_fixture() method
"""
from dcos_test_utils.dcos_api_session import DcosApiSession, DcosUser
from dcos_test_utils.helpers import CI_CREDENTIALS
... | asridharan/dcos | packages/dcos-integration-test/extra/api_session_fixture.py | Python | apache-2.0 | 848 |
#!/usr/bin/env python
# Copyright 2016 Criteo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | iksaif/biggraphite | biggraphite/accessor_cache.py | Python | apache-2.0 | 3,791 |
# -*- coding : utf- 8 -*-
from django.db import models
import random
import string
class myURL(models.Model):
url = models.URLField(verbose_name='Your base url', unique=True)
secret = models.CharField(verbose_name='My Secret Key', max_length=6, unique=True)
username = models.CharField(verbose_name='Nickna... | Tosta-Mixta/urlreductor | mini_url/models.py | Python | apache-2.0 | 981 |
import math
import random
class Point(object):
def __init__(self, x, y, z=0):
self.x = x
self.y = y
self.z = z
def get_x(self):
return self.x
def get_y(self):
return self.y
def get_z(self):
return self.z
def set_x(self, x):
self.x = x
... | wallarelvo/rover | rover/point.py | Python | apache-2.0 | 2,222 |
# coding=utf-8
# Copyright 2022 GradMax 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 ag... | google-research/growneuron | growneuron/cifar/data.py | Python | apache-2.0 | 3,185 |
#
# 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... | wooga/airflow | tests/utils/test_compression.py | Python | apache-2.0 | 3,779 |
#!/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");... | arenadata/ambari | ambari-server/src/main/resources/common-services/ZEPPELIN/0.6.0/package/scripts/master.py | Python | apache-2.0 | 24,600 |
from django.conf.urls.defaults import patterns # noqa
from django.conf.urls.defaults import url # noqa
from openstack_dashboard.dashboards.fogbow.members import views
from openstack_dashboard.dashboards.fogbow.members.views import IndexView
urlpatterns = patterns('',
url(r'^$', IndexView.as_view(), name='index'... | fogbow/fogbow-dashboard | openstack_dashboard/dashboards/fogbow/members/urls.py | Python | apache-2.0 | 408 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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
#
#... | townbull/mtaaas-openstack | mtaaas/openstack/common/threadgroup.py | Python | apache-2.0 | 3,514 |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | kayhayen/Nuitka | nuitka/tree/ReformulationYieldExpressions.py | Python | apache-2.0 | 3,088 |
"""Provides functionality to interact with climate devices."""
from abc import abstractmethod
from datetime import timedelta
import functools as ft
import logging
from typing import Any, Dict, List, Optional
import voluptuous as vol
from homeassistant.const import (
ATTR_TEMPERATURE,
PRECISION_TENTHS,
PRE... | leppa/home-assistant | homeassistant/components/climate/__init__.py | Python | apache-2.0 | 15,863 |
# -*- encoding: utf-8 -*-
from opensearchsdk.apiclient import api_base
class SearchManager(api_base.Manager):
"""Search resource manage class"""
def search(self, query=None, index_name=None, fetch_fields=None, qp=None,
disable=None, first_formula_name=None, formula_name=None,
sum... | yanheven/ali-opensearch-sdk | opensearchsdk/v2/search.py | Python | apache-2.0 | 2,022 |
# -*- 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-oslogin | google/cloud/oslogin_v1/services/os_login_service/__init__.py | Python | apache-2.0 | 769 |
# -*- coding: utf-8 -*-
"""demo_app URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home,... | pivotal-energy-solutions/django-datatable-view | demo_app/demo_app/urls.py | Python | apache-2.0 | 816 |
# (C) Copyright 2019 Fujitsu Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | stackforge/monasca-persister | monasca_persister/tests/test_influxdb_alarm_state_history_repository.py | Python | apache-2.0 | 3,046 |
# 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... | jiaphuan/models | official/resnet/cifar10_test.py | Python | apache-2.0 | 5,068 |
#!/usr/bin/python
"""
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 l... | xeonchen/cdpagent | webpagetest/support/trace-parser.py | Python | apache-2.0 | 102,619 |
"""
WSGI config for gdelt project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` se... | Berico-Technologies/CLAVIN-contrib | gdelt/gdelt/gdelt/wsgi.py | Python | apache-2.0 | 1,416 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright (c) 2009-2010 Ars Aperta, Itaapy, Pierlis, Talend.
#
# Authors: Hervé Cauwelier <herve@itaapy.com>
# David Versmisse <david.versmisse@itaapy.com>
#
# This file is part of Lpod (see: http://lpod-project.org).
# Lpod is free software; you can redistribu... | Agicia/lpod-python | scripts/lpod-merge.py | Python | apache-2.0 | 8,413 |
# Copyright 2014 Open Source Robotics Foundation, 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... | ros2/rosidl | rosidl_adapter/test/test_constant.py | Python | apache-2.0 | 1,555 |
from .technical import (
AnnualizedVolatility,
Aroon,
AverageDollarVolume,
BollingerBands,
EWMA,
EWMSTD,
ExponentialWeightedMovingAverage,
ExponentialWeightedMovingStdDev,
FastStochasticOscillator,
IchimokuKinkoHyo,
LinearWeightedMovingAverage,
MACDSignal,
MaxDrawdown... | enigmampc/catalyst | catalyst/pipeline/factors/crypto/__init__.py | Python | apache-2.0 | 1,022 |
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... | GoogleCloudPlatform/python-docs-samples | composer/functions/composer_storage_trigger.py | Python | apache-2.0 | 4,541 |
# Copyright 2015 Infoblox 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... | infobloxopen/heat-infoblox | heat_infoblox/tests/test_resource_utils.py | Python | apache-2.0 | 5,663 |
#!/usr/bin/env python
#
# Copyright 2017-2021 University Of Southern California
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | pegasus-isi/pegasus | packages/pegasus-python/src/Pegasus/db/admin/versions/v9.py | Python | apache-2.0 | 1,223 |
# -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | torgartor21/solar | solar/solar/core/handlers/__init__.py | Python | apache-2.0 | 1,254 |
from markdown import Extension
from markdown.treeprocessors import Treeprocessor
class BS4Extension(Extension):
def extendMarkdown(self, md): # noqa: N802
md.registerExtension(self)
md.treeprocessors.register(BS4Treeprocessor(md), "bs4_extension", 0)
class BS4Treeprocessor(Treeprocessor):
d... | comic/comic-django | app/grandchallenge/core/utils/markdown.py | Python | apache-2.0 | 1,204 |
import json
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django impo... | mfalcon/edujango | students/views.py | Python | apache-2.0 | 8,057 |
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
import random
import math
##############################################
def sepLine(w, x):
return -((w[0]+w[1]*x)/w[2])
#end
def drawSepLine(w, minX, maxX):
sepx = range(minX, maxX)
sepy = []
for e in sepx:
tm... | YuncyYe/ml | mlf/oneVersusAll_hard.py | Python | apache-2.0 | 7,007 |
from configobj import ConfigObj
from utils_log import utils_log
sys_config_log = utils_log(name='utils_sys_config')
class utils_sys_config():
""" Use ConfigObj to generate config file """
def __init__(self, filename):
self.filename = filename
self.config = ConfigObj(self.filename, list_values=... | AnsonShie/system_monitor | utils/utils_sys_config.py | Python | apache-2.0 | 5,301 |
# time: 30 mins
# used time: 8 mins
# this time try use recursion to solve the problem
# thought: every element can be in a set or not; if i know all subsets from S[:-1], i can know all subsets from S
class Solution:
"""
@param S: The set of numbers.
@return: A list of lists. See example.
"""
def ... | stonemary/lintcode_solutions | subsets/3.py | Python | apache-2.0 | 956 |
import sys
import os
import shlex
import sys
from recommonmark.parser import CommonMarkParser
source_parsers = {
'.md': CommonMarkParser,
}
source_suffix = ['.rst', '.md']
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory i... | SpectoLabs/hoverpy | docs/conf.py | Python | apache-2.0 | 2,160 |
# Copyright 2016 Big Switch Networks, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | wolverineav/networking-bigswitch | networking_bigswitch/tests/unit/bigswitch/test_reachabilitytest_db.py | Python | apache-2.0 | 2,406 |