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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
""" Registration tests """
import os
from shutil import copy
import pytest
from tempfile import TemporaryDirectory
from nipype.pipeline import engine as pe
from ..interfaces.reportlets.registration import (
FLIRTRPT,
SpatialNormalizationRPT,
ANTSRegistrationRPT,
BBRegisterRPT,
... | poldracklab/niworkflows | niworkflows/tests/test_registration.py | Python | bsd-3-clause | 7,017 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import six
import argparse
from . import Command
from .run import Run
from .compare import Compare
from ..rep... | spacetelescope/asv | asv/commands/continuous.py | Python | bsd-3-clause | 7,132 |
# -*- coding: utf-8 -*-
"""
{{ project_name }}.libs.common.models
~~~~~~~~~~~~~~~~~~~~~~~~~
This module contains all models that can be used across apps
:copyright: (c) 2015
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .utils.text import slugify
clas... | ericbuckley/django-project-template | project_name/libs/common/models.py | Python | bsd-3-clause | 2,547 |
from impedance_map.sphere import correlation_coefficient, form_factor, \
pair_distribution_function_PY, structure_factor_function_PY, \
cross_section_dimension, fit_correlation_coefficient_nls, \
fit_form_factor_nls
import numpy as np
import math
import unittest
class TestCode(unittest.TestCase):
def ... | aluchies/impedance_map | impedance_map/tests/test_sphere.py | Python | bsd-3-clause | 6,422 |
#! /usr/bin/python
#
# Copyright (C) 2012,2014 Stefano Sanfilippo.
# See LICENSE.txt in the main source package for more information
#
from __future__ import with_statement
import sys
# Ugly ugly trick to give us compatibility both with Py2 and Py3k
try:
import cStringIO as StringIO
except ImportError:
try:
... | esseks/nscript | scripts/fixnss.py | Python | bsd-3-clause | 1,822 |
# -*- coding: utf-8 -*-
from ._compat import unittest
from ._adapt import DEFAULT_URI, drop, IS_MSSQL, IS_IMAP, IS_GAE, IS_TERADATA, IS_ORACLE
from pydal import DAL, Field
from pydal._compat import PY2
@unittest.skipIf(IS_IMAP, "Reference not Null unsupported on IMAP")
@unittest.skipIf(IS_ORACLE, "Reference Not Null... | willimoa/pydal | tests/base.py | Python | bsd-3-clause | 7,487 |
from __future__ import absolute_import, unicode_literals
from .premailer import Premailer, transform
__version__ = '2.9.4'
| industrydive/premailer | premailer/__init__.py | Python | bsd-3-clause | 124 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.broccoli.preprocess import MotionCorrection
def test_MotionCorrection_inputs():
input_map = dict(args=dict(argstr='%s',
),
device=dict(argstr='-device %d',
),
environ=dict(nohash=Tru... | wanderine/nipype | nipype/interfaces/broccoli/tests/test_auto_MotionCorrection.py | Python | bsd-3-clause | 1,430 |
# -*- coding: utf-8 -*-
from .subject import Subject
class Music(Subject):
target = 'music'
def __repr__(self):
return '<DoubanAPI Music>'
| xlk521/cloudguantou | douban_client/api/music.py | Python | bsd-3-clause | 160 |
#!/usr/bin/env python
#
# Copyright 2021 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Delete files from the temporary directory on a Swarming bot."""
import os
import sys
if sys.platform == 'win32':
os.system(r'forfiles /P c:\users\chro... | google/skia-buildbot | scripts/run_on_swarming_bots/delete_tmp_dirs.py | Python | bsd-3-clause | 562 |
"""
soupselect.py - https://code.google.com/p/soupselect/
CSS selector support for BeautifulSoup.
soup = BeautifulSoup('<html>...')
select(soup, 'div')
- returns a list of div elements
select(soup, 'div#main ul a')
- returns a list of links inside a ul inside div#main
"""
import re
from bs4 import BeautifulSoup
t... | devilry/devilry-django | devilry/project/develop/testhelpers/soupselect.py | Python | bsd-3-clause | 5,265 |
def extractEmergencyExitsReleaseBlog(item):
"""
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
| fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractEmergencyExitsReleaseBlog.py | Python | bsd-3-clause | 226 |
import pytest
import textwrap
import ctypes
import os
import windows
import windows.debug
import windows.generated_def as gdef
import windows.native_exec.simple_x86 as x86
import windows.native_exec.simple_x64 as x64
from .conftest import generate_pop_and_exit_fixtures, pop_proc_32, pop_proc_64
from .pfwtest import *... | hakril/PythonForWindows | tests/test_debugger.py | Python | bsd-3-clause | 25,193 |
from collections import defaultdict
from django.conf import settings
from mongodbforms.documentoptions import DocumentMetaWrapper, LazyDocumentMetaWrapper
from mongodbforms.fieldgenerator import MongoDefaultFormFieldGenerator
try:
from django.utils.module_loading import import_by_path
except ImportError:
# t... | fmoro/django-mongodbforms | mongodbforms/util.py | Python | bsd-3-clause | 4,265 |
from __future__ import absolute_import
import logging
import re
from django.core.urlresolvers import RegexURLResolver, RegexURLPattern
from django.conf.urls import patterns, include, url
from sentry.plugins import plugins
logger = logging.getLogger("sentry.plugins")
def ensure_url(u):
if isinstance(u, (tuple,... | mvaled/sentry | src/sentry/plugins/base/group_api_urls.py | Python | bsd-3-clause | 1,093 |
from twisted.application.service import Application
from twisted.application.internet import TimerService, TCPServer
from twisted.web import server
from twisted.python import log
from scrapy.utils.misc import load_object
from .interfaces import IEggStorage, IPoller, ISpiderScheduler, IEnvironment
from .launcher impor... | mouadino/scrapy | scrapyd/app.py | Python | bsd-3-clause | 1,522 |
import decimal
import os
from contextlib import contextmanager
from django.test import TestCase
from django.core.exceptions import ImproperlyConfigured
from mock import patch
from configurations.values import (Value, BooleanValue, IntegerValue,
FloatValue, DecimalValue, ListValue,
... | luzfcb/django-configurations | tests/test_values.py | Python | bsd-3-clause | 12,772 |
#!/usr/bin/python
# Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, 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:
# 1. Redistributions of source code must retain the above copyright n... | gaberger/pybvc | samples/sampleopenflow/demos/demo8.py | Python | bsd-3-clause | 7,431 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Simphony-remote documentation build configuration file, created by
# sphinx-quickstart on Tue Jun 7 14:01:45 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in t... | simphony/tornado-webapi | doc/source/conf.py | Python | bsd-3-clause | 12,106 |
try:
from ttag.args import Arg, BasicArg, BooleanArg, ConstantArg, DateArg, \
DateTimeArg, IntegerArg, IsInstanceArg, KeywordsArg, \
ModelInstanceArg, StringArg, TimeArg, MultiArg
from ttag.core import Tag
from ttag.exceptions import TagArgumentMissing, TagValidationError
from ttag impor... | lincolnloop/django-ttag | ttag/__init__.py | Python | bsd-3-clause | 840 |
from django.core.cache import cache
def pytest_runtest_setup(item):
# Clear the cache before every test
cache.clear()
| mozilla/standup | standup/status/tests/conftest.py | Python | bsd-3-clause | 128 |
from django import template
from django.template.base import Node, Template, TemplateSyntaxError
from django.conf import settings
register = template.Library()
class PlugItIncludeNode(Node):
def __init__(self, action):
self.action = action
def render(self, context):
action = self.action.reso... | ebu/PlugIt | plugit_proxy/templatetags/plugit_tags.py | Python | bsd-3-clause | 2,347 |
"""The WaveBlocks Project
Compute some observables like norm, kinetic and potential energy
of Hagedorn wavepackets. This class implements the mixed case
where the bra does not equal the ket.
@author: R. Bourquin
@copyright: Copyright (C) 2014, 2016 R. Bourquin
@license: Modified BSD License
"""
from functools import... | WaveBlocks/WaveBlocksND | WaveBlocksND/ObservablesMixedHAWP.py | Python | bsd-3-clause | 13,370 |
import os, sys
sys.path.insert(0, os.path.join("..",".."))
from nodebox.graphics import *
from nodebox.gui.controls import *
# Comparison between Rows and Row containers.
# Both are subclasses of Layout.
# Panel 1
# Controls in a Rows layout are drawn below each other.
# Rows.width defines the width of all controls... | pepsipepsi/nodebox_opengl_python3 | examples/10-gui/05-layout.py | Python | bsd-3-clause | 3,183 |
from __future__ import absolute_import
from datetime import timedelta
from django.utils import timezone
from rest_framework.response import Response
from sentry.api.base import Endpoint
from sentry.api.permissions import assert_perm
from sentry.api.serializers import serialize
from sentry.models import Group, GroupSt... | camilonova/sentry | src/sentry/api/endpoints/team_groups_new.py | Python | bsd-3-clause | 1,628 |
"""
Checking for connected components in a graph.
"""
__author__ = "Sergio J. Rey <srey@asu.edu>"
__all__ = ["check_contiguity"]
from operator import lt
def is_component(w, ids):
"""Check if the set of ids form a single connected component
Parameters
----------
w : spatial weights boject
id... | lixun910/pysal | pysal/explore/giddy/components.py | Python | bsd-3-clause | 4,697 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "devault.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| opportunitynetwork/devault | devault/manage.py | Python | bsd-3-clause | 250 |
"""A collection of classes and methods to deal with collections of
rates that together make up a network."""
# Common Imports
import warnings
import functools
import math
import os
from operator import mul
from collections import OrderedDict
from ipywidgets import interact
import numpy as np
import matplotlib as mp... | pyreaclib/pyreaclib | pynucastro/networks/rate_collection.py | Python | bsd-3-clause | 34,049 |
# proxy module
from __future__ import absolute_import
from mayavi.filters.api import *
| enthought/etsproxy | enthought/mayavi/filters/api.py | Python | bsd-3-clause | 87 |
# -*- coding: utf-8 -*-
"""
Version code adopted from Django development version.
https://github.com/django/django
"""
VERSION = (0, 7, 2, 'final', 0)
def get_version(version=None):
"""
Returns a PEP 386-compliant version number from VERSION.
"""
if version is None:
from modeltranslation impor... | yaroslavprogrammer/django-modeltranslation | modeltranslation/__init__.py | Python | bsd-3-clause | 2,020 |
import os
from pkg_resources import resource_filename
__all__ = [
'get_filepath',
]
def get_filepath(name='sherpa_wz.hepmc'):
return resource_filename('deepjets', os.path.join('testdata', name))
| deepjets/deepjets | deepjets/testdata/__init__.py | Python | bsd-3-clause | 207 |
from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponsePermanentRedirect
from django.middleware.locale import LocaleMiddleware
from django.template import Context, Template
from django.test... | yephper/django | tests/i18n/patterns/tests.py | Python | bsd-3-clause | 15,353 |
"""
This module contain solvers for all kinds of equations,
algebraic or transcendental.
"""
import warnings
from collections import defaultdict
from types import GeneratorType
from ..core import (Add, Dummy, E, Equality, Expr, Float, Function, Ge, I,
Integer, Lambda, Mul, Symbol, expand_log, expa... | skirpichev/omg | diofant/solvers/solvers.py | Python | bsd-3-clause | 50,763 |
# -*- coding: utf-8 -*-
"""
channel.py
:copyright: (c) 2015 by Fulfil.IO Inc.
:license: see LICENSE for more details.
"""
from trytond.pool import PoolMeta
from trytond.model import fields
__all__ = ['Channel']
__metaclass__ = PoolMeta
def submit_to_google(url, data):
import requests
import json... | prakashpp/trytond-google-merchant | channel.py | Python | bsd-3-clause | 797 |
# -*- coding: utf-8 -*-
"""
DBSCAN: Density-Based Spatial Clustering of Applications with Noise
"""
# Author: Robert Layton <robertlayton@gmail.com>
#
# License: BSD
import warnings
import numpy as np
from ..base import BaseEstimator
from ..metrics import pairwise_distances
from ..utils import check_random_state
d... | sgenoud/scikit-learn | sklearn/cluster/dbscan_.py | Python | bsd-3-clause | 7,355 |
#
# Module to allow connection and socket objects to be transferred
# between processes
#
# multiprocessing/reduction.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
from __future__ import absolute_import
__all__ = []
import os
import sys
import socket
import threading
f... | mozilla/firefox-flicks | vendor-local/lib/python/billiard/reduction.py | Python | bsd-3-clause | 5,061 |
# -*- coding: utf-8 -*-
#_____________________________________________________________________________
#
# This file is part of txrecaptcha, a Twisted reCAPTCHA client.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# Matthew Finkel 0x017DD169EA793BE2 <sysrqb@torproject.org>
# :copyri... | isislovecruft/txrecaptcha | test/test_resources.py | Python | bsd-3-clause | 9,079 |
# Copyright (c) 2014-2016, Clemson University
# 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 conditio... | ClemsonSoCUnix/django-sshkey | django_sshkey/models.py | Python | bsd-3-clause | 5,547 |
from catkin_pkg.python_setup import generate_distutils_setup
from setuptools import setup
d = generate_distutils_setup(
packages=['catkin'],
package_dir={'': 'python'},
scripts=[
'bin/catkin_find',
'bin/catkin_init_workspace',
'bin/catkin_make',
'bin/catkin_make_isolated',
... | ros/catkin | setup.py | Python | bsd-3-clause | 416 |
'''
Authentication by token for the serverland dashboard Web API.
Project: MT Server Land prototype code
Author: Will Roberts <William.Roberts@dfki.de>
'''
from piston.utils import rc, translate_mime, MimerDataException
from serverland.dashboard.api.models import AuthToken
from django.core.exceptions import Multiple... | NickRuiz/mt-serverland | dashboard/api/authentication.py | Python | bsd-3-clause | 1,948 |
class MailgunException(Exception):
pass
| gnrfan/django-mailgun-validation | mailgun_validation/exceptions.py | Python | bsd-3-clause | 44 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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
# l... | stormi/tsunami | src/primaires/objet/commandes/oedit/__init__.py | Python | bsd-3-clause | 3,339 |
#!/usr/bin/env python2
import os, sygnal, sys
import argparse
import math
| cuauv/software | cave/mainForCommandline.py | Python | bsd-3-clause | 75 |
from django.conf.urls import url
import logging
logger = logging.getLogger(__name__)
from argo import views
local_urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^filter/$',views.filter,name='filter'),
url(r'^job_display/(?P<job_num>\w+)/$',views.job_display,name='job_display'),
]
urlpat... | hep-cce/hpc-edge-service | argo/urls.py | Python | bsd-3-clause | 349 |
from __future__ import absolute_import, unicode_literals
from django.db.models.lookups import Lookup
from django.db.models.query import QuerySet
from django.db.models.sql.where import SubqueryConstraint, WhereNode
from django.utils.six import text_type
class FilterError(Exception):
pass
class FieldError(Excep... | car3oon/saleor | saleor/search/backends/base.py | Python | bsd-3-clause | 8,616 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | bokeh/core/property/json.py | Python | bsd-3-clause | 2,991 |
# -*- encoding: utf-8 -*-
from imaplib import ParseFlags
# mockimaplib: A very simple mock server module for imap client APIs
# Copyright (C) 2014 Alan Etkin <spametki@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Li... | web2py/pydal | pydal/contrib/mockimaplib.py | Python | bsd-3-clause | 10,686 |
import re
from .. import irc, var, ini
from ..tools import is_identified
# Require identification with NickServ to send messages.
def ident (f):
def check (user, channel, word):
if is_identified(user):
f(user, channel, word)
else:
irc.msg(channel, "{}: Identify with NickServ first.".format(user))
return c... | skewerr/deskbot | modules/commands/tell.py | Python | bsd-3-clause | 4,602 |
from __future__ import absolute_import, unicode_literals
from celery.bin import celery
from djcelery.app import app
from djcelery.management.base import CeleryCommand
base = celery.CeleryCommand(app=app)
class Command(CeleryCommand):
"""The celery command."""
help = 'celery commands, see celery help'
r... | alexhayes/django-celery | djcelery/management/commands/celery.py | Python | bsd-3-clause | 643 |
from __future__ import absolute_import, unicode_literals
import datetime
import pytz
import six
ISO8601_DATE_FORMAT = '%Y-%m-%d'
ISO8601_DATETIME_FORMAT = ISO8601_DATE_FORMAT + 'T' + '%H:%M:%S'
def parse_iso8601(value):
"""
Parses a datetime as a UTC ISO8601 date
"""
if not value:
return No... | caktus/rapidpro-python | temba_client/utils.py | Python | bsd-3-clause | 935 |
#! /usr/bin/env python3
import getopt
import os
import os.path
import re
import socket
import subprocess
import sys
import threading
import time
import tokenize
import traceback
import types
import linecache
from code import InteractiveInterpreter
try:
from tkinter import *
except ImportError:
print("** IDLE... | wdv4758h/ZipPy | lib-python/3/idlelib/PyShell.py | Python | bsd-3-clause | 52,145 |
# coding=utf-8
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
from unittest import TestCase
from mock import Mock, patch
from qrl.core.misc import logger
from qrl.core.processors.TxnProcessor import TxnProcessor
from qrl.core.Cha... | cyyber/QRL | tests/core/processors/test_TxnProcessor.py | Python | mit | 6,292 |
import json
import sys
data = json.load(sys.stdin)
for e in data.itervalues():
if e['senses'] and e['senses'][0]['definition']:
print u"{0}\t{1}".format(
e['hw'], e['senses'][0]['definition']['sen']).encode('utf-8')
| Eszti/4lang | scripts/get_defs.py | Python | mit | 241 |
from numbers import Integral, Real
from itertools import chain
import string
import numpy as np
import openmc.checkvalue as cv
import openmc.data
# Supported keywords for continuous-energy cross section plotting
PLOT_TYPES = ['total', 'scatter', 'elastic', 'inelastic', 'fission',
'absorption', 'capture... | johnnyliu27/openmc | openmc/plotter.py | Python | mit | 38,526 |
#Library avaiable here: https://github.com/FND/markdown-checklist
import re
from markdown.extensions import Extension
from markdown.preprocessors import Preprocessor
from markdown.postprocessors import Postprocessor
def makeExtension(configs=[]):
return ChecklistExtension(configs=configs)
class ChecklistExten... | byohay/Remarkable | markdown/extensions/markdown_checklist.py | Python | mit | 1,078 |
# Copyright (c) 2013 eBay Inc.
# Copyright (c) OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | sjsucohort6/openstack | python/venv/lib/python2.7/site-packages/cinderclient/v2/qos_specs.py | Python | mit | 4,789 |
#!/usr/bin/env python
#
# Raman off-resonant activity calculator
# using VASP as a back-end.
#
# Contributors: Alexandr Fonari (Georgia Tech)
# Shannon Stauffer (UT Austin)
#
# MIT license, 2013
#
def parse_poscar_header(inp_fh):
import sys
from math import sqrt
#
inp_fh.seek(0) # just in... | alexandr-fonari/raman-sc | VASP/vasp_raman.py | Python | mit | 11,443 |
def load_text_file(text_file: str) -> str:
with open(text_file, 'r') as f:
return f.read()
| kyuridenamida/atcoder-tools | atcodertools/fileutils/load_text_file.py | Python | mit | 103 |
"""
WSGI config for bangkok 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETT... | zkan/microservices-with-swarm-101 | services/front_gateway/front_gateway/wsgi.py | Python | mit | 392 |
from struct import pack, unpack
from time import time
from communication.ComAPI.packet import Packet
class PacketLogin(Packet):
"""Class for constructing binary data based
on a common API between client / server."""
def __init__(self):
super().__init__()
self.packetID = 3
def encode(self, username, avatar... | DanAurea/Trisdanvalwen | communication/ComAPI/packetLogin.py | Python | mit | 1,024 |
import hashlib
import requests
import threading
import json
import sys
import traceback
import base64
import electrum_vtc as electrum
from electrum_vtc.plugins import BasePlugin, hook
from electrum_vtc.i18n import _
class LabelsPlugin(BasePlugin):
def __init__(self, parent, config, name):
BasePlugin.... | pknight007/electrum-vtc | plugins/labels/labels.py | Python | mit | 5,710 |
#!/usr/bin/env python2.7
from argparse import ArgumentParser
parser = ArgumentParser()
args = parser.parse_args()
from sys import exit
from subtlenet.models import cluster as train
import numpy as np
from subtlenet.utils import mpl, plt
from mpl_toolkits.mplot3d import Axes3D
train.NEPOCH = 10
train.encoded_size=2
... | sidnarayanan/BAdNet | train/cluster/simple/run.py | Python | mit | 2,825 |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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... | e1ven/Waymoot | libs/tornado-2.2/build/lib/tornado/curl_httpclient.py | Python | mit | 18,106 |
#!/usr/bin/env python2
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 2 -*-
# Author: Fábio André Damas <skkeeper at gmail dot com>
from threading import Thread
from subprocess import Popen, PIPE
class PlaySound(Thread):
def __init__(self, filename, volume):
Thread.__init__(self)
self... | skkeeper/linux-clicky | linux_clicky/play_sound.py | Python | mit | 691 |
#!/usr/bin/env python
"""SciPy: Scientific Library for Python
SciPy (pronounced "Sigh Pie") is open-source software for mathematics,
science, and engineering. The SciPy library
depends on NumPy, which provides convenient and fast N-dimensional
array manipulation. The SciPy library is built to work with NumPy
arrays, a... | largelymfs/w2vtools | build/scipy/setup.py | Python | mit | 7,514 |
from django.conf.urls import patterns, include, url
import views
urlpatterns = patterns('',
url(r'^$', views.TopicModelIndexView.as_view(), name='topics_models'),
url(r'^model/(?P<model_id>\d+)/$', views.TopicModelDetailView.as_view(), name='topics_model'),
url(r'^model/(?P<model_id>\d+)/topic/(?P<topic_i... | hds-lab/textvisdrg-prototype | textvis/topics/urls.py | Python | mit | 545 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Related to AboutOpenClasses in the Ruby Koans
#
from runner.koan import *
class AboutMonkeyPatching(Koan):
class Dog:
def bark(self):
return "WOOF"
def test_as_defined_dogs_do_bark(self):
fido = self.Dog()
self.assertEqual... | gregkorte/Python-Koans | python3/koans/about_monkey_patching.py | Python | mit | 1,426 |
import os, glob, shutil
from pathos import multiprocessing as mp
import pandas as pd
import numpy as np
base_path = '/Data/malindgren/cru_november_final/IEM/ar5'
output_base_path = '/Data/malindgren/cru_november_final/IEM/ar5'
models = [ 'IPSL-CM5A-LR', 'GISS-E2-R', 'MRI-CGCM3', 'CCSM4', 'GFDL-CM3' ]
# variables = [... | ua-snap/downscale | old/old_bin/sort_files_by_rcp.py | Python | mit | 1,564 |
"""
Color definitions are used as per CSS3 specification:
http://www.w3.org/TR/css3-color/#svg-color
A few colors have multiple names referring to the sames colors, eg. `grey` and `gray` or `aqua` and `cyan`.
In these cases the LAST color when sorted alphabetically takes preferences,
eg. Color((0, 255, 255)).as_name... | samuelcolvin/pydantic | pydantic/color.py | Python | mit | 16,607 |
#!/usr/bin/python2
import os, glob
os.chdir( '/workspace/Shared/Tech_Projects/ALFRESCO_Inputs/project_data/CODE/tem_ar5_inputs' )
base_dir = '/workspace/Shared/Tech_Projects/ESGF_Data_Access/project_data/data/prepped'
output_base_dir = '/workspace/Shared/Tech_Projects/ALFRESCO_Inputs/project_data/TEM_Data/downscaled'... | ua-snap/downscale | old/old_bin/downscaling_launcher.py | Python | mit | 3,849 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-25 18:48
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | Astroxslurg/interlecture | interlecture/interauth/migrations/0001_initial.py | Python | mit | 905 |
# Copyright (C) 2011 by Mark Visser <mjmvisser@gmail.com>
#
# 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... | mjmvisser/adl3 | adl3/adl_defines.py | Python | mit | 39,284 |
#### 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 = Creature()
result.template = "object/mobile/shared_space_rebel_tier3_ezkiel.iff"
result.attribute_template_id = 9... | obi-two/Rebelion | data/scripts/templates/object/mobile/shared_space_rebel_tier3_ezkiel.py | Python | mit | 452 |
import ConfigParser
import StringIO
from test_support import TestFailed, verify
def basic(src):
print "Testing basic accessors..."
cf = ConfigParser.ConfigParser()
sio = StringIO.StringIO(src)
cf.readfp(sio)
L = cf.sections()
L.sort()
verify(L == [r'Commented Bar',
r'Foo ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.2/Lib/test/test_cfgparser.py | Python | mit | 7,274 |
#### 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 = Intangible()
result.template = "object/draft_schematic/space/chassis/shared_hutt_medium_s02.iff"
result.attribute... | obi-two/Rebelion | data/scripts/templates/object/draft_schematic/space/chassis/shared_hutt_medium_s02.py | Python | mit | 458 |
#The new version is in polishNotation2.py. Use that version instead of using this version.
#To do:
#Find out how to split a string using matches of a regular expression as the separator.
#Test everything in polyglotCodeGenerator.py
#Use re.match(expr, stringToSplit).groups() to split a string with its paramet... | jarble/EngScript | libraries/polishNotation.py | Python | mit | 14,320 |
from __future__ import unicode_literals, division, absolute_import
import copy
import datetime
from math import ceil
from flask import jsonify
from flask import request
from flask_restplus import inputs
from sqlalchemy.orm.exc import NoResultFound
from flexget.api import api, APIResource, ApiClient
from flexget.even... | antivirtel/Flexget | flexget/plugins/api/series.py | Python | mit | 36,378 |
"""A few convenience functions to setup the Ising model in a TF.
TFIM stands for Ising model in a transverse field, i.e.:
.. math::
H=\sum_{i}\left[S^{z}_{i}S^{z}_{i+1} + h S^{x}_{i}\right)\right]
"""
class TranverseFieldIsingModel(object):
"""Implements a few convenience functions for the TFIM.
Does... | chanul13/hubbard_dimer | dmrg101/utils/models/tfi_model.py | Python | mit | 2,957 |
from __future__ import print_function
import getpass
import logging
import os
import os.path as op
from ssbio.protein.sequence.utils import fasta as fasta
log = logging.getLogger(__name__)
class ITASSERPrep():
"""Prepare a protein sequence for an I-TASSER homology modeling run.
The main utilities of this ... | SBRG/ssbio | ssbio/protein/structure/homology/itasser/itasserprep.py | Python | mit | 10,329 |
import pytest
from CyberArkPAS import Client, add_user_command, get_users_command, \
update_user_command, add_safe_command, update_safe_command, get_list_safes_command, get_safe_by_name_command, \
add_safe_member_command, update_safe_member_command, list_safe_members_command, add_account_command, \
update_... | VirusTotal/content | Packs/CyberArkPAS/Integrations/CyberArkPAS/CyberArkPAS_test.py | Python | mit | 9,611 |
r"""
Examples
--------
::
* - *
/ \ / \
* - * - *
/ \ / \ / \
* - * - * - *
\ / \ / \ /
* - * - *
\ / \ /
* - *
>>> from landlab.graph import TriGraph
>>> graph = TriGraph((5, 2), node_layout="hex", sort=True)
>>> graph.number_of_nodes
14
>>> graph.x_of_node
ar... | cmshobe/landlab | landlab/graph/hex/hex.py | Python | mit | 27,221 |
# -*- 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 'Package'
db.create_table('banzai_package', (
('id', self.gf('django.db.models.fi... | Tapo4ek/django-banzai | banzai/migrations/0001_initial.py | Python | mit | 4,368 |
# Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets
# in the array which gives the sum of zero.
#
# Note: The solution set must not contain duplicate triplets.
#
# For example, given array S = [-1, 0, 1, 2, -1, -4],
#
# A solution set is:
# [
# [-1, 0, 1... | jigarkb/CTCI | LeetCode/015-M-3Sum.py | Python | mit | 1,646 |
#### 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/tatooine/shared_housing_tatt_style02_large.iff"
result.attribute_te... | anhstudios/swganh | data/scripts/templates/object/building/tatooine/shared_housing_tatt_style02_large.py | Python | mit | 479 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('connectors', '0002_parameter_description'),
]
operations = [
migrations.RenameField(
model_name='callback',
... | rebearteta/social-ideation | connectors/migrations/0003_auto_20150423_1545.py | Python | mit | 393 |
from vint.ast.traversing import traverse, register_traverser_extension
from vint.ast.parsing import Parser
from vint.ast.node_type import NodeType
REDIR_CONTENT = 'VINT:redir_content'
class RedirAssignmentParser(object):
""" A class to make redir assignment parseable. """
def process(self, ast):
... | Kuniwak/vint | vint/ast/plugin/scope_plugin/redir_assignment_parser.py | Python | mit | 1,250 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-monitor/azure/mgmt/monitor/models/autoscale_setting_resource_paged.py | Python | mit | 1,000 |
# Copyright (c) 2011 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.
"""Collection of functions and classes to fix various encoding problems on
multiple platforms with python.
"""
import codecs
import locale
import os
imp... | PowerKiKi/mqueue | library/searchengine/nova/fix_encoding.py | Python | mit | 11,785 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# 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... | JScott/ansible-taiga | templates/opt/taiga/back/settings/local.py | Python | mit | 1,982 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('imagr_app', '0002_auto_20141106_1538'),
]
operations = [
migrations.AlterField(
model_name='album',
... | CharlesGust/django-imagr | imagr_site/imagr_app/migrations/0003_auto_20141114_1441.py | Python | mit | 1,007 |
""" simple cache based on shelve
"""
import shelve
import time
def load_cache(cache_file):
cache = shelve.open(cache_file)
return cache
def read_key(cache, key, ttl):
""" Reads value from cache, if doesnt exist or is older than ttl, raises KeyError
"""
bibtex, timestamp = cache[key]
if (ti... | ryanvarley/adsbibtex | adsbibtex/adsbibtex_cache.py | Python | mit | 505 |
# -*- coding: utf-8 -*-
import platform
import os
import sys
from .constants import (MYSTEM_BIN, MYSTEM_EXE, MYSTEM_DIR)
_TARBALL_URLS = {
'linux': {
'32bit': "http://download.cdn.yandex.net/mystem/mystem-3.0-linux3.5-32bit.tar.gz",
'64bit': "http://download.cdn.yandex.net/mystem/mystem-3.0-linux3... | hatbot-team/hatbot_resources | preparation/lang_utils/pymystem/installer.py | Python | mit | 2,655 |
"""This file is useful only if 'salesforce' is a duplicit name in Django registry
then put a string 'salesforce.apps.SalesforceDb' instead of simple 'salesforce'
"""
from django.apps import AppConfig
class SalesforceDb(AppConfig):
name = 'salesforce'
label = 'salesforce_db'
| django-salesforce/django-salesforce | salesforce/apps.py | Python | mit | 286 |
# argv[1] - file path to main folder (like $HOME/dsge-models)
# argv[2] - name of model (e.g. 'dsf' or 'nk' or 'ca')
from scipy.io import loadmat
from sys import argv
from json import load
TT = 30 # how many periods of results to send
model = argv[2]
fpath = argv[1] + '/' + model + '_mfiles/'
jso... | wclark3/dsge-models | dsf_mfiles/save_results.py | Python | mit | 1,975 |
#### 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/deed/corellia/player_house_deed/shared_corellia_house_large_deed.iff... | obi-two/Rebelion | data/scripts/templates/object/tangible/deed/corellia/player_house_deed/shared_corellia_house_large_deed.py | Python | mit | 490 |
import os, sys
import tempfile
import unittest as unittest0
try:
unittest0.skipUnless
unittest0.skip
except AttributeError:
import unittest2 as unittest
else:
unittest = unittest0
del unittest0
import win32file
from winsys import fs
class TestDrive (unittest.TestCase):
#
# The name of the drive should b... | frankyrumple/ope | laptop_credential/winsys/tests/test_fs/test_drive.py | Python | mit | 1,460 |
"""
Experimental agent implementation running separate threads for emulation and GPU training.
This is slightly (estimate ~20%) faster than the sequential implementation, but results might be different.
Copyright 2016 Rasmus Larsen
This software may be modified and distributed under the terms
of the MIT license. See ... | rlrs/deep-rl | dqn/ParallelAgent.py | Python | mit | 2,448 |
n = int(raw_input('Ingrese n: '))
es_primo = True
d = 2
while d < n:
if n % d == 0:
es_primo = False
d = d + 1
if es_primo:
print(n, 'es primo')
else:
print(n, 'es compuesto')
| sebastiandres/iwi131 | ipynb/06-Funciones/iwi131_code/es_primo_v1.py | Python | cc0-1.0 | 200 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.models.building_location_choice_model import BuildingLocationChoiceModel as UrbansimBuildingLocationChoiceModel
from numpy import where, arange, zeros
from numpy import logical_or, ... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim_parcel/models/building_location_choice_model.py | Python | gpl-2.0 | 5,528 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-29 13:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("issuetracker", "0004_data_migration_set_bugzilla_to_allow_add_case_to_issue"),
]
operations = [
migrations.RemoveFi... | Nitrate/Nitrate | src/tcms/issuetracker/migrations/0005_adjust_issue_report_fields.py | Python | gpl-2.0 | 1,490 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.