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 |
|---|---|---|---|---|---|
"""
Make torrent.
Author(s): Arno Bakker, Bram Cohen
"""
from tribler_core.utilities import path_util
from tribler_core.utilities.unicode import ensure_unicode_detect_encoding
def pathlist2filename(pathlist):
""" Convert a multi-file torrent file 'path' entry to a filename. """
return path_util.join(*(ensure... | hbiyik/tribler | src/tribler-core/tribler_core/utilities/maketorrent.py | Python | lgpl-3.0 | 859 |
#!/usr/bin/python
#
# Copyright (C) 2015 JWCrypto Project Contributors, see LICENSE file
from setuptools import setup
setup(
name = 'jwcrypto',
version = '0.2.0',
license = 'LGPLv3+',
maintainer = 'JWCrypto Project Contributors',
maintainer_email = 'simo@redhat.com',
url='https://github.com/... | puiterwijk/jwcrypto | setup.py | Python | lgpl-3.0 | 764 |
from pycp2k.inputsection import InputSection
class _becke88_lr3(InputSection):
def __init__(self):
InputSection.__init__(self)
self.Section_parameters = None
self.Scale_x = None
self.Omega = None
self._name = "BECKE88_LR"
self._keywords = {'Omega': 'OMEGA', 'Scale_x... | SINGROUP/pycp2k | pycp2k/classes/_becke88_lr3.py | Python | lgpl-3.0 | 385 |
from zope.interface import implements
from Products.CMFQuickInstallerTool.interfaces import INonInstallable
from five import grok
from collective.grok import gs
from zope.i18nmessageid import MessageFactory
# Set up the i18n message factory for our package
MessageFactory = MessageFactory('wcc.api')
_ = MessageFactory... | oikoumene/wcc.api | wcc/api/__init__.py | Python | lgpl-3.0 | 734 |
#!/usr/local/bin/python3
''' # ---
compare_record_counts.py
Compares two files' full of csv-formatted lists of record counts -- files
generated by mysql_record_count.py, for example. This program generates a file
giving a list of tables with changes in the counts of their records and the
number of records added or d... | drewdle/landshark | compare_record_counts.py | Python | unlicense | 2,126 |
from __future__ import unicode_literals
from ckeditor.fields import RichTextField
from filer.fields.image import FilerImageField
from cms.models import CMSPlugin, PlaceholderField
from django.utils.translation import ugettext_lazy as _
from django.db import models
class Project(models.Model):
name = models.Char... | pmutale/www.mutale.nl | stick2uganda/models.py | Python | unlicense | 3,647 |
"""
Tuples are very similar to lists, except that they are immutable (they cannot be changed).
"""
words = ("spam", "eggs", "sausages",)
print(words[0])
# spam
"""
Trying to reassign a value in a tuple causes a TypeError.
"""
words[1] = "cheese"
# TypeError: 'tuple' object does not support item assignment
""... | rajibmp/sololearn | python/06-types/06-tuples.py | Python | unlicense | 394 |
"""
Django app for easy embeding YouTube and Vimeo videos and music from
SoundCloud.
"""
VERSION = (0, 8, 'dev')
def get_release():
return '.'.join(str(i) for i in VERSION[:3])
def get_version():
"""
Returns only digit parts of version.
"""
return '.'.join(str(i) for i in VERSION[:2])
__versi... | orlenko/bccf | src/embed_video/__init__.py | Python | unlicense | 341 |
# Author: Peter Prettenhofer <peter.prettenhofer@gmail.com>
# Olivier Grisel <olivier.grisel@ensta.org>
# Mathieu Blondel <mathieu@mblondel.org>
# Lars Buitinck <L.J.Buitinck@uva.nl>
# License: BSD 3 clause
from __future__ import print_function
import logging
import numpy as np
from optparse i... | yaodi833/shorttext | document_classification_20newsgroups.py | Python | unlicense | 9,740 |
#!/usr/bin/python3.4
# -*- coding: iso-8859-15 -*-
# -O Optimize e non scrive il __debug__
#
# ####################################################################################################################
import sys, os
import types
import platform
import openpyxl
from openpyxl.utils import get_column_letter... | Loreton/MP3Catalog | Source/LnLib/Excel/LnExcel_Class.py | Python | unlicense | 7,629 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-07 14:44
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quiz', '0012_auto_20170407_1442'),
]
operations = [
migrations.AlterUniqueTogether(
... | denys-zarubin/sweetheart_test | quiz/migrations/0013_auto_20170407_1444.py | Python | unlicense | 407 |
from __future__ import print_function
from fabric.api import local, run, cd, env
env.forward_agent = 'True'
def deploy():
local('git push')
with cd('webapps/basic/nematode'):
run('git pull')
run('chmod 644 *.js *.css *.html *.png *.pdf .htaccess')
| chebee7i/nematode | fabfile.py | Python | unlicense | 275 |
# 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 required by applicable law or a... | GoogleCloudPlatform/python-compat-runtime | appengine-vmruntime/vmruntime/tests/legacy_e2e_support_test_app.py | Python | apache-2.0 | 1,030 |
"""
.. module: cloudaux.aws.decorators
:platform: Unix
:copyright: (c) 2018 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Patrick Kelley <pkelley@netflix.com> @monkeysecurity
.. moduleauthor:: Mike Grima <mgrima@netflix.com>
"""
import functools
impo... | Netflix-Skunkworks/cloudaux | cloudaux/aws/decorators.py | Python | apache-2.0 | 2,672 |
import sublime
_acc_value = 1
_busy_indicator_size = 8
_commandsInProgress = []
def run_progress_indicator(thread, message, success_message, fail_message):
global _commandsInProgress
_commandsInProgress.append(CommandInProgressModel(thread, message, success_message, fail_message))
if len(_commandsInProg... | dimitardanailov/appbuilder-sublime-package | app_builder/thread_progress.py | Python | apache-2.0 | 3,101 |
# Copyright 2011 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,... | natduca/ndbg | tests/ui/test_output_tab.py | Python | apache-2.0 | 1,123 |
"""compare providers
Revision ID: 6261d01a8a89
Revises: b5c4bf4603be
Create Date: 2016-05-25 08:33:09.061411
"""
# revision identifiers, used by Alembic.
revision = '6261d01a8a89'
down_revision = 'b5c4bf4603be'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
... | giubil/trackit | api/files/api/migrations/versions/6261d01a8a89_compare_providers.py | Python | apache-2.0 | 808 |
#
# Copyright 2014 Thomas Rabaix <thomas.rabaix@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | rande/python-element | element/plugins/static/loader.py | Python | apache-2.0 | 1,563 |
# coding=utf-8
# Copyright 2020 The TF-Agents 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | tensorflow/agents | tf_agents/agents/qtopt/qtopt_agent.py | Python | apache-2.0 | 28,159 |
month = int(input("Enter month: "))
year = int(input("Enter year: "))
if month == 1:
monthName = "January"
numberOfDaysInMonth = 31
elif month == 2:
monthName = "February"
if year % 400 == 0 or (year % 4 == 0 and year % 100 != 0):
numberOfDaysInMonth = 29
else:
numberOfDa... | asmitde/TA-PSU-CMPSC101 | Fall 2016/Homeworks/HW4/Solution/problem5.py | Python | apache-2.0 | 1,132 |
#!/usr/bin/env python
from __future__ import print_function
import sys
import os
import shutil
import shlex
import argparse
import netCDF4 as nc
import numpy as np
import tempfile
import subprocess as sp
import multiprocessing as mp
my_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(my... | CWSL/access-om | tools/make_remap_weights.py | Python | apache-2.0 | 8,602 |
#!/usr/bin/env python
#
# parttool is used to perform partition level operations - reading,
# writing, erasing and getting info about the partition.
#
# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | krzychb/rtd-test-bed | components/partition_table/parttool.py | Python | apache-2.0 | 10,853 |
# -*- coding: utf-8 -*-
from model.address import Address
def test_add_address(app, json_addresses, db, check_ui):
address = json_addresses
old_addresses = db.get_address_list()
app.address.create(address)
old_addresses.append(address)
assert len(old_addresses) == app.address.count()
if check... | vpalex999/python_training | test/test_add_address.py | Python | apache-2.0 | 453 |
# encoding=utf-8
__author__ = 'Hinsteny'
class Student(object):
def __init__(self, name, score):
self._name = name
self.__name = name
self.__score = score
def print_score(self):
print('%s: %s' % (self.__name, self.__score))
bart = Student('Bart Simpson', 98)
print(bart._na... | InverseLina/python-practice | Category/Test__.py | Python | apache-2.0 | 389 |
#!/usr/bin/env python
import os
import subprocess
from os.path import join, dirname
from cloudify import ctx
ctx.download_resource(
join('components', 'utils.py'),
join(dirname(__file__), 'utils.py'))
import utils # NOQA
SERVICE_NAME = 'stage'
# Some runtime properties to be used in teardown
runtime_props... | cloudify-cosmo/cloudify-manager-blueprints | components/stage/scripts/create.py | Python | apache-2.0 | 3,954 |
# Copyright 2014 LinkedIn Corp.
#
# 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.... | arpras/Zopkio | zopkio/constants.py | Python | apache-2.0 | 1,224 |
from ciphertext import Ciphertext
import time
c = Ciphertext()
c.text_in('hello')
assert c.text_out() == 'hello'
d = Ciphertext()
d.text_in('No King of the Isles had ever needed a Hand')
with open('sample.txt','r') as source:
natural_text = source.read()
natural = Ciphertext()
natural.text_in(natural_text)
natur... | paulsbrookes/subcipher | index_based/test.py | Python | apache-2.0 | 405 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | generalization_representations_rl_aistats22/atari/train.py | Python | apache-2.0 | 4,622 |
# -*- coding: utf-8 -*-
__all__ = [
"PYTHAINLP_DEFAULT_DATA_DIR",
"get_full_data_path",
"get_pythainlp_data_path",
"get_pythainlp_path",
"misspell",
]
from pythainlp.tools.path import (
PYTHAINLP_DEFAULT_DATA_DIR,
get_full_data_path,
get_pythainlp_data_path,
get_pythainlp_path,
)
f... | PyThaiNLP/pythainlp | pythainlp/tools/__init__.py | Python | apache-2.0 | 365 |
from block import *
import os
import time
import base64
from logging import ERROR, WARN, INFO, DEBUG
class file_data_reader(Block):
def on_load(self, config):
self.config = config
self.add_port("input", Port.PUSH, Port.UNNAMED, ["url"])
self.add_port("output", Port.PUSH, Port.UNNAMED, ["url", "data"])
... | mpi-sws-rse/datablox | blox/file_data_reader__1_0/b_file_data_reader.py | Python | apache-2.0 | 803 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing 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/LICENS... | probcomp/bayeslite | src/stats.py | Python | apache-2.0 | 6,235 |
# import the necessary packages
from skimage.segmentation import slic
from skimage.segmentation import mark_boundaries
from skimage.util import img_as_float
from skimage.transform import rescale
from skimage import io
import matplotlib.pyplot as plt
import argparse
img_file = "../data/similar_objects/1.JPG"
# load t... | m3rik/nn | CNTK/GeneralizedHoughTransform/slic.py | Python | apache-2.0 | 900 |
#!/usr/bin/python
import re
from multiprocessing import Process
def avgList(list):
min = list[0]
max = list[0]
for val in list:
if val< min:
min=val
if val > max:
max=val
list.remove(min)
list.remove(max)
cummulated = 0
count = 0
for val in list:... | srijeyanthan/hadoop_2_4_0_experimental_version | scripts/deployment_scripts/parslogs_mt.py | Python | apache-2.0 | 7,713 |
# vim:fileencoding=utf-8:ts=2:sw=2:expandtab
import json
##################################################
class JobSpecification(object):
Name = ""
def __init__(self, *, InputKey, OutputKeyPrefix):
if not self.Name:
self.Name = self.__class__.__name__.replace('Job', '')
self.InputKey = InputKey
... | appcove/DocStruct | Python/DocStruct/JobSpecification.py | Python | apache-2.0 | 1,993 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | usc-isi/essex-baremetal-support | nova/tests/test_api.py | Python | apache-2.0 | 22,746 |
# -*- coding: utf-8 -*-
'''
This module contains all of the routines needed to set up a master server, this
involves preparing the three listeners and the workers needed by the master.
'''
# Import python libs
from __future__ import absolute_import
import copy
import os
import re
import sys
import time
import errno
im... | smallyear/linuxLearn | salt/salt/master.py | Python | apache-2.0 | 85,621 |
#
# Copyright 2018 PyWren 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 in writing... | pywren/pywren | tests/test_pickle.py | Python | apache-2.0 | 5,292 |
import ovlib.verb
from ovlib.dispatcher import dispatcher, command, Dispatcher
from ovlib.wrapper import ObjectWrapper, ListObjectWrapper, wrapper
from ovirtsdk4.types import VnicProfile
from ovirtsdk4.writers import VnicProfileWriter
from ovirtsdk4.services import VnicProfilesService, VnicProfileService, AssignedVni... | fbacchella/ovirtcmd | ovlib/vnicprofile/__init__.py | Python | apache-2.0 | 1,344 |
# -*- 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-datacatalog | samples/generated_samples/datacatalog_v1_generated_data_catalog_get_tag_template_async.py | Python | apache-2.0 | 1,485 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import os
import numpy as np
import tensorflow as tf
import niftynet.io.image_loader as image_loader
from tests.niftynet_testcase import NiftyNetTestCase
CASE_NIBABEL_3D = 'testing_data/FLAIR_1023.nii.gz'
CASE_LOGO_2D = 'niftynet-logo.png'... | NifTK/NiftyNet | tests/image_loader_test.py | Python | apache-2.0 | 1,953 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | rnirmal/savanna | savanna/db_new/sqlalchemy/models.py | Python | apache-2.0 | 9,551 |
# Generated by Django 2.1.8 on 2019-05-02 23:22
import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
import django.utils.timezone
import gwells.db_comments.model_mixins
import wells.data_migrations
class Migration(migrations.Migration):
... | bcgov/gwells | app/backend/wells/migrations/0080_add_well_disinfect_status.py | Python | apache-2.0 | 2,423 |
from model.group import Group
import re
from timeit import timeit
def test_group_list(app, db):
print(timeit(lambda: app.group.get_group_list(), number=1))
def clean(group):
return Group(id=group.id, name=re.sub('\s+', ' ', group.name.strip()))
print(timeit(lambda: map(clean, db.get_group_list()),... | ble669/python_training | test/test_db_matches_ui.py | Python | apache-2.0 | 434 |
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument ('-n', '--num', type=float, default=float('-inf'), help='a number of your choice')
args = parser.parse_args()
num = args.num
if num == float('-inf'):
print('You should have made a choice')
... | tri2sing/IntroPython | Conditionals.py | Python | apache-2.0 | 468 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Event._update_cms_form'
db.add_column('webinars_event', '_update_cms_form', self.gf('djang... | prior/webinars | webinars_web/webinars/migrations/0037_auto__add_field_event__update_cms_form.py | Python | apache-2.0 | 25,544 |
# -*- coding: utf-8 -*-
# File: input_source_base.py
from abc import ABCMeta, abstractmethod
import copy
import six
from six.moves import zip
from contextlib import contextmanager
import tensorflow as tf
from ..utils.argtools import memoized, call_only_once
from ..callbacks.base import CallbackFactory
from ..tfutils.... | eyaler/tensorpack | tensorpack/input_source/input_source_base.py | Python | apache-2.0 | 7,697 |
import json
import mock
import pytest
from awx.main.models import Credential, CredentialType, Job
from awx.api.versioning import reverse
@pytest.fixture
def ec2_source(inventory, project):
with mock.patch('awx.main.models.unified_jobs.UnifiedJobTemplate.update'):
return inventory.inventory_sources.create... | wwitzel3/awx | awx/main/tests/functional/api/test_deprecated_credential_assignment.py | Python | apache-2.0 | 19,249 |
#!/usr/bin/env python
#
# Copyright 2015 British Broadcasting 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 requ... | bbc/pydvbcss | dvbcss/protocol/server/cii.py | Python | apache-2.0 | 13,575 |
#!/usr/bin/python
# Copyright 2015 Sam Yaple
#
# 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... | rthallisey/kolla-kubernetes-personal | kolla/ansible/library/kolla_docker.py | Python | apache-2.0 | 22,596 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/python-spanner-orm | spanner_orm/tests/conftest.py | Python | apache-2.0 | 833 |
#
# 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... | iemejia/incubator-beam | release/src/main/scripts/mass_comment.py | Python | apache-2.0 | 4,252 |
import socket
import platform
import multiprocessing
from distutils.version import LooseVersion
SocketBase = socket.socket
MpPipe = multiprocessing.Pipe
MpQueue = multiprocessing.Queue
MpProcess = multiprocessing.Process
ipdb_nl_async = True
commit_barrier = 0
# save uname() on startup time: it is not so
# highly po... | drzaeus77/pyroute2 | pyroute2/config/__init__.py | Python | apache-2.0 | 559 |
"""empty message
Revision ID: 4acdc03c38b0
Revises: 1d85516e9a94
Create Date: 2014-08-12 17:21:41.726000
"""
# revision identifiers, used by Alembic.
revision = '4acdc03c38b0'
down_revision = '1d85516e9a94'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | alwayssayyes/practice-tutti | migrations/versions/4acdc03c38b0_.py | Python | apache-2.0 | 605 |
# -*- coding: utf-8 -*-
def command():
return "attach-load-balancer"
def init_argument(parser):
parser.add_argument("--load-balancer-no", required=True)
parser.add_argument("--instance-no", required=True)
def execute(requester, args):
load_balancer_no = args.load_balancer_no
instance_no = args.in... | primecloud-controller-org/pcc-cli | src/pcc/api/lb/attach_load_balancer.py | Python | apache-2.0 | 511 |
# -*- coding: utf-8 -*-
#
# This file is part of django-taggit-autocomplete-modified.
#
# django-taggit-autocomplete-modified provides autocomplete functionality
# to the tags form field of django-taggit.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-taggit-autocomplete-modified
# Public... | onepercentclub/django-taggit-autocomplete-modified | src/taggit_autocomplete_modified/managers.py | Python | apache-2.0 | 1,736 |
#!/usr/bin/env python
#
# Copyright 2017 Robot Garden, 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 applicab... | ProgrammingRobotsStudyGroup/robo_magellan | scripts/wheel_sensor.py | Python | apache-2.0 | 2,941 |
from django.apps import AppConfig
class PurchaseorderManageConfig(AppConfig):
name = 'PurchaseOrder_manage'
| Pandaaaa906/ChemErpSystem | PurchaseOrder_manage/apps.py | Python | apache-2.0 | 114 |
'''
Created on Dec 23, 2014
@author: Debanjan Mahata
'''
from twython import TwythonStreamer
from TwitterAuthentication import keyList
from time import sleep
from random import randint
import EventInfoProcess.EventTweetProcess as tweetProcess
import EventInfoProcess.EventTweetClassifier as tweetClassify
import DataPr... | dxmahata/InformativeTweetCollection | DataCollection/TwitterEventDataCollection.py | Python | apache-2.0 | 2,321 |
# -*- coding: utf-8 -*-
#
# Copyright 2016-2021 BigML
#
# 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 ... | bigmlcom/bigmler | bigmler/topicdistribution.py | Python | apache-2.0 | 7,994 |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | lathama/Adynaton | adynaton/unittests/test_LightweightDirectoryAccessProtocolServer.py | Python | apache-2.0 | 1,218 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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.a... | sajuptpm/neutron-ipam | neutron/plugins/bigswitch/plugin.py | Python | apache-2.0 | 50,723 |
import re
from datetime import datetime
import os
import time
import subprocess
from ajenti.api import *
from ajenti.plugins.main.api import SectionPlugin
from ajenti.plugins.services.api import ServiceMultiplexor
from ajenti.ui import on
from ajenti.ui.binder import Binder
from ajenti.util import platform_select
fro... | lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/ntpd/main.py | Python | apache-2.0 | 4,668 |
#!/usr/bin/python
#
# Uploads artifacts to S3.
# Produces a universe, and uploads it to S3.
# If running in jenkins ($WORKSPACE is defined), writes $WORKSPACE/stub-universe.properties
#
# Env:
# S3_BUCKET (default: infinity-artifacts)
# S3_DIR_PATH (default: autdelete7d)
# S3_URL (default: s3://${S3_BUCKET}/${S3_... | tobilg/dcos-commons | tools/publish_aws.py | Python | apache-2.0 | 7,896 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | ioram7/keystone-federado-pgid2013 | build/python-keystoneclient/keystoneclient/openstack/common/jsonutils.py | Python | apache-2.0 | 5,983 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | sacharya/nova | nova/tests/integrated/api_samples_test_base.py | Python | apache-2.0 | 13,038 |
#
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from ttypes import *
AIRAVATA_API_VERSION = "0.17.0"
| gouravshenoy/airavata | airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/constants.py | Python | apache-2.0 | 276 |
from .test_helper import argv_kiwi_tests
import sys
import mock
import random
from azure.common import AzureMissingResourceHttpError
from collections import namedtuple
from datetime import datetime
from mock import patch
from pytest import raises
from azurectl.account.service import AzureAccount
from azurectl.config.p... | SUSE/azurectl | test/unit/instance_data_disk_test.py | Python | apache-2.0 | 17,303 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | QISKit/qiskit-sdk-py | qiskit/transpiler/passes/mapping/barrier_before_final_measurements.py | Python | apache-2.0 | 3,034 |
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from db.db_model import User
from settings import DATABASE_NAME, HOST, PASSWORD, USER
from common.strUtil import md5
__all__=['Singleton', 'DBOBJ']
class Singleton(object):
"""
Singleton class
"""
def __init__(self... | jinlongwang/app_qr_analysis | db/db_session.py | Python | apache-2.0 | 1,878 |
# Copyright 2022 The DDSP 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 wri... | magenta/ddsp | ddsp/training/models/__init__.py | Python | apache-2.0 | 1,613 |
#
# 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
# ... | Hybrid-Cloud/conveyor | conveyor/conveyorheat/engine/resources/stack_resource.py | Python | apache-2.0 | 21,855 |
# Copyright 2014 eNovance
#
# 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... | idegtiarov/ceilometer | ceilometer/opts.py | Python | apache-2.0 | 5,763 |
#!/usr/bin/env python
#Copyright 2013 Matthew Thode
#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... | prometheanfire/rackspace-challenges | challenge6.py | Python | apache-2.0 | 991 |
# 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
# distribu... | quantumlib/OpenFermion-Cirq | openfermioncirq/trotter/simulate_trotter_test.py | Python | apache-2.0 | 13,634 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tableacl.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _refl... | alainjobart/vitess | py/vtproto/tableacl_pb2.py | Python | apache-2.0 | 4,714 |
# Copyright 2012 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 agreed to in... | dims/keystone | keystone/token/provider.py | Python | apache-2.0 | 25,056 |
import os
import shutil
import unittest
import zopkio.runtime as runtime
class Args:
def __init__(self):
self.output_dir = None
self.log_level = "INFO"
self.console_level = "INFO"
self.machine_list = None
self.config_overrides = None
self.user = None
self.password = None
self.test_lis... | arpras/Zopkio | test/test_zopkio.py | Python | apache-2.0 | 1,464 |
#Shared Knowledge save to the cloud
def SaveMemory(question,reponse,silent,justPredicates):
sleep(0.5)
chatBot.savePredicates()
if justPredicates==0:
ServerResponse="0"
RetourServer=Parse("http://www.myai.cloud/shared_memory.php?action=update&question="+urllib2.quote(question)+"&reponse="+urllib2.quote(reponse.r... | MyRobotLab/pyrobotlab | home/moz4r/deprecated/Inmoov/InmoovScript_InmoovAI/INMOOV-AI_memory.py | Python | apache-2.0 | 1,664 |
import multiprocessing
import json
import time
import sys
import re
import logging
from collections import defaultdict
from jinja2 import Template
from scipy.interpolate import spline
from scipy.signal import butter, lfilter
import matplotlib.pyplot as plt
import numpy as np
"""
stats = {
'switches': defaultdict(d... | nachtkatze/sdn-diagnosis | monitor/monitor.py | Python | apache-2.0 | 17,272 |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
import json
from datetime import datetime
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolv... | kdeloach/raster-foundry | src/rf/apps/home/tests.py | Python | apache-2.0 | 24,353 |
# ====================================================================
# 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... | svn2github/pylucene | test2/test_IndexDeletionPolicy.py | Python | apache-2.0 | 2,964 |
from __future__ import print_function
import os
import sys
import networkx as nx
import pandas as pd
import re
# -----------------------------------------------------------------------------
def msplit(string, delims):
s = string
for d in delims:
rep = d + '\n'
s = rep.join(x for x in s.split(... | gasuperdev/sifra | sifra/systemlayout.py | Python | apache-2.0 | 7,677 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | covid_epidemiology/src/models/generic_seir_state_model_constructor.py | Python | apache-2.0 | 44,854 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | diffusion_distillation/diffusion_distillation/config/imagenet64_base.py | Python | apache-2.0 | 2,576 |
import os
import json
import time
import urllib2
import StringIO
import unittest
from jsonschema import validate
class TestBatchRecognition(unittest.TestCase):
def setUp(self):
time.sleep(1)
def test_batch_recognition(self):
response = self.get_response_for_wav()
self.assertResponse... | UFAL-DSG/cloud-asr | tests/test_batch_recognition.py | Python | apache-2.0 | 2,520 |
# 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
# distribu... | jarrodmcc/OpenFermion | src/openfermion/transforms/_jordan_wigner.py | Python | apache-2.0 | 10,817 |
#!/usr/bin/env python
import os
NFQ_NUMBER=42
ZMQ_ADDR=os.getenv('EQ_ETHER_ZMQ_ADDR')
import pyearthquake
from pyearthquake.middlebox.nfqhook import NFQHook
LOG = pyearthquake.LOG.getChild(__name__)
if __name__ == '__main__':
LOG.info("Please run `iptables -A OUTPUT -p tcp -m owner --uid-owner $(id -u nfqhooked)... | fuku-ys/earthquake | example/not-so-much-useful/tcp-ex-lo.nfqhook/materials/sample_nfqhook.py | Python | apache-2.0 | 466 |
from awxkit.utils import random_title, update_payload, filter_by_class, PseudoNamespace
from awxkit.api.resources import resources
from awxkit.api.pages import Organization
from awxkit.api.mixins import HasCreate, DSAdapter
from . import page
from . import base
class OAuth2Application(HasCreate, base.Base):
dep... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awxkit/awxkit/api/pages/applications.py | Python | apache-2.0 | 3,349 |
# -*- encoding: utf-8 -*-
#
# Copyright © 2013 Rackspace Hosting
#
# Author: Thomas Maddox <thomas.maddox@rackspace.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.ap... | rackerlabs/ceilometer-load-tests | src/plugins/__init__.py | Python | apache-2.0 | 1,251 |
from .response import Response
from ..reallyobject import ReallyObject
class ReadResponse(Response):
def __init__(self, raw):
super(ReadResponse, self).__init__(raw)
@property
def next_token(self):
if self._raw.get('body') and self._raw.get('body').get('tokens'):
return self._... | reallylabs/pyreally | pyreally/responses/read.py | Python | apache-2.0 | 935 |
# 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 applicab... | alexgorban/models | research/delf/delf/python/examples/extractor_test.py | Python | apache-2.0 | 2,114 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import MySQLdb
import os
# 打开数据库连接
db = MySQLdb.connect("localhost","root","12345678","test")
cursor = db.cursor()
count = 0
os.chdir('information')
path1 = os.getcwd()
s1 = os.listdir(path1)
for i in s1:
if i[0] == '.':
s1.remove(i)
for i in s1:
path2 = path1+... | JiaruZhang/Five | addBookData.py | Python | apache-2.0 | 2,903 |
#IBM_PROLOG_BEGIN_TAG
#
# Copyright 2015,2018 IBM International Business Machines Corp.
#
# 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
#
#... | mklight/eCMD | ecmd-core/pyecmd/__init__.py | Python | apache-2.0 | 9,894 |
#!/usr/bin/env python
from setuptools import setup
setup(name='django_crowd_authz',
version='1.0.1',
description='Crowd Authentication for Django',
author='Daniel Craigmile',
author_email='danielc@pobox.com',
url='https://github.com/x110dc/django_crowd_authz',
py_modules=['auth.bac... | x110dc/django_crowd_authz | setup.py | Python | apache-2.0 | 383 |
# Tim Cornwell <realtimcornwell@gmail.com>
#
# Definition of structures needed by the function interface. These are mostly
# subclasses of astropy classes.
#
import numpy as numpy
from astropy.table import Table
import os
import numpy
import astropy.units as units
from astropy.coordinates import SkyCoord, ICRS, Ear... | SKA-ScienceDataProcessor/crocodile | arl/test_support.py | Python | apache-2.0 | 16,511 |
from unittest import TestCase
from pypika import (
ClickHouseQuery,
Database,
Table,
)
class ClickHouseQueryTests(TestCase):
def test_use_AS_keyword_for_alias(self):
t = Table('abc')
query = ClickHouseQuery.from_(t).select(t.foo.as_('f1'), t.bar.as_('f2'))
self.assertEqual(str... | kayak/pypika | pypika/tests/dialects/test_clickhouse.py | Python | apache-2.0 | 3,473 |
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | hemna/cinder-brick | brick/tests/initiator/test_connector.py | Python | apache-2.0 | 26,481 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# write a correct test!
import unittest
import pygimli as pg
from pygimli.core.matrix import RVector, MatrixBase
class Matrix(pg.matrix.MatrixBase):
def __init__(self):
pg.MatrixBase.__init__(self)
def rows(self): return 1
def cols(self): return 1... | gimli-org/gimli | pygimli/testing/test_OwnMatrix.py | Python | apache-2.0 | 1,449 |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
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... | jlongever/redfish-client-python | on_http_redfish_1_0/models/processor_collection_processor_collection.py | Python | apache-2.0 | 9,550 |
"""
Usage:
feed_checker.py CALENDAR_PATH CREDENTIALS_PATH EVENTS_OUTPUT
Arguments:
CALENDAR_PATH path to ical file
CREDENTIALS_PATH path to file with google user credentials
EVENTS_OUTPUT path to file to save upcoming events for hangout runner
"""
from icalendar import Calendar
import a... | enkidulan/hangout_automated_manager | feed_checker.py | Python | apache-2.0 | 2,080 |