text stringlengths 475 200k |
|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Module Assignment2, parse URL Data and Display User Information"""
import urllib2
import csv
import datetime
import logging
import argparse
def download_data(url):
"""
Args:
response (inst) : Opens access to URL site.
crdata (json): Data aquire... |
# 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... |
"""This script generates Slicer Interfaces based on the CLI modules XML. CLI
modules are selected from the hardcoded list below and generated code is placed
in the cli_modules.py file (and imported in __init__.py). For this to work
correctly you must have your CLI executabes in $PATH"""
import xml.dom.minidom
import s... |
"""Constants for 1-Wire component."""
from __future__ import annotations
from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.const imp... |
from django import forms
from django.conf import settings
from django.core import validators
from django.core.exceptions import ValidationError
from django.utils import translation
from babel import Locale, localedata
from babel.support import Format
from tower import ugettext_lazy as _lazy
# TODO: remove this and u... |
import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... |
# -*- coding: utf-8 -*-
#################################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 Julius Network Solutions SARL <[EMAIL]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
## TODO: Absorption BoTndary Condition
def make_kernel(a):
a = np.asarray(a)
a = a.reshape(list(a.shape) + [1,1])
return tf.constant(a,dtype=1)
def simple_conv(x,k):
x = tf.expand_dims(tf.expand_dims(x,0),-1)
y = tf.nn.... |
#!/usr/bin/python
# QuesoGLC
# A free implementation of the OpenGL Character Renderer (GLC)
# Copyright (c) 2002, 2004-2006, Bertrand Coconnier
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software F... |
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 15 14:03:52 2015
@author: jemanjohnson
"""
import numpy as np
import matplotlib.pyplot as plt
import os
import scipy.io
from sklearn import preprocessing
from time import time
from sklearn.preprocessing import MinMaxScaler
# Image Reshape Function
def img_as_array(img... |
#!/usr/bin/python
from crontab import CronTab # pip install python-crontab
import os
### USER SETTINGS
#script_path = '/home/pragmo/pigitgrow/Pigrow/scripts/cron/'
homedir = os.getenv("HOME")
script_path = homedir + '/Pigrow/scripts/cron/'
cappath = homedir + "/cam_caps/"
archive_path = homedir + '/archive/' #... |
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
import os
class Animal(models.Model):
name = models.CharField(max_length=150)
latin_name = models.CharField(max_length=150)
def __unicode__(self):
return self.common_name
class Plant(models.M... |
"""
Name-Value Object: $obj.attr.attr2|filter|filter2|filterN
Numbered Argument: $[0].attr.attr2|filter|filter2|filterN
To create new filters, subclass and create do_ method.
do_ALL is the general method for any filters not found. It should raise FilterError if the
filter is still not available.
Use $$ to avoid repla... |
# -*- coding: utf-8 -*-
import httplib as http
import itertools
from flask import request
from framework import status
from framework.exceptions import HTTPError
from framework.flask import redirect # VOL-aware redirect
from framework.auth.decorators import must_be_signed
from website.archiver import ARCHIVER_SUCC... |
# -*- coding: utf-8 -*-
from translate.lang import factory as lang_factory
from translate.misc import wStringIO
from translate.storage import po
from translate.tools import posegment
class TestPOSegment:
def posegment(self, posource, sourcelanguage, targetlanguage, stripspaces=True, onlyaligned=True):
"... |
# Copyright (c) 2013-2017 Christian Geier et al.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, ... |
import logging
import functools
import platform
import os
TMP_DIR = os.path.join("/tmp", "insights-web")
logger = logging.getLogger(__name__)
def defaults(default=None):
"""
Catches any exception thrown by the wrapped function and returns `default`
instead.
Parameters
----------
default : o... |
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify,... |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
# Author: Jonathan D. Simms <[EMAIL]>
# this module is a trivial class with doctests and a __test__ attribute
# to test trial's doctest support with python2.4
class Counter(object):
"""a simple counter object for testing trial's d... |
import json
import hashlib
import requests
from optional_django.serializers import JSONEncoder
from .exceptions import ReactRenderingError
from . import conf
from .exceptions import RenderServerError
class RenderedComponent(object):
def __init__(self, markup, props):
self.markup = markup
self.prop... |
def decorated(origFunc, newFunc, decoration=None):
"""
Copies the original function's name/docs/signature to the new function, so that the docstrings
contain relevant information again.
Most importantly, it adds the original function signature to the docstring of the decorating function,
as well a... |
# Copyright 2015 IBM Corp.
#
# 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 t... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google 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 applicable law or... |
import re
import ast
from setuptools import setup
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('pipdeptree.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
with open('./README.rst') as f:
long_desc = f.read()
install_requir... |
from __future__ import absolute_import
import numpy as np
import backend as K
from utils import get_from_module
def get_fans(shape, dim_ordering='th'):
if len(shape) == 2:
fan_in = shape[0]
fan_out = shape[1]
elif len(shape) == 4 or len(shape) == 5:
# assuming convolution kernels (2D o... |
# -*- coding: utf-8 -*-
"""Bot tests."""
#
# (C) Pywikibot team, 2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
import sys
import pywikibot
import pywikibot.bot
from pywikibot import i18n
from pywikibot.tools import PY2
from tests.aspects import (... |
import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_rai... |
#!/usr/bin/python
import os
import string
call = " hook(10);\n";
call = " hook(10); hook2(10);hook3(0);hook4(0);\n";
def run_test(num_calls, compiler_command):
f = open("program_options_test.cpp", "w")
f.write("""#include <boost/program_options.hpp>
using namespace boost::program_options;
... |
import boto.ec2
import boto.route53, boto.route53.record
import time
machines = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen',
'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen', 'twenty', 'twentyone', 'twentytwo',
... |
#
# config.py
#
# Copyright (C) 2008 Andrew Resch <[EMAIL]>
#
# Deluge is free software.
#
# You may redistribute it and/or modify it under the terms of the
# GNU General Public License, as published by the Free Software
# Foundation; either version 3 of the License, or (at your option)
# any later version.
#
# deluge ... |
"""
tempfile モジュールに関するサンプルです。
tempfile.TemporaryDirectory() の使い方について
REFERENCES:: http://bit.ly/2KIbuZC
"""
import pathlib
import tempfile
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
# ---------------------------... |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
from __future__ import print_function
from builtins import range
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.naive_bayes import H2ONaiveBayesEstimator
import random
import string
def nb_baddata():
random.seed(1234)
rawdata = [[random.gauss(0,1) for r i... |
import logging
from future.moves.urllib.parse import urljoin
from dirtyfields import DirtyFieldsMixin
from django.conf import settings
from django.contrib.postgres import fields
from django.core.urlresolvers import reverse
from django.db import models
from osf.utils.fields import NonNaiveDateTimeField
from osf.models... |
"""
Created on 10 Nov 2016
@author: Bruno Beloff ([EMAIL])
example:
{
"format": "application/json"
}
"""
from collections import OrderedDict
from scs_core.data.json import JSONable
# --------------------------------------------------------------------------------------------------------------------
class Top... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from collections imp... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from contextlib impo... |
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import warnings
def decorator_with_args(decorator_to_enhance):
"""
This is decorator for decorator. It allows any decorator to get additional arguments
"""
def decorator_maker(*args, **kwargs):
... |
#!/usr/bin/env python
#
# This program returns the grey matter segmentation given anatomical, landmarks and t2star images
#
# ---------------------------------------------------------------------------------------
# Copyright (c) 2013 Polytechnique Montreal <www.neuro.polymtl.ca>
# Authors: Benjamin De Leener, Augustin... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# License: MIT (see LICENSE file provided)
# vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4:
"""
**polib** allows you to manipulate, create, modify gettext files (pot, po
and mo files). You can load existing files, iterate through it's entries,
add, modify entr... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 04 10:57:34 2017
@author: Gerwyn
"""
from __future__ import division
import numpy as np
import scipy as sp
import scipy.interpolate as spi
import scipy.stats as sps
import matplotlib.pyplot as plt
import uncertainties as u
from uncertainties import unumpy
plt.close('a... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
from .spec import Base2Obj
def default_tree_traversal(root, leaves):
""" default tree traversal """
objs = [('#', root)]
while objs:
path, obj = objs.pop()
# name of child are json-pointer encoded, we don't have
... |
from datetime import datetime
import httplib, urllib
from threading import Thread
from django.db.models.signals import post_save
from resources.models import Resource
from sms_notifications.models import SmsNotification
def notify(resource):
"""
send sms alerts to the authorised personnel
depend... |
from mpf.core.mode import Mode
from mpf.core.delays import DelayManager
import random
class sbone_servoactivation(Mode):
def mode_init(self):
self.log.info('sbone_servoactivation_mode_init')
self.delay = DelayManager(self.machine.delayRegistry)
def mode_start(self, **kwargs):
self.log... |
#!/usr/bin/env 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 require... |
from __future__ import unicode_literals
import os
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import CachedFilesMixin, StaticFilesStorage
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import get_storage_class
from django.utils.functi... |
"""
Support for HDMI CEC devices as media players.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/hdmi_cec/
"""
import logging
from homeassistant.components.hdmi_cec import ATTR_NEW, CecDevice
from homeassistant.components.media_player import MediaPlay... |
import time
from PyQt4.QtGui import *
from PyQt4.QtCore import *
from electrum_gui.qt.util import *
from electrum_gui.qt.amountedit import AmountEdit
from electrum.bitcoin import COIN
from electrum.i18n import _
from decimal import Decimal
from functools import partial
from electrum.plugins import hook
from exchange_... |
import sys
from PIL import Image
def main():
f = open(sys.argv[1], 'rb')
data = f.read()
f.close()
use_bits = True
BYTESPERLINE = 128
BITSPERLINE = BYTESPERLINE * 8
if use_bits:
width = BITSPERLINE
height = (len(data) * 8 + BITSPERLINE - 1) / BITSPERLINE
else:
width = BYTESPERLINE
height = (len(data... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Classes to read, validate and work with the input data files.
"""
import logging
from collections import OrderedDict
from pathlib import Path
import urllib.parse
from astropy.table import Table
from .info import gammacat_info
from .utils import load_ya... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2019 David Arroyo Menéndez
# Author: David Arroyo Menéndez <[EMAIL]>
# Maintainer: David Arroyo Menéndez <[EMAIL]>
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# th... |
"""
Computational Neurodynamics
Exercise 1
Simulates Izhikevich's neuron model using the Runge-Kutta 4 method.
Parameters for regular spiking, fast spiking and bursting
neurons extracted from:
http://www.izhikevich.org/publications/spikes.htm
(C) Murray Shanahan et al, 2015
"""
import numpy as np
import matplotlib.... |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... |
# Copyright 2017 Google 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 applicable law or agreed to in writing, ... |
import logging
from functools import wraps
from copy import deepcopy
from pyhooker.func_utils import build_extensive_kwargs
from pyhooker.loading import load_obj
__author__ = 'sighalt'
logger = logging.getLogger(__name__)
_registry = {}
def register(interface, implementation, auto_load=False, call=True):
"""Re... |
#
# Martin Kolman <[EMAIL]>
#
# Copyright 2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
# General Public License v.2. This program is distributed in the hope that it
# will be useful, but WI... |
#!/usr/bin/python
#
# (c) 2018, Yanis Guenane <[EMAIL]>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['pr... |
#!/usr/bin/env python
'''======================================================
Created by: D. Spencer Maughan
Last updated: November 2014
File name: generic_trajectory.py
Organization: RISC Lab, Utah State University
======================================================'''
import rosli... |
from django.utils.decorators import method_decorator
from corehq import privileges
from corehq.apps.accounting.decorators import requires_privilege_with_fallback
from corehq.apps.reports.dispatcher import ReportDispatcher, ProjectReportDispatcher, datespan_default
from corehq.apps.users.decorators import require_permis... |
#!/usr/bin/env python
from __future__ import print_function
"""
test_mkdir.py
test product, combine, permute, combine_with_replacement
"""
import os
tempdir = os.path.relpath(os.path.abspath(os.path.splitext(__file__)[0]))
import os
import sys
# add grandparent to search path for testing
grandparent_d... |
from __future__ import print_function
# Author: Mihai Tudor Panu <[EMAIL]>
# Copyright (c) 2014 Intel Corporation.
#
# 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, inclu... |
""" Python for System Administrators
Gathering System Data with multiplatform
and platform-dependent tools like command
line output and files.
"""
#
# Our code is p3-ready
#
from __future__ import print_function
def grep(needle, fpath):
"""A simple grep implementation
goal: open() is itera... |
# Copyright (C) 2016 Swift Navigation Inc.
#
# Contact: Valeri Atamaniouk <[EMAIL]>
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# E... |
# -*- coding: utf-8 -*-
# Copyright (C) 2007, 2008 Toms Bauģis <toms.baugis at gmail.com>
# This file is part of Project Hamster.
# Project Hamster 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 ver... |
"""
Identifier for course resources.
"""
from __future__ import absolute_import
import logging
import inspect
from abc import ABCMeta, abstractmethod
from bson.objectid import ObjectId
from bson.errors import InvalidId
from xmodule.modulestore.exceptions import InsufficientSpecificationError, OverSpecificationError
... |
# Copyright (c) 2016 PaddlePaddle 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 applic... |
# Copyright (c) 2021 PaddlePaddle 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 app... |
# -*- coding: utf-8 -*-
u"""pkconfig to_environ() test
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
def test_to_environ(pkconfig_setup):
pkconfig = p... |
# -*- coding: UTF-8
""" Provides cool stories for your chat
Packages
========
parser -- External stories sources parsers
Modules
=======
model -- Plugin logic impl
"""
import random
import threading
from dewyatochka.core import plugin
from dewyatochka.core.plugin.exceptions import PluginError
from . impor... |
# Futures #
from __future__ import division
# Built-in modules #
import os, sys, gzip, tempfile, shutil
from itertools import izip
# Internal modules #
from gefes.common import average
from gefes.common.cache import property_cached
# Third party modules #
import sh
from Bio import SeqIO
############################... |
import numpy as np
from pySDC.implementations.collocation_classes.gauss_legendre import CollGaussLegendre
from pySDC.implementations.controller_classes.controller_nonMPI import controller_nonMPI
from pySDC.implementations.problem_classes.Boussinesq_2D_FD_imex import boussinesq_2d_imex
from pySDC.implementations.proble... |
# Copyright 2015 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... |
import prody as protein
import numpy as np
import matplotlib as pl
import os
'''
Background: It will be much easier to use 4*4 matrix instead of 3*3 matrix to do transformation.
This will help when the program needs to judge whether the ligand is in rotated boxes, (in case of loss of information)
To be simple , all m... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
"""
Tests for wiki permissions
"""
from django.contrib.auth.models import Group
from wiki.models import URLPath
from course_wiki import settings
from course_wiki.utils import course_wiki_slug, user_is_article_course_staff
from course_wiki.views import get_or_create_root
from lms.djangoapps.courseware.tests.factories... |
#!/usr/bin/env python3
'''
KLL Kiibohd .h/.c File Emitter
'''
# Copyright (C) 2016-2020 by Jacob Alexander
#
# This file 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
# (... |
#!/usr/bin/python
# This script generates the unit test coverage report for openbmc project.
#
# Usage:
# get_unit_test_report.py target_dir [url_file]
#
# Positional arguments:
# target_dir Target directory in pwd to place all cloned repos and logs.
# url_file Text file containing url of repositories. Optional.
#... |
from livesettings import *
from django.utils.translation import ugettext_lazy as _
# this is so that the translation utility will pick up the string
gettext = lambda s: s
PAYMENT_GROUP = ConfigurationGroup('PAYMENT_DUMMY',
_('Payment Test Module Settings'),
ordering = 100)
config_register_list(
BooleanVa... |
# -*- encoding: utf-8 -*-
from supriya.tools.synthdeftools.CalculationRate import CalculationRate
from supriya.tools.ugentools.MultiOutUGen import MultiOutUGen
class BeatTrack(MultiOutUGen):
r'''Autocorrelation beat tracker.
::
>>> source = ugentools.SoundIn.ar(bus=0)
>>> pv_chain = ugentool... |
# -*- coding: utf-8 -*-
#
# 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
#... |
""" Python Character Mapping Codec generated from '8859-11.TXT' with gencodec.py.
Generated from mapping found in
ftp://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-11.TXT
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charm... |
# Copyright (c) 2015-2020 Contributors as noted in the AUTHORS file
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# System imports
import logging # noqa: F401
impo... |
#
# pyquaero - a Python library for Aquaero fan controllers
#
# Copyright (C) 2014 Richard "Shred" Körber
# https://github.com/shred/pyquaero
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Found... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ar'
import os
import app
import logging
import app.backend
import argparse
import app.core.utils as utils
from app.core.dataentry_v1 import DBWatcher
from app.core.utils.report import RunnerMakeReport
if __name__ == '__main__':
logging.basicConfig(level=logg... |
#!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
if os.path.exists('.env'):
print('Importing environment from .env...')
for line in open('.env'):
var = line.strip().split('=')
... |
# 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 use ... |
#!/usr/bin/python
"""
Functions to prevent spam by ignoring ip and subject combinations which occur too frequently, and are likely to be from spammers or bots, etc.
Based on concept described by Paul Tyma: http://mailinator.blogspot.com/2007/01/architecture-of-mailinator.html
"""
import time
ip_hash = {} # k=... |
import logging
from django.db.models import Count, Avg, F
import caching.base as caching
from olympia.addons.models import Addon
from olympia.amo.celery import task
from olympia.amo.decorators import write
from .models import Review, GroupedRating
log = logging.getLogger('z.task')
@task(rate_limit='50/m')
@write... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
import_cesi_2_csv.py
~~~~~~~~~~~~~~~~~~~~
Convert csv file into insert statements for loading into the releves database.
The CSV filename should be in the form NAME_YYYY-MM.csv.
The CSV file should be in this format
Day;Morning hour;Sensor... |
#!/usr/bin/env python
"""
This class is a container for sysreport report object.
@author : Shane Bradley
@contact : [EMAIL]
@version : 2.17
@copyright : GPLv2
"""
import string
import os.path
import logging
import re
import sx
from sx.reports import Report
from sx.extractors.tarextractor import Tarextracto... |
# !/usr/bin/python
import sys
import utility
if len(sys.argv) < 2:
print "Usage:",sys.argv[0],"cdif-input-file"
sys.exit(64)
fileName=sys.argv[1]
annotations = {}
classDict = utility.initializeClassDictionary()
invEntDict = utility.initializeInvokableEntityDictionary()
#methDict =
##
# a two-phase approach:
#... |
# Some examples of reading text files with different options
#
# The file sample.txt is a UTF-8 encoded text file with Windows
# line-endings (\r\n).
# (a) Reading a basic text file (UTF-8 default encoding)
print("Reading a simple text file (UTF-8)")
with open('sample.txt', 'rt') as f:
for line in f:
prin... |
from proteus import *
from proteus.default_p import *
from proteus.mprans import Dissipation
from proteus import Context
ct = Context.get()
domain = ct.domain
nd = domain.nd
LevelModelType = Dissipation.LevelModel
if ct.useOnlyVF:
RD_model = None
LS_model = None
dissipation_model = 3
ME_model = 2
else:... |
import numpy as np
import unittest
from ..aux_readers import ARM_JWD_Reader
class TestArmJwdReader(unittest.TestCase):
"Test module for the ARM_JWD_Reader"
def setUp(self):
filename = "testdata/sgpdisdrometerC1.b1.20110427.000000_test_jwd_b1.cdf"
self.dsd = ARM_JWD_Reader.read_arm_jwd_b1(fil... |
"""Test the cea.config.Configuration()"""
import unittest
import pickle
import os
import tempfile
import cea.config
class TestConfiguration(unittest.TestCase):
def test_can_be_pickled(self):
config = cea.config.Configuration()
config = pickle.loads(pickle.dumps(config))
self.assertIsNo... |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import pyauto_functional # Must be imported before pyauto
import pyauto
class ChromeosTime(pyauto.PyUITest):
""... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2010-2012 Asidev s.r.l.
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 b... |
import json
import os
import subprocess
from coveralls import Coveralls
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
NONUNICODE_DIR = os.path.join(BASE_DIR, 'nonunicode')
def test_non_unicode():
os.chdir(NONUNICODE_DIR)
subprocess.call(['coverage', 'run', 'nonunicode.py'], cwd=NON... |
import datetime
import logging
from datetime import timedelta
from django import forms
from django.core.validators import ValidationError
from django.db.models import Q
from django.forms import widgets
from django.utils.translation import get_language
import happyforms
import jinja2
from tower import ugettext as _, u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.