input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
ActionError('Unable to update GroupAtom due to GAIN_PAIR action: Unknown atom type produced from set "{0}".'.format(self.atomType))
#Add a lone pair to a group atom with none
if not self.lonePairs:
self.lonePairs = [1,2,3,4] #set to a wildcard of any number greater than 0
#Add a lone pair to a group atom that alre... | |
# Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Notes:
#
# This is all roughly based on the Makefile system used by the Linux
# kernel, but is a non-recursive make -- we put the entire dependency
# graph in fr... | |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | |
<gh_stars>100-1000
# Copyright 2012 SINA Corporation
# Copyright 2014 Cisco Systems, Inc.
# All Rights Reserved.
# Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at... | |
then the unit of the
returned number will be the product of the units in self.unit
and unit. For example, if the flux units are counts/s, and
unit=u.angstrom, then the integrated flux will have units
counts*Angstrom/s.
Finally, if unit is None, then the units of the returned
number will be the product of self.un... | |
value for media image."""
if self._albumart_url:
return super().media_image_hash
if self._albumart:
return hashlib.md5(self._albumart).hexdigest()[:5]
return None
@property
def source(self):
"""Name of the current input source."""
return self._source
@property
def source_list(self):
"""List of available i... | |
self.init = init
self.in_ch = None
self.out_ch = out_ch
self.epsilon = epsilon
self.stride1 = stride1
self.stride2 = stride2
self.optimizer = optimizer
self.momentum = momentum
self.kernel_shape1 = kernel_shape1
self.kernel_shape2 = kernel_shape2
self.act_fn = Affine(slope=1, intercept=0) if act_fn is None el... | |
#!/usr/bin/env python3
#
# Copyright (c) 2004-present, Facebook, Inc.
# 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. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
... | |
points in the experiment
rate : array_like
the recorded firing rate corresponding to the stimulus, must have dimensions of (T,)
filter_dims : tuple
a tuple defining the dimensions for the spatiotemporal filter. e.g., (n,n,tau) for a 2D stimulus or
or (n,tau) for a bars stimulus. tau must be less than T, the leng... | |
>>> p, q = Bools('p q')
>>> Xor(p, q)
Xor(p, q)
>>> simplify(Xor(p, q))
Not(p) == q
"""
ctx = _get_ctx(_ctx_from_ast_arg_list([a, b], ctx))
s = BoolSort(ctx)
a = s.cast(a)
b = s.cast(b)
return BoolRef(Z3_mk_xor(ctx.ref(), a.as_ast(), b.as_ast()), ctx)
def Not(a, ctx=None):
"""Create a Z3 not expression or p... | |
<filename>PyNite/FEModel3D.py
from numpy import array, matrix, zeros, empty, delete, insert, matmul, divide, add, subtract
from numpy import nanmax, seterr, shape
from numpy.linalg import solve
from scipy.sparse.linalg import spsolve
from scipy.sparse import csc_matrix
from math import isclose
from Node3D import Node... | |
right_psdf, left_index=True, right_index=True, how='right').sort_index()
A B
1 2.0 x
2 NaN y
>>> ps.merge(left_psdf, right_psdf, left_index=True, right_index=True, how='outer').sort_index()
A B
0 1.0 None
1 2.0 x
2 NaN y
Notes
-----
As described in #263, joining string columns currently returns None for mi... | |
<reponame>frank1010111/pyCRM
import numpy as np
from numpy import ndarray
from numba import njit
import pandas as pd
import pickle
from scipy import optimize
from typing import Optional, Tuple, Union
from joblib import Parallel, delayed
@njit
def q_primary(
production: ndarray, time: ndarray, gain_producer: ndarray,... | |
from flask import (
abort,
current_app,
flash,
redirect,
render_template,
request,
session,
url_for,
)
from flask_login import current_user, login_required
from notifications_python_client.errors import HTTPError
from notifications_utils.field import Field
from notifications_utils.formatters import formatted_li... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
import os.path
import time
import sys
import random
import math
import tensorflow as tf
import numpy as np
import importlib
import argparse
import facenet
import lfw
import tensor... | |
Split Stock Move lines into production lot which specified split by quantity.
@param cr: the database cursor
@param uid: the user id
@param ids: ids of stock move object to be splited
@param split_by_qty : specify split by qty
@param prefix : specify prefix of production lot
@param with_lot : if true, prodcution ... | |
in the tree.
for atom in ring:
atoms = {'*': atom}
entry = ring_database.descend_tree(molecule, atoms)
matched_ring_entries.append(entry)
if matched_ring_entries is []:
raise KeyError('Node not found in database.')
# Decide which group to keep
is_partial_match = True
complete_matched_groups = [entry for entry... | |
= cobra_model.metabolites.get_by_id('10fthf_c')
gly = cobra_model.metabolites.get_by_id('gly_c')
co2 = cobra_model.metabolites.get_by_id('co2_c')
glu = cobra_model.metabolites.get_by_id('glu_DASH_L_c')
gln = cobra_model.metabolites.get_by_id('gln_DASH_L_c')
asp = cobra_model.metabolites.get_by_id('asp_DASH_L_c')
... | |
on
the attribute dictionary - this saves us ton of safety checks later on.
"""
# initialize state
d = self._attributes_t_init ()
# call to update and the args/kwargs handling seems to be part of the
# dict interface conventions *shrug*
# we use similar mechanism to initialize attribs here:
for arg in args :
... | |
# pylint: disable=E1101, dangerous-default-value
"""
Classes to handle alignments in the SAM format.
Reader -> Sam -> Writer
"""
import sys
try:
from collections import OrderedDict
except ImportError: #python 2.6 or 3.6+
if sys.version_info >= (3,6):
OrderedDict = dict
else:
from ordereddict import OrderedDict
... | |
""" ResourceManagementIHEPDB
ResourceManagementIHEPDB for IHEPDIRAC.
"""
from datetime import datetime
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.Base.DB import DB
from IHEPDIRAC.ResourceStatusSystem.Utilities import MySQLWrapper
__RCSID__ = '$Id: $'
class ResourceManagementIHEPDB( object ):
"""
Class tha... | |
state.get(objs[1], "color")
return np.array([shelf_color], dtype=np.float32)
painttoshelf_nsrt = NSRT("PaintToShelf", parameters, preconditions,
add_effects, delete_effects, set(), option,
option_vars, painttoshelf_sampler)
nsrts.add(painttoshelf_nsrt)
# PlaceInBox
obj = Variable("?obj", obj_type)
box = Varia... | |
sap_flux = rawsap_flux / np.nanmedian(rawsap_flux)
# Deblending by calculating flux contaminatio ratio for stars within 3 TESS pixels of target
# If no othery stars are nearby, this ratio = 1
flux_contamination_ratio = calc_flux_contamination(ID)
# subtract and re-normalize sap_flux to complete the process
sap_f... | |
<reponame>mirochaj/ares
"""
OpticalDepth.py
Author: <NAME>
Affiliation: University of Colorado at Boulder
Created on: Sat Feb 21 11:26:50 MST 2015
Description:
"""
import inspect
import numpy as np
from ..data import ARES
import os, re, types, sys
from ..util.Pickling import read_pickle_file, write_pickle_file
fro... | |
construct the circuit
operations_in = (
circuit.Operation(_random_matrix_gate(1), [2]),
circuit.Operation(_random_matrix_gate(2), [2, 3]),
circuit.Operation(_random_matrix_gate(1), [3])
)[:num_operations]
circ = circuit.Circuit(4, operations_in)
# (indirectly) call circ.__iter__
operations_out = tuple(circ)
... | |
"""
Decoding module for a neural speaker (with attention capabilities).
The MIT License (MIT)
Originally created at 06/15/19, for Python 3.x
Copyright (c) 2021 <NAME> (ai.stanford.edu/~optas) & Stanford Geometric Computing Lab
"""
import torch
import random
import time
import warnings
import tqdm
import math
import n... | |
= 0
self.alterSpeed( choice( [-1, 1] ) )
self.rise = ( 0, -8, -16, -20, -16, -8, 0 )
self.newSlime = None
def move(self, delay, sprites):
self.checkHitBack()
self.rect.left += self.speed
if (getPos(self,0.75,0)[0] >= self.scope[1] and self.speed > 0) or (getPos(self,0.25,0)[0] <= self.scope[0] and self... | |
<reponame>pasientskyhosting/redis-operator
load("@bazel_gazelle//:deps.bzl", "go_repository")
def go_repositories():
go_repository(
name = "co_elastic_go_apm",
importpath = "go.elastic.co/apm",
sum = "h1:arba7i+CVc36Jptww3R1ttW+O10ydvnBtidyd85DLpg=",
version = "v1.5.0",
)
go_repository(
name = "co_elastic_go_a... | |
test_08__cont2host(self, mock_local, mock_isdir):
"""Test08 ExecutionEngineCommon()._cont2host()."""
self._init()
mock_isdir.return_value = True
ex_eng = udocker.ExecutionEngineCommon(mock_local)
ex_eng.opt["vol"] = ("/opt/xxx:/mnt",)
status = ex_eng._cont2host("/mnt")
self.assertEqual(status, "/opt/xxx")
ex_e... | |
self.w /= sum(self.w)
self.w = flip(self.w)
### Calculation range
self.shift = 5*tau #Number of days to start calculation before the frist Rt.
self.n = min(self.m, n) #Number of Rt's to calculate, from the present into the past.
self.N = n+self.shift #Total range (into the past) for calculation
#If self.N is ... | |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import sys
from mixbox.binding_utils import *
from . import cybox_common
class HiveListType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, Hive=None):
if Hive is None:
self.Hive = []... | |
<reponame>lovewsy/patrace
##########################################################################
#
# Copyright 2011 <NAME>
# All Rights Reserved.
#
# 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 ... | |
<filename>vistrails/db/versions/v0_3_0/domain/auto_gen.py
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: <EMAIL>
... | |
# ===============================================================================
# Copyright 2011 <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
#
# http://www.apache.org/licenses/LI... | |
<gh_stars>0
""" Data loaders
This file provides:
1. A `create_loaders` function that creates two data loaders, one for the training set and one for the test set.
2. A `FloorplanGraphDataset` class which extends torch's Dataset.
Raw data schema:
- dataset is a python list of floorplans
- each floorplan if a python ... | |
col in enumerate(row or []):
self.grid.SetCellValue(i, j, compat.unicode(col))
if self.can_add and self.immediate:
for j, col in enumerate(self.default_row):
self.grid.SetCellValue(rows_new-1, j, compat.unicode(col))
self._changing_value = False
# update state of the remove button and the row label
self._updat... | |
value for `details_level` ({0}), must be one of {1}" # noqa: E501
.format(details_level, allowed_values))
self._details_level = details_level
else:
self._details_level = allowed_values[int(details_level) if six.PY3 else long(details_level)]
@property
def use_frames_for_del_ins_elements(self):
"""
Gets the use... | |
+ 20.0 and self.y1 > oy1 - 20.0 and self.y2 < oy2 + 20.0:
o.treasure = False # If robot contacts landmark with treasure
ID = o.treasureID
canvas.delete(ID) # Delete treasure object from list
o.treasureID = ""
self.points += 100 #Add 100 to points as treasure has been found
self.rXPos += self.vx
self.rYPos +=... | |
<filename>dftd3/dftd3.py
#!/usr/bin/python
from __future__ import print_function, absolute_import
# THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT ... | |
For heteroscedastic inference this corresponds to the \
sqrt(exp(s^2)) with s^2 predicted value.
- Ypred_std (numpy array): Array with standard deviations computed from regular \
(homoscedastic) inference.
- pred_name (string): Name of data colum or quantity predicted (as extracted \
from the data frame using the ... | |
model_only: bool = True, verbose: bool = True):
"""
This function saves the transformation pipeline and trained model object
into the current working directory as a pickle file for later use.
Example
-------
>>> from pycaret.datasets import get_data
>>> data = get_data('airline')
>>> from pycaret.time_series ... | |
<gh_stars>10-100
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
Functions for bootstrapping elements
(pipes, configuration, etc)
"""
from __future__ import annotations
from meerschaum.utils.typing import Union, Any, Sequence, SuccessTuple, Optional, Tuple, List
def bootstrap(
action : Optional[... | |
''',
categories=[x_octopus_parserlog],
a_legacy=LegacyDefinition(name='x_octopus_parserlog_KdotPCalcSecondOrder'))
x_octopus_parserlog_KdotPCalculateEffectiveMasses = Quantity(
type=bool,
shape=[],
description='''
Octopus parser log entry "KdotPCalculateEffectiveMasses" of type "logical" in
section "Linear Res... | |
you divide and the dist
# is symmetric then you get a div zero...
for line in self.line_names:
ft_not = np.ones_like(ft_all)
if np.any(ft_line_density[line] == 0):
# have to build up
for not_line in self.line_names:
if not_line != line:
ft_not *= ft_line_density[not_line]
else:
if len(self.line_names) > 1:
f... | |
<reponame>NateLehman/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (... | |
rules"
my_user, channel, _ = params
channel = self.get_channel(channel)
self.logger.log("[%s] NAMES: %s" % (channel.name,
" ".join(user.nick for user in channel.users)))
reactor.callLater(10, self.update_rules, channel=channel)
def userJoined(self, nick, channel):
self.logger.log("[%s] %s has joined." % (channe... | |
args=["build", element_name])
result.assert_success()
assert cli.get_element_state(project, element_name) == "cached"
key_2 = cli.get_element_key(project, element_name)
assert key_2 != "{:?<64}".format("")
# workspace keys are not recalculated
assert key_1 == key_2
wait_for_cache_granularity()
# Modify the w... | |
line))
mtl.close()
def split_mesh(verts_loc, faces, unique_materials, filepath, SPLIT_OB_OR_GROUP):
'''
Takes vert_loc and faces, and separates into multiple sets of
(verts_loc, faces, unique_materials, dataname)
'''
filename = os.path.splitext((os.path.basename(filepath)))[0]
if not SPLIT_OB_OR_GROUP:
# us... | |
re.sub(r'[^\w ]', '', s)
return s
def numbers_only(s):
s = re.sub(r'[^\d]', '', s)
return s
# Some mobile browsers which look like desktop browsers.
RE_MOBILE = re.compile(r"(iphone|ipod|blackberry|android|palm|windows\s+ce)", re.I)
RE_DESKTOP = re.compile(r"(windows|linux|os\s+[x9]|solaris|bsd)", re.I)
RE_BOT = ... | |
<reponame>Stitch-Zhang/xls2xlsx<gh_stars>10-100
from bs4 import BeautifulSoup, UnicodeDammit, NavigableString, Comment, CData, ProcessingInstruction, Declaration, Doctype # pip install beautifulsoup4
import quopri
from bs4 import GuessedAtParserWarning
from openpyxl import Workbook
from openpyxl.styles import PatternFi... | |
<gh_stars>1-10
#!/usr/bin/env python3
'''
Copyright 2018, VDMS
Licensed under the terms of the BSD 2-clause license. See LICENSE file for terms.
Schedule3.py Take adavantage of a Setup (Hopefully non-root) SaltSSH Environment
And Utilize it to make my SSH based collections.
'''
# Stdlib
from colorama import Fore, Ba... | |
that I can seem to find
time for).
It currently doesn't do any sort of job combining dictionaries or anything, but it definitely could, if
you have two incomplete dictionaries
:param other: the new sideband data to add to the larger spectrum. Add means append, no additino is performed
:type other: HighSidebandPM... | |
replace arrays
for frame in self.tracked:
frame[frame == label_2] = label_1
# replace fields
track_1 = self.tracks[label_1]
track_2 = self.tracks[label_2]
for d in track_1["daughters"]:
self.tracks[d]["parent"] = None
track_1["frames"] = sorted(set(track_1["frames"] + track_2["frames"]))
track_1["daughters"... | |
m += 1
self.plot_selected_energy_range_original()
self._update_ylimit()
self.log_linear_plot()
self._update_canvas()
def plot_emission_line(self):
"""
Plot emission line and escape peaks associated with given lines.
The value of self.max_v is needed in this function in order to plot
the relative height of e... | |
beseeming ornaments
To wield old partisans, in hands as old,
Cank'red with peace, to part your cank'red hate.
If ever you disturb our streets again,
Your lives shall pay the forfeit of the peace.
For this time all the rest depart away.
You, Capulet, shall go along with me;
And, Montague, come you this afternoon,... | |
def get_pure_virtual_methods( self, type='public' ):
r = {}
for meth in self['methods'][ type ]:
if meth['pure_virtual']: r[ meth['name'] ] = meth
return r
def __init__(self, nameStack):
self['nested_classes'] = []
self['parent'] = None
self['abstract'] = False
self._public_enums = {}
self._public_structs = ... | |
pointers, action):
"""Get metadata about objects pointed by pointers for given action
Return decoded JSON object like {'objects': [{'oid': '', 'size': 1}]}
See https://github.com/git-lfs/git-lfs/blob/master/docs/api/batch.md
"""
objects = [
{'oid': pycompat.strurl(p.oid()), 'size': p.size()}
for p in pointers
... | |
from tkinter import (
Tk,
Button,
Scale,
HORIZONTAL,
PhotoImage,
Label,
Listbox,
END,
Scrollbar,
VERTICAL,
)
from tkinter.filedialog import askopenfilename, askdirectory
from pygame.mixer import music, init, quit
from tinytag import TinyTag
from glob import glob
# инилизация mixer, без него ... | |
for the sql " \
" * to literally match an underscore, not any " \
" * single character LIKE usually matches it to. */ " \
" and (v2.file_family like '%%/_copy/_[0-9]' escape '/'" \
" or " \
" (v1.system_inhibit_1 in ('duplicating', " \
" 'duplicated') " \
" or (select count(alt_bfid) " \
" from file f1,file f2,... | |
<filename>src/hplib_database.py
# Import packages
import os
import pandas as pd
import scipy
import hplib as hpl
from functools import partial
import concurrent.futures
# Functions
def import_heating_data():
# read in keymark data from *.txt files in /input/txt/
# save a dataframe to database_heating.csv in folder /... | |
<reponame>NVlabs/iccad2020-GPUgatesim
# Copyright (c) 2020, NVIDIA CORPORATION. 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... | |
-1, -1, 1, -1, -1, -1, 1, -1, -1],
[-1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, 1],
[1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1],
[-1, -1, -1, 1, -1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, 1],
[-1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, -1],
[1, -1, 1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1... | |
import random
from typing import Iterator, List, Tuple, Dict
import pytest
from words.exceptions.parser_exceptions import StackSizeException, InvalidPredicateException, \
UndefinedIdentifierException, IdentifierPreviouslyDefinedException
from words.lexer.lex import Lexer
from words.lexer.lex_util import DebugData
fr... | |
stub, and fake the request.
with mock.patch.object(
type(client.transport.list_snapshots),
'__call__') as call:
# Designate an appropriate return value for the call.
call.return_value = bigtable_table_admin.ListSnapshotsResponse()
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(bigtable_table_admin.Lis... | |
again!')
response_data = {
'error': message
}
logger.exception(message)
return Response(response_data, status=status.HTTP_400_BAD_REQUEST)
except requests.exceptions.RequestException:
message = ('A server error occured while processing zip file. '
'Please try again!')
response_data = {
'error': message
}
l... | |
--lease-time 86400
"""
helps['vmware workload-network dns-service'] = """
type: group
short-summary: Commands to manage a DNS Service workload network.
"""
helps['vmware workload-network dns-service list'] = """
type: command
short-summary: List of DNS services in a private cloud workload network.
... | |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'Explorer/explorer.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtC... | |
#!/usr/bin/env python
"""Geoname Annotator"""
from __future__ import absolute_import
import math
import re
import sqlite3
from collections import defaultdict
from .annotator import Annotator, AnnoTier, AnnoSpan
from .ngram_annotator import NgramAnnotator
from .ne_annotator import NEAnnotator
from geopy.distance import... | |
<filename>core/botCore.py
#! /usr/bin/env python3
import os
import sys
import time
import json
import os.path
import hashlib
import logging
import threading
from decimal import Decimal
from flask_socketio import SocketIO
from flask import Flask, render_template, url_for, request
from binance_api import api_master_rest... | |
= data['groupId']
text_json['id'] = data['groupId']
text_json['pitGroupRef'] = data['groupId']
response.text = json.dumps(text_json)
elif re.match("^/storage-systems/[0-9a-zA-Z]+/snapshot-volumes$",
path):
response.status_code = 200
text_json = json.loads("""{"unusableRepositoryCapacity": "0",
"totalSizeInBytes... | |
# Copyright: (c) 2018, <NAME> (@jborean93) <<EMAIL>>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
from copy import deepcopy
from pypsrp._utils import to_string, version_equal_or_newer
class ObjectMeta(object):
def __init__(self, tag="*", name=None, optional=False, object=None):
self.tag = t... | |
pginf7, pginf8, pginf9)
if numwebpagestest1==-10:
return -10
if numwebpagestest1==-100 or numwebpagestest1==verifnumwebpages or len(numwebpagestest1)==0:
lastpage=allinfolist
break
verifnumwebpages=copy.deepcopy(numwebpagestest1)
allinfolist.extend(numwebpagestest1)
else:
startpage=1
numwebpages=getinfo((pgi... | |
def exportAttributes(self, outfile, level, already_processed, namespace_='WinExecutableFileObj:', name_='PEResourceType'):
pass
def exportChildren(self, outfile, level, namespace_='WinExecutableFileObj:', name_='PEResourceType', fromsubclass_=False):
if self.Type is not None:
self.Type.export(outfile, level, namesp... | |
# Import Built-Ins
import logging
import json
import time
import queue
import threading
from threading import Thread
# Import Third-Party
from websocket import create_connection, WebSocketTimeoutException
from websocket import WebSocketConnectionClosedException
# Import Homebrew
from bitex.api.WSS.base import WSSAPI
... | |
lcdata[key]
for key in sapkeys:
lcdict['sap'][key.lower()] = lcdata[key]
for key in pdckeys:
lcdict['pdc'][key.lower()] = lcdata[key]
# turn some of the light curve information into numpy arrays so we can
# sort on them later
lcdict['lc_channel'] = npfull_like(lcdict['time'],
lcdict['lcinfo']['channel'][0])
l... | |
import threading
import sqlite3
from enum import Enum
import time
import datetime
from ..CTGP7Defines import CTGP7Defines
current_time_min = lambda: int(round(time.time() / 60))
class ConsoleMessageType(Enum):
SINGLE_MESSAGE = 0
TIMED_MESSAGE = 1
SINGLE_KICKMESSAGE = 2
TIMED_KICKMESSAGE = 3
class CTGP7ServerDat... | |
obj_.build(child_)
self.experimentalConditions = obj_
obj_.original_tagname_ = 'experimentalConditions'
elif nodeName_ == 'encoding':
obj_ = encoding.factory()
obj_.build(child_)
self.encoding.append(obj_)
obj_.original_tagname_ = 'encoding'
elif nodeName_ == 'sequenceParameters':
obj_ = sequenceParametersType... | |
from dataclasses import dataclass, field
from typing import Dict, List, Optional
X_NL_NAMESPACE = "urn:oasis:names:tc:ciq:xsdschema:xNL:2.0"
@dataclass
class Function:
"""Function of the Person defined.
Example: Managing Director, CEO, Marketing Manager, etc.
:ivar content:
:ivar code: Indicates the name eleme... | |
skills1 = [
[("Thrown Weapon (Dart)", 1, SK)],
[("Thrown Weapon (Knife)", 1, SK)],
[("Thrown Weapon (Shuriken)", 1, SK)],
[("Throwing", 1, SK)],
[("Blowpipe", 1, SK)],
[("Sling", 1, SK)],
]
traits.extend(pick_from_list(skills1, 1))
melee_option = random.randrange(3)
if melee_option == 0:
skills2 = [
[("Kni... | |
<gh_stars>0
# Copyright (C) 2021 Open Source Robotics Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | |
"""Tests for the uas_telemetry module."""
import datetime
from auvsi_suas.models.aerial_position import AerialPosition
from auvsi_suas.models.gps_position import GpsPosition
from auvsi_suas.models.mission_config import MissionConfig
from auvsi_suas.models.uas_telemetry import UasTelemetry
from auvsi_suas.models.waypoi... | |
import os
import numpy as np
from matplotlib.colors import rgb_to_hsv, hsv_to_rgb
from PIL import Image
def norm(img):
""" Normalize an image down to a 'unit vector' """
n = np.linalg.norm(img)
if n == 0:
return img
return img.astype(np.float32) / n
def rgb2gray(img):
""" Convert RGB image to grayscale value... | |
# This imports the "json" module from the Python standard library
# https://docs.python.org/3/library/json.html
import json
from time import sleep
from colour import Color
# This is outside the scope of beginner Python and VRC, but this is for
# something called "type-hin ting" that makes Python code easier to debug... | |
:width: 100%
:align: left
Display of the NYC Metro Area, with extra annotations beyond what :py:meth:`display_fips <covid19_stats.engine.viz.display_fips>` can do.
Here are the arguments.
:param str msaname: the identifying name for the `MSA <msa_>`_, for example ``nyc``.
:param fig: the :py:class:`Figure <matp... | |
import shutil
import tempfile
class SSFile:
"""
Abstract base class for all the supported file types in ShapeShifter. Subclasses must implement reading a file to pandas and exporting a dataframe to the filetype
"""
def __init__(self, filePath, fileType):
self.filePath=filePath
self.fileType=fileType
self.isG... | |
<filename>sdk/python/pulumi_azure/costmanagement/resource_group_export.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typi... | |
empty scans file created")
longitude = -self.telescope.long*180/math.pi # east logitude
latitude = self.telescope.lat*180/math.pi
height = self.telescope.elevation
self.location = astropy.coordinates.EarthLocation(lon=longitude,
lat=latitude,
height=height)
self.logger.debug("__init__: telescope location defined... | |
A WITH RING BELOW
'\u1e02': b'\xc7B', # LATIN CAPITAL LETTER B WITH DOT ABOVE
'\u1e03': b'\xc7b', # LATIN SMALL LETTER B WITH DOT ABOVE
'\u1e04': b'\xd6B', # LATIN CAPITAL LETTER B WITH DOT BELOW
'\u1e05': b'\xd6b', # LATIN SMALL LETTER B WITH DOT BELOW
'\u1e08': b'\xc2\xd0C', # LATIN CAPITAL LETTER C WITH CEDILLA... | |
<gh_stars>0
from SkateUtils.KeyPoseState import State
import numpy as np
import pydart2 as pydart
import math
import IKsolve_double_stance
import IKsolveGlobal
import dart_ik
import copy
import pickle
from fltk import *
from PyCommon.modules.GUI import hpSimpleViewer as hsv
from PyCommon.modules.Renderer import ysRend... | |
# (c) 2005 <NAME> and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
# Mostly taken from PasteDeploy and stripped down for Galaxy
import inspect
import os
import re
import sys
import pkg_resources
from six import iteritem... | |
/ n)) \
if style == 'American' or i in specified else p * np.exp(-self.r * self.t / n)
return reduce(backward, range(1, n), options[option](fn(mc, 0), *strikes))
if option in options:
if exercise == 'barrier':
act, barrier, rebate = info
if not isinstance(barrier, float):
raise ValueError('Barrier must be fl... | |
expected = np.int32([
[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
])
expected = expected[:, :, np.newaxis]
assert np.array_equal(segmap_aug.arr, expected)
def test_augment_segmentation_maps_multichannel_rot90(self):
segmap = ia.SegmentationMapsOnImage(
np.arange(0, 4*4).reshape((4, 4, 1)).astype(np.int32),
s... | |
<filename>project_code/classes.py<gh_stars>1-10
import math
import enum
BranchTypeEnum = enum.Enum(value='BranchTypeEnum',
names=('Line', 'Coupler', 'Transformer',
'Transformer2W', 'Transformer3W3', 'Transformer3W2'))
class Branch:
n_of_branches = 0
IATL_max = 5000 # Threshold above which IATL are regarded as in... | |
# Created by <NAME>, <NAME> Scientific
# import modules
import xml.etree.cElementTree as etree
from .converter import register, ValueConverter
@register("ED0FB1D9-4E07-47E1-B96C-4013B9AFE534")
class MassSpectrumConverter(ValueConverter):
"""
The pyeds.MassSpectrumConverter is used to convert mass spectrum data fro... | |
os.path.dirname(path)
if not os.path.exists(directory):
os.makedirs(directory)
with open(path,'w+') as f:
f.write(data)
# -----------------------------------------------------------------------------
# Name: mat_check(node)
# Raises: N/A
# Returns: None
# Desc: Checks if material exist and creates it otherwise.
... | |
import numpy as np
import time
import ctypes
from hetu import cpu_links as cpu_op
from hetu import ndarray
from hetu.ndarray import numpyasdlarrayhandle
def save_to_file(data, file):
f = open(file, 'a+')
f.write(data)
f.close()
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
ll = [10, 50, 100, 200, 300, 400,... | |
<filename>music21/meter/core.py
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Name: meter.core.py
# Purpose: Component objects for meters
#
# Authors: <NAME>
# <NAME>
#
# Copyright: Copyright © 2009-2012, 2015, 2021 <NAME>
# and the music21 Project
# License: ... | |
#!/usr/bin/python
import numpy as np
import argparse
import time
import cv2 as cv
import os
def runYOLODetection(args):
# load my fish class labels that my YOLO model was trained on
labelsPath = os.path.sep.join([args["yolo"], "fish.names"])
#labelsPath = os.path.sep.join([args["yolo"], "coco.names"])
LABELS = op... | |
<reponame>falconsoft3d/fiscalberry
# -*- coding: UTF-8 -*-
import string
import types
import requests
import logging
import unicodedata
import escpos
from ComandoInterface import ComandoInterface, ComandoException, ValidationError, FiscalPrinterError, formatText
import time
import datetime
from math import ... | |
<filename>evaluation/ope.py
# ------------------------------------------------------------------------------
# CONFIDENTIAL AND PROPRIETARY.
#
# COPYRIGHT (c) 2020. <NAME>. ALL RIGHTS RESERVED.
#
# Unauthorized use or disclosure in any manner may result in disciplinary
# action up to and including termination of employ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.