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 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | ging/horizon | openstack_dashboard/dashboards/project/instances/tabs.py | Python | apache-2.0 | 3,495 |
# Copyright 2014 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 ... | CSCI1200Course/csci1200OnlineCourse | tests/functional/unit_description.py | Python | apache-2.0 | 2,008 |
from __future__ import unicode_literals
import datetime
import pickle
from decimal import Decimal
from operator import attrgetter
from django.core.exceptions import FieldError
from django.contrib.contenttypes.models import ContentType
from django.db.models import Count, Max, Avg, Sum, StdDev, Variance, F, Q
from djan... | rogerhu/django | tests/aggregation_regress/tests.py | Python | bsd-3-clause | 47,311 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ...testing import assert_equal
from ..misc import CalculateNormalizedMoments
def test_CalculateNormalizedMoments_inputs():
input_map = dict(moment=dict(mandatory=True,
),
timeseries_file=dict(mandatory=True,
),
)
inputs = CalculateNorm... | iglpdc/nipype | nipype/algorithms/tests/test_auto_CalculateNormalizedMoments.py | Python | bsd-3-clause | 863 |
# 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... | openstack/horizon | openstack_dashboard/dashboards/admin/hypervisors/compute/urls.py | Python | apache-2.0 | 1,052 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
#
# Copyright (c) 2008-2011 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or... | stelfrich/openmicroscopy | components/tools/OmeroWeb/omeroweb/webclient/controller/impexp.py | Python | gpl-2.0 | 1,024 |
#
# The Python Imaging Library.
# $Id: GifImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
#
# GIF file handling
#
# History:
# 1995-09-01 fl Created
# 1996-12-14 fl Added interlace support
# 1996-12-30 fl Added animation support
# 1997-01-05 fl Added write support, fixed local colour map bug
# 1997-02-23 fl ... | tkaitchuck/nupic | external/linux64/lib/python2.6/site-packages/PIL/GifImagePlugin.py | Python | gpl-3.0 | 10,996 |
"""
Registers signal handlers at startup.
"""
# pylint: disable=unused-import
import openedx.core.djangoapps.monitoring.exceptions
| synergeticsedx/deployment-wipro | openedx/core/djangoapps/monitoring/startup.py | Python | agpl-3.0 | 131 |
# 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 a... | nikesh-mahalka/cinder | cinder/tests/unit/api/contrib/test_volume_actions.py | Python | apache-2.0 | 41,283 |
from __future__ import unicode_literals
from moto.core.responses import BaseResponse
from moto.ec2.utils import sequence_from_querystring
class ElasticIPAddresses(BaseResponse):
def allocate_address(self):
if "Domain" in self.querystring:
domain = self.querystring.get('Domain')[0]
else... | kennethd/moto | moto/ec2/responses/elastic_ip_addresses.py | Python | apache-2.0 | 6,068 |
#
# highlight.py
# Part of SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Ryan Hileman and Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter3
# License: MIT
#
"""
This module implements highlighting code with marks.
The following classes are exported:
Highligh... | micahwood/linux-dotfiles | sublime/Packages/SublimeLinter/lint/highlight.py | Python | mit | 14,958 |
import WebIDL
def WebIDLTest(parser, harness):
# Check that error messages put the '^' in the right place.
threw = False
input = """\
// This is a comment.
interface Foo {
};
/* This is also a comment. */
interface ?"""
try:
parser.parse(input)
results = parser.finish()
except Web... | UK992/servo | components/script/dom/bindings/codegen/parser/tests/test_error_lineno.py | Python | mpl-2.0 | 907 |
# 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 'Member.area_of_residence'
db.add_column('mks_member', 'area_of_residence', self.gf('dj... | livni/old-OK | src/knesset/mks/migrations/0004_add_members_residence.py | Python | bsd-3-clause | 6,016 |
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element, SubElement
import gzip
import os
import requests
import time
from xml.dom import minidom
VALID_REFS = ['VENDOR', 'VERSION', 'CHANGE_LOG', 'PRODUCT', 'PROJECT', 'ADVISORY']
CPEDB_URL = "https://static.nvd.nist.gov/fee... | masahir0y/buildroot-yamada | support/scripts/cpedb.py | Python | gpl-2.0 | 7,878 |
from pymongo.connection import Connection
from pymongo.errors import OperationFailure
from ghettoq.backends.base import BaseBackend
from ghettoq.messaging import Empty
__author__ = "Flavio [FlaPer87] Percoco Premoli <flaper87@flaper87.org>"
DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = 27017
class MongodbBackend(BaseB... | mzdaniel/oh-mainline | vendor/packages/ghettoq/ghettoq/backends/mongodb.py | Python | agpl-3.0 | 1,263 |
from Screens.Screen import Screen
from Screens.ChoiceBox import ChoiceBox
from Screens.InputBox import InputBox
from Screens.MessageBox import MessageBox
from Screens.HelpMenu import HelpableScreen
from Components.ActionMap import HelpableActionMap, ActionMap
from Components.Sources.List import List
from Components.Sou... | kingvuplus/rr | lib/python/Plugins/Extensions/DVDBurn/ProjectSettings.py | Python | gpl-2.0 | 11,215 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | AxelDelmas/ansible | lib/ansible/parsing/__init__.py | Python | gpl-3.0 | 11,072 |
# -*- coding: utf-8 -*-
#
# Clang documentation build configuration file, created by
# sphinx-quickstart on Sun Dec 9 20:01:55 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... | root-mirror/root | interpreter/llvm/src/tools/clang/docs/conf.py | Python | lgpl-2.1 | 9,185 |
# coding: utf8
"""
tinycss.page3
------------------
Support for CSS 3 Paged Media syntax:
http://dev.w3.org/csswg/css3-page/
Adds support for named page selectors and margin rules.
:copyright: (c) 2012 by Simon Sapin.
:license: BSD, see LICENSE for more details.
"""
from __future__ impor... | alexston/calibre-webserver | src/tinycss/page3.py | Python | gpl-3.0 | 5,107 |
#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2006
# Author: Stefan Berger <stefanb@us.ibm.com>
# Positive Test: create domain with virtual TPM attached at build time,
# extend a pcr
# check list of pcrs; locally migrate the domain and
# check li... | Aaron0927/xen-4.2.1 | tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py | Python | gpl-2.0 | 3,482 |
#!/usr/bin/python
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'network'}
DOCUMENTATION = r'''
---
module: nxos_hsrp
extends_documentation_frag... | rosmo/ansible | lib/ansible/modules/network/nxos/nxos_hsrp.py | Python | gpl-3.0 | 15,408 |
# 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 agreed to in... | jeffrey4l/nova | nova/tests/unit/api/openstack/compute/contrib/test_migrations.py | Python | apache-2.0 | 5,239 |
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Generate a spatial analysis against an arbitrary library.
To use, build the 'binary_size_tool' target. Then run this tool, passing
... | hgl888/chromium-crosswalk-efl | tools/binary_size/run_binary_size_analysis.py | Python | bsd-3-clause | 35,816 |
# -*- coding: utf-8 -*-
from sympy import (Symbol, symbols, oo, limit, Rational, Integral, Derivative,
log, exp, sqrt, pi, Function, sin, Eq, Ge, Le, Gt, Lt, Ne, Abs, conjugate,
I)
from sympy.printing.python import python
from sympy.utilities.pytest import raises, XFAIL
x, y = symbols('x,y')
th = Symbol('th... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/printing/tests/test_python.py | Python | mit | 7,440 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C): 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Requirements
# - pyvmomi >= 6.0.0.2016.4
# TODO:
# * more jq examples
# * optional folder heriarchy
"""
$ jq '._meta.hostvars[].c... | dav1x/openshift-ansible-contrib | reference-architecture/vmware-ansible/inventory/vsphere/vms/vmware_inventory.py | Python | apache-2.0 | 27,704 |
# 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... | szha/mxnet | benchmark/python/sparse/updater.py | Python | apache-2.0 | 2,695 |
#!/usr/bin/env python
#
# Copyright 2008 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 o... | sfenu/google-appengine-wx-launcher | launcher/html_info_dialog_unittest.py | Python | apache-2.0 | 1,929 |
import datetime
from django.conf import settings
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from registration.forms import RegistrationForm
from registration.ba... | sozlukus/sozlukus.com | sozlukus/registration/tests/default_backend.py | Python | mit | 8,430 |
import sys
import pytest
py3 = sys.version_info[0] >= 3
class DummyCollector(pytest.collect.File):
def collect(self):
return []
def pytest_pycollect_makemodule(path, parent):
bn = path.basename
if "py3" in bn and not py3 or ("py2" in bn and py3):
return DummyCollector(path, parent=pare... | paulrouget/servo | tests/wpt/web-platform-tests/tools/third_party/pytest/doc/en/example/py2py3/conftest.py | Python | mpl-2.0 | 324 |
#!/usr/bin/env python
'''Simple viewer for DDS texture files.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
from ctypes import *
import getopt
import sys
import textwrap
from SDL import *
from pyglet.gl.VERSION_1_1 import *
import pyglet.dds
import pyglet.event
import pyglet.image
import pyglet.sprit... | shaileshgoogler/pyglet | tools/ddsview.py | Python | bsd-3-clause | 4,680 |
import test.test_support, unittest
import sys, codecs, htmlentitydefs, unicodedata
class PosReturn:
# this can be used for configurable callbacks
def __init__(self):
self.pos = 0
def handle(self, exc):
oldpos = self.pos
realpos = oldpos
if realpos<0:
realpos = ... | jedie/pypyjs-standalone | website/js/pypy.js-0.3.0/lib/modules/test/test_codeccallbacks.py | Python | mit | 32,120 |
from ._pkg0_1_0_1_0 import *
from ._pkg0_1_0_1_1 import * | asedunov/intellij-community | python/testData/completion/heavyStarPropagation/lib/_pkg0/_pkg0_1/_pkg0_1_0/_pkg0_1_0_1/__init__.py | Python | apache-2.0 | 57 |
name1_1_1_0_1_3_0 = None
name1_1_1_0_1_3_1 = None
name1_1_1_0_1_3_2 = None
name1_1_1_0_1_3_3 = None
name1_1_1_0_1_3_4 = None | smmribeiro/intellij-community | python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_1/_pkg1_1_1/_pkg1_1_1_0/_pkg1_1_1_0_1/_mod1_1_1_0_1_3.py | Python | apache-2.0 | 128 |
"""
==============
Non-linear SVM
==============
Perform binary classification using non-linear SVC
with RBF kernel. The target to predict is a XOR of the
inputs.
The color map illustrates the decision function learned by the SVC.
"""
print(__doc__)
import numpy as np
import matplotlib.pyplot as plt
from sklearn imp... | glemaitre/scikit-learn | examples/svm/plot_svm_nonlinear.py | Python | bsd-3-clause | 1,136 |
"""Tests for account creation"""
import json
import ddt
import unittest
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth.models import AnonymousUser
from django.utils.importli... | tiagochiavericosta/edx-platform | common/djangoapps/student/tests/test_create_account.py | Python | agpl-3.0 | 20,139 |
# -*- coding: 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 model 'TrackedUser'
db.create_table('sentry_trackeduser', (
('id', self.gf('sentry.db.m... | JackDanger/sentry | src/sentry/south_migrations/0077_auto__add_trackeduser__add_unique_trackeduser_project_ident.py | Python | bsd-3-clause | 22,623 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | krishnazure/ansible | lib/ansible/playbook/playbook_include.py | Python | gpl-3.0 | 5,458 |
"""
Helper functions for mapping model fields to a dictionary of default
keyword arguments that should be used for their equivelent serializer fields.
"""
import inspect
from django.core import validators
from django.db import models
from django.utils.text import capfirst
from rest_framework.compat import clean_manyt... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/rest_framework/utils/field_mapping.py | Python | agpl-3.0 | 9,402 |
from django.db import models
class Person(models.Model):
name = models.CharField(max_length=255, default='Robot')
age = models.IntegerField()
class Meta:
app_label = 'test_djangoitem'
class IdentifiedPerson(models.Model):
identifier = models.PositiveIntegerField(primary_key=True)
name = ... | elkingtowa/pyrake | tests/test_djangoitem/models.py | Python | mit | 440 |
import lldb
import re
import testutils as test
def runScenario(assembly, debugger, target):
process = target.GetProcess()
res = lldb.SBCommandReturnObject()
ci = debugger.GetCommandInterpreter()
# Run debugger, wait until libcoreclr is loaded,
# set breakpoint at Test.Main and stop there
test... | tijoytom/coreclr | src/ToolBox/SOS/tests/t_cmd_dumpmodule.py | Python | mit | 1,304 |
# Volatility
# Copyright (C) 2008-2013 Volatility Foundation
# Copyright (C) 2011 Jamie Levy (Gleeda) <jamie.levy@gmail.com>
#
# This file is part of Volatility.
#
# Volatility 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 Softw... | woogers/volatility | volatility/plugins/registry/registryapi.py | Python | gpl-2.0 | 12,244 |
"""Enumeration metaclass.
XXX This is very much a work in progress.
"""
import string
class EnumMetaClass:
"""Metaclass for enumeration.
To define your own enumeration, do something like
class Color(Enum):
red = 1
green = 2
blue = 3
Now, Color.red, Color.green and Color.bl... | xbmc/atv2 | xbmc/lib/libPython/Python/Demo/metaclasses/Enum.py | Python | gpl-2.0 | 4,419 |
# A Job consists of many "Tasks".
# A task is the run of an external tool, with proper methods for failure handling
from Tools.CList import CList
class Job(object):
NOT_STARTED, IN_PROGRESS, FINISHED, FAILED = range(4)
def __init__(self, name):
self.tasks = [ ]
self.resident_tasks = [ ]
self.workspace = "/tmp... | popazerty/EG-2 | lib/python/Components/Task.py | Python | gpl-2.0 | 15,627 |
# -*- test-case-name: twisted.test.test_ssl -*-
# Copyright (c) 2001-2009 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
SSL transport. Requires PyOpenSSL (http://pyopenssl.sf.net).
SSL connections require a ContextFactory so they can create SSL contexts.
End users should only use the ContextFactory cla... | sorenh/cc | vendor/Twisted-10.0.0/twisted/internet/ssl.py | Python | apache-2.0 | 7,496 |
"""
Tests for the stats.mstats module (support for maskd arrays)
"""
import numpy as np
from numpy import nan
import numpy.ma as ma
from numpy.ma import masked, nomask
import scipy.stats.mstats as mstats
from numpy.testing import TestCase, run_module_suite
from numpy.ma.testutils import assert_equal, assert_almost_e... | scipy/scipy-svn | scipy/stats/tests/test_mstats_basic.py | Python | bsd-3-clause | 20,295 |
class A:
@staticmethod
def m(x):
return x
print A.m(1) | asedunov/intellij-community | python/testData/quickFixes/PyMakeMethodStaticQuickFixTest/usage_after.py | Python | apache-2.0 | 72 |
# (c) 2015, Ansible Inc,
#
# This file is part of Ansible
#
# Ansible 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 later version.
#
# Ansible is di... | salivatears/ansible | lib/ansible/plugins/action/service.py | Python | gpl-3.0 | 2,322 |
#!/usr/bin/env python
## Copyright (c) 2012 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENT... | jian929/stagefright | vp9/omx-components/videocodec/libvpx_internal/libvpx/tools/diff.py | Python | gpl-2.0 | 4,218 |
try:
#comment
x = 1<caret>
y = 2
except:
pass | asedunov/intellij-community | python/testData/refactoring/unwrap/tryUnwrap_before.py | Python | apache-2.0 | 61 |
#!/usr/bin/python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
src = open(sys.argv[1])
dst = open(sys.argv[2], 'w')
for ch in src.read():
dst.write('%d,\n' % ord(ch))
src.close()
dst.close()
| ibc/MediaSoup | worker/deps/gyp/test/external-cross-compile/src/tochar.py | Python | isc | 317 |
import os
from ctypes import CDLL
from ctypes.util import find_library
from django.conf import settings
# Creating the settings dictionary with any settings, if needed.
GEOIP_SETTINGS = dict((key, getattr(settings, key))
for key in ('GEOIP_PATH', 'GEOIP_LIBRARY_PATH', 'GEOIP_COUNTRY', 'GEOIP_CITY... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/geoip/libgeoip.py | Python | gpl-2.0 | 1,094 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | 837278709/metro-openerp | third_modules/product_margin/__openerp__.py | Python | agpl-3.0 | 1,927 |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Band(models.Model):
name = models.CharField(max_length=100)
class Meta:
ordering = ('name',)
def __str__(self):
return self.name
| openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/middleware/models.py | Python | apache-2.0 | 287 |
# Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
# All Rights Reserved
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software wi... | harshilasu/GraphicMelon | y/google-cloud-sdk/platform/gsutil/third_party/boto/boto/ec2/elb/listelement.py | Python | gpl-3.0 | 1,512 |
import simplejson
from lxml import etree
from ..exceptions import except_orm
from ..models import (
MetaModel,
BaseModel,
Model, TransientModel, AbstractModel,
MAGIC_COLUMNS,
LOG_ACCESS_COLUMNS,
)
from openerp.tools.safe_eval import safe_eval as eval
# extra definitions for backward compatibilit... | omprakasha/odoo | openerp/osv/orm.py | Python | agpl-3.0 | 6,222 |
# mammon - utility/third-party stuff, each thing has it's own header and provenance
# information.
# CaseInsensitiveDict from requests.
#
# Copyright 2015 Kenneth Reitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | nasonfish/mammon | mammon/utility.py | Python | isc | 7,875 |
#! /usr/bin/env python
# coding=utf8
#
# Copyright (c) 2008 James Molloy, Jörg Pfähler, Matthew Iselin
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#... | jmolloy/pedigree | scripts/buildLibc.py | Python | isc | 2,327 |
from .formSubmission import FormSubmission
from django.contrib.auth.models import User
from django.db import models
from django.template.defaultfilters import slugify
class Log(models.Model):
"""
Form Submission Log Database Model
Attributes:
* owner - user submitting the message
* submission - ... | ConstellationApps/Forms | constellation_forms/models/log.py | Python | isc | 1,879 |
class Loader:
def __init__(self, options):
self.options = options
self.error = False
self.error_message = ''
self.input_file = None
self.output_file = None
if options.input_filename == '' or options.input_filename == None:
self.error = True
self.error_message = 'Please provide an input file'
retu... | fredmorcos/attic | snippets/python/lex-parse/loader.py | Python | isc | 963 |
__author__ = 'rakesh.varma'
from fabric.api import *
class nginx_install:
def __init__(self, host_ip, host_user, host_key_file):
env.host_string = host_ip
env.user = host_user
env.key_filename = host_key_file
def install(self):
sudo('apt-get update')
sudo('apt-get inst... | varmarakesh/devops-toolbox | devops-toolbox/nginx/install.py | Python | isc | 369 |
import random
import time
# Takes k random sample items from the cache and evicts the oldest item
# This is the same algorithm as allkeys-lru in Redis (there k=3 by default)
from common import Entry
class alg:
def __repr__(self):
return "LRU10"
def __init__(self, c):
random.seed(1337)
... | trauzti/mimir | pymimir/LRU10.py | Python | isc | 2,061 |
# as_rwGPS.py Asynchronous device driver for GPS devices using a UART.
# Supports a limited subset of the PMTK command packets employed by the
# widely used MTK3329/MTK3339 chip.
# Sentence parsing based on MicropyGPS by Michael Calvin McCoy
# https://github.com/inmcm/micropyGPS
# Copyright (c) 2018 Peter Hinch
# Rele... | peterhinch/micropython-async | v3/as_drivers/as_GPS/as_rwGPS.py | Python | mit | 4,383 |
#!/usr/bin/env python2
import rrrr
import sys
import os.path
import time
if len(sys.argv) < 2 or not os.path.isfile(sys.argv[1]):
print ("Create a timetable from GTFS using rrtimetable.")
sys.exit(-1)
router = rrrr.Raptor(timetable = sys.argv[1])
now = int(time.time())
# print router.stops()[0:10]
best_tim... | GraRi135/letsmeet | src/letsmeet-rrrr.py | Python | mit | 832 |
import requests
import warnings
warnings.warn('\n\n\n**** data.session_client will be deprecated in the next py2cytoscape release. ****\n\n\n')
class SessionClient(object):
def __init__(self, url):
self.__url = url + 'session'
def delete(self):
requests.delete(self.__url)
def save(self... | idekerlab/py2cytoscape | py2cytoscape/data/session_client.py | Python | mit | 839 |
#!/usr/bin/python
from functools import wraps
import unittest
from CoordinateMapper import CoordinateMapper
from MapPositions import GenomePositionError
from MapPositions import ProteinPositionError
from MapPositions import CDSPosition, CDSPositionError
from SeqFeature import FeatureLocation, SeqFeature
from Bio.SeqR... | HaseloffLab/PartsDB | partsdb/tools/CoordinateMapper/testCoordinateMapper.py | Python | mit | 13,945 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="family", parent_name="waterfall.hoverlabel.font", **kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=plotly_name,
parent... | plotly/plotly.py | packages/python/plotly/plotly/validators/waterfall/hoverlabel/font/_family.py | Python | mit | 574 |
#! /usr/bin/python3
"""
Datastreams are identified by the address that publishes them, and referenced
in transaction outputs.
For CFD leverage, 1x = 5040, 2x = 10080, etc.: 5040 is a superior highly
composite number and a colossally abundant number, and has 1-10, 12 as factors.
All wagers are in XBJ.
Expiring a bet... | Bluejudy/bluejudyd | lib/bet.py | Python | mit | 18,984 |
from dsmr_parser import telegram_specifications
from dsmr_parser.objects import Telegram
from dsmr_parser.parsers import TelegramParser
from example_telegrams import TELEGRAM_V4_2
parser = TelegramParser(telegram_specifications.V4)
telegram = Telegram(TELEGRAM_V4_2, parser, telegram_specifications.V4)
print(telegram)
| ndokter/dsmr_parser | test/experiment_telegram.py | Python | mit | 320 |
from waldur_core.core import WaldurExtension
class OpenStackTenantExtension(WaldurExtension):
class Settings:
# wiki: https://opennode.atlassian.net/wiki/display/WD/OpenStack+plugin+configuration
WALDUR_OPENSTACK_TENANT = {
'MAX_CONCURRENT_PROVISION': {
'OpenStackTenan... | opennode/nodeconductor-openstack | src/waldur_openstack/openstack_tenant/extension.py | Python | mit | 1,984 |
#-*- coding=utf-8 -*-
'''
@description: 影讯信息获取类。
@author: miliang<miliang@baidu.com>
'''
import sys
sys.path.append('../')
import copy
import urllib
import urllib2
import json
import hashlib
import time
import MySQLdb
import redis
import socket
from monitor.settings import MODE,MYSQL,SEQ_INFO_FILE,RED... | deevarvar/myLab | baidu_code/bcoreapi/monitor/seq_info_collector.py | Python | mit | 4,963 |
"""
Test and verify the memory-mapped command bridge (memmap_command_bridge).
Unlike the actual designs this test does not use a generic peripheral
but instead a specific peripheral / slave is used for each bus type,
other tests verify the generic ability.
"""
from __future__ import print_function, division
from ra... | NickShaffner/rhea | test/test_system/test_memmap_command_bridge.py | Python | mit | 4,179 |
import re
import sys
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style
from .win32 import windll
from .winterm import WinTerm, WinColor, WinStyle
if windll is not None:
winterm = WinTerm()
def is_a_tty(stream):
return hasattr(stream, 'isatty') and stream.isatty()
class StreamWrapper(object):
'''
... | madgik/exareme | Exareme-Docker/src/exareme/exareme-tools/madis/src/lib/colorama/ansitowin32.py | Python | mit | 6,285 |
# Implement function ToLowerCase() that has a string parameter str, and returns the same string in lowercase.
# https://leetcode.com/problems/to-lower-case/
import pytest
class Solution:
def toLowerCase(self, str: str) -> str:
lower = ""
for i in str:
ordVal = ord(i)
if o... | anu-ka/coding-problems | Python/to_lower.py | Python | mit | 660 |
'''
Created on Apr 30, 2017
@author: jamie
'''
import numpy as np
class CartState(object):
'''
Defines a Cartesian state information
'''
pos_I = np.array([0., 0., 0.])
vel_I = np.array([0., 0., 0.])
| jamielapointe/PyPassiveRangingFilters | pyPassiveRanging/dynamicsModels/cartState.py | Python | mit | 236 |
import base64
import urllib
import hashlib
import json
from Crypto.Cipher import AES
from external.sequencing.config import SequencingEndpoints
class AESCipher:
def __init__(self, key, iv):
self.key = key[:32]
self.iv = iv[:16]
__pad = lambda self,s: s + (AES.block_size - len(s) % AES.block_... | SequencingDOTcom/App-Market-API-integration | python/external/sequencing/utils/connect.py | Python | mit | 1,174 |
from rest_framework import serializers
from .models import (
Provider,
OsFamily,
OperatingSystem,
Instance,
ServerPlan
)
class ProviderSerializer(serializers.ModelSerializer):
class Meta:
model = Provider
class OsFamilySerializer(serializers.ModelSerializer):
class Meta:
... | jcbalmeida/onecloud-store | store/computing/serializers.py | Python | mit | 816 |
# Copyright (c) 2015-2019 Patricio Cubillos and contributors.
# pytips is open-source software under the MIT license (see LICENSE).
from .tips import __all__
from .tips import *
# Clean up top-level namespace--delete everything that isn't in __all__
# or is a magic attribute, and that isn't a submodule of this packa... | pcubillos/pytips | pytips/__init__.py | Python | mit | 491 |
import datetime
from django.conf import settings
from django.utils import timezone
from account.models import SignupCode
from waitinglist.models import WaitingListEntry
User = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
def stats():
waiting_list = WaitingListEntry.objects
return {
"waiting... | pinax/django-waitinglist | waitinglist/stats.py | Python | mit | 842 |
# coding: utf-8
import asyncio
import logging
from panoramisk import Manager
from .controller import Controller, DEFAULT_MAX_QUEUES, DEFAULT_MAX_QUEUE_SIZE
from .messages import MessageWrapper
class Bridge:
def __init__(self, options, filters, push_configs):
self.loop = asyncio.get_event_loop()
... | osantana/ami-push | ami_push/bridge.py | Python | mit | 1,262 |
from model import Event
from geo.geomodel import geotypes
def get(handler, response):
lat = handler.request.get('lat')
lon = handler.request.get('lng')
response.events = Event.proximity_fetch(
Event.all(),
geotypes.Point(float(lat),float(lon)),
)
| globalspin/haemapod | haemapod/handlers/events/proximity.py | Python | mit | 264 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
from frappe.utils import random_string
from frappe.test_runner import make_test_records
class TestAutoAssign(unittest.TestCase):
def setUp(self):
... | vjFaLk/frappe | frappe/automation/doctype/assignment_rule/test_assignment_rule.py | Python | mit | 6,555 |
from __future__ import absolute_import
import sys
sys.path.append("../lib")
sys.path.append("../workers")
from database import Database, Sequence
from tree.tree import build
from align.align import msa
from align.align import pipeline
import idigbio
opts = {}
opts["data_file"] = "data.nex"
#raw_seqs = {}
#raw_seqs... | mjcollin/idigphylo | api/api_stub.py | Python | mit | 5,084 |
# KL Template Parser
import sys
# Default type groups
Floats = ['Float32', 'Float64']
Ints = ['UInt8', 'SInt8', 'UInt16', 'SInt16', 'UInt32', 'SInt32', 'UInt64', 'SInt64']
UInts = ['UInt8', 'UInt16', 'UInt32', 'UInt64']
SInts = ['SInt8', 'SInt16', 'SInt32', 'SInt64']
Num = ['UInt8', 'SInt8', 'UInt16', 'SInt16', 'UInt... | MattG1942/KLTemplateParser | KLTemplateParser.py | Python | mit | 3,424 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "game_server.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| cypreess/PyrateDice | game_server/game_server/manage.py | Python | mit | 254 |
from galaxy import config, tools, jobs, web
import galaxy.model.mapping
class UniverseApplication( object ):
"""Encapsulates the state of a Universe application"""
def __init__( self, **kwargs ):
# Read config file and check for errors
self.config = config.Configuration( **kwargs )
self... | jmchilton/galaxy-central | galaxy/app.py | Python | mit | 1,636 |
# from django.conf.urls import url
# from . import views
urlpatterns = [
]
| InterestingLab/elasticmanager | indices/urls.py | Python | mit | 77 |
from six import python_2_unicode_compatible
from .base import QuickbooksBaseObject, Ref, QuickbooksManagedObject, QuickbooksTransactionEntity, \
LinkedTxnMixin, MarkupInfo
from .detailline import DetailLine
class ItemBasedExpenseLineDetail(QuickbooksBaseObject):
class_dict = {
"ItemRef": Ref,
... | emburse/python-quickbooks | quickbooks/objects/vendorcredit.py | Python | mit | 2,766 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pygeoutil documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 14 10:29:06 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | ritviksahajpal/pygeoutil | doc/conf.py | Python | mit | 10,031 |
# -*- coding: utf-8 -*-
""" S3 Extensions for gluon.dal.Field, reusable fields
@requires: U{B{I{gluon}} <http://web2py.com>}
@copyright: 2009-2016 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associ... | flavour/ifrc_qa | modules/s3/s3fields.py | Python | mit | 55,566 |
'''
A Multilayer Perceptron implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits
(http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
from __future__ import print_function
import tensorf... | isabellewei/deephealth | data/network.py | Python | mit | 3,768 |
# coding=utf-8
from Framework.Controller import Controller
from Database.Controllers.Curriculo import Curriculo as BDCurriculo
from Models.Curriculo.RespostaListar import RespostaListar
from Database.Models.Curriculo import Curriculo as ModelCurriculo
class Curriculo(Controller):
def Listar(self,pedido_listar):
re... | AEDA-Solutions/matweb | backend/Controllers/Curriculo.py | Python | mit | 541 |
from .mim import Connection, match, MatchDoc, MatchList, BsonArith
| rick446/MongoTools | mongotools/mim/__init__.py | Python | mit | 67 |
"""This is a stub view that can be used to
develop or test the Meeting Tracker JavaScript
functionality without hitting the actual database.
"""
from django.template import Context, loader
from django.http import HttpResponse
from chirp.utils import as_json
def meetings_dev(request):
t = loader.get_template('... | chirpradio/chirpradio-volunteers | chirp/volunteers/_ui_test_/meetings.py | Python | mit | 1,128 |
from django.conf.urls import include, url
urlpatterns = (
url(r"^", include("pinax.forums.urls", namespace="pinax_forums")),
)
| pinax/pinax-forums | pinax/forums/tests/urls.py | Python | mit | 132 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-batch/azure/batch/models/start_task.py | Python | mit | 5,044 |
# -*- coding: utf-8 -*-
"""Module that helps in checking the correctness of CSV file structure."""
| TMiguelT/csvschema | csv_schema/__init__.py | Python | mit | 103 |
from commands import getoutput
def NetworkFromPrefix(val):
"""
Return the network with the network prefix given.
"""
ifaces = getoutput('hostname -I') # *nix only.
sifaces = ifaces.strip().split()
for iface in sifaces:
if iface.startswith(val):
return iface
| stuntgoat/conf-syrup | conf_syrup/network_type.py | Python | mit | 307 |
# Bryan Barrows
# CSC 110 - Winter 17
# fahrenheit.py
# The purpose of this program is to convert a user input temperature from celsius to fahrenheit.
def main():
celsius = eval(input("What is the Celsius temperature? "))
fahrenheit = (9/5) * celsius + 32
print("The temperature is ",fahrenheit," degrees F... | bbarrows89/CSC110_Projects | fahrenheit.py | Python | mit | 341 |
from django.contrib import admin
from minitwitter.app.models import Tweet
class TweetAdmin(admin.ModelAdmin):
fieldsets = [
('Tweet info', {'fields': ['user', 'text']}),
('Date information', {'fields': ['timestamp']})
]
admin.site.register(Tweet, TweetAdmin)
| RomuloOliveira/django-dojo | minitwitter/app/admin.py | Python | mit | 285 |
import os
import pygame as pg
import glob
import constants
pg.display.init()
video = pg.display
screen = video.set_mode(constants.display_size)
""" Preloads images and parameters """
images = glob.glob('*.png')
image_cache = {}
def get_image(path):
img = image_cache.get(path)
path = os.path.join('resources... | bardlean86/SNEK_TheReckoning | graphics.py | Python | mit | 2,059 |