input
stringlengths
2.65k
237k
output
stringclasses
1 value
"""Imports""" import json import pytest import demistomock as demisto from netaddr import IPAddress IOC_RES_LEN = 38 '''Tests''' @pytest.mark.helper_commands class TestHelperFunctions: @pytest.mark.get_outbound_ioc_values def test_get_outbound_ioc_values_1(self, mocker): """Test on_demand""" from ExportIndicat...
# coding: utf-8 import pprint import re import six class CreateListenerOption: """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. """ sensitive_list = [] openapi_typ...
a child or children as a father (mother), in place of the natural or adoptive father (mother). [thefreedictionary]"""), 'lino_xl.lib.humanlinks.Link' : _("""A link between two persons."""), 'lino_xl.lib.humanlinks.Link.parent' : _("""Pointer to the person who is "parent"."""), 'lino_xl.lib.humanlinks.Link.child' : _...
= self.owner_id result['DomainName'] = self.domain_name result['StartTime'] = self.start_time result['EndTime'] = self.end_time result['Interval'] = self.interval result['IspNameEn'] = self.isp_name_en result['LocationNameEn'] = self.location_name_en return result def from_map(self, map={}): self.owner_id = m...
<gh_stars>10-100 from logging import Logger import requests import time try: # web3 4.0 from eth_account.internal.transactions import assert_valid_fields except ImportError: # web3 5.0 from eth_account._utils.transactions import assert_valid_fields from sto.ethereum.utils import mk_contract_address, get_construct...
<reponame>lesyk/Evolife<filename>Other/Ants/Ants.py #!/usr/bin/env python ############################################################################## # EVOLIFE www.dessalles.fr/Evolife <NAME> # # Telecom ParisTech 2014 www.dessalles.fr # ############################################################################## ...
<filename>data_processor.py import numpy as np import json import glob import copy import os.path import re from tqdm import tqdm from sklearn.feature_extraction import FeatureHasher def read_label_csv(path): label_table = dict() with open(path, "r", encoding='ISO-8859-1') as f: for line in f.readlines()[1:]: fna...
[4.4270e+00, 1.5150e+00, 1.9412e+01], [5.4930e+00, 2.4339e+01, 1.8848e+01], [5.2230e+00, 2.3079e+01, 1.9656e+01], [5.4960e+00, 2.1839e+01, 1.8816e+01], [5.6050e+00, 2.4950e+00, 2.1551e+01], [3.9530e+00, 1.3860e+00, 1.8622e+01], [4.8760e+00, 2.4386e+01, 1.8089e+01], [4.2980e+00, 2.3074e+01, 1.9952e+01], [5.7910e...
<reponame>ariroffe/logics<gh_stars>10-100 from itertools import product from copy import copy from logics.classes.propositional import Formula from logics.classes.exceptions import NotWellFormed class LocalValidityMixin: def _get_truth_value_combinations(self, formula_or_inference): """Will return an iterator that...
returned have QUERY's head in the head and the stored instances of TABLENAMES in the body. """ # This is different than abduction because instead of replacing # a proof attempt with saving a literal, we want to save a literal # after a successful proof attempt. assert False, "Not yet implemented" def abduce(sel...
<reponame>hotpxl/minpy-jit<filename>minpy/segment.py #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import ast import types import inspect from collections import OrderedDict from functools import wraps, reduce from mxnet import nd from . import core _segment_cnt = 0 _ndarray_fun...
# @today 0 -> text:today, meaning:monday if "@today" in constraints: if "0" in constraints["@today"]: resolved_dict["@today_00"] = "today" if "1" in constraints["@today"]: resolved_dict["@today_01"] = "current" if "2" in constraints["@today"]: resolved_dict["@today_02"] = "currently" # @weekly_time: could mak...
0.1992188, 0.1718750, 0.1484375, 0.1289062, 0.1132812, 0.0976562, 0.0859375, 0.0781250, 0.0742188, 0.0742188, 0.0742188, 0.0781250, 0.0859375, 0.0976562, 0.1132812, 0.1289062, 0.1484375, 0.1718750, 0.1992188, 0.2265625, 0.2539062, 0.2851562, 0.3164062, 0.3476562, 0.3828125, 0.4179688, 0.4492188, 0.4843750, 0.515625...
state_out = State(x=x, v=vf, beta=state.beta) logdet = tf.reduce_sum(scale, axis=1) return state_out, logdet def _update_v_forward( self, state: State, step: int, training: bool = None ): """Update the momentum `v` in the forward leapfrog step. Args: network (tf.keras.Layers): Network to use state (State...
logits = logits + weights['b_output'] if config.label_type == 'multi_head_sparse' or config.label_type == 'multi_head_one_hot': logits2= tf.matmul(kc, weights['w_output_head2']) + weights['b_output_head2'] else: logits2 = tf.constant(0, dtype=tf.float32) self.logits = logits self.logits2 = logits2 return logit...
await msg.edit(content="‌") await msg.edit( content=f"```diff\n{int(msg_react.content)}ページ/{len(embeds)}ページ目を表示中\n見たいページを発言してください。\n30秒経ったら処理は止まります。\n0と発言したら強制的に処理は止まります。```", embed=embeds[int(msg_react.content) - 1]) except asyncio.TimeoutError: # wait_forの時間制限を超過した場合 # このcontentの中にはゼロ幅スペースが入っています。Noneでもいいのですが編集者...
<filename>python/src/ties/test/schema_validation_tests.py ################################################################################ # Copyright 2019 Noblis, 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...
# -*- coding: utf-8 -*- #!/usr/bin/python # Author: <NAME> # UY - 2017 # License: MIT # One way or another... # One and Two ways ANOVA conducting with Python # %matplotlib inline import warnings warnings.filterwarnings('ignore') import pandas as pd import matplotlib.axes pd.set_option("display.width", 100) import matp...
import logging import typing from itertools import combinations import spydrnet as sdn from spydrnet.ir import Definition as DefinitionBase from spydrnet.ir.innerpin import InnerPin from spydrnet.ir.outerpin import OuterPin from spydrnet.ir.port import Port logger = logging.getLogger('spydrnet_logs') try: import ne...
# ========================================================================================================================================================== # mappo gnn class # purpose: class to train multiple agents # =====================================================================================================...
to reconfirm') class PersonalInformationForm(RegistrationFormStep): title = 'Personal Information' t_shirt_cut = forms.ChoiceField( label='My t-shirt cut', choices=( ('', NO_T_SHIRT_LABEL), ('s', STRAIGHT_CUT_LABEL), ('w', WOMENS_FITTED_CUT_LABEL), ), required=False, ) t_shirt_size = forms.ChoiceField( l...
import hashlib import json import os import re import shlex import shutil import subprocess from argparse import ArgumentParser from configparser import ConfigParser from io import StringIO from subprocess import CalledProcessError from django.conf import settings from django.template.loader import render_to_string fr...
print("set rotation speed: {} deg/sec".format(rs)) @stage_decorator(list(detectors) + motor) @bpp.monitor_during_decorator([zps.pi_r]) @run_decorator(md=_md) def fly_inner_scan(): # close shutter, dark images: numer=chunk_size (e.g.20) print("\nshutter closed, taking dark images...") yield from _set_andor_param...
<filename>data-hub-api/apps/cdms_api/soap/api.py import os import hmac import base64 import hashlib import datetime import requests import logging from uuid import uuid4 from suds.sax.parser import Parser from django.utils import timezone from django.conf import settings from django.template import Engine, Context fr...
""" GCore/SolveIK.py Requires: sys numpy scipy Grip ISCV (project, cloud, ) """ import sys import numpy as np import ISCV from GCore import Character, Recon, list_of_lists_to_splits import scipy.linalg.lapack as LAPACK def computeChannelAffectedEffectors(jointCutOff, jointParents, jointChanSplits, effect...
<reponame>leilinen/flink ################################################################################ # 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. Th...
else: unknown_words.add(word) print(f"Bonusing {len(known_words)} prewrite words: {' '.join(sorted(known_words))}") print(f"Not bonusing {len(unknown_words)} unknown words: {' '.join(sorted(unknown_words))}") # Beginning of sentence suggestions if use_bos_suggs and use_bos_suggs != 'manual' and not enable_bos_sug...
#!/usr/bin/env python # coding: utf-8 # For python 2 compatibility from __future__ import unicode_literals import sys from codecs import open from os.path import split, join, exists from os import getcwd, mkdir import subprocess import unicodedata #from traceback import print_exc # Python Version Compatibility majo...
from django.shortcuts import render from . import models, forms from django.contrib.auth.models import User from django.contrib.auth import authenticate, login, logout from django.http import HttpResponse, HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.contrib.admin.views.dec...
f.close() commandSuccess=True elif a[0] == 'showall': for i in range(len(texts)): #print texts(i) _ba.chatmessage(str(i) + '. ' + texts[i]) commandSuccess=True elif a[0] == 'del' and len(a)>1: try: if len(texts) > 1: texts.pop(int(a[1])) #write to file with open(python_path + '/BsTextOnMap.py') as (file): ...
<filename>src/DCGMM/dataset/TF2_Dataset.py # 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 w...
# 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...
from tkinter import * from tkinter import ttk from colorexlib.colorexlib.common.datastructures import HeatMap, Tile from colorexlib.colorexlib.common.styling import Themes, StyleSheet import math class HeatMapWindow(Frame): def __init__(self, parent, heatmap=None, **kwargs): # Determine the val...
<reponame>AlexRaschia/Py-nergie_demo # -*- coding: utf-8 -*- """ Projet Py-nergie DS Bootcamp Juin 2021 """ import streamlit as st import pandas as pd import seaborn as sns import matplotlib.pyplot as plt #from sklearn.preprocessing import StandardScaler, MinMaxScaler st.set_option('deprecation.showPypl...
the client""" with self.metadata_lock: details = {} for field in CLIENT_FIELDS: if hasattr(self, field): details[field] = getattr(self, field) if self.sensors: details['sensors'] = [] for sensor_id, sensor in self.sensors.items(): sensor_details = sensor.to_dict() sensor_details['sensor_id'] = sensor_id deta...
<reponame>awb-carleton/pattern-analysis<filename>foldit/check_models.py from foldit.foldit_data import load_extend_data, make_series from pattern_extraction import * import argparse from sklearn import svm, linear_model, ensemble from sklearn.metrics import mean_squared_error, r2_score, explained_variance_score import ...
from copy import deepcopy import time # Agent that solves Sudoku puzzles present_mode = True; # step by step class Sudoku: def __init__(self): self.boards_so_far = [] self.sudoku_table = [0]*9 self.read_table() self.heuristic = 0 # number of zeros for i in range(0,len(self.sudoku_table)): for j in ran...
EmptyResultException: return iter([]) else: # call the __iter__ method directly return iter(self._qr) def __iter__(self): return self.execute() class UpdateQuery(BaseQuery): def __init__(self, model, **kwargs): self.update_query = kwargs super(UpdateQuery, self).__init__(model) def clone(self): query =...
include_earliest_year="all_bioactivity_records", ic50_conversion_strategy="all_relations_half_ic50", fit_ic50=False, )["final"] c_doc_uid = Counter(ds.data["doc_uid"]) x = np.vectorize(lambda uid: c_doc_uid[uid])(ds.data["doc_uid"]) y = value = to_pki(ds.data["value"]) kernel = Benchmarks2018StructuralSimilarity...
% dvmrel.mat_type raise NotImplementedError(msg) elif card_type == 'DVGRID': for dvgrid_id in ids: dvgrids = model.dvgrids[dvgrid_id] for dvgrid in dvgrids: desvars_used.add(dvgrid.desvar_id) nids_used.add(dvgrid.nid) cids_used.add(dvgrid.cid) elif card_type == 'TF': for tf_id in ids: tfs = model.transfer_fu...
key in opts: opts[key] = value else: raise ValueError('%s is not a valid option'%(key)) if opts['use_jd']: # Set the recycling strategy if opts['recycle_type'] == 'num_recycling': recycle_type = TACS.NUM_RECYCLE else: recycle_type = TACS.SUM_TWO problem.addFrequencyConstraint(opts['sigma'], opts['num_eigs']...
# processed Android keys out_key_p = [ <KEY>, <KEY>, 0x872bc2af, 0x740c67d2, 0x06b5b538, 0x203471d9, 0x5b166908, 0x1992e2dd, 0x709c1604, 0xf44b2f24, 0x80b4e61e, 0xf4dd369b, 0x0b635c77, 0x3ece8651, 0x0d0bcd5b, 0x577afa1f, 0xef341b74, 0xfe722dca ] out_key_s = [[ 0xe15f9e9b, 0x03555599, <KEY>, 0xaddfbacb, 0x8563f318, 0x1...
<filename>renderchan/launcher.py<gh_stars>10-100 __author__ = '<NAME>' from gettext import gettext as _ from argparse import ArgumentParser import os import subprocess import datetime import pwd class Launcher: def __init__(self): self.pidFile = "" self.logFile = "-" self.outputFile = "-" self.sourceDir = "" s...
*args) return api_call def net_firewall_config_get(*args): api_call = _invoke_api('net-firewall-config-get', *args) return api_call def net_firewall_config_get_iter(*args): api_call = _invoke_api('net-firewall-config-get-iter', *args) return api_call def net_firewall_config_modify(*args): api_call = _invoke_ap...
<filename>tools/ins2000_parser.py<gh_stars>10-100 import os import sys import argparse import json import struct import math import collections import datetime import time PI = 3.1415926535897932 WGS84 = { 'a': 6378137.0, 'b': 6356752.3142, 'f': 0.0033528106643315515, 'e': 0.081819190837555025, 'e2': 0.0066943799...
400.000, 100.000, 0.000, 100.000, 900.000, 16695.000, 0.000, 35773.358], [700.000, 710.484, 400.000, 100.000, 0.000, 100.000, 900.000, 16695.000, 0.000, 36274.946], [700.000, 710.484, 400.000, 100.000, 0.000, 100.000, 900.000, 16695.000, 0.000, 35739.309], [500.000, 710.484, 1100.000, 100.000, 0.000, 100.000, 900.00...
return Ravel(Add([self.func, other.func]), self.axis) return Ravel(Add([self.func, Unravel(other, self.axis, self.func.shape[self.axis:self.axis+2])]), self.axis) def _get(self, i, item): if i != self.axis: return Ravel(Get(self.func, i+(i>self.axis), item), self.axis-(i<self.axis)) if item.isconstant and numeric...
# Copyright 2019 T-Mobile US, 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...
isinstance(val, CpoExpr): return val # Check atoms (not cached) vtyp = type(val) ctyp = _PYTHON_TO_CPO_TYPE.get(vtyp) if ctyp: return CpoValue(val, ctyp) # Check numpy scalars (special case when called from overloaded operator) #if vtyp is NUMPY_NDARRAY and not val.shape: if vtyp is NUMPY_NDARRAY: return Cp...
<reponame>gAldeia/itea-python # Author: <NAME> # Contact: <EMAIL> # Version: 1.0.2 # Last modified: 06-25-2021 by <NAME> """Base class to represent an IT expression. """ import numpy as np from sklearn.base import BaseEstimator from sklearn.utils.validation import check_array class BaseITExpr(BaseE...
<filename>src/falconpy/malquery.py """Falcon MalQuery API Interface Class _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1 | |: 1 | |::.. . | CROWDSTRIKE FALCON |...
""" Affine image registration module consisting of the following classes: AffineMap: encapsulates the necessary information to perform affine transforms between two domains, defined by a `static` and a `moving` image. The `domain` of the transform is the set of points in the `static` image's grid, and the `codomai...
<reponame>nikitaborisov/autowordl words = ['AAHED', 'AALII', 'AARGH', 'AARTI', 'ABACA', 'ABACI', 'ABACK', 'ABACS', 'ABAFT', 'ABAKA', 'ABAMP', 'ABAND', 'ABASE', 'ABASH', 'ABASK', 'ABATE', 'ABAYA', 'ABBAS', 'ABBED', 'ABBES', 'ABBEY', 'ABBOT', 'ABCEE', 'ABEAM', 'ABEAR', 'ABELE', 'ABERS', 'ABETS', 'ABHOR', 'ABIDE', 'AB...
<filename>services/models.py from collections import defaultdict from django.conf import settings from django.contrib.gis.db import models from django.contrib.gis.geos import Point from django.contrib.sites.models import Site from django.core.exceptions import ValidationError from django.core.urlresolvers import revers...
radius: int, h: float, sigma: float, mse: tuple[float, float], hard_thr: float, block_size: int, block_step: int, group_size: int, bm_range: int, bm_step: int, ps_num: int, ps_range: int, ps_step: int, lowpass: list[float], color: bool, matrix: int ): mask = core.GenBlockMask(core.ShufflePlanes(src, 0, vs.GRAY)) c...
<reponame>alewis/jax_vumps<filename>testing/old_contractions.py """ A docstring """ import numpy as np import scipy as sp import numpy.linalg as npla import scipy.linalg as spla from functools import reduce from bhtools.tebd.scon import scon import bhtools.tebd.utils as utils #from scipy.linalg import solve """ Con...
self.plotMeanButton3D = qt.QPushButton("Toggle mean shape visibility") self.plotMeanButton3D.checkable = True self.plotMeanButton3D.toolTip = "Toggle visibility of mean shape plot" meanShapeLayout.addWidget(self.plotMeanButton3D,1,2) self.plotMeanButton3D.enabled = False self.plotMeanButton3D.connect('clicked(bool...
import json from _sha1 import sha1 from datetime import datetime from unittest import TestCase from unittest.mock import patch, Mock from urllib.parse import urlencode from verification.application.handlers.jumio_verification_handlers import submit from verification.application.handlers.verification_handlers import in...
<reponame>jeetsukumaran/spdw<gh_stars>0 #! /usr/bin/env python3 # -*- coding: utf-8 -*- import math import os import collections import json import sys import argparse import inspect import itertools import io import dendropy class Partition(object): @staticmethod def build_species_leafsets(d): if d is None: ret...
<reponame>cabrittin/elegansbrainmap """ connectome.py Connectome data structures. Inherits from iGraph See http://igraph.org/python/ Required 3rd party packages: igraph csv numpy Author: <NAME> """ import igraph import csv import numpy as np import ioaux SCREEN = ['old'] class Connectome: """ Class to rep...
1 t = max(A, B, C) if t >= p: a -= 1 B += D[a] A -= D[a] break p = t ans = min(ans, p) return p def func_185eefb746f742679e04ba34753568f0(N, D): S = sum(D) ans = S A, B, C = 0, 0, S a = 0 b = -1 while b < N - 1: b += 1 C -= D[b] B += D[b] p = max(A, B, C) while a < b: B -= D[a] A += D[a] a += 1...
<gh_stars>0 # Dimensional Analysis code # author: <NAME> # date: 02/18/2021 # email: <EMAIL> import sys import numpy as np try: import Tkinter as tk except ImportError: import tkinter as tk try: import ttk py3 = False except ImportError: import tkinter.ttk as ttk py3 = True from dimensional_analysis import so...
<gh_stars>1-10 import hashlib import tempfile import os from babel.dates import get_timezone, format_datetime, format_date from django.http import HttpResponse from django.utils import timezone from reportlab.lib import colors from reportlab.lib.enums import TA_CENTER, TA_RIGHT from reportlab.lib.styles import getSa...
{ "id": "56255f3807599c377bf0e5bf072359fd", "username": "Chachou", "email": "<EMAIL>", } response = self.client.get( "/api/liveregistrations/", HTTP_AUTHORIZATION=f"Bearer {jwt_token}", ) self.assertEqual(response.status_code, 200) self.assertEqual(response.json()["count"], 1) self.assertEqual( response.js...
<reponame>ThomasEdwardRiley/nestcheck<filename>nestcheck/diagnostics_tables.py #!/usr/bin/env python """ High-level functions for calculating results of error analysis and diagnostic tests for batches of nested sampling runs. """ import numpy as np import pandas as pd import nestcheck.error_analysis import nestcheck.i...
<reponame>maxwerhahn/Multi-pass-GAN #****************************************************************************** # # tempoGAN: A Temporally Coherent, Volumetric GAN for Super-resolution Fluid Flow # Copyright 2018 <NAME>, <NAME>, <NAME>, <NAME>, <NAME> # #*************************************************************...
<gh_stars>1-10 """Base graph class specialized for neural networks on graphs.""" from __future__ import absolute_import import networkx as nx import numpy as np import dgl from .base import ALL, is_all, DGLError, dgl_warning from . import backend as F from .frame import FrameRef, Frame, merge_frames from .graph_index...
ret_val, response = self._make_rest_call_helper_oauth2(action_result, endpoint, json=param, method=method) if phantom.is_fail(ret_val): return None if response.get("resources"): list_ids_details.extend(response.get("resources")) del list_ids[:min(100, len(list_ids))] return list_ids_details def _get_device_...
import libvirt from xml.etree import ElementTree from jinja2 import Environment, PackageLoader, FileSystemLoader import os import time import shutil import random from qcow2 import Qcow2 from js9 import j import atexit LOCKCREATED = 1 LOCKREMOVED = 2 NOLOCK = 3 LOCKEXIST = 4 JSBASE = j.application.jsbase_get_class() ...
import argparse import threading import socket import time import _pickle as cpickle import hashlib import pygame import copyreg import ctypes import lz4.frame def get_ip_address(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) return s.getsockname()[0] class GLL...
<reponame>lawrence14701/galaxy<gh_stars>10-100 #!/usr/bin/env python # % brew vinstall samtools 1.0 # % brew vinstall samtools 0.1.19 # % brew vinstall samtools 1.1 # % brew env samtools 1.1 # PATH=/home/john/.linuxbrew/Cellar/htslib/1.1/bin:/home/john/.linuxbrew/Cellar/samtools/1.1/bin:$PATH # export PATH # LD_LIBRAR...
X.509 cert" x509Cert = X509().parse(open(os.path.join(dir, "serverX509Cert.pem")).read()) x509Chain = X509CertChain([x509Cert]) s = open(os.path.join(dir, "serverX509Key.pem")).read() x509Key = parsePEMKey(s, private=True) connection = connect() connection.handshakeServer(verifierDB=verifierDB, \ certChain=x509...
properties=dict( addresses=relationship( Address, cascade="all,delete-orphan", backref="user" ), orders=relationship(Order, cascade="all, delete-orphan"), ), ) s = Session() # the standalone Address goes in, its foreign key # allows NULL a = Address() s.add(a) s.commit() # the standalone Order does not. ...
<gh_stars>0 # encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): depends_on = [ ("core", "0001_initial"), ("environments", "0001_initial"), ("library", "0001_initial"), ] def forwards(self, orm): # Addin...
:param str workload_type: Workload type for which registration was sent. """ if backup_management_type is not None: pulumi.set(__self__, "backup_management_type", backup_management_type) if container_type is not None: pulumi.set(__self__, "container_type", 'AzureWorkloadContainer') if extended_info is not None: ...
""" Just another Python API for Travis CI (API). A module which provides the "Repository" resource type. Author: <NAME>, @funilrys, contactTATAfunilrysTODTODcom Project link: https://github.com/funilrys/PyTravisCI Project documentation: https://pytravisci.readthedocs.io/en/latest/ License :: MIT License Co...
# -*- coding: utf-8 -*- import os import json from collections import OrderedDict from django.conf import settings from bs4 import BeautifulSoup from portal.portal_helper import Content class SphinxContent: PADDLE = 'paddle' PADDLE_API = 'api' VISUALDL = 'visualdl' def paddle_sphinx_fluid_sitemap(original_docume...
Method': 'طريقة التحديث', 'Update Policy': 'سياسة التحديث', 'Update Report': 'تحديث التقرير', 'Update Request': 'تحديث الطلب', 'Update Service Profile': 'تحديث خدمة البيانات الشخصية', 'Update this entry': 'تحديث هذه الادخال', 'Update Unit': 'تحديث وحدة', 'Update your current ordered list': 'تحديث القائمة المرتبة...
<reponame>samadhicsec/threatware #!/usr/bin/env python3 """ Handler to invoke verifier """ import logging import sys import argparse import json from pathlib import Path from storage.gitrepo import GitStorage from utils.error import ThreatwareError from utils.output import FormatOutput import utils.logging from provid...
from __future__ import absolute_import from __future__ import unicode_literals import logging from functools import reduce import paramiko import os import MySQLdb import random from orchestration.database import database_update from orchestration.moosefs import commands as mfs_commands from orchestration.network imp...
# =========================== # Imports required libraries # =========================== import pygame import random from sys import exit # ============================================= # Sets up window - might move to display class # ============================================= print("Setting up window") pygame.i...
# -*- coding: utf-8 -*- from __future__ import (unicode_literals, absolute_import) from julia import node EQUIPMENT = { '0': 'None', '1': 'M4 Super90', '2': 'Nova Pump', '3': 'Shotgun', '4': 'Less Lethal Shotgun', '5': 'Pepper-ball', '6': 'Colt M4A1 Carbine', '7': 'AK-47 Machinegun', '8': 'GB36s Assault Rif...
49, 'R', 'F') : 'RF2', (131, 49, 'R', 'U') : 'UR0', (131, 49, 'U', 'B') : 'UB2', (131, 49, 'U', 'F') : 'UF2', (131, 49, 'U', 'L') : 'UL2', (131, 49, 'U', 'R') : 'UR2', (135, 97, 'B', 'D') : 'DB2', (135, 97, 'B', 'L') : 'LB2', (135, 97, 'B', 'R') : 'RB2', (135, 97, 'B', 'U') : 'UB2', (135, 97, 'D', 'B') : 'DB0...
''' This is right after migrating last V2 env. refer to xls design file. -- Entrada_v2 /Users/qiyang/Documents/qduan/git/work_git/field_service_robot/doc/dispatch_ai_model_design.xlsx step 1: move rules out of env definition. step 2: Then I will change network layout to multiple input (cnn + dense) https://www.pyimag...
__next__(self): global set_global_value set_global_value('MyFilter', '__next__') return 'infinite loop' o = MyFilter(lambda: None, []) getattr(o, attribute_name) assert is_global_value_set('MyFilter', '__getattribute__') iter(o) assert is_global_value_set('MyFilter', '__iter__') next(o) assert is_global_value_set(...
#!/usr/bin/env python # coding: utf-8 # # 8. Interactivity in Python # ### Announcements # - Lab 7 due Wednesday # - Interview with <NAME> on Friday # - Code Review I for final projects due on November 19 (50% complete, working examples) # So far this semester, our interaction with Python has been primarily based i...
<filename>type4py/preprocess.py<gh_stars>10-100 from sklearn.model_selection import train_test_split from sklearn.preprocessing import LabelEncoder from type4py import logger, AVAILABLE_TYPES_NUMBER, MAX_PARAM_TYPE_DEPTH from libsa4py.merge import merge_jsons_to_dict, create_dataframe_fns, create_dataframe_vars from li...
""" Training script. Should be pretty adaptable to whatever. """ import argparse import os import shutil import json from copy import deepcopy import multiprocessing import numpy as np import pandas as pd import torch from allennlp.common.params import Params from allennlp.training.learning_rate_schedule...
SP.array of I0 interaction variables to be included in the background model when testing for interaction with Inters K1r: [N x N] SP.array of LMM-covariance/kinship koefficients (optional) If not provided, then linear regression analysis is performed K1c: [P x P] SP.array of LMM-covariance/kinship koefficients (opt...
"""Channel. A channel is used to send values to streams. The stream will iterate over incoming events in the channel. """ import asyncio from typing import ( Any, Awaitable, Callable, Mapping, MutableSet, Optional, Set, cast, ) from weakref import WeakSet from mode import Seconds, get_logger, want_seconds ...
<filename>position inference/csv_to_db_correctBAD.py import numpy as np import sqlite3 import pandas as pd import time import sys bTime = time.time() try: f = open("../DATAcorrected.db", "xt") f.close() except: print("\nDelete DATAcorrected.db in order to use the program") sys.exit() db = sqlite3....
RuntimeError("There isn't enough documents in the database for training the Top2Vec model.") else: if len(docs) > 1000: self.train(docs=list(map(lambda d: d.text, docs))) # training the Top2Vec model with the uploaded documents else: raise RuntimeError("There isn't enough documents in the database or in the upload...
# Copyright 2016-2017 Capital One Services, LLC # Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 import itertools import operator import zlib import jmespath from c7n.actions import BaseAction, ModifyVpcSecurityGroupsAction from c7n.exceptions import PolicyValidationError, ClientError fro...
cmap = Colormap(self._coltbl(cmap_file), name=cname) matplotlib.cm.register_cmap(name=cname, cmap=cmap) return cmap @property def cet_d_rainbow_bgymr_r(self): cname = "cet_d_rainbow_bgymr_r" if cname in matplotlib.cm._cmap_registry: return matplotlib.cm.get_cmap(cname) cmap_file = os.path.join(CMAPSFILE_DIR, "...
recvbuf=[Segment_X_spread[gtx].mask, MPI.BOOL], op=MPI.LAND) Distributed_X_spread = None #-- along-track Y coordinates of segment fit Segment_Y_atc[gtx] = np.ma.zeros((n_seg),fill_value=fill_value) Segment_Y_atc[gtx].mask = np.ones((n_seg),dtype=bool) comm.Allreduce(sendbuf=[Distributed_Y_atc.data, MPI.DOUBLE], \ ...
the neighbor allreduce precision (sum) 1D, 2D, 3D tensors correctly.""" size = bf.size() rank = bf.rank() if size <= 1: fname = inspect.currentframe().f_code.co_name warnings.warn("Skip {} due to size 1".format(fname)) return dtypes = [torch.DoubleTensor] if TEST_ON_GPU: dtypes += [torch.cuda.DoubleTensor] #...
<reponame>yubocai-poly/CSE102 #! /usr/bin/env python3 # -------------------------------------------------------------------- import math # -------------------------------------------------------------------- class Node: def __init__(self, value, left=None, right=None): self.value = value self.left = left self.ri...
<gh_stars>0 # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the LICENSE file in # the root directory of this source tree. An additional grant of patent rights # can be found in the PATENTS file in the same directory. import math import to...
""" This is to understand how Config.extra works. See also: https://pydantic-docs.helpmanual.io/usage/model_config/ TL;DR - There are some surprises when you have properties on your Models both set/get and when exporting via dict() """ import pytest from pydantic import BaseModel, Extra, ValidationError DATA = {"th...
is not None: scale = scale.to(device=device, dtype=dtype) assert len(scale.shape) == 1 and ( len(scale) == 2 or len(scale) == 4 ), f"`scale` shall have 2 or 4 elements. Got {scale}." _joint_range_check(cast(torch.Tensor, scale[:2]), "scale") _scale = _adapted_uniform((batch_size,), scale[0], scale[1], same_on_bat...