input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
False
class _Optimizer(Ascender):
@pass_node
def parents_of(self, node):
children = node.C
assert len(children) == 1
child = children[0]
if isinstance(child, Node) and child.T in ("union", "join"):
return Node(child.T, [Node("parents_of", cc) for cc in child.C])
else:
return node
@pass_node
def childr... | |
from vork.tokenizer import *
from vork.ast import *
class Parser:
def __init__(self, tokenizer: Tokenizer):
self.t = tokenizer
self.t.next_token()
self.frame = []
###################################################################################################################
# Expression pars... | |
(RB.item()+(meshes['m']<0).copy()*par['borrwedge'])/PI.item()
EVm = np.reshape(np.asarray(np.reshape(np.multiply(RBaux.flatten(order='F').T.copy(),mutil_c.flatten(order='F').copy()),(mpar['nm']*mpar['nk'],mpar['nh']),order='F').dot(np.transpose(P.copy()))),(mpar['nm'],mpar['nk'],mpar['nh']),order='F')
result_EGM_... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Colony Framework
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Colony Framework.
#
# Hive Colony Framework is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apach... | |
"LOAD_DATETIME",
"STG_CUSTOMER_LOGIN_TS": "LOAD_DATETIME",
},
"src_ldts": "LOAD_DATETIME"
},
"PIT_CUSTOMER_LG": {
"source_model": "HUB_CUSTOMER_TS",
"src_pk": "CUSTOMER_PK",
"as_of_dates_table": "AS_OF_DATE",
"satellites":
{
"SAT_CUSTOMER_DETAILS_TS": {
"pk":
{"PK": "CUSTOMER_PK"},
"ldts":
{"LDTS": "LOAD... | |
<reponame>deeptavker/pysph<filename>pysph/tools/ipy_viewer.py
import json
import glob
from pysph.solver.utils import load, get_files, mkdir
from IPython.display import display, Image, clear_output, HTML
import ipywidgets as widgets
import numpy as np
import matplotlib as mpl
mpl.use('module://ipympl.backend_nbagg')
# ... | |
<reponame>TIBCOSoftware/fabrician-hadoop-enabler<filename>src/main/resources/common/gridlib/scripts/hadoop_enabler_common.py
from com.datasynapse.fabric.admin.info import AllocationInfo
from com.datasynapse.fabric.util import GridlibUtils, ContainerUtils
from com.datasynapse.fabric.common import RuntimeContextVariabl... | |
<gh_stars>0
import random
import sys
from collections import Counter
import Grandmas_Game_Closet as Main
import pygame
from pygame.locals import *
import shelve
# Colors used
RED = (255, 0, 0)
GREEN = (0, 255, 0)
DARKGREEN = (20, 100, 20)
BLUE = (0, 0, 255)
PURPLE = (255, 0, 255)
YELLOW = (255, 255, 0)
GREY = (100, 1... | |
and not volume.deviceType == 'quorum':
continue
if volume.deviceType == 'iscsi':
if volume.useVirtio:
if disk.source.name__ and disk.source.name_ in volume.installPath:
return disk, disk.target.dev_
else:
if disk.source.dev__ and volume.volumeUuid in disk.source.dev_:
return disk, disk.target.dev_
elif volume... | |
<filename>plotting/attenuation.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CERN@school: Analysis functions for the attenuation experiment.
See the README.md file for more information.
"""
#...for the logging.
import logging as lg
#...for the MATH.
import math
#...for even more MATH.
import numpy as np
... | |
# coding: utf-8
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
import filecmp
import json
import pytest
import oci
import services.object_storage.src.oci_cli_object_storage as oci_cli_object_storage
import os
import random
import shutil
import six
import string
from tests import util
fr... | |
#! /usr/local/bin/python3
""" Populate tables of program requirements and mappings of courses to those requirements.
A "program" is a requirement block with a block_type of MAJOR, MINOR, or CONC, but these blocks
may reference OTHER blocks. DEGREE, LIBL, REQUISITE, and SCHOOL blocks are not handled here.
[There are ... | |
from __future__ import print_function
import os
import sys
import time
import pickle
import itertools
import numpy as np
import theano
import lasagne
from lasagne.utils import floatX
from utils import BColors, print_net_architecture
import theano.tensor as T
from data_pool import DataPool
from ba... | |
<filename>plotext/_figure.py
from plotext._utility.color import no_color_name, color_code
from plotext._utility.data import brush, transpose, replace
from plotext._utility.string import only_spaces
from plotext._utility.color import uncolorize
from plotext._matrices import figure_matrices
from plotext._default import f... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
hyper/http20/stream
~~~~~~~~~~~~~~~~~~~
Objects that make up the stream-level abstraction of hyper's HTTP/2 support.
These objects are not expected to be part of the public HTTP/2 API: they're
intended purely for use inside hyper's HTTP/2 abstraction.
Conceptually, a single... | |
# Shmup - Part 22
# simple start/end screens
# by KidsCanCode 2015
# A space shmup in multiple parts
# For educational purposes only
# Art from Kenney.nl
# Frozen Jam by tgfcoder <https://twitter.com/tgfcoder> licensed under CC-BY-3
import pygame as pg
import random
import sys
from os import path
sound_dir = path.joi... | |
"""
In large part lifted from
https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py
but with 1d convolutions and arbitrary kernel sizes
"""
from typing import Callable, List, Literal, Optional
import torch
import torch.nn as nn
from torch import Tensor
def convN(
in_planes: int,
... | |
#!/usr/bin/env python3
# pcrunner/main.py
# vim: ai et ts=4 sw=4 sts=4 ft=python fileencoding=utf-8
'''
pcrunner.main
-------------
Main entry point for the pcrunner command.
'''
import argparse
import io
import itertools
import logging
import logging.handlers
import os
import re
import shlex
import stat
import subp... | |
#!/usr/bin/python
#
# File: DockSim.py
# Author: <NAME>
# Email: <EMAIL>
# Date: Dec 20, 2015
#----------------------------------------------------------------------------
from __future__ import print_function, division
from collections import namedtuple
from math import sqrt, trunc
StateVec = namedtuple('StateVec',... | |
<reponame>profesia/luft<filename>luft/common/column.py
# -*- coding: utf-8 -*-
"""Column."""
from typing import List, Optional, Union
from luft.common.config import EMBULK_TYPE_MAPPER
from luft.common.logger import setup_logger
# Setup logger
logger = setup_logger('common', 'INFO')
class Column:
"""Column."""
de... | |
import re, sys
from requests.structures import CaseInsensitiveDict
from .stashbox import StashBoxInterface
from . import gql_fragments
from . import log as stash_logger
from .types import PhashDistance
from .classes import GQLWrapper
class StashInterface(GQLWrapper):
port = ""
url = ""
headers = {
"Accept-Enc... | |
#d64r2 = self._res_block(Concatenate()([d64, d64r, interpolated64]), (3, 3), batch_norm=True, activation='lrelu', name=name+'_d64_r2')
#d64r3 = self._res_block(d64r2, (3, 3), batch_norm=True, activation='lrelu', name=name+'_d64_r3')
#img64 = Conv2D(3, (3, 3), padding='same', strides=(1, 1), activation='tanh', name=... | |
# # ⚠ Warning
#
# THE 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 SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA... | |
graph.
feat : str
The feature field.
Returns
-------
tensor
The tensor obtained.
Examples
--------
>>> import dgl
>>> import torch as th
Create two :class:`~dgl.DGLGraph` objects and initialize their
node features.
>>> g1 = dgl.DGLGraph() # Graph 1
>>> g1.add_nodes(2)
>>> g1.ndata['h'] = th.tensor([... | |
<reponame>TugberkArkose/MLScheduler
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate Leakage': 0.00662954,
'Peak Dyna... | |
<reponame>jdsika/TUM_HOly<filename>openrave/python/ikfast_generator_cpp_sympy0_6.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Software License Agreement (Lesser GPL)
#
# Copyright (C) 2009-2012 <NAME>
#
# ikfast is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General... | |
<reponame>lasconic/randomsheetmusic
# -*- coding: utf-8 -*-
#-------------------------------------------------------------------------------
# Name: musicxml/mxObjects.py
# Purpose: MusicXML objects for conversion to and from music21
#
# Authors: <NAME>
#
# Copyright: Copyright © 2009-2014 <NAME> and the music21 Projec... | |
str(default_val)
output = output.strip()
if not output_re or re.match(output_re, output):
break
else:
print "Invalid input, must match %s" % output_re
return output
def ConfigureHostnames(config):
"""This configures the hostnames stored in the config."""
if flags.FLAGS.external_hostname:
hostname = flags.FLA... | |
<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import frappe
import json
from frappe import _
def safe_str(obj):
""" return the byte string representation of obj """
try:
return str(obj)
except UnicodeEncodeError:
# obj is unicode
return str(unicode(obj).encode('utf-8')).decode('utf-8')
@frappe.w... | |
# -*- encoding: utf-8
from sqlalchemy.testing import eq_, is_
from sqlalchemy import schema
from sqlalchemy.sql import table, column, quoted_name
from sqlalchemy.dialects import mssql
from sqlalchemy.dialects.mssql import mxodbc
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import sql
from... | |
3150, 2647, 3150, 3151, 2757, 3150, 3151,
3152, 2856, 2941, 2942, 2943, 2944, 220, 2527,
3150, 2648, 3150, 3151, 2758, 3150, 3151, 3152,
2857, 3150, 3151, 3152, 3153, 2945, 3018, 3019,
3020, 3021, 3022, 232, 239, 250, 240, 250,
250, 241, 250, 250, 250, 242, 250, 250,
250, 250, 243, 250, 250, 250, 250, 250,
244, ... | |
import unittest
from cumulusci.core.exceptions import TaskOptionsError
from cumulusci.tasks.metadata_etl.layouts import (
AddFieldsToPageLayout,
AddRecordPlatformActionListItem,
AddRelatedLists,
)
from cumulusci.tasks.salesforce.tests.util import create_task
from cumulusci.utils.xml import metadata_tree
MD = "{%s}... | |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use... | |
<filename>tests/framework/unit_tests/TSA/testFourier.py
# Copyright 2017 Battelle Energy Alliance, 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/LICEN... | |
"_wdens.dat")
if self.solute is not None :
_write_density(self.sdensity, 1.0 / len(self.solute), "_sdens.dat")
self._write_records(postfix="_dt.txt")
vals = np.asarray([entry.value for entry in self.records])
with open(self.out+".txt", "w") as f :
f.write(" ".join("%.3f %.3f"%(av, err) for av, err in zip(vals.me... | |
# Copyright 2012 OpenStack LLC.
# 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 applicable law or a... | |
the data
Function calls on GroupBy, if not specially implemented, "dispatch" to the
grouped data. So if you group a DataFrame and wish to invoke the std()
method on each group, you can simply do:
::
df.groupby(mapper).std()
rather than
::
df.groupby(mapper).aggregate(np.std)
You can pass arguments to th... | |
(Hamiltonian): the hamiltonian you want to apply.
Examples:
>>> from mindquantum import Simulator
>>> from mindquantum import Circuit, Hamiltonian
>>> from mindquantum.core.operators import QubitOperator
>>> import scipy.sparse as sp
>>> sim = Simulator('projectq', 1)
>>> sim.apply_circuit(Circuit().h(0))
>>> ... | |
<filename>af_lenz.py
#!/usr/bin/env python
from inspect import isfunction
from autofocus import AutoFocusAPI
AutoFocusAPI.api_key = ""
from autofocus import AFSession, AFSample
from autofocus import AFServiceActivity, AFRegistryActivity, AFProcessActivity, AFApiActivity, AFJavaApiActivity, AFUserAgentFragment, AFMutexA... | |
eating
new_food_scanned = [x, y] # get coordinate of 8 tiles x 3 around to know whether have food which not exists in list food_position previous
# check if character food which we define in util.py is have in map's pacman
if self.InitMap.food in self.map.data[y][x]:
# if 8 tiles x 3 have coordinate of food and thi... | |
<filename>spinnaker-monitoring-daemon/spinnaker-monitoring/spectator_metric_transformer.py
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
... | |
"""
TeamReel DS API: Endpoints to analyze a new video with ML, get user analysis
results (that user's recent interview performance), get video analysis
results (interview performance in a specific video response), or
get top video responses to a prompt. Provides the following endpoints:
For DS/ML internal use:
(1) '/... | |
"""
Economic Model for VF
Created on 30 March 2020
Author: <NAME>
Contact: <EMAIL>
"""
# ========= IMPORT LIBRARIES ======= #
import numpy as np
import math
import matplotlib.pyplot as plt
import datetime
# ========== GLOBAL VARIABLES ====== #
#Time parameters
YEARLY_TO_MONTHLY_31 = 11.77
DAYS_IN_MONTH = 31
DA... | |
print(' ERROR. Problem in loading file %s' % infile)
print(' Check to make sure filename matches an existing'
'file')
print(' If it does, there may be something wrong with the'
' fits header.')
print('')
raise IOError('Error in read_from_file')
else:
print('')
print('ERROR. File %s does not exist.' % infile)
... | |
# Copyright 2019 The resource-policy-evaluation-library Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | |
import os
import multiprocessing
from meaningless.bible_web_extractor import WebExtractor
from meaningless.utilities import common
from meaningless.utilities.exceptions import UnsupportedTranslationError, InvalidPassageError
class BaseDownloader:
"""
An downloader object that stores Bible passages into a local file... | |
<filename>AutoDDU_CLI.py
Version_of_AutoDDU_CLI = "0.0.7"
import json
import os
import platform
import shutil
import subprocess
import sys
import time
import traceback
import urllib.request
# import wexpect
import zipfile
from datetime import datetime, timezone, date
from subprocess import CREATE_NEW_CONSOLE
#import n... | |
"""
Minter definition transaction class. This transaction type
allows the current coin creators to redefine who has the ability to create coins.
"""
def __init__(self):
self._mint_fulfillment = None
self._mint_condition = None
self._minerfees = []
self._data = bytearray()
self._version = bytearray([12... | |
faire la transition entre jour et mois
extra_between_day_and_month = "(jour du mois de |jour du mois d'|de |d')?"
## Regex de dates pour les dates complètes (avec jour) ou partielles (mois et année seulement), numériques.
full_date_regex = "\d\d?'*(er|me|e|deg)? "+extra_between_day_and_month+month_and_year_group_regex... | |
"""Returns mapping of sites from input to this object
Pymatgen molecule_matcher does not work unfortunately as it needs to be
a reasonably physical molecule.
Here, the graph is constructed by connecting the nearest neighbor, and
isomorphism is performed to find matches, then kabsch algorithm is
performed to mak... | |
dset_name="train", query_bert_path_or_handler="", sub_feat_path_or_handler="",
vid_feat_path_or_handler="", normalize_vfeat=True, normalize_tfeat=True,
avg_pooling=False, annotation_root=ANNOTATION_PACKAGE_ROOT, feature_root=FEATURE_PACKAGE_ROOT):
assert dset_name in ['train', 'valid', 'test'], "dset_name should be ... | |
<reponame>leozz37/makani
# Copyright 2020 Makani Technologies 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 applica... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2011, <NAME>
# 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
#... | |
logger.info('Setting osd noout flag')
ct_pod.exec_ceph_cmd('ceph osd set noout')
logger.info(f"Put object into {pool_name}")
pool_object = 'test_object'
ct_pod.exec_ceph_cmd(f"rados -p {pool_name} put {pool_object} /etc/passwd")
logger.info(f"Looking for Placement Group with {pool_object} object")
pg = ct_pod.exe... | |
<reponame>toebes/onshape-clients<gh_stars>10-100
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa... | |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of thi... | |
"""
Base Request Handlers
"""
import asyncio
import datetime
import logging
import typing
import uuid
from email import utils
import jsonpatch
import problemdetails
import sprockets_postgres as postgres
from openapi_core.deserializing.exceptions import DeserializeError
from openapi_core.schema.media_types.exceptions ... | |
<reponame>basilevh/spatialaudiogen
import tensorflow as tf
from tensorflow.contrib.framework.python.ops import variables
from tensorflow.contrib.layers.python.layers import utils
from tensorflow.contrib import layers
from tensorflow.contrib.layers import l2_regularizer
from tensorflow.contrib.layers import batch_norm a... | |
wdim_bins = (self.bins * wg_min),
integrate = self.kernels.csr_sigma_clip4(self.queue, wdim_bins, (wg_min,), *kw_int.values())
events.append(EventDescription("csr_sigma_clip4", integrate))
# now perform the calc_from_1d on the device and count the number of pixels
memset2 = self.program.memset_int(self.queue, (1,)... | |
bbox_y = island.bounding_box.xy
for x in stops_x:
if x + bbox_x > cage_size.x:
continue
for y in stops_y:
if y + bbox_y > cage_size.y or (x, y) in occupied_cache:
continue
for i, obstacle in enumerate(page_islands):
# if this obstacle overlaps with the island, try another stop
if (x + bbox_x > obstacle.pos.x a... | |
#!/usr/bin/env python
# Copyright 2016 Google 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | |
x is outside range of xarr
if (np.max(x) <= np.min(xarr)) or (np.min(x) >= np.max(xarr)):
return 0
else:
f=interpolate.interp1d(xarr, yarr)
return f(x)
def make_grid_2d(grid0, flux):
qauxarr=np.unique(grid0['LOGQ'])
zauxarr=np.unique(grid0['LOGZ'])
nlines0=len(grid0['ID'][0])
fflux=np.zeros( (len(qauxarr),l... | |
# turn_on_github_auth()
main_user = os.getenv('GITHUB_MAIN_USER')
main_pass = os.getenv('GITHUB_MAIN_PASS')
user1 = os.getenv('GITHUB_USER_1')
client_id = CLIENT_ID
client_secret = CLIENT_SECRET
main_token = GITHUB_ADMIN_TOKEN
cookies = dict(token=main_token)
ids = [
{
'name': main_user,
'type': 'user'
}... | |
import numpy as np
import cv2, serial, time, os, sys
from scipy import stats
def getSerialPort(intASCII): # intASCII is the integer which can be recognized as a correct signal (e.g. laser level) by our Arduino UNO
for portNum in range(1, 11):
try:
portName = 'COM' + str(portNum)
ser = serial.Serial(portNam... | |
plotdir = None, freecolor=False, photometry_db = __default_photometry_db__, specification = {}, cuts = stdCalibrationCuts):
filter='%s-%s' % (filterPrefix, stdfilter)
filterInfo = filter_info[stdfilter]
sdss_names = SDSSNames(filterInfo)
mag_name = 'SEx_MAG_AUTO'
magerr_name ='SEx_MAGERR_AUTO'
goodObjs = cat... | |
# Copyright 2018 Google LLC. 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 applicable law or agree... | |
<reponame>rabaniten/qiskit-terra
# -*- coding: utf-8 -*-
# Copyright 2017, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
# pylint: disable=invalid-name
# pylint: disable=arguments-differ
"""Contains a (slow) pyth... | |
<filename>src/cabinetry/model_utils.py<gh_stars>1-10
"""Provides utilities for pyhf models."""
import json
import logging
from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union
import awkward as ak
import numpy as np
import pyhf
from cabinetry.fit.results_containers import FitResults
log = logging.... | |
parameters is to be
x -> North, y -> East and z -> **DOWN**.
.. note:: All input values in **SI** units(!) and output in **Eotvos**!
Parameters:
* xp, yp, zp : arrays
Arrays with the x, y, and z coordinates of the computation points.
* prisms : list of :class:`~fatiando.mesher.Prism`
The density model used to... | |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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://w... | |
self._ops = inside_ops
# Compute inside and outside tensor
inputs, outputs, insides = select.compute_boundary_ts(inside_ops)
# Compute passthrough tensors, silently ignoring the non-passthrough ones.
all_tensors = frozenset(inputs + outputs + list(insides))
self._passthrough_ts = [t for t in passthrough_ts if t ... | |
<gh_stars>1000+
"""Cryptocurrency Context Controller"""
__docformat__ = "numpy"
# pylint: disable=R0904, C0302, R1710, W0622, C0201, C0301
import argparse
from typing import List
from datetime import datetime, timedelta
import pandas as pd
from prompt_toolkit.completion import NestedCompleter
from binance.client impor... | |
= modified_access_conditions.if_match
if_none_match = None
if modified_access_conditions is not None:
if_none_match = modified_access_conditions.if_none_match
if_tags = None
if modified_access_conditions is not None:
if_tags = modified_access_conditions.if_tags
comp = "properties"
# Construct URL
url = self.... | |
import json
from queue import Queue
from threading import Thread
from uuid import uuid4
import logging
import tornado.escape
import tornado
import tornado.web
from tornado.options import options, define
import tornado.httpserver
import tornado.ioloop
import pika.adapters.tornado_connection
from pyasynch.encoder impor... | |
<gh_stars>1-10
import types,string
from logs import log_error,log_info
import traceback
from scan_rtl import compute1
MathOptsStr = '~ ! & && ~& !& ^ !^ ~^ | || ~| !|'
MathOpts = MathOptsStr.split()
Between = '_HIER_'
def constant_inputs(Current,Env):
Lits = []
for Dst,Src,_,_ in Current.hard_assigns:
if is_lite... | |
<gh_stars>10-100
#!/usr/bin/env python
"""
The handles all the UI elements in the Mosaic tab.
Hazen 10/18
"""
import numpy
from PyQt5 import QtCore, QtGui, QtWidgets
import storm_control.sc_library.hdebug as hdebug
import storm_control.steve.coord as coord
import storm_control.steve.imageCapture as imageCapture
impo... | |
d1.meanlogd1)
np.testing.assert_allclose(d2.meanlogd2, d1.meanlogd2)
np.testing.assert_allclose(d2.meanlogd3, d1.meanlogd3)
np.testing.assert_allclose(d2.meanu, d1.meanu)
np.testing.assert_allclose(d2.meanv, d1.meanv)
fits_name = 'output/nnnc_fits.fits'
dddc.write(fits_name)
dddc4 = treecorr.NNNCrossCorrelation... | |
'''
Created on 30-Dec-2018
@author: vijay
'''
import wx
from wx import TreeCtrl
from wx.lib.mixins.treemixin import ExpansionState
from src.view.util.FileOperationsUtil import FileOperations
import logging.config
from src.view.constants import LOG_SETTINGS
from src.view.other.TreeData import TreeSearch, viewdataList
... | |
print('Processing pulseOx log: '+log_fname+'.puls')
if 'slr' in os.path.basename(log_fname):
print('\t[\'slr\'-type physiolog]')
time_puls, puls_values, epi_acqtime_puls, epi_event_puls, acq_window_puls = dsc_extract_physio.read_physiolog(log_fname+'.puls', sampling_period=20) # extract physio signal
reps_table_pu... | |
<reponame>scroix/nodel-recipes
'''Lightweight modbus control.'''
# REVISION HISTORY
# 21-Jan-2018
# Support for read-only unsigned 16-bit MODBUS registers (use Custom)
#
# 20-Jan-2018 (minor, non-functional)
# Uses the 'request_queue' from the toolkit to manually handle any packet fragmentation that is possible with
... | |
return self
for season in self._season:
if season == requested_season:
self._index = index
break
index += 1
return self
def _dataframe_fields(self):
"""
Creates a dictionary of all fields to include with DataFrame.
With the result of the calls to class properties changing based on the
class index value, th... | |
# answerl.append(rel16_loc)
# answerl.append(rel17_loc)
# answerl.append(rel18_loc)
# answerl.append(rel19_loc)
answerr.append(rel20_ans)
# answer.append(rel21_ans)
# answer.append(rel22_ans)
answerr.append(rel23_ans)
# answer.append(rel24_ans)
# answer.append(rel25_ans)
answerr.append(rel26_ans)
# answer.ap... | |
from django.shortcuts import render
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.contrib.auth import authenticate, logout
from django.contrib.auth import login as signin
from django.http.respons... | |
<reponame>lcit/metrics_delin
import os
import sys
import json
import re
import os
import glob
import pickle
import random
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
import time
__all__ = ["json_read", "json_write", "pickle_read", "pickle_write",
"mkdir", "sort_nicely", "find_files", "r... | |
slash and tooth will rend.",
"There cannot be a happy end, for claw will slash and tooth will rend.",
"You should be in bed.",
"I know where she is.",
"What do you think of climate change?"
"Nature always avenges herself on those who insult her",
"What is magic?",
"Magic is the art and science of causing change to ... | |
import pytest
import numpy as np
from unittest.mock import MagicMock, patch
from qtpy import QtCore, QtGui
from qtpy.QtCore import Qt
from glue.utils.qt import get_qapp, process_events
from glue.core import Data, DataCollection
from glue.utils.qt import qt_to_mpl_color
from glue.app.qt import GlueApplication
from ..... | |
Metafield Value')
),
default='sema_html_value',
max_length=50
)
metafield_value_packaging_custom_value = TextField(
blank=True,
help_text='format: <html>...</html>'
)
metafield_value_fitments_choice = CharField(
choices=(
('sema_vehicles_value', 'SEMA Vehicles'),
('custom_fitments_metafield_value_value', 'C... | |
import os
import numpy as np
from tqdm import tqdm
from dotmap import DotMap
from itertools import chain
from collections import OrderedDict
from sklearn.cluster import KMeans
from scipy import stats
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import (
RobertaConfig,
RobertaM... | |
<reponame>JonathanGailliez/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 M... | |
xmlDoc.toxml('utf-8')
xml = xml.replace('<svg', '<svg width="%ipx" height="%ipx"' % (width_in_px, height_in_px), 1)
return xml
# data should be an object of the ResultAlternativeConcernTableData class
def convertAlternativeConcernSessionResultToSvg(data):
########### Settings ###########
fontSize = 30
f = ImageF... | |
# is an iterator
filelist = []
for f in fns:
filelist.extend(glob(f))
if base is None:
base = ''
# ensures that path from base ends with separator
if base:
base = os.path.join(base, "")
replaceparts = getData(base) # from base get parts
# ensures that extension starts with point "."
if isinstance(ext, basest... | |
15, v + 7, v + 5, v + 13)])
mymesh.from_pydata(myvertex, [], myfaces)
mymesh.update(calc_edges=True)
if mat and bpy.context.scene.render.engine == 'CYCLES':
set_material(mywindow, matdata)
# --------------
# Blind Box
# --------------
if blind:
mybox = create_blind_box("Blind_box", sx, sy + blind_back + blin... | |
"""
@package mi.instrument.nortek.vector.ooicore.driver
@file mi/instrument/nortek/vector/ooicore/driver.py
@author <NAME>, <NAME>
@brief Driver for the ooicore
Release notes:
Driver for vector
"""
from datetime import datetime
import os
from mi.core.instrument.chunker import StringChunker
from mi.core.instrument.in... | |
#eps = np.zeros(self.dim)+1e-8
#for i in range(self.dim):
# eps[i] += np.amax(np.abs(sol.y.T[:,i]))*(1e-5)
J = np.zeros((self.dim+1,self.dim+1))
t = np.linspace(0,init[-1],self.TN)
for p in range(self.dim):
pertp = np.zeros(self.dim)
pertm = np.zeros(self.dim)
pertp[p] = eps[p]
pertm[p] = -eps[p]
... | |
<reponame>7l2icj/kamo_clone<filename>yamtbx/dataproc/myspotfinder/command_line/spot_finder_backend.py
"""
Reference:
Python Multiprocessing with ZeroMQ
http://taotetek.net/2011/02/02/python-multiprocessing-with-zeromq/
"""
import iotbx.phil
import libtbx.phil
import os
import stat
import time
import datetime
impor... | |
from typing import List, Union, Tuple
from functools import reduce
import re
import json
import shlex
import click
from prompt_toolkit.styles import Style
from prompt_toolkit.formatted_text import HTML
from prompt_toolkit.shortcuts import CompleteStyle
from prompt_toolkit.completion import (
Completer, FuzzyComplet... | |
import sys
sys.path.append("..")
from common.utils import Node
#%%
def paintLineOn(buff, text, indent):
buff += indent + text + "\n"
return buff
def paint_type(typeName):
if typeName.value == "Generic":
base, *args = typeName.children
base, args = paint_type(base), [paint_type(arg) for arg in arg... | |
node.args[1],
node.args[2],
node.args[3],
node.args[4]],
keywords=[])
elif len(node.args) == 6:
ast.fix_missing_locations(function_6_arg)
copy_node.body.append(function_6_arg)
new_node = ast.Call(
func=ast.Name(
id='__qmutpy_qgi_func__', ctx=ast.Load()),
args=[
node.func.value,
node.args[0],
node.args... | |
"SELECT name FROM shard_range").fetchone()[0],
'"a/{<shardrange \'&\' name>}"')
self.assertEqual(conn.execute(
"SELECT timestamp FROM shard_range").fetchone()[0],
timestamp) # Not old_delete_timestamp!
self.assertEqual(conn.execute(
"SELECT meta_timestamp FROM shard_range").fetchone()[0],
meta_timestamp)
self.a... | |
# -*- coding: utf-8 -*-
# ===========================================================================
# Copyright 2016-2017 TrungNT
# ===========================================================================
from __future__ import print_function, division, absolute_import
import os
import sys
import inspect
import m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.