src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2012-2014 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... |
# -*- coding:utf-8 -*-
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.shortcuts import redirect
#导入跳转连接模块
from django.http.response import HttpResponse
#导入模块该模块可以加载处理html网页
from manager import models
from models import UserInfo
from models import Asset
from models import... |
# -*- coding: UTF-8 -*-
#! python3
"""
Isogeo API v1 - Model of Metadata (= Resource) entity
See: http://help.isogeo.com/api/complete/index.html#definition-resource
"""
# #############################################################################
# ########## Libraries #############
# #####################... |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... |
################################################################################
# Copyright (C) 2015 OpenELEQ #
# #
# This Program is free software; you can redistribute it and/or modify ... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
"""
给定一个无序数组arr,求出需要排序的最短子数组长度。
例如:
arr=[1, 5, 3, 4, 2, 6, 7],返回4,因为只有[5, 3, 2, 4]需要排序。
"""
class ShortestSubarr:
@classmethod
def get_shortest_subarr(cls, arr):
if not arr or len(arr) == 1:
return 0
length = len(arr)
max_index = -1
index = length - 1
min_va... |
from influxdb_metrics.loader import write_points
from karrot.groups.stats import group_tags
def activity_tags(activity):
tags = group_tags(activity.place.group)
tags.update({
'place': str(activity.place.id),
})
return tags
def activity_joined(activity):
write_points([{
'measurem... |
import io
from enum import Enum
from pathlib import Path
from uuid import UUID
import pytest
from Pegasus.json import dump_all, dumps, load_all, loads
class _Color(Enum):
RED = 1
class _Html:
def __html__(self):
return "html"
class _Json:
def __json__(self):
return "json"
@pytest.m... |
#!/usr/bin/env python2
# transpiled with BefunCompile v1.3.0 (c) 2017
import sys
import zlib, base64
_g = ("Ah+LCAAAAAAABADtmVc4nG/378eM3vuI3oIUDBmjRY/eJaL3SHRGLzEE0UWCJKJEjQhiCBGd0aJGDZMYwahRRtTBGLZf+R+8Z/vk3de1r73vk/u71vo833U/1zpcfCmU"
+ "gL8OKWAbM59ivxbUuxvlKvhD3K3C+tanWiVKJkibLzKHRuD1K34xKraiw5eZHW1CNz5pT5yFjsp7... |
# -*- 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 os
import time
import pytz
import datetime
import requests
import threading
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import matplotlib.dates as mdates
SECOND = 1
MINUTE = 60 * SECOND
HOUR = 60 * MINUTE
DAY = 24 * HOUR
WEEK = 7 * DAY
MONTH = 31 * DAY
YEAR = 365 *... |
#!/usr/bin/env python3
# Copyright (c) 2018-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the Partially Signed Transaction RPCs.
"""
from decimal import Decimal
from test_framework.test_f... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Model.hidden'
db.add_column('blogs_model', 'hidden',
self.gf('django.d... |
import distribute_setup
distribute_setup.use_setuptools()
from setuptools import setup, find_packages
setup(
name='yapga',
version='1',
packages=find_packages(),
# metadata for upload to PyPI
author='Austin Bingham',
author_email='austin.bingham@gmail.com',
description="Yet Another Python... |
"""
My Process Execution Library
"""
import os
import time
import Queue
import platform
import threading
import subprocess
NewLine = '\n'
if platform.system() == 'Windows':
NewLine = '\r\n'
def queue_output(out, queue):
"""Queue output"""
for line in iter(out.readline, b''):
queue.put... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
import numpy as np
import warnings
from affine import Affine
from shapely.geometry import shape
from .io import read_features, Raster
from .utils import (rasterize_geom, get_percentile, check_stats,
remap_... |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design 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:
#
# * Red... |
from tests import BaseTest
from mock import patch
import dns
from resolverapi.util.dns_query import parse_query
TEST_DOMAIN = 'testdomain.com.'
def make_answer(rdtype, answers=None, additionals=None, authorities=None):
"""For mocking an answer. We make an answer without any message (what would
normally co... |
"""Support for Genius Hub sensor devices."""
from datetime import timedelta
from typing import Any, Awaitable, Dict
from homeassistant.const import DEVICE_CLASS_BATTERY
from homeassistant.util.dt import utc_from_timestamp, utcnow
from . import DOMAIN, GeniusEntity
GH_HAS_BATTERY = ["Room Thermostat", "Genius Valve",... |
"""
Test 2.
"""
from pyquery import PyQuery as pq
from lxml import etree
import urllib
import pprint
def parser(d):
p = d(".current .menu-day-content").items()
for each in p:
thing = str(each.html())
thing2 = thing.replace("\t", "").strip()
lst = thing2.split("\n")
lst2 = []
for item in lst:
if len(i... |
import chainer
import numpy
import pytest
import chainerx
import chainerx.testing
from chainerx_tests import array_utils
from chainerx_tests import dtype_utils
from chainerx_tests import math_utils
from chainerx_tests import op_utils
_in_out_dtypes_arithmetic_invalid = [
(('bool_', 'bool_'), 'bool_'),
(('bo... |
""" test the scalar Timedelta """
import pytest
import numpy as np
from datetime import timedelta
import pandas as pd
import pandas.util.testing as tm
from pandas.core.tools.timedeltas import _coerce_scalar_to_timedelta_type as ct
from pandas import (Timedelta, TimedeltaIndex, timedelta_range, Series,
... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.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, eithe... |
# -*- coding: iso-8859-15 -*-
#
# Copyright 2017 Mycroft AI Inc.
#
# 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 appli... |
"""Core visualization operations."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# Joan Massich <mailsik@gmail.com>
# Guillaume Favelier <guillaume.favelier@gmail.com>
#
# License: Simplified BSD
from contextlib import contextmanager
i... |
"""
Data structure for 1-dimensional cross-sectional and time series data
"""
from __future__ import division
# pylint: disable=E1101,E1103
# pylint: disable=W0703,W0622,W0613,W0201
import types
import warnings
from numpy import nan, ndarray
import numpy as np
import numpy.ma as ma
from pandas.core.common import (i... |
#!/usr/bin/env python
from fortuneengine.GameEngine import GameEngine
from LemonadeMain import LemonadeMain
from LemonadeGui import LemonadeGui
from optparse import OptionParser
from pygame import font
parser = OptionParser()
parser.add_option("", "--width", dest="width", help="window width",
metav... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b on 2019-05-07.
# 2019, SMART Health IT.
import os
import io
import unittest
import json
from . import imagingstudy
from .fhirdate import FHIRDate
class ImagingStudyTests(unittest.TestCase):
def instantiate_from(self, filena... |
# 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 may ... |
# -*- coding: ms949 -*-
import re
import json
#text file read
with open('GutindexAll.txt','r') as gutinfile:
data=gutinfile.read()
data=unicode(data, errors='replace')
result = []
isStart = False
for line in data.splitlines():
#if 'by': #line¿¡ ÀúÀÚ°¡ ÀÖ´Â °æ¿ì¿Í ŸÀÌÆ²¸¸ Àִ°æ¿ì¸¦ ±¸ºÐÇØ¾ßÇÒµí
if i... |
import threading
class ReadWriteLock:
"""A lock object that allows many simultaneous "read-locks", but
only one "write-lock"."""
def __init__(self):
self._read_ready = threading.Condition(threading.Lock())
self._readers = 0
def acquire_read(self):
"""Acquire a read-lock. B... |
#!/usr/bin/python
import hashlib, re, sys, os, base64, time, random, hmac
import ripemd
### Elliptic curve parameters (secp256k1)
P = 2**256-2**32-2**9-2**8-2**7-2**6-2**4-1
N = 115792089237316195423570985008687907852837564279074904382605163141518161494337
A = 0
B = 7
Gx = 55066263022277343669578718895168534326250603... |
""" (disabled by default) support for testing pytest and pytest plugins. """
import gc
import sys
import traceback
import os
import codecs
import re
import time
import platform
from fnmatch import fnmatch
import subprocess
import py
import pytest
from py.builtin import print_
from _pytest.main import Session, EXIT_OK... |
import pandas as pd
import numpy as np
import json
from unidecode import unidecode
def extract_domain(url):
# extract domains
domain = url.lower().split('/')[2]
domain_parts = domain.split('.')
# e.g. co.uk
if domain_parts[-2] not in ['com', 'co']:
return '.'.join(domain_parts[-2:])
e... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2015 Kitware Inc.
#
# 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 cop... |
from copy import deepcopy
import logging
from mission_report import parse_mission_log_line
from mission_report.constants import COUNTRIES_COALITION_DEFAULT, COALITION_ALIAS
from stats.models import PlayerOnline, Profile
logger = logging.getLogger('online')
_countries = deepcopy(COUNTRIES_COALITION_DEFAU... |
from unittest import TestCase
from nose.tools import assert_equal, assert_true
from tests.factories import KalibroModuleFactory
from tests.helpers import not_raises
class TestKalibroModule(TestCase):
def setUp(self):
self.subject = KalibroModuleFactory.build()
def test_properties_getters(self):
... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# This exploit template was generated via:
# $ pwn template
from pwn import *
# Set up pwntools for the correct architecture
context.update(arch='i386')
exe = '/problems/handy-shellcode_4_b724dbfabf610aaa4841af644535be30/vuln'
# Many built-in settings can be controlled o... |
#!/usr/bin/env python
def initiate():
box.append([0, 1, 2, 9, 10, 11, 18, 19, 20])
box.append([3, 4, 5, 12, 13, 14, 21, 22, 23])
box.append([6, 7, 8, 15, 16, 17, 24, 25, 26])
box.append([27, 28, 29, 36, 37, 38, 45, 46, 47])
box.append([30, 31, 32, 39, 40, 41, 48, 49, 50])
box.append([33, ... |
import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer
import pandas as pd
from pandas import Series, Timestamp, date_range, isna
import pandas._testing as tm
def test_where_unsafe_int(sint_dtype):
s = Series(np.arange(10), dtype=sint_dtype)
mask = s < 5
s[mask] = range(2, 7)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The experiment with 10 Hz/5Hz, wisp, attention, 70, cA 5, delta, theta, alpha low, alpha high, beta low, beta high, batch size = 1 and
balanced data set
@author: yaric
"""
import experiment as ex
import config
from time import time
n_hidden = 5
batch_size = 1
expe... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, unicode_literals, absolute_import
def parse_paravision_date(pv_date):
"""Convert ParaVision-style datetime string to Python datetime object.
Parameters
----------
pv_date : str
ParaVision datetime string.
Returns
-------
`datetime.d... |
# Copyright (C) 2006-2007 Aren Olson
# 2011 Brian Parma
#
# 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, or (at your option)
# any later version.
#
# This p... |
"""Test code for binary neural network operators."""
import numpy as np
import tvm
import topi
from topi.util import get_const_tuple
from tvm.contrib.pickle_memoize import memoize
def verify_binary_dense(batch, in_dim, out_dim):
A = tvm.placeholder((batch, in_dim), name='A')
B = tvm.placeholder((out_dim, in_d... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or impli... |
"""
Module that tests various deployment functionality
To run me from command line:
cd automaton/tests
export PYTHONPATH=$PYTHONPATH:../
python -m unittest -v deployment_tests
unset PYTHONPATH
I should have used nose but
"""
import unittest
from lib import util
from deployment import common
class test_deployment_... |
colorAvailable = False
loglevel_colors = None
verbose = False
try:
import colorama
from colorama import Fore
colorama.init()
loglevel_colors = [Fore.RED, Fore.YELLOW, Fore.BLUE, Fore.MAGENTA]
colorAvailable = True
except:
pass
loglevel_sz = ["[!!]", "[??]", "[ii]", "[vv]"]
class Logging:
... |
from typing import List, DefaultDict, Generic, TypeVar, Dict, NamedTuple
import time
import os
import logging
import concurrent
import asyncio
from aiohttp import web
import kubernetes_asyncio as kube
from gear import setup_aiohttp_session, web_authenticated_developers_only, rest_authenticated_users_only
from hailtop.c... |
'''
Created on Dec 7, 2015
@author: jumbrich
'''
import hashlib
import requests
from StringIO import StringIO
import os
import urllib
import urlnorm
from werkzeug.exceptions import RequestEntityTooLarge
from pyyacp.yacp import YACParser
from csvengine.utils import assure_path_exists
import structlog
log =structlo... |
# Copyright 2015-2017 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... |
from unittest import TestCase
from mock import MagicMock, patch
import api.tasks.braintasks as module
from api.tasks.braintasks import BRAIN_SCAN_TASKS
from irma.common.base.exceptions import IrmaCoreError, IrmaTaskError
from irma.common.base.utils import IrmaReturnCode
class TestModuleBraintasks(TestCase):
de... |
import argparse
import stringsheet.main as ss
from . import __version__
def create(args):
ss.create(args.project_name, args.source_dir, args.multi_sheet)
def upload(args):
ss.upload(args.spreadsheet_id, args.source_dir)
def download(args):
ss.download(args.spreadsheet_id, args.target_dir)
def parse... |
import matplotlib.pyplot as plt
#stores information about laser structure
#saves refraction and electric field profiles in text and graphic form to HDD
class Laser:
refraction = []
field = []
gridX = []
gridN = []
field = []
def __init__(self, (wavelength, concentration, thickness... |
"""Utilities for writing code that runs on Python 2 and 3"""
# flake8: noqa
# Copyright (c) 2010-2013 Benjamin Peterson
#
# 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,... |
import random
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext as _
from django_extensions.db.fields import ModificationDateTimeField, CreationDateTimeField
from djchoices import DjangoChoices, ChoiceItem
from .mails import mail_new_voucher
class VoucherStatu... |
# -*- encoding: utf-8 -*-
from supriya.tools import osctools
from supriya.tools.requesttools.Request import Request
class BufferGetRequest(Request):
r'''A /b_get request.
::
>>> from supriya.tools import requesttools
>>> request = requesttools.BufferGetRequest(
... buffer_id=23,
... |
# Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... |
from Plugins.Plugin import PluginDescriptor
from Screens.Console import Console
from Screens.ChoiceBox import ChoiceBox
from Screens.MessageBox import MessageBox
from Screens.Screen import Screen
from Screens.Standby import TryQuitMainloop
from Screens.Ipkg import Ipkg
from Components.ActionMap import ActionMap, Number... |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""Module contains classes presenting Element and Specie (Element + oxidation state) and PeriodicTable."""
import re
import json
import warnings
from io import open
from pathlib import Path
from enum import En... |
"""
Tunnel and connection forwarding internals.
If you're looking for simple, end-user-focused connection forwarding, please
see `.Connection`, e.g. `.Connection.forward_local`.
"""
import errno
import select
import socket
import time
from threading import Event
from invoke.exceptions import ThreadException
from inv... |
#
# 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
# ... |
#!/usr/bin/env python
"""
This is an Ansible dynamic inventory for OpenStack.
It requires your OpenStack credentials to be set in clouds.yaml or your shell
environment.
"""
from __future__ import print_function
from collections import Mapping
import json
import os
import shade
def base_openshift_inventory(cluste... |
# -*- coding: utf-8 -*-
import re
def clean_string(string):
r"""Discard newlines, remove multiple spaces and remove leading or
trailing whitespace. We also replace quotation mark characters
since we've decided to use a different style (though usually
quotes are marked with <ctl>).
Note since this ... |
import time
import eventlet
import subprocess
from oslo.config import cfg
from oslo.utils import units
from nova import exception
from nova.compute import power_state
from nova.openstack.common import log as logging
from nova.virt.jacket.vcloud import constants
from nova.virt.jacket.vcloud.vcloud import exceptions
fro... |
import math
import random
import operator
import numpy as np
class Perceptron:
'''
Implements the Perceptron Learning Algorithm
fields:
int dim Dimensionality of the data
List weights Array (dim+1 x 1) of the weights
List data Array (N x 1) of tuples (x, y) composed of vectors x and results y=f(x)
int ite... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
from datetime import datetime
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from markdown import markdown
import bleach
from flask import current_app, request, url_for
from flask.ext.login import UserMixin,... |
import etcd
import json
import threading
import time
from tendrl.commons import sds_sync
from tendrl.commons.utils import etcd_utils
from tendrl.commons.utils import log_utils as logger
from tendrl.monitoring_integration.graphite import graphite_utils
from tendrl.monitoring_integration.graphite import GraphitePlugin
f... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY = "\2\1thisismyscretkey\1\2\e\y\y\h"
OPENID_PROVIDERS = [
{"name": "Google", "url": "https://www.google.com/accounts/o8/id"},
{"name": "Yahoo", "url": "https://me.yahoo.com"},
{"name": "AOL", "url": "http://open... |
from dateutil.relativedelta import relativedelta
from django import forms
from edc_constants.constants import YES
from td_maternal.models.enrollment_helper import EnrollmentHelper
from ..models import AntenatalEnrollment, MaternalEligibility
from .base_enrollment_form import BaseEnrollmentForm
class AntenatalEnro... |
# 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
# d... |
import pipes
import os
import string
import unittest
from test.support import TESTFN, run_unittest, unlink, reap_children
if os.name != 'posix':
raise unittest.SkipTest('pipes module only works on posix')
TESTFN2 = TESTFN + "2"
# tr a-z A-Z is not portable, so make the ranges explicit
s_command = 'tr... |
import re
import os
values = {
# 'uc': 'Grissom',
'lc': 'mutara',
'header': 'Michroma',
'body': 'Play',
'website': 'mavek_org',
# 'cl': '#116BB7',
}
def main():
src = 'cyborg'
cmd = 'cp -r {0}/* {1}'.format(src, values['lc'])
os.system(cmd)
infile = "{0}/bootsw... |
from model.contact import Contact
import random
def test_edit_contact(app, db, check_ui):
app.open_home_page()
if app.contact.count() == 0:
app.contact.create(Contact(firstname="Contact", lastname="", nickname="",
address="", company="", home="",
... |
import unittest
import javabridge
from javabridge import JavaException, is_instance_of
import numpy as np
from TASSELpy.TASSELbridge import TASSELbridge
try:
try:
javabridge.get_env()
except AttributeError:
print("AttributeError: start bridge")
TASSELbridge.start()
except AssertionEr... |
"""Display details for a specified volume."""
# :license: MIT, see LICENSE for more details.
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer import utils
@click.command()
@click.argument('volume_id')
@environment.pass_env
def cli(env, volume_id)... |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 24 11:02:14 2016
@author:Zhao Cheng
"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import configparser
class SqlalchemyDB(object):
def __init__(self, sqlalchemycfg='sqlalchemydb.cfg'):
self.sqlalchemycfg = sqlalchemycfg
... |
#
# Copyright John Reid 2013
#
"""
Example to illustrate application of pybool. Based on regulatory network in paper
on robustness under functional constraint by Nakajima et al.
"""
import numpy as N, logging
from pybool.constraints import gene_off, gene_on
from pybool import network, constraints
class MetaData(c... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0010_change_on_delete_behaviour'),
('core', '0019_add_tags_to_article'),
]
... |
"""functions that send email in askbot
these automatically catch email-related exceptions
"""
from django.conf import settings as django_settings
DEBUG_EMAIL = getattr(django_settings, 'ASKBOT_DEBUG_INCOMING_EMAIL', False)
import logging
import os
import re
import smtplib
import sys
from askbot import exceptions
from ... |
import time
import sys
import os
from PIL import Image
import numpy as np
import lasagne as nn
import theano
import theano.tensor as T
import h5py
from fuel.datasets.hdf5 import H5PYDataset
from fuel.schemes import ShuffledScheme, SequentialScheme
from fuel.streams import DataStream
# runs training loop, expects dat... |
##!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Code PyQt4
In this example, we create a simple
window in PyQt4.
"""
from PyQt4 import QtCore, QtGui
class MyWindow(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.button1 = QtGui.QPushButton(u"Кнопка 1. Нажм... |
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
This file is part of MyServerTalks.
MyServerTalks 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... |
# -*- coding: utf-8 -*-
# 14-8-8
# create by: snower
'''
MySQL asynchronous client.
'''
from . import platform
from .util import async_call_method
from .connections import Connection
from .cursor import Cursor
from .util import py3
class Client(object):
def __init__(self, *args, **kwargs):
self._args = ... |
# -*- coding: utf-8 -*-
"""The gzip file path specification resolver helper implementation."""
# This is necessary to prevent a circular import.
import dfvfs.file_io.gzip_file_io
import dfvfs.vfs.gzip_file_system
from dfvfs.lib import definitions
from dfvfs.resolver import resolver
from dfvfs.resolver import resolver... |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.http import HttpResponseRedirect
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^accoun... |
import os
import random
import getpass
import time
os.system('clear')
def encode(klartext):
'''
Create a random One-Time-Pad and encode the input strings
'''
laengeKlartext = len(klartext)
key = ''
keyArray = []
klartextArray = list(klartext)
geheimtextArray = []
geheimtext = ''
alphabet = []
for i in ran... |
"""
Convert an RDF graph into an image for displaying in the notebook, via GraphViz
It has two parts:
- conversion from rdf into dot language. Code based in rdflib.utils.rdf2dot
- rendering of the dot graph into an image. Code based on
ipython-hierarchymagic, which in turn bases it from Sphinx
See https://... |
import json
# Third-Party
from model_utils import Choices
from distutils.util import strtobool
# Local
from apps.bhs.models import Convention, Award, Chart, Group, Person
from apps.registration.models import Contest, Session, Assignment, Entry
class SfConvention:
def parse_sf_notification(n):
d = {}
... |
import requests
import datetime
import sys
class BruteForceService(object):
def __init__(self, _listpass, _url, _user, _quote):
self._listpass = _listpass
self._url = _url
self._user = _user
self._quote = _quote
def bruteForce(self):
fpass = open(_listpa... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from djangocms_text_ckeditor.models import Text
from django.contrib.admin.sites import site
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser, Group, Permission
from django.contrib.sites.models import Site
f... |
"""Convert data to TFRecords file format with example protos. An Example is a mostly-normalized data format for
storing data for training and inference. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tensorflow as tf
from tensorflow.... |
import ast
import os
import sys
import trace
import unittest
class ASTTest(unittest.TestCase):
def setUp(self, filename, parse_file=True):
"""Stores the raw text of the student submission, the lines that were
printed when executing the student submission, and the AST tree of the
submission... |
import abc
import base64
import re
class StringOrPattern(object):
"""
A decorator object that wraps a string or a regex pattern so that it can
be compared against another string either literally or using the pattern.
"""
def __init__(self, subject):
self.subject = subject
def __eq__(s... |
# -*- coding:Utf-8 -*-
#!/usr/bin/env python
import sys
import os
from math import sqrt
import lxml.etree
from io import StringIO
from math import pi
import time
from operator import attrgetter
BORNE_INF_MODIF = 1.
BORNE_SUP_MODIF = 10.
NB_ZONE_USER = 500
class Point:
"""Définition d'un point.
Attributs ... |
#
import platform as p
def main():
print("platform.architecture: {}".format(p.architecture()));
print("platform.machine: {}".format(p.machine()));
print("platform.node: {}".format(p.node()));
print("platform.processor: {}".format(p.processor()));
print("platform.python_build: {}".f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Eduard Trott
# @Date: 2015-09-07 14:59:52
# @Email: etrott@redhat.com
# @Last modified by: etrott
# @Last Modified time: 2015-10-05 11:03:49
from setuptools import setup
VERSION_FILE = "clicktrack/_version.py"
VERSION_EXEC = ''.join(open(VERSION_FILE).read... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.