input
stringlengths
2.65k
237k
output
stringclasses
1 value
zip p14['zip5'] = p14['zip'].map(lambda x: x[:5]) """#Changing the NAN strings back to np.NaN (this happened while we were cleaning) p14.replace('NAN', np.NaN,inplace=True)""" #I dropped this rn #Groupby the ID so we can shrink our df payids = p14.groupby(['id','fn','ln','mn','zip','specialty','address1']).count()['a...
'subordinates': 'subordinates', 'workload_status': 'workload-status', 'workload_version': 'workload-version'} _toPy = {'address': 'address', 'agent-status': 'agent_status', 'charm': 'charm', 'leader': 'leader', 'machine': 'machine', 'opened-ports': 'opened_ports', 'provider-id': 'provider_id', 'public-address': 'publi...
this category (bytes) 'download_size_pretty': Size of unique files in this category (pretty format) } ], ... ], ... ] """ api_code = enter_api_call('api_reset_session', request) if not request or request.GET is None: ret = Http404(HTTP404_NO_REQUEST('/__cart/reset.json')) exit_api_call(api_code, ret) ra...
<filename>evaluate_populations.py """ evaluate_populations.py Evaluate all the populations across their generations and compare each of them against each other. Note: Evaluation is only done on backed-up populations. """ import argparse from collections import Counter from glob import glob import matplotlib.pyplot a...
[("trans1", Trans(), [0]), ("trans2", SparseMatrixTrans(), 1)], sparse_threshold=0.1, ) col_trans.fit(X_array) X_trans = col_trans.transform(X_array) assert not sparse.issparse(X_trans) assert X_trans.shape == (X_trans.shape[0], X_trans.shape[0] + 1) assert_array_equal(X_trans[:, 1:], np.eye(X_trans.shape[0])) ...
<filename>lib/gs.py # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Library to make common google storage operations more reliable. """ import logging import os from chromite.buildbot import co...
return cas_models.QueryDatabaseResponse().from_map( self.do_request('1.0', 'antcloud.cas.database.query', 'HTTPS', 'POST', f'/gateway.do', TeaCore.to_map(request), headers, runtime) ) async def query_database_ex_async( self, request: cas_models.QueryDatabaseRequest, headers: Dict[str, str], runtime: util_models...
import re from django.contrib.auth.decorators import login_required from django.forms import model_to_dict import json import logging from copy import deepcopy from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import render, redirect from django.template import Context from django.templa...
2D tensors, then being converted into a list of 2D slices Returns: Tensor: LSTM output for each model time step """ self.init_buffers(inputs) if self.reset_cells: self.h[-1][:] = 0 self.c[-1][:] = 0 params = (self.h, self.h_prev, self.xs, self.ifog, self.ifo, self.i, self.f, self.o, self.g, self.c, self.c_...
<gh_stars>1-10 from zope.interface import implements from twisted.trial import unittest from twisted.application import service from twisted.mail import smtp from twisted.internet.defer import gatherResults from twisted.internet import error from twisted.cred import portal, checkers from twisted.test.proto_helpers imp...
plugin.socket_connect_timeout == URLBase.socket_connect_timeout assert plugin.socket_read_timeout == URLBase.socket_read_timeout # Reset our object a.clear() assert len(a) == 0 # Instantiate a bad object plugin = a.instantiate(object, tag="bad_object") assert plugin is None # Instantiate a good object plugi...
<reponame>cashaddy/NeuroKit.py<filename>neurokit/bio/bio_ecg_preprocessing.py # -*- coding: utf-8 -*- """ Subsubmodule for ecg processing. """ import numpy as np import pandas as pd import biosppy import scipy from .bio_rsp import * from ..signal import * from ..materials import Path from ..statistics import * # ===...
['c3d', 'amc', 'avi'], 'fps': 120}, 11: {'desc': 'Run Dive Over Roll Run', 'files': ['c3d', 'amc', 'avi'], 'fps': 120}}}, 131: {'desc': '<NAME> Styled Motions', 'motions': {1: {'desc': 'Start Walk Stop', 'files': ['c3d', 'amc', 'avi'], 'fps': 120}, 2: {'desc': 'Start Walk Stop', 'files': ['c3d', 'amc', 'avi']...
<reponame>lhartung/paradrop-test import ipaddress from .base import ConfigObject, ConfigOption from .command import Command IPTABLES_WAIT = "5" class ConfigDefaults(ConfigObject): typename = "defaults" options = [ ConfigOption(name="input", default="ACCEPT"), ConfigOption(name="output", default="ACCEPT"), Co...
<filename>cli/tests/pcluster/validators/test_cluster_validators.py # Copyright 2021 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...
import django import unittest from django.core.validators import validate_email, validate_slug, URLValidator from django.utils.timezone import utc from django.core.files.images import ImageFile from django.core.management import call_command import string import datetime import os import six from sampledatahelper.hel...
from ballot import ballot2form, form2ballot, blank_ballot, sign, uuid, regex_email, rsakeys from ranking_algorithms import iro, borda, schulze import re def index(): return dict() @auth.requires_login() def elections(): response.subtitle = T('My Elections') elections = db(db.election.created_by==auth.user.id).sele...
50], yet not a valid multiple of 15 #invalid multiple passed, yet in the range with pytest.raises(ArgumentError): api.check_args(args={"q": 43}, op=api.ops["getAllStatisticsbyUserID"]) #invalid multiple passed, but out of the range with pytest.raises(ArgumentError): api.check_args(args={"q": 63}, op=api.ops["ge...
np.expand_dims(points, 1) v1 = points - self.front_left_vertices v2 = points - self.front_right_vertices v3 = points - self.back_right_vertices v4 = points - self.back_left_vertices # x_hat = np.zeros([n_points, n_vortices, 3]) # x_hat[:, :, 0] = 1 # Do some useful arithmetic v1_cross_v2 = np.cross(v1, v2, ax...
"""Adapted from Nematode: https://github.com/demelin/nematode """ import tensorflow as tf import exception import rnn_inference import sampler_inputs from transformer import INT_DTYPE, FLOAT_DTYPE import transformer_inference class BeamSearchSampler: """Implements beam search with one or more models. If there ar...
options_dict = self.options_master # Delete any user defined option fields for option in self.options_delete: if option in options_dict: options_dict.pop(option) # Update any user defined option fields for option in self.options_overwrite.keys(): if option in options_dict: options_dict[option] = self.options_...
'jp';").fetchall() lock_id = session.add_lock() keyboard = [[InlineKeyboardButton(piece[0], callback_data="['c102', {}, {}]".format(piece[1], lock_id))] for piece in piece_list] text = "Choose a piece to remove:" reply_markup = InlineKeyboardMarkup(keyboard) bot.send_message(chat_id = chat_id[0][0], text = text, r...
""" redpatch A module for segmenting diseased leaf images to find healthy regions, lesion associated regions and lesion centres. Workflow Overview ----------------- 1. Set scale sliders to find HSV values that segment whole leaves from background 2. Segment image into leaf sub-images 3. Set scale sliders to find HS...
#!/usr/bin/env python # # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Updates the Chrome reference builds. Usage: $ /path/to/update_reference_build.py $ git commit -a $ git cl upload """ import a...
<reponame>skiehl/wwz # -*- coding: utf-8 -*- #!/usr/bin/env python """A class for plotting results of the weighted wavelet z-transform analysis. """ import matplotlib.gridspec as gs import matplotlib.pyplot as plt from matplotlib.ticker import LogLocator import numpy as np import os import sys __author__ = "<NAME>" _...
'Trimming reverse {at} reads for sample {name} at depth {depth} to length {length}' .format(at=analysistype, name=sample.name, depth=depth, length=sample[read_type][depth][read_pair].reverse_reads.length)) if sample[read_type][depth][read_pair].reverse_reads.length != '0': # Use the reformat method in the OLCTool...
if_match is not None: header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') if self.config.accept_language is not None: header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body body_content = sel...
<filename>ospy/sensors.py # -*- coding: utf-8 -*- __author__ = u'<NAME>' # System imports from threading import Thread, Timer import traceback import logging import traceback import time import datetime import subprocess import os import json # Local imports from ospy.options import options, rain_blocks, program_leve...
<gh_stars>1-10 import numpy as np import pandas as pd import matplotlib.pyplot as plt import os import sys import ast import configparser from scipy import interpolate, integrate from scipy.signal import argrelextrema from scipy.stats import linregress from scipy.optimize import curve_fit from astropy import units, co...
ET.tostring(emit._xml()) '<emit><CNPJ>08427847000169</CNPJ><IE>111222333444</IE><IM>123456789012345</IM><cRegTribISSQN>1</cRegTribISSQN><indRatISSQN>S</indRatISSQN></emit>' """ def __init__(self, **kwargs): super(Emitente, self).__init__(schema={ 'CNPJ': { 'type': 'cnpj', 'required': True}, 'IE': { 'type': '...
######################################################################################################## # data_sql.py - Data pull from json, clean it up and upload to SQL # by <NAME> # # This is Python script Pulls the metadata (link) from following three json data:- # 1. https://api.weather.gov/points/31.7276,-110.87...
Path object with file path to the file Raises ------ NotDumpableExtractorError """ ext = extensions[0] file_path = Path(file_path) file_path.parent.mkdir(parents=True, exist_ok=True) folder_path = file_path.parent if Path(file_path).suffix == '': file_path = folder_path / (str(file_path) + ext) assert file_...
<reponame>hlubenow/yetanother_raycaster.py #!/usr/bin/python # coding: utf-8 """ Yet another ray caster 2.0 - (C) 2021, hlubenow Python/Pygame version of the tutorial code by 3DSage (https://github.com/3DSage/OpenGL-Raycaster_v1) License: MIT """ import pygame import math import os, sys from mazegenerator impor...
<reponame>pombredanne/synapse-3 import asyncio import logging import binascii import collections import regex import synapse.exc as s_exc import synapse.common as s_common import synapse.lib.chop as s_chop import synapse.lib.node as s_node import synapse.lib.time as s_time import synapse.lib.cache as s_cache import ...
@property def pitchSet(self): r''' Gets the pitch set of all elements in a verticality. >>> score = corpus.parse('bwv66.6') >>> scoreTree = tree.fromStream.asTimespans(score, flatten=True, ... classList=(note.Note, chord.Chord)) >>> verticality = scoreTree.getVerticalityAt(1.0) >>> for pitch in sorted(vertical...
<filename>MUNIT/networks.py """ Copyright (C) 2018 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ from torch import nn from torch.autograd import Variable import torch import torch.nn.functional as F import utils imp...
ctx.invoke(self.hostconfig_set, ip=ip, password=password, port=port) @hostconfig.command(name="set", aliases=["+", "add"]) @commands.cooldown(rate=1, per=15, type=commands.BucketType.user) async def hostconfig_set(self, ctx, ip: str, password: str = "<PASSWORD>", port: int = 2333): """ {command_prefix}hostconfig ...
<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, absolute_import, division # disable: accessing protected members, too many methods # pylint: disable=W0212,R0904 import unittest import fudge from hamcrest import is_ from hamcrest import none from hamcrest import not_...
# Copyright 2015 Fortinet 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 applicable law or a...
<reponame>XanaduAI/xir # pylint: disable=redefined-outer-name """Unit tests for the program class""" from decimal import Decimal from typing import Any, Dict, Iterable, List, MutableSet, Sequence import pytest import xir @pytest.fixture def program(): """Returns an empty XIR program.""" return xir.Program() # ...
x-axis limit ax.set_xlim([min(xvar), max(xvar)]) for yr in vert_yr: plt.axvline(yr, linestyle='--', color='k', lw=1.5) plt.annotate(str(yr), xy=(yr-5, ax.get_ylim()[0] + 0.01 * ax.get_ylim()[1]), color='k', size=8, bbox=dict(edgecolor='none', fc='white', alpha=0.5)) plt.xlabel(xlabel) plt.ylabel(ylabel) gridd...
args.project)[0].replace("\\:", ":")) else: pick_and_set_project(args) def cd(args): # entity_result should be None because expected='folder' project, folderpath = try_call(resolve_existing_path, args.path, 'folder')[:2] if project is not None: project_name = try_call(dxpy.get_handler(project).describe)['name']...
"----------------\n" st = st+ str(self.extent_c)+'\n' if hasattr(self, 'Gs'): st = st + "----------------\n" st = st + "Gs : "+str(len(self.Gs.node))+"("+str(self.Np)+'/'+str(self.Ns)+'/'+str(len(self.lsss))+') :'+str(len(self.Gs.edges()))+'\n' if hasattr(self,'Gt'): st = st + "Gt : "+str(len(self.Gt.node))+' : '...
""" <NAME> (<EMAIL>) Computational Epigenetics Sector Waterland Lab, BCM 2017 AXTELL Read-level Methylation Extractor Changelog: UPDATE 7-31-2017 Includes a column that shows which CpGs in each read contribute to that read's methylation status UPDATE 10-30-2017 Fixes a bug where reads report CpGs at sligthly di...
GeneTransfer: f(val, gene) returning species that gene transfers to (or None if no trransfer.) SpeciesBirth: f(val, species) returning True if species splits. SpeciesDeath: f(val, species) returning True if species dies. SpeciesRateChange: f(val, species) resetting species rate matrix given val. NOTE: i...
None self.assertEqual(m.__str__(), "<module '?' (built-in)>") m.__file__ = [] self.assertEqual(m.__str__(), "<module '?' (built-in)>") m.__file__ = 'foo.py' self.assertEqual(m.__str__(), "<module '?' from 'foo.py'>") def test_cp7007(self): file_contents = ''' called = 3.14 ''' strange_module_names = [ "+", ...
# -*- coding: utf-8 -*- ''' Created on 13.08.2015 @author: rdebeerst ''' import bkt import bkt.console import bkt.library.powerpoint as powerpoint import bkt.library.algorithms import System import bkt.ui import json # import ruben as toolbox_rd class Adjustments(object): @staticmethod def adjustment_edit_bo...
<reponame>danbarla/GTDynamics """ * GTDynamics Copyright 2020, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * See LICENSE for the license information * * @file jr_simulator.py * @brief Simulate the jumping robot by solving dynamics of each step. * @author <NAME> """ im...
from collections import defaultdict import numpy as np from pyNastran.bdf.bdf_interface.assign_type import ( integer, integer_or_blank, double_or_blank, integer_double_string_or_blank) from pyNastran.bdf.field_writer_8 import print_card_8, set_blank_if_default from pyNastran.dev.bdf_vectorized2.cards.elements.bars im...
<reponame>il-dionigi/crazyflie_ros_cyphy<gh_stars>0 #!/usr/bin/env python import rospy import tf import numpy as np import matplotlib.pyplot as plt import atexit from crazyflie_driver.msg import Position from crazyflie_driver.msg import ConsoleMessage from crazyflie_driver.msg import Hover from crazyflie_driver.msg i...
get_preserved_filters_querystring(self): return urlencode({ '_changelist_filters': self.get_changelist_filters_querystring() }) def get_sample_user_id(self): return self.joepublicuser.pk def get_changelist_url(self): return '%s?%s' % ( reverse('admin:auth_user_changelist', current_app=self.admin_site.name), ...
<filename>tests/test_dumper.py # -*- coding: utf-8 -*- # Zinc dumping and parsing module # See the accompanying LICENSE Apache V2.0 file. # (C) 2016 VRT Systems # (C) 2021 Engie Digital # # vim: set ts=4 sts=4 et tw=78 sw=4 si: import datetime import json from csv import reader import pytz import haystackapi from hay...
<filename>hst.py from __future__ import division, print_function, absolute_import from . import data_structures from astropy.io import fits as _fits import astropy.time as _time import astropy.units as _u import astropy.constants as _const import astropy.table as _tbl from time import strftime as _strftime import nump...
try: result.success = self._handler.iterationsUntilConvergence(args.modelIds, args.tolerance) msg_type = TMessageType.REPLY except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): raise except ServerLogicException as svEx: msg_type = TMessageType.REPLY result.svEx = svEx except Exception as ex: ...
<reponame>sobkulir/web # -*- coding: utf-8 -*- import datetime from django.conf import settings from django.contrib.auth.models import Group from django.contrib.sites.models import Site from django.test import TestCase from django.urls import reverse from django.utils import timezone import trojsten.submit.constants...
node == 'GLIDER' and instrument_class == 'CTD' and method == 'Telemetered': uframe_dataset_name = 'CP05MOAS/GL514/03-CTDGVM000/telemetered/ctdgv_m_glider_instrument' var_list[0].name = 'time' var_list[1].name = 'sci_water_temp' var_list[2].name = 'practical_salinity' var_list[3].name = 'sci_seawater_density' ...
access roads. 'favorite_tree', # The best connected (most nodes) tree in the forest. # To help with matching, we distinguish real Expressway Ramps from those # that don't actually connect to an Expressway. 'expressway_endpts', # # Used by the workers. 'hydrated_items', 'processed_sids', 'problem_items', 'anal...
from ipaddress import IPv4Network import re from django.conf import settings from django.core.exceptions import ValidationError from django.core.management import call_command from rest_framework import status from desecapi.models import RRset from desecapi.tests.base import DesecTestCase, AuthenticatedRRSetBaseTestC...
<gh_stars>10-100 #!/usr/bin/env python # encoding: utf-8 """ script to install all the necessary things for working on a linux machine with nothing Installing minimum dependencies """ import sys import os import logging import subprocess import xml.etree.ElementTree as ElementTree import xml.dom.minidom as minidom imp...
0.03 1 2.17e+06 273.50 | 255.95 0.0 1000 0 | 0.05 0.00 78.21 0.03 1 2.18e+06 273.50 | 249.94 0.0 1000 0 | 0.05 0.00 78.31 0.03 1 2.20e+06 273.50 | 253.91 0.0 1000 0 | 0.05 0.00 78.00 0.03 1 2.21e+06 274.55 | 1 2.21e+06 274.55 | 274.55 0.3 1000 0 | 0.05 0.00 77.51 0.03 1 2.22e+06 274.55 | 267.84 0.0 1000 0 | 0.05 0.57 7...
<reponame>PsycleResearch/django-url-filter # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import abc import re from functools import wraps import six from cached_property import cached_property from django import forms from django.core.exceptions import ValidationError...
authenticated user') def test_detail_show_flags_for_not_int(self): rating = Rating.objects.create( addon=self.addon, body='review', user=user_factory()) detail_url = reverse_ns(self.detail_url_name, kwargs={'pk': rating.pk}) response = self.client.get(detail_url, {'show_flags_for': 'nope'}) assert response.statu...
) ) DTObjectMapESProducer = cms.ESProducer( "DTObjectMapESProducer", appendToDataLabel = cms.string( "" ) ) EcalBarrelGeometryFromDBEP = cms.ESProducer( "EcalBarrelGeometryFromDBEP", applyAlignment = cms.bool( True ) ) EcalElectronicsMappingBuilder = cms.ESProducer( "EcalElectronicsMappingBuilder" ) EcalEndcapGeometr...
in range(self.nr_pipelets) ]) @property def solos_full_utilization(self): l = [] for pipelet, nr_ways, traffic_spec in \ zip(self.pipelets, self.l3_ways, self.traffics): e = Run( pipelets=(pipelet, ), cbms=(ways_to_cbm(nr_ways), ), run_number=self.run_number, traffics=(traffic_spec, ), utilizations=(100, )...
<reponame>isabella232/eclipse2017<gh_stars>10-100 # # 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 requ...
from io import FileIO import re import sqlite3 import argparse import os.path from enum import Enum, auto from sqlite3 import Error from locale import atof from datetime import datetime import subprocess import sys try: from openpyxl import Workbook except ImportError: subprocess.check_call([sys.executable, "-m", "...
<reponame>intel/RAAD #!/usr/bin/python3 # -*- coding: utf-8 -*- # *****************************************************************************/ # * Authors: <NAME> # *****************************************************************************/ # @package gatherMeta from __future__ import annotations import opt...
<reponame>doraskayo/buildstream #!/usr/bin/env python3 # # Copyright (C) 2018 Bloomberg Finance LP # # 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...
instance that provides the text. text (str): Plain text without formatting. entities (telethon.types.TypeMessageEntity list): List of Telegram entity objects. Returns: .TelegramRichText: Parsed rich text container. """ if not text: return None elif not entities: return immp.RichText([immp.Segment(text)]) ...
an "X" or "0" at BOX/SQUARE no. 2. It has co-ordinates of BOX/SQUARE no. 2. #(4.6.3)p3 -> self.p3() is used to decide if PLAYER1 or PLAYER2 will make an "X" or "0" at BOX/SQUARE no. 3. It has co-ordinates of BOX/SQUARE no. 3. #(4.6.4)p4 -> self.p4() is used to decide if PLAYER1 or PLAYER2 will make an "X" or "0" at B...
# Step 2: Exponentiate the diagonals tfb.TransformDiagonal(tfb.Exp(validate_args=self.VALIDATE_ARGS)), # Step 1: Expand the vector to a lower triangular matrix tfb.FillTriangular(validate_args=self.VALIDATE_ARGS), ]) self.prior = PriorModel( n_length=self.n_length, num_electrode=self.num_electrode) self.rearrang...
<reponame>ThanksBoomerang/graphql-core-legacy from pytest import raises from graphql import GraphQLInt, parse from graphql.utils.build_ast_schema import build_ast_schema from graphql.utils.schema_printer import print_schema from ...type import ( GraphQLDeprecatedDirective, GraphQLIncludeDirective, GraphQLSkipDirec...
#!/usr/bin/env python """ ..__main__.py ~~~~~~~~~~~~~~~~ Picasso command line interface :author: <NAME>, 2015 :copyright: Copyright (c) 2015 Jungmann Lab, Max Planck Institute of Biochemistry """ import os.path def _average(args): from glob import glob from .io import load_locs, NoMetadataFileError from .post...
<reponame>RaphaelOlivier/armory """ Metrics for scenarios Outputs are lists of python variables amenable to JSON serialization: e.g., bool, int, float numpy data types and tensors generally fail to serialize """ import logging import numpy as np import time from contextlib import contextmanager import io from colle...
is one realization) (image is None if mpds_geosClassicOutput->outputImage is NULL) nwarning: (int) total number of warning(s) encountered (same warnings can be counted several times) warnings: (list of strings) list of distinct warnings encountered (can be empty) """ # --- Set grid geometry and varname # Set...
'.png', out + str(n) + '.png') n += 1 os.rename(f'{pngdir}/top' + str(nfr) + '.png', out + str(n) + '.png') else: os.rename(f'{pngdir}/top' + str(nfr) + '.png', out + str(n) + '.png') n += 1 os.rename(f'{pngdir}/bot' + str(nfr) + '.png', out + str(n) + '.png') except: end = True nim = n - 1 elif b...
<reponame>EzzEddin/bayesloop #!/usr/bin/env python """ Transition models refer to stochastic or deterministic models that describe how the time-varying parameter values of a given time series model change from one time step to another. The transition model can thus be compared to the state transition matrix of Hidden M...
<gh_stars>0 import os from os import listdir from os.path import isfile, join # File system dir_path = os.path.dirname(os.path.realpath(__file__)) filesys = [f for f in listdir(dir_path) if isfile(join(dir_path, f))] def get_dir_size(path=dir_path): total = 0 with os.scandir(dir_path) as it: for entry in it: if...
# pybids has to be greater than 0.5 from .interfaces import BIDSDataGrabberPatch from nipype.pipeline import engine as pe from argparse import ArgumentParser from nipype.interfaces import utility as niu import os def main(): opts = get_parser().parse_args() # define and create the output directory outdir = os.pat...
<filename>src/graph_transpiler/webdnn/frontend/tensorflow/ops/gen_math_ops.py<gh_stars>1-10 import numpy as np import tensorflow as tf from tensorflow.core.framework.types_pb2 import DT_FLOAT from webdnn.frontend.tensorflow.converter import TensorFlowConverter from webdnn.frontend.tensorflow.util import elementwise_bi...
<reponame>scvannost/multilang<gh_stars>0 """Run Python, R, Matlab, and bash in the same file. Expected uses ------------- 1. Natively in Python: >>> import multilang This allows for both script and interactive use >>> # run a script >>> fname = 'path/to/file.mul' >>> ml = multilang.as_multilang(fname) >>> ...
<gh_stars>0 import tensorflow as tf import numpy as np import os import h5py import time from PIL import Image class SRCNN: def __init__(self, args, sess): self.sess = sess self.do_train = args.do_train self.do_test = args.do_test self.train_dir = args.train_dir self.test_dir = args.test_dir sel...
<filename>LPES-video/08.02-rezystor+kondensator/08.02.01-rezystor.py # Copyright (c) 2020-2021 Matematyka dla Ciekawych Świata (http://ciekawi.icm.edu.pl/) # Copyright (c) 2020-2021 <NAME> <<EMAIL>> # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and...
patched_module.__dict__) except Exception: # TODO: syntaxerror, do not produce those mutations exec("", patched_module.__dict__) sys.modules[module_path] = patched_module def pytest_configure(config): mutation = config.getoption("mutation", default=None) if mutation is not None: uid = UUID(hex=mutation) inst...
# Copyright (C) 2011-2016, Quentin "mefyl" Hocquet # # This software is provided "as is" without warranty of any kind, # either expressed or implied, including but not limited to the # implied warranties of fitness for a particular purpose. # # See the LICENSE file for more information. import collections import green...
-= 1 if parent.parent is not None: #print "before, ", parent.parent_id #self.printTree(parent.segment) superparent = parent.parent if left: superparent.balance -= 1 else: superparent.balance += 1 if superparent.balance == 0: superparent.height -= 1 self.propagateArea(superparent, config, -1) #print ...
data. Args: loc: Insertion index. column: Column labels to insert. value: Dtype object values to insert. Returns: A new PandasQueryCompiler with new data inserted. """ if is_list_like(value): # TODO make work with another querycompiler object as `value`. # This will require aligning the indices with a `rein...
# (C) Copyright 2014 <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/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
# Enter a parse tree produced by ora2epasParser#elsif_part. def enterElsif_part(self, ctx:ora2epasParser.Elsif_partContext): pass # Exit a parse tree produced by ora2epasParser#elsif_part. def exitElsif_part(self, ctx:ora2epasParser.Elsif_partContext): pass # Enter a parse tree produced by ora2epasParser#else_...
import base64 import json from unittest import TestCase, mock from unittest.mock import Mock, mock_open import requests_mock from kallisticore.exceptions import FailedAction, InvalidHttpProbeMethod, \ InvalidCredentialType, InvalidHttpRequestMethod from kallisticore.lib.credential import \ EnvironmentUserNamePasswor...
self.fs2.t] if reserve_type == "Uber":#2-nautical-mile diversion distance; used by McDonald & German constraints += [self.fs2.L_D == aircraft.L_D_cruise] constraints += [self.fs2.V == V_cruise] R_divert = Variable("R_{divert}",2,"nautical_mile","Diversion distance") self.R_divert = R_divert constrai...
> 0.1: # return 0.0351* depth + 0.5538, 0.02, 0.009977*depth + 0.216978, 0.045 # else: # print "too low depth" # return 0.529327,0.025785, 0.217839, 0.040334 # if depth > 0.5: # return 0.06315* (math.log(depth)) + 0.64903, 0.046154, 0.0005007*depth + 0.3311504,0.12216 # else: # return 0.62036, 0.046154, 0.31785...
<reponame>JohnKurian/TableGPT import time import os import string import queue import encoder from tqdm import tqdm import sys # bpe vocab enc = encoder.get_encoder("117M") # “#” field_empty = 2 eos = 50256 def join_box(list_in): """ Filters empty fields, combines multiple values into same field Args: list_in: ...
VALUE_TYPE : `type` = `int` The premium types' values' type. DEFAULT_NAME : `str` = `'Undefined'` The default name of the premium types. Each predefined premium type can also be accessed as class attribute: +-----------------------+---------------+-------+ | Class attribute name | name | value | +===========...
"tags": [ "foo" ], "documentation": "" }, { "test_case_name": "Login with user 'FooBar' and password '<PASSWORD>'", "arguments": { "${username}": "FooBar", "${password}": "<PASSWORD>" }, "tags": [ "foo", "2" ], "documentation": "" } ] This can be accessed as usual in Robot Framework®. ``${DataDrive...
to_replace = '{' + arg.number_str + '}' replacement = statement.argv[int(arg.number_str)] parts = resolved.rsplit(to_replace, maxsplit=1) resolved = parts[0] + replacement + parts[1] # Append extra arguments and use statement.arg_list since these arguments need their quotes preserved for arg in statement.arg_lis...
import random import time from time import sleep fancy_line = "~" * 75 bold = "\033[1m" reset_bold = "\033[0m" text_length = 80 good_shape = True players = ['young woman', 'middle-aged woman', 'old man', 'middle-aged man',\ 'body builder', 'teenager', 'middle-aged man', 'old lady', 'intelligent man', 'young woman'] c...
<gh_stars>10-100 # -*- coding: utf-8 -*- # Copyright 2020 The PsiZ 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...
cmap = Colormap(self._coltbl(cmap_file), name=cname) matplotlib.cm.register_cmap(name=cname, cmap=cmap) return cmap @property def default_r(self): cname = "default_r" if cname in matplotlib.cm._cmap_registry: return matplotlib.cm.get_cmap(cname) cmap_file = os.path.join(CMAPSFILE_DIR, "ncar_ncl", "default.rgb"...
1 if output: return 1 else: a = 2 return a return output, backward ''') cu = torch.jit.CompilationUnit(code) g = cu.tanh.graph FileCheck().check_count("prim::Closure_0", 2).check("int = prim::If") \ .run(g) code = dedent(''' def loop_in_closure(self): output = torch.tanh(self) def backward(grad_output):...