content
stringlengths
0
894k
type
stringclasses
2 values
# -*- coding: utf-8 -*- import os import sys import topology_sdk.api.view.create_view_pb2 import topology_sdk.api.view.delete_view_pb2 import topology_sdk.api.view.fetch_cmdb_business_view_pb2 import topology_sdk.model.topology.view_pb2 import topology_sdk.api.view.fetch_origin_view_pb2 import topology_sdk.api.v...
python
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! import grpc from google.ads.google_ads.v1.proto.resources import mobile_device_constant_pb2 as google_dot_ads_dot_googleads__v1_dot_proto_dot_resources_dot_mobile__device__constant__pb2 from google.ads.google_ads.v1.proto.services import mobile_devi...
python
# Author: Aqeel Anwar(ICSRL) # Created: 10/14/2019, 12:50 PM # Email: aqeel.anwar@gatech.edu import numpy as np import os, subprocess, psutil import math import random import time import airsim import pygame from configs.read_cfg import read_cfg import matplotlib.pyplot as plt def close_env(env_process): process ...
python
#! /usr/bin/env nix-shell #! nix-shell -i python3 -p "[python3] ++ (with pkgs.python37Packages; [ requests future ws4py pytest pylint coveralls twine wheel ])" # <<END Extended Shebang>> import json from pywebostv.discovery import * from pywebostv.connection import * from pywebostv.controls import * with open('/home/...
python
NSIDE = 16 STRENGTH = 500 BACKGROUND = 1000 TILT = 45 ALTERNATING = False TEST = False TALK = True plot = True #%matplotlib inline only a notebook feature. """ Parameters ---------- NSIDE : int Must be a power of 2, corresponding to the number of pixels to occupy TSM (ie NSIDE = 8 => 768 pixels, etc.) STRENGTH : f...
python
# -*- coding: utf-8 -*- """Script to run the experiment for anglicisms with different parameters""" import experiment_context_window_comparative as ecwc score_fns = ['binary', 'raw_count', 'chi_sq', 'dice'] score_lists = {} for window_size in [4,25,60,100]: # for window_size in [90,100,110]: for score_fn in ...
python
# -*- coding: utf-8 -*- """ Created on Sun Jun 25 12:50:46 2017 @author: Sergio Cristauro Manzano """ from ..DB.MySQL_Aena import MySQLAccessAena as DBContext #Server #from self.db.MySQL import MySQLAccess as DBContext #Local class RepositoryVuelosEntrantesAena(): ############################################...
python
import datetime import requests import lxml.html as lh import pandas as pd ## VARS # Code of meteo station station_code = 'CE' # year-month-day to start retrieving data from meteodate = (2021, 5, 13) # how many days of data do we retrieve? meteodays = 62 # name of excel file to write to excelfile = r'mete...
python
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- # # AUTHOR: César Miranda Meza # COMPLETITION DATE: November 23, 2021. # LAST UPDATE: November 27, 2021. # # This code is used to apply the classification evalua...
python
import csv import pickle callstate={} with open('call_state.dat') as fin: reader=csv.reader(fin, skipinitialspace=True, delimiter='|', quotechar="'") for row in reader: #print (row[0]) callstate[row[0]]=row[1:] print ('Done') print ("Saving Object") # Step 2 with open('callstate.dictionary...
python
import json import directory def parse_key_group_name(key_group_name = 'Group.basic'): line = key_group_name.split('.') if len(line) != 2 or not line[0] or not line[1]: raise ValueError('key_group_name not correct, please see dtsk_python_load_demo.py') name_type = line[0] name_value = line[1] ...
python
# coding: utf-8 import unittest from problems.power_of_two import Solution from problems.power_of_two import Solution2 from problems.power_of_two import Solution3 class TestCase(unittest.TestCase): def setUp(self): self.solution = Solution() def test(self): test_data = [ {'n': 0,...
python
import unittest import numpy as np from pax import core, plugin from pax.datastructure import Event, Peak class TestPosRecTopPatternFunctionFit(unittest.TestCase): def setUp(self): self.pax = core.Processor(config_names='XENON1T', just_testing=True, ...
python
# Escreva um programa que leia a velocidade de um carro. Se ele ultrapassar 80Km/h, mostre uma mensagem dizendo que ele foi multado. A multa vai custar R$7,00 por cada Km acima do limite. velocidade = int(input('Quantos Km/h você estava dirigindo ? ')) if velocidade >80: print('QUER VOAR ???') multa = (velocid...
python
""" Unit tests for `dh.ejson`. """ import fractions import unittest import dh.ejson class Test(unittest.TestCase): def test_bytes(self): """ JSON serialization and de-serialization of byte arrays. """ x = bytes([225, 127, 98, 213]) j = dh.ejson.dumps(x) xHat = dh....
python
# Universal Power Supply Controller # USAID Middle East Water Security Initiative # # Developed by: Nathan Webster # Primary Investigator: Nathan Johnson # # Version History (mm_dd_yyyy) # 1.00 03_24_2018_NW # ###################################################### # Import Libraries import Parameters from Initializatio...
python
import tensorflow as tf from tensorflow.keras.layers import (Add, Conv2D, Input, Concatenate, TimeDistributed) from tensorflow.keras.models import Model from .blocks import (RecurrentConvBlock, ResidualBlock, ConvBlock, DenseBlock, TransitionBlock, LocalizedC...
python
############################################################################### ## ## Copyright (C) 2014-2016, New York University. ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## ...
python
from server import Server def start(port): def newServer(port): s = Server(port) return s server = newServer(port) server.start() if __name__ == '__main__': start(":9090")
python
import logging from flask import ( Blueprint, jsonify, request, abort, current_app ) from onepiece.exceptions import ( ComicbookException, NotFoundError, SiteNotSupport ) from . import crawler from . import task from .const import ConfigKey logger = logging.getLogger(__name__) app = B...
python
from flask import render_template,flash, redirect, request, jsonify from flask_wtf import FlaskForm from wtforms import TextField, validators, SubmitField, DecimalField, IntegerField, RadioField from app import app, controller #from .models import from random import randint import json from .controller import plotMete...
python
import inspect from typing import Any, Dict import pytest from di.utils.inspection.abstract import AbstractInspector from tests.di.utils.inspection.module_abstract import ( CanonicalAbstract, DuckAbstract1, DuckAbstract2, DuckAbstract3, DuckAbstract4, DuckAbstract5, NormalClass, abstra...
python
""" Surface Boolean Logic ~~~~~~~~~~~~~~~~~~~~~ Use a surface inside a volume to set scalar values on an array in the volume. Adopted from https://docs.pyvista.org/examples/01-filter/clipping-with-surface.html """ import numpy as np import pyvista as pv from pyvista import _vtk as vtk ###############################...
python
import logging from typing import Union from xml.dom.minidom import Element import requests from huaweisms.api.config import MODEM_HOST from huaweisms.xml.util import get_child_text, parse_xml_string, get_dictionary_from_children logger = logging.getLogger(__name__) class ApiCtx: def __init__(self, modem_hos...
python
''' Created on 16.3.2012 @author: Antti Vainio ''' from leader import leader from follower import follower from vector import vector from thinker import unitType class simulation(): ''' This class handles the calculation of simulation. A single frame can be calculated and executed just by calling ca...
python
s=str(input()) n1,n2=[int(e) for e in input().split()] j=0 for i in range(len(s)): if j<n1-1: print(s[j],end="") j+=1 elif j>=n1-1: j=n2 if j>=n1: print(s[j],end="") j-=1 elif j<=k: print(s[j],end="") j+=1 k=n2-1
python
""" Inspection utilities. """ from typing import Optional import numpy as np import tensorflow as tf # type: ignore from matplotlib import cm # type: ignore from PIL import Image # type: ignore from ._image import preprocess_image, Preprocessing from ._typing import NDUInt8Array, NDFloat32Array def make_grad_cam...
python
#! /usr/bin/env python # coding=utf-8 try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('CHANGELOG.rst') as history_file: history = history_file.read().replace('.. :changelog:', '') re...
python
# -*- coding: utf-8 -*- """ Useful functions to work with dictionaries. """ def deep_get(d, *keys, default=None): """ Recursive safe search in a dictionary of dictionaries. Args: d: the dictionary to work with *keys: the list of keys to work with default: the default value to return ...
python
""" PyRetroPrint emulates Epson ESC/P printers, IBM Proprinters, and Atari 8-series """ __all__ = ["pyretroprint", "page", "epsonfx", "ibm"]
python
# -*- coding: utf-8 -*- """ Created on Fri Jun 8 19:20:13 2018 @author: kejintao input information: 1. demand patterns (on minutes) 2. demand databases 3. drivers' working schedule (online/offline time) ** All the inputs are obtained from env, thus we do not need to alter parameters here """ from path import * imp...
python
from unittest import TestCase from catalog import Catalog class TestCatalog(TestCase): def setUp(self): class TestNum(Catalog): _attrs = 'value', 'label', 'other' red = 1, 'Red', 'stuff' blue = 2, 'Blue', 'things' self.TestNum = TestNum def test_access_at...
python
import unittest2 as unittest import urllib2 from AccessControl import Unauthorized from plone.app.testing import TEST_USER_ID from plone.app.testing import setRoles from zope.component import getUtility from plone.registry.interfaces import IRegistry from collective.flattr.interfaces import ICollectiveFlattr from mocke...
python
""" This is about the prediction of alpha using the conditional input output pair of parameters and outcome """ import os import argparse import numpy as np import pandas as pd import seaborn as sns from collections import Counter import logging from annotator.annot import Annotator from commons import ENDPOINT from e...
python
import asyncio import datetime import time from pprint import pprint from typing import List, Optional, Tuple import meadowflow.event_log import meadowflow.jobs import meadowflow.time_event_publisher import pytest import pytz from meadowflow.time_event_publisher import ( Periodic, PointInTime, TimeEventPu...
python
# Copyright (c) OpenMMLab. All rights reserved. import argparse import warnings from typing import Any import mmcv import torch from mmcv import Config, DictAction from mmcv.parallel import MMDataParallel from torch import nn from mmedit.apis import single_gpu_test from mmedit.core.export import ONNXRuntimeEditing fr...
python
# -*- coding: utf-8 -*- """ @author: Daniel Jiménez-Caminero Costa """ import numpy as np import math def nonlinear_common(p_0, alpha, m_exponents, v_i_array, threshold_db_array): """ Array lists that are necessary for the calculation of the non-linearity and are general to each band. This has bee...
python
import time import math from dronekit import connect from dronekit.mavlink import MAVConnection from dronekit.test import with_sitl from nose.tools import assert_not_equals, assert_equals @with_sitl def test_mavlink(connpath): vehicle = connect(connpath, wait_ready=True) out = MAVConnection('udpin:localhost:1...
python
# ----------------------------------------------------------------------------- # QP/Python Library # # Port of Miro Samek's Quantum Framework to Python. The implementation takes # the liberty to depart from Miro Samek's code where the specifics of desktop # systems (compared to embedded systems) seem to warrant a diff...
python
#!/usr/bin/python '''========================================================================= The Software is copyright (c) Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230. All rights reserved. Licensed under the CSIRO BSD 3-Clause License You may not use this file ex...
python
#!/usr/bin/python import sys import math, numpy as np import roslib; roslib.load_manifest('hrl_fabric_based_tactile_sensor') import rospy from hrl_msgs.msg import FloatArray import hrl_lib.util as ut import hrl_lib.transforms as tr import hrl_fabric_based_tactile_sensor.adc_publisher_node as apn from m3skin_ros.ms...
python
# -*- coding: utf-8 -*- import os import h5py import pathlib as p import numpy as np from .trs import Trs __all__ = ['Ta'] class Ta(Trs): ''' TA experimental class Child class of TRS (time-resolve spectroscopy) Handels Uberfast ps/fs and Fastlab TA files. ''' def __init__(self, full_path=Non...
python
from . import card def get_image_slug(value, size: str="small"): if not isinstance(value, card.Card): return "ERROR[NOT_A_CARD({!r})]".format(value) try: s = card.size_from_str(size) except TypeError: return "ERROR[INVALID_SIZE({!r})]".format(size) try: retur...
python
# -*- coding: utf-8 -*- import os import mongomock import pymongo import pytest import requests from autoradarr.autoradarr import ( convert_imdb_in_radarr, filter_by_detail, filter_in_db, filter_in_radarr, filter_regular_result, get_db, get_imdb_data, get_radarr_data, get_tmdbid_by_...
python
# # Copyright 2018 Analytics Zoo Authors. # # 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...
python
import base64 import difflib import threading from pathlib import Path from typing import Tuple from urllib.parse import quote from nornir.core.task import Optional, Result, Task import requests LOCK = threading.Lock() def _generate_diff(original: str, fromfile: str, tofile: str, content: str) -> str: diff =...
python
#Imports from PIL import Image class RotateImage(object): ''' Rotates the image about the centre of the image. ''' def __init__(self, degrees): ''' Arguments: degrees: rotation degree. ''' # Write your code here self.degrees = degree...
python
""" @author:ACool(www.github.com/starFalll) 根据微博用户动态进行词云,词频分析,和时间分析 """ import jieba from wordcloud import WordCloud from sqlalchemy import create_engine, MetaData,Table, Column, Integer, String, ForeignKey,update,select import re from collections import Counter from pyecharts import Bar, Pie from weibo.Connect_mysql i...
python
import os DESCRIPTION = "sets a variable for the current module" def autocomplete(shell, line, text, state): env = shell.plugins[shell.state] # todo, here we can provide some defaults for bools/enums? i.e. True/False if len(line.split()) > 1: optionname = line.split()[1] if optionname in ...
python
import cv2 import pytesseract pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe' img_path = "Resources/text.png" img = cv2.imread(img_path) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # Convert to RGB hImg , wImg , = img.shape [0] , img.shape [1] print("Enter 1 to read ...
python
# -*- coding: utf-8 -*- """ hdu_api._internal_utils ----------------------- """ import sys from hdu_api import _pyDes _ver = sys.version_info #: Python 2.x? is_py2 = (_ver[0] == 2) #: Python 3.x? is_py3 = (_ver[0] == 3) def encrypt(data, first_key, second_key, third_key): bts_data = extend_to_16bits(data) ...
python
import os import numpy as np class Reversi: def __init__(self): # parameters self.name = os.path.splitext(os.path.basename(__file__))[0] self.Blank = 0 self.Black = 1 self.White = 2 self.screen_n_rows = 8 self.screen_n_cols = 8 self.enable_actions = ...
python
__version__ = "v0.0.dev"
python
# -*- coding: utf-8 -*- """Test different properties in FlowProposal""" from nessai.proposal import FlowProposal def test_poolsize(proposal): """Test poolsize property""" proposal._poolsize = 10 proposal._poolsize_scale = 2 assert FlowProposal.poolsize.__get__(proposal) == 20 def test_dims(proposal)...
python
from corehq.apps.groups.models import Group from corehq.apps.users.models import CommCareUser, CouchUser from corehq.apps.users.util import WEIRD_USER_IDS from corehq.elastic import es_query, ES_URLS, stream_es_query, get_es from corehq.pillows.mappings.user_mapping import USER_MAPPING, USER_INDEX from couchforms.model...
python
"""Contains classes to store the result of a genetic algorithm run. Additionally, the classes in this module allow for figure generation. """ from abc import ABC import copy import enum import math import random from typing import Dict, List, Union from os import listdir, mkdir from matplotlib import pyplot as plt f...
python
from flask import Flask from flask import request from flask import jsonify from flask import send_from_directory from flask import Response from flask import abort from werkzeug import secure_filename from setup import * app = Flask(__name__) #app = Flask(__name__, static_url_path='') app.config['MAX_CONTENT_LENG...
python
import gizeh from .base_form import BaseForm from .base_picture import BasePicture @BasePicture.register_subclass('circle') class Circle(BaseForm): def draw(self, ind): circle = gizeh.circle( r=self.radius[ind], xy=self.center, fill=self.color[ind], **self...
python
from datetime import datetime from gtts import gTTS def speech_1(text, sender): msg = 'Da: {}. Oggetto: {}'.format(sender, text) tts = gTTS(text=msg, lang='it') now = datetime.now() title = sender.replace(' ', '_') + now.strftime('_%d-%m-%y_%H-%M-%S') + '.mp3' print(title) tts.save(title) ...
python
import random import numpy as np import torch class min_max_node_tracker: def __init__(self): self.max = float('-inf') self.min = float('inf') def normalized(self, node_Q): """ Normalize the value to [0, 1] Parameters ---------- node_Q : float ...
python
""" We are given head, the head node of a linked list containing unique integer values. We are also given the list G, a subset of the values in the linked list. Return the number of connected components in G, where two values are connected if they appear consecutively in the linked list. Example 1: Input: head: 0-...
python
# -*- coding: utf-8 -*- import unittest from clu.phontools.struct import * from .utils import phrase1 """ Test `clu.phontools.struct.Phrase` behaviors """ class PhraseTests(unittest.TestCase): phrase1: Phrase = phrase1 def test_equality(self): """Comparisions of pairs of `clu.phontools.struct.Phra...
python
from django.db import models from django.utils.translation import gettext as _ from django.conf import settings from django.utils import timezone from dateutil.relativedelta import relativedelta from datetime import date from django.urls import reverse_lazy from app.models import TimeStampMixin class TypeOfService(Ti...
python
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-11-13 10:48 from __future__ import unicode_literals import annoying.fields import django.core.validators from django.db import migrations, models import django.db.models.deletion import django_fsm import silver.models.documents.base def move_documents_to_b...
python
from Factory import customer # set data if __name__ == "__main__": cust = customer.Customer() data = cust.get_data() sorted_data = cust.sort_by_revenue(cust.data) print('\n\n') print("In order of annual revenue the accounts low to high are:") cust.print_data(sorted_data) print('\n') pr...
python
#!/usr/bin/python3 class Transform: def __init__(self, position, rotation=0, scale=1, layer=0): """ The transform defines spatial orientation parameters :param position: the position :param rotation: the rotation in degrees :param scale: the scale (1 is 100%) :para...
python
#!/usr/bin/python3 # First choice pack and unpack into sqlite # Paul H Alfille 2021 # Wrap firstchoice-specific code into an sqlite3 one. try: import sys except: print("Please install the sys module") print("\tit should be part of the standard python3 distribution") raise import first import ...
python
from io import BytesIO import math from wand.image import Image as WandImageBase from wand.color import Color as WandColor import aiohttp import discord class Color(WandColor): """ A little subclass of wand.color.Color Adds functionality for ascii art. """ def __init__(self, *args, **kwargs): ...
python
# Check if One Array can be Nested in Another # Create a function that returns True if the first list can be nested inside the second. def can_nest(list1, list2): sortedlist1 = sorted(list1) sortedlist2 = sorted(list2) return sortedlist2[0] < sortedlist1[0] and sortedlist1[-1] < sortedlist2[1] print(can_nest([3, ...
python
import cpg_scpi from time import sleep def main(): cpg = cpg_scpi.CircuitPlayground() if cpg.is_open: repeat(what=cpg.buttonAny, count=10, delaySeconds=1) repeat(what=cpg.buttonLeft, count=10, delaySeconds=1) repeat(what=cpg.buttonRight, count=10, delaySeconds=1) repeat(what=cp...
python
import random ch = {} class Node(object): def __init__(self, val): #self.ID = id(self) #self.weight = random.randint(1, 10) self.ID = val self.weight = self.ID self.cluster = [] self.clusterHead = None self.neighbours = [] ch[self] = F...
python
import torch.nn as nn from ..builder import BACKBONES from .base_backbone import BaseBackbone import numbers import collections import logging import functools import torch from torch import nn from torch.nn import functional as F from mmcls.models.backbones.transformer import Transformer checkpoint_kwparams = None #...
python
# -*- coding: utf-8 -*- """ Created on Mon Jan 28 13:33:54 2019 Programa que permite contar las vocales dentro de una palabra @author: Luis Cobian """ palabra = input("Una palabra: ") palabra = palabra.lower(); a = palabra.count("a"); e = palabra.count("e"); i = palabra.count("i"); o = palabra.count("o"); u = palabr...
python
import pytest import urlpath from cortex.utils.databases import mongo_db
python
from __future__ import unicode_literals import cv2 import numpy as np import mediapipe as mp from tensorflow.keras.models import load_model import cv2 mp_hands = mp.solutions.hands # Hands model mp_drawing = mp.solutions.drawing_utils # Drawing utilities def mediapipe_detection_hands(image, model): # image = cv2....
python
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
python
from typing import Any, Dict from .ml_model import MLModel from .modeler import Modeler class MLModeler(Modeler): """ Base class for H1st ML Modelers. Has capabilities that are specific to MLModels. """ def train_model(self, prepared_data: dict) -> MLModel: """ Implement logic of ...
python
# PLEASE NOTE # =========== # # The code in this module is a slightly modified version of the code from # the Chemistry Toolkit Rosetta Wiki. # http://ctr.wikia.com/wiki/Calculate_TPSA # # The algorithm follows the approach of Ertl et al., which is to sum partial # surface contributions based on fragments defined in a...
python
from io import BytesIO from os import path from PIL import Image # Each entry in the list contains the information necessary to render the final # image with each of the layers resized and cropped accordingly. Some of this # information is also required by the JavaScript on the page. TEMPLATES = { 'bq-aquaris': ...
python
import json from urllib.parse import parse_qsl, urlencode import falcon import requests from requests_oauthlib import OAuth1Session from sikre import settings from sikre.models.users import User from sikre.resources.auth import utils from sikre.utils.logs import logger class LinkedinAuth(object): def on_post(s...
python
#!/usr/bin/env python # coding: utf-8 """ mq modules defines Message Queue clients and some tools. """ from .rabbit import RabbitMQConnection from .kafka import KafkaConnection from .consts import MQTypes class MQClientFactory(): def __init__(self, mq_type): self._mq_type = mq_type if mq_type n...
python
import os import sys import csv import copy import time import random import argparse import numpy as np np.set_printoptions(precision=4) from matplotlib.animation import FFMpegWriter from tqdm import tqdm # from minisam import * # how to install minisam: https://minisam.readthedocs.io/install.html ...
python
""" ========================== Non blocking stream reader ========================== """ import time from typing import Optional, TypeVar, Union from threading import Thread from queue import Queue, Empty Stdout = TypeVar('Stdout') Seconds = TypeVar('Seconds') ######################################################...
python
from aws_ssm_copy.copy import main
python
import torch import torch.nn as nn import numpy as np import torch.nn.functional as F class Conv2DBatchNorm(nn.Module): def __init__( self, in_channels, n_filters, k_size, stride, padding, bias=True, dilation=1, is_batchnorm=True, ): ...
python
class Solution: def XXX(self, s: str) -> bool: # 栈用于存储左括号 stack = [] for char in s: if char in '([{': # 如果是左括号,压入 stack.append(char) else: # 如果是右括号,栈空(无左括号),或左右不匹配,则无效 if not stack or '([{'.f...
python
from setuptools import setup with open("README.md","r") as fh: long_description = fh.read() setup( url="https://github.com/dave-lanigan/kyber-api-python", author="Daithi", author_email="dav.lanigan@gmail.com", name="kybernet", version="0.0.1", description="Unofficial python wrapper for Ky...
python
import numpy as np list = [np.linspace([1,2,3], 3),\ np.array([1,2,3]),\ np.arange(3),\ np.arange(8).reshape(2,4),\ np.zeros((2,3)),\ np.zeros((2,3)).T,\ np.ones((3,1)),\ np.eye(3),\ np.full((3,3), 1),\ np.random.rand(3),\ np.random.rand(3,3),\ np.random.uniform(5,15,3),\ np.random.randn(3),\ np.random.normal(3, 2.5, ...
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: LiuZhi @time: 2019-01-20 00:28 @contact: vanliuzhi@qq.com @software: PyCharm """ from flask import render_template, send_from_directory, abort, request from flask.blueprints import Blueprint from flask_security import login_required index_bp = Bluepri...
python
# # Copyright 2018 ISP RAS (http://www.ispras.ru) # # 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 agr...
python
from sqlalchemy.orm import Session from ..models import users, sensors from .. import routers from .. import schemas def get_sensors_for_user(db: Session, username: str): user_id = db.query(users.User).filter(users.User.username == username).first().id print(user_id) return db.query(sensors.Sensor).filte...
python
PATTERNS = { "precedence": { "afterward(s)": "^afterwards?", "after that": "^after th(at|is)", "eventually": "^eventually", "in turn": "^in turn", "later": "^later", "next": "^next", # followed by pronoun? "thereafter": "^thereafter" }, "succession": { ...
python
#!/usr/bin/python # coding=utf8 from char_rnn_net import char_rnn_net from config import Config from data_utils import get_data import tensorflow as tf from utils import pick_top_n def gen_acrostic(start_words, word2ix, ix2word, prefix_words=None): with tf.Session() as sess: save_path = Config.model_path...
python
#! /usr/bin/env python import unittest import ddlib as dd class TestDDLib(unittest.TestCase): def setUp(self): self.words = ["Tanja", "married", "Jake", "five", "years", "ago"] self.lemma = ["Tanja", "marry", "Jake", "five", "years", "ago"] def test_materialize_span(self): span1 = dd.Span(0, 3) ...
python
"""---------------------------------------------------------- Authors: Wilhelm Ågren <wagren@kth.se> Last edited: 12-03-2022 License: MIT ----------------------------------------------------------""" from autograd import Tensor class Module(object): def __call__(self, x): return self.forward(x) def ...
python
import math import multiprocessing import itertools import glob import sys import time import re import numpy as np from matplotlib import pyplot as plt from astropy.io import fits as pyfits from scipy.optimize import fmin_powell from scipy.interpolate import RectBivariateSpline from . import kepio, kepmsg, kepkey, kep...
python
#!/usr/bin/env python3 from __future__ import print_function import os import pythondata_cpu_minerva print("Found minerva @ version", pythondata_cpu_minerva.version_str, "(with data", pythondata_cpu_minerva.data_version_str, ")") print() print("Data is in", pythondata_cpu_minerva.data_location) assert os.path.exist...
python
#! /usr/bin/python # -*- coding: utf-8 -*- __author__ = "Osman Baskaya" from pprint import pprint from collections import defaultdict as dd from classifier_eval import ChunkEvaluator from logger import ChunkLogger from classifier import * import mapping_utils import sys import os chunk_types = ['semcor', 'uniform',...
python
""" Chouette storages file. For now it's just a RedisStorage. It could be made more enterprise-y with a Storage interface, but it'll work for now as is. """ import json import logging import os import re from datetime import datetime from typing import Any, Dict, Optional from uuid import uuid4 from redis import Redis...
python
# state ChrMarineStartingLeft # autogenerated by SmartBody stateManager = scene.getStateManager() stateChrMarineStartingLeft = stateManager.createState1D("mocapStartingLeft") stateChrMarineStartingLeft.setBlendSkeleton('ChrBackovic.sk') motions = StringVec() motions.append("ChrMarine@Idle01_ToWalk01") motion...
python