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 |
|---|---|---|---|---|---|
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apark263/tensorflow | tensorflow/contrib/tensorrt/test/neighboring_engine_test.py | Python | apache-2.0 | 2,729 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-03-01 02:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('file_tags', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='filetags',
name... | miurahr/seahub | seahub/file_tags/migrations/0002_remove_filetags_parent_folder_uuid.py | Python | apache-2.0 | 360 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | lib_openshift/models/v1_container_state_running.py | Python | apache-2.0 | 3,435 |
# Copyright 2015 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | dims/glance | glance/async/flows/convert.py | Python | apache-2.0 | 3,951 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# no... | rackerlabs/horizon | openstack_dashboard/dashboards/admin/projects/urls.py | Python | apache-2.0 | 1,755 |
import re
array_spec_pat = re.compile('.*(\[^]]\])$')
const_prefix_pat = re.compile('^const ([a-zA-Z0-9_]+)(.*)$')
moab_type_pat = re.compile('.*\Wm[a-z_0-9]+_t$')
datatype_names = 'int|short|long|double|float|char|bool'.split('|')
moab_struct_naming_pat = re.compile(r'm([a-z_]+)_t(?=$|\W)')
moab_common_out_pat = re.c... | dhh1128/own_fix | param.py | Python | apache-2.0 | 5,815 |
from rest_framework.routers import SimpleRouter
from api.ingestjobs import views
router = SimpleRouter()
router.register(r'ingestjobs', views.IngestJobViewSet, basename='ingestjob')
urlpatterns = router.urls
| CenterForOpenScience/SHARE | api/ingestjobs/urls.py | Python | apache-2.0 | 210 |
# copied from aiopg
# https://github.com/aio-libs/aiopg/blob/master/aiopg/pool.py
import asyncio
import collections
from .connection import connect
from .utils import _PoolContextManager, _PoolConnectionContextManager
__all__ = ['create_pool', 'Pool']
def create_pool(minsize=10, maxsize=10, echo=False, loop=None,
... | aio-libs/aioodbc | aioodbc/pool.py | Python | apache-2.0 | 5,833 |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | dims/oslo.utils | tests/test_utils.py | Python | apache-2.0 | 750 |
def make_arn(region, account_id, resource_type, resource_path):
arn_template = (
"arn:aws:elasticbeanstalk:{region}:{account_id}:{resource_type}/{resource_path}"
)
arn = arn_template.format(
region=region,
account_id=account_id,
resource_type=resource_type,
resource_p... | spulec/moto | moto/elasticbeanstalk/utils.py | Python | apache-2.0 | 360 |
#!/usr/bin/env python
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# All rights reserved.
#
# Androguard is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation,... | xysec/androguard | apkviewer.py | Python | apache-2.0 | 3,140 |
import sqlalchemy as SA
import pushmanager.core.db as db
from pushmanager.core.mail import MailQueue
from pushmanager.core.requesthandler import RequestHandler
import pushmanager.core.util
class DelayRequestServlet(RequestHandler):
def post(self):
if not self.current_user:
return self.send_er... | hashbrowncipher/pushmanager | pushmanager/servlets/delayrequest.py | Python | apache-2.0 | 2,656 |
# Copyright (c) 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 ... | gotostack/swift | test/unit/common/test_swob.py | Python | apache-2.0 | 58,939 |
# -*- coding: utf-8 -*-
# (c) 2017-2019, ETH Zurich, Institut fuer Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Defines a crystal lattice class.
"""
import numpy as np
import scipy.linalg as la
from fsc.export import export
# TODO: move to a separate module # pylint: disable=fixme,useless-suppr... | Z2PackDev/bands_inspect | bands_inspect/lattice.py | Python | apache-2.0 | 1,413 |
# 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/python-openstacksdk | openstack/cloud/_block_storage.py | Python | apache-2.0 | 36,405 |
__author__ = 'Jonathan Brodie'
import ctypes
from hzclient.clientmessage import ClientMessage
from util import util
'''
PUT
'''
def putEncode():
msg=ClientMessage()
msg.optype=0x1101
util.raiseNotDefined()
def putDecode(bytesobject):
servermsg=ClientMessage.decodeMessage(bytesobject)
util.raiseNotDe... | hazelcast-incubator/pyhzclient | hzclient/codec/transactionalmultimapcodec.py | Python | apache-2.0 | 1,449 |
# 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 ... | OBIGOGIT/etch | binding-python/runtime/src/test/python/tests/binding/util/__init__.py | Python | apache-2.0 | 1,108 |
import sys
import unittest
from unittest import TestCase
try:
import faulthandler
except ImportError:
pass
else:
try:
# May fail in IPython Notebook with UnsupportedOperation
faulthandler.enable()
except BaseException as e:
msg = "Failed to enable faulthandler due to:\n{err}"
... | m-labs/llvmlite | llvmlite/tests/__init__.py | Python | bsd-2-clause | 1,433 |
import angr
from collections import namedtuple
import logging
l = logging.getLogger(name=__name__)
Dirent = namedtuple('dirent', ('d_ino', 'd_off', 'd_reclen', 'd_type', 'd_name'))
class readdir(angr.SimProcedure):
struct = None
condition = None
def run(self, dirp): # pylint: disable=arguments-differ
... | schieb/angr | angr/procedures/posix/readdir.py | Python | bsd-2-clause | 2,207 |
import claripy
import ana
import nose
import pickle
import tempfile
import logging
l = logging.getLogger('claripy.test.serial')
def test_pickle():
bz = claripy.backend_z3
a = claripy.BitVecVal(0, 32)
b = claripy.BitVec('x', 32, explicit_name=True)
c = a+b
nose.tools.assert_equal(c.resolved_with(... | zhuyue1314/claripy | tests/test_serial.py | Python | bsd-2-clause | 2,258 |
"""
Users
=====
"""
from pipes import quote
import posixpath
import random
import string
from fabric.api import hide, run, settings, sudo, local
from fabtools.group import (
exists as _group_exists,
create as _group_create,
)
from fabtools.files import uncommented_lines
from fabtools.utils import run_as_root... | wagigi/fabtools-python | fabtools/user.py | Python | bsd-2-clause | 8,682 |
#!/usr/bin/env python3
import canmatrix.formats
import sys
import optparse
# command line options...
usage = """
%prog [options] matrix
matrixX can be any of *.dbc|*.dbf|*.kcd|*.arxml
"""
parser = optparse.OptionParser(usage=usage)
parser.add_option(
"-f", "--frames",
dest="frames",
help="encode list o... | altendky/canmatrix | examples/encodeFrame.py | Python | bsd-2-clause | 2,030 |
"""HTTP server classes.
Note: BaseHTTPRequestHandler doesn't implement any HTTP request; see
SimpleHTTPRequestHandler for simple implementations of GET, HEAD and POST,
and CGIHTTPRequestHandler for CGI scripts.
It does, however, optionally implement HTTP/1.1 persistent connections,
as of version 0.3.
Notes on CGIHTT... | xyuanmu/XX-Net | python3.8.2/Lib/http/server.py | Python | bsd-2-clause | 47,254 |
#
# This file is part of pyasn1-modules software.
#
# Created by Russ Housley
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
import sys
import unittest
from pyasn1.codec.der.decoder import decode as der_decoder
from pyasn1.codec.der.encoder import encode as der_encoder
f... | etingof/pyasn1-modules | tests/test_rfc7292.py | Python | bsd-2-clause | 8,295 |
#-----------------------------------------------------------------
# pycparser: explore_ast.py
#
# This example demonstrates how to "explore" the AST created by
# pycparser to understand its structure. The AST is a n-nary tree
# of nodes, each node having several children, each with a name.
# Just read the code, ... | kk1987/pycparser | examples/explore_ast.py | Python | bsd-3-clause | 5,702 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Classes that deal with stretching, i.e. mapping a range of [0:1] values onto
another set of [0:1] values with a transformation
"""
import numpy as np
from .transform import BaseTransform
from .transform import CompositeTransform
__all__ = ["BaseSt... | bsipocz/astropy | astropy/visualization/stretch.py | Python | bsd-3-clause | 15,324 |
#!/usr/bin/env python
# Benchmark the effect of chunkshapes in reading large datasets.
# You need at least PyTables 2.1 to run this!
# F. Alted
from time import perf_counter as clock
import numpy as np
import tables as tb
dim1, dim2 = 360, 6_109_666
rows_to_read = range(0, 360, 36)
print("=" * 32)
# Create the EArra... | avalentino/PyTables | bench/chunkshape-bench.py | Python | bsd-3-clause | 1,877 |
import numpy as np
import pytest
import pandas as pd
from pandas.core.sparse.api import SparseDtype
import pandas.util.testing as tm
@pytest.mark.filterwarnings("ignore:Sparse:FutureWarning")
@pytest.mark.filterwarnings("ignore:Series.to_sparse:FutureWarning")
class TestSparseSeriesIndexing:
def setup_method(sel... | toobaz/pandas | pandas/tests/sparse/test_indexing.py | Python | bsd-3-clause | 38,613 |
"""This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import... | glensc/osquery-python | tests/test_config_plugin.py | Python | bsd-3-clause | 1,735 |
import os
import sys
setupfile = file("setup.py",'r')
input = sys.argv[1]
lines = setupfile.readlines()
output = file("setup.py", 'w')
for line in lines:
if line.startswith(" library_dirs"):
newline = " library_dirs=['"+str(input)+"'],\n"
output.write(newline)
else:
... | kshedstrom/pyroms | bathy_smoother/external/lp_solve_5.5/extra/Python/pyhelp.py | Python | bsd-3-clause | 381 |
import ssl
import tempfile
import pytest
from ...utils.data import get_pkg_data_filename
from ..hub import SAMPHubServer
from ..integrated_client import SAMPIntegratedClient
from ..errors import SAMPProxyError
# By default, tests should not use the internet.
from .. import conf
from .test_helpers import random_par... | funbaker/astropy | astropy/samp/tests/test_standard_profile.py | Python | bsd-3-clause | 8,591 |
# being a bit too dynamic
from distutils.version import LooseVersion
import operator
def _mpl_version(version, op):
def inner():
try:
import matplotlib as mpl
except ImportError:
return False
return (
op(LooseVersion(mpl.__version__), LooseVersion(versio... | toobaz/pandas | pandas/plotting/_matplotlib/compat.py | Python | bsd-3-clause | 554 |
""" This module extends standard Python's pickle module so that it is
capable of writing more efficient pickle files that contain Panda
objects with shared pointers. In particular, a single Python
structure that contains many NodePaths into the same scene graph will
write the NodePaths correctly when used with this pi... | toontownfunserver/Panda3D-1.9.0 | direct/stdpy/pickle.py | Python | bsd-3-clause | 5,329 |
import re
from django.contrib.sites.models import Site
from django.core import mail
from django.test.utils import override_settings
import mock
from nose.tools import eq_
from kitsune.questions.events import QuestionReplyEvent, QuestionSolvedEvent, email_utils
from kitsune.questions.models import Question
from kitsu... | safwanrahman/kitsune | kitsune/questions/tests/test_notifications.py | Python | bsd-3-clause | 15,416 |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from djangobmf.serializers import ModuleSerializer
from rest_framework import serializers
class WarehouseSerializer(ModuleSerializer):
class Meta:
fields = (
'name',
)
class LocationSerializer(... | django-bmf/django-bmf | djangobmf/contrib/location/serializers.py | Python | bsd-3-clause | 507 |
import distutils.version
import importlib
import types
import warnings
# Update install.rst when updating versions!
VERSIONS = {
"bs4": "4.6.0",
"bottleneck": "1.2.1",
"fastparquet": "0.2.1",
"gcsfs": "0.2.2",
"lxml.etree": "3.8.0",
"matplotlib": "2.2.2",
"numexpr": "2.6.2",
"odfpy": "... | toobaz/pandas | pandas/compat/_optional.py | Python | bsd-3-clause | 3,494 |
from __future__ import absolute_import, division, print_function
import os
import re
import sys
from os.path import isdir, isfile, join
from conda.compat import iteritems, PY3, text_type
from conda.utils import memoized, md5_file
import conda.config as cc
from conda.resolve import MatchSpec
from conda.cli.common impo... | mwcraig/conda-build | conda_build/metadata.py | Python | bsd-3-clause | 20,286 |
"""Abstract base models used by the page management application."""
from django.db import models
from django.shortcuts import render
from cms import externals
from cms.models.managers import OnlineBaseManager, PublishedBaseManager, SearchMetaBaseManager, PageBaseManager
class PublishedBase(models.Model):
"... | JamesJGarner/cms | src/cms/models/base.py | Python | bsd-3-clause | 7,140 |
import os
__version_path = os.path.join(
os.path.abspath(
os.path.dirname(__file__)),
'version.txt',
)
with open(__version_path, 'r') as f:
__version__ = f.read()
default_app_config = 'wizard_builder.apps.WizardBuilderConfig'
| SexualHealthInnovations/django-wizard-builder | wizard_builder/__init__.py | Python | bsd-3-clause | 248 |
import chainer
import chainer.functions as F
import chainer.links as L
from chainer_mask_rcnn.models.mask_rcnn_resnet import _copy_persistent_chain
from chainer_mask_rcnn.models.resnet_extractor import _convert_bn_to_affine
from ..resnet import BuildingBlock
from ..resnet import ResNet101Extractor
from ..resnet impor... | start-jsk/jsk_apc | demos/instance_occlsegm/instance_occlsegm_lib/contrib/instance_occlsegm/models/fcn/fcn16s_resnet_occlusion.py | Python | bsd-3-clause | 3,904 |
import SimpleHTTPServer
import SocketServer
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "serving at port", PORT
httpd.serve_forever() | Jycraft/jycraft-web | servedir.py | Python | bsd-3-clause | 212 |
""" Formula for building parallel """
from pakit import Archive, Recipe
class Parallel(Recipe):
"""
GNU parallel executes shell jobs in parallel
"""
def __init__(self):
super(Parallel, self).__init__()
self.homepage = 'http://www.gnu.org/software/parallel'
self.repos = {
... | pakit/recipes | parallel.py | Python | bsd-3-clause | 883 |
import os
from django.conf import settings
from django.core.files import File as DjangoFile
from django.forms.models import modelform_factory
from django.test import TestCase
from tests.helpers import (
create_clipboard_item, create_folder_structure, create_image,
create_superuser,
)
from filer import settin... | divio/django-filer | tests/test_models.py | Python | bsd-3-clause | 12,044 |
#
# $Id: sphinxapi.py 2970 2011-09-23 16:50:22Z klirichek $
#
# Python version of Sphinx searchd client (Python API)
#
# Copyright (c) 2006, Mike Osadnik
# Copyright (c) 2006-2011, Andrew Aksyonoff
# Copyright (c) 2008-2011, Sphinx Technologies Inc
# All rights reserved
#
# This program is free software; you can redist... | apahomov/django-sphinx | djangosphinx/apis/api281/__init__.py | Python | bsd-3-clause | 30,427 |
#!/usr/bin/env python
#
# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Generate Android.bp for Skia from GN configuration.
from __future__ import print_function
import os
import pprint
import string
import subprocess
import tempf... | google/skia | gn/gn_to_bp.py | Python | bsd-3-clause | 23,280 |
#! /usr/bin/python
# Copyright (c) 2015, Matthew P. Grosvenor
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | camsas/qjump-nsdi15-plotting | table1/do_hist.py | Python | bsd-3-clause | 2,737 |
"""
WSGI config for game project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from mezzanine.utils.conf import real_p... | aldenjenkins/foobargamingwebsite | game/wsgi.py | Python | bsd-3-clause | 484 |
"""Tests for proselint."""
| amperser/proselint | tests/__init__.py | Python | bsd-3-clause | 27 |
#Panic For Pinos by Maxim Pinigin (c) 2016-2017
import time
def panic(reason):
print("")
print("Pinos Panic: " + reason)
time.sleep(10)
exit()
| NovoImpossible/pinos | panic.py | Python | isc | 149 |
"""
Good Points:
1. getNodes
1.1 while q (instead of while len(q) > 0)
1.2 collections.deque (instead of q = [])
Bad Points:
1. another loop to fill mapping instead of doing it in the bfs
"""
# Definition for a Node.
class Node:
def __init__(self, val = 0, neighbors = []):
self.val... | Chasego/codirit | leetcode/133-Clone-Graph/bfs_001_iterative_jiuzhang.py | Python | mit | 1,381 |
"""Assess transcript abundance in RNA-seq experiments using Cufflinks.
http://cufflinks.cbcb.umd.edu/manual.html
"""
import os
import shutil
import tempfile
import pandas as pd
from bcbio import bam
from bcbio.utils import get_in, file_exists, safe_makedir
from bcbio.distributed.transaction import file_transaction
fro... | vladsaveliev/bcbio-nextgen | bcbio/rnaseq/cufflinks.py | Python | mit | 10,844 |
import ntpath
import os
from test.test_support import TestFailed
from test import test_support, test_genericpath
import unittest
def tester(fn, wantResult):
fn = fn.replace("\\", "\\\\")
gotResult = eval(fn)
if wantResult != gotResult:
raise TestFailed, "%s should return: %s but returned: %s" \
... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.7/Lib/test/test_ntpath.py | Python | mit | 8,404 |
# -*- coding: utf-8 -*-
__all__ = ("S3MainMenuLayout",
"S3AboutMenuLayout",
"MA",
"S3LanguageMenuLayout",
"ML",
"S3PersonalMenuLayout",
"MP",
)
from gluon import current, URL, \
A, FORM, IMG, INPUT, LI, OPTION, SELECT, SPAN,... | flavour/eden | modules/templates/CCC/layouts.py | Python | mit | 10,084 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailmenus', '0010_auto_20160201_1558'),
]
operations = [
migrations.AlterField(
model_name='flatmenuitem',
... | rkhleics/wagtailmenus | wagtailmenus/migrations/0011_auto_20160415_1519.py | Python | mit | 848 |
# 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 unique constraint on 'BitcoinAddress', fields ['address']
db.create_unique('django_bitcoin_bitcoi... | FuzzyHobbit/django-bitcoin | django_bitcoin/migrations/0003_auto__add_unique_bitcoinaddress_address.py | Python | mit | 5,057 |
# Copyright 2017, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | ammarkhann/FinalSeniorCode | lib/python2.7/site-packages/google/gax/utils/oneof.py | Python | mit | 2,265 |
# Copyright 2003 by Bartek Wilczynski. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Parsing AlignACE files: AlignAceParser
"""
from Bio.Motif import Motif
from Bio.Alphab... | bryback/quickseq | genescript/Bio/Motif/Parsers/AlignAce.py | Python | mit | 1,718 |
# $Id: __init__.py 8131 2017-07-03 22:06:53Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Open Document Format (ODF) Writer.
"""
VERSION = '1.0a'
__docformat__ = 'reStructuredText'
import sys
import os
import os.path
import tempfile
impor... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/docutils/writers/odf_odt/__init__.py | Python | mit | 135,235 |
from django.conf.urls import include, url
from django.contrib import admin
from django.conf import settings
import socketio.sdjango
from fabric_bolt.core import views
socketio.sdjango.autodiscover()
admin.autodiscover()
urlpatterns = [
url(r'^grappelli/', include('grappelli.urls')),
url(r'^admin/', include(... | paperreduction/fabric-bolt | fabric_bolt/core/urls.py | Python | mit | 1,071 |
# -*- encoding: UTF-8 -*-
import sys
import motion
import almath
from naoqi import ALProxy
def StiffnessOn(proxy):
# We use the "Body" name to signify the collection of all joints
pNames = "Body"
pStiffnessLists = 1.0
pTimeLists = 1.0
proxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLi... | KellyChan/python-examples | python/aldebaran/hana/hana/motion/cartesian/motion_hulaHoop.py | Python | mit | 2,824 |
# -*- coding: utf-8 -*-
#above helps to declare what encoding we want to use in the module
#note this is copied from the first json lab
#above is used to set the encoding for this module, (unfortunately didn't help that much)
#used for seeing our data in nicest string format possible
import pprint
#again idiom for ... | razzius/PyClassLessons | instructors/course-2015/functions_gens_and_ducks/examples/in_class/parsetext_trade_2015.py | Python | mit | 2,835 |
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import time
import scrapy
from Global_function import get_localtime, print_new_number, save_messages
now_time = get_localtime(time.strftime("%Y-%m-%d", time.localtime()))
# now_time = 20170420
class USTC005_Spider(scrapy.Spider):
name = ... | hbtech-ai/ARPS | report_spider/report_spider/spiders/USTC005.py | Python | mit | 3,781 |
"""
ucript to manually bin alignments against position. The idea is to manually
look for mutations that freebayes might miss because of the low probability
of the events that we are dealing with.
"""
import os
import sys
# Setup Django environment.
sys.path.append(
os.path.join(os.path.dirname(os.path.realpat... | woodymit/millstone_accidental_source | genome_designer/debug/2014_07_11_dep_mpileup_analysis.py | Python | mit | 2,582 |
from string import ascii_lowercase
from time import time
import random
class Cipher(object):
def __init__(self, key=None):
if not key:
random.seed(time())
key = ''.join(random.choice(ascii_lowercase) for i in range(100))
elif not key.isalpha() or not key.islower():
... | mweb/python | exercises/simple-cipher/example.py | Python | mit | 935 |
#!/usr/bin/python -tt
__author__ = 'mricon'
import logging
import os
import sys
import anyjson
import totpcgi
import totpcgi.backends
import totpcgi.backends.file
import totpcgi.utils
import datetime
import dateutil
import dateutil.parser
import dateutil.tz
from string import Template
import syslog
#-------------... | n054/totp-cgi | contrib/gitolite/command.py | Python | gpl-2.0 | 22,349 |
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2007 Donald N. Allingham
# Copyright (C) 2008 Gary Burton
# Copyright (C) 2011 Tim G L Lyons
# Copyright (C) 2017 Alois Poettker
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the ... | Nick-Hall/gramps | gramps/plugins/view/eventview.py | Python | gpl-2.0 | 19,458 |
"""
Only works for 'basic type' properties (bool, int and float)!
seq must be uni-dimensional, multi-dimensional arrays (like array of vectors) will be re-created from it.
"""
collection.foreach_set(attr, some_seq)
# Python equivalent
for i in range(len(some_seq)):
setattr(collection[i], attr, some_seq[i])
| pawkoz/dyplom | blender/doc/python_api/examples/bpy.types.bpy_prop_collection.foreach_set.py | Python | gpl-2.0 | 314 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
lasinfoPro.py
---------------------
Date : October 2014 and May 2016
Copyright : (C) 2014 by Martin Isenburg
Email : martin near rapidlasso point com
***... | AsgerPetersen/QGIS | python/plugins/processing/algs/lidar/lastools/lasinfoPro.py | Python | gpl-2.0 | 5,416 |
#! /usr/bin/env python
# Change the #! line occurring in Python scripts. The new interpreter
# pathname must be given with a -i option.
#
# Command line arguments are files or directories to be processed.
# Directories are searched recursively for files whose name looks
# like a python module.
# Symbolic links are al... | sensysnetworks/uClinux | user/python/Tools/scripts/pathfix.py | Python | gpl-2.0 | 3,851 |
import inspect
import pytest
def parametrize(tests, arity=None):
'''Helper for parametrizing pytest tests.
Expects a list of lambdas, one per test. Each lambda must return
the parameters for its respective test.
Test identifiers will be automatically generated, from the test
number and its lamb... | stanographer/plover | plover_build_utils/testing/parametrize.py | Python | gpl-2.0 | 1,189 |
# Copyright 2008,2009 Marcus Huewe <suse-tux@gmx.de>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT... | OlegGirko/osc | osc/OscConfigParser.py | Python | gpl-2.0 | 13,677 |
from __future__ import with_statement, print_function
# Script for building the _ssl and _hashlib modules for Windows.
# Uses Perl to setup the OpenSSL environment correctly
# and build OpenSSL, then invokes a simple nmake session
# for the actual _ssl.pyd and _hashlib.pyd DLLs.
# THEORETICALLY, you can:
# * Unpack th... | teeple/pns_server | work/install/Python-2.7.4/PCbuild/build_ssl.py | Python | gpl-2.0 | 8,447 |
"""
:class:`PyBusyInfo` constructs a busy info window and displays a message in it.
Description
===========
:class:`PyBusyInfo` constructs a busy info window and displays a message in it.
This class makes it easy to tell your user that the program is temporarily busy.
Just create a :class:`PyBusyInfo` object, and w... | garrettcap/Bulletproof-Backup | wx/lib/agw/pybusyinfo.py | Python | gpl-2.0 | 9,862 |
#!/usr/bin/env python
import unicornhat as unicorn
from graphics import Drawing, Color
import time, signal, threading
class UnicornDrawing(Drawing):
def __init__(self):
Drawing.__init__(self,8,8)
'''
All drawing operations use the pixel method
so we override it for UnicornHat
'''
def pixel(self, x, y... | quincerly/unicorn-hat | python/examples/clock.py | Python | gpl-2.0 | 1,580 |
# Copyright 2008-2016 Free Software Foundation, Inc.
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
from . import _virtual_connections
from .. import Constants
from ..base import Element
from ..utils.descriptors import (
EvaluatedFlag, EvaluatedEnum, EvaluatedPInt,
setup_nam... | dl1ksv/gnuradio | grc/core/ports/port.py | Python | gpl-3.0 | 9,414 |
class Graph:
"""
* Creates a adjaceny list for a graph
* Implements a function for topological sorting
"""
def __init__(self, no_vertices):
"""
Initialises an empty adjaceny list (list of lists)
"""
self.vertices = no_vertices
self.adjlist = [[] for i in xra... | algobook/Algo_Ds_Notes | Topological_Sort/Topological_Sort.py | Python | gpl-3.0 | 1,538 |
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPD... | etherkit/OpenBeacon2 | macos/venv/lib/python3.8/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-google.cloud.translate.py | Python | gpl-3.0 | 527 |
# -*- coding: utf-8 -*-
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**metadata module.**
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Sof... | Gustry/inasafe | safe/metadata/property/boolean_property.py | Python | gpl-3.0 | 1,696 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import datetime
from frappe import _, msgprint, scrub
from frappe.defaults import get_user_permissions
from frappe.model.utils import get... | emmuchira/kps_erp | erpnext/accounts/party.py | Python | gpl-3.0 | 16,798 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | cylc/cylc | tests/unit/parsec/test_ordered_dict.py | Python | gpl-3.0 | 4,516 |
# Copyright (c) 2018, Frappe Technologies and contributors
# For license information, please see license.txt
# don't remove this function it is used in tests
def test_method():
'''test function'''
return 'overridden'
| mhbu50/erpnext | erpnext/regional/france/utils.py | Python | gpl-3.0 | 222 |
from __future__ import (absolute_import, division, print_function)
import unittest
import os
import shutil
import sys
import mantid.kernel.plugins as plugins
from mantid.api import AlgorithmFactory, AlgorithmManager
__TESTALG__ = \
"""from mantid.api import PythonAlgorithm, AlgorithmFactory
class TestPyAlg(PythonAl... | dymkowsk/mantid | Framework/PythonInterface/test/python/mantid/kernel/PythonPluginsTest.py | Python | gpl-3.0 | 1,990 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any ... | freeworldxbmc/pluging.video.Jurassic.World.Media | resources/lib/resolvers/clicknupload.py | Python | gpl-3.0 | 2,319 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import datetime
import pytz
def now():
return datetime.datetime.utcnow().replace(tzinfo=pytz.UTC)
| Callek/build-relengapi | relengapi/lib/time.py | Python | mpl-2.0 | 304 |
# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
from __future__ import division
import pytes... | kohr-h/odl | odl/test/operator/pspace_ops_test.py | Python | mpl-2.0 | 6,845 |
# -*- coding: utf-8 -*-
# See README.rst file on addon root folder for license details
from openerp import models, fields, exceptions, api
from openerp.tools.translate import _
class ProjectTemplateWizard(models.TransientModel):
_name = 'project.template.wizard'
project_id = fields.Many2one(
comodel... | Endika/event | event_project/wizard/project_template_wizard.py | Python | agpl-3.0 | 1,219 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from authentic2.compat import user_model_label
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'LibertySession.django_session_key'
db.al... | adieu/authentic2 | authentic2/saml/migrations/0022_auto__chg_field_libertysession_django_session_key__chg_field_libertyar.py | Python | agpl-3.0 | 24,009 |
"""
Tests for VideoBlockURLTransformer.
"""
from unittest import mock
from openedx.core.djangoapps.content.block_structure.factory import BlockStructureFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.fac... | eduNEXT/edx-platform | lms/djangoapps/course_api/blocks/transformers/tests/test_video_urls.py | Python | agpl-3.0 | 5,797 |
#!/usr/bin/env python
# Screen scrape list of who's standing down in the 2010 general election
# Copyright (C) 2009 Matthew Somerville
# This is free software, and you are welcome to redistribute it under
# certain conditions. However, it comes with ABSOLUTELY NO WARRANTY.
# For details see the file LICENSE.html in ... | henare/parlparse | members/wikipedia-standingdown.py | Python | agpl-3.0 | 1,078 |
# Copyright (c) 2015 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from . import USBPrinterOutputDeviceManager
from PyQt5.QtQml import qmlRegisterType, qmlRegisterSingletonType
from UM.i18n import i18nCatalog
i18n_catalog = i18nCatalog("cura")
def getMetaData():
return {
"type... | senttech/Cura | plugins/USBPrinting/__init__.py | Python | agpl-3.0 | 1,268 |
# Copyright (C) 2014-2016 Andrey Antukh <niwi@niwi.nz>
# Copyright (C) 2014-2016 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014-2016 David Barragán <bameda@dbarragan.com>
# Copyright (C) 2014-2016 Alejandro Alonso <alejandro.alonso@kaleidos.net>
# This program is free software: you can redistribute it and/or mo... | Rademade/taiga-back | taiga/projects/attachments/__init__.py | Python | agpl-3.0 | 988 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2009 CamptoCamp. All rights reserved.
# @author Nicolas Bessi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publi... | akretion/account-financial-tools | currency_rate_update/__openerp__.py | Python | agpl-3.0 | 1,514 |
"""Deprecated import support. Auto-generated by import_shims/generate_shims.sh."""
# pylint: disable=redefined-builtin,wrong-import-position,wildcard-import,useless-suppression,line-too-long
from import_shims.warn import warn_deprecated_import
warn_deprecated_import('bulk_email.apps', 'lms.djangoapps.bulk_email.apps'... | eduNEXT/edunext-platform | import_shims/lms/bulk_email/apps.py | Python | agpl-3.0 | 368 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/libyogrt/package.py | Python | lgpl-2.1 | 1,739 |
#! /usr/bin/env python
from __future__ import print_function
import openturns as ot
size = 100
# ARMA parameters
arcoefficients = ot.ARMACoefficients([0.3])
macoefficients = ot.ARMACoefficients(0)
timeGrid = ot.RegularGrid(0.0, 0.1, size)
# White noise ==> gaussian
whiteNoise = ot.WhiteNoise(ot.Normal(), timeGrid)
... | aurelieladier/openturns | python/test/t_DickeyFullerTest_std.py | Python | lgpl-3.0 | 1,164 |
'''Script to help generate item names.'''
def int_to_str(num, alphabet):
'''Convert integer to string.'''
# http://stackoverflow.com/a/1119769/1524507
if (num == 0):
return alphabet[0]
arr = []
base = len(alphabet)
while num:
rem = num % base
num = num // base
a... | PressStartandSelect/jux-discovery | util/item_name_gen.py | Python | unlicense | 758 |
# 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 requir... | bac/horizon | openstack_dashboard/dashboards/identity/roles/views.py | Python | apache-2.0 | 3,528 |
import pytest
__author__ = 'thauser'
from pnc_cli.swagger_client.apis import BuildconfigsetrecordsApi
from test import testutils
import pnc_cli.user_config as uc
bcsr_api = None
@pytest.fixture(scope='function', autouse=True)
def init_api():
global bcsr_api
bcsr_api = BuildconfigsetrecordsApi(uc.user.get_ap... | thauser/pnc-cli | test/integration/test_buildconfigsetrecords_api.py | Python | apache-2.0 | 1,504 |
from six import string_types
from pypif.obj.common.pio import Pio
class Instrument(Pio):
"""
Information about an instrument used to take a measurement.
"""
def __init__(self, name=None, model=None, producer=None, url=None, tags=None, **kwargs):
"""
Constructor.
:param name: ... | CitrineInformatics/pypif | pypif/obj/common/instrument.py | Python | apache-2.0 | 2,048 |
# Copyright 2014, Jeff Buttars, A10 Networks.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | sasukeh/acos-client | acos_client/v30/slb/virtual_port.py | Python | apache-2.0 | 3,458 |