content
stringlengths
5
1.05M
import os import sys import logging import paddle import argparse import functools import math import time import numpy as np import paddle.fluid as fluid sys.path[0] = os.path.join( os.path.dirname("__file__"), os.path.pardir, os.path.pardir) from paddleslim.common import get_logger import models from utility impo...
# Copyright 2019 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
import dill from sklearn.feature_selection import RFECV from sklearn.model_selection import StratifiedKFold from robotehr.pipelines.supporters.plots import plot_rfe def recursive_feature_elimination(X, y, algorithm, step_size=50, create_figure=False, filename="", n_splits=5): estimator = algorithm() rfecv = ...
from onmt.modules.StochasticTransformer.Models import StochasticTransformerEncoder, StochasticTransformerDecoder # For flake8 compatibility. __all__ = [StochasticTransformerEncoder, StochasticTransformerDecoder]
from flask_restplus import Namespace, Resource from flask import request, jsonify, current_app from flask_jwt_simple import jwt_required, get_jwt_identity from kafka import KafkaProducer from micro_utils.flask.jwt import resolve_jwt_identity from micro_utils.messaging.adapters import TopicProducer from micro_utils.p...
#test cases starting from 0 class Solution: def fib(self, N): if N==0: return 0 lastTwo = [1 , 1] counter = 3 while counter <= N: nextFib = lastTwo[0] + lastTwo[1] lastTwo[0] = lastTwo[1] lastTwo[1] = nextFib counter += 1 return lastTwo[1] if N > 1 else ...
# This relies on each of the submodules having an __all__ variable. from .client import * from .exceptions import * from .protocol import * from .server import * from .uri import * __all__ = ( client.__all__ + exceptions.__all__ + protocol.__all__ + server.__all__ + uri.__all__ ) from .version im...
"""Unit tests for testing support """ import logging import os import unittest import numpy from astropy import units as u from astropy.coordinates import SkyCoord from rascil.data_models.polarisation import PolarisationFrame from rascil.processing_components.image.operations import export_image_to_fits, scale_and...
from csv import DictWriter from itertools import groupby import os import re from string import capwords import xml.etree.ElementTree as et import requests STATE_PROP_PATTERN = re.compile(r"^Proposition (\d+) - (.+)$") CITY_MEASURE_PATTERN = re.compile(r"^([A-Z]{1,2})-(.+)$") def get_results(use_cache=True): u...
""" PreAssembly Report. See FALCON-pbsmrtpipe/pbfalcon/report_preassembly.py for XML version. """ # Copied from # http://swarm/files/depot/branches/springfield/S2.3/software/smrtanalysis/bioinformatics/tools/pbreports/pbreports/report/preassembly.py from .FastaReader import open_fasta_reader from .io import capture...
#!/usr/bin/python # helper functions for your analysis of data from Isobel Hawes, for Le Yan and the biohub # import libraries import numpy as np import math import scipy # import pandas to work with data import pandas as pd # plotting import matplotlib.pyplot as plt import seaborn as sns # import itertools, reduce to ...
import matplotlib.pyplot as plt from matplotlib.path import Path import matplotlib.patches as patches verts = [ (0., 0.), # left, bottom (0., 1.), # left, top (1., 1.), # right, top (1., 0.), # right, bottom (0., 0.), # ignored ] codes = [Path.MOVETO, Path.LINETO, Path.LINETO...
from __future__ import print_function import pytest from urbansim_templates.shared import CoreTemplateSettings def test_property_persistence(): """ Confirm CoreTemplateSettings properties persist through to_dict() and from_dict(). """ obj = CoreTemplateSettings() obj.name = 'name' obj.t...
""" Operator to resample a timeseries based dataframe """ import pandas as pd from tasrif.processing_pipeline import ProcessingOperator from tasrif.processing_pipeline.validators import GroupbyCompatibleValidatorMixin class ResampleOperator(GroupbyCompatibleValidatorMixin, ProcessingOperator): """ Group and a...
from distutils.core import setup setup(name='networkmonitor', version='0.0.1', description='Console application to let you monitor the status of devices.', author='James Tombleson', url='http://github.com/luther38/networkmonitor', packages=[ 'pipenv', 'requests', 'click...
import numpy as np from ..data import Dataset def show_accuracy_loss(net, scaling="scaled", test_dataset_path="../data/processed/extended"): """Show performance on the test sets Args: net (Keras model): Keras compiled model scaling (str, optional): dataset properties, assuming the datasets are...
import argparse import json import numpy as np import subprocess as sp import copy from librw.loader import Loader from librw.rw import Rewriter from librw.analysis.register import RegisterAnalysis from rwtools.asan.instrument import Instrument from librw.analysis.stackframe import StackFrameAnalysis def do_symboli...
print("Hello world") print("What is the score of india vs england match?:????")
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ayarlar.ui' # # Created by: PyQt5 UI code generator 5.15.1 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import Qt...
# -*- coding: utf-8 -*- # Command line utilties and helper functions from clint.textui import puts, colored, indent from getpass import getpass from blockcypher.utils import (is_valid_address_for_coinsymbol, coin_symbol_from_mkey, format_output, UNIT_CHOICES) from blockcypher.constants import COIN_SYMBOL_MAP...
@when(u'I submit my employment status as "{type}"') def step_impl(context, type): context.execute_steps(u''' When I choose "%s" from "you_are" And I press "Continue" ''' % type) @when(u'I submit my benefits as "{type}"') def step_impl(context, type): context.execute_steps(u''' When...
# -*- coding: utf-8 -*- import logging import logging.config import time import threading from pynetdicom2 import uids from . import ae from . import config from . import event_bus class Server: """Server class itself. Sets up event bus. Initializes all components and passes config to them. :ivar confi...
""" AppConfig """ from django.apps import AppConfig class GradesConfig(AppConfig): """ App config for this app """ name = "grades" def ready(self): """ Ready handler. Import signals. """ import grades.signals # pylint: disable=unused-import
from io import TextIOBase import os.path import operator from itertools import combinations, permutations from functools import reduce, partial from math import isfinite, prod from collections import Counter INPUT=os.path.join(os.path.dirname(__file__), "input.txt") with open(INPUT) as f: data = f.read() test="""...
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-09-27 19:50 from __future__ import unicode_literals import awx.main.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('main', '0052_v340_remove_project_sc...
# Copyright (c) 2019 Horizon Robotics. 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 applicab...
""" SQLAlchemy-JSONAPI Serializer. Colton J. Provias - [email protected] http://github.com/coltonprovias/sqlalchemy-jsonapi Licensed with MIT License """ from functools import wraps from sqlalchemy.orm.base import MANYTOONE, ONETOMANY def as_relationship(to_many=False, linked_key=None, link_key=None, ...
from .doctype import * from .html import * from .sys import * from .date import * from ._if import * from ._for import * from ._while import * from ._import import * from ._def import * from .include import * from .extends import * from .entitize import * from .constants import * from .ieif import * from .types import ...
#!/usr/bin/env python import csv with open('SeqTracking.csv', encoding='ISO-8859-1') as csvfile: with open('Metadata_csv.csv', 'w') as outfile: outfile.write('SeqID,Genus,Quality\n') reader = csv.DictReader(csvfile) for row in reader: if row['Genus'] == '': genu...
from typing import Callable, List, Optional, Sequence from ebl.transliteration.domain.atf import Atf, WORD_SEPARATOR from ebl.transliteration.domain.egyptian_metrical_feet_separator_token import ( EgyptianMetricalFeetSeparator, ) from ebl.transliteration.domain.enclosure_tokens import ( AccidentalOmission, ...
# # 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 ...
# "Stopwatch: The Game" import simplegui # define global variables current_time = 0 time_display = "0:00.0" attempts = 0 succeeds = 0 # define helper function format that converts time # in tenths of seconds into formatted string A:BC.D def time_format(t): D = t % 10 t /= 10 BC = t % 60 A = t / 60 ...
# -*- coding: utf-8 -*- # --------------------------------------------------------------------- # Export model to CSV # --------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ------------------------------------------------------------...
#!/usr/bin/env python3 """ Very simple HTTP server in python for logging requests Usage:: ./server.py [<port>] """ from http.server import BaseHTTPRequestHandler, HTTPServer from urllib.parse import urlparse, parse_qs import logging import json class Server(BaseHTTPRequestHandler): _config = None def ...
import getopt import sys from libcloud.compute.types import NodeState from lc import get_lc from printer import Printer def lister_main(what, resource=None, extension=False, supports_location=False, **kwargs): """Shortcut for main() routine for lister tools, e.g. lc-SOMETHING-list @param what: ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from ... import TestUnitBase class TestDESDerive(TestUnitBase): def test_real_world_01(self): self.assertEqual(self.load()(B''), B'\x01' * 8) def test_real_world_02(self): self.assertEqual(self.load()(B'pw0rdEXAMPLE.Cpianist'), bytes.fromhex('15...
# -*- coding: utf-8 -*- # Copyright 2013 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...
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: Donny You([email protected]) from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from utils.tools....
#!/c/Python27/python # wpadmin.py - Command line tool for WordPress # # The MIT License (MIT) # # Copyright (c) 2014 Raul Chacon <[email protected]> # # 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 ...
"""Tools to cache time-series data. """ from collections import deque from py2store.utils.affine_conversion import get_affine_converter_and_inverse class RegularTimeseriesCache: """ A type that pretends to be a (possibly very large) list, but where contents of the list are populated as they are needed. F...
""" Defines the rule for building external library with CMake """ load( "//tools/build_defs:framework.bzl", "CC_EXTERNAL_RULE_ATTRIBUTES", "cc_external_rule_impl", "create_attrs", ) load( "//tools/build_defs:detect_root.bzl", "detect_root", ) load( "//tools/build_defs:cc_toolchain_util.bzl"...
# -*- coding: utf-8 -*- import functools import itertools as it import json import os import re import socket from typing import NamedTuple from urllib.parse import urlparse import jsonschema import pygtrie import structlog import ujson from .errors import InvalidUpstreamHost from .errors import InvalidUpstreamURL l...
''' Train Neural RE Model ''' __author__ = 'Maosen' import os import random import torch import logging import argparse import pickle import numpy as np from tqdm import tqdm import utils from model import Model from utils import Dataset torch.backends.cudnn.deterministic = True def train(args): model = Model(args...
from __future__ import print_function from __future__ import print_function from __future__ import print_function import shutil import sys import tempfile from six import StringIO import os import yaml from mako.lookup import TemplateLookup from mock import patch from nose.plugins.skip import Skip from pyff.mdrepo impo...
from __future__ import print_function import datetime from googleapiclient.discovery import build from httplib2 import Http from oauth2client import file, client, tools from pyrfc3339 import parse from util.models import CalendarDTO from util.models.AppointmentDTO import AppointmentDTO class GoogleCalendar: # ...
import os from dotenv import load_dotenv from archivy import app def main(): load_dotenv() port = int(os.environ.get("ARCHIVY_PORT", 5000)) app.run(host='0.0.0.0', port=port)
from setuptools import find_packages, setup VERSION = '0.8' setup( name = 'urlrap', packages = find_packages(), version = VERSION, platforms=['any'], description = 'URL connivance functions.', author = 'Bob Colner', author_email = '[email protected]', url = 'https://github.com/bobcolne...
""" .. module:: transducer_services_Simple :platform: Unix, Windows :synopsis: Defines a simple example implementation for IEEE1451.0 Transducer Services for ncaplite. .. moduleauthor:: James Ethridge <[email protected]> """ from ncaplite.transducer_services_base import TransducerAccessBase import ncap...
from mygrad.tensor_base import Tensor from .ops import * __all__ = ["reshape", "squeeze", "ravel", "expand_dims", "broadcast_to"] def reshape(a, *newshape, constant=False): """ Returns a tensor with a new shape, without changing its data. This docstring was adapted from ``numpy.reshape`` Param...
# based on works of 2015 Matthias Groncki # https://github.com/mgroncki/IPythonScripts # #Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: # #- Redistributions of source code must retain the above copyright notice, #this list...
#!/usr/bin/env python # -*- coding: utf-8 -*- import multiprocessing import time import os import random import string import sys from core.targets import analysis from core.attack import start_attack from core.alert import info from core.alert import warn from core.alert import error from core.alert import write from...
from setuptools import setup, find_packages with open("requirements.txt", 'r') as file: libs = file.readlines() setup( name = "image_toolbox", version = "0.0.1", author = "Kareem Janou", description = ("Collection of usefull tools, that can make the developement of neural networks easier."), l...
#!/usr/bin/env python # -*- coding: utf-8 -*- #----------------------------------------------------------------------------- # update_backscatter.py, Angeline G. Burrell (AGB), UoL # # Comments: Update the beam's groundscatter flag, calculate the virtual height # and propagation path, determine the origin fie...
__author__ = 'robson' # convert D in nm^2/ps -> 10^-5 cm^2/s for 3D/2D/1D diffusion - same as GROMACS! FACTOR = { 'msd': 1000.0 / 6.0, 'msd_xy': 1000.0 / 4.0, 'msd_yz': 1000.0 / 4.0, 'msd_xz': 1000.0 / 4.0, 'msd_x': 1000.0 / 2.0, 'msd_y': 1000.0 / 2.0, 'msd_z': 1000.0 / 2.0, } class MSDE...
""" Validation Implemented by Peng Zhang """ import argparse import os import torch from torch.utils.data import DataLoader from torchvision import utils as v_utils from tqdm import tqdm from data_path import DATA_PATH from dataset.augmentation import ValidFrameSampler, ValidAugmentation from dataset.video_matte imp...
class Student: def __init__(self, first_name, last_name): self.first_name = first_name self.last_name = last_name self.promoted = False def __bool__(self): return self.promoted def run_example(): student = Student(first_name="Mikołaj", last_name="Lewandowski") print(...
import csv import io from datetime import datetime from django.contrib import messages from django.db.models import Q from django.http import JsonResponse, HttpResponseRedirect from django.shortcuts import render from django.urls import reverse from django.views.generic import CreateView, UpdateView, ListView from proj...
import sys from abc import ABC, abstractmethod from itertools import chain from pathlib import Path from typing import Dict, Tuple import numpy as np import torch import torch.nn.functional as FF from src.data.common import get_loader from torch.distributions import Distribution from torch.nn import LSTM, Embedding, L...
import argparse import numpy as np import torch import json from collections import OrderedDict from torch import nn from torch import optim from torch.autograd import Variable from torchvision import models import torch.nn.functional as F from train import construct_model from PIL import Image def get_comman...
# -*- coding:utf-8 -*- from flask_restful import Resource, reqparse, request from flask import g from common.log import Logger from common.audit_log import audit_log from common.db import DB from common.utility import uuid_prefix from common.sso import access_required import json from user.user import update_user_privi...
"""vitamins.match.hitbox -- hitbox class and data.""" from functools import partial from vitamins.match.base import OrientedObject from vitamins import draw class Hitbox: width: float length: float height: float angle: float # todo: take this into account root_to_front: float root_to_top: f...
import numpy import unittest import cupy from cupy import testing @testing.gpu class TestDims(unittest.TestCase): _multiprocess_can_split_ = True def check_atleast(self, func, xp): a = testing.shaped_arange((), xp) b = testing.shaped_arange((2,), xp) c = testing.shaped_arange((2, 2)...
import os ## coverted from model.eval.genotyped.sh def modelEvalCVGenotyped (path, pheno, model, snpList, genotypeFle): phenoFile = path + "/pheno_data/pheno_" + str(pheno) + ".txt" covarFile = path + "/pheno_data/covar_" + str(pheno) + ".txt" outFile = path + "/association_cv/chr0." + str(pheno) extrac...
import time import sys from scapy.all import * from scapy.all import * from scapy.all import send from scapy.layers.inet import * import scapy srcIP = "192.168.0.107" destIP = "192.168.0.105" IPLayer = IP(dst=destIP, src=srcIP) for i in range(1,100): TCPLayer = TCP(seq=i, dport=135, sport=135) spoofpkt = IP...
from .managers import CoreManager from .models import AbstractAudit, AbstractChoice __all__ = ['CoreManager', 'AbstractAudit', 'AbstractChoice', ]
# Generated by Django 3.0.9 on 2020-10-23 15:57 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('quotations', '0033_auto_20201020_1511'), ] operations = [ migrations.AddField( model_name='quotation', name='discoun...
from django.db import models # Create your models here. SOCIAL_CHOICES = ( ('F', 'Facebook'), ('W', 'Whatsapp'), ('T', 'Twitter'), ('I', 'Instagram'), ('L', 'LinkedIn'), ('Y', 'Youtube'), ) class SocialLink(models.Model): site = models.CharField(choices=SOCIAL_CHOICES, max_length=1,) l...
import ctypes import numpy from nidaqmx._lib import lib_importer, wrapped_ndpointer, c_bool32 from nidaqmx.constants import FillMode from nidaqmx.errors import check_for_error def _write_analog_f_64( task_handle, write_array, num_samps_per_chan, auto_start, timeout, data_layout=FillMode.GROUP_BY_CHAN...
from run_experiments_transfer import test_robustness import torchvision.datasets as dset import torchvision.transforms as transforms import torch import numpy as np from clustorch.kmeans import KMeans from clustorch.spectral import SpectralClustering from clustorch.hierarchical import Hierarchical from experiments.devi...
import os import sys import unittest from collections import OrderedDict sys.path.append(os.path.join(os.path.dirname(__file__), "..")) import setup_malcolm_paths import numpy as np from malcolm.core.vmetas import NumberArrayMeta class TestValidation(unittest.TestCase): def test_numpy_array(self): nm ...
import os def setup_working_directories(config_vars): ## Expected raw data directories: config_vars["raw_images_dir"] = os.path.join(config_vars["root_directory"], 'raw_images/') config_vars["raw_annotations_dir"] = os.path.join(config_vars["root_directory"], 'raw_annotations/') ## Split files co...
import pytest from wemake_python_styleguide.violations.oop import ( UnpythonicGetterSetterViolation, ) from wemake_python_styleguide.visitors.ast.classes import WrongClassBodyVisitor module_getter_and_setter = """ attribute = 1 def get_attribute(): ... def set_attribute(): ... """ static_getter_and_set...
# Copyright 2022 Sony Group 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 ...
from setuptools import setup, find_packages setup( name = "Boids", version = "6.6.2", description = "Simulation of Boids", author = "Leo Carlos-Sandberg" url = "https://github.com/lcarlossandberg/Bad_Boids", license = "MIT License" packages = find_packages(exclude=['*test']), ...
#!/usr/bin/env python # Written by: DGC # python imports # local imports # done before any other imports in case of errors in them import Error Error.set_exception_handler() # next start logging. import Log Log.start_logging() # now set up localisation import Localisation localisation = Localisation.Localiser() ...
from unittest.mock import MagicMock, patch from django.test import TestCase from monitor.decorators import hub_signature_required class TestHubSignatureRequired(TestCase): def fn_to_test(self, request): return request.body def setUp(self): self.decorator = hub_signature_required se...
import functools import sys import types from nose import SkipTest from nose.tools import eq_ from .. import helper from ..helper import MockXPI from appvalidator.constants import SPIDERMONKEY_INSTALLATION from appvalidator.errorbundle import ErrorBundle from appvalidator.errorbundle.outputhandlers.shellcolors import...
import datetime from abstractblock import AbstractBlock from textdatav1 import TextDataV1 class GenesisBlock(AbstractBlock): @property def id(self): return self._index @property def timestamp(self): return self._timestamp @property def data(self): return self._data ...
from django import forms from .models import ( Book, Category, Shelf, Author ) class BookCreationAddForm(forms.ModelForm): class Meta: model = Book fields = ('name', 'author', 'category', 'amount', 'price', 'image', 'shelf', ) class CategoryCreationForm(forms...
_base_ = ['./segmentation_static.py', '../_base_/backends/onnxruntime.py'] onnx_config = dict(input_shape=[2048, 1024])
from django.db import models # Create your models here. class Grocery(models.Model): ItemName = models.CharField(max_length=100) ItemQuantity = models.CharField(max_length=50) ItemStatus = models.CharField(max_length=15) Date = models.DateField() UserId = models.IntegerField(default=5) def __s...
def aumentar(n=0): return n * 1.5 def diminuir(n=0): return n * 0.5 def dobro(n=0): return n * 2 def metade(n=0): return n / 2 def moeda(n=0): return f'R${n:.2f}'.replace('.', ',')
from __future__ import print_function, absolute_import import torch import torch.nn.functional as F from torch import nn, autograd from torch.autograd import Variable, Function import numpy as np import math torch.autograd.set_detect_anomaly(True) class ExemplarMemory(Function): def __init__(self, em, alpha=0.0...
from random import choice import numpy as np from constants import * from tile import Tile, TileType class Board(object): """ Board class. """ def __init__(self, row, column, board_setup=None): """ Board class construct. :param row: # of rows in the board :param colu...
# coding=utf-8 # main.py # Autore: Matteo Esposito # Versione di Python: 2.6.9 import time from lib.settings import DEBUG, RELEASE from lib.ProjUtilities import generateRandomAVLTree, concatenate global A, B def benchmark(n): """ Main delle funzioni di benchamrking, si occupa di creare gli alebri AVL e di r...
import os import tornado.ioloop import tornado.web import TileStache class TornadoRequestHandler(tornado.web.RequestHandler): """ Create a Tornado HTTP get and post handler. This class is documented as part of Tornado public RequestHandler API: http://www.tornadoweb.org/en/stable/guide/stru...
"""Posts views.""" # Rest framework from rest_framework.response import Response from rest_framework.decorators import action from rest_framework.generics import get_object_or_404 from rest_framework import status, viewsets, mixins # Permissions from rest_framework.permissions import ( AllowAny, IsAuthenticat...
import sys sys.path.append('./site-packages') # flake8: noqa: E402 from crhelper import CfnResource import boto3 from pathlib import Path helper = CfnResource() @helper.create @helper.update def on_create(event, __): pass def delete_s3_objects(bucket_name): if bucket_name: s3_resource = boto3.reso...
#!/usr/bin/env python """testwang - a tool for working with randomly-failing tests.""" from __future__ import ( absolute_import, division, print_function, unicode_literals, ) import argparse import atexit import copy import io import itertools import json import os import subprocess import sys import...
""" bot commands """ from . import bot from ..lib.owoify import owoify, owoify2 from ..lib.smh import expand bot.add_formatter(owoify, "owoify", "owoifies text") bot.add_formatter(owoify2, "owoify2", "owoifies text, but worse") bot.add_formatter(expand, "smh", "expands instances of smh") import discord import reque...
"""Load Hbase.thrift as the Hbase_thrift module using thriftpy2 on import.""" from pkg_resources import resource_filename import thriftpy2 thriftpy2.load(resource_filename(__name__, 'Hbase.thrift'), 'Hbase_thrift')
from django.shortcuts import redirect from django.contrib.auth.models import User from django.http import JsonResponse def login_redirect(request): return redirect('/') def validate_username(request): username = request.GET.get('username', None) data = { 'is_taken': User.objects.filter(username__i...
import time from datetime import datetime def str_to_seconds(time_s, format_s='%Y-%m-%d %H:%M:%S'): struct_t = time.strptime(time_s, format_s) return int(time.mktime(struct_t)) def str_to_mcroseconds(time_s, format_s='%Y-%m-%d %H:%M:%S'): struct_t = datetime.strptime(time_s, format_s) return time.mkti...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Created by Hao Luo at 2019-09-02 """Step_simulate.py :description : script :param : :returns: :rtype: """ import os import cobra import matplotlib.pyplot as plt import numpy as np os.chdir('../../ComplementaryData/Step_03_Compare_Refine/') print('----- loading mode...
def escreva(msg): t = len(msg) print('-' * t) print(msg) print('-' * t) escreva('Henrique Alvaro') escreva('HAMS') escreva('python')
import unittest from hotspots.hs_io import HotspotReader from ccdc.utilities import _csd_required, PushDir from ccdc import io from ccdc.molecule import Atom from ccdc.pharmacophore import Pharmacophore, GeometricDescriptors from hotspots.protein_extension import Protein from hotspots.grid_extension import Gri...
import json import serial class PrometheusSerial: portPrefix = '/dev/ttyUSB' portNumber = 0 connected = False connection = None socket = None reactor = None def __init__(self, reactor): print "PrometheusSerial: Starting serial communication" self.reactor = reactor self.init() def init(self): seri...
from flask import Flask # flask server from flask import request # how the user requested a resource from flask import render_template # to use templates/layouts app = Flask(__name__) # Something i can do in templates: # {{ var_name }} # {% """kind of python code on flask""" %} # [@] signifies a decorator - way...
num =1 num2 =22 num4 =3333 num5 =88 num5 = 666
#!/usr/bin/env python """ Functions for solving a 1D wave equation. """ from __future__ import division # disable integer division from scitools.numpyutils import * from CurveViz import * def solver(I, f, c, U_0, U_L, L, n, dt, tstop, user_action=None, version='scalar'): """ Solve the wave equation...