text
stringlengths
1
927k
from redbot.core import data_manager from .json_utils import * class CogSettings(object): SETTINGS_FILE_NAME = "legacy_settings.json" def __init__(self, cog_name, bot=None): self.folder = str(data_manager.cog_data_path(raw_name=cog_name)) self.file_path = os.path.join(self.folder, CogSetting...
from . import pql_objects as objects from . import sql from .exceptions import Signal from .interp_common import call_builtin_func from .pql_types import ITEM_NAME, T, dp_type from .types_impl import kernel_type @dp_type def _cast(inst_type, target_type, inst): if inst_type <= target_type: return inst ...
class EvalError(Exception): def __init__(self, message: str, sexp): super().__init__(message) self._sexp = sexp
import argparse import ipaddress import itertools import logging import os import re import secrets import socket import ssl import sys from random import shuffle from typing import List, Tuple, Union from urllib.parse import urlsplit from . import base _logger = logging.getLogger(__name__) def configure_logging(lo...
#!/usr/bin/env/python # -*- coding:utf-8 -*- # Author:guoyuhang
""" This module defines various utilities for dealing with the network. """ from asyncio import iscoroutinefunction, iscoroutine def combine_action_handlers(*handlers): """ This function combines the given action handlers into a single function which will call all of them. """ # make su...
#!/usr/bin/env python # -*- coding: utf-8 -*- from flask_wtf import FlaskForm from wtforms import StringField from wtforms import PasswordField from wtforms import BooleanField from wtforms import SubmitField from wtforms.validators import DataRequired from wtforms.validators import Length from wtforms.validators imp...
import os from sympy.printing import julia_code from sympy import Symbol import json import logging import re class BaseParser: """Parent class for all model parsers. """ def __init__(self, mbam_model, data_path): """ Parameters ---------- mbam_model : ``mbammodel`` ...
#!/usr/bin/env python """Module docstring.""" # Imports import os import sys # Module Constants START_MESSAGE = "CLI Inspection Script" # Module "Global" Variables location = os.path.abspath(__file__) # Module Functions and Classes def main(*args): """My main script function. Displays the full patch to...
# Copyright 2020 Google LLC # Copyright 2021 Fraunhofer FKIE # # 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...
# AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified). __all__ = ['repeat_one'] # Cell import ipywidgets as widgets from fastai2.vision.all import* from .dashboard_two import ds_choice # Cell def repeat_one(source, n=128): """Single image helper for displaying batch""" return...
from ddtrace import config from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY from ddtrace.constants import ERROR_TYPE from ddtrace.contrib.falcon.patch import FALCON_VERSION from ddtrace.ext import http as httpx from tests.opentracer.utils import init_tracer from tests.utils import assert_is_measured from tests.u...
# 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 modules import os import sys from os.path import join as opj import pandas as pd import time from nipype.interfaces.freesurfer import ReconAll from nipype.interfaces.utility import IdentityInterface from nipype.pipeline.engine import Workflow, Node from pypapi import events, papi_high as high import argparse ...
"""Example of an MLP in Myia. Myia is still a work in progress, and this example may change in the future. """ import time from dataclasses import dataclass import numpy import torch from numpy.random import RandomState from torchvision import datasets, transforms import myia.public_api as pub from myia import Arit...
# # Copyright (C) 2008-2020 Advanced Micro Devices, 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: # 1. Redistributions of source code must retain the above copyright notice, # this list of...
import warnings from collections import defaultdict from os.path import dirname from pathlib import Path import h5py import numpy as np from cached_property import cached_property from rich.console import Console from .util import tr_lower, normalize_tokenizer_name console = Console() class InvalidTokenizer(Except...
# -*- coding: utf-8 -*- # Copyright (c) 2021, Gopi and Contributors # See license.txt from __future__ import unicode_literals # import frappe import unittest class TestCategoryModuleInfo(unittest.TestCase): pass
import argparse parser = argparse.ArgumentParser(description="Este programa calcula X^Y") group = parser.add_mutually_exclusive_group() group.add_argument("-v", "--verbose", action="store_true") group.add_argument("-q", "--quiet", action="store_true") parser.add_argument("x", type=int, help="la base") parser.add_argum...
# Copyright 2019 DeepMind Technologies Ltd. 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 appl...
# (c) Continuum Analytics, Inc. / http://continuum.io # All Rights Reserved # # conda is distributed under the terms of the BSD 3-clause license. # Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause. from __future__ import absolute_import, division, print_function from collections import OrderedDict, ...
# 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/. import os import zipfile import simplejson as json from cuddlefish.util import filter_filenames, filter_dirnames class ...
from app import app from flask import render_template import forms # Basic route @app.route('/') @app.route('/index') def index(): return render_template('index.html', current_title= 'Custom Title') @app.route('/about', methods=['GET','POST']) def about(): form = forms.AddTaskForm() return render_templat...
# Copyright (c) 2018-2019, NVIDIA CORPORATION. # # 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 agre...
""" This file offers the methods to automatically retrieve the graph socfb-UCSC68. The graph is automatically retrieved from the NetworkRepository repository. Report --------------------- At the time of rendering these methods (please see datetime below), the graph had the following characteristics: Datetime: 202...
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os import sys from spack import * from spack.operating_systems.mac_os import macos_version MACOS_VERSION = macos_...
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc from chirpstack_api.as_pb.external.api import application_pb2 as chirpstack__api_dot_as__pb_dot_external_dot_api_dot_application__pb2 from google.protobuf import...
import logging class HeterogeneousClient: def __init__(self, client_idx, local_training_data, local_test_data, local_sample_number, args, device, model_trainer): self.client_idx = client_idx self.local_training_data = local_training_data self.local_test_data = local_test_...
from typing import Dict, List, Optional, Union import contextlib import asyncio import discord from discord.ext import pages from database import DatabasePersonality, DatabaseDeck # Set authorized guilds for slash command (return [] for global command - might take up to 1h to register) def get_authorized_guild_ids(...
emptyInput = {"errorCode": 601, "description": "empty input"} InvalidInput = {"errorCode": 602, "description": "Invalid input"} UnidentifiedIntent = { "errorCode": 701, "description": "Can't identify the intent"} NotEnoughData = { "errorCode": 702, "description": "Not enough Training Data. Please Add m...
# -*- 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 #...
import os os.system("git clone https://github.com/justteen/BUZZ-USERBOT /root/userbot && mkdir /root/userbot/bin/ && cd /root/userbot/ && chmod +x /usr/local/bin/* && python3 -m userbot")
""" A simple Line class. NOTE: This is NOT rosegraphics -- it is your OWN Line class. Authors: David Mutchler, Vibha Alangar, Dave Fisher, Amanda Stouder, their colleagues and Xiaolong Chen. """ # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE. import math import m1t_test_Line as m1t ########################...
def mm(word_dict, text): result = list() max_length = return result def mm(word_dict, token, window_size=5): idxs = [] result = [] index = 0 text_size = len(token) #print(token) while text_size > index: for size in range(window_size + index, index, -1): #print(s...
import os, sys, json, db_utils import pymysql from github import Github, UnknownObjectException from datetime import datetime # Aligns all defects recorded in database with their github status TABLE_NAME = "canary_issues" c = None conn = None github_token=os.getenv('GITHUB_TOKEN') github_org=os.getenv('GITHUB_ORG') g...
from django.test import TestCase from models import Photo, Album from imagr_users.models import ImagrUser from imagr_images.models import get_file_owner_username from admin import PhotoAdmin, AlbumAdmin, ImageSizeListFilter from django.core.urlresolvers import reverse from django.contrib.admin.sites import AdminSite im...
from typing import List import pytest from pytest_mock import MockerFixture from mock import MagicMock from pathlib import Path from click.testing import CliRunner # module under test : import stubber.stubber as stubber def test_stubber_help(): # check basic commandline sanity check runner = CliRunner() ...
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- __version__ = '1.20.94' # ----------------------------------------------------------------------------- import asyncio import concurrent import socket import time import math import random import certifi import a...
# Copyright (c) 2012 VMware, Inc. # Copyright (c) 2011 Citrix Systems, Inc. # Copyright 2011 OpenStack Foundation # # 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://w...
"""Transform mypy expression ASTs to mypyc IR (Intermediate Representation). The top-level AST transformation logic is implemented in mypyc.irbuild.visitor and mypyc.irbuild.builder. """ from typing import List, Optional, Union, Callable, cast from mypy.nodes import ( Expression, NameExpr, MemberExpr, SuperExpr,...
# Generated by Django 2.2.24 on 2022-01-04 09:54 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('neighborapp', '0004_neighborhood_description'), ] operations = [ migrations.AlterField( model_...
from bottle import * import os import settings from domain.training_model import Training from training_utils.combined_outputs import overview_csv @get(f'/<session_name>/<model_name>/refresh') def invalidate_cache(session_name, model_name): global global_models global_models = Training.load_all() return r...
import math import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd from tqdm import tqdm def scree_plot(analysis_actors_dict, dir_path, pcs_on_scree_plot=50, variance_ratio_line=0.75): """ Creates a plot with the scree plots for each ligand and saves it on the specified ...
# Copyright 2020 MONAI Consortium # 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, s...
# Copyright (C) 2019-2021 Zilliz. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
def test_error(invalid_fixture): pass class Test: def test_error(self, invalid_fixture): assert True
from __future__ import print_function # Primality Testing with the Rabin-Miller Algorithm import random def rabinMiller(num): s = num - 1 t = 0 while s % 2 == 0: s = s // 2 t += 1 for trials in range(5): a = random.randrange(2, num - 1) v = pow(a, s, num) if v...
#!/usr/bin/env python2 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * # Creat...
# Copyright 2018 D-Wave Systems 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...
# GNU MediaGoblin -- federated, autonomous media hosting # Copyright (C) 2016 MediaGoblin contributors. See AUTHORS. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of...
from set_root_path import set_root_path set_root_path() import db.sql_server as db empresas = [ { "RazonSocial": "GENTOR, S.A. DE C.V.", "RFC": "GEN760712EM0" }, { "RazonSocial": "SERVICIOS CORPORATIVOS GENTOR, S.A.", "RFC": "SCG931026LW1" }, { "RazonSocial...
""" This is the Scrapy engine which controls the Scheduler, Downloader and Spiders. For more information see docs/topics/architecture.rst """ import logging from time import time from twisted.internet import defer, task from twisted.python.failure import Failure from scrapy import signals from scrapy.core.scraper i...
# -*- coding: utf-8 -*- description = 'controlling the UV-vis spectrometer and LEDs' group = 'optional' tango_base = 'tango://phys.kws2.frm2:10000/kws2/' devices = dict( OceanView = device('nicos.devices.entangle.DigitalOutput', description = 'spectrometer trigger interval (0 to switch off)', tan...
import pandas from ..schema.schema_base import * from .datastore_base import DataStore from .odo_datastore import OdoDataStore from ..config import config from functools import lru_cache, partial from sqlalchemy import Table, MetaData, select from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.automap import ...
#!/usr/bin/env python # # File: llnms-scan-network.py # Author: Marvin Smith # Date: 6/13/2015 # # Purpose: Scan LLNMS networks # __author__ = 'Marvin Smith' # Python Libraries import argparse, os, sys # LLNMS Libraries if os.environ['LLNMS_HOME'] is not None: sys.path.append(os.environ['L...
''' ====================================================================== Created on Jan 14, 2018 PURPOSE: this module provides classes to read Maven projects from git or other repos specifically intended to create the graph of multiple project dependencies ROADMAP: TODO - 1. review how properties ...
from collections import defaultdict class Solution: """ @param accounts: List[List[str]] @return: return a List[List[str]] """ def accountsMerge(self, accounts): # write your code here merged = [] if not accounts or len(accounts) == 0: return merged s...
import unittest import sys from pathlib import Path sys.path.append(str(Path(__file__).parent.parent)) sys.path.append(str(Path(__file__).parent.parent / "src/predict")) import src.predict.detect_score as detect_score class TestDetectScore(unittest.TestCase): def setUp(self):#設定 self.ds=detect_score.Detect...
# Copyright 2020 John Reese # Licensed under the MIT license import re from typing import Any, Pattern, Union from .engines.base import Connection from .errors import InvalidURI from .types import Location _uri_regex: Pattern = re.compile(r"(?P<engine>\w+)://(?P<location>.+)") def connect(location: Union[str, Loca...
import math from rply import LexerGenerator, ParserGenerator def build_lexer(): # LEXERGENERATOR INSTANZIEREN lexer_generator = LexerGenerator() # WHITESPACES IGNORIEREN lexer_generator.ignore(r'\s+') # ZAHLEN ERKENNEN # -? => ENTWEDER MINUS ODER NICHT # \.? => ENTWEDER EIN PUNKT ODER NICH...
from utils import CSVScraper, CanadianPerson as Person from pupa.scrape import Organization, Post from collections import defaultdict import re class CanadaMunicipalitiesPersonScraper(CSVScraper): csv_url = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vRrGXQy8qk16OhuTjlccoGB4jL5e8X1CEqRbg896ufLdh67DQk9nuGm-o...
def test_cursor_triggers_cursor_in_the_connection(open_connection): open_connection.cursor() open_connection._connection_handler.cursor.assert_called_once() def test_cursor_returns_a_cursor_in_the_handler(open_connection, mocker): cursor_mock = mocker.Mock() open_connection._connection_handler.cursor....
""" Django settings for config project. Generated by 'django-admin startproject' using Django 4.0.2. For more information on this file, see https://docs.djangoproject.com/en/4.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.0/ref/settings/ """ from pathlib ...
# -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Vyatta.Vyatta.get_capabilities # --------------------------------------------------------------------- # Copyright (C) 2007-2015 The NOC Project # See LICENSE for details # -------------------------------------------------...
import sqlite3 def get_connection(): conn = sqlite3.connect('fridge.db') conn.row_factory = sqlite3.Row return conn
"""the tests for the Command line switch platform.""" import json import os import tempfile import unittest from homeassistant.const import STATE_ON, STATE_OFF import homeassistant.components.switch as switch import homeassistant.components.switch.command_line as command_line from tests.common import get_test_home_as...
import psycopg2 from getpass import getpass class DatabaseConection(object): """ """ def __init__(self, host: str, database: str, user: str): self._con = None self._host = host self._database = database self._user = user self.connected = False try: ...
# coding: utf-8 """ Catch-all file for utility functions. """ import sys import logging import numpy as np from matador.compute import ComputeTask from matador.utils.cell_utils import cart2frac, cart2abc LOG = logging.getLogger("ilustrado") LOG.setLevel(logging.DEBUG) def strip_useless(doc, to_run=False): ""...
"""The scheduler shall be run as a background task. Based on oSparc pipelines, it monitors when to start the next celery task(s), either one at a time or as a group of tasks. In principle the Scheduler maintains the comp_runs table in the database. It contains how the pipeline was run and by whom. It also contains the...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # michael a.g. aïvázis # orthologue # (c) 1998-2018 all rights reserved # """ Verify that attempts to create local filesystems with nonexistent roots fails as expected """ def test(): # support import pyre.primitives # my package import pyre.filesyste...
from collections import OrderedDict import torch from torch import Tensor import torch.nn as nn from torch.utils.model_zoo import load_url as load_state_dict_from_url from ptnetworks.ActivationTracker import ActivationTracker from typing import Type, Any, Callable, Union, List, Optional class ResNetCIFAR(nn.Module):...
#!/usr/bin/env python import sys import re from utils import choplist STRICT = 0 ## PS Exceptions ## class PSException(Exception): pass class PSEOF(PSException): pass class PSSyntaxError(PSException): pass class PSTypeError(PSException): pass class PSValueError(PSException): pass ## B...
from gym_minigrid.minigrid import * from configurations import config_grabber as cg import math import operator from functools import reduce import traceback import numpy as np config = cg.Configuration.grab() AGENT_VIEW_SIZE = config.agent_view_size EXTRA_OBSERVATIONS_SIZE = 5 OBS_ARRAY_SIZE = (AGENT_VIEW_SIZE, A...
from django.core.mail import send_mail from django.template.loader import render_to_string from django.conf import settings class BaseEmailSponsorshipNotification: subject_template = None message_template = None email_context_keys = None def get_subject(self, context): return render_to_string...
#!/usr/bin/python # -*- coding: UTF-8 -*- import codecs from contextlib import contextmanager @contextmanager def Open(filename, mode, encoding='utf-8'): fp = codecs.open(filename, mode, encoding) try: yield fp finally: fp.close() data = u"context汉字测试" with Open('data.txt', 'w') as f: ...
from django.contrib.auth import get_user_model from rest_framework import serializers from companys.models import Company, News from users.models import Profile User = get_user_model() class NewsSerializer(serializers.ModelSerializer): class Meta: model = News fields = '__all__' class Company...
from tests import BasicTestCase class TestLeaderboards(BasicTestCase): def test_leaderboards(self): response = self.request(type="query", call='leaderboards(token :"{0}")'.format(self.access_token), body=''' .....
"""Console script for imglatex.""" import click from imglatex.imglatex import find_images, Image, Document @click.command() @click.argument('path', type=click.Path(exists=True)) @click.option('--prefix', default='.', help='Prefix for the image paths') def main(path: click.Path, prefix: str): """Console script f...
try: from hmac import compare_digest except ImportError: def compare_digest(a, b): return a == b import binascii from django.utils import timezone from django.utils.translation import gettext_lazy as _ from rest_framework import exceptions from rest_framework.authentication import ( BaseAuthentica...
import scipy.spatial.distance from nltk.stem import WordNetLemmatizer from nltk.stem.lancaster import LancasterStemmer from math import ceil import numpy as np import copy import itertools from players.codemaster import Codemaster THRESHOLD = np.inf class AICodemaster(Codemaster): def __init__(self, brown_ic=Non...
""" Copyright (c) 2020 Intel Corporation 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 writin...
from .errors import MultipleResults, NoResults def equals(field, value): """Return function where input ``field`` value is equal to ``value``""" return lambda x: x.get(field) == value def contains(field, value): return lambda x: value in x.get(field) def startswith(field, value): return lambda x: ...
#!/usr/bin/env python3 """ This script is used to take any GFF3 file and re-generate feature identifiers within it to match the convention used at IGS. This is: $prefix.$type.$id.$version The mode here defines what the identifier. For example, if using --mode=sequential for an organism (--prefix) of b_microti,...
# File: forescoutcounteract_consts.py # Copyright (c) 2018-2021 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) # # -- # Define your constants here FS_DEX_HOST_ENDPOINT = '/fsapi/niCore/Hosts' FS_DEX_LIST_ENDPOINT = '/fsapi/niCore/Lists' FS_DEX_TEST_CONNECTIVITY = \ """...
# 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...
import numpy as np def make_histograms(x, bins=40, interval=[1e-1, 1]): intervals = np.linspace(interval[0], interval[1], bins) flat_x = x.reshape((x.shape[0], -1)) hist_x = np.zeros((x.shape[0], bins)) for i in range(1, bins): mask = flat_x <= intervals[i] mask = np.logical_and(mask, f...
from abc import ABC, abstractmethod class Pretty(ABC): @abstractmethod def __pretty__(self) -> str: ...
# 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...
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.FileItem import FileItem from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.ZhimaCreditEpProductCodeQueryModel import ZhimaCreditEpProductCodeQueryModel class ZhimaCreditEpProductCodeQueryRequest(object): ...
from datetime import date, datetime, time, timedelta, tzinfo import operator from typing import Optional import warnings import numpy as np from pandas._libs import NaT, Period, Timestamp, index as libindex, lib from pandas._libs.tslibs import ( Resolution, ints_to_pydatetime, parsing, timezones, ...
import sys sys.path.append("/Users/csiu/repo/kick/src/python") import argparse import custom import pandas as pd import numpy as np import re import os from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.utils.extmath import randomized_s...
# -*- coding: utf-8 -*- import adsputils import unittest import os import json import time from inspect import currentframe, getframeinfo from adsputils.exceptions import UnicodeHandlerError def _read_file(fpath): with open(fpath, 'r') as fi: return fi.read() class TestInit(unittest.TestCase): def t...
# exported from PySB model 'model' from pysb import Model, Monomer, Parameter, Expression, Compartment, Rule, Observable, Initial, MatchOnce, Annotation, ANY, WILD Model() Monomer('Ligand', ['Receptor']) Monomer('ParpU', ['C3A']) Monomer('C8A', ['BidU', 'C3pro']) Monomer('SmacM', ['BaxA']) Monomer('BaxM', ['BidM', '...
# smalltalk infected fizzbuzz version from forbiddenfruit import curse from collections import deque def if_true(self, block): # simulate blocks using functions self and block() # close circuit when object is truthy return self def if_false(self, block): # simulate blocks using functions not...
""" Copyright (c) 2017 Cyberhaven 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, publish, distribute, sub...
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-03 21:41 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0003_remove_student_student_name'), ] ope...
import os import sys import cv2 import glob import h5py import json import numpy as np import scipy.io as sio import scipy.misc from .read_openpose import read_openpose def read_calibration(calib_file, vid_list): Ks, Rs, Ts = [], [], [] file = open(calib_file, 'r') content = file.readlines() for vid_i ...
__author__ = 'haho0032' import base64 import datetime import dateutil.parser import pytz import six from OpenSSL import crypto from os.path import join from os import remove from Cryptodome.Util import asn1 class WrongInput(Exception): pass class CertificateError(Exception): pass class PayloadError(Except...
# Copyright 2016 Mandiant, A FireEye Company # Authors: Brian Jones # License: Apache 2.0 ''' Model classes for "Relational Learning with TensorFlow" tutorial ''' import numpy as np import tensorflow as tf from .util import ContrastiveTrainingProvider def least_squares_objective(output, target, add_bias=True): ...
from dataclasses import dataclass from typing import List from salvia.types.blockchain_format.sized_bytes import bytes32 from salvia.types.blockchain_format.program import Program from salvia.util.ints import uint64 # This class is supposed to correspond to a CREATE_COIN condition @dataclass(frozen=True) class Paym...