text stringlengths 3.07k 12.6k |
|---|
# Copyright 2014 VMware, 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 a... |
# -*- coding: utf-8 -*-
"""
MIT Licence
<NAME>
Change data to your location
"""
from keras import backend as K
from keras.engine.topology import Layer
from keras.initializers import RandomUniform, Initializer, Constant
import numpy as np
class InitCentersRandom(Initializer):
""" Initializer for initialization ... |
import jet
import sys
from random import randint
from inspect import getargspec
from helpers import cprint
from jet.jit import jit
import numpy as np
ERROR_MAX = 1.e-12
mode = 0 if 'continue' in sys.argv else 1
dimensions = []
for f_name in ['0d', '1d', '2d']:
with open(f_name) as file:
dimensions_raw =... |
import os
from time import sleep, time
from kivy.logger import Logger
from kivy.storage.jsonstore import JsonStore
from kivy.utils import platform
from plyer import notification
from raven import Client
from ethereum_utils import AccountUtils
from etheroll.constants import KEYSTORE_DIR_SUFFIX
from etheroll.patches im... |
"""Slot Attention model for object discovery and set prediction.
coding=utf-8
Copyright 2020 The Google Research 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/... |
"""
117. Populating Next Right Pointers in Each Node II
Medium
Given a binary tree
struct Node {
int val;
Node *left;
Node *right;
Node *next;
}
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
Initially, all next pointers ar... |
# Copyright (c) 2020 <NAME>
# Use of this source code is governed by an MIT
# license that can be found in the LICENSE file.
import subprocess, os, sys, json, threading, signal, traceback, rpcworker, addresses
from PyQt5.QtCore import *
from PyQt5 import QtWidgets
#from resource import resource_path
from rpcworker imp... |
#!/usr/bin/env python
import argparse, math, re
parser = argparse.ArgumentParser(
description="Converts VarScan2 somatic indel vcf to annovar format", formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('input', help='Input indel file generated by VarScan2 somatic')
# parser.add_argument(... |
from django.utils import tree
import re
FILTER_CONTAINS = u'%(field)s:%(value)s'
FILTER_EXACT = u'%(field)s:"%(value)s"'
FILTER_COMPARE = {
'gt': u'%(field)s:{%(value)s TO *}',
'gte': u'%(field)s:[%(value)s TO *]',
'lt': u'%(field)s:{* TO %(value)s}',
'lte': u'%(field)s:[* TO %(value)s]',
}
FILTER_RANG... |
import json
import csv
import gzip
from typing import NamedTuple
import io
import itertools
from pathlib import Path
import ir_datasets
from ir_datasets.util import DownloadConfig, TarExtract, ZipExtractCache
from ir_datasets.formats import BaseDocs, BaseQueries, BaseQrels
from ir_datasets.formats import GenericDoc, Ge... |
from future.moves.urllib.parse import urlparse
from django.db import connection
from django.db.models import Sum
import requests
import logging
from django.apps import apps
from api.caching.utils import storage_usage_cache
from framework.postcommit_tasks.handlers import enqueue_postcommit_task
from api.caching impor... |
import sys
from os import mkdir
from os.path import join, exists
import numpy as np
import pandas as pd
import plotly.graph_objects as go
# If plotly does not save the image, try:
# conda install psutil
# conda install -c plotly plotly-orca
# Saving the image may be more complex on Linux
def plot_decomposition(resul... |
import math
import logging
import numpy as np
from openpathsampling.netcdfplus import StorableNamedObject
logger = logging.getLogger(__name__)
init_log = logging.getLogger('openpathsampling.initialization')
class ShootingPointSelector(StorableNamedObject):
def f(self, snapshot, trajectory):
"""
... |
# Copyright (c) 2014 Eventbrite, Inc. All rights reserved.
# See "LICENSE" file for license.
import re
def add_intl(template_string):
"""Wraps the language specific text in an html mako template in the
proper get text formatting.
template_string -- The string to convert.
returns The converted string... |
#!/usr/bin/env python
from __future__ import absolute_import, division, print_function, \
unicode_literals
import os
import sys
import time
import socket
import six.moves.urllib as urllib
import hashlib
import logging
from zeroconf import ServiceInfo, Zeroconf
from six.moves.BaseHTTPServer import BaseHTTPRequestHa... |
"""
Unit tests for gp.py
-- <EMAIL>
"""
# pylint: disable=import-error
# pylint: disable=no-member
# pylint: disable=invalid-name
# pylint: disable=relative-import
from utils.base_test_class import BaseTestClass, execute_tests
import numpy as np
# Local
import gp_core
import kernel
def gen_gp_test_data():
"""... |
# -*- coding: utf-8 -*-
import sqlite3
import argparse
from urllib.request import Request, urlopen
import csv
import re
import xml.etree.ElementTree as ET
from typing import List, Dict
import collections
import json
# BLASTの結果のtextファイル名をパラメータから取得
# $ python m2o.py <file path> のようにBLASTのformat 6 outputファイルを引数にしてスクリプトを... |
import mypolygon # I'll want to use functions from mypolygon.py
import turtle
import math
# 4.1.1
# Stack diagram, from circle(bob, radius) fuction call in
# provided polygon.py
#----------------------------------------------
# __main__ | bob -> turtle.Turtle()
# | radius -> 100
#-------... |
"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
"""
import os
import sys
import requests
from lxml import html
from urllib.parse import urlparse, urljoin
from tqdm import tqdm
import json
from pathlib import Path, PureWindowsPath
from .create import clean_filename
import multiprocessing
import multiprocessing.pool
im... |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests for ensuring correctness of CPU and cache topology in the guest."""
import os
import platform
import pytest
import framework.utils_cpuid as utils
TOPOLOGY_STR = {1: "0", 2: "0,1", 16: "0-15"}
PLATF... |
from .datalog import Fact
from .exceptions import NeuroLangException
from .expression_walker import PatternWalker, add_match, expression_iterator
from .expressions import Constant, ExpressionBlock, FunctionApplication, Symbol
from .logic import ExistentialPredicate, Implication
from .utils.orderedset import OrderedSet
... |
import paho.mqtt.client as mqtt
import sys,os, time
from threading import Thread
from json import loads, dumps
from datetime import datetime
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), ".."))
from adapter.mtconnect_adapter import Adapter
from adapter.data_item import DataItem, Event, Simp... |
import os
import cv2
import traceback
import numpy as np
from io import BytesIO
from PIL import Image
import tritonclient.grpc as grpcclient
from tritonclient.utils import InferenceServerException
def get_client_and_model_metadata_config(FLAGS):
try:
# Create gRPC client for communicating with the server... |
"""
Pre-process dataset by extracting aligned cropped mouths. Adapted from https://github.com/mpc001/
Lipreading_using_Temporal_Convolutional_Networks/blob/master/preprocessing/crop_mouth_from_video.py"""
import argparse
import os
from collections import deque
import numpy as np
from PIL import Image
from tqdm import... |
#!/usr/bin/env python
#************************************************************************
#
# Plot figures and output numbers for Fraction of Absorbed Photosynthetic Radiation (FPR) section.
# For BAMS SotC 2016
#
#************************************************************************
# ... |
import random
import hmac
import time
from typing import Optional
import discord
import requests
import src.db as db
from .config import keys, cfg
from .utils import is_mod, updateWebhooks, seconds_convert, convert_utc_to_epoch, webhookStreamsRequest
from .log import logger
client = discord.Client()
st... |
from __future__ import absolute_import
import numpy as np
import itertools
import operator
import random
import sys
import copy
from benchmark.plotting.eval_range_search import compute_AP
from benchmark.sensors.power_capture import power_capture
def compute_recall_without_distance_ties(true_ids, run_ids, count):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/server/graphql/types/misc.py
#
# 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
# ... |
"""
@file
@brief CorrPlot functionalities.
It comes from `corrplot.py <https://raw.githubusercontent.com/biokit/biokit/master/biokit/viz/corrplot.py>`_
which I copied here because the module does not properly work on Python 3 (import issues).
See also `biokit license <https://github.com/biokit/biokit/blob/master/LICEN... |
# -*- coding: utf-8 -*-
"""
Base model information
@author: Colin
"""
import datetime
import numpy as np
import pandas as pd
class ModelObject(object):
"""Generic class for holding forecasting models.
Models should all have methods:
.fit(df, future_regressor = []) (taking a DataFrame with DatetimeIn... |
# Copyright 2017 AT&T Intellectual Property. All other 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... |
import numpy as np
import torch as torch
from torch.utils.data import Dataset
from nuscenes.nuscenes import NuScenes
from nuscenes.utils.geometry_utils import transform_matrix
from nuscenes.utils.data_classes import PointCloud, LidarPointCloud
from pyquaternion import Quaternion
import os.path as osp
from functools imp... |
import itertools
from collections import Counter
# 计算皇家同花顺需要的牌
def find_royal_flush_cards(visible_cards: list):
existing_cards = []
possible_cards = []
# 至少要先能凑成同花
possible_suit = is_flush_possible(visible_cards)
if possible_suit != '':
for card in visible_cards:
if card[0] == ... |
# -*- mode: python; coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2012, 2015, 2018 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systemes Répartis Coopératifs (SRC), Université Pierre
# et <NAME>.
#
# This file is pa... |
from datetime import datetime
from corehq.apps.locations.models import SQLLocation
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn
from corehq.apps.reports.filters.fixtures import AsyncLocationFilter
from corehq.apps.reports.filters.select import MonthFilter, YearFilter
from custom.ilsgate... |
# standard python imports
import unittest.mock as mock
import builtins
import json
import socket
# 3rd party imports
import pytest
# two1 imorts
from two1.commands.util import bitcoin_computer
# String to use as the content of the mocked file
UUID_STR = "12345678-1234-1234-1234-123456789012"
@pytest.mark.parametri... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
QSDsan: Quantitative Sustainable Design for sanitation and resource recovery systems
This module is developed by:
<NAME> <<EMAIL>>
This module is under the University of Illinois/NCSA Open Source License.
Please refer to https://github.com/QSD-Group/QSDsan/blob/... |
# Copyright (C) 2013-2016 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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.a... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging as _logging
import pybullet as _pybullet
import numpy as _numpy
from .joint_info import JointInfo
from .joint_state import JointState
from .link_state import LinkState
from .dynamics_info import DynamicsInfo
_log = _logging.getLogg... |
"""test for CharArrowKeysInput"""
import os
import unittest
from mock import patch, Mock
try:
from ui import CharArrowKeysInput
except ImportError:
print("Absolute imports failed, trying relative imports")
os.sys.path.append(os.path.dirname(os.path.abspath('.')))
# Store original __import__
orig_i... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pandas as pd
import tensorflow as tf
COLUMNS = ["age", "workclass", "fnlwgt", "education", "education_num",
"marital_status", "occupation", "relationship", "race", "gender",
"capi... |
import bpy
import os
import sys
import json
import time
import random
import numpy as np
from random import sample
import bpy, bpy_extras
import glob
def clear_scene():
'''Clear existing objects in scene'''
for block in bpy.data.meshes:
if block.users == 0:
bpy.data.meshes.remove(block)
... |
#
# Copyright 2016 The BigDL 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 in ... |
from typing import Tuple
import torch
import torch.nn as nn
from torch.nn.functional import conv2d
def laplacian_1d(window_size) -> torch.Tensor:
r"""One could also use the Laplacian of Gaussian formula
to design the filter.
"""
filter_1d = torch.ones(window_size)
filter_1d[window_size // 2]... |
import datetime as dt
import os
import sys
import subprocess
from argparse import ArgumentParser
from timeflow import stats as statistics
from timeflow import utils
def log(args):
utils.write_to_log_file(args.message)
def _call_editor(editor, filename):
editor = editor.split()
subprocess.call(editor +... |
# -*- coding: utf-8 -*-
"""Run all tests for `mcpyrate`."""
import os
import re
import subprocess
import sys
import traceback
from importlib import import_module
from mcpyrate.colorizer import ColorScheme, colorize
from mcpyrate.pycachecleaner import deletepycachedirs
import mcpyrate.activate # noqa: F401, this ena... |
# Copyright (C) 2006-2013 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
import networkx as nx
__author__ = """\n""".join(['<NAME> <<EMAIL>>',
'<NAME> (<EMAIL>)',
'<NAME> (<EMAIL>)'])
__all__ = ['c... |
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import transaction
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.http import Http404
from django.shortcuts import redirect
from djan... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
import ast
import collections
import re
import sys
import typing
from functools import... |
import tensorflow as tf
def relu(input_):
with tf.name_scope('relu'):
return tf.nn.relu(input_)
def lrelu(input_, leak=0.2):
with tf.name_scope('lrelu'):
return tf.maximum(input_, leak * input_)
def instance_norm(input_):
with tf.name_scope('instance_norm'):
num_channels = inpu... |
#!/usr/bin/env python3
import argparse
parser = argparse.ArgumentParser(description='Extract the features of each segmented region.')
parser.add_argument(
"img", help="the path to the original image from which the segmented regions came"
)
parser.add_argument(
"labels", help="the path to the file containing th... |
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmflow.models.decoders.maskflownet_decoder import (BasicDeformWarpBlock,
DeformWarpBlock,
MaskFlowNetSDecoder,
... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import time
from natsort import natsorted
from cm_client.rest import ApiException
import cm_client
from ansible.module_utils.basic import AnsibleModule
ANSIBLE_METADATA = {
"metadata_version": "1.0",
"supported_by": "community",
"status": ["preview"],
"versio... |
# Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import abc
import pytest
import reframe.core.launchers as launchers
from reframe.core.backends import getlauncher
from refram... |
#!/usr/bin/python3
# Script to generate permutations of media and run a MMODES simulation in different
# parallel processes.
import sys, os, re
import random
import json
import mmodes
import dill as pickle
import subprocess
import pandas as pd
from copy import deepcopy as dcp
from multiprocessing import Pool, Lock
sy... |
# -#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# @Author : Ch
# File : model_cross_transformer.py
# @Time : 2021/9/3 15:09
import numpy as np
import torch.nn as nn
from .model_transformer import PositionWiseFeedForward, ScaledDotProductAttention
class CrossMultiHeadAttention(nn.Module):
'''
Mu... |
"""
Example of a simple VariationalAutoEncoder implementation in plain PyTorch.
NOTE: This is a raw Pytorch implementation. A Pytorch Lightning module can be found in the models folder while
this implementation here is only for tutorial / learning purposes.
"""
import torch
from torch import nn
import torch.nn.... |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
'''
____ _ _ _ _ __ __ _
| _ \ __ _| |__ | |__ (_) |_| \/ | __ _ ___| | __
| |_) / _` | '_ \| '_ \| | __| |\/| |/ _` / __| |/ /
| _ < (_| | |_) | |_) | | |_| | | | (_| \__ \ <
|_| \_\__,_|_.__/|_.__/|_|\__|_| |_|\__,_|___/_|\_\
... |
import sys, random
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QMainWindow, QDesktopWidget, QFrame, QMessageBox, QAction, QLineEdit, QGridLayout, QLabel
from PyQt5.QtCore import Qt, QBasicTimer, pyqtSignal
from PyQt5.QtGui import QIcon, QColor, QPainter
import datetime
class Connect4(QMainWindow):
... |
## ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 <NAME>
# Copyright (c) 2008-2020 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following ... |
#!/usr/bin/python
# Copyright 2012-2013 inBloom, Inc. and its affiliates.
#
# 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 os
from bento.core.pkg_objects \
import \
Extension
def translate_name(name, ref_node, from_node):
if from_node != ref_node:
parent_pkg = ref_node.path_from(from_node).replace(os.sep, ".")
return ".".join([parent_pkg, name])
else:
return name
class NodeDataFiles(obj... |
#!/usr/bin/env python3
import os
import subprocess
import argparse
# the directory to mount the sd card to
BOOT_MNT = '/mnt/zynq/boot/'
GAMES_MNT = '/mnt/zynq/games'
# the names to copy the boot and mes files to on the sd card
BOOT_FILE = 'BOOT.bin'
MES_FILE = 'MES.bin'
def copy_file(src, dst):
"""
This fu... |
"""
Callbacks for SOM.
"""
import numpy as np
import torch
from fastai.callback.core import Callback
__all__ = [
"SomTrainer",
"LinearDecaySomTrainer",
"TwoPhaseSomTrainer",
"ExperimentalSomTrainer",
]
class SomTrainer(Callback):
"""Base class for SOM training strategies."""
pass
class Line... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
from tensorflow.contrib.tensorboard.plugins import projector
from lesson6 import word2vec_utils
FLAGS = tf.flags.FLAGS
tf.flags.DEFINE_string('DOWNLOAD_URL', 'http://mattmahoney.net/dc/text8.zip', 'download link for text8')
tf.flags.DEFINE_... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# author:jingtongyu
# datetime:2020/6/7 10:14 下午
# software: PyCharm
from flask import g
from flask_restful import Resource, inputs
from flask_restful.reqparse import RequestParser
from sqlalchemy.exc import SQLAlchemyError
from app import hash_ids
from common.utils import g... |
import math
from queue import Queue
from IPython import embed
import torch
import torch.distributed as dist
import torch.cuda.comm as comm
from torch.autograd.function import once_differentiable
from torch.nn.modules.batchnorm import _BatchNorm
import torch.nn.functional as F
import syncbn_gpu
class DistributedSync... |
from random import randint
from time import sleep
import pytest
from flask import Flask
from .gatekeeper import GateKeeper
def test_gk_internals_ban():
"""test internal functions of the ban mechanism"""
ban_rule = [randint(2, 5), randint(2, 5), randint(5, 8)]
ip1 = "10.0.1.1"
ip2 = "10.0.1.2"
te... |
from PIL import Image
# DO NOT SEE HERE! IT WORKED!
class MatrixSunday:
__image_src = None
__image_dst = None
def de_scramble(self, path_src: str, path_dst: str, data: list):
self.__image_src = Image.open(path_src, 'r')
self.__process(data)
self.__image_dst.save(path_dst)
... |
import os
from copy import deepcopy
from rez.utils.sourcecode import _add_decorator, SourceCode, late, include
from rez.serialise import process_python_objects, FileFormat
from rez.vendor.schema.schema import Schema, Or
from rez.package_serialise import (
package_serialise_schema,
package_key_order,
dump_f... |
from flask import Flask, abort, jsonify, request, render_template
from sklearn.externals import joblib
import numpy as np
import json
# load pickle below
lr = joblib.load('kiva_predictor.pkl')
app = Flask(__name__)
@app.route("/")
def home():
return render_template("index.html")
"""
Index(['language_english', '... |
import sys
import time
import random
import argparse
import matplotlib.pyplot as plt
import numpy as np
import onnxds.read_dataset as helper
import tenncor as tc
prog_description = 'Demo rbm trainer'
def mse_errfunc(x, visible_sample_):
return tc.api.reduce_mean(tc.api.square(x - visible_sample_))
def show_di... |
##############################################################################
#
# Copyright (c) 2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
# !/usr/bin/python3
# coding: utf_8
# Copyright YYYY 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 ... |
import rospy
import numpy as np
from std_msgs.msg import Float64
from gazebo_msgs.srv import *
from geometry_msgs.msg import *
import sys, select, os
import roslib
if os.name == 'nt':
import msvcrt
else:
import tty, termios
roslib.load_manifest('dual_gazebo')
def qua2eular(x,y,z,w):
q_x = x
q_y = y
... |
#!/usr/bin/env python
# coding: utf-8
import pandas as pd
get_ipython().system('pip install pymystem3')
import re
import numpy as np
from wordcloud import WordCloud, STOPWORDS
import nltk
nltk.download("stopwords")
from nltk.corpus import stopwords
from pymystem3 import Mystem
from string import punctuation
from nltk.... |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
"""
This module provides affiliations of the current user
"""
import logging
import traceback
from myuw.dao import log_err
from myuw.dao.exceptions import IndeterminateCampusException
from myuw.dao.enrollment import (
get_main_... |
#!/usr/bin/python3
import argparse
import os
import sys
import time
from subprocess import DEVNULL, Popen
parser = argparse.ArgumentParser('dodobox')
subparsers = parser.add_subparsers(help='Action to perform', dest='action', required=True)
actions = {}
def action(name, help=None, **kwargs):
p = subparsers.add_p... |
from PyQt4 import Qt, QtGui, QtCore
from input_parsers import DataCurve, InputParser
import re
import itertools
import color_picker
import time
class InputParserEditDialog(QtGui.QDialog):
ColorRole = Qt.Qt.UserRole + 1
def __init__(self, parent=None):
super(InputParserEditDialog, self).__init__(paren... |
from __future__ import absolute_import, division, print_function
from libtbx.utils import Sorry, Usage
from libtbx import slots_getstate_setstate
import re
import sys
master_phil = """
mtz_file = None
.type = path
f_obs_label = F-obs-filtered
.type = str
f_calc_label = F-model
.type = str
r_free_label = R-free-... |
import numpy as np
import cv2
from config import Config
import tensorflow as tf
from PIL import Image
words_dict = {}
n_2_w = {}
CHARS =set()
with open(Config.dict_file_path, "r", encoding="utf8") as dict_file:
for index, line in enumerate(dict_file.readlines()):
line = line.strip()
if not line == "... |
# -*- coding: utf-8 -*-
# This is based on build_manpage originally downloaded from:
# https://github.com/pwman3/pwman3/
# Original license:
# This file is distributed under the same License of Python
# Copyright (c) 2014 <NAME> <<EMAIL>>
import datetime
from distutils.core import Command
from distutils.errors impo... |
"""This module contains the general information for ApeMenloVnic ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class ApeMenloVnicConsts:
STATE_CREATE_PEND = "CreatePend"
STATE_CREATING = "Creating"
STATE_DESTROY_P... |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import os
import onnx
import torch
from torch import Tensor, nn
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.data import build_detection_test_loader
from detectron2.... |
from __future__ import division, print_function
import json
import os
import datetime
from gym import logger
from gym.wrappers import Monitor
from gym.wrappers.monitor import detect_training_manifests, collapse_env_infos, merge_stats_files
from gym.wrappers.monitoring import video_recorder
from gym.wrappers.monitorin... |
import datetime
import os
import pytest
from dynamorm.exceptions import ValidationError
from dynamorm.model import DynaModel
from dynamorm.indexes import GlobalIndex, ProjectKeys
from dynamorm.relationships import OneToOne, OneToMany, ManyToOne
if "marshmallow" in (os.getenv("SERIALIZATION_PKG") or ""):
from mar... |
# Import
import logging
import json
import os.path
import argparse
# Settings
import sys
import time
CUR_DIR = os.getcwd()
CONF_DIR = CUR_DIR
STORE_DIR = os.path.join(os.path.abspath(os.path.join(CUR_DIR, os.pardir)), 'store')
CONF_TEMP = "conf_"
STORE_TEMP = "stored_"
STORED_TEMP = CONF_TEMP + STORE_TEMP
# Parser
... |
# Copyright (c) 2019 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... |
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.popup import Popup
from kivy.uix.label import Label
import matplotlib.pyplot as plt
import pandas as pd
from multiprocessing import Process
class ... |
import os
import sys
import types
import inspect
import subprocess
import hashlib
from . import Parser
if sys.version_info[0] >= 3:
string_types = str,
text_type = str
else: # pragma: no cover
string_types = basestring,
text_type = unicode
class JSString(text_type):
""" A subclass of string, so... |
"""A file to move a UR robot with a grid and save correspondences between
camera and robot pose for future processing.
todo: generalize this to other robot types
"""
# The MIT License (MIT)
#
# Copyright (c) 2016 GTRC.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software... |
# BSD 2-Clause License
#
# Copyright (c) 2020, <NAME> (<EMAIL>)
#
# 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
# ... |
import tensorflow as tf
import numpy as np
from utils.utils import load_data, preprocess_features, preprocess_adj_bias, adj_to_bias
from .models import GAT
def train(model, inputs, bias_mat, lbl_in, msk_in, optimizer):
with tf.GradientTape() as tape:
logits, accuracy, loss = model(inputs=inputs, training=... |
import re
import os
import glob
import numpy as np
from tqdm import tqdm
import torch
import torch.nn.functional as F
import torchvision.models as models
use_gpu = True
cuda_available = torch.cuda.is_available()
device = torch.device("cuda" if (cuda_available and use_gpu) else "cpu")
from utils import to_var
from mo... |
from collections import namedtuple
import tensorflow as tf
import tensorflow_probability as tfp
from gemlib.mcmc.occult_proposal import AddOccultProposal, DelOccultProposal
tfd = tfp.distributions
OccultKernelResults = namedtuple(
"OccultKernelResults",
(
"log_acceptance_correction",
"target... |
#!/usr/bin/python
import os, re
import numpy as np
import matplotlib.pyplot as plt
debug = True
def compute_rcr_parameters(area, Q_goal, P_min, P_max, P_mean, Q_mean, ratio_prox_to_distal_resistors, decay_time, C_prefactor=1.0):
tol = 1e-12
# total resistances
R_total = []
for Q in Q_goal:
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.4
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_ev... |
##################################################################
# MESURE DU TAUX D'OCCUPATION DE PARKINGS A L'AIDE #
# DE CAMERAS VIDEOS #
# -------------------------------------------------------------- #
# <NAME> - TB 2018 - HEIG-VD ... |
# -*- coding: utf-8 -*-
"""
This file is a part of python_translate package
(c) <NAME> <<EMAIL>>
This file is derived from Symfony package.
(c) <NAME> <<EMAIL>>
For the full copyright and license information, please view the LICENSE and LICENSE_SYMFONY_TRANSLATION
files that were distributed with this source code.
""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.