code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
from binding import *
from src.namespace import llvm
from src.Value import MDNode
from src.Instruction import Instruction, TerminatorInst
llvm.includes.add('llvm/Transforms/Utils/BasicBlockUtils.h')
SplitBlockAndInsertIfThen = llvm.Function('SplitBlockAndInsertIfThen',
ptr(Ter... | llvmpy/llvmpy | llvmpy/src/Transforms/Utils/BasicBlockUtils.py | Python | bsd-3-clause | 767 |
from __future__ import absolute_import
import mock
import os
from django.conf import settings
from sentry_sdk import Hub
TEST_ROOT = os.path.normpath(
os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, os.pardir, "tests")
)
def pytest_configure(config):
# HACK: Only needed for testin... | mvaled/sentry | src/sentry/utils/pytest/sentry.py | Python | bsd-3-clause | 8,427 |
import pytest
from django.db import connection, IntegrityError
from .models import MyTree
def flush_constraints():
# the default db setup is to have constraints DEFERRED.
# So IntegrityErrors only happen when the transaction commits.
# Django's testcase thing does eventually flush the constraints but to... | craigds/django-mpathy | tests/test_db_consistency.py | Python | bsd-3-clause | 2,474 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from markitup import settings
from markitup.markup import filter_func
from markitup.sanitize import sanitize_html
def apply_filter(request):
cleaned_data = sanitize_html(request.POST.get('data', ''), strip=True)
markup ... | thoslin/django-markitup | markitup/views.py | Python | bsd-3-clause | 527 |
# -*- coding: utf-8 -*-
"""
Doctest runner for 'birdhousebuilder.recipe.adagucserver'.
"""
__docformat__ = 'restructuredtext'
import os
import sys
import unittest
import zc.buildout.tests
import zc.buildout.testing
from zope.testing import doctest, renormalizing
optionflags = (doctest.ELLIPSIS |
doc... | bird-house/birdhousebuilder.recipe.adagucserver | birdhousebuilder/recipe/adagucserver/tests/test_docs.py | Python | bsd-3-clause | 1,620 |
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
API Issues to work out:
- MatrixTransform and STTransform both have 'scale' and 'translate'
attributes, but they are used in very different ways. It ... | Eric89GXL/vispy | vispy/visuals/transforms/base_transform.py | Python | bsd-3-clause | 7,578 |
from x86asm import codePackageFromFile
from x86cpToMemory import CpToMemory
from pythonConstants import PythonConstants
import cStringIO
import excmem
def pyasm(scope,s):
cp = codePackageFromFile(cStringIO.StringIO(s),PythonConstants)
mem = CpToMemory(cp)
mem.MakeMemory()
mem.BindPythonFunctions(scope)... | grant-olson/pyasm | __init__.py | Python | bsd-3-clause | 327 |
"""
Custom Authenticator to use MediaWiki OAuth with JupyterHub
Requires `mwoauth` package.
"""
import json
import os
from asyncio import wrap_future
from concurrent.futures import ThreadPoolExecutor
from jupyterhub.handlers import BaseHandler
from jupyterhub.utils import url_path_join
from mwoauth import ConsumerTok... | jupyterhub/oauthenticator | oauthenticator/mediawiki.py | Python | bsd-3-clause | 4,178 |
# Copyright 2017 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.
"""This program wraps an arbitrary command since gn currently can only execute
scripts."""
import os
import subprocess
import sys
from shutil import copy2
... | nwjs/chromium.src | tools/v8_context_snapshot/run.py | Python | bsd-3-clause | 552 |
#
# FBrowserBase.py -- Base class for file browser plugin for fits viewer
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
import os, glob
import stat, time
from ging... | bsipocz/ginga | ginga/misc/plugins/FBrowserBase.py | Python | bsd-3-clause | 5,421 |
from .cuda_products import gmt_func as gp_device
from .cuda_products import imt_func as ip_device
import numpy as np
import numba.cuda
import numba
import math
import random
from . import *
def sequential_rotor_estimation_chunks(reference_model_array, query_model_array, n_samples, n_objects_per_sample, mutation_pro... | arsenovic/clifford | clifford/tools/g3c/cuda.py | Python | bsd-3-clause | 20,805 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
## @copyright
# Software License Agreement (BSD License)
#
# Copyright (c) 2017, Jorge De La Cruz, Carmen Castano.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the followi... | jdelacruz26/misccode | cad2xls.py | Python | bsd-3-clause | 2,955 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 0, transform = "Fisher", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Fisher/trend_MovingMedian/cycle_0/ar_/test_artificial_1024_Fisher_MovingMedian_0__100.py | Python | bsd-3-clause | 266 |
# Copyright (c) 2016,2017 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""
===========================
Upper Air Sounding Tutorial
===========================
Upper air analysis is a staple of many synoptic and mesoscale analysis
problems. In this... | metpy/MetPy | v0.8/_downloads/upperair_soundings.py | Python | bsd-3-clause | 7,536 |
## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
""" Deploy and install a package to a target
"""
import os
import sys
import zipfile
from qisys import ui
import qisys.command
import qisys.parse... | dmerejkowsky/qibuild | python/qipkg/actions/deploy_package.py | Python | bsd-3-clause | 1,732 |
"""
SMQTK Web Applications
"""
import inspect
import logging
import os
import flask
import smqtk.utils
from smqtk.utils import plugin
class SmqtkWebApp (flask.Flask, smqtk.utils.Configurable, plugin.Pluggable):
"""
Base class for SMQTK web applications
"""
@classmethod
def impl_directory(cls):... | kfieldho/SMQTK | python/smqtk/web/__init__.py | Python | bsd-3-clause | 4,457 |
from __future__ import unicode_literals
from django.db import models
from smartmin.models import SmartModel, ActiveManager
class Post(SmartModel):
title = models.CharField(max_length=128,
help_text="The title of this blog post, keep it relevant")
body = models.TextField(help_text... | caktus/smartmin | test_runner/blog/models.py | Python | bsd-3-clause | 1,319 |
from __future__ import absolute_import
import pkgutil
import six
MODEL_MOVES = {
"sentry.models.tagkey.TagKey": "sentry.tagstore.legacy.models.tagkey.TagKey",
"sentry.models.tagvalue.tagvalue": "sentry.tagstore.legacy.models.tagvalue.TagValue",
"sentry.models.grouptagkey.GroupTagKey": "sentry.tagstore.le... | mvaled/sentry | src/sentry/utils/imports.py | Python | bsd-3-clause | 1,880 |
from pyelectro import analysis as pye_analysis
from matplotlib import pyplot
file_name = "100pA_1a.csv"
t, v = pye_analysis.load_csv_data(file_name)
analysis_var = {
"peak_delta": 0.1,
"baseline": 0,
"dvdt_threshold": 2,
"peak_threshold": 0,
}
analysis = pye_analysis.IClampAnalysis(
v, t, analysi... | NeuralEnsemble/neurotune | examples/example_1/data_analysis.py | Python | bsd-3-clause | 489 |
import json
from django.test.utils import override_settings
import pytest
from pyquery import PyQuery
from fjord.base import views
from fjord.base.tests import (
LocalizingClient,
TestCase,
AnalyzerProfileFactory,
reverse
)
from fjord.base.views import IntentionalException
from fjord.search.tests imp... | Ritsyy/fjord | fjord/base/tests/test_views.py | Python | bsd-3-clause | 5,907 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_i3wm-formula
----------------------------------
Tests for `i3wm-formula` module.
"""
import unittest
from i3wm-formula import i3wm-formula
class TestI3wm-formula(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pas... | westurner/i3wm-formula | tests/test_i3wm-formula.py | Python | bsd-3-clause | 407 |
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E08000032'
addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.tsvJune2017.tsv'
stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__0... | chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_bradford.py | Python | bsd-3-clause | 408 |
import os
import pytest
from datetime import time
from sport_systems import stats
BASE_DIR = os.path.dirname(__file__)
@pytest.fixture
def response_1():
path = os.path.join(BASE_DIR, 'response-1.xml')
with open(path, 'rb') as fin:
data = fin.read()
return data
@pytest.fixture
def results_1():... | willcodefortea/sportssystems_crawler | tests/conftest.py | Python | bsd-3-clause | 672 |
from django.test import TestCase
from mock import Mock, patch
from paymentexpress.facade import Facade
from paymentexpress.gateway import AUTH, PURCHASE
from paymentexpress.models import OrderTransaction
from tests import (XmlTestingMixin, CARD_VISA, SAMPLE_SUCCESSFUL_RESPONSE,
SAMPLE_DECLINED_RESPO... | django-oscar/django-oscar-paymentexpress | tests/facade_tests.py | Python | bsd-3-clause | 7,334 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists of vo... | zjj/trac_hack | trac/versioncontrol/admin.py | Python | bsd-3-clause | 16,185 |
from acoustics.decibel import *
def test_dbsum():
assert(abs(dbsum([10.0, 10.0]) - 13.0103) < 1e-5)
def test_dbmean():
assert(dbmean([10.0, 10.0]) == 10.0)
def test_dbadd():
assert(abs(dbadd(10.0, 10.0) - 13.0103) < 1e-5)
def test_dbsub():
assert(abs(dbsub(13.0103, 10.0) - 10.0) < 1e-5)
def tes... | FRidh/python-acoustics | tests/test_decibel.py | Python | bsd-3-clause | 451 |
from djangothis.app import read_yaml, read_yaml_file, watchfile
| amitu/djangothis | djangothis/__init__.py | Python | bsd-3-clause | 64 |
# coding: utf-8
# Copyright 2015 rpaas authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import unittest
from rpaas import plan, storage
class MongoDBStorageTestCase(unittest.TestCase):
def setUp(self):
self.storage = st... | vfiebig/rpaas | tests/test_storage.py | Python | bsd-3-clause | 5,053 |
"""
Collection of query wrappers / abstractions to both facilitate data
retrieval and to reduce dependency on DB-specific API.
"""
from contextlib import contextmanager
from datetime import date, datetime, time
from functools import partial
import re
from typing import Iterator, Optional, Union, overload
import warnin... | TomAugspurger/pandas | pandas/io/sql.py | Python | bsd-3-clause | 62,333 |
# Copyright (C) 2011 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... | was4444/chromium.src | third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py | Python | bsd-3-clause | 3,518 |
import numpy as np
from ._layout import Layout
from ._multivector import MultiVector
class ConformalLayout(Layout):
r"""
A layout for a conformal algebra, which adds extra constants and helpers.
Typically these should be constructed via :func:`clifford.conformalize`.
.. versionadded:: 1.2.0
At... | arsenovic/clifford | clifford/_conformal_layout.py | Python | bsd-3-clause | 2,999 |
"""
Menu-driven login system
Contribution - Griatch 2011
This is an alternative login system for Evennia, using the
contrib.menusystem module. As opposed to the default system it doesn't
use emails for authentication and also don't auto-creates a Character
with the same name as the Player (instead assuming some sort... | GhostshipSoftware/avaloria | contrib/menu_login.py | Python | bsd-3-clause | 13,491 |
#!/usr/bin/env python
#
# Copyright (c) 2013 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.
"""Runs Android's lint tool."""
import argparse
import os
import re
import sys
import traceback
from xml.dom import minidom
fr... | was4444/chromium.src | build/android/gyp/lint.py | Python | bsd-3-clause | 12,623 |
"""
Concurrent downloaders
"""
import os
import sys
import signal
import logging
import itertools
from functools import partial
from concurrent.futures import ProcessPoolExecutor
from pomp.core.base import (
BaseCrawler, BaseDownloader, BaseCrawlException,
)
from pomp.contrib.urllibtools import UrllibDownloadWorke... | estin/pomp | pomp/contrib/concurrenttools.py | Python | bsd-3-clause | 5,193 |
# Copyright (c) 2012 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.
import logging
import os
import time
import traceback
import urlparse
import random
import csv
from chrome_remote_control import page_test
from chrome_re... | junmin-zhu/chromium-rivertrail | tools/chrome_remote_control/chrome_remote_control/page_runner.py | Python | bsd-3-clause | 6,385 |
"""Migrate review conditions from settings
Revision ID: 933665578547
Revises: 02bf20df06b3
Create Date: 2020-04-02 11:13:58.931020
"""
import json
from collections import defaultdict
from uuid import uuid4
from alembic import context, op
from indico.modules.events.editing.models.editable import EditableType
# rev... | ThiefMaster/indico | indico/migrations/versions/20200402_1113_933665578547_migrate_review_conditions_from_settings.py | Python | mit | 2,739 |
"""
PynamoDB exceptions
"""
from typing import Any, Optional
import botocore.exceptions
class PynamoDBException(Exception):
"""
A common exception class
"""
def __init__(self, msg: Optional[str] = None, cause: Optional[Exception] = None) -> None:
self.msg = msg
self.cause = cause
... | pynamodb/PynamoDB | pynamodb/exceptions.py | Python | mit | 4,009 |
# -*- coding: utf-8 -*-
"""
handler base
~~~~~~~~~~~~
Presents a reasonable base class for a ``Handler`` object, which handles
responding to an arbitrary "request" for action. For example, ``Handler``
is useful for responding to HTTP requests *or* noncyclical realtime-style
requests, and acts as a base c... | momentum/canteen | canteen/base/handler.py | Python | mit | 17,022 |
# -*-coding: utf-8 -*-
import math
import numpy as np
import relations
def _avg_difference(npiece, side):
if side == relations.LEFT:
difference = npiece[:, 0] - npiece[:, 1]
elif side == relations.RIGHT:
difference = npiece[:, -1] - npiece[:, -2]
elif side == relations.UP:
differe... | typeinference/jigsaw-puzzle | src/measures.py | Python | mit | 1,631 |
import RPi.GPIO as GPIO
import os
import time
import datetime
import glob
import MySQLdb
from time import strftime
import serial
ser = serial.Serial(
port='/dev/ttyACM0',
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
counter = ... | Shashank95/Intellifarm | logdata.py | Python | mit | 1,310 |
# Copyright 2016 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... | jjas0nn/solvem | tensorflow/lib/python2.7/site-packages/tensorflow/contrib/learn/__init__.py | Python | mit | 2,083 |
from __future__ import division
class ExitNode:
"""
Class for the exit node on our network
"""
def __init__(self, max_simulation_time):
"""
Initialise a node.
"""
self.individuals = []
self.id_number = -1
self.next_event_date = max_simulation_time
... | geraintpalmer/ASQ | asq/exit_node.py | Python | mit | 759 |
### EXESOFT PYIGNITION ###
# Copyright David Barker 2010
#
# Global constants module
# Which version is this?
PYIGNITION_VERSION = 1.0
# Drawtype constants
DRAWTYPE_POINT = 100
DRAWTYPE_CIRCLE = 101
DRAWTYPE_LINE = 102
DRAWTYPE_SCALELINE = 103
DRAWTYPE_BUBBLE = 104
DRAWTYPE_IMAGE = 105
# Interpola... | HelsinkiGroup5/Hackathon | display_manuel/constants.py | Python | mit | 865 |
import json
import math
import random
import os
class KMeans(object):
# TO-DO: Richard
def __init__(self, dataset=None):
file_path = os.path.dirname(os.path.realpath(__file__))
if dataset is None:
self.mega_dataset = json.loads(open(file_path + '/dataset.json', 'r').read... | avathardev/matchine-learning | kmeans.py | Python | mit | 3,350 |
#!/usr/bin/env python
# coding=utf-8
"""
The full documentation is at https://python_hangman.readthedocs.org.
"""
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
def finalize_options... | bionikspoon/python_hangman | setup.py | Python | mit | 2,404 |
# encoding: utf-8
from mongoengine.fields import BaseField
from marrow.package.canonical import name
from marrow.package.loader import load
class PythonReferenceField(BaseField):
"""A field that transforms a callable into a string reference using marrow.package on assignment, then back to the
callable when accessi... | deKross/task | marrow/task/field.py | Python | mit | 717 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/player/shared_player_city_bank_corellia_style_01.iff"
result.attrib... | anhstudios/swganh | data/scripts/templates/object/building/player/shared_player_city_bank_corellia_style_01.py | Python | mit | 446 |
__author__ = 'leif'
from django.contrib import admin
from models import *
admin.site.register(GameExperiment)
admin.site.register(UserProfile)
admin.site.register(MaxHighScore)
| leifos/boxes | treasure-houses/asg/admin.py | Python | mit | 178 |
#! coding:utf-8
"""
compiler tests.
These tests are among the very first that were written when SQLAlchemy
began in 2005. As a result the testing style here is very dense;
it's an ongoing job to break these into much smaller tests with correct pep8
styling and coherent test organization.
"""
from sqlalchemy.testin... | sandan/sqlalchemy | test/sql/test_compiler.py | Python | mit | 148,745 |
# coding: utf-8
from django.views.generic import CreateView, UpdateView, DeleteView
from django.http import HttpResponse, HttpResponseRedirect
from django.template.loader import render_to_string
from django.template import RequestContext
from django.core.serializers.json import DjangoJSONEncoder
from django.conf import... | kobox/achilles.pl | src/static/fm/views.py | Python | mit | 4,377 |
# Copyright (c) 2015 Boocock James <james.boocock@otago.ac.nz>
# Author: Boocock James <james.boocock@otago.ac.nz>
#
# 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 without restriction, incl... | theboocock/fine_mapping_pipeline | tests/test_run_finemap.py | Python | mit | 1,755 |
import os
import json
import six
from ddt import ddt, data, file_data, is_hash_randomized
from nose.tools import assert_equal, assert_is_not_none, assert_raises
@ddt
class Dummy(object):
"""
Dummy class to test the data decorator on
"""
@data(1, 2, 3, 4)
def test_something(self, value):
... | domidimi/ddt | test/test_functional.py | Python | mit | 6,480 |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and Contributors
# License: MIT. See LICENSE
# import frappe
import unittest
class TestModuleOnboarding(unittest.TestCase):
pass
| frappe/frappe | frappe/desk/doctype/module_onboarding/test_module_onboarding.py | Python | mit | 197 |
#!/usr/bin/env python
from icqsol.bem.icqPotentialIntegrals import PotentialIntegrals
from icqsol.bem.icqLaplaceMatrices import getFullyQualifiedSharedLibraryName
import numpy
def testObserverOnA(order):
paSrc = numpy.array([0., 0., 0.])
pbSrc = numpy.array([1., 0., 0.])
pcSrc = numpy.array([0., 1., 0.])
... | gregvonkuster/icqsol | tests/testPotentialIntegrals.py | Python | mit | 3,128 |
#!/usr/bin/python
#encoding=utf-8
import urllib, urllib2
import cookielib
import re
import time
from random import random
from json import dumps as json_dumps, loads as json_loads
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import os
project_root_path = os.path.abspath(os.path.join(os.path.... | debugtalk/MiaoZuanScripts | MiaoZuanScripts.py | Python | mit | 7,305 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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 without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | datalogics/scons | test/ParseDepends.py | Python | mit | 5,431 |
"""Tests for base extension."""
import unittest
from grow.extensions import base_extension
class BaseExtensionTestCase(unittest.TestCase):
"""Test the base extension."""
def test_config_disabled(self):
"""Uses the disabled config."""
ext = base_extension.BaseExtension(None, {
'di... | grow/pygrow | grow/extensions/base_extension_test.py | Python | mit | 844 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# isprime.py
#
# Author: Billy Wilson Arante
# Created: 2016/06/16 PHT
# Modified: 2016/10/01 EDT (America/New York)
from sys import argv
def isprime(x):
"""Checks if x is prime number
Returns true if x is a prime number, otherwise false.
"""
if x <= 1:
... | arantebillywilson/python-snippets | py2/cool-things/isprime.py | Python | mit | 565 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from holmes.validators.base import Validator
from holmes.utils import _
class ImageAltValidator(Validator):
@classmethod
def get_without_alt_parsed_value(cls, value):
result = []
for src, name in value:
data = '<a href="%s" target="_blank"... | holmes-app/holmes-api | holmes/validators/image_alt.py | Python | mit | 3,935 |
#!/usr/bin/env python
#coding: utf-8
# Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# @param root, a tree node
# @return a list of integers
def postorderTraversal(self, root):
p... | wh-acmer/minixalpha-acm | LeetCode/Python/binary_tree_postorder_traversal_iter.py | Python | mit | 324 |
from .models import Project,Member,Contact,Technology,Contributor
from rest_framework import serializers
class ContactSerializer(serializers.ModelSerializer):
class Meta:
model = Contact
fields = ('name', 'link')
class MemberSerializer(serializers.ModelSerializer):
contacts = ContactSerializer... | o-d-i-n/HelloWorld | api/serializers.py | Python | mit | 778 |
from . animation import Animation
from .. layout import strip
class Strip(Animation):
LAYOUT_CLASS = strip.Strip
LAYOUT_ARGS = 'num',
def __init__(self, layout, start=0, end=-1, **kwds):
super().__init__(layout, **kwds)
self._start = max(start, 0)
self._end = end
if self.... | ManiacalLabs/BiblioPixel | bibliopixel/animation/strip.py | Python | mit | 543 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/deployment_properties.py | Python | mit | 2,606 |
import enum
class calendar_permissions(enum.IntEnum):
ASCIT = 21
AVERY = 22
BECHTEL = 23
BLACKER = 24
DABNEY = 25
FLEMING = 26
LLOYD = 27
PAGE = 28
RICKETTS = 29
RUDDOCK = 30
OTHER = 31
ATHLETICS = 32
| ASCIT/donut-python | donut/modules/calendar/permissions.py | Python | mit | 251 |
import logging, sys
from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL
class InfoFilter(logging.Filter):
def filter(self, rec):
return rec.levelno in (logging.DEBUG, logging.INFO)
def _new_custom_logger(name='BiblioPixel',
fmt='%(levelname)s - %(module)s - %(message)s'):
... | sethshill/final | build/lib.linux-armv7l-2.7/bibliopixel/log.py | Python | mit | 1,041 |
def make_colorscale_from_colors(colors):
if len(colors) == 1:
colors *= 2
return tuple((i / (len(colors) - 1), color) for i, color in enumerate(colors))
| KwatME/plot | plot/make_colorscale_from_colors.py | Python | mit | 172 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Building()
result.template = "object/building/poi/shared_corellia_solitude_medium3.iff"
result.attribute_template... | anhstudios/swganh | data/scripts/templates/object/building/poi/shared_corellia_solitude_medium3.py | Python | mit | 456 |
class Solution(object):
# def convert(self, s, numRows):
# """
# :type s: str
# :type numRows: int
# :rtype: str
# """
# ls = len(s)
# if ls <= 1 or numRows == 1:
# return s
# temp_s = []
# for i in range(numRows):
# tem... | qiyuangong/leetcode | python/006_ZigZag_Conversion.py | Python | mit | 1,447 |
"""Representation of Z-Wave binary_sensors."""
from openzwavemqtt.const import CommandClass, ValueIndex, ValueType
from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR_DOMAIN,
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
from ho... | rohitranjan1991/home-assistant | homeassistant/components/ozw/binary_sensor.py | Python | mit | 14,428 |
"""
run quality assurance measures on functional data
"""
import sys,glob
sys.path.append('/corral-repl/utexas/poldracklab/software_lonestar/quality-assessment-protocol')
import os
import numpy
from run_shell_cmd import run_shell_cmd
from compute_fd import compute_fd
from qap import load_func,load_image, load_mask, s... | vsoch/myconnectome | myconnectome/qa/run_qap_func.py | Python | mit | 2,129 |
__version__ = "master"
| jvandijk/pla | pla/version.py | Python | mit | 23 |
#!/usr/bin/python
'''
Created on May 14, 2012
@author: Charlie
'''
import ConfigParser
import boto
import cgitb
cgitb.enable()
class MyClass(object):
def __init__(self, domain):
config = ConfigParser.RawConfigParser()
config.read('.boto')
key = config.get('Credentials', 'aws_access_key_i... | donlee888/JsObjects | Python/Prog282SimpleDb/scripts/simpledb.py | Python | mit | 1,593 |
# 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 ... | jkonecki/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/flattened_product.py | Python | mit | 2,348 |
# 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 ... | v-iam/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/deployed_stateful_service_replica_info.py | Python | mit | 3,502 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import unittest
import os
import json
from io import open
import warnings
from pymatgen.electronic_structure.bandstructure import Kpoint
from pymatgen import Lattice
from pymatgen.electronic_structure.core im... | dongsenfo/pymatgen | pymatgen/electronic_structure/tests/test_bandstructure.py | Python | mit | 23,174 |
"""
SPLIF Fingerprints for molecular complexes.
"""
import logging
import itertools
import numpy as np
from deepchem.utils.hash_utils import hash_ecfp_pair
from deepchem.utils.rdkit_utils import load_complex
from deepchem.utils.rdkit_utils import compute_all_ecfp
from deepchem.utils.rdkit_utils import MoleculeLoadExcep... | deepchem/deepchem | deepchem/feat/complex_featurizers/splif_fingerprints.py | Python | mit | 10,535 |
# -*- coding: utf-8 -*-
from .base import _Base, Base
from .base_collection import BaseCollection
from .habit_groups import HabitGroups
from .habit_groups_collection import HabitGroupsCollection
from .habits import Habits
from .habits_collection import HabitsCollection
from .users import Users
from .users_collection i... | dnguyen0304/mfit_service | mfit/mfit/resources/__init__.py | Python | mit | 1,041 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/inventory/shared_creature_inventory_6.iff"
result.attribute_templat... | anhstudios/swganh | data/scripts/templates/object/tangible/inventory/shared_creature_inventory_6.py | Python | mit | 450 |
""" FileDialogDelegateQt.py: Delegate that pops up a file dialog when double clicked.
Sets the model data to the selected file name.
"""
import os.path
try:
from PyQt5.QtCore import Qt, QT_VERSION_STR
from PyQt5.QtWidgets import QStyledItemDelegate, QFileDialog
except ImportError:
try:
from PyQt4... | marcel-goldschen-ohm/ModelViewPyQt | FileDialogDelegateQt.py | Python | mit | 2,023 |
import sys
import pprint
class Reference(object):
def __init__(self, tb_index, varname, target):
self.tb_index = tb_index
self.varname = varname
self.target = target
def marker(self, xtb, tb_index, key):
return Marker(self, xtb, tb_index, key)
class Marker(object):
def... | Hypernode/xtraceback | xtraceback/reference.py | Python | mit | 1,552 |
# -*- coding: utf-8 -*-
"""
This scripts sets an initial layout for the ProEMOnline software. It uses the
PyQtGraph dockarea system and was designed from the dockarea.py example.
Contains:
Left column: Observing Log
Center column: Plots
Right column: Images and Process Log
Menu bar
"""
import pyqtgraph as pg
from p... | ccd-utexas/ProEMOnline | layout.py | Python | mit | 7,341 |
import _plotly_utils.basevalidators
class PadValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="pad", parent_name="layout.title", **kwargs):
super(PadValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
dat... | plotly/python-api | packages/python/plotly/plotly/validators/layout/title/_pad.py | Python | mit | 945 |
from sentence import Sentence
from textblob import TextBlob
from itertools import chain
from collections import Counter
def findSubject(lines):
sentences = []
if len(lines) == 0:
print "messages are empty"
return None
for m in lines:
sentences.append(Sentence(m).nouns)
if len(sen... | ZacharyJacobCollins/Fallen | tagger.py | Python | mit | 554 |
import xml.sax
import unittest
import test_utils
import xmlreader
import os
path = os.path.dirname(os.path.abspath(__file__) )
class XmlReaderTestCase(unittest.TestCase):
def test_XmlDumpAllRevs(self):
pages = [r for r in xmlreader.XmlDump(path + "/data/article-pear.xml", allrevisions=True).parse()]
... | races1986/SafeLanguage | CEM/tests/test_xmlreader.py | Python | epl-1.0 | 1,809 |
#!/usr/bin/python
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
#
# 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 2 of the License, or
# (at your option)... | vladimir-ipatov/ganeti | lib/tools/burnin.py | Python | gpl-2.0 | 42,651 |
# This file is a part of pysnapshotd, a program for automated backups
# Copyright (C) 2015-2016 Jonas Thiem
#
# 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 2 of the License,... | JonasT/pyrsnapshotd | src/pysnapshotd/pipeobject.py | Python | gpl-2.0 | 4,032 |
# Copyright (C) 2008 Canonical Ltd
#
# 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | stewartsmith/bzr | bzrlib/smart/packrepository.py | Python | gpl-2.0 | 1,623 |
import os, platform
sysstr = platform.system()
if sysstr == "Windows":
LF = '\r\n'
elif sysstr == "Linux":
LF = '\n'
def StripStr(str):
# @Function: Remove space(' ') and indent('\t') at the begin and end of the string
oldStr = ''
newStr = str
while oldStr != newStr:
oldStr = newStr
... | seims/SEIMS | scenario_analysis/util.py | Python | gpl-2.0 | 1,939 |
# coding: utf-8
# Copyright 2014 Globo.com Player authors. All rights reserved.
# Use of this source code is governed by a MIT License
# license that can be found in the LICENSE file.
from collections import namedtuple
import os
import errno
import math
try:
import urlparse as url_parser
except ImportError:
i... | JaxxC/goodgame.xbmc | plugin.video.goodgame/resources/lib/m3u8/model.py | Python | gpl-2.0 | 22,352 |
# coding: utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import socket
import os
import re
import select
import time
import paramiko
import struct
import fcntl
import signal
import textwrap
import getpass
import fnmatch
import readline
import datetime
from multiprocessing import Pool
os.environ['DJANGO... | watchsky126/jumpserver | connect.py | Python | gpl-2.0 | 12,846 |
import hashlib
import binascii
class MerkleTools(object):
def __init__(self, hash_type="sha256"):
hash_type = hash_type.lower()
if hash_type == 'sha256':
self.hash_function = hashlib.sha256
elif hash_type == 'md5':
self.hash_function = hashlib.md5
elif hash_t... | OliverCole/ZeroNet | src/lib/merkletools/__init__.py | Python | gpl-2.0 | 4,984 |
# encoding: utf-8
"""
Miscellaneous functions, which are useful for handling bodies.
"""
from yade.wrapper import *
import utils,math,numpy
try:
from minieigen import *
except ImportError:
from miniEigen import *
#spheresPackDimensions==================================================
def spheresPackDimensions(idS... | ThomasSweijen/TPF | py/bodiesHandling.py | Python | gpl-2.0 | 8,305 |
# -*- coding: utf-8 -*-
import fauxfactory
import pytest
from cfme import test_requirements
from cfme.rest.gen_data import a_provider as _a_provider
from cfme.rest.gen_data import vm as _vm
from cfme.utils import error
from cfme.utils.rest import assert_response, delete_resources_from_collection
from cfme.utils.wait i... | jkandasa/integration_tests | cfme/tests/infrastructure/test_vm_rest.py | Python | gpl-2.0 | 2,531 |
# -*- coding: utf-8 -*-
# This file is part of the Horus Project
__author__ = 'Jesús Arroyo Torrens <jesus.arroyo@bq.com>'
__copyright__ = 'Copyright (C) 2014-2016 Mundo Reader S.L.'
__license__ = 'GNU General Public License v2 http://www.gnu.org/licenses/gpl2.html'
from horus.engine.driver.driver import Driver
from ... | bqlabs/horus | src/horus/gui/engine.py | Python | gpl-2.0 | 1,802 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | Lekensteyn/buildbot | master/buildbot/process/results.py | Python | gpl-2.0 | 2,689 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2007 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## This program 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 F... | andrebellafronte/stoq | stoqlib/domain/transfer.py | Python | gpl-2.0 | 15,361 |
#! /usr/bin/env python
#
# Copyright (C) 2015 Open Information Security Foundation
#
# You can copy, redistribute or modify this Program 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... | daviddiallo/suricata | scripts/dnp3-gen/dnp3-gen.py | Python | gpl-2.0 | 22,538 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
CreateWorkspace.py
---------------------
Date : October 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**********************... | mhugent/Quantum-GIS | python/plugins/processing/algs/admintools/CreateWorkspace.py | Python | gpl-2.0 | 2,079 |
from __future__ import division
"""
These functions are for BOSSANOVA (BOss Survey of Satellites Around Nearby Optically obserVable milky way Analogs)
"""
import numpy as np
from matplotlib import pyplot as plt
import targeting
def count_targets(hsts, verbose=True, remove_cached=True, rvir=300, targetingkwargs={})... | saga-survey/saga-code | bossanova/bossanova.py | Python | gpl-2.0 | 4,779 |
#!/usr/bin/env python
# coding:utf-8
import hashlib
import logging
from x1category import X1Category
TOOL_PREFIX = 'X1Tool'
class X1Tool(object):
'appid:6376477c731a89e3280657eb88422645f2d1e2a684541222e21371f3110110d2'
DEFAULT_METADATA = {'name': "X1Tool", 'author': "admin", 'comments': "default", 'template':... | cshzc/X1Tool | src/server/apps/x1tool.py | Python | gpl-2.0 | 1,304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.