text
stringlengths
3.07k
12.6k
# 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 th...
from __future__ import unicode_literals import time import io import datetime import os.path import re import logging import itertools import msgpack import snappy import boto.s3 from boto.s3.connection import OrdinaryCallingFormat from .encoding import ascii_to_unicode_str, unicode_to_ascii_str MAX_BUFFER_SIZE = 102...
#!/usr/bin/env python import argparse from datetime import datetime import logging logger = logging.getLogger('KNNC') import os os.environ.update( OMP_NUM_THREADS = '1', OPENBLAS_NUM_THREADS = '1', NUMEXPR_NUM_THREADS = '1', MKL_NUM_THREADS = '1', ) import warnings from joblib import Parallel, delayed...
#!/usr/bin/env python # Copyright 2018 The Bazel 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 ...
#!/usr/bin/env python """This script shows an example of using the PyWavefront module.""" import ctypes import sys sys.path.append('..') import pyglet from pyglet.gl import * from pywavefront import visualization import pywavefront import numpy as np import cv2 import cv2.aruco as aruco import glob # resource path imp...
# Coyright 2017-2019 Nativepython 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 ...
import numpy as np from .FindPDSFiles import FindPDSFiles from ...Tools.ReadPDSFile import ReadPDSFile import RecarrayTools as RT from ... import Globals from ...Tools.PDSFMTtodtype import PDSFMTtodtype import DateTimeTools as TT import os edrfields = { 'MET': 'MET', 'FIPS_SCANTYPE': 'ScanType', 'PROTON_RAT...
from glob import glob import os import nibabel as nib import numpy as np import torch from torchvision.datasets.folder import IMG_EXTENSIONS from warnings import warn from utils.utils import CenterCrop3D, ResizeGray, histogram_equalization DATAROOT = str(os.environ.get('DATAROOT')) DICOM_EXT = ('.dcm', ) NIFTI_EXT ...
import torch from torch.utils.data.dataset import Dataset import os import glob import cv2 import numpy as np #from common_path import train_set_path_ as dataset_dir def img2tensor(img_arr): '''float64 ndarray (H,W,3) ---> float32 torch tensor (1,3,H,W)''' img_arr = img_arr.astype(np.float32) img_arr = img...
import os from flask import Flask, render_template, request, url_for import oauth2 as oauth import urllib.request import urllib.parse import urllib.error import json app = Flask(__name__) app.debug = False request_token_url = 'https://api.twitter.com/oauth/request_token' access_token_url = 'https://api.twitter.com/o...
import random, os import numpy as np import pandas as pd import seaborn as sns import tensorflow as tf import matplotlib.pyplot as plt token2int = {x:i for i, x in enumerate('().ACGUBEHIMSX')} token2int_seq = {x:i for i, x in enumerate('ACGU')} token2int_struct = {x:i for i, x in enumerate('().')} token2int_...
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. # Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Licen...
"""Criando a função que realiza a validação dos processos Revision ID: d39f83f51f4e Revises: <KEY> Create Date: 2020-10-20 06:56:01.157257 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'd39f83f51f4e' down_revision = '<KEY>' branch_labels = None depends_on = N...
from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.decorators import login_required from django.views.generic.list import ListView from django.views.generic.detail import DetailView from django.views.generic.edit import Cre...
import math import numpy as np import networkx as nx import matplotlib.pyplot as plt import random from scipy.linalg import subspace_angles import csv ### HELPER FUNCTIONS ### def subspace_dist(A, B): ''' Inputs: A, B - Two subspaces (columns of each matrix are basis for the subspace) Outputs: Th...
from typing import Optional import torch from torch import Tensor import torch.nn.functional as F from torch_utils import misc #---------------------------------------------------------------------------- def fast_bilinear_mult(x, styles): """ x: [b, c, h, w], styles: [b, c, 2, 2] """ b, c, h, w...
import math import gmsh gmsh.initialize() gmsh.open("/Users/mcgurn/chrestScratch/ablateInputs/geom/slabMotor.3D.hex.msh") # Load in the element elementIds = gmsh.model.mesh.getElementsByCoordinates(0.138613, 0.0175073, 0.00679931, 3, False) # Print the element information for elementId in elementIds: print("El...
import os import os.path import sys import numpy as np import pytest # Local files current_file = os.path.realpath(__file__) current_dir = os.path.dirname(current_file) sys.path.insert(0, os.path.join(os.path.dirname(current_dir), 'common_python')) import tools # ============================================== # Objec...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import wiringpi import time def usleep(x): return time.sleep(x / 1000000.0) class Lcd1602: RS = 0 RW = 1 STRB = 2 LED = 3 D4 = 4 D5 = 5 D6 = 6 D7 = 7 LCD_BLINK_CTRL = 0x01 LCD_CURSOR_CTRL = 0x02 LCD_DISPLAY_CTRL = 0x04 ...
class svgClass: def __init__(self,Fname,Db): self.Fname = Fname self.File = open(Fname,'w') # self.File.write('<svg xmlns="http://www.w3.org/2000/svg" version="1.1">\n') self.Db=Db self.Color = 'black' self.textSize = 1 self.RGB = 0,0,0 self.offsetX...
exit("Permission Error: github.com bloked the tool") import os import sys import cmd import time import socket import tempfile import requests import threading print_sys = print from rich import print from typing import Optional, Any, Tuple, List TOOLS_PATH = os.path.join(__file__.rsplit('/', maxsplit=2)[0], 'tools/e...
from django import forms from django.db import models from django.utils import timezone from django.utils.safestring import mark_safe from wagtail.admin.edit_handlers import ( FieldPanel, FieldRowPanel, HelpPanel, InlinePanel, MultiFieldPanel, ObjectList, TabbedInterface ) from wagtail.admin.forms import Wagta...
# vim: set fileencoding=utf-8: # # GPIO Zero: a library for controlling the Raspberry Pi's GPIO pins # # Copyright (c) 2016-2021 <NAME> <<EMAIL>> # # SPDX-License-Identifier: BSD-3-Clause import operator from threading import RLock from . import SPI from ..devices import Device, SharedMixin from ..input_devices impor...
"""Genetic Algorithmn Implementation see: http://www.obitko.com/tutorials/genetic-algorithms/ga-basic-description.php """ import random import numpy as np from perceptron import * def neural_to_chromo(neural): chromo = [] neural_map = [[0,0,0], [0,0,1], [0,0,2], [0,1,0], [0,1,1], [0,1,2], [0,2,0], [0,2,1], [0,...
import functools from marshmallow import Schema, fields requiredString = functools.partial(fields.String, required=True) requiredInteger = functools.partial(fields.Integer, required=True) requiredBool = functools.partial(fields.Bool, required=True) requiredFloat = functools.partial(fields.Float, required=True) requir...
import datetime import json import logging import pytz from django.conf import settings from django.contrib.auth import get_user_model from django.core.exceptions import ImproperlyConfigured from jwcrypto import jwe, jwk, jwt from oidc_provider.lib.errors import BearerTokenError from oidc_provider.lib.utils.oauth2 imp...
""" ## Week 3: Quick sort Complexity: - with first element pivot: averge $O(n\log(n))$, worst case $O(n^2)$ - with median element pivot: always $O(n\log(n))$ - with random pivot: average $O(n\log(n))$ - Memory complexity: $O(1)$ in place - sometimes unstable """ import numpy as np import random class QuickSorter: ...
import os import re import sys import time import pickle import numpy as np from tqdm import trange from pypinyin import pinyin, lazy_pinyin, Style curdir = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, curdir) with open(os.path.join(curdir, 'input_dict_nt_max.pickle'), 'rb') as handle: input_dict_...
import json import logging from dataclasses import dataclass, field, asdict from pathlib import Path from uncertify.data.preprocessing.preprocessing_config import PreprocessConfig from uncertify.evaluation.inference import SliceWiseCriteria from typing import Union, List LOG = logging.getLogger(__name__) @datacla...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division import json import numpy as np import os import sys import matplotlib PLOT_FORMAT = os.environ.get('PLOT_FORMAT', 'interactive') if PLOT_FORMAT == 'interactive': def save_figure(fig, name): plt.show() elif PLOT_...
#!/usr/bin/env python3 """ File: section3/3_1_embeddings.py Author: <NAME> Description: Simple autoencoder model to illustrate embeddings with TensorFlow. 1. Build {word => counts} dictionary from training dataset. 2. Store as vocabulary file (always useful to have on-hand). """ import os import numpy as np i...
import json import os import pytest import requests from defusedxml import ElementTree from mock import patch from app.scrapers import small_test from app.server import app REASON = 'Do you have query-server running on http://127.0.0.1:7001 ?' TRAVIS_CI = os.getenv('TRAVIS', False) # Running in Travis CI? @pytest...
# coding: utf-8 import asyncio import time from asynctest import CoroutineMock from sanic import Sanic from spf import SanicPluginsFramework from sanic_oauthlib.client import OAuthException, oauthclient from pytest_sanic.utils import TestClient as SanicTestClient from .server import create_server, db from .client imp...
""" knowledge.py ================================================================ This module handles domain knowledge representation and verification. It transforms knowledge about the data generating process into constraints on the edges of the causal graph. It also verifies if a given causal graph respects a ...
import numpy as np import tensorflow as tf from ..nufft.interp_functions import kbinterp, adjkbinterp def calculate_radial_dcomp_tf(interpob, nufftob_forw, nufftob_back, ktraj, stacks=False): """Numerical density compensation estimation for a radial trajectory. Estimates the density compensation function num...
import datajoint as dj import numpy as np from djutils.templates import SchemaTemplate schema = SchemaTemplate() # ===================================== Neuropixels Probes ===================================== @schema class ProbeType(dj.Lookup): definition = """ probe_type: varchar(32) # e.g. neuropixels...
''' AIDA uses wikipedia page titles from 2004. Our Wikipedia dumps are from Fall 2019. Some pages have changed titles, been deleted, etc. We need to normalize the AIDA dataset by updating the 2004 page titles with the 2019 versions. We have to ensure that the pages match on page ID. To do this, we build a map of 2004_...
from stream_framework.activity import Activity, AggregatedActivity from stream_framework.feeds.aggregated_feed.base import AggregatedFeed from stream_framework.verbs.base import Add as AddVerb, Love as LoveVerb import copy import datetime import unittest import time def implementation(meth): def wrapped_test(self...
import gym from ac_gym import ptan, model import numpy as np import torch import argparse import os from time import time import torch.optim as optim class Solver: def __init__(self, args, algo_name): self.env = gym.make(args.env) os.makedirs('./models/', exist_ok=True) self.models_path...
from __future__ import (division, absolute_import, print_function, unicode_literals) from future import standard_library from future.builtins import * from .common import UnmatchedStepError, combined_match_dict, u from copy import copy from io import StringIO import re import yaml class Step(...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# This file is part of Fuzzgrind. # Copyright (C) 2009 <NAME> # # This work is licensed under the terms of the GNU GPL, version 3. # See the LICENSE file in the top-level directory. def inverse(d): new_d = {} for (k, v) in d.items(): new_d[v] = k return new_d # valgrind/VEX/priv/gues...
import io import os from flask import Flask, Response, render_template, flash, request, redirect, url_for import json import tensorflow as tf from PIL import Image import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from werkze...
""" This module implements a VERY limited parser that finds <link> tags in the head of HTML or XHTML documents and parses out their attributes according to the OpenID spec. It is a liberal parser, but it requires these things from the data in order to work: - There must be an open <html> tag - There must be an open...
#!/usr/bin/env python """ Copyright (c) 2018, salesforce.com, inc. All rights reserved. SPDX-License-Identifier: BSD-3-Clause For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause Command line utility that shows information about Maven artifacts. """ from colle...
# by <NAME>, 2021-1-15 from stable_baselines3 import DQN import gym_flappy_bird from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D import gym import torch import numpy as np import os import pathlib import cv2 activation = {} def get_activation(name): def hook(model, input, output): ...
# SYSTEM REQUIREMENTS # This program has been successfully run under Mac OS 10.10; it is standard Python 2.7 # so it should also run in Unix or Windows. # # INITIAL PROVENANCE: # Programmer: <NAME> # Parus Analytics # Charlottesville, VA, 22901 U.S.A. # http://eventdata.parusanalytics.com # # GitHub reposit...
from librato.streams import Stream class Space(object): """Librato Space Base class""" def __init__(self, connection, name, id=None, chart_dicts=None, tags=False): self.connection = connection self.name = nam...
import json from typing import Any, Dict, List, Optional, cast import dash_bootstrap_components as dbc from dash import ALL, Dash, Input, Output, State, dcc, html from dash.dependencies import MATCH from dash.development.base_component import Component from envinorma.models import Condition from envinorma.models.am_ap...
import os import random import numpy as np from PIL import Image from sklearn.cross_validation import train_test_split from sklearn.utils.validation import check_consistent_length from tensorflow.python.ops.rnn import bidirectional_rnn from tensorflow.python.ops.rnn_cell import BasicLSTMCell def convert_row_to_binar...
import sys import argparse from utils import sanitize_word from utils import REPLACE_MAP SEEN = set() TEMPLATE = ( '{0} -> {1}_{0}\n' + '[string] {1}\n' + '[tree] {0}({1})\n' + '[ud] "({1}<root> / {1})"\n' + '[fourlang] "({1}<root> / {1})"\n' ) def get_args(): parser = argparse.ArgumentParse...
import os, sys, serial, time, traceback from . codes import CMDTYPE, LEDTYPE, SPIChipsets, BufferChipsets from . devices import Devices from . import io from .. channel_order import ChannelOrder from .. driver_base import DriverBase from ... util import exception, log, util from ... drivers.return_codes import ( R...
"""Parses an MRO file into a python representation. There are two pieces to this. First, pyparsing creates a grammar for the mro format and uses that to tokenize it into python objects. Second, those objects are tidied up into something that's a somewhat intuitive interface. """ import collections import os import re...
import subprocess import sys import pathlib import tempfile import shutil import random from distutils.dir_util import copy_tree import sox def validateInput(): # Ensure file was passed as input try: fileInput = sys.argv[1] return fileInput except IndexError: print("No input file p...
# encoding: utf8 # # spyne - Copyright (C) Spyne contributors. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version...
from scipy.stats import norm import numpy as np import torch import importlib import sys def cdf(value): return 0.5 * ( 1 + torch.erf((value - self.loc) * self.scale.reciprocal() / math.sqrt(2)) ) def load_example(example): testcase = None if example == "1Dtoyanalysis": testcase = imp...
from types import SimpleNamespace from collections import Counter import numpy as np import pandas as pd from pandas.tools.plotting import andrews_curves, radviz, parallel_coordinates import matplotlib.pyplot as plt import argparse from sklearn.decomposition import PCA from sklearn.cluster import KMeans from scipy.spat...
from functools import wraps from typing import List from flask import render_template, request, url_for, Response, make_response, redirect, current_app, flash, send_file from flask_login import login_user, current_user, logout_user from werkzeug.urls import url_parse from app import app, get_user_from_token from cert...
import datetime, requests, os, json, urllib.request from io import BytesIO import google_streetview.api from PIL import Image # for signing urls import hashlib, hmac, base64 from urllib3.util import parse_url import gsv_depth_scraper.geom now = datetime.datetime.now() PANO_URL = 'http://maps.google.com/cbk?output=ti...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import itertools import json import logging import shutil import subprocess import sys from itertools import chain from pathli...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author : <NAME> @file : TGrep.py @time : 2018/12/25 @site : @software: PyCharm ,----------------, ,---------, ,-----------------------, ," ,"| ," ,"| ," ," | ...
# encoding: utf-8 """ notification.py Created by <NAME> on 2009-11-05. Copyright (c) 2009-2017 Exa Networks. All rights reserved. License: 3-clause BSD. (See the COPYRIGHT file) """ import string from exabgp.util import hexbytes from exabgp.util import hexstring from exabgp.bgp.message.message import Message # ==...
import torch.autograd as autograd import torch.distributed as distributed from torch.autograd.function import once_differentiable from models.feature_extraction.layers import _backend def _activation_from_name(activation): if activation == "leaky_relu": return _backend.Activation.LeakyReLU elif activa...
# -*- coding=utf-8 -*- # The MIT License (MIT) # # Copyright (c) 2016 R1tschY # # 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 #...
# BenchExec is a framework for reliable benchmarking. # This file is part of BenchExec. # # Copyright (C) 2007-2015 <NAME> # 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...
# -*- mode: python; coding: utf-8 -*- # Copyright 2014 <NAME> <<EMAIL>> and collaborators. # Licensed under the MIT License. """pwkit.pdm - period-finding with phase dispersion minimization As defined in Stellingwerf (1978ApJ...224..953S). See the update in Schwarzenberg-Czerny (1997ApJ...489..941S), however, which c...
# pylint: disable=W0613 # $Filename$ # $Authors$ # Last Changed: $Date$ $Committer$ $Revision-Id$ # Copyright (c) 2003-2011, German Aerospace Center (DLR) #Redistribution and use in source and binary forms, with or without # All rights reserved. #modification, are permitted provided that the following condition...
from __future__ import absolute_import from pyrem_torq import * from pyrem_torq.expression import * from pyrem_torq.treeseq import seq_split_nodes_of_label # TODO We should consider to splitting process to parse two characters operators # such as ^= ++ -- def split_to_str(text): p = re.compile("|".join([ ...
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from abc import ABCMeta, abstractmethod from pathlib import PurePath from textwrap import dedent from typing import List, Tuple, Type from unittest.mock import Mock import pytest from pa...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from bob.data_table import DataTableColumn from django.db.models import Q from ralph.cmdb.models import CI, CI_STATE_TYPES...
# Copyright (C) 2009 Google 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: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
# Copyright (c) 2017 CEF Python, see the Authors file. # All rights reserved. Licensed under BSD 3-clause license. # Project website: https://github.com/cztomczak/cefpython """ Run all examples that can be run on current configuration. Note on GTK 2 / GTK 3 on Windows: Installing both PyGTK and PyGI on Windows wi...
""" Functions to preprocess information before uploading it to WI. """ import datetime import pathlib from typing import Union import cv2 import ffmpeg import pandas as pd from PIL import ExifTags, Image def _get_exif_code(tag: str) -> int: for key, value in ExifTags.TAGS.items(): if value == tag: ...
#Importing Libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt #Importing Dataset train = pd.read_csv('train.csv') train.info() null = train.isnull().sum() #Droping new price column because it has maximum nan value and also Unnamed:0 because it is equivalent to index train ...
"""Dojo for reinforcement learning agent.""" # + # | DEPENDENCIES # + # | STANDARD LIBRARIES from abc import ABC, abstractmethod # | THIRD-PARTY LIBRARIES import gym from torch.utils.tensorboard import SummaryWriter # | CUSTOM LIBRARIES from algorithm import Algorithm from approximator import IterativeMeanApproximato...
import os import platform import re import sys import tempfile import shutil from copy import copy from conans import tools from cpt.packager import ConanMultiPackager,load_cf_class def loadScheme_(name): CONANOS_SCHEME_REPO = os.environ.get('CONANOS_SCHEME_REPO') if not CONANOS_SCHEME_REPO: ...
from collections import Counter class Item(): def __init__(self, letter, price): self.letter = letter self.price = price class Order(): def __init__(self, order_string): self.order_string = order_string self.item_count = Counter(order_string) def get_item_count(self, ite...
import numpy as np from flare.kernels import sc, mc_simple, mc_sephyps """ This module includes interface functions between kernels and gp/gp_algebra str_to_kernel_set is used in GaussianProcess class to search for a kernel function based on a string name. from_mask_to_args converts the hyperparameter vector and th...
import json import lzma import tempfile import zipfile from collections import namedtuple from pathlib import Path from celery import shared_task from django.core.files import File from django.utils import timezone from capapi.serializers import BulkCaseDocumentSerializer from capdb.models import Jurisdiction, Report...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Copyright (c) 2016 46elks AB <<EMAIL>> # Developed in 2016 by <NAME> <<EMAIL>> # Licensed under the MIT License from __future__ import (absolute_import, division, print_function, unicode_literals) import elkme.config import elkme.elks import js...
# # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is 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 # # THIS SOFTWARE IS PR...
from django.db import connection from vapi.constants import MAX_MAPPING_DISTANCE def get_candidates(sequence, search_radius): """ Returns closest segment and distance. Uses built in postgis functions to find the distance in meters between a line (input) and all the segments in the database. Then it re...
import ast import json from flask import Blueprint, g, Response, request from sqlalchemy.exc import IntegrityError from . import worker from .models.user import UserGroup from .models.query import Query from .models.queryrevision import QueryRevision from .models.queryrun import QueryRun from .models.star import Star...
from __future__ import print_function from . import conditions def cartesian_product(*sequences): # TODO: Also exists in tools.py outside the pddl package (defined slightly # differently). Not good. Need proper import paths. if not sequences: yield () else: for tup in cartesian_p...
from collections import defaultdict import time import os import numpy as np from tqdm import tqdm from tensorboardX import SummaryWriter from medicaltorch import datasets as mt_datasets from medicaltorch import models as mt_models from medicaltorch import transforms as mt_transforms from medicaltorch import losses...
# -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # For license information, please see license.txt from __future__ import unicode_literals import json import math import frappe from frappe import _ from frappe.model.document import Document from frappe.utils import flt fro...
import abc import socket from threading import Lock, Thread import six.moves.cPickle as pickle from flask import Flask, request from multiprocessing import Process from ..utils.sockets import determine_master from ..utils.sockets import receive, send from ..utils.serialization import dict_to_model # from multiprocessi...
#Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, so...
import os.path import pyfasta import re from tenkit.regions import Regions from collections import defaultdict import gzip # 10X generated references that should # have genes, regions, and snps files KNOWN_GENOMES = ['10X_hg19_ucsc', '10X_b37', '10X_GRCh38_no_alt_decoy'] def open_reference(reference_path): ''' Op...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2016-2018 Lenovo # # 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...
# encoding=utf-8 import os import pickle import numpy as np from src.util.tfidf import process_tfidf_data, tfidf_train, tfidf_test, tfTF_train, tfTF_test from src.util.util import matrix_cosine_similarity, ngram, constituency_tree, remove_stop_word """ 输入分为两种: sequence or tokens """ def word_vector_similarity_tra...
from django.utils.translation import gettext as _ def test_collection_list(francoralite_context): for username in francoralite_context.USERNAMES: # Open the collections list page for each profile francoralite_context.open_homepage(auth_username=username) francoralite_context.open_url('/col...
#!/usr/bin/env python3 from xdfile.utils import get_args, open_output, find_files, log, debug, info, error, get_log, COLUMN_SEPARATOR, EOL from xdfile.utils import parse_tsv, progress, parse_pathname from xdfile import corpus, xdfile, BLOCK_CHAR # for a given grid # for all words, # show how many distinct clues ...
from tetrisShapes import * import time import random COLOUR_DICT1 = {1: 'red', 2: 'yellow', 3: 'green', 4: 'dark red', 5: 'orange', 6: 'blue', 7: 'purple'} COLOUR_DICT2 = {'red': 1, 'yellow': 2, 'green': 3, 'dark red': 4, 'orange': 5, 'blue': 6, 'purple': 7} def setWin(): win = GraphWin("Play Tetris",...
from django.contrib.gis import measure from django.contrib.gis.db.models.functions import Distance from django.contrib.gis.geos import Point from django.contrib.postgres import search from django.db import models from django.db.models import Count, Max, Q from django.db.models.functions import Length from core.lib imp...
import logging from typing import Iterable, List, Tuple, Type import pandas as pd from pypika.queries import QueryBuilder from fireant.database import Database from fireant.dataset.fields import DataType, Field from fireant.dataset.modifiers import RollupValue from fireant.dataset.references import calculate_delta_pe...
# # Copyright (c) 2019 Analog Devices Inc. # # (see http://www.github.com/analogdevicesinc/libm2k). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 2.1 of the License, or...
#!/usr/bin/env python3 import copy import os import numpy as np import sys # You need spglib and ASE to be installed. You can hardwire their path here. # sys.path.append('/opt/spglib-1.6.0/lib/python') # sys.path.append('/opt/ase-3.8.1.3440') import ase import ase.io import spglib element_symbols = [ 'X', ...
# coding=utf-8 # Copyright 2021 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
###################################################### # # BioSignalML Management in Python # # Copyright (c) 2010-2013 <NAME> # # 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 # # h...