repo_name stringlengths 5 104 | path stringlengths 4 248 | content stringlengths 102 99.9k |
|---|---|---|
getconnect/connect-python | tests/test_api.py | # -*- coding: utf-8 -*-
import json
from mock import patch
from collections import defaultdict
from requests import Session
from connect.api import ConnectApi
from connect.event import Event
from connect import responses
PROJECT_ID = "MY_PROJECT_ID"
API_PUSH_KEY = "MY_PUSH_API_KEY"
BASE_URL = "https://api.getconnect.... |
toumorokoshi/transmute-core | transmute_core/tests/contenttype_serializers/test_default_serializer_set.py | import pytest
from transmute_core import NoSerializerFound, SerializationException
def test_default_serializer_json(serializer_set):
frm, expected_to = {"foo": "bar"}, b'{"foo": "bar"}'
serializer = serializer_set["application/json"]
assert serializer.dump(frm) == expected_to
assert serializer.load(ex... |
compops/gpo-abc2015 | state/smc_resampling.py | ##############################################################################
##############################################################################
# Routines for
# Resampling
#
# Copyright (c) 2016 Johan Dahlin
# liu (at) johandahlin.com
#
#####################################################################... |
bovee/planknn | scripts/check_nn.py | ## this may crash due to memory demands (training too many features at once)
#from pyplanknn.network import Network
#from pyplanknn.submit import check_model
#
#check_model(Network)
import random
import numpy as np
from sklearn.metrics import classification_report
from pyplanknn.preprocess import read_train, read_meta... |
Spiderlover/Toontown | toontown/hood/DLHood.py | from toontown.safezone.DLSafeZoneLoader import DLSafeZoneLoader
from toontown.town.DLTownLoader import DLTownLoader
from toontown.toonbase import ToontownGlobals
from toontown.hood.ToonHood import ToonHood
class DLHood(ToonHood):
notify = directNotify.newCategory('DLHood')
ID = ToontownGlobals.DonaldsDreamla... |
e-koch/TurbuStat | turbustat/io/try_load_beamwidth.py | # Licensed under an MIT open source license - see LICENSE
from __future__ import print_function, absolute_import, division
try:
from radio_beam import Beam
RADIO_BEAM_INSTALL = True
except ImportError:
RADIO_BEAM_INSTALL = False
from astropy.io import fits
from astropy import units as u
from warnings impo... |
maraujop/django-crispy-forms | crispy_forms/templatetags/crispy_forms_utils.py | import re
from django import template
from django.utils.encoding import force_str
from django.utils.functional import keep_lazy
register = template.Library()
@keep_lazy(str)
def remove_spaces(value):
html = re.sub(r">\s{3,}<", "> <", force_str(value))
return re.sub(r"/><", r"/> <", force_str(html))
class ... |
jkonecki/autorest | AutoRest/Generators/Python/Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/resource_collection.py | # 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 ... |
nalabelle/druid-django | frontend/views.py | from django.shortcuts import render, get_object_or_404
from django.views import generic
from django.http import HttpResponse, HttpResponseRedirect
from django.template import loader
from rest_framework import reverse
from druidapi.query.models import QueryModel
from models import Result
from forms import SearchForm
imp... |
MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.2/Lib/test/string_tests.py | """
Common tests shared by test_str, test_unicode, test_userstring and test_string.
"""
import unittest, string, sys, struct
from test import support
from collections import UserList
class Sequence:
def __init__(self, seq='wxyz'): self.seq = seq
def __len__(self): return len(self.seq)
def __getitem__(self... |
theboocock/plinkseq_utilities | pseq_util/phenotypes_snpmax.py | """
Parses Phenotype Data from SNPMAX and places the data in a format for use
in plink/seq.
Format looks something like the one shown below.
PATIENT<TAB>PHENO1<TAB>PHENO2<TAB>
1<TAB>1<TAB>RED
2<TAB>0<TAB>BLUE
"""
from phenotype import Phenotype
import argparse
import tempfile
sample_list... |
brave/muon | script/bump-version.py | #!/usr/bin/env python
import os
import re
import sys
from lib.config import SOURCE_ROOT, get_electron_version, get_chrome_version
from lib.util import execute, parse_version, scoped_cwd
def main():
if len(sys.argv) != 2 or sys.argv[1] == '-h':
print 'Usage: bump-version.py [<version> | major | minor | patch]'... |
flavour/eden | controllers/msg.py | # -*- coding: utf-8 -*-
"""
Messaging Module - Controllers
"""
if not settings.has_module(c):
raise HTTP(404, body="Module disabled: %s" % c)
# -----------------------------------------------------------------------------
def index():
""" Module's Home Page """
module_name = settings.modules[c].get(... |
watchdogpolska/django-mptt | mptt/fields.py | """
Model fields for working with trees.
"""
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from mptt.forms import TreeNodeChoiceField, TreeNodeMultipleChoiceField
__all__ = ('TreeForeignKey', 'TreeOneToOneField', 'TreeManyToManyField')
class TreeForeignKey(mo... |
basu96/crux-judge | src/server/contest/migrations/0003_profile.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-12-25 23:46
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):
dependencies = [
migrations.swappable_depende... |
tijme/angularjs-sandbox-escape-scanner | acstis/Scanner.py | # -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2017 Tijme Gommers
#
# 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... |
toumorokoshi/transmute-core | transmute_core/tests/frameworks/test_aiohttp/test_full.py | import pytest
import json
@pytest.mark.asyncio
async def test_content_type_in_response(cli):
"""the content type should be specified in the response."""
resp = await cli.get("/optional")
assert 200 == resp.status
assert resp.headers["Content-Type"] == "application/json"
@pytest.mark.asyncio
async de... |
jhroot/elife-bot | provider/glencoe_check.py | import sys, json
import requests
import re
from functional import seq
'''
glencoe_resp = {
"media1": {
"source_href": "https://static-movie-usa.glencoesoftware.com/source/10.7554/659/0f10378e095dde7aaf579af504c4bfdc6fb86550/elife-00569-media1.wmv",
"doi": "10.7554/eLife.00569.019",
"flv_hre... |
AntonSax/plantcv | plantcv/roi_objects.py | # Find Objects Partially Inside Region of Interest or Cut Objects to Region of Interest
import cv2
import numpy as np
from . import print_image
from . import plot_image
from . import fatal_error
def roi_objects(img, roi_type, roi_contour, roi_hierarchy, object_contour, obj_hierarchy, device, debug=None):
"""Find... |
sidecars/python-quickbooks | tests/unit/test_cdc.py | import unittest
try:
from mock import patch
except ImportError:
from unittest.mock import patch
from quickbooks.cdc import change_data_capture
from quickbooks.objects import Invoice, Customer
from quickbooks import QuickBooks
from datetime import datetime
class ChangeDataCaptureTest(unittest.TestCase):
def setUp(s... |
chrhartm/SORN | utils/lstsq_reg.py | import numpy as np
"""
Performs tikhonov regularized least squares
I.e. solution of y = Ax for x
Parameters:
A: NxM ndarray
y: NxK ndarray
mue: double
regularization parameter
Returns:
x: MxK array
"""
def lstsq_reg(A,Y,mue):
Ac = A.copy()
Yc = Y.copy()
result = np.dot(np.dot(np.li... |
okfn/brand-manager | manager/apps/brand/notifications.py | from django.core.mail import send_mail
from django.core.urlresolvers import reverse
class EmailNotification:
msg_from = 'OKFN team <noreply@okfn.org>'
def __init__(self, msg_to, msg_from=None):
self.msg_to = msg_to
if msg_from:
self.msg_from = msg_from
def send_mail(self, su... |
zeyuanxy/leet-code | vol4/number-of-islands/number-of-islands.py | class Solution(object):
def search(self, grid, x, y, s):
if grid[x][y] == '0' or (x, y) in s:
return s
s.add((x, y))
if x - 1 >= 0:
s = self.search(grid, x - 1, y, s)
if x + 1 < len(grid):
s = self.search(grid, x + 1, y, s)
if y - 1 >= 0:
... |
paurosello/frappe | frappe/tests/test_search.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from frappe.desk.search import search_link
class TestSearch(unittest.TestCase):
def test_search_field_sanitizer(self):
# pass
search_link('Doc... |
mchristopher/PokemonGo-DesktopMap | app/pylibs/win32/Cryptodome/SelfTest/Util/test_asn1.py | #
# SelfTest/Util/test_asn.py: Self-test for the Cryptodome.Util.asn1 module
#
# ===================================================================
#
# Copyright (c) 2014, Legrandin <helderijs@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modificat... |
bardia-heydarinejad/Graph | home/views.py | from django.shortcuts import render_to_response,RequestContext
from django.http import HttpResponse,HttpResponseRedirect
from urllib import urlencode
from time import sleep
from vertex.models import *
from django.core.exceptions import ObjectDoesNotExist
from login.views import authDetail
def home(request):
if not a... |
fusionbox/django-extensions | django_extensions/management/commands/validate_templates.py | import os
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.core.management.color import color_style
from django.template.base import add_to_builtins
from django.template.loaders.filesystem import Loader
from django_extensions.utils import validatingtemplatet... |
reedessick/event_supervisor2 | dq/dq.py | description = "a module housing checks of DQ summary page functionality"
author = "reed.essick@ligo.org"
#---------------------------------------------------------------------------------------------------
import eventSupervisor.eventSupervisorUtils as esUtils
#--------------------------------------------------... |
garygriswold/Bible.js | Versions/Release.2.x.x/py/UpdateVideo.py | # This program reads files in data/KOGVideo and loads them into the Video table
# to populate the description column
import io
import os
import sqlite3
db = sqlite3.connect("Versions.db")
cursor = db.cursor()
source = "data/KOGVideo/"
filelist = sorted(os.listdir(source))
for filename in filelist:
if filename[0:4] =... |
fflewddur/python-phash | docs/conf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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
# au... |
fabioz/PyDev.Debugger | tests_python/resources/_bytecode_super.py | class A(object):
def __init__(self):
self.a = 10
class B(A):
def __init__(self):
super().__init__() # break here
assert self.a == 10
def method():
self.b = self.a
method()
assert self.b == 10
if __name__ == '__main__':
B()
print('TEST ... |
smkr/pyclipse | plugins/org.python.pydev.jython/jysrc/assist_regex_based_proposal.py | """Quick Assistant: Regex based proposals.
This module combines AssistProposal, regexes and string formatting to
provide a way of swiftly coding your own custom Quick Assistant proposals.
These proposals are ready for instatiation and registering with
assist_proposal.register_proposal(): AssignToAttributeOfSelf,
As... |
HEPData/hepdata | hepdata/modules/search/webpack.py | #
# This file is part of HEPData.
# Copyright (C) 2016 CERN.
#
# HEPData 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.
#
# HEPData is... |
kudlav/dnf | dnf/cli/completion_helper.py | #!/usr/bin/env python
#
# This file is part of dnf.
#
# Copyright 2015 (C) Igor Gnatenko <i.gnatenko.brain@gmail.com>
#
# 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 Li... |
creyesp/RF_Estimation | Clustering/clustering/spaceClustering.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# spaceClustering.py
#
# Copyright 2014 Carlos "casep" Sepulveda <carlos.sepulveda@gmail.com>
#
# 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 Found... |
nacc/autotest | client/tests/btreplay/btreplay.py | import time, os
from autotest.client import test, os_dep, utils
from autotest.client.shared import error
class btreplay(test.test):
version = 1
# http://brick.kernel.dk/snaps/blktrace-git-latest.tar.gz
def setup(self, tarball = 'blktrace-git-latest.tar.gz'):
tarball = utils.unmap_url(self.bindir,... |
labordoc/labordoc-next | modules/webdeposit/lib/deposition_fields/issn_field.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2012, 2013 CERN.
##
## Invenio 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 opt... |
Mellthas/quodlibet | quodlibet/ext/songsmenu/website_search.py | # Copyright 2011-2018 Nick Boultbee
#
# 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.
import os
from urllib.parse impor... |
kaaustubh/pjsip | tests/pjsua/scripts-pesq/200_codec_speex_8000.py | # $Id: 200_codec_speex_8000.py 2063 2008-06-26 18:52:16Z nanang $
#
from inc_cfg import *
ADD_PARAM = ""
if (HAS_SND_DEV == 0):
ADD_PARAM += "--null-audio"
# Call with Speex/8000 codec
test_param = TestParam(
"PESQ codec Speex NB",
[
InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec speex/8000 --c... |
oVirt/vdsm | tests/throttledlog_test.py | #
# Copyright 2016 Red Hat, 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) any later version.
#
# This program is distributed in th... |
akosiaris/transliterate | src/transliterate/tests/data/python32.py | # -*- coding: utf-8 -*-
__title__ = 'transliterate.tests.data.python32'
__author__ = 'Artur Barseghyan'
__copyright__ = '2013-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
latin_text = "Lorem ipsum dolor sit amet"
armenian_text = 'Լօրեմ իպսում դօլօր սիտ ամետ'
cyrillic_text = 'Лорем ипсум долор сит амет'
ukr... |
yandex/mastermind | src/cocaine-app/indexes.py | from Queue import Queue
import elliptics
class SecondaryIndex(object):
def __init__(self, idx, key_tpl, meta_session):
self.idx = idx
self.key_tpl = key_tpl
self.meta_session = meta_session
def __iter__(self):
for idx in self.meta_session.find_all_indexes([self.idx]):
... |
popazerty/enigma2 | RecordTimer.py | from boxbranding import getMachineBrand, getMachineName
import xml.etree.cElementTree
from time import localtime, strftime, ctime, time
from bisect import insort
from sys import maxint
import os
from enigma import eEPGCache, getBestPlayableServiceReference, eServiceReference, eServiceCenter, iRecordableService, quitMa... |
gloryofrobots/obin | arza/compile/compiler.py | __author__ = 'gloryofrobots'
from arza.compile.code.opcode import *
from arza.compile.parse import parser
from arza.compile import simplify
from arza.compile.parse import nodes
from arza.compile.parse.basic import IMPORT_NODES
from arza.compile.parse.nodes import (node_type, imported_name_to_s,
... |
xenserver/transfervm | transfertests/getrecord_test.py |
import base64
import httplib
import logging
import unittest
import testsetup
import transferclient
import moreasserts
def clean_up():
hostname = testsetup.HOST
testsetup.clean_host(hostname)
class GetRecordTest(unittest.TestCase):
def assertRecordFields(self, record, fields):
for field in field... |
shugaoye/virt-manager | virtinst/osdict.py | #
# List of OS Specific data
#
# Copyright 2006-2008, 2013-2014 Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>
#
# 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, ... |
azumimuo/family-xbmc-addon | plugin.video.phstreams/resources/lib/resolvers/veehd.py | # -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any ... |
creasyw/IMTAphy | documentation/doctools/tags/0.4.2/sphinx/quickstart.py | # -*- coding: utf-8 -*-
"""
sphinx.quickstart
~~~~~~~~~~~~~~~~~
Quickly setup documentation source to work with Sphinx.
:copyright: 2008 by Georg Brandl.
:license: BSD.
"""
import sys, os, time
from os import path
from sphinx.util import make_filename
from sphinx.util.console import purple, bold... |
CalPolyUROV/UROV2016 | Last_Years_code/PythonServer/UI/pythonGenerator.py | import glob
import os.path
import sys
from PyQt4 import uic
UI_FILES = 'XML/*.ui'
def compile_ui():
uifiles = glob.glob(UI_FILES)
if len(uifiles) == 0:
print 'none!'
return
with open('Generated/generatedGUI.py', 'w+b') as pyfile:
for uifile in uifiles:
uic.compileUi(uifile, pyfile)
pyfil... |
NikolaYolov/invenio_backup | modules/bibauthorid/lib/bibauthorid_config.py | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011 CERN.
##
## Invenio 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) a... |
nirs/vdsm | tests/network/functional/conftest.py | #
# Copyright 2018-2020 Red Hat, 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) any later version.
#
# This program is distributed ... |
rct/rtl_433 | examples/rtl_433_statsd_pipe.py | #!/usr/bin/env python
"""Statsd monitoring for rtl_433 using pipes."""
# Needs Python statsd Network plugin, s.a. https://github.com/jsocol/pystatsd
# pip install pystatsd
# -or-
# curl -o statsd.py https://github.com/jsocol/pystatsd/raw/v3.2/statsd/client.py
import sys
import json
from statsd import StatsClient... |
zrhans/python | exemplos/Examples.lnk/bokeh/plotting/file/bollinger.py | import numpy as np
from bokeh.plotting import *
# Define Bollinger Bands.
upperband = np.random.random_integers(100, 150, size=100)
lowerband = upperband - 100
x_data = np.arange(1, 101)
# Bollinger shading glyph:
band_x = np.append(x_data, x_data[::-1])
band_y = np.append(lowerband, upperband[::-1])
output_file('b... |
jurgnjn/biokludge | scripts/cap/txn_starts2tics.py | #!/usr/bin/env python
import argparse
import sys
import HTSeq as hts
def inv_dist(i, j):
"""
Distance between too GenomicInterval-s.
0 if adjacent or overlapping
inf if on different chromosomes or strands
"""
if i.overlaps(j): return(0)
if (i.chrom == j.chrom) and (i.strand == j.st... |
openstenoproject/plover | plover/system/english_stenotype.py |
KEYS = (
'#',
'S-', 'T-', 'K-', 'P-', 'W-', 'H-', 'R-',
'A-', 'O-',
'*',
'-E', '-U',
'-F', '-R', '-P', '-B', '-L', '-G', '-T', '-S', '-D', '-Z',
)
IMPLICIT_HYPHEN_KEYS = ('A-', 'O-', '-E', '-U', '*')
SUFFIX_KEYS = ('-Z', '-D', '-S', '-G')
NUMBER_KEY = '#'
NUMBERS = {
'S-': '1-',
'T-... |
delmic/odemis | src/odemis/gui/test/comp_grid_test.py | #-*- coding: utf-8 -*-
"""
.. codeauthor:: Rinze de Laat <delaat@delmic.com>
Copyright © 2014-2018 Rinze de Laat, Éric Piel, Delmic
This file is part of Odemis.
.. license::
Odemis is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License version 2 as publi... |
UdK-VPT/Open_eQuarter | mole3/stat_corr/window_wall_ratio_south_AVG_by_building_age_lookup.py | # coding: utf8
# OeQ autogenerated lookup function for 'Window/Wall Ratio South in correlation to year of construction, based on the source data of the survey for the "German Building Typology developed by the "Institut für Wohnen und Umwelt", Darmstadt/Germany, 2011-2013'
import math
import numpy as np
from . import ... |
yousseb/meld | meld/undo.py | # Copyright (C) 2002-2006 Stephen Kennedy <stevek@gnome.org>
# Copyright (C) 2010-2011 Kai Willadsen <kai.willadsen@gmail.com>
#
# 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 ... |
SteveDiamond/cvxpy | cvxpy/reductions/complex2real/atom_canonicalizers/__init__.py | """
Copyright 2017 Robin Verschueren
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... |
portfors-lab/sparkle | test/tests/gui/__init__.py | import sip
sip.setdestroyonexit(0)
import os, shutil
import numpy as np
from sparkle.QtWrapper import QtGui
tempfolder = os.path.join(os.path.abspath(os.path.dirname(__file__)), u"tmp")
app = None
# executes once before all tests
def setup():
if not os.path.exists(tempfolder):
os.mkdir(tempfolder)
n... |
hes19073/hesweewx | bin/weewx/reportengine.py | #
# Copyright (c) 2009-2020 Tom Keffer <tkeffer@gmail.com>
#
# See the file LICENSE.txt for your full rights.
#
"""Engine for generating reports"""
from __future__ import absolute_import
# System imports:
import datetime
import ftplib
import glob
import logging
import os.path
import threading
import time
import... |
dantebarba/docker-media-server | plex/Sub-Zero.bundle/Contents/Libraries/Shared/subliminal_patch/refiners/omdb.py | # coding=utf-8
import os
import subliminal
import base64
import zlib
from subliminal import __short_version__
from subliminal.refiners.omdb import OMDBClient, refine as refine_orig, Episode, Movie
from subliminal_patch.http import TimeoutSession
class SZOMDBClient(OMDBClient):
def __init__(self, version=1, sessio... |
mscuthbert/abjad | abjad/tools/stringtools/is_lower_camel_case.py | # -*- encoding: utf-8 -*-
import re
import six
lowercamelcase_regex = re.compile(
'^([a-z,0-9]+([A-Z,0-9]+[a-z,0-9]*)*)?$',
re.VERBOSE,
)
def is_lower_camel_case(expr):
r'''Is true when `expr` is a string and is lowercamelcase.
.. container:: example
::
>>> stringtools.is... |
mscuthbert/abjad | abjad/tools/datastructuretools/test/test_datastructuretools_TreeContainer_append.py | # -*- encoding: utf-8 -*-
from abjad import *
def test_datastructuretools_TreeContainer_append_01():
leaf_a = datastructuretools.TreeNode()
leaf_b = datastructuretools.TreeNode()
leaf_c = datastructuretools.TreeNode()
leaf_d = datastructuretools.TreeNode()
container = datastructuretools.TreeConta... |
erh3cq/hyperspy | hyperspy/io_plugins/bruker.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 Petras Jokubauskas
# Copyright 2016 The HyperSpy developers
#
# This library 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... |
jpopelka/fabric8-analytics-worker | f8a_worker/workers/dependency_parser.py | """Output: List of direct and indirect dependencies."""
import re
import anymarkup
import itertools
from pathlib import Path
from tempfile import TemporaryDirectory
from f8a_worker.base import BaseTask
from f8a_worker.errors import TaskError
from f8a_worker.process import Git
from f8a_worker.utils import TimedCommand... |
hzlf/openbroadcast | website/shop/shop/tests/util.py | #-*- coding: utf-8 -*-
from decimal import Decimal
from django.contrib.auth.models import User, AnonymousUser
from django.core.exceptions import ImproperlyConfigured
from django.test.testcases import TestCase
from shop.addressmodel.models import Address, Country
from shop.models.cartmodel import Cart
from shop.util.add... |
ntoll/Pcode | venv/__init__.py | """
Virtual environment (venv) package for Python. Based on PEP 405.
Copyright (C) 2011-2012 Vinay Sajip.
Licensed to the PSF under a contributor agreement.
usage: python -m venv [-h] [--system-site-packages] [--symlinks] [--clear]
[--upgrade]
ENV_DIR [ENV_DIR ...]
Creates virtual Python envi... |
monash-merc/karaage | karaage/tests/machines/test_views.py | # Copyright 2010-2011, 2013-2015 VPAC
# Copyright 2014 The University of Melbourne
#
# This file is part of Karaage.
#
# Karaage 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,... |
piotrek-golda/CivilHubIndependantCopy | rest/serializers.py | # -*- coding: utf-8 -*-
from rest_framework import serializers
from rest_framework.pagination import PaginationSerializer
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.utils.translation import get_language
from django.utils.translation import gettext ... |
benjimons/FIR | fir_todos/models.py | from django.conf import settings
from django.db import models
from django import forms
from incidents.models import Incident, IncidentCategory, BusinessLine, Label
class TodoItem(models.Model):
description = models.CharField(max_length=140)
incident = models.ForeignKey(Incident, blank=True, null=True)
ca... |
DGA-MI-SSI/YaCo | deps/swig-3.0.7/Examples/test-suite/python/li_cwstring_runme.py | from li_cwstring import *
if count(u"ab\0ab\0ab\0", 0) != 3:
raise RuntimeError
if test1() != u"Hello World":
raise RuntimeError
if test2() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_":
raise RuntimeError
if test3("hello") != u"hello-suffix":
raise RuntimeError
if test4("... |
dantebarba/docker-media-server | plex/Subliminal.bundle/Contents/Libraries/Shared/guessit/plugins/transformers.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# GuessIt - A library for guessing information from filenames
# Copyright (c) 2013 Nicolas Wack <wackou@gmail.com>
#
# GuessIt is free software; you can redistribute it and/or modify it under
# the terms of the Lesser GNU General Public License as published by
# the Free ... |
erh3cq/hyperspy | hyperspy/tests/test_non-uniform_not-implemented.py | # -*- coding: utf-8 -*-
# Copyright 2007-2021 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... |
maciekswat/dolfin_1.3.0 | test/documentation/test.py | # Copyright (C) 2011 Marie E. Rognes
#
# This file is part of DOLFIN.
#
# DOLFIN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.... |
SuperDARNCanada/placeholderOS | experiments/testing_archive/test_beamforming_16_boxes.py | #!/usr/bin/python
import os
import sys
sys.path.append(os.environ['BOREALISPATH'])
# write an experiment that creates a new control program.
from experiment_prototype.experiment_prototype import ExperimentPrototype
class OneBox(ExperimentPrototype):
def __init__(self):
cpid = 100000000
super(On... |
immenz/pyload | module/plugins/hooks/RestartSlow.py | # -*- coding: utf-8 -*-
import pycurl
from module.plugins.Hook import Hook
class RestartSlow(Hook):
__name__ = "RestartSlow"
__type__ = "hook"
__version__ = "0.04"
__config__ = [("free_limit" , "int" , "Transfer speed threshold in kilobytes" , 100 ),
(... |
robocomp/robocomp | libs/innermodel-python3/innermodel_python3/innermodelprismaticjoint.py | from innermodeltransform import InnerModelTransform
class InnerModelPrismaticJoint (InnerModelTransform):
def __init__(self, id: str, min: float, max: float, value: float, offset: float, port: int = 0,
axis: str = 'z', home: float = 0, parent: 'InnerModelTransform' = None):
super (InnerMod... |
LuoZijun/uOffice | temp/ooxmlx/samples/01_basic/parse.py | import sys
import six
import logging
import ooxml
from ooxml import parse, serialize, importer
logging.basicConfig(filename='ooxml.log', level=logging.INFO)
if len(sys.argv) > 1:
file_name = sys.argv[1]
dfile = ooxml.read_from_file(file_name)
six.print_("\n-[HTML]-----------------------------\n")
... |
CartesianCo/argentum-control | src/controllers.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Argentum Control GUI
Copyright (C) 2013 Isabella Stevens
Copyright (C) 2014 Michael Shiel
Copyright (C) 2015 Trent Waddington
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License... |
nozuono/calibre-webserver | src/calibre/gui2/tweak_book/polish.py | #!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
from functools import partial
from PyQt4.Qt import (
QTextBrowser, QVBox... |
siddhuwarrier/lockindicator-applet | src/typeutils/Exceptions.py | # Copyright (c) 2010 Siddhu Warrier (http://siddhuwarrier.homelinux.org,
# siddhuwarrier AT gmail DOT com).
#
# This file is part of the typeutils package.
# The utils package is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Sof... |
stutivarshney/Bal-Aveksha | WebServer/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "WebServer.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that th... |
mancoast/CPythonPyc_test | cpython/266_test_zipimport_support.py | # This test module covers support in various parts of the standard library
# for working with modules located inside zipfiles
# The tests are centralised in this fashion to make it easy to drop them
# if a platform doesn't support zipimport
import unittest
import test.test_support
import os
import os.path
import sys
im... |
mdsmus/MusiContour | tests/test_contour.py | # -*- coding: utf-8 -*-
import contour.contour as contour
from contour.contour import Contour
import py
def test_build_classes_card():
fn = contour.build_classes_card
assert fn(4) == [(4, 1, (0, 1, 2, 3), True), (4, 2, (0, 1, 3, 2), False),
(4, 3, (0, 2, 1, 3), True), (4, 4, (0, 2, 3, 1)... |
gaeran/lipan | portscan/portscan/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-26 00:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ScanRe... |
slandis/InkCutter | inkcutter/app/bin/serial/serialutil.py | #! python
# Python Serial Port Extension for Win32, Linux, BSD, Jython
# see __init__.py
#
# (C) 2001-2009 Chris Liechti <cliechti@gmx.net>
# this is distributed under a free software license, see license.txt
# compatibility folder Python < 2.6
try:
bytes
bytearray
except (NameError, AttributeError):
# Py... |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/newrelic-2.46.0.37/newrelic/api/memcache_trace.py | import functools
from .time_trace import TimeTrace
from .transaction import current_transaction
from ..core.memcache_node import MemcacheNode
from ..common.object_wrapper import FunctionWrapper, wrap_object
class MemcacheTrace(TimeTrace):
def __init__(self, transaction, command):
super(MemcacheTrace, sel... |
xorpaul/shinken | test/test_parse_perfdata.py | #!/usr/bin/env python
# Copyright (C) 2009-2010:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
#
# This file is part of Shinken.
#
# Shinken 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 F... |
iw3hxn/server | openerp/modules/loading.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... |
levkar/odoo-addons | sale_dummy_confirmation/sale.py | # -*- coding: utf-8 -*-
from openerp import api, fields, models, _
class sale_order(models.Model):
_inherit = 'sale.order'
dummy_confirmation = fields.Boolean('Dummy Confirmation', help="If true, this sale order has been dummy confirmed and can go back to draft.")
def action_button_confirm(self, ... |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/radon/raw.py | '''This module contains functions related to raw metrics.
The main function is :func:`~radon.raw.analyze`, and should be the only one
that is used.
'''
import tokenize
import operator
import collections
try:
import StringIO as io
except ImportError: # pragma: no cover
import io
__all__ = ['OP', 'COMMENT', ... |
sciCloud/OLiMS | lims/controlpanel/bika_labcontacts.py | from dependencies.dependency import ClassSecurityInfo
from dependencies.dependency import schemata
from dependencies import atapi
from dependencies.dependency import registerType
from dependencies.dependency import permissions
from dependencies.dependency import getToolByName
from lims.browser.bika_listing import BikaL... |
pixelated-project/pixelated-user-agent | service/test/unit/adapter/test_mailbox_indexer_listener.py | #
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated 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
# (at your option) any later version.
#
# Pixelated is distrib... |
mark-in/securedrop-app-code | tests/functional/source_navigation_steps.py | import tempfile
class SourceNavigationSteps():
def _source_visits_source_homepage(self):
self.driver.get(self.source_location)
self.assertEqual("SecureDrop | Protecting Journalists and Sources",
self.driver.title)
def _source_chooses_to_submit_documents(self):
... |
wetneb/dissemin | deposit/migrations/0008_userpreferences.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-23 19:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... |
drewkett/SU2 | SU2_PY/merge_solution.py | #!/usr/bin/env python
## \file merge_solution.py
# \brief Python script for merging of the solution files.
# \author F. Palacios
# \version 6.1.0 "Falcon"
#
# The current SU2 release has been coordinated by the
# SU2 International Developers Society <www.su2devsociety.org>
# with selected contributions from the op... |
mlundblad/telepathy-gabble | tests/twisted/sasl/saslutil.py | # hey, Python: encoding: utf-8
from twisted.words.protocols.jabber.xmlstream import NS_STREAMS
from gabbletest import XmppAuthenticator
from base64 import b64decode, b64encode
from twisted.words.xish import domish
import constants as cs
import ns
from servicetest import (ProxyWrapper, EventPattern, assertEquals,
... |
pawhewitt/Dev | SU2_PY/SU2/run/geometry.py | #!/usr/bin/env python
## \file geometry.py
# \brief python package for running geometry analyses
# \author T. Lukaczyk, F. Palacios
# \version 5.0.0 "Raven"
#
# SU2 Original Developers: Dr. Francisco D. Palacios.
# Dr. Thomas D. Economon.
#
# SU2 Developers: Prof. Juan J. Alonso's group at ... |
ruthfranklin/hande | tools/pyblock/pyblock/pd_utils.py | '''Pandas-based wrapper around :mod:`pyblock.blocking`.'''
# copyright: (c) 2014 James Spencer
# license: modified BSD license; see LICENSE for further details.
import numpy
import pandas as pd
import pyblock.blocking
def reblock(data, axis=0, weights=None):
'''Blocking analysis of correlated data.
Parameters
-... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.