src stringlengths 721 1.04M |
|---|
#
# 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... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the output module interface."""
import unittest
from plaso.output import manager
from tests.cli import test_lib as cli_test_lib
from tests.output import test_lib
class TestEvent(object):
"""Test event object."""
def __init__(self, timestamp, entry):
"... |
"""
===========================================================
Hierarchical clustering: structured vs unstructured ward
===========================================================
Example builds a swiss roll dataset and runs
hierarchical clustering on their position.
For more information, see :ref:`hierarchical_clus... |
# -*- coding: utf-8 -*-
from aero.__version__ import __version_info__
__author__ = 'nickl-'
from .base import CommandProcessor as CommandProcessor
class InstallCommand(CommandProcessor):
from .base import coroutine
package = ''
adapter = ''
def wiring(self):
self.out = self.write()
... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... |
# Copyright 2021, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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... |
"""
选取发布时间为2018年的文章,并对其进行月份统计
"""
import numpy as np
import pandas as pd
from pyecharts import Bar
df = pd.read_csv('sg_articles.csv', header=None, names=["title", "article", "name", "date"])
list1 = []
list2 = []
for j in df['date']:
# 获取文章发布年份及月份
time_1 = j.split('-')[0]
time_2 = j.split('-')[1]
lis... |
# -*- coding: utf-8 -*-
from django.db import models
from .validators import validate_printable
import os
class JobSession(models.Model):
status = models.CharField(max_length=3000)
all_status = models.CharField(max_length=48000)
attachedfile = models.FileField(
upload_to='imprimo',
... |
"""Test letsencrypt.client.revoker."""
import csv
import os
import pkg_resources
import shutil
import tempfile
import unittest
import mock
from letsencrypt.client import errors
from letsencrypt.client import le_util
from letsencrypt.client.plugins.apache import configurator
from letsencrypt.client.display import util... |
from collections import namedtuple
from vector3 import Vec3, dot
from math import sqrt
from ray import Ray
HitRecord = namedtuple("HitRecord", ['t', 'p', 'normal', 'material'])
class Hitable:
def hit(self, ray_, t_min, t_max):
"""
Determine if the ray will hit the object
:param ray_:
... |
#!/usr/bin/env python
#
import sys
import time
import math
import struct
debug =0
if sys.version_info<(3,0):
p_version=2
else:
p_version=3
if sys.platform == 'uwp':
import winrt_smbus as smbus
bus = smbus.SMBus(1)
else:
import smbus
import RPi.GPIO as GPIO
rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
... |
import os
import pytest
from utils import (
POSTGRES_HOST,
POSTGRES_PORT,
POSTGRES_USER,
POSTGRES_PASSWORD,
create_db,
db_connection,
drop_tables,
)
import pgcli.pgexecute
@pytest.fixture(scope="function")
def connection():
create_db("_test_db")
connection = db_connection("_test_db... |
# Copyright 2014 Open Source Robotics Foundation, 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 applicable law or ... |
"""Tools for creating and definding againts adversarial examples.
"""
# third party imports
import numpy as np
# Toolbox imports
from ..datasource import Datasource
from .tool import Tool
from .classifier import Classifier, ClassIdentifier
class Attacker(Tool):
# pylint: disable=too-many-ancestors
"""An a... |
# -*- coding: utf-8 -*-
#
# django-ldapdb
# Copyright (c) 2009-2011, Bolloré telecom
# All rights reserved.
#
# See AUTHORS file for a full list of contributors.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1... |
import json
import numpy as np
import pandas as pd
def get_json_data(filename):
with open(filename) as data_file:
return json.load(data_file)
class Batch():
def __init__(self, data, batch_size=None):
self.data = np.array(data)
self.batch_size = batch_size
self.shuffle().split(... |
# Copyright 2018 DeepMind Technologies Limited. 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... |
import numpy as np
import matplotlib.pyplot as plt
data1 = np.loadtxt("expect_random_T1.00.dat")
data2 = np.loadtxt("expect_ordered_T1.00.dat")
data3 = np.loadtxt("expect_random2_T2.40.dat")
data4 = np.loadtxt("expect_ordered2_T2.40.dat")
values1 = data1[0::1]
values2 = data2[0::1]
values3 = data3[0::1]
values4 = data... |
# Copyright (c) 2010-2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 3 17:24:04 2015
@author: Sean
"""
import rppy
import numpy as np
import matplotlib.pyplot as plt
p1 = 2000
vp1 = 3000
vs1 = 1500
e1 = 0.0
d1 = 0.0
y1 = 0.0
p2 = 2200
vp2 = 4000
vs2 = 2000
y2 = 0.1
d2 = 0.1
e2 = 0.1
theta = 30
phi = np.arange(0, 90, 1)
phit = np.arra... |
# importing libraries:
import maya.cmds as cmds
from Library import dpUtils as utils
import dpBaseClass as Base
import dpLayoutClass as Layout
# global variables to this module:
CLASS_NAME = "FkLine"
TITLE = "m001_fkLine"
DESCRIPTION = "m002_fkLineDesc"
ICON = "/Icons/dp_fkLine.png"
class FkLine(Base.StartClas... |
from __future__ import absolute_import
import unittest
import gi.docstring
from gi.repository import Regress
from gi.repository import GIMarshallingTests
from gi.repository import Gio
from gi.repository import GObject
from gi.repository import GLib
try:
from gi.repository import Gtk
except ImportError:
Gtk ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from xlpo.readers import XLSXTranslationsReader
from tests.base import BaseTestCase
import os
import unittest
class TestXLSXTranslationsReader(BaseTestCase):
def test_valid_files(self):
xlsx_file = os.... |
from watchdog.observers import Observer
from watchdog.watchmedo import observe_with
from leanpub.shellcommandtrick import ShellCommandTrick
def pandoc_cmd(book):
"""Create the command to convert the files (listed in `book`)
into a pdf. This is wrapped with echos that the build has started and
is complete... |
"""The WaveBlocks Project
This file contains the interface for general quadratures.
Do not confuse quadratures with quadrature rules! Quadrature rules
are structs containing just nodes and weights and some convenience
methods. InnerProducts are classes that really can compute things
like inner products (brakets) etc.
... |
"""Provide the functionality to group entities."""
import asyncio
import logging
import voluptuous as vol
from homeassistant import core as ha
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_ICON, CONF_NAME, STATE_CLOSED, STATE_HOME,
STATE_NOT_HOME, STATE_OFF, STATE_ON, STATE_OPEN, STATE_LOCKED,
ST... |
__author__ = 'Peter Hofmann'
__version__ = '0.1.3'
import os
import sys
from collections import Iterable
from io import StringIO
if sys.version_info < (3,):
from ConfigParser import SafeConfigParser as ConfigParser
else:
from configparser import ConfigParser
from scripts.loggingwrapper import DefaultLogging
... |
import os
from django.core.management import BaseCommand
from django.conf import settings
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument("-n","--name", type=str, dest="name", help="Name of the project. "
"This should... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from os import path
from django.core.exceptions import ImproperlyConfigured
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import models
from django.db.models import signals
from django.forms import Textarea
from django.for... |
# -*- coding: utf-8 -*-
"""
Enumerazione dei mesi di un anno rpg.
"""
from src.element import EnumElement, finalize_enumeration
#-------------------------------------------------------------------------------
name = __name__[__name__.rfind(".")+1 : ]
elements = []
cycle_on_last = True
#-------------------------... |
#Kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen, ScreenManager
from kivy.properties import ObjectProperty
from kivy.uix.gridlayout import GridLayout
from kivy.uix.tabbedpanel import TabbedPanel, TabbedPanelItem
from kivy.uix.label import Label
#IRC
import irc.cl... |
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<http://www.micronaet.it>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebrush>)
# This pro... |
import functools
from flask import request
from sqlalchemy import desc
from ._compat import httplib
from .request_utils import error_abort
def sort_query(query, allowed_fields=(), default=None):
allowed_fields = set(allowed_fields)
sort_param = request.args.get("sort", None)
if sort_param:
sort_... |
import os
import re
from setuptools import setup
VERSION = re.search(
r"VERSION\s*=\s*['\"](.*)['\"]",
open(os.path.join(os.path.dirname(__file__), 'simple_settings', '__init__.py')).read()
).group(1)
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
# allow setup.py to be run from ... |
#!/usr/bin/env python
from __future__ import print_function
import IMP.multifit
from IMP import OptionParser
__doc__ = "Write output models as PDB files."
# analyse the ensemble, first we will do the rmsd stuff
def parse_args():
usage = """%prog [options] <asmb.input> <proteomics.input>
<mapping.inpu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Basic functions, including timing, rush (imported), quit
"""
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2020 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
from __future__ import abs... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Sphinx documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 7 16:29:12 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autog... |
# horde3d_h.py
#
# Copyright 2014 Logan Perkins <perkins@lp-programming.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the Eclipse Public License 1.0
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without... |
#!/usr/bin/env python
import time
import saga
import os, sys
import subprocess
import pdb
import logging
logging.basicConfig(level=logging.ERROR)
def main():
try:
# create a job service for Futuregrid's 'india' PBS cluster
js = saga.job.Service("pbs+ssh://india")
#js = saga.job.Servi... |
# -*- coding: utf-8 -*-
__author__ = """Chris Tabor (dxdstudio@gmail.com)"""
if __name__ == '__main__':
from os import getcwd
from os import sys
sys.path.append(getcwd())
from MOAL.helpers.display import Section
from MOAL.helpers.display import prnt
from random import choice
from MOAL.languages.formal_la... |
import chainerx
from chainerx import _docs
def set_docs():
_docs_creation()
_docs_evaluation()
_docs_indexing()
_docs_linalg()
_docs_logic()
_docs_loss()
_docs_manipulation()
_docs_math()
_docs_sorting()
_docs_statistics()
_docs_connection()
_docs_normalization()
_d... |
# This macro is to reorder selected lines, so that the shortest will be
# pushed to top, the longest will go to bottom (look like a tower).
#
# The macro is useful to reorder Python's "import" lines.
#
# Author: Nguyễn Hồng Quân (ng.hong.quan@gmail.com)
import eollib
from xpcom import components
viewSvc = components.... |
#!/usr/bin/env python3
#
# Copyright (c) 2018 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
#
# This script will relocate .text, .rodata, .data and .bss sections from required files
# and places it in the required memory region. This memory region and file
# are given to this python script in the form of ... |
import asyncio
import mimetypes
from pathlib import Path
from .response import DataResponse, ResponseNotFound
@asyncio.coroutine
def index(request, writer, settings):
full_path = (Path(settings.webapp_root) / 'index.html').resolve()
with full_path.open('rb') as f:
return DataResponse(writer, data=f.... |
#!/usr/bin/env python
import argparse
import os
import re
import shutil
import sys
from ConfigParser import SafeConfigParser
PARSER = argparse.ArgumentParser(description="Import some aliases")
PARSER.add_argument('profile', help="Profile to output config for")
PARSER.add_argument('-c', '--config',
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Test CircleCI interfaces
.. moduleauthor:: Max Wu <http://maxwu.me>
"""
import unittest
import numbers
import json
from cistat import config
from cistat.model import Xunitrpt
from cistat.reqs import CircleCiReq
class CircleCiReqTest(unittest.TestCase):
def setU... |
import re
import os
import sys
from setuptools import setup, find_packages
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
def _read_long_description():
try:
import pypandoc
return pypandoc.convert('README.md', 'rst')
except ImportError:
return None
with open('nopassword/__in... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from sklearn import preprocessing
import pylab
import itertools
from line_coding import polar_nrz
import math
from scipy import signal
from scipy.integrate import simps
import numpy.matlib
from compy.bin2gray impor... |
# -*- coding: utf-8 -*-
#
# OpenLMI documentation build configuration file, created by
# sphinx-quickstart on Thu Sep 12 11:07:33 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... |
import os
import subprocess
import sys
from queue import Queue
sys.path.insert(0, ".")
import unittest
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
from bears.natural_language.AlexBear import AlexBear
from coalib.settings.Section import Section
class AlexBearTest(LocalBearTestHelper):
def setU... |
#!/usr/bin/env python3
# Copyright (c) 2015-2020 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node responses to invalid locators.
"""
from test_framework.messages import msg_getheaders, msg_... |
#!/usr/bin/env python
import sys
import rospkg
import rospy
import tf
import numpy as np
from std_msgs.msg import String, Bool
from geometry_msgs.msg import Transform, Pose, Vector3, Quaternion, Point
from lab3.msg import FrameCall
PROJECT_PATH = rospkg.RosPack().get_path('lab3')
sys.path.append(PROJECT_PATH+'/src/lab... |
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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... |
import json
from django.test import TestCase
from django.test import Client
class IndexViewTests(TestCase):
fixtures = ['seed.json']
"""
Tests for the Index app views
"""
def test_get_index(self):
"""
Test that the index page returns success
"""
client = Client()
... |
# -*- coding: utf-8 -*-
#
# ceph-deploy documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 21 09:32:42 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#... |
import numpy as np
from sklearn import datasets
from sklearn.semi_supervised import LabelPropagation
from wedc.domain.core.ml.helper import label
from wedc.domain.core.ml.graph import knn
from wedc.domain.core.data.seed import seed_vector
from wedc.infrastructure import database
from wedc.infrastructure.model.labelle... |
from collections import namedtuple
MotorModelConfig = namedtuple(
"MotorModelConfig",
[
"name",
"nominalVoltage",
"freeSpeed",
"freeCurrent",
"stallTorque",
"stallCurrent",
],
)
MotorModelConfig.__doc__ = """
Configuration parameters useful for simulating... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import re
import datetime
import unittest
from django.conf import settings, global_settings
from django.core import mail
from django.core.checks import Error
from django.core.files import temp as tempfile
from django.core.exceptions import Impr... |
from pygments.lexers import get_all_lexers, get_lexer_by_name, guess_lexer
from pygments.styles import get_all_styles
from pygments.formatters import HtmlFormatter
from pygments.util import ClassNotFound
from pygments import highlight
LEXER_LIST_ALL = sorted([(i[1][0], i[0]) for i in get_all_lexers()])
LEXER_LIST = (
... |
import sys
from fastforward.cliutil import priority
from playback.api import Horizon
def install(args):
try:
target = Horizon(user=args.user, hosts=args.hosts.split(','), key_filename=args.key_filename, password=args.password)
except AttributeError:
sys.stderr.write('No hosts found. Please usin... |
# -*- coding: utf-8 -*-
from trytond.model import fields, ModelSQL, ModelView
from trytond.pool import PoolMeta
from trytond.pyson import Eval, Bool
__all__ = ['Product', 'GiftCardPrice']
__metaclass__ = PoolMeta
class Product:
"Product"
__name__ = 'product.product'
is_gift_card = fields.Boolean("Is Gif... |
from setuptools import setup
EXTRAS_REQUIRE = {
"docs": ("sphinx", "pallets-sphinx-themes"),
"jwt": ("PyJWT>=1.4.0", "cryptography>=2.0.0"),
"tests": ("coverage", "psycopg2-binary", "pytest"),
}
EXTRAS_REQUIRE["dev"] = (
EXTRAS_REQUIRE["docs"] + EXTRAS_REQUIRE["tests"] + ("tox",)
)
setup(
name="Fl... |
# -*- coding: utf-8 -*-
import os
import datetime
import json
from nose.tools import eq_, ok_
from django.test import TestCase, Client
from django.conf import settings
from django.contrib.auth.models import User
from funfactory.urlresolvers import reverse, split_path
from peekaboo.main.models import Location, Visi... |
"""Test the wakeable_queue.Queue class
"""
import unittest
import os
import sys
import random
import logging
import threading
from time import sleep
logger = logging.getLogger(__name__)
from wakeable_queue import Queue, AbortRequested, WakeableQueueWorker, WorkerStatus
random.seed()
STOP_MSG = []
class Worker(Wak... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Example 5.1 from Kane 1985."""
from __future__ import division
from sympy import Dummy, Matrix
from sympy import expand, solve, symbols, trigsimp
from sympy.physics.mechanics import ReferenceFrame, Point, dot, dynamicsymbols
from util import msprint, subs, partial_veloc... |
# MNIST from official PyTorch Docs
from __future__ import print_function
import argparse
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import psutil
from torchvision import datasets, transforms
from torch.autograd import Variable
# Training settings
... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Red Hat, 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
#
#... |
"""
Tests for the LTI outcome service handlers, both in outcomes.py and in tasks.py
"""
import unittest
import ddt
from django.test import TestCase
from mock import patch, MagicMock
from student.tests.factories import UserFactory
from lti_provider.models import GradedAssignment, LtiConsumer, OutcomeService
import lti... |
# -*- coding: utf-8 -*-
"""
Jokes from stackoverflow - provided under CC BY-SA 3.0
http://stackoverflow.com/questions/234075/what-is-your-best-programmer-joke?page=4&tab=votes#tab-top
"""
neutral = [
"Complaining about the lack of smoking shelters, the nicotine addicted Python programmers said there ought to be '... |
import warnings
import pandas as pd
import requests
from bs4 import BeautifulSoup, Comment
from . import cache
from .datahelpers import postprocessing
from .datasources.fangraphs import fg_team_fielding_data
# This is just a pass through for the new, more configurable function
team_fielding = fg_team_fielding_data
... |
# This file is part of OtfBot.
#
# OtfBot 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.
#
# OtfBot is distributed in the hope that it... |
# Copyright 2004-2010 PyTom <pytom@bishoujo.us>
#
# 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, mer... |
from django.conf.urls import url
from django.contrib import admin
from . import views
app_name = 'extracao'
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', views.index, name='index'),
url(r'^register/$', views.register, name='register'),
url(r'... |
# Copyright 2011 Fluidinfo 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 applicable law or agreed to in writing, ... |
import base64
import json
import re
def ack(client, app):
vin = "20UYA31581L000000"
while True:
y = client.service.listInstalledApps()
y = json.loads(y)
for t in y['result']:
if t['vin'] == vin:
if int(t['appId']) == app:
print t['installa... |
"""This is a repository for items in AGE"""
import csv
__author__ = "Grant Colasurdo"
class Items:
"""This class manages the meta-info of """
def __init__(self, character):
self.character = character
class Item:
def __init__(self, csv_row):
self.item_name: str = csv_row['item_name']
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Sword York
# GitHub: https://github.com/SwordYork/sequencing
# No rights reserved.
#
from abc import ABCMeta, abstractmethod
from ..base import Layer
from ... import np, TIME_MAJOR
class RNN(Layer, metaclass=ABCMeta):
def __init__(self, init_state, ... |
from __future__ import print_function
import os
import sys
import numpy as np
def parse_enum(enum, v):
if isinstance(v, enum):
return v
else:
return enum[v]
def atoms_to_numpy(f, mol, dtype="float"):
return np.fromiter((f(a) for a in mol.GetAtoms()), dtype, mol.GetNumAtoms())
def con... |
# -*- coding: utf-8 -*-
import unittest
from nose.tools import raises
from modules.command.cmd import validator
from modules.command.parser import CommandParser
from modules.command.exceptions import UnknownCommandException, InvalidCommandException
class MockParser(object):
@validator
def is_valid(self, cmd):... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... |
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl
from openpyxl.descriptors import Float, Set, Alias, NoneSet
from openpyxl.descriptors.sequence import ValueSequence
from openpyxl.compat import safe_string
from .colors import ColorDescriptor, Color
from .hashable import HashableObject
from op... |
#!/bin/python
import os, subprocess
import logging
from autotest.client import test
from autotest.client.shared import error, software_manager
sm = software_manager.SoftwareManager()
class nscd(test.test):
"""
Autotest module for testing basic functionality
of nscd
@author
"""
version = 1
... |
#!/usr/bin/python
import read_amber_prmtop as ra
import networkx as nx
import itertools
class GhostAtom(ra.Atom):
pass
valences = {"H": 1,
"C": 4,
"N": 3,
"O": 2,
"S": 2,
"Se": 2,
"P": 5}
def tetravalent_atoms(atoms):
"""
Identif... |
from project.database import db
from sqlalchemy.sql import func
from flask import g
from marshmallow import Schema, fields, post_load
from itsdangerous import SignatureExpired, BadSignature, TimedJSONWebSignatureSerializer
from flask_httpauth import HTTPBasicAuth
from project.security import pwd_context
import os
aut... |
"""
=============
Font Indexing
=============
A little example that shows how the various indexing into the font
tables relate to one another. Mainly for mpl developers....
"""
from __future__ import print_function
import matplotlib
from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, KERNING_UNFITTED, KERNING_U... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__all__=['arrMin', 'arrMax', 'arrMedian', 'arrTrimean', 'arrMode', 'arrAverage', 'oGet', 'arrUnique']
def arrUnique(arr, key=None):
#unique elements of array
if not(arr): return []
tArr1=arr
if key: tArr1=[key(s) for s in tArr1]
tArr1=set(list(tArr1))
re... |
#! /usr/bin/python
import serial, time
import subprocess
from subprocess import call, Popen
from argparse import ArgumentParser
import re
def do_test(port, baudrate, test_name):
databits = serial.EIGHTBITS
stopbits = serial.STOPBITS_ONE
parity = serial.PARITY_NONE
ser = serial.Serial(port, baudrate, d... |
#!/usr/bin/env python
import unittest
from pentai.ai.alpha_beta import *
class MockState(object):
def __init__(self, name, utility, successors):
self.name = name
self.utility = utility
self.successors = successors
class MockGame:
def __init__(self, states, max_depth=4):
self.... |
# coding: utf-8
from django.utils import unittest
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.core.files.base import ContentFile
from django.db.models.fields.files import FieldFile, FileField
from django.core.files.storage import default_storage
from oioioi.filetracker.mod... |
"""
Django settings for bitpoll project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# B... |
import re
import tokens
_IDENTIFIER_CHARS = '-+_?!*/:<>=a-zA-Z'
_IDENTIFIER_REGEX = '[%s][%s0-9]*' % (_IDENTIFIER_CHARS, _IDENTIFIER_CHARS)
matchers = (
(re.compile(r'\('), tokens.OpenParen),
(re.compile(r'\)'), tokens.CloseParen),
(re.compile(_IDENTIFIER_REGEX), tokens.Identifier),
(re.compile(r'(\+... |
#!/usr/bin/env python
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#
# Thanks for opting for GUI version of AirCrack set of tools. This project is in early stage and require your support. #
# Project is ... |
#!/usr/bin/env python3
from sympy import *
from mpmath import *
from matplotlib.pyplot import *
#init_printing() # make things prettier when we print stuff for debugging.
# ************************************************************************** #
# Magnetic field inside copper coil with hollow copper cylinde... |
# Interface for STSADM.EXE
#
# Allows users to execute STSADM operations by calling the
# run method. The run method takes an operation argument
# and a list of name-value pairs for the operation arguments
#
# import references
import clr
clr.AddReference("System")
from System import Environment
from Syste... |
"""Allow access to the answer_choice table."""
from sqlalchemy import select
from sqlalchemy.engine import ResultProxy, Connection
from sqlalchemy.sql.dml import Insert
from dokomoforms.db import answer_choice_table
def answer_choice_insert(*,
is_type_exception: bool=None,
... |
#!/usr/bin/env python3
# encoding: utf-8
#
# test_dap.py
#
# Created by José Sánchez-Gallego on 19 Sep 2016.
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import unittest
from marvin import config
from marvin.tests import MarvinTest
from marvin.utils.da... |
from django.test import TestCase
from django.urls.base import reverse
from battle.models import Battle
from organization.models.organization import Organization
from turn.barbarians import do_settlement_barbarian_generation
from turn.battle import organizations_with_battle_ready_units, \
battle_ready_units_in_tile... |
#
# Copyright (c) 2008--2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... |
#!/usr/bin/env python
import CentroidFold
cf = CentroidFold.CentroidFold(CentroidFold.CentroidFold.CONTRAFOLD)
cf.calculate_posterior("GGGCCCAUAGCUCAGUGGUAGAGUGCCUCCUUUGCAAGGAGGAUGCCCUGGGUUCGAAUCCCAGUGGGUCCA")
ea,s=cf.decode_structure(4)
print s,ea
aln = [
"-----GCUA-AUAUCGCUGUGGAAACACCUGGAACCAUCCCGAACCCAGC-AGUU... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.