input
stringlengths
2.65k
237k
output
stringclasses
1 value
# Copyright 2019-2020 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 ac...
already_processed, name_): pass def exportLiteralChildren(self, outfile, level, name_): if self.Packet_Too_Big is not None: showIndent(outfile, level) outfile.write('Packet_Too_Big=%s,\n' % self.Packet_Too_Big) if self.MTU is not None: showIndent(outfile, level) outfile.write('MTU=%s,\n' % quote_python(self.MTU...
: spec.get('optional'), 'name' : name, 'label' : spec.desc, 'options' : attributes.options, 'value' : attributes.value if attributes.multiple else [attributes.value] }) elif type(attributes) is form_builder.TextField: attribute_inputs.append({ 'type' : 'text', 'name' : name, 'label' : spec.desc, 'value' : at...
import argparse import glob import os import random import logging import numpy as np import math from tqdm import tqdm import time import torch from transformers import AutoTokenizer, AutoModelForMaskedLM from transformers import DataCollatorForLanguageModeling from transformers.optimization import AdamW, get_linear_s...
"Cannot set version on non-existent client %s" % client self.logger.error(msg) raise Bcfg2.Server.Plugin.MetadataConsistencyError(msg) self.versions[client] = version self.clients_xml.write() def resolve_client(self, addresspair, cleanup_cache=False): """Lookup address locally or in DNS to get a hostname.""" if...
operation: Can be "and", "or". :return: """ code = "; NOT EXPR\n" target_expr = node.getExpr() target_type = self.getLLVMType(target_expr.getExpressionType()) code_target, reg_target = self.astNodeToLLVM(target_expr) # extra load not necessary when dealing with Identifiers if not isinstance(targ...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # __ # \ /\ / _ / / _ _ # \/ \/ (- / /) () /__ (/ /- /- / (- /- # # author: <NAME> # contact: <EMAIL> import os import re import time import requests from lxml import etree from PIL import Image, ImageDraw, ImageFont # Layout # Material style with colored date bar LAYOU...
same key, user root: PASSED", tid) # for user www-data output5 = runr(self, 'lamuc www-data xxx', tid) # print(output5) if output5 == '0': log_red("Verify that lamuc process generated a unique password, user www-data: FAILED", tid) else: log_green("Verify that lamuc process generated a unique password, user www...
<reponame>iVibudh/CER-ESA-Phase2 import pickle import nltk from nltk.corpus import stopwords from nltk.stem.porter import * from nltk.tokenize import word_tokenize Landscape_terrain_and_weather = """Physical and Meteorological Environment Physical Environment Meteorological Environment Precipitation Snowfall Wind rain...
<reponame>sniff122/ImageUploader try: from flask import render_template, jsonify, request, Flask, send_from_directory, redirect import json, time, random, requests, os import secrets import discord from discord.ext import commands from discord.ext.commands import bot import asyncio import aiohttp import reques...
<gh_stars>1-10 # pyOCD debugger # Copyright (c) 2018-2019 Arm Limited # SPDX-License-Identifier: Apache-2.0 # # 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/...
-> Element: # todo: In the implementation below... # We use condition in context of "matching", i.e. as a predicate... # why then not accept Callable[[E], bool] also? # (as you remember, Condition is Callable[[E], None] throwing Error) # This will allow the following code be possible # results.element_by(lambda i...
import json from unittest import TestCase from conda.common.compat import on_win from conda import text_type from conda._vendor.auxlib.ish import dals from conda.base.context import reset_context, context from conda.common.io import captured, env_var, replace_log_streams from conda.exceptions import CommandNotFoundEr...
''' adapted from https://github.com/all-umass/ManifoldWarping ''' import numpy as np import scipy as sp import sys import time import scipy.spatial.distance as sd from sklearn.metrics.pairwise import euclidean_distances, pairwise_distances from sklearn.manifold import Isomap,LocallyLinearEmbedding import pandas as pd ...
= False) ncutSizer.AddWidget(self.usencut) self.ncut = EcceSpinCtrl(self, hardRange = "[0..)", name = "ES.Theory.NWPW.EwaldNcut", default = 1, label = "") ncutSizer.AddWidget(self.ncut) nwpwRightSizer.AddWidget(ncutSizer) self.mapping = EcceSpinCtrl(self, hardRange = "[1..2]", name = "ES.Theory.NWPW.mapping...
<gh_stars>1-10 from fluiddb.cache.test.test_permission import CachingPermissionAPITestMixin from fluiddb.data.permission import Operation, Policy, getTagPermissions from fluiddb.data.system import createSystemData from fluiddb.data.user import Role from fluiddb.exceptions import FeatureError from fluiddb.model.exceptio...
= 0 last_time = None for job in non_covered_jobs: if job.state == consts.JOB_STATE_EXECUTING_FINISHED: jobs_processing += 1 elif job.state == consts.JOB_STATE_ASSIGNED: jobs_executing += 1 elif job.state != consts.JOB_STATE_COMPLETED: jobs_waiting += 1 elif job.state == consts.JOB_STATE_COMPLETED: jobs_comple...
self.repeated_multi_var_condition(): return self.enclose( "struct", self.repeated_declaration()) else: return self.var_type() # Whether this element needs a check (memcmp) for a string value. def expected_string_condition(self): return self.type in ["BSTR", "TSTR"] and self.value is not None # Whether this el...
<gh_stars>10-100 """ Tools for reading and processing the sensitivity analysis data files. Some of the files are specific to our project (`input_parameters.csv' and `results.csv`), but the results of sensitivity analyses are formatted as any SALib analysis results will be from a sobol analysis. Our data files are stor...
<gh_stars>0 # coding: utf8 """ A sample Python 2 script that demonstrates several anticipated read-only uses of EDD's REST API. The general process followed by this script is: 1) Query EDD and/or ICE for contextual data based on parameters used to narrow the bounds of the search. 2) Query EDD for a subset of studies ...
-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 numpy as np import logging import itertools import operator from gelcoverage.tools.bed_reader import BedReader from gelcoverage.tools.bigwig_reader import BigWigReader import gelcoverage.constants as constants def find_gaps(coverages, start_position, coverage_threshold): """ Find continuous genomic positions...
<reponame>leplatrem/addons-server # -*- coding: utf-8 -*- import base64 import json from datetime import datetime from time import sleep from xml.dom import minidom from django.conf import settings from django.core.cache import cache from olympia import amo from olympia.amo.tests import TestCase from olympia.amo.urlr...
# Copyright 2020, by the California Institute of Technology. ALL RIGHTS # RESERVED. United States Government Sponsorship acknowledged. Any # commercial use must be negotiated with the Office of Technology Transfer # at the California Institute of Technology. #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
import datetime import reversion from django.conf import settings from django.contrib import messages from django.contrib.admin.models import LogEntry, CHANGE from django.contrib.auth import get_user_model from django.contrib.auth.decorators import login_required from django.contrib.contenttypes.models import ContentT...
3) trans_num = N.array([0,0,0]) trans_den = N.array([1,1,1]) transformations.append((rot, trans_num, trans_den)) rot = N.array([1,-1,0,0,-1,0,0,0,-1]) rot.shape = (3, 3) trans_num = N.array([0,0,1]) trans_den = N.array([1,1,2]) transformations.append((rot, trans_num, trans_den)) rot = N.array([-1,0,0,-1,1,0,0,0,-1]) ro...
# Copyright 2019 Rackspace US 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...
to create backup")) def update_recently_visited(self, filename): recent = self.config.get('recently_open', []) try: sorted(recent) except: recent = [] if filename in recent: recent.remove(filename) recent.insert(0, filename) recent = recent[:5] self.config.set_key('recently_open', recent) self.recently_vis...
<filename>environments/maze.py<gh_stars>1-10 from typing import List, Tuple import copy import math from termcolor import colored from gym.envs.classic_control import rendering import numpy as np from environments import DiscreteEnv SCREEN_WIDTH = 600 SCREEN_HEIGHT = 600 VIEWER = rendering.Viewer(SCREEN_WIDTH, SCREEN...
_status = 39 elif cmd.count("resize") : _fmsg += "Cannot resize object." _status = 40 elif cmd.count("migrate") : _fmsg += "Cannot migrate object." _status = 41 elif cmd.count("protect") : _fmsg += "Cannot protect object." _status = 41 elif cmd.count("login") : _fmsg += "Cannot login to object." _status = 4...
<gh_stars>1-10 import os import importlib.resources from zipfile import ZipFile import numpy as np import time import datetime as dt from tensorflow.keras.utils import plot_model # req: pydot, graphviz from tensorflow.keras.optimizers import Adam from tensorflow.keras.models import Sequential, Model, load_model from te...
VersionInfo.parse(mine) if theirs.major != mine.major: warnings.warn( f"Model was trained with {library} {theirs}, yours is {mine}. " f"Bad things will probably happen unless you update {library} to {theirs.major}.x." ) if theirs.minor > mine.minor: warnings.warn( f"Model was trained with {library} {theirs}, yo...
<reponame>maxmuffin/SmartSeat<filename>IA/server/server.py import datetime import hashlib import json import os import sqlite3 import time import uuid import apscheduler import joblib import numpy import socket import pandas as pd from pythonping import ping from Crypto.Cipher import AES from apscheduler.schedulers.ba...
from __future__ import absolute_import import pytest try: import rasterio except: rasterio = None rasterio_available = pytest.mark.skipif(rasterio is None, reason="requires rasterio") from os import path from itertools import product import datashader as ds import xarray as xr import numpy as np import dask.array...
# -*- coding: utf-8 -*- # Copyright (c) 2019 by University of Kassel, T<NAME>, RWTH Aachen University and Fraunhofer # Institute for Energy Economics and Energy System Technology (IEE) Kassel and individual # contributors (see AUTHORS file for details). All rights reserved. import numpy as np import pandas as pd impo...
TypeError('ClassName must be a class name string') self.name = name self.class_name = class_name def to_json(self): return {self.name: self.class_name} class Operation(ToJson, ToCodeString): def __init__(self, _class_name, view=None, options=None, views=None): self._class_name = _class_name if view is no...
self._get_value_at_indirect_y() cycles = 5 else: raise RuntimeError(f"Unknown op code: {op_code}") result = (self._a - value)&0xFF self._carry = self._a >= value self._zero = self._a == value self._negative = result&0x80 > 0 self._system.consume_cycles(cycles) def CPX(self, op_code): # Compare Memory and In...
<= 0) m.c2709 = Constraint(expr= m.x2708 - m.b3019 <= 0) m.c2710 = Constraint(expr= m.x2709 - m.b3019 <= 0) m.c2711 = Constraint(expr= m.x2710 - m.b3019 <= 0) m.c2712 = Constraint(expr= m.x2711 - m.b3019 <= 0) m.c2713 = Constraint(expr= m.x2712 - m.b3019 <= 0) m.c2714 = Constraint(expr= m.x2713 - m.b3019 <= 0) m...
round_bound if rounds != rounds_bound: # stack: i, rounds o.extend( _compile_to_assembly( rounds_bound, withargs, existing_labels, break_dest, height + 2 ) ) # stack: i, rounds, rounds_bound # assert rounds <= rounds_bound # TODO this runtime assertion should never fail for # internally generated repeats. #...
from __future__ import absolute_import, division, print_function import os from dynd import nd import datashape import sys from functools import partial from datashape import dshape, Record, to_numpy_dtype, Option from datashape.predicates import isscalar import toolz from toolz import concat, partition_all, first, me...
retval = False if dop is None: if isinstance(DictOp, types.InstanceType) and DictOp.__class__.__name__ == "DictOp": dop = DictOp else: dop = _get_collectd_config(webobj, host) switch_libvirt_plugin(flag=False, dop=dop, webobj=webobj, host=host) def switch_sensors_plugin(flag=True, dop=None, webobj=None, host=...
#!/usr/bin/env python """ Subband Autocorrelation Classification (SAcC) Pitch Tracker feature Based on Matlab code by <NAME> and <NAME> Python port based on SRI Feature template. 2013-08-25 <NAME> <EMAIL> """ import os import numpy as np import scipy.signal import scipy.io import scipy.cluster.vq # For SRI's wavread...
where a message came from so we can GC it properly', 'typedef struct msg_udata { // confuse over-simplified pretty-printer', ' ::google::protobuf::MessageLite * msg;', ' bool lua_owns;', ' lua_protobuf_gc_callback gc_callback;', ' void * callback_data;', '} msg_udata;', '',]) return lines def proto_function_op...
#!/usr/bin/env python # Copyright 2014-2018 The PySCF Developers. 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 # # Unles...
import asyncio import dataclasses import datetime from typing import Optional from anyio import to_thread from sqlalchemy.ext.asyncio import AsyncSession from Backend.core.errors import CustomException from Backend.crud import crud_activities, destiny_manifest, discord_users from Backend.crud.destiny.collectibles imp...
<gh_stars>0 # -*- coding: utf-8 -*- """ Created on Mon Oct 14 15:48:42 2019 @author: jpass """ import pandas as pd import uuid import os import logging from time import strftime, localtime #logging.getLogger().setLevel(logging.DEBUG) logging.getLogger().setLevel(logging.INFO) md_datedef = strftime...
<reponame>samcom12/anuga_core<filename>anuga/culvert_flows/tests/test_culvert_class.py #!/usr/bin/env python from __future__ import print_function from __future__ import division from builtins import range from past.utils import old_div import unittest import os.path import sys from anuga.utilities.system_tools impo...
on with the creation try: self._create_colls(investigation) success_msg = ( 'Collection structure for sample data ' '{}d in iRODS'.format(action) ) if settings.SHEETS_ENABLE_CACHE: success_msg += ', initiated iRODS cache update' messages.success(self.request, success_msg) except taskflow.FlowSubmitException a...
# This code is part of Qiskit. # # (C) Copyright IBM 2020. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any modifications or derivative wo...
<filename>universe/vncdriver/server_messages.py try: # In Py2, use the more efficient cStringIO implementation if it's # available from cStringIO import StringIO as BytesIO except ImportError: # Fall back to using normal BytesIO, six handles python 2 vs 3 compat from six import BytesIO import logging import numpy...
if CONTROLLED_VOCABULARY is None: self.CONTROLLED_VOCABULARY = [] else: self.CONTROLLED_VOCABULARY = CONTROLLED_VOCABULARY if LEXICON_REF is None: self.LEXICON_REF = [] else: self.LEXICON_REF = LEXICON_REF if EXTERNAL_REF is None: self.EXTERNAL_REF = [] else: self.EXTERNAL_REF = EXTERNAL_REF def factory(*ar...
from portality import models, lcc from portality.datasets import licenses, main_license_options from flask_login import current_user from portality.util import flash_with_url, listpop from copy import deepcopy from portality.formcontext.choices import Choices def interpret_list(current_values, allowed_values, substitu...
p[3] prnt.values = [p[5]] prnt.nl = True p[0] = prnt def p_print_stmt6(p): ''' print_stmt : PRINT RIGHTSHIFT test COMMA print_list ''' prnt = ast.Print() all_values = p[5] good_values = [item for item in all_values if item is not None] if all_values[-1] is None: nl = False else: nl = True prnt.dest = p[3]...
load(self, stream): # type: (Union[Path, StreamTextType]) -> Any """ at this point you either have the non-pure Parser (which has its own reader and scanner) or you have the pure Parser. If the pure Parser is set, then set the Reader and Scanner, if not already set. If either the Scanner or Reader are set, you ca...
maxsigma = np.max(mvg.sigmas, axis=0) for i in range(len(mvpars)): if np.isinf(lower[i]): lower[i] = minmu[i] - 100. * maxsigma[i] if np.isinf(upper[i]): upper[i] = maxmu[i] + 100. * maxsigma[i] # create a bounded MultivariateNormal distribution BoundedMvN = pymc3.Bound(pymc3.MvNormal, lower=lower, upper=upper)...
# # Copyright The NOMAD Authors. # # This file is part of NOMAD. # See https://nomad-lab.eu for further info. # # 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/license...
################################################################################ # _ ____ ___ # # / \ / ___|_ _| # # / _ \| | | | # # / ___ \ |___ | | # # ____ _/_/ _\_\____|___| _ # # / ___|__ _| |__ | | ___ | _ \| | __ _ _ __ # # | | / _` | '_ \| |/ _ \ | |_) | |/ _` | '_ \ # # | |__| (_| | |_) | | __/ | __/| | (_| |...
(avg) RAD += dRAD #minSd = opt0 ( RD_, 0.1 ) #if minSd != None : # if show : # print " SD0: %.1f" % minSd sdev = toRAD slope = 0 if RD_[0][1] <= RD_[-1][1] : sdev = 10.0 else : #for i in range ( len(RD_) ) : # RD_[i][1] = RD_[i][1] - RD_[-1][1] # if log : # Y[i] = Y[i] - Y[-1] #import time #star...
return self.send_response(Success=result, Message=msg) if member_id == 'all': res = self._rest_inbound_socket.conference_api(room, "say '%s'" % text, async=False) else: res = self._rest_inbound_socket.conference_api(room, "saymember %s '%s'" % (member_id, text), async=False) if not res: msg = "Conference Speak Fa...
'boundaries': [-0.5, 0.5, 1.5], 'coordinates': 'elevation azimuth range', 'scale_factor': 1, 'add_offset': 0, '_FillValue': 0, '_Write_as_dtype': 'uint8'}, HRV: { 'units': '%', 'standard_name': 'HRV', 'long_name': 'SEVIRI High Resolution Visible Reflectance'}, VIS006: { 'units': '%', 'standard_name': 'VIS...
#!/usr/bin/env python # -*- coding: utf-8 -*- __doc__ = """ =============================================== |module_summary| Embroidermodder_wxPythonGUI.py =============================================== Embroidermodder v2.0 wxPython GUI """ #-Imports.----------------------------------------------------------------...
de pesquisa', 'Survey Question added': 'Pergunta de pesquisa incluída', 'Survey Question deleted': 'Pergunta de pesquisa excluída', 'Survey Question updated': 'Pergunta de pesquisa atualizada', 'Survey Section': 'Seção da Pesquisa de Opinião', 'Survey Section Details': 'Detalhes de Seção de Pesquisa', 'Survey Sec...
Write a framerate chunk into the first image if self.image_number == 0: if not self.writeFramerateChunk(1 / self.control_proxy.StepTime, image_path): QMessageBox.warning( None, 'Saving framerate failed', "Framerate was not saved, this recorded image\n" + "sequence will have to be exported using\n" + "current St...
con.state_machine.go_to(self.end_state, con.spawn, context=self.context) self.result = self.result.match_output if self.result.rfind(self.connection.hostname): self.result = self.result[ :self.result.rfind(self.connection.hostname)] else: dialog = self.service_dialog(service_dialog=reply) con.spawn.sendline(com...
#!/usr/bin/env python """Filestore aff4:/files abstraction layer. Filestore allows for multiple different filestore modules to register URNs under aff4:/files to handle new file hash and new file creations. """ import hashlib import logging from grr.lib import fingerprint from grr.lib import rdfvalue from grr.lib i...
image.\n\n(string) --\n(string) --\n\n\n\n :type clientToken: string :param clientToken: [REQUIRED]\nThe idempotency token used to make this request idempotent.\nThis field is autopopulated if not provided.\n :rtype: dict ReturnsResponse Syntax { 'requestId': 'string', 'clientToken': 'string', 'imageBuildVersi...
get_example_scope( "POST", "/", [], ), mock_receive([]), mock_send, ) assert app.response.status == 204 @pytest.mark.asyncio async def test_handler_from_json_parameter_missing_property( app, mock_send, mock_receive ): @app.router.post("/") async def home(item: FromJSON[Item]): ... # Note: the following ...
Folder "no-media-directories-error": "No media directories have been set. For shared playlist and file switching features to work properly please select File->Set Media Directories and specify where Syncplay should look to find media files.", "cannot-find-directory-error": "Could not find media directory '{}'. To upd...
#!/usr/bin/env python # -*- coding: utf-8 -*- """priors.py -- This module contains various objects to be used as priors. When called these return the ln-prior-probability, and they can also be used to construct prior transforms (for nested sampling) and can be sampled from. """ import numpy as np import scipy.stats ...
<gh_stars>0 #!/usr/bin/env python """ ----------------------------------------------------------------------------- Copyright (c) 2009-2019, Shotgun Software Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redis...
dataspace. Parameters: ctx: If not ``None``, TileDB context wrapper for a TileDB storage manager. """ used_dims_no_domain = tuple( dim_name for dim_name, dim in self._dims.items() if dim.domain is None and self._dim_to_arrays[dim_name] ) if used_dims_no_domain: raise ValueError( f"Cannot create a TileDB gro...
<filename>helper.py # global imports import numpy as np import itertools import scipy import scipy.special import scipy.stats import collections from numba import jit def get_states(N): """return all possible states as arrays for N binary units""" return np.array([np.array(x) for x in itertools.product([0, 1], repe...
pei_holidays) def test_family_day(self): ab_holidays = holidays.CA(prov="AB") bc_holidays = holidays.CA(prov="BC") mb_holidays = holidays.CA(prov="MB") sk_holidays = holidays.CA(prov="SK") for dt in [date(1990, 2, 19), date(1999, 2, 15), date(2000, 2, 21), date(2006, 2, 20)]: self.assertNotIn(dt, self.holidays...
self.assertRaises( cinder_exceptions.ImageUnacceptable, self._driver.copy_image_to_volume, context, volume, image_service, image_id) validate_disk_format.assert_called_once_with(image_meta['disk_format']) @mock.patch.object(VMDK_DRIVER, '_get_disk_type') @mock.patch('cinder.volume.drivers.vmware.vmdk.VMwareVcVmd...
= params['data'] # HTTP header `Accept` header_params['Accept'] = self.api_client.\ select_header_accept(['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']) if not header_params['Accept']: del header_params['Accept'] # HTTP header `Content-Type` header_params['Cont...
h1 = np.histogram(dmat, bins=range(0, int(np.amin(im.shape)/2), spacing)) dmat = dmat[:, hits] h2 = np.histogram(dmat, bins=h1[1]) tpcf = namedtuple('two_point_correlation_function', ('distance', 'probability')) return tpcf(h2[1][:-1], h2[0]/h1[0]) def _radial_profile(autocorr, r_max, nbins=100): r""" Helper f...
<reponame>laidbackware/ansible-for-nsxt<filename>library/nsxt_services.py #!/usr/bin/env python # # Copyright 2018 VMware, Inc. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILIT...
'zh': u('\u9655\u897f\u7701\u54b8\u9633\u5e02')}, '861582981':{'en': 'YanAn, Shaanxi', 'zh': u('\u9655\u897f\u7701\u5ef6\u5b89\u5e02')}, '861582982':{'en': 'Yulin, Shaanxi', 'zh': u('\u9655\u897f\u7701\u6986\u6797\u5e02')}, '861582983':{'en': 'Weinan, Shaanxi', 'zh': u('\u9655\u897f\u7701\u6e2d\u5357\u5e02')}, '861...
= False break confirm = validate_entry() if edit is False: break else: self.header_names.append(col_name) col_n += 1 print('') print('Column Headers:', self.header_names) enter_continue() confirm = 'n' while confirm == 'n': self.data_row_idx = input("Enter the row index that data begin " "on: ") try:...
serializers.UnifiedJobListSerializer parent_model = models.Schedule relationship = 'unifiedjob_set' name = _('Schedule Jobs List') class AuthView(APIView): '''List enabled single-sign-on endpoints''' authentication_classes = [] permission_classes = (AllowAny,) swagger_topic = 'System Configuration' def get(...
if X1 == 0: # GEMM_gmem = GEMM_l2mem # GEMM_l2mem = 0 return GEMM_flop, num_accesses #Column-Row MM def getCf_kp1(self): #Multiply assert(self.kp_hidden_type == 1) assert(self.kp_hidden_dim1 > 1) assert(self.kp_hidden_dim1 % 4 == 0 or self.kp_hidden_dim1 == 2) #4 bc it is LSTM cell assert((2 * self.D) % se...
pred_prob_mat[:, n_clusters] = y_pred_whole print (' Done evaluation using whole instances') print (' Start to evaluate each cluster ') # --------------------------- SELF ------------------------- # predict the whole instances using each cluster data, while self # prediction using 10-fold CV. [y_pred_multi...
''' PRÁCTICA 3 Clasificación <NAME> ''' ############################# ####### BIBLIOTECAS ####### ############################# # Biblioteca lectura de datos # ========================== import pandas as pd # matemáticas # ========================== import numpy as np # Modelos lineales a usar # ==================...
<filename>test_pcn.py import pytest from pcn import PCNetwork import torch @pytest.fixture def net(): net = PCNetwork([3, 4, 2]) return net def test_number_of_layers(net): assert len(net.W) == 2 assert len(net.b) == 2 assert len(net.x) == 3 def test_weight_sizes(net): assert net.W[0].shape == (4, 3) asse...
#!/usr/bin/env python3 # # Copyright 2017 rootkiwi # # AN2Linux-server is licensed under GNU General Public License 3, with the additional # special exception to link portions of this program with the OpenSSL library. # # See LICENSE for more details. import logging import sys try: import ssl except ImportError as e:...
("nickts", Integer()) ] errors = { HandshakeNotYetComplete: "HANDSHAKE_NOT_COMPLETE", NoSuchServer: "NO_SUCH_SERVER", UserAlreadyConnected: "UUID_ALREADY_CONNECTED" } requiresAnswer = False class RemoveUser(Command): arguments = [ ("user", String()), ("reason", String()) ] errors = { HandshakeNotYetComple...
# Import libraries import streamlit as st import pandas as pd import yfinance as yf import talib import plotly.graph_objects as go import plotly.express as px import requests import seaborn as sns import os from streamlit_lottie import st_lottie from sqlalchemy import create_engine # Import my custom scri...
multiple dichotomy sets template = " %%(countedValue)s %%(lblLen)s %s " % tail mrespDef += template % rest mrespDefs.append(mrespDef) mrespDefs = "\n".join(mrespDefs) return mrespDefs def _getMultRespDefsEx(self, mrDef): """Get 'extended' multiple response defintions. This is a helper function for the multResp...
<gh_stars>1000+ # 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 applicable law o...
import mybayes as bayes import numpy as np from mybayes.influence import ProbTable, Normal from mybayes.settings import NumberOfSample from copy import deepcopy class TempCache(object): data = {} id_top = 0 def add(self, item): self.id_top+=1 self.data[self.id_top] = item return self.id_top def get(self, id)...
<gh_stars>0 import dask.dataframe as dd import pandas as pd """ All queries take in Dask Dataframes, and return results as an uncomputed dask dataframe. """ def query1(tables): pd.set_option('float_format', '{:.2f}'.format) ####################################################### # FROM lineitem ###############...
<reponame>JoeLanglands/MICE-MagneticFieldMapping<gh_stars>0 1import os import pickle import sys import time import numpy as np import matplotlib.pyplot as plt import utils from fbutils import applyfb as appFB from fbutils import fbfit as fitFB from fieldmanip.readData import readFile from fieldmanip import fieldMani...
# Copyright (c) 2021 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
plt.xlabel('x [pixels]') plt.ylabel('y [pixels]') plt.colorbar() plt.show() """ def __init__(self, radius_in, width, **kwargs): radius_out = radius_in + width self._model = models.Ring2D(1. / (np.pi * (radius_out ** 2 - radius_in ** 2)), 0, 0, radius_in, width) self._default_size = _round_up_to_odd_integer(2 *...
= None): """ bias score for a segmentation result. Bias is the percentage difference in size of a given result Args: include_classes: (list) which classes to include in the output, default is [1:] excluding background modifier: (Callable) an optional function to apply to output before calculations """ MetricBase...
<filename>test/helpers/special_chars_and_punct.py # This file is used by various classes in test.unit_test.test_scrubber.py # This file is NOT to be used for character processing in the Lexos app proper! EE_HTML = {'&ae;': 'æ', '&d;': 'ð', '&t;': 'þ', '&e;': 'ę', '&AE;': 'Æ', '&D;': 'Ð', '&T;': 'Þ', '&#541;': 'ȝ', '&...
21: return 6 else: return 7 else: return 5 else: if f5 <= 31: if f3 <= 9: return 1 else: if f6 <= 22: if f5 <= 12: return 4 else: return 5 else: return 6 else: if f6 <= 14: return 5 else: return 4 else: return 1 else: if f6 <= 3: if f5 <= 4: if f8 <= 9: return 6 else: if f8 <= 11: return...
<filename>rubik/solve.py import sys import time from rubik import cube from rubik.maths import Point DEBUG = False class Solver: def __init__(self, c): self.cube = c self.colors = c.colors() self.moves = [] self.left_piece = self.cube.find_piece(self.cube.left_color()) self.right_piece = self.cube.find_piece...
service = create_service(service_permissions=[EMAIL_TYPE, UPLOAD_DOCUMENT]) content = "See attached file." template = create_template(service=service, template_type="email", content=content) data = { "email_address": service.users[0].email_address, "template_id": template.id, "personalisation": {"document": {"fil...
#!/usr/bin/env python import os #os.environ["CUDA_VISIBLE_DEVICES"]="-1" import numpy as np from math import sqrt from numpy import zeros import re import math from .batch_object import batch_object from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split import pdb im...