text stringlengths 17 737k |
|---|
#!/usr/bin/env python
"""
MCNPX Model for Cylindrical RPM8
"""
#import mctal
import subprocess
class CylinderRPM(object):
# Material Dictionaries
cellForStr = '{:5d} {:d} -{:4.3f} {:d} -{:d} u={:d}\n'
surfForStr = '{:5d} cz {:5.3f}\n'
tranForStr = '*tr{:d} {:4.3f} {:4.3f} 0.000\n'
geoParam={'RPM8S... |
import datetime
import json
from firmant.plugins import PluginMount
from firmant.utils import not_implemented
# Base classes for Atom data.
class AtomBase(object):
def __eq__(self, other):
for field in self.fields:
if hasattr(self, field) \
and hasattr(other, field) \
... |
#! /usr/bin/env python3
import logging, sys
format_ = "%(asctime)s %(levelname)s: %(message)s"
stdout_hdlr = logging.StreamHandler(sys.stdout)
stdout_hdlr.setFormatter(logging.Formatter(format_))
stdout_hdlr.setLevel(logging.INFO)
file_hdlr = logging.FileHandler(filename="nowallet.log", mode="w")
file_hdlr.setFormat... |
from __future__ import unicode_literals
from django.db import models
from django.db.models.signals import m2m_changed, pre_save
from django.core.exceptions import ValidationError
import punctuation
from slugify import slugify
try:
from django_countries.fields import CountryField
except ImportError:
raise (
... |
#!/usr/bin/python3
import argparse
import urllib.request
import json
import datetime
###### USAGE #######################
## ./fetch_panels.py -o OUTPUT_DIR
########################################
# configure the CLI options
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--output", help="Output ... |
import tangelo
import json
import networkx as nx
import romanesco
betweenness_centrality = {
'inputs': [
{'name': 'G',
'type': 'graph',
'format': 'networkx'},
{'name': 'node',
'type': 'string',
'format': 'text'}
],
'outputs': [
{'name': 'measure'... |
from django import template
from cms.templatetags.cms_tags import Placeholder
from laterpay import ItemDefinition
register = template.Library()
class PaidContentPlaceholder(Placeholder):
name = 'lp_placeholder'
def render_tag(self, context, name, extra_bits, nodelist=None):
content = super(PaidCo... |
# -*- coding: utf-8 -*-
"""test class"""
import os
import tempfile
import unittest
from plasoscaffolder.bll.services import sqlite_generator
from plasoscaffolder.common import file_handler
from tests.fake import fake_file_handler
from tests.fake import fake_formatter_mapping
from tests.fake import fake_formatter_test_... |
"""Pointwise theano functions and other such malarkey.
Note: Unless these are re-written as classes, which isn't the worst idea,
a dictionary is neccesary so that the activation function can be serialized as
a string. If it were a class, it could / would have a name property.
"""
import theano.tensor as T
def linea... |
# Copyright 2019 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... |
#!/usr/bin/env python
from __future__ import print_function, division, absolute_import, unicode_literals
import os
import platform
import sys
import re
import shutil
import urllib2
import argparse
BLOCKHEAD = '###ClickBait HEAD###'
BLOCKTAIL = '###ClickBait TAIL###'
LINUX_HOSTPATH = '/etc/hosts'
WIN_HOSTPATH = '\\sys... |
#----------------------------------------------------------
import numpy as np
import struct
import time
import usb.core
import warnings
from oceanoptics.defines import OceanOpticsError as _OOError
from oceanoptics.defines import OceanOpticsModelConfig as _OOModelConfig
from oceanoptics.defines import OceanOpticsVendo... |
'''
This holds onto the UpdateObject class.
It allows us to easily abstract away different update types and provide a uniform
way to interpret the results through a set of basic actionable functions.
'''
import time
from twisted.internet import reactor
from paradrop.base import nexus, settings
from paradrop.base.outpu... |
import json
import re
from urllib.parse import unquote
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponse
from django.shortcuts import render, redirect
from django.urls import reverse
from django.urls import reverse_lazy
from django.views.generic import FormView
from django.... |
# Copyright 2015 Vinicius Chiele. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
# Copyright 2016-2018 California Institute of Technology.
#
# 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... |
# -*- coding: utf-8 -*-
#
# synop.py
#
# purpose: Legacy Synop-LaDO toolbox
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.tiddlyspot.com/
# created: 13-Sep-2012
# modified: Sat 13 Oct 2012 01:53:58 AM BRT
#
# obs: Mostly backwards compatible functions. There are newer and b... |
e783f9ab-2ead-11e5-93d8-7831c1d44c14 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2017, Dorian Soergel
#
# 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 th... |
# 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... |
# Copyright 2016 Measurement Lab
#
# 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 writi... |
"""Extract files Microsoft Access OLE object fields"""
import struct
import re
import sys
from pprint import pprint
class BadDataError(Exception):
pass
def bmps(oleobject):
"""Return iterator over all BMPs inside OLE object field"""
for object_type, data in objects(oleobject):
if object_type == ... |
from neomodel.properties import IntegerProperty, DateTimeProperty, DateProperty, StringProperty
from neomodel.exception import InflateError, DeflateError
from neomodel import StructuredNode
from pytz import timezone
from datetime import datetime, date
class FooBar(object):
pass
def test_deflate_inflate():
p... |
"""
the flask extension
"""
from functools import wraps
import logging
from flask import request, current_app, g, Blueprint
from .errors import RateLimitExceeded, ConfigurationError
from flask.ext.limiter.storage import storage_from_string
from .strategies import STRATEGIES
from .util import parse_many, get_ipaddr
... |
import os
import re
from lxml import etree
def locate_xpath_result(request, xpath):
"""
Takes a Request object and an xpath.
Locates all instances of the specified xpath content within the html
associated with the request.
Returns a list of all the content matching the xpath
"""
parser = et... |
# -*- coding: utf-8 -*-
'''
Mounting of filesystems
=======================
Mount any type of mountable filesystem with the mounted function:
.. code-block:: yaml
/mnt/sdb:
mount.mounted:
- device: /dev/sdb1
- fstype: ext4
- mkmnt: True
- opts:
- defaults
/srv... |
# Filename: evt.py
# pylint: disable=C0103,R0903
"""
Pumps for the EVT simulation dataformat.
"""
import sys
from km3pipe.core import Pump, Blob
from km3pipe.logger import logging
log = logging.getLogger(__name__) # pylint: disable=C0103
__author__ = "Tamas Gal"
__copyright__ = "Copyright 2016, Tamas Gal and the K... |
# Copyright (c) 2011-2018, Ulf Magnusson
# SPDX-License-Identifier: ISC
"""
Overview
========
Kconfiglib is a Python 2/3 library for scripting and extracting information
from Kconfig (https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt)
configuration systems.
See the homepage at https://github.com/u... |
# coding=utf-8
__author__ = "Gina Häußge <osd@foosel.net>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
from flask import Flask, request, render_template, jsonify, send_from_directory, abort, url_for
from werkzeug.utils import secure_filename
import tornadio2
import os
impor... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# This is Kconfiglib, a Python library for scripting, debugging, and extracting
# information from Kconfig-based configuration systems. To view the
# documentation, run
#
# $ pydoc kconfiglib
#
# or, if you prefer HTML,
#
# $ pydoc -w kconfiglib
#
# The examples/ subdirectory contains examples, to be run with e.g.
#
... |
# -*- coding: utf-8 -*-
"""
python-bna
Battle.net Authenticator routines in Python.
Specification can be found here:
<http://bnetauth.freeportal.us/specification.html>
Python implementation by Jerome Leclanche <j.leclanche@gmail.com>
"""
from time import time
from hashlib import sha1
RSA_KEY = 104890018807986556874... |
# -*- coding: utf-8 -*-
"""
femagtools
~~~~~~~~~~
Python bindings for FEMAG
"""
__title__ = 'femagtools'
__version__ = '0.9.41-snapshot'
__author__ = 'Ronald Tanner'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016-2018 SEMAFOR Informatik & Energie AG'
from .bch import Reader
from .model import Mach... |
import os
import os.path
import scripttest
def test_persists_data():
env = scripttest.TestFileEnvironment()
# FIXME path to fridge script should be determined in some other way
env.run('../../bin/fridge', 'init')
env.writefile('somefile', 'with some content')
env.run('../../bin/fridge', 'commit')... |
from __future__ import unicode_literals
import unittest
from StringIO import StringIO
import pyaavso
from pyaavso.formats.visual import VisualFormatWriter
class VisualFormatWriterTestCase(unittest.TestCase):
"""
Tests for VisualFormatWriter class.
"""
def setUp(self):
self.fp = StringIO()
... |
# -*- coding: utf-8 -*-
"""
femagtools
~~~~~~~~~~
Python bindings for FEMAG
"""
__title__ = 'femagtools'
__version__ = '1.1.6dev'
__author__ = 'Ronald Tanner'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016-2018 SEMAFOR Informatik & Energie AG'
from .asm import read
from .bch import Reader
from .mo... |
#!/usr/bin/env python
# swift.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift... |
import hierarchy
from collections import defaultdict
import itertools
accumulate = lambda f: lambda g: lambda *a, **k: f(g(*a, **k))
@accumulate('\n'.join)
def make_tikz_nodes(formulae, formula_layout):
fmt = r'\node ({}) at ({}, {}) {{{}}};'
for j, row in enumerate(formula_layout):
i = 0
whil... |
#!/usr/bin/env python
"""Hindsight - Internet history forensics for Google Chrome/Chromium.
This script parses the files in the Chrome data folder, runs various plugins
against the data, and then outputs the results in a spreadsheet.
"""
import os
import sys
import re
import codecs
import time
import datetime
import... |
#!/usr/bin/python
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... |
from marshal import loads, dumps
import sqlite3
import uuid as uuidgenerator
import sys
class Matcher:
def __init__(self, where=None):
self._where = where
def docs_matches(self, a):
doc = loads(a)
for k in self._where:
if k in doc and doc[k] != self._where[k]:
... |
# Copyright (C) 2005-2007 Jelmer Vernooij <jelmer@samba.org>
# 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 pr... |
__version__ = '0.2.12'
|
from src import MFM, Model, ModelInput
MFM.init()
model = Model()
model_input = ModelInput(model)
model.start()
|
# Support for the Numato Saturn (http://numato.com/product/saturn-spartan-6-fpga-development-board-with-ddr-sdram)
from fractions import Fraction
from migen import *
from migen.genlib.resetsync import AsyncResetSynchronizer
from litex.build.generic_platform import *
from litex.soc.integration.soc_sdram import *
fro... |
# Copyright (c) 2010, Robert Escriva
# 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 condition... |
# -*- coding: utf-8 -*-
"""
flask_testing.utils
~~~~~~~~~~~~~~~~~~~
Flask unittest integration.
:copyright: (c) 2010 by Dan Jacob.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, with_statement
import gc
import time
try:
import unittest2 as unittest
e... |
# coding=utf-8
NETS = ['default']
POOL = 'default'
IMAGE = None
CPUMODEL = 'host-model'
NUMCPUS = 2
CPUHOTPLUG = False
CPUFLAGS = []
MEMORY = 512
MEMORYHOTPLUG = False
DISKINTERFACE = 'virtio'
DISKTHIN = True
DISKSIZE = 10
DISKS = [{'size': DISKSIZE}]
GUESTID = 'guestrhel764'
VNC = False
CLOUDINIT = True
RESERVEIP = Fa... |
from pyspark import SparkContext
import json
import time
from operator import add
import math
print 'loading'
sc = SparkContext("spark://ec2-54-200-174-121.us-west-2.compute.amazonaws.com:7077", "Simple App")
# Replace `lay-k.json` with `*.json` to get a whole lot more data.
lay = sc.textFile('s3n://AKIAJFDTPC4XX2LVET... |
import pytz
import re
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
import requests
from django.conf import settings
from django.db import models, connection
from django.db.models.expressions import RawSQL
from django.core.exceptions import ObjectDoesNotExist
from django.uti... |
import pgmapcss.db as db
from .compile_function_get_where import compile_function_get_where
from .compile_function_check import compile_function_check
from pkg_resources import *
import pgmapcss.eval
import pgmapcss.colors
def compile_function_match(stat):
replacement = {
'style_id': stat['id'],
'style... |
# This file is part of PyBOSSA.
#
# PyBOSSA 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.
#
# PyBOSSA is distributed in the ho... |
# This file is part of PyBOSSA.
#
# PyBOSSA 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.
#
# PyBOSSA is distributed in the ho... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from rpython.rlib.rsre import rsre_re as re
from rpython.rlib import jit
from rpython.rlib import streamio as sio
from rpython.rlib.rbigint import rbigint
from rpython.rlib.rstring import ParseStringError, ParseStringOverflowError
from rpython.rlib.rari... |
from pydoctor.test.test_astbuilder import fromText
from pydoctor.test.test_packages import processPackage
from pydoctor import server
from nevow import context, testutil, appserver, flat, inevow
from twisted.internet.defer import maybeDeferred
def deferredResult(*args):
hack = []
err = []
def cb(x):
... |
# -*- coding: utf-8 -*-
"""
pygments.formatters.latex
~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for LaTeX fancyvrb output.
:copyright: 2006-2007 by Georg Brandl.
:license: BSD, see LICENSE for more details.
"""
import StringIO
from pygments.formatter import Formatter
from pygments.token import Token
fr... |
"""Configuration file parsing and utilities."""
import copy
import itertools
import os
from collections import Set, namedtuple
from re import compile as re
try: # Python 3.x
from ConfigParser import RawConfigParser
except ImportError: # Python 2.x
from configparser import RawConfigParser
from .utils impo... |
# -*- coding: utf-8 -*-
import random
import uuid
from collections import OrderedDict
from functools import reduce
from dummy_spark.resultsiterable import ResultIterable
__author__ = 'willmcginnis'
class RDD(object):
"""
A Resilient Distributed Dataset (RDD) is the basic abstraction in Spark. It represent... |
import os
import logging
import subprocess
import flye.fasta_parser as fp
logger = logging.getLogger()
MINIMAP_BIN = "flye-minimap2"
class ShortPlasmidsAssemblyException(Exception):
pass
class Hit:
def __init__(self, raw_hit):
hit = raw_hit.split()
self.query = hit[0]
self.query_l... |
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import gyp
import gyp.common
import gyp.msvs_emulation
import gyp.MSVSVersion
import gyp.system_test
import gyp.xcode_emulation
import hashlib
import o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import atexit
import os
import sys
from datetime import datetime
from pyparsing import ParseException
from yalix.exceptions import EvaluationError
from yalix.completer import Completer
from yalix.interpreter import *
from yalix.parser import scheme_parser
from yalix.utils... |
import os
from django.shortcuts import render
from django.shortcuts import get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect, StreamingHttpResponse, HttpResponseNotFound
from django.core.servers.basehttp import FileWrapper
from django.core.urlresolvers import reverse
from django.core.server... |
import os
from django.shortcuts import render, get_object_or_404, render_to_response
from django.http import StreamingHttpResponse, HttpResponseNotFound
from django.core.servers.basehttp import FileWrapper
from django.core.urlresolvers import reverse, reverse_lazy
from django.template import RequestContext
from django... |
# coding: utf-8
import os
import json
from collections import OrderedDict
from unittest import TestCase
from urllib3_mock import Responses
from pycsob import conf, utils
from pycsob.client import CsobClient
KEY_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'fixtures', 'test.key'))
PAY_ID = '34ae55eb6... |
from __future__ import absolute_import
from .comm import min_max
def validate_int(obj, ret, val, ctx):
min_max(obj, ret, False)
min_max(obj, ret, True)
return val
def create_int(obj, v, ctx=None):
r = int(v)
validate_int(obj, r, v, ctx)
return r
|
'''
Netlink basics
==============
General netlink packet structure::
nlmsg packet:
+ header
+ data
Generic netlink message header::
nlmsg header:
+ uint32 length
+ uint16 type
+ uint16 flags
+ uint32 sequence number
+ uint32 pid
The `length` field is ... |
#!/usr/bin/env python
#
# merge_tests.py: testing merge
#
# Subversion is a tool for revision control.
# See http://subversion.tigris.org for more information.
#
# ====================================================================
# Copyright (c) 2000-2003 CollabNet. All rights reserved.
#
# This software is lic... |
# encoding: utf-8
"""
This thing tries to restore public interface of objects that don't have a python
source: C extensions and built-in objects. It does not reimplement the
'inspect' module, but complements it.
Since built-ins don't have many features that full-blown objects have,
we do not support some fancier thing... |
# Copyright 2014 Adobe. All rights reserved.
"""
Tools for processing "fontinfo" files. See "psautohint --doc-fddict", or the
MakeOTF user guide for details on this format.
The "fontinfo" file is expected to be in the same directory as the input
font file.
"""
from __future__ import print_function, absolute_import
... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not... |
import numpy as np
from scipy import stats
from scipy.special import expit
from copy import deepcopy
import matplotlib.pyplot as plt
class NeuroPop(object):
"""
This class implements several conveniences for
plotting, fitting and decoding from population tuning curves
We allow the fitting of two class... |
import os
import re
from collections import defaultdict
from dvc.exceptions import DvcException
from dvc.logger import Logger
from dvc.config import Config
from dvc.executor import Executor, ExecutorError
from dvc.path.data_item import DataItemError
from dvc.state_file import StateFile
from dvc.system import System
fr... |
from flask import Flask, render_template, flash, request, Markup, session, redirect, url_for, escape, Response, current_app, send_file
from werkzeug.security import generate_password_hash, check_password_hash
import sys, os
from flask.ext.sqlalchemy import SQLAlchemy
from impschedules import app, db
import models, pr... |
#!/usr/bin/env python
"""
Copyright (c) 2010, Patrick Salecker
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 lis... |
"""
Algorithms for computing the skeleton of a binary image
"""
import numpy as np
from scipy import ndimage as ndi
from ._skeletonize_cy import _fast_skeletonize, _skeletonize_loop, _table_lookup_index
# --------- Skeletonization by morphological thinning ---------
def skeletonize(image):
"""Return the skelet... |
#! /usr/bin/env python
import logging
logger = logging.getLogger("robot")
logger.setLevel(logging.DEBUG)
#console = logging.StreamHandler()
#console.setLevel(logging.INFO)
#formatter = logging.Formatter('%(asctime)-15s %(name)s: %(levelname)s - %(message)s')
#console.setFormatter(formatter)
#logger.addHandler(consol... |
'''
Cache manager
=============
The cache manager can be used to store python objects attached to a unique
key. The cache can be controlled in two ways: with a object limit or a
timeout.
For example, we can create a new cache with a limit of 10 objects and a
timeout of 5 seconds::
# register a new Cache
Cach... |
from pygit2 import *
import uuid, toml, os
class File:
def __init__(self, entry):
self.xid = uuid.uuid4()
self.entry = entry
class Snapshot:
def __init__(self, commit):
self.commit = commit
self.files = {}
self.xids = {}
def add(self, entry, xid):
#metadata... |
from collections import namedtuple
from sqlalchemy.sql.expression import and_, literal_column
from shapely.geometry import MultiPoint
from geoalchemy2.shape import from_shape
from skylines.database import db
from skylines.lib import files
from skylines.lib.types import is_string
from skylines.lib.compat import _xrange... |
import sys
import os
import tempfile
import shutil
from StringIO import StringIO
import textwrap
from distutils.core import Extension, Distribution
from distutils.command.build_ext import build_ext
from distutils import sysconfig
from distutils.tests import support
from distutils.errors import (DistutilsSetupError, Co... |
# Run these tests with 'nosetests':
# install the 'python-nose' package (Fedora/CentOS or Ubuntu)
# run 'nosetests' in the root of the repository
from cStringIO import StringIO
import glob
import os
import sys
import unittest
from mock import patch
import configure
class BasicTests(unittest.TestCase):
def te... |
"""WMS 1.3.0 compliant GetCapabilities, GetMap, GetFeatureInfo, and Exceptions interface."""
try:
from mapnik2 import Coord
except ImportError:
from mapnik import Coord
from lxml import etree as ElementTree
from ogcserver.common import ParameterDefinition, Response, Version, ListFactory, \
... |
# -*- coding: utf-8 -*-
import os
import re
import collections
import fnmatch
from pyxshell.pipeline import pipe
@pipe
def echo(item):
"""
Yield a single item. Equivalent to ``iter([item])``, but nicer-looking.
>>> list(echo(1))
[1]
>>> list(echo('hello'))
['hello']
"""
... |
# Copyright 2015-2015 ARM Limited
#
# 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 w... |
#!/usr/bin/python
import os, sys, unittest, doctest
from Cython.Distutils.extension import Extension
from Cython.Distutils import build_ext
from distutils.dist import Distribution
distutils_distro = Distribution()
TEST_DIRS = ['compile', 'run']
TEST_RUN_DIRS = ['run']
INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE... |
#!/usr/bin/python
import os, sys, re, shutil, unittest, doctest
WITH_CYTHON = True
from distutils.dist import Distribution
from distutils.core import Extension
from distutils.command.build_ext import build_ext
distutils_distro = Distribution()
TEST_DIRS = ['compile', 'errors', 'run', 'pyregr']
TEST_RUN_DIRS = ['run... |
from djpcms import views, forms, html
from djpcms.utils import gen_unique_id
from ccy import dateFromString
class EcoForm(forms.Form):
height = forms.IntegerField()
service_url = forms.CharField(required = False)
class TimeSeriesView(views.ModelView):
'''``djpcms`` application view for ... |
import numpy as nm
import pytest
from sfepy import data_dir
from sfepy.base.base import assert_
import sfepy.base.testing as tst
filename_mesh = data_dir + '/meshes/2d/square_unit_tri.mesh'
def get_pars(ts, coors, mode=None, extra_arg=None,
equations=None, term=None, problem=None, **kwargs):
if mode... |
#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
DEBUG=True,
USE_TZ=True,
TIME_ZONE="UTC",
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
MIDDLEWARE_CLASSES=[
"django.... |
import frappe
import json, re
import bleach, bleach_whitelist.bleach_whitelist as bleach_whitelist
from six import string_types
from bs4 import BeautifulSoup
def clean_html(html):
if not isinstance(html, string_types):
return html
return bleach.clean(clean_script_and_style(html),
tags=['div', 'p', 'br', 'ul', '... |
#!/usr/bin/env python
# =============================================================================
# file = api.py
# description = System Information API
# author = GR <https://github.com/shortdudey123>
# create_date = 2014-07-25
# mod_date = 2014-07-25
# version = 0.1
# usage =
# notes =
# python_ver = 2.7.6
# ===... |
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'includes': [
'../../../../build/common.gypi',
],
'conditions': [
['target_arch=="x64"', {
'variables': {
# No extra r... |
# -*- coding: utf-8 -*-
#
# Natural Language Toolkit: ARLSTem Stemmer
#
# Copyright (C) 2001-2017 NLTK Project
#
# Author: Kheireddine Abainia (x-programer) <k.abainia@gmail.com>
# Algorithms: Kheireddine Abainia <k.abainia@gmail.com>
# Siham Ouamour
# Halim Sayoud
# URL:... |
# Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# 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... |
import json
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from haystack.query import SearchQuerySet, SQ
from publicbody.models import PublicBody
from froide.helper.json_view import JSONResponseDetailView
class PublicBodyDetailView(JSONResponseDetailView):
model = Pu... |
# Software License Agreement (BSD License)
#
# Copyright (c) 2010, Willow Garage, 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... |
#!/usr/bin/env python
import os
if 'SETTINGS_MODULE' not in os.environ:
os.environ['SETTINGS_MODULE'] = "testsettings"
import unittest
import tempfile
import shutil
import json
from betty import app
from betty.models import Image, Ratio
from betty.database import db_session, init_db
TEST_DATA_PATH = os.path.joi... |
#!/usr/bin/env /usr/bin/python3
## Copyright 2017 Marshall E. Giguere
##
## 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
##
## ... |
#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return None
PACKAGE_ROOT=os.path.abspath(os.path.dirname(__file__))
DEBUG = True
DEFAULT_SETTI... |
#! /usr/bin/env python
#
# Author: Damian Eads
# Date: April 17, 2008
#
# Copyright (C) 2008 Damian Eads
#
# 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 copy... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.