input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<reponame>8ball030/AutonomousHegician
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2020 eightballer
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may o... | |
true values of the energy for electrons.
:parameter pred_ele: array containing the predicted energies for electrons.
:parameter tr_pi0: array containing the true values of the energy for neutral pions.
:parameter pred_pi0: array containing the predicted energies for neutral pions.
:parameter tr_chPi: array containi... | |
")
for ns in ("", "processor"):
new_command("print-time", print_time_cmd,
{"": [arg(obj_t('processor', 'processor'), "cpu-name", "?"),
arg(flag_t, "-s"),
arg(flag_t, "-c"),
arg(flag_t, "-all")],
"processor": [ arg(flag_t, "-s"),
arg(flag_t, "-c")]}[ns],
namespace = ns,
alias = "ptime",
type = ["Execution", "... | |
###################################################################################################
#ESNet: An Efficient Symmetric Network for Real-time Semantic Segmentation
#Paper-Link: https://arxiv.org/pdf/1906.09826.pdf
############################################################################################... | |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# pylint:disable=bad-whitespace
# pylint:disable=line-too-long
# pylint:disable=too-many-lines
# pylint:disable=invalid-name
# #########################################################
#
# ************** !! WARNING !! ***************
# ******* THIS FILE WAS AUTO-GENERATE... | |
import os
import argparse
import json
import psutil
import numpy
from onnx import TensorProto
"""
This profiler tool could run a transformer model and print out the kernel time spent on each Node of the model.
Example of profiling of longformer model:
python profiler.py --model longformer-base-4096_fp32.onnx --batch_s... | |
Sets the size of the start annotation arrow head,
relative to `arrowwidth`. A value of 1 (default) gives
a head about 3x as wide as the line.
startstandoff
Sets a distance, in pixels, to move the start arrowhead
away from the position it is pointing at, for example
to point at the edge of a marker independent of ... | |
<gh_stars>0
import os
import os.path
import cv2
import glob
import h5py
from PIL import Image
import skimage
import skimage.io
import numpy as np
import pandas as pd
import torch
from torchvision import transforms
import torchvision.transforms.functional as TF
import utils
DATASET_REGISTRY = {}
def build_dataset(... | |
<reponame>NicEscobar/InertialNavigation
#!/usr/bin/env python
'''
parse a MAVLink protocol XML file and generate a Node.js javascript module implementation
Based on original work Copyright <NAME> 2011
Released under GNU GPL version 3 or later
'''
from __future__ import print_function
from builtins import range
impor... | |
add referring words.')
def get_sight(self):
return self._sense['sight']
def set_sight(self, string):
self._sense['sight'] = discourse_model.reformat(string)
sight = property(get_sight, set_sight,
'What is seen when an Item is looked at.')
def get_touch(self):
return self._sense['touch']
def set_touch(self, s... | |
# Author: <NAME> (<EMAIL>)
# Center for Machine Perception, Czech Technical University in Prague
"""Implementation of the pose error functions described in:
Hodan, Michel et al., "BOP: Benchmark for 6D Object Pose Estimation", ECCV'18
Hodan et al., "On Evaluation of 6D Object Pose Estimation", ECCVW'16
"""
import mat... | |
.raw bytes crypto material only without code
.pad int number of pad chars given raw
.qb64 str in Base64 fully qualified with derivation code + crypto mat
.qb64b bytes in Base64 fully qualified with derivation code + crypto mat
.qb2 bytes in binary with derivation code + crypto material
.nontrans True when non-tran... | |
<reponame>metagov/discord-research-bot<filename>app/database.py
from abc import ABC, abstractproperty
from tinydb.table import Document
from tinydb.queries import Query
from tinydb import TinyDB, where
from helpers import user_to_hash
from datetime import datetime
from typing import Generator, List, Optional
from enum ... | |
<filename>notebooks/Users/pavan.r.r@koantek.com/GANS_MAFIA (1).py<gh_stars>0
# Databricks notebook source
# from google.colab import drive
# drive.mount('/content/drive')
# COMMAND ----------
# from google.colab.patches import cv2_imshow
# COMMAND ----------
!git clone https://github.com/dattasiddhartha/segmented-s... | |
<reponame>guoqiao/charm_upgrade
#!/usr/bin/python3
import sys
import time
import json
import argparse
import subprocess
import logging
from os import getenv
from os.path import abspath, dirname, join
from collections import defaultdict
import requests
LOG = logging.getLogger(__name__)
LOG_FMT = '%(asctime)s %(levelna... | |
from cardboard import types
from cardboard.ability import (
AbilityNotImplemented, spell, activated, triggered, static
)
from cardboard.cards import card, common, keywords, match
@card("Maze of Ith")
def maze_of_ith(card, abilities):
def maze_of_ith():
return AbilityNotImplemented
return maze_of_ith,
@card("S... | |
<gh_stars>0
# Copyright 2015 Google 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 or agreed to in wr... | |
are using the pure Python implementation ' +
'of fast fca.')
# Return output
mining_results = _fast_fca(
context,
min_c=min_occ,
min_z=min_spikes,
max_z=max_spikes,
max_c=max_occ,
winlen=winlen,
min_neu=min_neu,
report=report)
return mining_results, rel_matrix
def _build_context(binary_matrix, winlen, onl... | |
is None:
return False
return _release_cluster_lock(session, lock, action_id, scope)
@retry_on_deadlock
def cluster_lock_steal(cluster_id, action_id):
with session_for_write() as session:
lock = session.query(
models.ClusterLock).with_for_update().get(cluster_id)
if lock is not None:
lock.action_ids = [action_... | |
# Copyright 2020 Microsoft Corporation
#
# 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 wri... | |
matrix mapping source dipole strengths to target normal-grads
See lap3ddipole_native for math definitions.
"""
y = np.atleast_2d(y) # handle ns=1 case: make 1x3 not 3-vecs
d = np.atleast_2d(d)
x = np.atleast_2d(x)
e = np.atleast_2d(e)
ns = y.shape[0]
nt = x.shape[0]
assert(A.shape==(nt,ns))
assert(An.shape==(... | |
<reponame>bopopescu/Social-Lite
# -*- coding: utf-8 -*- #
# Copyright 2017 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | |
<filename>hnn_core/dipole.py
"""Class to handle the dipoles."""
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
import warnings
import numpy as np
from copy import deepcopy
from .viz import plot_dipole, plot_psd, plot_tfr_morlet
def simulate_dipole(net, tstop, dt=0.025, n_trials=None, record_vsoma=False,
record_is... | |
<reponame>alapan-sau/SocialMediaDB<gh_stars>0
import subprocess as sp
import pymysql
import pymysql.cursors
from tabulate import tabulate
from time import time
from datetime import datetime
import time
import datetime
# ----------------- Functional Requirement Start ---------------
def printWeeklyReport():
global c... | |
of false-positives
# Manual override for MS11-011 to reduce false positives. The article was updated, but the bulletin database wasn't (https://technet.microsoft.com/en-us/library/security/ms11-011.aspx)
# V1.2 (March 18, 2011): Added Windows 7 for 32-bit Systems Service Pack 1, Windows 7 for x64-based Systems Servic... | |
optional): Name of the vehicle to get the Pose of
Returns:
Pose:
"""
pose = self.client.call('simGetVehiclePose', vehicle_name)
return Pose.from_msgpack(pose)
def simSetTraceLine(self, color_rgba, thickness=1.0, vehicle_name = ''):
"""
Modify the color and thickness of the line when Tracing is enabl... | |
<filename>tests/readers/opendss/Capacitors/test_capacitor_connectivity.py
# -*- coding: utf-8 -*-
"""
test_capacitor_connectivity.py
----------------------------------
Tests for parsing all the attributes of Capacitors when reading from OpenDSS to Ditto
"""
import os
import math
import pytest
import numpy as np
fro... | |
'Flags', 'model_type': 'Type', 'id': 'ID', 'name': 'Name', 'picture': ''}
cols = ['picture', 'name', 'description', 'first_year', 'country']
lrange = dict(entry=[x for x in entry if x], styles=dict(zip(cols, cols)))
lsection = dict(columns=cols, headers=hdrs, range=[lrange], note='', name=sec.name)
llistix = dict(... | |
= doKeywordArgs(keys,d)
newline = d.get('newline',None)
align = d.get('align',0)
# if not align: align = 0
# Compute the caller name.
try: # get the function name from the call stack.
f1 = sys._getframe(1) # The stack frame, one level up.
code1 = f1.f_code # The code object
name = code1.co_name # The code name... | |
order hexahedron (8 nodes associated with the vertices, 24 with the edges, 24 with the faces, 8 in the volume)
hexahedron_125_node = sp.int32(93) # 125-node fourth order hexahedron (8 nodes associated with the vertices, 36 with the edges, 54 with the faces, 27 in the volume)
#end class gmshtranslator
# From GMSH ... | |
and x_horiz_end >= x_end:
if is_on_poly:
y_end = max(horiz_line[0][1], horiz_line[1][1])
bucket['lines'].append((y_start, y_end))
total_length += (y_end - y_start)
is_on_poly = False
else:
y_start = horiz_line[1][1] # both yco are same on a horizontal line
is_on_poly = True
total_pixel_count += (x_end - x_star... | |
<filename>main.py
# Copyright © 2020. All rights reserved.
# Authors: <NAME>
# Contacts: <EMAIL>
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import copy
# Getting new Xi and y of first side
def get_X1_y1(X_train, y_train, X_test, y_test, index, threshold, si... | |
<reponame>ConnectionMaster/python-plugin
import imp
import importlib
from collections import defaultdict
import sys
import shutil
import tempfile
import hashlib
import logging
import jsonpickle
import errno
from distutils.sysconfig import get_python_lib
#WSE-402 add support for pip 9 and pip 10
try:
from pip._interna... | |
request.page and pagename == request.page.page_name:
# do not create new object for current page
pageobj = request.page
else:
pageobj = Page(request, pagename)
return pageobj
def getFrontPage(request):
""" Convenience function to get localized front page
@param request: current request
@rtype: Page object
@... | |
r"""
Depth averaged shallow water equations in conservative form
"""
from __future__ import absolute_import
from .utility_nh import *
from thetis.equation import Equation
g_grav = physical_constants['g_grav']
rho_0 = physical_constants['rho0']
class BaseShallowWaterEquation(Equation):
"""
Abstract base class for Sh... | |
self.y = x, y
def __repr__(self):
return "<Vector2D: (%f, %f) >" % (self.x, self.y)
def __hash__(self):
return hash((self.x, self.y))
def __eq__(self, other):
if not isinstance(other, Vector2D):
return False
return self.x == other.x and self.y == other.y
def __add__(self, other):
x = self.x + other.x
y =... | |
= {1, 1, 1})
def test_rmw_zp_stk_relative_indirect_word(self):
stdout = StringIO()
mon = Monitor(stdout = stdout)
mpu = mon._mpu
mpu.osx = True; mpu.ind = True; mpu.siz = True;
# kernel stk relative rmw word
mpu.p = mpu.p | 0x20 # set M flag
mpu.pc = 0x200
mpu.sp[1] = 0x1FD
self.rmwVal = 0x55AA
self.rt... | |
with before.each:
self.c = CT()
self.c.situacion = 'L'
self.c.numero_maquinas = 1
with context('si situacion es Local'):
with context('si 1 máquina 15kVA'):
with it('must be TI-42W'):
self.c.potencia = 15
for t in range(18, 24):
self.c.tension = t
expect(self.c.tipoinstalacion).to(equal('TI-42W'))
with con... | |
import os
import csv
import sys
import re
import threading
import time
import tkinter as tk
from tkinter import scrolledtext, ttk, messagebox, END
from tkinter.filedialog import askdirectory
class App(tk.Frame):
__OUTFILE_PREFIX = "ParsedFileResults"
__OUTFILE_HEADERS = ['FILENAME', 'TRN02', 'TRN03', 'PAYER', 'PAYE... | |
\n',
'ATOM 1260 H7 MOL 2 21.566 11.115 11.837 1.00 0.00 H1- \n',
'ATOM 1261 N1 MOL 2 5.510 23.896 13.515 1.00 0.00 N3- \n',
'ATOM 1262 C1 MOL 2 3.179 23.469 15.133 1.00 0.00 C \n',
'ATOM 1263 C2 MOL 2 3.515 22.704 14.027 1.00 0.00 C \n',
'ATOM 1264 C3 MOL 2 4.685 23.027 13.212 1.00 0.00 C \n',
'ATOM 1265 C4 MOL 2... | |
<gh_stars>0
#
# pokersim.py - Runs a Monte Carlo simulation of a hand
# with user-specified 3 community cards
#
#
import argparse
import random
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def hello():
flop = request.args.get('flop')
iterations = request.args.get('iterations')
return main... | |
import cv2
import numpy
from cimbar.util.geometry import calculate_midpoints
def next_power_of_two_plus_one(x):
return 2**((x - 1).bit_length()) + 1
# should be thought of as a line, not an area
class Anchor:
__slots__ = 'x', 'xmax', 'y', 'ymax'
def __init__(self, x, y, xmax=None, ymax=None):
self.x = x
self... | |
Engine.
Args:
h: The hash
Returns:
The string representation of the hash.
"""
return '%s_%s_%s_%s_%s' % (h[0:8], h[8:16], h[16:24], h[24:32], h[32:40])
def _Hash(content):
"""Compute the sha1 hash of the content.
Args:
content: The data to hash as a string.
Returns:
The string representation of the has... | |
import os
import shutil
import addSubproject
import option
import utility
import grapeGit as git
import grapeConfig
import grapeMenu
import checkout
# update your custom sparse checkout view
class UpdateView(option.Option):
"""
grape uv - Updates your active submodules and ensures you are on a consistent branch ... | |
content = FipFloatingIpAssociateFirewallInfoResponsesSerializer(label="弹性公网IP成功关联后的返回信息")
is_ok = serializers.BooleanField(label="成功标识", help_text="示例:{成功:True、失败:False}")
message = serializers.CharField(label="错误信息", help_text="示例:该订单 BMS201908231116166874034 无对应服务器交付信息")
no = serializers.IntegerField(label="返回码", ... | |
"""
Copyright 2021 <NAME>
Orchestrates a hadoop + Hive + SQL cluster of docker nodes
"""
import argparse
import collections
import distutils.dir_util
import json
import os
import re
import shutil
import subprocess
import sys
import time
# PyPI installed modules...
import requests
# The root directory of the playgroun... | |
design_df, run_enrichr=None, enrichrgram=True)
elif data_type == PROTEOMICS or data_type == METABOLOMICS:
json_data = to_clustergrammer(X_std, design_df)
return json_data
def get_standardized_df(analysis_data, axis, pk_cols=PKS):
data_type = analysis_data.data_type
data_df, design_df = get_dataframes(analysis_da... | |
#**************************************************************************#
# This file is part of pymsc which is released under MIT License. See file #
# LICENSE or go to https://github.com/jam1garner/pymsc/blob/master/LICENSE #
# for full license details. #
#**********************************************************... | |
list of FairVariable objects. They correspond to triples in the RDF:
The name is stored as a blanknode with a hasInputVar relation to the step.
This blanknode has an RDF:type, PPLAN:Variable; and an RDFS:comment, a string literal
representing the type (i.e. int, str, float) of the variable.
"""
return [self._get_v... | |
key in ride['lifts']:
item = collection.find_one({'_id': key})
if item['status'] in ['PENDING', 'ACTIVE']:
collection.update({'_id': key}, {'$set': {'status': 'CANCELLED'}}, upsert = False)
new_item = collection.find_one({'_id': key})
after_updated_lift(new_item, item)
#===========================================... | |
<reponame>dhimmel/bioregistry
# -*- coding: utf-8 -*-
"""Utilities for normalizing prefixes."""
import logging
from functools import lru_cache
from typing import Any, Dict, List, Mapping, Optional, Set, Tuple, Union
from .resource_manager import manager
from .schema import Attributable, Resource
__all__ = [
"get_r... | |
190, 247, 255],
[102, 188, 249, 255],
[101, 185, 251, 255],
[99, 183, 253, 255],
[98, 181, 255, 255],
[96, 179, 0, 255],
[95, 177, 0, 255],
[93, 174, 0, 255],
[92, 172, 0, 255],
[91, 170, 0, 255],
[89, 167, 0, 255],
[88, 165, 0, 255],
[86, 162, 0, 255],
[85, 160, 0, 255],
[83, 158, 0, 255],
[82, 155, 0, ... | |
aa
* np.random.random_sample(
3,
)
+ bb
)
self.set_structure(
lattice=np.array([[10, 0, 0], [0, 10, 0], [0, 0, 10]], np.float),
species=["Si"] * (coordination + 1),
coords=coords,
coords_are_cartesian=False,
)
self.setup_random_indices_local_geometry(coordination)
def setup_random_indices_local_geometry(s... | |
<filename>implicit_constrained_optimization/co_utils.py
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/... | |
from bs4 import BeautifulSoup
from selenium import webdriver
from Crawler.utils import utils
from logging.config import fileConfig
import requests
import configparser
import re
import os
import logging
import threading
import math
import time
# initiate config file
config = configparser.ConfigParser()
config.read(os.... | |
Simulation object
run(12)
)
Args:
name (str, optional): Group name.
m (float, int): Group mass.
Returns:
Group
"""
return Group(name, m, callee=self)
def plot(self):
"""Simulation results plotter.
Returns:
SimulationPlotter
"""
return SimulationPlotter(self)
def plot_group_size(self, fpath=None, ... | |
#!/usr/bin/env python3
# coding: utf-8
"""
Common source for utility functions used by ABCD-BIDS task-fmri-pipeline
<NAME>: <EMAIL>
Created: 2021-01-15
Updated: 2021-11-12
"""
# Import standard libraries
import argparse
from datetime import datetime # for seeing how long scripts take to run
from glob import glob
impo... | |
# -*- coding: utf-8 -*-
"""
@File: patent2vec.py
@Description: This is a module for generating document embedding for patents.
This application,
1. Creates Patent2Vec model
2. Initializes Patent2Vec model's weights
with pre-trained model
3. Trains Patent2Vec model
4. Infers document embedding for a new patent do... | |
'''
Created on Jul 22, 2011
@author: Rio
'''
from __future__ import absolute_import
from collections import defaultdict
import os
from logging import getLogger
import itertools
from numpy import swapaxes, uint8, zeros
import numpy
from mceditlib.anvil.adapter import VERSION_1_7, VERSION_1_8
from mceditlib.anvil.ent... | |
def trigger(a, b, c):
func(a, b, c, True)
func(a, b, c, False)
trigger.get_concrete_function()
root = tracking.AutoTrackable()
root.f = func
root = cycle(root, cycles)
self.assertAllEqual(root.f(), [1.0, 2.0, 3.0, True])
self.assertAllEqual(root.f(-1.0, training=False), [3.0, 2.0, -1.0, False])
with self.as... | |
func_f44f33e103f543419a1dcb8c9bab2103(r, p, s, q, N):
D = [((i * p + q) % r + s) for i in range(N)]
S = sum(D)
ans = S
A, B, C = 0, 0, S
return C
def func_51b005fbf8e74403aa64e1e560f4a121(r, p, s, q, N):
D = [((i * p + q) % r + s) for i in range(N)]
S = sum(D)
ans = S
A, B, C = 0, 0, S
return D
def func_d... | |
import cv2
from PIL import Image, ImageEnhance, ImageFilter
#from skimage.util import random_noise
import mmcv
import numpy as np
from numpy import random
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
from ..registry import PIPELINES
try:
from imagecorruptions import corrupt
except ImportError:
co... | |
# Copyright 2012 <NAME>
# Copyright 2013 Canonical Ltd.
# 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 requi... | |
file
wavel_loose -- As wavel, but with less strict criteria
fflat_mfsky -- Find a reduced fibre flat field from a twilight flat
fflat_mfsky_loose-- Find a reduced fibre flat field from any twilight flat field on a night
fflat_mksky_any -- Find a reduced fibre flat field from any twilight flat field in a manager set... | |
outfile (former: 'tmat')"]),
('<RELAX_SPINANGLE_DIRAC>', [
None, '%l', False,
"Run option: relax the spin angle in a SCF calculation [only DIRAC mode] (former: 'ITERMDIR')"
]),
('<SEARCH_EFERMI>', [
None, '%l', False,
"Run option: modify convergence parameters to scan for fermi energy only (to reach charge neutr... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
proxy.py
~~~~~~~~
⚡⚡⚡ Fast, Lightweight, Programmable Proxy Server in a single Python file.
:copyright: (c) 2013-present by <NAME> and contributors.
:license: BSD, see LICENSE for more details.
"""
import argparse
import asyncio
import base64
import contextlib
imp... | |
<gh_stars>10-100
# -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - <NAME> <<EMAIL>>
#
# 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 ... | |
import numpy as np
import networkx as nx
from autode.smiles import atom_types
from autode.log import logger
from autode.utils import log_time
from autode.atoms import Atom, AtomCollection
from autode.bonds import get_avg_bond_length
from autode.smiles.base import SMILESAtom, SMILESBond, SMILESStereoChem
from autode.smi... | |
big image or tensor 'a', shave it symmetrically into b's shape"""
# If dealing with a tensor should shave the 3rd & 4th dimension, o.w. the 1st and 2nd
is_tensor = (type(a) == torch.Tensor)
r = 2 if is_tensor else 0
c = 3 if is_tensor else 1
# Calculate the shaving of each dimension
shave_r, shave_c = max(0, a.sh... | |
else:
# route is not straight and will be split.
# put old route in list and start a new route
if len(newroute) >= n_edges_min:
# route should contain at least n_edges_min edges
newroutes.append(newroute)
routecosts.append(self.get_routecost(newroute))
# attention, we need the last edge of the old route
# in o... | |
a domain and //
assert mep_tags.domain('https://docs.python.org/3/library/') == 'python'
assert mep_tags.domain('//www.cwi.nl:80/%7Eguido/Python.html') == 'cwi'
# returns None on local URLs or those missing //
assert mep_tags.domain('www.cwi.nl/%7Eguido/Python.html') is None
assert mep_tags.domain('help/Python.htm... | |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
This experiment was partially created using PsychoPy2 Experiment Builder (v1.83.04), Tue Feb 23 13:01:04 2016
If you publish work using this script please cite the relevant PsychoPy publications
<NAME> (2007) PsychoPy - Psychophysics software in Python. Journal of Neu... | |
<gh_stars>100-1000
# Copyright (c) 2017 The Johns Hopkins University/Applied Physics Laboratory
# 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.or... | |
-> typing.Dict[str, typing.Any]:
"""https://www.hl7.org/fhir/extensibility.html#Special-Case
In some cases, implementers might find that they do not have appropriate data for
an element with minimum cardinality = 1. In this case, the element must be present,
but unless the resource or a profile on it has made the a... | |
from keras.engine import Layer
from keras import activations
from keras import initializers
from keras import regularizers
from keras import constraints
from keras import backend as K
#from keras.layers import RNN
#import tensorflow as tf
#import tensorflow.contrib.rnn as rnn
class NASCell(Layer):
"""Neural Architec... | |
<reponame>ondrejbohdal/evograd<filename>CrossDomainFewShotLearning/methods/backbone.py
# This code is modified from https://github.com/facebookresearch/low-shot-shrink-hallucinate
import torch
import torch.nn as nn
import math
import torch.nn.functional as F
from torch.nn.utils import weight_norm
# --- gaussian initi... | |
dump the resulting output. After a call
to done(), you may not add any more modules until you call
reset(). """
assert self.mf is None
# If we are building an exe, we also need to implicitly
# bring in Python's startup modules.
if addStartupModules:
self.modules['_frozen_importlib'] = self.ModuleDef('importlib... | |
# -*- coding: utf-8 -*-
# Metropolis Drift-Diffusion-Model
# Copyright 2018 <NAME>, <NAME>, <NAME>
# This file is released under the MIT licence that accompanies the code
## This file contains a console interface and related routines
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse.csgraph impor... | |
randomization=0):
if (self.working_mode == 'synthesis'):
self.flatten_parameters_to_reference(cycle=0)
self.output_handler.write(self, pixel=0, randomization=randomization)
def add_spectral(self, spectral):
"""
Programmatically add a spectral region
Parameters
----------
spectral : dict
Dictionary containi... | |
import errno
import os
import json
import re
import shutil
import tarfile
from urlparse import urlparse
import arc
from pandaharvester.harvestercore import core_utils
from .base_messenger import BaseMessenger
from pandaharvester.harvesterconfig import harvester_config
from pandaharvester.harvestermisc import arc_utils... | |
# -*- coding: utf-8 -*-
"""
:mod:`channel.worker` -- Multi-device sync API for a single computation device
==============================================================================
.. module:: worker
:platform: Unix
:synopsis: Provide methods for single device Theano code that enable
homogeneous operations acr... | |
lexRefType
class langType(GeneratedsSuper):
"""The Language element containing a reference to a language name or
(if possible persistent) definition. ISO-639-3 still seems to be
the best choice for language codes and closest to persistent
language ID's seem to be the http://cdb.iso.org/lg/...
identifiers also us... | |
dtype=np.int64)
pv = np.zeros(3, dtype=np.int64)
pt = np.zeros(3, dtype=np.int64)
dr = np.zeros(3, dtype=np.float64)
density_t = np.zeros(2, dtype=np.float64)
grad = np.zeros(3, dtype=np.float64)
grad_dir = np.zeros(3, dtype=np.float64)
max_grad = np.float64(0.)
known = np.zeros((vx, vy, vz), dtype=np.int8)
# ... | |
of the release of MySQL Shell 8.0.24, in order to use Inbound
Replication into an MySQL Database Service instance with High
Availability, all tables at the source server need to have Primary Keys.
This needs to be fixed manually before running the dump. Starting with
MySQL 8.0.23 invisible columns may be used to ad... | |
#!/usr/bin/env python
"""
Gmail notification in Menu bar.
requirement: rumps (https://github.com/jaredks/rumps),
httplib2, oauth2client, google-api-python-client
Worked with python 2.7
"""
import os
import sys
import re
import argparse
import base64
import dateutil.parser
import webbrowser
import urllib
import httpl... | |
<gh_stars>1-10
""" The access backend object base class """
from __future__ import unicode_literals
import six
import hmac
import hashlib
import time
from collections import defaultdict
from passlib.apps import LazyCryptContext
from passlib.utils import sys_bits
from pyramid.security import (
Authenticated,
Everyone... | |
Again with the optional parameters to change the values.
Change_degree_of_block change the value of out_degree of block.
"""
return ((self.partition.get_edge_count(neighbor_block, to_block) - change_ets)
+ (self.partition.get_edge_count(to_block, neighbor_block) - change_est)
+ self.epsilon) \
/ ((self.partition.... | |
bin = 10
x,y = numpy.meshgrid(numpy.arange(0,LENGTH1,bin),numpy.arange(0,LENGTH2,bin))
x_conv = coord_conv_x(x)
y_conv = coord_conv_y(y)
epsilon = 0
index = 0
ROT=ROTS[0]
for term in cheby_terms_use:
index += 1
#print index, ROT, term, fitvars[str(ROT)+'$'+term['n']]
epsilon += fitvars[str(ROT)+'$'+term['n'... | |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | |
<filename>transformations/multilingual_backtranslation/transformation.py
from nltk import edit_distance
from transformers import MarianMTModel, MarianTokenizer
from interfaces.SentenceOperation import SentenceOperation
from tasks.TaskTypes import TaskType
from transformations.multilingual_backtranslation.helpers.suppo... | |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""Test the modern PyGreSQL interface.
Sub-tests for the copy methods.
Contributed by <NAME>.
These tests need a database to test against.
"""
try:
import unittest2 as unittest # for Python < 2.7
except ImportError:
import unittest
from collections import Iterable
imp... | |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.7
# kernelspec:
# display_name: Python [conda env:bandit_py3]
# language: python
# name: conda-env-bandit_py3-py
# ---
# %% language="javascript"
# IP... | |
# -*- coding: utf-8 -*-
__author__ = '<NAME>'
import kivy
kivy.require('1.9.0')
import threading
import time
from datetime import datetime
import urllib2
import json
import operator
import gc
import os
from functools import partial
import math
from kivy.config import Config
Config.set("kivy", "exit_on_escape", False... | |
- 3.36078881755967E-11*m.x1263
- 4.75821426122115E-9*m.x1264 - 5.75253712746733E-8*m.x1265 - 4.75821426122115E-9*m.x1266
- 3.36078881755966E-11*m.x1267 - 4.06309203184713E-10*m.x1268 - 5.75253712746733E-8*m.x1269
- 6.95464339901277E-7*m.x1270 - 5.75253712746733E-8*m.x1271 - 4.06309203184712E-10*m.x1272
- 3.36078881... | |
<gh_stars>0
import hashlib
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from time import time
from types import GeneratorType
from typing import TypeVar, List, Union, Dict, Generator, Optional
from . import codes
from . import logger
from .library import Interval, Scheduled, Smart, SubP... | |
<filename>fauxfactory/__init__.py
# -*- coding: utf-8 -*-
"""Generate random data for your tests."""
__all__ = (
'gen_alpha',
'gen_alphanumeric',
'gen_boolean',
'gen_choice',
'gen_cjk',
'gen_cyrillic',
'gen_date',
'gen_datetime',
'gen_email',
'gen_html',
'gen_integer',
'gen_ipaddr',
'gen_iplum',
'gen_lat... | |
<reponame>googleapis/googleapis-gen<filename>google/appengine/v1/google-cloud-appengine-v1-py/google/cloud/appengine_admin_v1/types/version.py
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the... | |
'Warren':'',
'Watson':'',
'Waverly':'',
'Waylon':'',
'Wayne':'',
'Wesley':'',
'Weston':'',
'Whitley':'',
'Whitney':'',
'Wilder':'',
'Will':'',
'Willa':'',
'William':'',
'Willow':'',
'Wilson':'',
'Winnie':'',
'Winston':'',
'Winter':'',
'Wren':'',
'Wyatt':'',
'Wynter':'',
'Woody':'',
'Xander':'',
'... | |
backcast,
self.var_bounds,
)
sigma2_python = sigma2.copy()
rec.garch_recursion(
parameters,
fresids,
sresids,
sigma2,
1,
1,
1,
nobs,
backcast,
self.var_bounds,
)
assert_almost_equal(sigma2_python, sigma2)
assert np.all(sigma2 >= self.var_bounds[:, 0])
assert np.all(sigma2 <= 2 * self.var_bounds[:, 1])... | |
if parameter.name in list(self.old_new.values()):
key = [k for k in self.old_new if self.old_new[k] == parameter.name][0]
self.old_new[key] = old_param.name
self.old_new[parameter.name] = old_param.name
else:
self.old_new[parameter.name] = old_param.name
# self.add_internal_parameter(iden_param)
else:
#Just ad... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.