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 |
|---|---|---|---|---|---|
from swift.common.swob import Request
from swift.common.utils import split_path
from Crypto.Cipher import AES
from Crypto import Random
import hashlib
AES_BLOCK = 32
def create_encrypt(raw, password):
raw = _pad(raw)
key = hashlib.sha256(password.encode()).digest()
iv = Random.new().read(AES.block_size)
... | xczheng/swift-encrypt-compress-middleware | myswift/encrypt.py | Python | apache-2.0 | 3,355 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#-------------------------------------------------------------------------------
"""Setuptools command to execute unit tests."""
__author__ = ('Lance Finn Helsten',)
__version__ = '0.7.4'
__copyright__ = """Copyright (C) 2014 Lance Helsten"""
__docformat__ = "reStructuredTe... | lanhel/ftpysetup | ftpysetup/runtest/unit.py | Python | apache-2.0 | 1,588 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#encoding=utf-8
'''
Created on 2015年4月21日
@author: kerry
'''
from base.http import MIGHttpMethodGet,MIGHttpMethodPost
from base.miglog import miglog
import urlparse
import json
class HttpApi(object):
'''
classdocs
'''
def __init__(self):
'''
... | smartdata-x/robots | api/HttpApi.py | Python | apache-2.0 | 1,065 |
import unittest
import pandas as pd
from pandas.util.testing import assert_series_equal
import numpy as np
from easyframes.easyframes import hhkit
class TestStataMerge(unittest.TestCase):
def setUp(self):
"""
df_original = pd.read_csv('sample_hh_dataset.csv')
df = df_original.copy()
print(df.to_dict())
... | shafiquejamal/easyframes | easyframes/test/test_statamerge.py | Python | apache-2.0 | 4,184 |
# 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... | toddpalino/kafka-tools | kafka/tools/protocol/requests/leader_and_isr_v0.py | Python | apache-2.0 | 2,023 |
from .reflash import main
| tomviner/upyflashed | upyflashed/__init__.py | Python | apache-2.0 | 26 |
# coding=utf-8
# coding=utf-8
# Copyright 2019 The RecSim 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-research/recsim | recsim/agents/cluster_bandit_agent.py | Python | apache-2.0 | 3,423 |
# 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 required by applica... | tensorflow/tpu | models/official/unet3d/tpu_executor.py | Python | apache-2.0 | 10,653 |
import logging
from ibmsecurity.utilities import tools
logger = logging.getLogger(__name__)
try:
basestring
except NameError:
basestring = (str, bytes)
def get(isamAppliance, state_id, check_mode=False, force=False):
"""
Get a grant
"""
return isamAppliance.invoke_get("Get a grant",
... | IBM-Security/ibmsecurity | ibmsecurity/isam/aac/api_protection/grants.py | Python | apache-2.0 | 3,427 |
# Copyright 2012 Grid Dynamics
# 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... | ycl2045/nova-master | nova/tests/virt/libvirt/test_imagebackend.py | Python | apache-2.0 | 26,862 |
from __future__ import print_function
from __future__ import division
import numpy as np
import sys
import argparse
import time
import re
import gzip
import os
import logging
from collections import defaultdict
from operator import itemgetter
__version__ = "1.0"
def main():
parser=argparse.ArgumentParser(descr... | blajoie/vcf2fasta | scripts/vcf2fasta.py | Python | apache-2.0 | 8,351 |
# Copyright 2021 The ParallelAccel 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 appl... | google/parallel_accel | parallel_accel/Analysis/benchmarks/acyclic_graphs/quick_sim_acyclic_graphs/acyclic_graph_q28c0d14.py | Python | apache-2.0 | 110,293 |
import os
import kfp.compiler as compiler
import kfp.components as components
from kfp.azure import use_azure_secret
import kfp.dsl as dsl
import argparse
parser = argparse.ArgumentParser(description='Process inputs.')
parser.add_argument('--image_name', type=str, default='kubeflow_synapse_component')
parser.add_argum... | kubeflow/pipelines | components/azure/azuresynapse/runsparkjob/sample.py | Python | apache-2.0 | 3,004 |
# -*- 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
#... | owlabs/incubator-airflow | tests/sensors/test_timeout_sensor.py | Python | apache-2.0 | 3,102 |
#!/usr/bin/env python
from ctypes import *
from ctypes.util import find_library
from os import path
import sys
__all__ = ['liblinear', 'feature_node', 'gen_feature_nodearray', 'problem',
'parameter', 'model', 'toPyModel', 'L2R_LR', 'L2R_L2LOSS_SVC_DUAL',
'L2R_L2LOSS_SVC', 'L2R_L1LOSS_SVC_DUAL', ... | WangWenjun559/Weiss | classifier/liblinear.py | Python | apache-2.0 | 9,368 |
import ConfigParser
import sys
from os.path import expanduser, isfile
class NewsConfig(object):
"""handles reading, writing, and validating
the configuration for newsapi.org"""
def __init__(self, configpath=None, apikey=None):
super(NewsConfig, self).__init__()
self.section = 'newsapi.... | bizarrechaos/newsapi-client | news/newsconfig.py | Python | apache-2.0 | 1,209 |
# 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... | openstack/ironic-inspector | ironic_inspector/plugins/local_link_connection.py | Python | apache-2.0 | 6,493 |
"""The dhcp integration."""
from abc import abstractmethod
from datetime import timedelta
import fnmatch
from ipaddress import ip_address as make_ip_address
import logging
import os
import threading
from aiodiscover import DiscoverHosts
from aiodiscover.discovery import (
HOSTNAME as DISCOVERY_HOSTNAME,
IP_AD... | Danielhiversen/home-assistant | homeassistant/components/dhcp/__init__.py | Python | apache-2.0 | 13,216 |
# Copyright (c) 2014 Pure Storage, 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 re... | dims/cinder | cinder/tests/unit/test_pure.py | Python | apache-2.0 | 112,015 |
# VMware vCloud Python helper
# Copyright (c) 2014 Huawei, 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
#
# Unl... | HybridF5/hybrid-jacket | nova_jacket/virt/jacket/vcloud/vcloud.py | Python | apache-2.0 | 51,929 |
"""
Validate the integrity of image files
In data-release 7 and 8 we had issues with image files that were corrupt.
This was causing problems when Omero tried to upload them.
This script checks the filetypes specified and reports any that seem
corrupt. It does this by attempting to load them usin... | mpi2/PhenotypeData | external_tools/src/main/python/omero56/scripts/validate_file_integrity.py | Python | apache-2.0 | 6,026 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
_author_ = 'Renzhw'
import asyncio,logging
import aiomysql
def log(sql,args=()):
logging.info('SQL:%s'%sql)
async def create_pool(loop, **kw):
logging.info('create database connection pool...')
global __pool
__pool = await aiomysql.create_pool(
... | Renzhw/python3 | www/orm.py | Python | apache-2.0 | 8,005 |
#!/usr/bin/env python3
"""Test framework utility functions tests"""
import unittest
from framework import VppTestRunner
from vpp_papi import mac_pton, mac_ntop
class TestUtil (unittest.TestCase):
""" MAC to binary and back """
def test_mac_to_binary(self):
mac = 'aa:bb:cc:dd:ee:ff'
b = mac_pt... | vpp-dev/vpp | test/test_util.py | Python | apache-2.0 | 512 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Carlos Jenkins <carlos@jenkins.co.cr>
#
# 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
#
# Unles... | carlos-jenkins/confspec | test/providers/test_ini.py | Python | apache-2.0 | 2,037 |
# Copyright 2022 The Scenic 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-research/scenic | scenic/model_lib/base_models/tests/test_regression_model.py | Python | apache-2.0 | 3,268 |
#!/usr/bin/python
import time
import telnetlib
import re
line_pat = re.compile(r'\d+\. (?P<username>[^,]*), id=(?P<id>\d+), steamid=(?P<steamid>\d+), online=(?P<online>True|False), ip=[\d.]*, playtime=(?P<playtime>\d+).*')
slot_pat = re.compile(r'Slot \d+: (\d{3}) * (.*)')
ban_pat = re.compile(r'^ \d{2}/\d{2}/... | ratilicus/sdtd | dev/sdtd-eac.py | Python | apache-2.0 | 2,696 |
#
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/ns/nspbr6_args.py | Python | apache-2.0 | 1,047 |
import mysql
import pymysql
from model.group import Group
from model.contact import Contact
class DbFixture:
def __init__(self, host, name, user, password):
self.host = host
self.name = name
self.user = user
self.password = password
self.connection = pymysql.connect(host=ho... | aalekperov/Task1 | fixture/db.py | Python | apache-2.0 | 2,534 |
"""Don't use default_fkey ondelete/onupdate settings for spam filtering columns.
Opt for the PostgreSQL defaults of NO ACTION.
Revision ID: fb60c8528489
Revises: 6f71a90cff21
Create Date: 2019-09-16 23:18:35.892342
"""
# revision identifiers, used by Alembic.
revision = 'fb60c8528489'
down_revision = '6f71a90cff21'... | Weasyl/weasyl | libweasyl/libweasyl/alembic/versions/fb60c8528489_spam_filtering_correct_onupdate_ondelete.py | Python | apache-2.0 | 1,610 |
"""Parser for STIX Domain Name Object.
see: https://docs.oasis-open.org/cti/stix/v2.1/csprd01/stix-v2.1-csprd01.html#_Toc16070687
"""
# standard library
from typing import Iterable, Union
# third-party
from stix2 import DomainName
# first-party
from tcex.stix.model import StixModel
class StixDomainNameObject(StixM... | kstilwell/tcex | tcex/stix/observables/domain_name.py | Python | apache-2.0 | 1,634 |
#!/usr/bin/python
import OpenSSL.crypto
import argparse
import base64
import glob
import k8s
import os
import shutil
import yaml
def sn():
sn = int(open("/etc/origin/master/ca.serial.txt").read(), 16)
sntext = "%X" % (sn + 1)
if len(sntext) % 2:
sntext = "0" + sntext
open("/etc/origin/maste... | RedHatEMEA/aws-ose3 | target/reip.py | Python | apache-2.0 | 18,095 |
#!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo 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 ... | fy2462/apollo | modules/tools/car_sound/car_sound.py | Python | apache-2.0 | 2,085 |
import argparse
import sys, os
import numpy as np
from copy import copy
parser = argparse.ArgumentParser()
parser.add_argument('qubit', help='qubit name')
parser.add_argument('direction', help='direction (X or Y)')
parser.add_argument('numPulses', type=int, help='log2(n) of the longest sequence n')
parser.add_argument(... | BBN-Q/Qlab | common/@PulseCalibration/PhaseEstimationSequence.py | Python | apache-2.0 | 1,148 |
# 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... | rew4332/tensorflow | tensorflow/python/kernel_tests/shape_ops_test.py | Python | apache-2.0 | 18,807 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0011_merge'),
]
operations = [
migrations.CreateModel(
name='CreditTradeZeroReason',
fields=[... | swcurran/tfrs | backend/api/migrations/0012_auto_20170928_1737.py | Python | apache-2.0 | 4,787 |
"""Test the Nightscout config flow."""
from aiohttp import ClientConnectionError
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.nightscout.const import DOMAIN
from homeassistant.components.nightscout.utils import hash_from_url
from homeassistant.const import CONF_URL
fr... | tchellomello/home-assistant | tests/components/nightscout/test_config_flow.py | Python | apache-2.0 | 3,995 |
#!/usr/bin/env python2.5
#
# Copyright 2008 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/models/seed_db.py | Python | apache-2.0 | 28,823 |
# 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
from pant... | qma/pants | src/python/pants/backend/jvm/tasks/jvm_compile/jvm_classpath_publisher.py | Python | apache-2.0 | 2,151 |
# Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
# Copyright 2015 Techcable
#
# 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 r... | Techcable/DiffUtils | diffutils/_myers.py | Python | apache-2.0 | 7,995 |
#!/usr/env/bin python
# TODO
# 1. fix bug that if a script shares the same name as a material dll to load,
# the material may not be loaded correctly
# 2. fix multiple definitions of c++ -> python conversion for Spectrum
import sys
import os
import math
from libgotham import *
import inspect
def normalize(x):
... | jaredhoberock/gotham | api/api.py | Python | apache-2.0 | 16,127 |
# Copyright 2012 Nebula, 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 agree... | DirectXMan12/nova-hacking | nova/tests/api/openstack/compute/contrib/test_flavor_swap.py | Python | apache-2.0 | 3,130 |
'''Problem 25 from project Euler: 1000-digit Fibonacci number
https://projecteuler.net/problem=25'''
RESULT = 4782
def solve():
'''Main function'''
digits = 1000
fib1 = 1
fib2 = 1
nth = 2
top = 10 ** (digits - 1)
while fib2 < top:
fib1, fib2 = fib2, fib1 + fib2
nth += 1... | jorgemira/euler-py | p025.py | Python | apache-2.0 | 383 |
import numpy
from numpy.testing import assert_almost_equal
import pytest
import torch
from torch.nn import LSTM, GRU
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from allennlp.common.checks import ConfigurationError
from allennlp.common.testing import AllenNlpTestCase
from allennlp.modules.... | allenai/allennlp | tests/modules/seq2seq_encoders/pytorch_seq2seq_wrapper_test.py | Python | apache-2.0 | 8,239 |
import hashlib
import os
import uuid
from prov.identifier import Namespace
__citation__ = "https://doi.org/10.5281/zenodo.1208477"
# NOTE: Semantic versioning of the CWLProv Research Object
# **and** the cwlprov files
#
# Rough guide (major.minor.patch):
# 1. Bump major number if removing/"breaking" resources or PRO... | common-workflow-language/cwltool | cwltool/provenance_constants.py | Python | apache-2.0 | 1,889 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('delivery', '0077_auto_20160823_1524'),
]
operations = [
migrations.AddField(
model_name='url',
name=... | AlexStarov/Shop | applications/delivery/migrations/0078_auto_20160823_1704.py | Python | apache-2.0 | 1,146 |
import unittest
import validators
from binding import Context
class ValidatorsTest(unittest.TestCase):
""" Testing for validators and extract functions """
def test_validatortest_exists(self):
func = validators.VALIDATOR_TESTS['exists']
self.assertTrue(func('blah'))
self.assertTrue(fu... | holdenweb/pyresttest | pyresttest/test_validators.py | Python | apache-2.0 | 13,922 |
from .models import instance_metadata_backend
instance_metadata_backends = {"global": instance_metadata_backend}
| spulec/moto | moto/instance_metadata/__init__.py | Python | apache-2.0 | 114 |
from graphics import*
import random
from Player import *
from Button import *
class Tile():
def __init__(self,l):
self.letter = l
self.setValue()
self.rect = Rectangle(Point(0,0),Point(10,10))
self.text_letter = Text(Point(5,5),self.letter)
self.text_value = Text(... | itsallvoodoo/csci-school | CSCI220/Week 15 - FINAL/Scrabble/Tile.py | Python | apache-2.0 | 5,575 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Jonas Wacker, Benjamin Milde'
from elasticsearch import Elasticsearch
import nltk
import traceback
import nltk.data
wiki_index = 'simple_en_wiki'
default_type = 'page'
sent_detector = nltk.data.load('tokenizers/punkt/english.pickle')
# Currently using a pu... | bmilde/ambientsearch | python/wiki_search_es.py | Python | apache-2.0 | 6,033 |
class Error(Exception): pass
class MissingData(Error): pass | iffy/parsefin | parsefin/error.py | Python | apache-2.0 | 59 |
"""Test the Z-Wave JS Websocket API."""
import json
from unittest.mock import patch
import pytest
from zwave_js_server.const import LogLevel
from zwave_js_server.event import Event
from zwave_js_server.exceptions import (
FailedCommand,
InvalidNewValue,
NotFoundError,
SetValueFailed,
)
from homeassist... | kennedyshead/home-assistant | tests/components/zwave_js/test_api.py | Python | apache-2.0 | 58,118 |
# Lint as: python3
# 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 agr... | google/tf-quant-finance | tf_quant_finance/models/legacy/brownian_motion.py | Python | apache-2.0 | 19,227 |
##
# Copyright (c) 2012-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/performance/sqlusage/requests/httpTests.py | Python | apache-2.0 | 3,288 |
"""
This script combines training_OnlineContrastiveLoss.py with training_MultipleNegativesRankingLoss.py
Online constrative loss works well for classification (are question1 and question2 duplicates?), but it
performs less well for duplicate questions mining. MultipleNegativesRankingLoss works well for duplicate
quest... | UKPLab/sentence-transformers | examples/training/quora_duplicate_questions/training_multi-task-learning.py | Python | apache-2.0 | 9,356 |
# coding=utf-8
# Copyright 2018 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)
class PantsDaemonSt... | baroquebobcat/pants | src/python/pants/goal/pantsd_stats.py | Python | apache-2.0 | 1,009 |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... | sridevikoushik31/nova | nova/tests/cells/test_cells_rpcapi.py | Python | apache-2.0 | 18,532 |
import json
import networkx as nx
from pybbn.graph.edge import Edge, EdgeType
from pybbn.graph.graph import Graph
from pybbn.graph.node import BbnNode
from pybbn.graph.variable import Variable
class Dag(Graph):
"""
Directed acyclic graph.
"""
def __init__(self):
"""
Ctor.
""... | vangj/py-bbn | pybbn/graph/dag.py | Python | apache-2.0 | 11,592 |
"""
tflite backend (https://github.com/tensorflow/tensorflow/lite)
"""
# pylint: disable=unused-argument,missing-docstring,useless-super-delegation
from threading import Lock
try:
# try dedicated tflite package first
import tflite_runtime
import tflite_runtime.interpreter as tflite
_version = tflite_... | plaidml/plaidml | mlperf/backend_tflite.py | Python | apache-2.0 | 1,874 |
__author__ = 'Jason Grundstad'
from django.conf import settings
from pyvirtualdisplay import Display
from selenium import webdriver
from bs4 import BeautifulSoup
import json
MD_ANDERSON_URL = 'https://pct.mdanderson.org/#/home'
MD_ANDERSON_OUTFILE = settings.LINKS_OUT + 'mdanderson.json'
def scrape_mdanderson():
... | djf604/viewer | util/link_out_scraper.py | Python | apache-2.0 | 1,060 |
# 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... | fullfanta/mxnet | python/mxnet/gluon/parameter.py | Python | apache-2.0 | 31,399 |
##
# Copyright (c) 2008-2015 Apple Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | red-hood/calendarserver | twistedcaldav/test/test_memcachepool.py | Python | apache-2.0 | 11,952 |
# Copyright 2020 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/timesketch | api_client/python/timesketch_api_client/credentials.py | Python | apache-2.0 | 5,272 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC. 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 require... | GoogleCloudPlatform/gsutil | gslib/tests/test_wrapped_credentials.py | Python | apache-2.0 | 4,593 |
import socket
import time
msg_header = 'AADD'
msg_stamp = '\x00\x00\x00\x00'
msg_id_gw = '00AA00DD'
msg_id_dev = '00000000'
msg_devtype = '\x33\x00'
msg_auth_key = '88888888'
msg_auth_datatype = '\x1c\x00'
msg_auth = msg_header+msg_stamp+msg_id_gw+msg_id_dev+msg_devtype+msg_auth_datatype+'\x00\x08'+msg_auth_key
m... | lingfliu/smart_tuwa | twrt/testbed/fan_test.py | Python | apache-2.0 | 951 |
class Student(object):
"""For student records"""
def __init__(self, name=None):
# This special method is called a "constructor"
self.name = name
def print_name(self):
print self.name
jenny = Student('Jenny')
jenny.print_name() # prints 'Jenny'
### Exercise Time ###
bill = Stud... | karlalopez/hackbright | objects-tom/solution/objects4.py | Python | apache-2.0 | 344 |
import math
import time
import mock
import unittest2
from pykafka import KafkaClient
from pykafka.balancedconsumer import BalancedConsumer
from pykafka.test.utils import get_cluster, stop_cluster
def buildMockConsumer(num_partitions=10, num_participants=1, timeout=2000):
consumer_group = 'testgroup'
topic =... | tempbottle/pykafka | tests/pykafka/test_balancedconsumer.py | Python | apache-2.0 | 4,755 |
# Copyright 2011 OpenStack LLC.
# 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... | klmitch/dtest | tests/test_inheritance.py | Python | apache-2.0 | 1,722 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class ConsultantformConfig(AppConfig):
name = 'consultantform'
| rajeshgupta14/pathend | consultantform/apps.py | Python | apache-2.0 | 168 |
#!/usr/bin/env python
# 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... | openstack/tripleo-heat-templates | tools/convert_nic_config.py | Python | apache-2.0 | 7,737 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import codecs
import json
import re
import urllib
with codecs.open('download/package-jsons', encoding='utf-8') as in_file, \
codecs.open('output.txt', mode='wb', encoding='utf-8') as out_file:
for package_json in in_file:
package_dict = json.loads(p... | samskeller/zeroclickinfo-fathead | lib/fathead/py_pi/parse.py | Python | apache-2.0 | 1,981 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# USAGE
# python -matx -s ESLKJXX gui
import argparse
import functools
import json
import sys
import inspect
from contextlib import contextmanager
import atx.androaxml as apkparse
from atx.cmds import run
from atx.cmds import iosdeveloper
from atx.cmds import install
... | Andy-hpliu/AirtestX | atx/__main__.py | Python | apache-2.0 | 4,930 |
"""
ChkConfig - command ``chkconfig``
=================================
"""
from collections import namedtuple
from .. import Parser, parser
import re
from insights.specs import chkconfig
@parser(chkconfig)
class ChkConfig(Parser):
"""
A parser for working with data gathered from `chkconfig` utility.
Sam... | wcmitchell/insights-core | insights/parsers/chkconfig.py | Python | apache-2.0 | 6,449 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-15 13:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_wallet_template'),
]
operations = [
migrations.AddField(
... | BartoszMakowski/typer | typer/core/migrations/0003_auto_20171015_1341.py | Python | apache-2.0 | 657 |
import time
from luma.core import cmdline, error
from luma.core.interface.serial import i2c, spi
from luma.core.render import canvas
from luma.oled.device import ssd1306, ssd1322, ssd1325, ssd1331, sh1106
from PIL import ImageFont
import timers
class ProgressBar(object):
__progress_padding = 2
__progress_heigh... | bdutro/mopidy-raspiradio | mopidy_raspiradio/gui.py | Python | apache-2.0 | 6,429 |
# -*- coding: utf-8 -*-
import asyncio
import logging
from alamo_scheduler.conf import settings
from pip import get_installed_distributions
from aiohttp.client import ClientSession
from aiohttp.web import Application, Response, json_response
logger = logging.getLogger(__name__)
__all__ = ['ClientSession', 'json_res... | RulersOfAsgard/ALAMO-scheduler | alamo_scheduler/aioweb.py | Python | apache-2.0 | 3,647 |
#
# Copyright 2018 Analytics Zoo 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... | intel-analytics/analytics-zoo | pyzoo/zoo/examples/qaranker/qa_ranker.py | Python | apache-2.0 | 3,792 |
# coding: utf-8
"""
MailMojo API
v1 of the MailMojo API # noqa: E501
OpenAPI spec version: 1.1.0
Contact: hjelp@mailmojo.no
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import mailmojo_sdk
from mailmojo_sdk.models... | eliksir/mailmojo-python-sdk | test/test_contact.py | Python | apache-2.0 | 815 |
import sys
import os
import socket
from optparse import make_option
from urlparse import urlparse
from django.conf import settings
from django.core.management.base import BaseCommand
from django_nose.management.commands.test import Command
from django_webdriver.message import Message
SETTINGS = getattr(settings, "... | aphentik/django-webdriver | django_webdriver/management/commands/test.py | Python | apache-2.0 | 3,072 |
"""Support for the Torque OBD application."""
import logging
import re
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.components.http import HomeAssistantView
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_EMAIL, CONF_NAME
from hom... | fbradyirl/home-assistant | homeassistant/components/torque/sensor.py | Python | apache-2.0 | 3,807 |
# -*- 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... | sasha-gitg/python-aiplatform | google/cloud/aiplatform_v1beta1/services/specialist_pool_service/client.py | Python | apache-2.0 | 37,342 |
# -*- coding: utf-8 -*-
from flask import request, Response
from werkzeug.http import parse_accept_header
import simplejson as json
from uuid import uuid4
def generic_api_error(e):
resp = json.dumps({"error": {"status": e.code,
"title": e.name,
"... | pjwerneck/device-mesh | mesh/views/api_errors.py | Python | apache-2.0 | 888 |
#!/usr/bin/env python3
# ID: umap_vis.py [73a44e5] jchealy@gmail.com $
"""
Manually generate figures for the UMAP documentation.
"""
##########################################################################
## Imports
##########################################################################
import matplotlib.pyplot... | DistrictDataLabs/yellowbrick | docs/api/text/umap_vis.py | Python | apache-2.0 | 1,667 |
"""Tests for the PS4 media player platform."""
from unittest.mock import MagicMock, patch
from pyps4_homeassistant.credential import get_ddp_message
from homeassistant.components import ps4
from homeassistant.components.media_player.const import (
ATTR_INPUT_SOURCE,
ATTR_INPUT_SOURCE_LIST,
ATTR_MEDIA_CONT... | fbradyirl/home-assistant | tests/components/ps4/test_media_player.py | Python | apache-2.0 | 17,932 |
from sqlalchemy import Column, Integer, String
from sqlalchemy import Table
from application.db import Base
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
name = Column(String(50), unique=True)
password = Column(String(120), unique=True)
def __init__(sel... | shunliz/test | python/flask/application/db/models.py | Python | apache-2.0 | 482 |
# coding: utf-8
from flask import Blueprint
from flask import request
from flask import redirect
from flask import url_for
from flask import render_template
from flask import flash,session
from tools.MysqlBase import *
from tools.SqliteBase import *
mysql = MysqlBase('python')
class Todo():
pass
todos_view = Bl... | maxis1314/pyutils | web/views/todos.py | Python | apache-2.0 | 3,030 |
import errno
import signal
import os
import socket
import time
SERVER_ADDRESS = (HOST, PORT) = '', 8888
REQUEST_QUEUE_SIZE = 1024
def grim_reaper(signum, frame):
while True:
try:
pid, status = os.waitpid(
-1,
os.WNOHANG,
)
except OSError:
... | zenanhu/pluto | hydra/server1.py | Python | apache-2.0 | 1,675 |
# Copyright 2010 OpenStack Foundation
# Copyright 2013 NTT corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... | spring-week-topos/cinder-week | cinder/image/glance.py | Python | apache-2.0 | 18,489 |
#
# 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... | nudles/incubator-singa | examples/cnn/autograd/mnist_cnn.py | Python | apache-2.0 | 10,259 |
import os
import pysftp
import sys
import subprocess
import glob
sys.path.append("C:\Users\jinkersont\.gnupg")
sys.path.append("C:\Users\jinkersont")
sys.path.append("C:\Program Files (x86)\gnupg\\bin")
print(sys.path)
UPLOAD = {
"SERVER": "192.168.80.33",
"PORT": 22,
"USERNAME": "sftpu... | timjinx/Sample-Repo | python/test_pysftp.py | Python | apache-2.0 | 2,864 |
#!/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")... | alexryndin/ambari | ambari-server/src/test/python/stacks/2.2/KAFKA/test_kafka_broker.py | Python | apache-2.0 | 7,652 |
# 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)
from collections imp... | slyphon/pants | src/python/pants/engine/exp/configuration.py | Python | apache-2.0 | 10,107 |
# coding:utf-8
from nose.tools import assert_raises, eq_, ok_
from flanker.addresslib.address import (Address, AddressList, EmailAddress,
UrlAddress)
from flanker.addresslib.address import parse, parse_list
def test_addr_properties():
email = parse('name@host.com')
url... | nylas/flanker | tests/addresslib/address_test.py | Python | apache-2.0 | 32,254 |
import exception_utils
import os
import shutil
deleted_file_path = '/home/ron/Desktop/duplicut_tester/1/11/11.txt.duplicutted' # the XXX.duplicutted file
if __name__ == '__main__':
try:
deleted_file_path_splitted = deleted_file_path.split('/')[0:-1]
file_name = deleted_file_path.split('/')[-1]
... | sneron7/DupliCut | deleted_file_recovery.py | Python | apache-2.0 | 890 |
# 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... | Laurawly/tvm-1 | python/tvm/relay/op/contrib/ethosu.py | Python | apache-2.0 | 42,334 |
"""Defines a workspace that is needed by a task"""
from __future__ import unicode_literals
class TaskWorkspace(object):
"""Represents a workspace needed by a task
"""
def __init__(self, name, mode, volume_name=None):
"""Creates a task workspace
:param name: The name of the workspace
... | ngageoint/scale | scale/job/execution/configuration/workspace.py | Python | apache-2.0 | 653 |
#!/usr/bin/python
# -*- coding: utf-8; -*-
#
# 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
#
# Unles... | locaweb/netl2api | netl2api/l2api/hp/flex10res.py | Python | apache-2.0 | 1,378 |
#!/usr/bin/python
#
# 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 ag... | GoogleCloudPlatform/datacatalog-connectors-bi | google-datacatalog-tableau-connector/src/google/datacatalog_connectors/tableau/scrape/metadata_api_helper.py | Python | apache-2.0 | 5,757 |
# Copyright 2010 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,... | Princessgladys/googleresourcefinder | app/bubble_test.py | Python | apache-2.0 | 5,468 |
# coding: utf-8
"""
Cloudbreak API
Cloudbreak is a powerful left surf that breaks over a coral reef, a mile off southwest the island of Tavarua, Fiji. Cloudbreak is a cloud agnostic Hadoop as a Service API. Abstracts the provisioning and ease management and monitoring of on-demand clusters. SequenceIQ's Cloud... | Chaffelson/whoville | whoville/cloudbreak/models/recipe_request.py | Python | apache-2.0 | 7,284 |
# 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/controllers/ConceptReferenceController.py | Python | apache-2.0 | 3,396 |