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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import calendar
import contextlib
import ctypes
import datetime
import email.utils
import errno
import getpass
import gzip
import itertools
import io
import json
import locale
import math
import os
import pipes
import platform
import re
import ssl
import socket
import stru... | laborautonomo/youtube-dl | youtube_dl/utils.py | Python | unlicense | 42,818 |
from sys import argv
from math import log
print(int(log(int(argv[1]), 2) + 1))
| EvanHahn/bits-required | python/bits.py | Python | unlicense | 79 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import forgery_py
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-i', dest='init_size', type=int, default=1000,
help='The initial number of entries.DEFAULT 1000')
parser.add_argument('-s', dest='num... | gosom/back-to-basics | search/build-demo-data.py | Python | unlicense | 1,168 |
# ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008-2012 Daniel Moisset, Ricardo Quesada, Rayentray Tappa,
# Lucio Torre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided t... | shadowmint/nwidget | lib/cocos2d-0.5.5/cocos/actions/interval_actions.py | Python | apache-2.0 | 22,046 |
from django.contrib import admin
from freemix.exhibit import models
class CanvasAdmin(admin.ModelAdmin):
list_display = ('title', 'description')
search_fields = ('title', 'description',)
admin.site.register(models.Canvas, CanvasAdmin)
class ExhibitAdmin(admin.ModelAdmin):
list_display = ('slu... | zepheira/freemix | freemix/exhibit/admin.py | Python | apache-2.0 | 632 |
from django.http import HttpResponse,HttpResponseRedirect
from django.shortcuts import render,render_to_response,get_object_or_404
from django.template import RequestContext,loader,Context
from django.views.generic import ListView
from django.core.context_processors import csrf
from django.contrib.auth import authentic... | omiltoro/softbrew | OMRS/views.py | Python | apache-2.0 | 9,545 |
#!/usr/bin/python
from k5test import *
# Create a realm with the KDC one hour in the past.
realm = K5Realm(start_kdc=False)
realm.start_kdc(['-T', '-3600'])
# kinit (no preauth) should work, and should set a clock skew allowing
# kvno to work, with or without FAST.
realm.kinit(realm.user_princ, password('user'))
real... | drankye/kerb-token | krb5/src/tests/t_skew.py | Python | apache-2.0 | 2,477 |
from connexion import App
import logging
logging.basicConfig(level=logging.INFO)
app = App(__name__)
app.add_api('swagger.yaml')
# set the WSGI application callable to allow using uWSGI
application = app.app
if __name__ == '__main__':
app.run(port=8080, server='gevent')
| melphi/algobox | python/algobox/src/algobox/backtest/service.py | Python | apache-2.0 | 278 |
# -*- coding: utf-8 -*-
"""
equip.analysis.flow
~~~~~~~~~~~~~~~~~~~
Extract the control flow graphs from the bytecode.
:copyright: (c) 2014 by Romain Gaucher (@rgaucher)
:license: Apache 2, see LICENSE for more details.
"""
import opcode
from operator import itemgetter, attrgetter
from itertools import tee,... | neuroo/equip | equip/analysis/flow.py | Python | apache-2.0 | 18,228 |
# -*- coding: utf-8 -*-
import pytest
from pygam import *
def test_can_build_sub_models():
"""
check that the inits of all the sub-models are correct
"""
LinearGAM()
LogisticGAM()
PoissonGAM()
GammaGAM()
InvGaussGAM()
ExpectileGAM()
assert(True)
def test_LinearGAM_uni(mcycle... | dswah/pyGAM | pygam/tests/test_GAMs.py | Python | apache-2.0 | 2,344 |
import json
from .._abstract.abstract import BaseAGOLClass, BaseSecurityHandler
from ..security import security
########################################################################
class Services(BaseAGOLClass):
"""
The administration resource is the root node and initial entry point
into a Spatia... | jgravois/ArcREST | src/arcrest/hostedservice/service.py | Python | apache-2.0 | 68,352 |
import os;
import sys;
import traceback;
#####################################################################
## Update Thread Pool size
#####################################################################
def configureThreadPool(clusterName, threadPoolName, minSize, maxSize):
print "Cluster Name = " + ... | muthu-s/chef-repo | cookbooks/wsi/files/configurethreadpool.py | Python | apache-2.0 | 1,835 |
from selenium import webdriver
from model.application import Application
import pytest
@pytest.fixture(scope="module")
def app(request):
driver = webdriver.Firefox()
driver.implicitly_wait(10)
request.addfinalizer(driver.quit)
return Application(driver)
| VolodyaEsk/selenium-python-vkhatianovskyi | php4dvd/selenium_fixture.py | Python | apache-2.0 | 272 |
#!/usr/bin/python
from __future__ import unicode_literals
import copy
import re
import time
import types
try:
from BaseHTTPServer import BaseHTTPRequestHandler
except ImportError:
# Python 3
unicode = str
from functools import wraps
from threading import Lock
_METRIC_NAME_RE = re.compile(r'^[a-zA-Z_:][... | machinelady/client_python | prometheus_client/core.py | Python | apache-2.0 | 16,613 |
import unittest
import datetime
import pykmlib
class PyKmlibAdsTest(unittest.TestCase):
def test_smoke(self):
classificator_file_str = ''
with open('./data/classificator.txt', 'r') as classificator_file:
classificator_file_str = classificator_file.read()
types_file_str = ''
... | rokuz/omim | kml/pykmlib/bindings_test.py | Python | apache-2.0 | 4,094 |
#!/usr/bin/env python
import os
import numpy as np
from scipy import interpolate
from osgeo import gdal, osr
#functions
def GetGeoInfo(filename, Subdataset = 0):
"""Gives geo-information derived from a georeferenced map
filename: file to be scrutinized
subdataset: layer to be used in case of HDF4 fo... | wateraccounting/SEBAL | interpolation/QGIS_.py | Python | apache-2.0 | 3,702 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | 2013Commons/HUE-SHARK | apps/useradmin/src/useradmin/urls.py | Python | apache-2.0 | 1,814 |
# -*- coding: utf-8 -*-
# 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
#
# Un... | google/mirandum | alerts/ytsubs/migrations/0004_migrate_updater.py | Python | apache-2.0 | 1,359 |
"""patch hash column
Revision ID: 51775a13339d
Revises: 187eade64ef0
Create Date: 2016-06-17 13:46:10.921685
"""
# revision identifiers, used by Alembic.
revision = '51775a13339d'
down_revision = '187eade64ef0'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('revision', sa.Column('... | dropbox/changes | migrations/versions/51775a13339d_patch_hash_column.py | Python | apache-2.0 | 428 |
# coding=utf-8
class Parent(object):
__parentAttr = 100
_parentAttr = 100
parentAttr = 100
def __init__(self):
print "父类构造函数"
def parentMethod(self):
print "父类方法"
def _protectedMethod(self):
print "我是protected方法"
def __privateMethod(self):
print "我是private方法"
def overWriteMethod(self):
print "父... | seasonfif/python | learning/classmodule/Parent.py | Python | apache-2.0 | 1,829 |
from pegasus.metrics import db
def migrate():
cur = db.cursor()
cur.execute("alter table planner_metrics add dax_input_files int unsigned")
cur.execute("alter table planner_metrics add dax_inter_files int unsigned")
cur.execute("alter table planner_metrics add dax_output_files int unsigned")
cur.... | pegasus-isi/pegasus-metrics | pegasus/metrics/migrations/008_add_file_counts.py | Python | apache-2.0 | 428 |
# 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/estimator/keras.py | Python | apache-2.0 | 21,876 |
"""Test for treadmill.metrics."""
import unittest
from collections import namedtuple
# Disable W0611: Unused import
import tests.treadmill_test_deps # pylint: disable=W0611
import mock
from treadmill import metrics
from treadmill import sysinfo
STATINFO = """cache 0
rss 0
mapped_file 0
pgpgin 0
pgpgout 0
swap 0
i... | toenuff/treadmill | tests/metrics_test.py | Python | apache-2.0 | 3,085 |
import sys
sys.path.insert(1, "../../../")
import h2o, tests
def swpredsRF():
# Training set has two predictor columns
# X1: 10 categorical levels, 100 observations per level; X2: Unif(0,1) noise
# Ratio of y = 1 per Level: cat01 = 1.0 (strong predictor), cat02 to cat10 = 0.5 (weak predictors)
... | kyoren/https-github.com-h2oai-h2o-3 | h2o-py/tests/testdir_algos/rf/pyunit_swpredsRF.py | Python | apache-2.0 | 1,272 |
from crispy_forms.helper import FormHelper
from crispy_forms.layout import *
from crispy_forms.bootstrap import *
from crispy_forms.layout import Layout, Submit, Reset, Div
from django import forms
from django.contrib.auth.forms import UserCreationForm
from workflow.models import TolaUser
from django.contrib.auth.model... | mercycorps/TolaActivity | tola/forms.py | Python | apache-2.0 | 3,887 |
"""
Copyright 2016 (c) Rakshak Talwar
Released under the Apache 2 License
"""
import json, pdb, re, time
import HTMLParser
import sqlite3 as sql
import requests
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
### global variables ###
hparse = HTMLParser.HTMLParser()
### gather authentic... | RakshakTalwar/hatchpitchpull | hatchpitchpull/hatchpitchpull.py | Python | apache-2.0 | 12,244 |
# Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2015 Tom Barron. 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 ob... | dims/cinder | cinder/volume/drivers/netapp/dataontap/client/client_base.py | Python | apache-2.0 | 15,903 |
# (c) Copyright 2014 Cisco Systems 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/jacket | jacket/storage/zonemanager/drivers/cisco/cisco_fc_zone_client_cli.py | Python | apache-2.0 | 18,157 |
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | RNAcentral/rnacentral-webcode | rnacentral/portal/rfam_matches.py | Python | apache-2.0 | 14,300 |
import mock
from zerver.lib.test_classes import ZulipTestCase
from typing import Dict
class TestFeedbackBot(ZulipTestCase):
def setUp(self) -> None:
user_profile = self.example_user('hamlet')
self.login(user_profile.email, realm=user_profile.realm)
def test_create_video_call_success(self) -> N... | dhcrzf/zulip | zerver/tests/test_create_video_call.py | Python | apache-2.0 | 1,733 |
# coding: utf-8
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger... | iEngage/python-sdk | test/test_interaction_response.py | Python | apache-2.0 | 971 |
#!/usr/bin/env python
# import all needed libraries
import sys
import time
import sockjs.tornado
from tornado import web, ioloop
from sockjs.tornado import SockJSRouter, SockJSConnection
import pigpio
import subprocess
import os
import signal
from thread import start_new_thread
import random
import colorsys
import pya... | karaambaa/RGB-LED-Server | server.py | Python | apache-2.0 | 15,826 |
#!/usr/bin/env python
import argparse
import logging
import os
import subprocess
import sys
def setup_logging(args, bam_name):
logging.basicConfig(
filename=os.path.join(bam_name + '.log'),
level=args.level,
filemode='w',
format='%(asctime)s %(levelname)s %(message)s',
date... | jeremiahsavage/bam_reheader | bam_reheader/main.py | Python | apache-2.0 | 2,824 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| texastribune/tt_streams | example/manage.py | Python | apache-2.0 | 320 |
import os
from datetime import timezone, timedelta, datetime
import json
import csv
def read_directory(directory_name):
files = []
for (dirpath, dirnames, filenames) in os.walk(directory_name):
files.extend(filenames)
break
return files
def read_file(filename):
is_tweet = lambda json... | chuajiesheng/twitter-sentiment-analysis | apology/scripts/extraction.py | Python | apache-2.0 | 10,235 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('mig_main', '0002_initial_split'),
]
operations = [
migrations.AddField(
model_name='officerposition',
... | tbpmig/mig-website | mig_main/migrations/0003_officerposition_position_type.py | Python | apache-2.0 | 508 |
# 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... | usc-isi/extra-specs | nova/tests/api/openstack/compute/contrib/test_cloudpipe.py | Python | apache-2.0 | 7,279 |
#!/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 b... | googleads/googleads-shopping-samples | python/shopping/content/datafeeds/update.py | Python | apache-2.0 | 1,688 |
import logging
import sys
from argparse2tool import load_argparse
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class Arg2GxmlParser:
def __init__(self):
ap = load_argparse() # avoid circular imports
help_text = (
"argparse2tool forms Galaxy XML and CWL... | erasche/argparse2tool | argparse2tool/cmdline2gxml/__init__.py | Python | apache-2.0 | 1,040 |
import sys
import xbmc,xbmcaddon,xbmcvfs
import sqlite3
from subprocess import Popen
import datetime,time
# from vpnapi import VPNAPI
channel = sys.argv[1]
start = sys.argv[2]
ADDON = xbmcaddon.Addon(id='script.stargate.guide')
def adapt_datetime(ts):
# http://docs.python.org/2/library/sqlite3.html#registering-a... | TheWardoctor/Wardoctors-repo | script.stargate.guide/resources/playwith/playwithchannel.py | Python | apache-2.0 | 2,920 |
# -*- coding: utf8 -*-
# Extracted data:
# Favorite places
# Bookmarks
# Search queries history
from physical import *
import SQLiteParser
from System.Convert import IsDBNull
__author__ = "Dmitry Merkuryev"
def chromiumTimestampParse(timestamp):
return TimeStamp.FromUnixTime(timestamp / 1000000 - 1164... | dimorinny/ufed-modules | ya-maps.py | Python | apache-2.0 | 7,341 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Widgets for advanced display of files."""
import json
from django import http
from grr.gui import renderers
from grr.lib import utils
class HexView(renderers.TemplateRenderer):
"""Display a HexView of a file.
Internal State:
- a... | spnow/grr | gui/plugins/fileview_widgets.py | Python | apache-2.0 | 7,084 |
# just listing list of requires. will create a set up using these
"""
airflow>=1.7.1,
numpy>=1.1,
requests>=2.1,
pymongo==3.4.0,
pytest>=3.0,
simplejson==3.10.0,
tox==2.6
PyYAML==3.12
"""
| mettadatalabs1/oncoscape-datapipeline | setup.py | Python | apache-2.0 | 191 |
# Copyright 2011 The greplin-tornado-sendgrid 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... | Cue/greplin-tornado-sendgrid | src/greplin/tornado/sendgrid.py | Python | apache-2.0 | 2,166 |
#!/usr/bin/env python
#
# Copyright 2015 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 requir... | Aloomaio/googleads-python-lib | examples/ad_manager/v201805/report_service/run_sales_report.py | Python | apache-2.0 | 2,040 |
from collections import defaultdict
from datetime import datetime
import pytz
import simplejson
from ichnaea.data.export import (
MetadataGroup,
ReportUploader,
)
class InternalTransform(object):
# *_id maps a source section id to a target section id
# *_map maps fields inside the section from sour... | therewillbecode/ichnaea | ichnaea/data/internal.py | Python | apache-2.0 | 4,710 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11a1 on 2017-05-12 17:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | JiaruZhang/Five | main/migrations/0002_auto_20170512_1731.py | Python | apache-2.0 | 2,835 |
from django.conf.urls import patterns, url
from bookswap import views
urlpatterns = patterns(
'',
#url(r'^$', views.index, name='index'),
url(r'^admin/start_transaction/$',
views.start_transaction, name='start_transaction'),
url(r'^admin/update_person/$',
views.update_person, name='update... | tbpmig/mig-website | bookswap/urls.py | Python | apache-2.0 | 747 |
import pandas as pd
import numpy as np
import os
def concatDataFrames():
score_df = pd.read_pickle('../../dataset/score_df.pickle')
tf_idf_df = pd.read_pickle('../../dataset/score_df_tfidf.pickle')
lsa_df = pd.read_pickle('../../dataset/score_df_lsa_cvect.pickle')
# Read additional features from the result of fea... | Iolaum/Phi1337 | scripts/pipeline/a03d_matrix_concat.py | Python | apache-2.0 | 1,585 |
import os
import subprocess
import time
from config import dataDir
__author__ = 'abr'
def md5sumRunner(reportfile):
with open(reportfile,"w") as fileThing:
start = time.time()
for dir, dirs, files in os.walk(dataDir):
if files:
for file in sorted(files):
... | openpreserve/Scape-Tool-Tester | app/md5sumEvaluator.py | Python | apache-2.0 | 773 |
# coding: utf-8
from unittest import TestCase
from yased import EventsDispatcher, Event
class AnyEvent(Event):
"""Represents any event."""
class EventsDispatcherTestCase(TestCase):
def setUp(self):
self.ed = EventsDispatcher()
def test_send(self):
calls = []
def handler(*args... | pavelpat/yased | src/tests/__init__.py | Python | apache-2.0 | 1,664 |
#
# 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 or agreed to in w... | sassoftware/rmake | rmake/cmdline/helper.py | Python | apache-2.0 | 30,546 |
'''
Structures useful for parsing an MS-DOS style MBR.
'''
import os
import math
import logging
import contextlib
import collections
import vstruct2.types as v_types
# assumption: sectors are 512-bytes in lenght
# anything other than this is... non-standard, and weird.
SECTOR_SIZE = 512
# partition types
SYSTEMID ... | vivisect/dissect | dissect/formats/mbr.py | Python | apache-2.0 | 3,391 |
#-*- coding: utf-8 -*-
from django.contrib.gis.db.models import DateTimeField, Model
class Base(Model):
created = DateTimeField(auto_now_add=True, null=True)
modified = DateTimeField(auto_now=True, null=True)
class Meta:
abstract = True
def __str__(self):
try:
for propnam... | FirstDraftGIS/firstdraft | projfd/appfd/models/base.py | Python | apache-2.0 | 940 |
#!/usr/bin/env python
#
# Copyright 2018 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 require... | googlearchive/simian | src/simian/mac/admin/xsrf.py | Python | apache-2.0 | 2,004 |
# Copyright (c) 2010-2014 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | KoreaCloudObjectStorage/swift3 | swift3/controllers/multi_delete.py | Python | apache-2.0 | 4,002 |
class Warrior(object):
def __init__(self, name, author, source, score=0):
self.name = name
self.author = author
self.source = source
self.score = score
| SilverWingedSeraph/corewar32 | toroid/toroid/warrior.py | Python | apache-2.0 | 188 |
# coding=utf-8
#
# Copyright (c) 2011-2015 First Flamingo Enterprise B.V.
#
# 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... | firstflamingo/python_utilities | markup.py | Python | apache-2.0 | 13,400 |
#!/usr/bin/python
## ################################################################################
## the package and lib that must install:
##
## OpenIPMI
## yum install OpenIPMI-python
##
## Pexpect:Version 3.3 or higher
## caution: a lower version will cause some error like "timeout nonblocking() in read" when... | OpenDeployment/openstack-cloud-management | tools/checkOs_InstallStatus.py | Python | apache-2.0 | 6,462 |
# 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,... | google/wasserstein-dist | compute_all.py | Python | apache-2.0 | 2,165 |
"""Implementation of treadmill admin ldap CLI cell plugin.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import click
from ldap3.core import exceptions as ldap_exceptions
from treadmill import admin
... | bretttegart/treadmill | lib/python/treadmill/cli/admin/ldap/cell.py | Python | apache-2.0 | 6,420 |
from setuptools import setup, find_packages
from dvc import VERSION
install_requires = [
"ply>=3.9", # See https://github.com/pyinstaller/pyinstaller/issues/1945
"configparser>=3.5.0",
"zc.lockfile>=1.2.1",
"future>=0.16.0",
"colorama>=0.3.9",
"configobj>=5.0.6",
"networkx>=2.1",
"pyy... | dataversioncontrol/dvc | setup.py | Python | apache-2.0 | 1,895 |
# 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/tensorboard | tensorboard/plugins/mesh/summary_v2_test.py | Python | apache-2.0 | 5,916 |
# Copyright 2021 The TF-Coder 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... | google-research/tensorflow-coder | tf_coder_colab_logging/serialization.py | Python | apache-2.0 | 6,543 |
#!/usr/bin/env/ python
'''
Title - Create multi-signature address
'''
# Import bitcoin
from bitcoin import *
my_private_key1 = random_key()
my_private_key2 = random_key()
my_private_key3 = random_key()
print("Private Key1: %s\n" % my_private_key1)
print("Private Key2: %s\n" % my_private_key2)
print("Priv... | codevan/codevan | BitcoinPlay/multisig_address.py | Python | apache-2.0 | 911 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sxjscience/tvm | python/tvm/auto_scheduler/search_policy.py | Python | apache-2.0 | 7,529 |
# Copyright 2016 The Eyra 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 la... | Eyra-is/Eyra | Backend/server-interface/qc/scripts/create_wrong_prompts/createBadData.py | Python | apache-2.0 | 4,134 |
#!/usr/bin/python
import urllib
print dir(urllib)
help(urllib.urlopen)
| richardcardona/learnpython-exercises | dirhelp.py | Python | apache-2.0 | 75 |
from helpers.basehelper import BaseHelper
from suds.client import Client
from suds import WebFault
from model.project import Project
class SoapHelper(BaseHelper):
def __init__(self, app):
self.app = app
self.client = Client(self.app.base_url + self.app.config['soap']['url'])
def can_login(se... | dkorogodin/python_mantis | helpers/soap.py | Python | apache-2.0 | 1,072 |
# Copyright 2019,2020,2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | sony/nnabla | python/test/function/test_where.py | Python | apache-2.0 | 1,821 |
#!/usr/bin/env python
# -*- coding: utf-8 -*
# Copyright 2015 Actian Corporation
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#... | ActianCorp/dbmv | bin/driverTools.py | Python | apache-2.0 | 12,678 |
#!/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
# "... | apache/incubator-airflow | tests/providers/google/cloud/operators/test_gcs_system_helper.py | Python | apache-2.0 | 2,215 |
"""
Base objects used in the application
"""
import warnings
import pygame
from .utils import lazy_property
class Drawable(object):
"""
Base for the objects providing drawing functionality.
Specifically, it has a surface on which it should draw
itself. It also has an update() method that is called... | rshk/PyGauges | pygauges/base.py | Python | apache-2.0 | 3,280 |
#
# Copyright (C) 2008 The Android 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 applicable la... | wzhy90/git-repo | subcmds/sync.py | Python | apache-2.0 | 27,721 |
#
# 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 us... | actuaryzhang/spark | python/pyspark/ml/feature.py | Python | apache-2.0 | 155,266 |
# -*- coding: utf-8 -*-
# (C) Copyright 2020 IBM Corp.
# (C) Copyright 2020 Inova Development 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.apac... | pywbem/pywbemtools | tests/unit/pywbemcli/test_connection_repository.py | Python | apache-2.0 | 32,125 |
# Copyright (c) 2017 Huawei Tech. Co., Ltd. .
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | openstack/dragonflow | dragonflow/tests/fullstack/test_os_ken_base_app.py | Python | apache-2.0 | 3,194 |
import configparser
parser = configparser.SafeConfigParser()
parser.add_section('bug_tracker')
parser.set('bug_tracker', 'url', 'http://localhost:8080/bugs')
parser.set('bug_tracker', 'username', 'dhellmann')
parser.set('bug_tracker', 'password', 'secret')
for section in parser.sections():
print(section)
for... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_application_building_blocks/configparser_populate.py | Python | apache-2.0 | 408 |
from django.test import TestCase
from django.http import HttpRequest, QueryDict
import forms
import models
class MachineIssue(TestCase):
fixtures = ['dev',]
def setUp(self):
pass
def testSingleUpdateForm(self):
"""
Test the itemStatusForm to see if it updates the machine correctl... | abztrakt/labtracker | Machine/tests.py | Python | apache-2.0 | 765 |
#!flask/bin/python
from flask import Flask, jsonify, abort
from flask import make_response
from flask import request
app = Flask(__name__)
#simulated data in list
vnfs = [
{
'vnf_id':1,
'vnf_name': u'vnf01',
'description': u'vnf03 description'
},
{
'vnf_id':2,
'vn... | IT-SeanWANG/CodeJam | 2016_1st/Refer2_Q3.py | Python | apache-2.0 | 2,440 |
'''Find all 2-cycles.
'''
from loops import *
import traceback
import logging
logging.basicConfig(filename='debug_count.log', filemode='w', level=logging.WARNING)
sys.stderr.write('reading master.opt\n')
opts = parse_transforms(open('master.opt').read())
#opts = opts[0:1]
#opts = opts[0:40]
sys.stderr.write('%s ... | rutgers-apl/alive-loops | debug_count.py | Python | apache-2.0 | 1,582 |
# Generated by Django 2.2 on 2019-05-03 14:04
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import libya_elections.libya_bread
class Migration(migrations.Migration):
initial = True
dependencies = [
('register', '__first__'),
]
operat... | SmartElect/SmartElect | audit/migrations/0001_initial.py | Python | apache-2.0 | 4,421 |
import unittest
from datetime import datetime
from kanaria.core.service.db import MongoDBService
class ModelExample(object):
def __init__(self, title="", description="", date=None):
self.title = title
self.description = description
self.date = date if date else datetime.now()
self... | icoxfog417/kanaria | tests/core/test_service_db.py | Python | apache-2.0 | 987 |
"""
Copyright 2017 Pani Networks Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | romana/vpc-router | vpcrouter/tests/test_http_server.py | Python | apache-2.0 | 1,361 |
#!/usr/bin/env python
"""
Integration (not unit) tests for pylast.py
"""
import unittest
import pylast
from .test_pylast import TestPyLastWithLastFm
class TestPyLastTrack(TestPyLastWithLastFm):
def test_love(self):
# Arrange
artist = "Test Artist"
title = "test title"
track = sel... | hugovk/pylast | tests/test_track.py | Python | apache-2.0 | 6,969 |
# coding=utf-8
# Copyright 2018 The DisentanglementLib 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
#
# Un... | google-research/disentanglement_lib | disentanglement_lib/evaluation/metrics/fairness.py | Python | apache-2.0 | 8,341 |
# vim: set fenc=utf8 ts=4 sw=4 et :
import json
import dict2xml
from .autovivification import AutoVivification
from .conf import Conf
from .utils import call_plugin
from .logging import *
class Flow():
# The overall frame time
newest_overall_frame_time = 0
@staticmethod
def get_flow_id(frame):
... | Enteee/pdml2flow | pdml2flow/flow.py | Python | apache-2.0 | 3,496 |
# Copyright (c) 2018 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 app... | chengduoZH/Paddle | python/paddle/fluid/profiler.py | Python | apache-2.0 | 13,034 |
import os
import subprocess
import click
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
JAR_EXECUTE = "java -jar " + DIR_PATH + "/kbox-v0.0.2-alpha.jar" # kbox-v0.0.2-alpha.jar
SPACE = " "
PUSH_COMMAND = 'push'
COMMAND_LIST = [PUSH_COMMAND]
@click.command(context_settings={"ignore_unknown_options": True})
... | AKSW/KBox | kbox.pip/kbox/kbox.py | Python | apache-2.0 | 1,180 |
from itertools import combinations
START_P_HP = 100
START_P_DMG = 0
START_P_A = 0
START_B_HP = 100
START_B_DMG = 8
START_B_A = 2
WEAPONS = [ [8,4,0], [10,5,0], [25,6,0], [40,7,0], [74,8,0] ]
ARMOR = [ [13,0,1], [31,0,2], [53,0,3], [75,0,4], [102,0,5] ]
#Include 'no armor' option
ARMOR.append([0,0,0])
RINGS = [ [25,1... | tosmun/AdventOfCode | solutions/day21/p2/main.py | Python | apache-2.0 | 1,368 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... | lucperkins/heron | heron/tools/tracker/src/python/handlers/jstackhandler.py | Python | apache-2.0 | 3,190 |
__author__ = 'rwechsler'
import cPickle as pickle
import itertools
import random
from annoy import AnnoyIndex
import multiprocessing as mp
import sys
import argparse
import time
import datetime
import numpy as np
def timestamp():
return datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
d... | jodaiber/semantic_compound_splitting | visualization_and_test/evaluate_candidates_indiv.py | Python | apache-2.0 | 4,883 |
# -*- coding: utf-8 -*-
def execute_rule(**kwargs):
sql = kwargs.get("sql")
bind_num = kwargs.get("or_num")
if sql.count(" or ") > bind_num:
return True
return False
| CreditEaseDBA/Themis | rule_analysis/rule/text/toomany_or.py | Python | apache-2.0 | 192 |
# 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 th... | bndl/bndl | bndl/compute/tests/test_many_nodes.py | Python | apache-2.0 | 745 |
#
# 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/ppml/src/bigdl/ppml/algorithms/hfl_logistic_regression.py | Python | apache-2.0 | 942 |
#
# 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/appfw/appfwprofile_contenttype_binding.py | Python | apache-2.0 | 9,811 |
import datetime
import logging
import os
import shutil
from typing import Any, Dict, Iterable, List, Optional, Tuple
import boto3
import ujson
from bs4 import BeautifulSoup
from django.conf import settings
from django.db import connection
from django.db.models import Max
from django.utils.timezone import now as timezo... | synicalsyntax/zulip | zerver/lib/import_realm.py | Python | apache-2.0 | 58,863 |
from dis import dis
import stella
import llvmlite.ir as ll
import llvmlite.binding as llvm
import pdb
from pdb import pm
from wip import *
# Now logging is turned off by default, but this is for debugging:
stella.logLevel('DEBUG')
# pylama:ignore=W0611,W0401
| squisher/stella | ipythoninit.py | Python | apache-2.0 | 261 |
#!/usr/bin/env python3
"""Generate an updated requirements_all.txt."""
import importlib
import os
import pkgutil
import re
import sys
import fnmatch
COMMENT_REQUIREMENTS = (
'Adafruit-DHT',
'Adafruit_BBIO',
'avion',
'beacontools',
'blinkt',
'bluepy',
'bme680',
'credstash',
'decora',... | jamespcole/home-assistant | script/gen_requirements_all.py | Python | apache-2.0 | 10,045 |
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... | Yelp/kafka-utils | tests/acceptance/steps/common.py | Python | apache-2.0 | 2,265 |