input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<reponame>vponomaryov/manila<filename>manila/tests/network/neutron/test_neutron_api.py<gh_stars>0
# Copyright 2013 OpenStack Foundation
# Copyright 2014 Mirantis 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 Licen... | |
if self.args:
self.parser.error('Expected a single <directory> argument.')
rpcserver = self._GetRpcServer()
cron_yaml = self._ParseCronYaml(self.basepath)
if cron_yaml:
cron_upload = CronEntryUpload(rpcserver, cron_yaml, self.error_fh)
cron_upload.DoUpload()
else:
print >>self.error_fh, (
'Could not find cr... | |
<filename>learn/offline_bo.py
import os
import sys
from dotmap import DotMap
import opto
import opto.data as rdata
from opto.opto.classes.OptTask import OptTask
from opto.opto.classes import StopCriteria, Logs
from opto.utils import bounds
from opto.opto.acq_func import EI, UCB
from opto import regression
import pand... | |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
----------------------------------------------... | |
the test will be registered with\n EventManager for every ObjectStateValue managed by ObjectState\n controlling the desired_state_threshold. E.g. if the test cares\n about BrokenState_Broken, we will register tolisten for events for\n state changes of BrokenState_Broken, BrokenState_Unbroken,\n BrokenState_Repairing, e... | |
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
try:
from typing import Dict, List
except ImportError:
pass
class RuntimeOptions(TeaModel):
def __init__(self, autoretry=None, ignore_ssl=None, max_attempts=None, backoff_policy=None, backoff_period=None,
... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ======================================================================
# Copyright 2016 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#... | |
<reponame>jielyu/ml-models
# encoding: utf-8
import os
import io
import itertools
import json
import tempfile
import time
import cv2
import numpy as np
import torch
from torch.utils.data.dataloader import default_collate
import torchvision
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
fro... | |
# Copyright 2017 The KaiJIN 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 law ... | |
hasattr(runpy, '_run_module_as_main'):
py.test.skip("requires CPython >= 2.6")
p = os.path.join(os.path.realpath(os.path.dirname(__file__)),
'mypackage', '__main__.py')
p = os.path.abspath(p)
monkeypatch.chdir(os.path.dirname(app_main))
data = self.run('-m test.mypackage extra')
assert "__init__ argv: ['-m', 'ex... | |
# coding: utf-8
"""
The Blue Alliance API v3
# Overview Information and statistics about FIRST Robotics Competition teams and events. # Authentication All endpoints require an Auth Key to be passed in the header `X-TBA-Auth-Key`. If you do not have an auth key yet, you can obtain one from your [Account Page](/accou... | |
25060765,
-1,
-65128,
26639629,
121147,
-65127,
26703701,
121150,
-65126,
26761198,
121148,
-1,
26824210,
121149,
27001247,
26623286,
-1,
-65123,
26967309,
121151,
-65122,
27023342,
121152,
-1,
27086354,
121153,
-1,
26965778,
121139,
27328949,
25006361,
-1,
27394482,
27269076,
-1,
274... | |
valY = (val * t[1]) + (( 1-val ) * blendT[1])
valZ = (val * t[2]) + (( 1-val ) * blendT[2])
mc.xform( right + '.vtx[' + str(inside[i]) + ']', a=True, os=True, t=[valX, valY, valZ])
bb = mc.exactWorldBoundingBox( self.blend_geo )
height = abs( bb[1] - bb[4] )
pos2 = mc.xform ( self.blend_geo, q=True, a=Tru... | |
# Copyright 2021 Collate
# 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, software
# dis... | |
import composite_behavior
import behavior
import constants
import robocup
import evaluation.passing
import evaluation.path
import main
from enum import Enum
import math
import tactics.positions.submissive_goalie as submissive_goalie
import tactics.positions.submissive_defender as submissive_defender
import role_assignm... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2013 <NAME>
from setuptools import setup
setup(name="pyhex",
version="0.3.0",
description="Python Hexadecimal Converter and Viewer",
classifiers=["Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audi... | |
installed, non-default, non-dependency, package names
"""
package_names = os.listdir(sublime.packages_path())
package_names = [path for path in package_names if path[0] != '.' and
os.path.isdir(os.path.join(sublime.packages_path(), path))]
if int(sublime.version()) > 3000 and unpacked_only == False:
for name in... | |
<reponame>Franck-Dernoncourt/natural-questions<filename>nq_eval.py
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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
#
# htt... | |
= FunctionSpace('V', domain)
x,y = domain.coordinates
alpha = Constant('alpha')
u = Projection(x**2+alpha*y, V, name='u')
#==============================================================================
def test_norm_2d():
domain = Domain('Omega', dim=DIM)
x,y = domain.coordinates
V = FunctionSpace('V', domai... | |
"""
Django settings for bc project.
"""
import os
import sys
from wagtail.embeds.oembed_providers import youtube
import dj_database_url
import raven
from raven.exceptions import InvalidGitRepository
env = os.environ.copy()
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
PROJECT_DIR = os.pat... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
r"""
Finite polyhedral complexes
This module implements the basic structure of finite polyhedral complexes.
For more information, see :class:`PolyhedralComplex`.
AUTHORS:
- <NAME> (2021-05): initial implementation
List of PolyhedralComplex methods
-----------------------------... | |
not in the UTF-8 range. The keys stored in BinaryData
must not overlap with the ones in the Data field, this is enforced
during validation process. Using this field will require 1.10+ apiserver
and kubelet.
data: Data contains the configuration data. Each key must consist of
alphanumeric characters, '-', '_' or '.... | |
<reponame>ucloud/ucloud-iot-device-sdk-c
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import sys
import os
import argparse
import glob
#import cStringIO
reload(sys)
sys.setdefaultencoding("utf-8")
try: import simplejson as json
except: import json
class TEMPLATE_CONSTANTS:
TYPE = "Type"
NAME = "Name"
ID... | |
# -*- coding: utf-8 -*-
"""
All database abstractions for threads and comments
go in this file.
CREATE TABLE `thread_upvotes` (
`user_id` int(11) DEFAULT NULL,
`thread_id` int(11) DEFAULT NULL,
KEY `user_id` (`user_id`),
KEY `thread_id` (`thread_id`),
CONSTRAINT `thread_upvotes_ibfk_1` FOREIGN KEY (`user_id`) REF... | |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017-2022 Univertity of Bristol - High Performance Networks Group
# 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.apach... | |
sga_id in enumerate(np.atleast_1d(fullsample['SGA_ID'])):
ellipsefile = os.path.join(galaxydir, '{}-largegalaxy-{}-ellipse.fits'.format(galaxy, sga_id))
# Find this object in the Tractor catalog.
match = np.where((tractor['REF_CAT'] == refcat) * (tractor['REF_ID'] == sga_id))[0]
if len(match) > 1:
raise ValueErr... | |
<reponame>sofia008/ml-gmail-api<filename>quickstart.py
# import the required libraries
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import pickle
import os.path
import base64
from bs4 import BeautifulSoup
import mys... | |
product_instance_id: str = None,
scene: str = None,
collect_label_content_list: List[CollectLabelContent] = None,
nonce: str = None,
):
# OAuth模式下的授权token
self.auth_token = auth_token
self.product_instance_id = product_instance_id
# 场景码
self.scene = scene
# 收集标签数据
self.collect_label_content_list = collect_la... | |
jailbreak and modifier in ["", ".begins", ".ends", ".regex"]):
return False
elif filter_attr in ["title", "studio"]:
jailbreak = False
current_data = getattr(current, filter_actual)
for check_data in filter_data:
if (modifier in ["", ".not"] and check_data.lower() in current_data.lower()) \
or (modifier == ".beg... | |
a7=self.x, a8=self.b_val_mag_expo[self.i], a9=self.E_val_mag_expo[self.i] )
if self.text == "Sodium":
for self.i in range(start_count, stop_count):
self.main_func(a1=self.text, a2="Sodium", a3=self.Xk_val_sod_expo[self.i], a4=self.c_val_sod_expo[self.i],
a5=self.a_val_sod_expo[self.i], a6=self.d_val_sod_expo[s... | |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | |
для служебных или образовательных задач,
напишите письмо на e-mail разработчика в свободной форме.
Студентам по направлению ИБ/Криминалистика Snoop ПО Full Version может быть
предоставлено на безвозмездной основе.
Snoop Full Version: плагины без ограничений; 1900+ Websites;
поддержка и обновление Database Snoop.
Подкл... | |
import pandas as pd
import numpy as np
import datetime
import math
import configuration
import rews
import binning
import warnings
warnings.simplefilter('ignore', np.RankWarning)
def getSeparatorValue(separator):
try:
return {"TAB":"\t",
"SPACE":" ",
"COMMA": ",",
"SEMI-COLON":";"}[separator.upper()]
except:
... | |
= "%s" % ipranges[0]
else:
iprangestr = "See %s" % e['UserIdGroupPairs'][0]['GroupId']
fh.write("<td>%s</td>" % iprangestr)
if 'FromPort' in e and e['FromPort']:
fh.write("<td>%s - %s/%s</td>" % (e['FromPort'], e['ToPort'], e['IpProtocol']))
else:
fh.write("<td>ALL</td>\n")
fh.write("</tr>\n")
fh.write("</tabl... | |
'''
inventoryanalytics: a Python library for Inventory Analytics
Author: <NAME>
MIT License
Copyright (c) 2018 <NAME>
'''
from typing import List
import numpy as np
from scipy.optimize import minimize
import matplotlib.pyplot as plt
class eoq:
'''
<NAME>. Harris, How Many Parts to Make at Once, Factory,
The Ma... | |
`use_bias` is True,
a bias vector is created and added to the outputs. Finally, if
`activation` is not `None`, it is applied to the outputs as well.
When using this layer as the first layer in a model,
provide the keyword argument `input_shape`
(tuple of integers, does not include the sample axis),
e.g. `input_s... | |
#
# This file is part of MicroPython MPU9250 driver
# Copyright (c) 2018 <NAME>
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
# Project home:
# https://github.com/tuupola/micropython-mpu9250
#
"""
MicroPython I2C driver for MPU9250 9-axis motion tracking device
"""
# pylin... | |
and last bin. If node_type
= 'center' then bounds correspond to the centers of the first
and last bin.
Parameters
----------
lo_bnd : float
Lower bound of first axis bin.
hi_bnd : float
Upper bound of last axis bin.
nbin : int
Number of bins.
interp : {'lin', 'log', 'sqrt'}
Interpolation method used to tra... | |
GuiTreeItemSet_get_linear_search_threshold():
return _gui.GuiTreeItemSet_get_linear_search_threshold()
GuiTreeItemSet_get_linear_search_threshold = _gui.GuiTreeItemSet_get_linear_search_threshold
class GuiTreeItemBasic(GuiTreeItem):
__swig_setmethods__ = {}
for _s in [GuiTreeItem]:
__swig_setmethods__.update(getat... | |
import discord
import asyncio
import os
from discord.ext import commands
import urllib
from urllib.request import URLError
from urllib.request import HTTPError
from urllib.request import urlopen
from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
from urllib.parse import quote
import re # Regex fo... | |
<reponame>njcuk9999/apero-drs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
# CODE NAME HERE
# CODE DESCRIPTION HERE
Created on 2019-01-19 at 12:02
@author: cook
"""
import numpy as np
from astropy.table import Table, vstack
import argparse
import os
import sys
import glob
from collections import OrderedDict
imp... | |
import os
import json
import argparse
import logging
from pathlib import Path
import time
from typing import Tuple
import pandas as pd
import numpy as np
import tqdm
from melloddy_tuner.utils import hash_reference_set
from melloddy_tuner.utils.helper import (
load_config,
load_key,
make_dir,
read_input_file,
crea... | |
self.self.all_head_size = self.self.attention_head_size * self.self.num_attention_heads
self.pruned_heads = self.pruned_heads.union(heads)
def forward(
self,
hidden_states,
attention_mask=None,
head_mask=None,
encoder_hidden_states=None,
output_attentions=False,
):
self_outputs = self.self(
hidden_states,
... | |
class Emote:
smile = u"😄"
satisfied = u"😆"
blush = u"😊"
smiley = u"😃"
relaxed = u"☺️"
smirk = u"😏"
heart_eyes = u"😍"
kissing_heart = u"😘"
kissing_closed_eyes = u"😚"
flushed = u"😳"
relieved = u"😌"
grin = u"😁"
wink = u"😉"
stuck_out_tongue_winking_eye = u"😜"
stuck_out_tongue_closed_eyes = u"😝"... | |
from neo4j.v1 import GraphDatabase, basic_auth
import networkit as nk
import graph_tool as gt
import networkx as nx
from pyspark.graphframes import *
from pyspark.sql import Row
import igraph as ig
import csv
from .graph_vis import NxpdGraph
from .config import bolt_url, results_path
entities = [":ORG", ":LOC", ":PER... | |
"""
Module defining classes for tracking results from simulations.
The trackers defined in this module are:
.. autosummary::
:nosignatures:
CallbackTracker
ProgressTracker
PrintTracker
PlotTracker
LivePlotTracker
DataTracker
SteadyStateTracker
RuntimeTracker
ConsistencyTracker
MaterialConservationTracker
... | |
"Gender": "Male",
"OccupationName": "Artist",
"SkinTone": "medium-dark",
"Location": "Sunrise",
"SalaryMin": "20000",
"SalaryMax": "100000"
},
"Male:dark:Artist": {
"Title": "Man Artist: Dark Skin Tone",
"Source": "https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/240/facebook/158/male-artist-t... | |
3}, {2}} # m{{1, 2, 3}} + m{{1, 3}, {2}} # m{{1, 3}, {2}}
"""
P = SetPartitions()
SP = SetPartitions(A.size())
ret = [[A,A]]
for i, B in enumerate(SP):
for C in SP[i+1:]:
if B.inf(C) == A:
B_std = P(list(B.standardization()))
C_std = P(list(C.standardization()))
ret.append([B_std, C_std])
ret.append([C_std, ... | |
: o0000oO0OOOo0 , "signature-eid" : O000oOO0Oooo ,
"signature" : o00 }
return ( json . dumps ( o00 ) )
if 59 - 59: O0 % iII111i
if 32 - 32: Ii1I % I11i + OOooOOo % OoooooooOO
def verify_map_request_sig ( self , pubkey ) :
oooOo0O00o = green ( self . signature_eid . print_address ( ) , False )
if ( pubkey == None... | |
: {
'meta_info' : _MetaInfoClass('Isis.Instances.Instance.Afs.Af.TopologyName.FrrTable',
False,
[
_MetaInfoClassMember('frr-load-sharings', REFERENCE_CLASS, 'FrrLoadSharings' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_clns_isis_cfg', 'Isis.Instances.Instance.Afs.Af.TopologyName.FrrTable.FrrLoadSharings',
[], [],
... | |
'custom_admin/add_form.html')
# Add an article so we can test delete, change, and history views
post = self.client.post(reverse('admin:admin_views_customarticle_add'), {
'content': '<p>great article</p>',
'date_0': '2008-03-18',
'date_1': '10:54:39'
})
self.assertRedirects(post, reverse('admin:admin_views_custo... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: <NAME>, <NAME>, <NAME>
# *****************************************************************************/
import json, os, sys, re, datetime, pprint, csv, ast
import numpy as np
i... | |
<reponame>ewanbarr/mpikat<filename>mpikat/meerkat/katportalclient_wrapper.py
"""
Copyright (c) 2018 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including ... | |
"""
if instancebranches == None:
instancebranches = instance.branches
for instancebranch in instancebranches:
plus, minus = self._instance_nodes([instancebranch.plus,
instancebranch.minus],
instance, instancename)
yield Branch(plus,minus)
@property
def _nterminalnodes(self):
"""Return number of terminal no... | |
for k, v in files.items()}
kwargs = obj.copy()
kwargs['resources'] = resources
kwargs['files'] = files
return cls(**kwargs)
@classmethod
@implements(Specification.from_protobuf)
def from_protobuf(cls, obj):
resources = Resources.from_protobuf(obj.resources)
files = {k: File.from_protobuf(v) for k, v in obj.... | |
Gutenberg-tm
License terms from this work, or any files containing a part of this
work or any other work associated with Project Gutenberg-tm.
1.E.5. Do not copy, display, perform, distribute or redistribute this
electronic work, or any part of this electronic work, without
prominently displaying the sentence set fort... | |
calculate the steady state for a ' +
'non-dissipative system ' +
'(no collapse operators given)')
elif issuper(A):
return A
else:
raise TypeError('Solving for steady states requires ' +
'Liouvillian (super) operators')
def _steadystate_LU_liouvillian(L, ss_args, has_mkl=0):
"""Creates modified Liouvillian for... | |
<filename>REESSimulation/api.py
from REESSimulation.solver import *
from REESSimulation.types import *
def run(engine):
if engine is None:
return
if engine.solver_params.mode == 'simulate':
return simulate(engine)
if engine.solver_params.mode == 'play':
return play(engine)
return False
def create_rigid_bo... | |
"""
An implementation of JSON Schema for Python
The main functionality is provided by the validator classes for each of the
supported JSON Schema versions.
Most commonly, :func:`validate` is the quickest way to simply validate a given
instance under a schema, and will create a validator for you.
"""
from __future__... | |
# Copyright (C) 2007 - 2009 The MITRE Corporation. See the toplevel
# file LICENSE for license terms.
# This is the core replacement engine. It uses a few external things:
# 1) lots of data it can read in. Sample names, streets, etc.
# 2) numToWords number speller.
# Courtesy of <NAME>, from
# http://mail.python.org... | |
'15:45'
, work_location = '1'
, wp = '15'
)
db.time_record.create \
( daily_record = dr
, start = '15:45'
, end = '17:45'
, work_location = '1'
, wp = '14'
)
dr = db.daily_record.create \
( user = user
, date = date.Date ('2010-03-18')
)
db.time_record.create \
( daily_record = dr
, start = '12:30'
, ... | |
Optional[int]
:param api_port:
:type api_port: Optional[int]
:param db: Name of the database
:type db: Optional[str]
:param user:
:type user: Optional[str]
:param pwd:
:type pwd: Optional[str]
:param verbose: Whether to print operations
:type verbose: Optional[bool]
:returns: Plotter
:rtype: Plotter
... | |
code
"""
hs, ss, fs = cls.Codes[code] # get sizes
return ( (fs - (hs + ss)) * 3 // 4 )
@property
def code(self):
"""
Returns ._code
Makes .code read only
"""
return self._code
@property
def raw(self):
"""
Returns ._raw
Makes .raw read only
"""
return self._raw
@property
def qb64b(self):
"""
P... | |
cluster
:type cluster: :class:`.ContainerCluster`
:param ex_detailed: Flag indicating whether detail info
of the containers is required. This will cause a
GET request for every container present in the
host. Default is True
:type ex_detailed: ``bool``
:rtype: ``list`` of :class:`libcloud.container.base.Contain... | |
(a·∇) (symm ∇) u]
= E : ε + τ E : [(symm ∇) v + (a·∇) ε]
and we have defined
v := ∂u/∂t
i.e. our velocity-like variable is the Eulerian rate of displacement.
The displacement `u` is an Eulerian field, measured with respect to a
reference state where the material travels at constant axial velocity.
It is para... | |
'FEAElementID' not in already_processed:
already_processed.add('FEAElementID')
showIndent(outfile, level)
outfile.write('FEAElementID="%s",\n' % (self.FEAElementID,))
if self._instances is not None and '_instances' not in already_processed:
already_processed.add('_instances')
showIndent(outfile, level)
ou... | |
the original
ELF file and the embedded enclaves.
elf_file: The ELF file to embed the enclaves in. This target is built with
the host toolchain.
enclaves: A dictionary from new ELF section names to the enclave files
that should be embedded in those sections. The section names may not
start with ".", since section ... | |
# Copyright (c) 2013 Hortonworks, 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 wri... | |
<reponame>nikhilagrwl07/homemade-machine-learning
"""Neural Network Module"""
import numpy as np
from ..utils.features import prepare_for_training
from ..utils.hypothesis import sigmoid, sigmoid_gradient
class MultilayerPerceptron:
"""Multilayer Perceptron Class"""
def __init__(self, data, labels, layers, epsilon... | |
is_leaf=True, yang_name="system-priority", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='http://openconfig.net/yang/lacp', defining_module='openconfig-lacp', yang_type='uint16', is_config=True)
name = __builtin__.property(_get_name, _set_name)
interval = __b... | |
''' show_authentication_sessions.py
IOSXE parsers for the following show commands:
* show authentication sessions
* show authentication sessions interface {interface}
* show authentication sessions interface {interface} details
'''
# Python
import re
# Metaparser
from genie.metaparser import MetaParser
from genie... | |
a file was loaded.
"""
if dotenv is None:
if path or os.path.isfile(".env") or os.path.isfile(".citusenv"):
echo(
" * Tip: There are .env or .citusenv files present."
' Do "pip install python-dotenv" to use them.',
fg="yellow",
err=True,
)
return False
# if the given path specifies the actual file then re... | |
def my_purchased_version(self, my_purchased_version):
"""Sets the my_purchased_version of this LibraryItem.
If this is a public item and the merchant has already purchased it, this is their version. If not yet purchased, this will be zero. This value will only be populated during a searchPublicItems() call. # noqa: ... | |
= subsGrp in ("xbrli:item", "xbrli:tuple",
"xbrldt:hypercubeItem", "xbrldt:dimensionItem")
if (prefix in genDocs) and name not in genDocs[prefix].extensionElements and name:
thisDoc = genDocs[prefix]
# elements row
eltType = cellValue(row, 'type')
eltTypePrefix = cellValue(row, 'typePrefix')
if not eltType:
el... | |
the surface a transient surface"""
self._call(OpCode(4), (parent, x, y, flags,))
return None
def set_fullscreen(self, method: FullscreenMethod, framerate: int, output: Optional[WlOutput]) -> None:
"""make the surface a fullscreen surface"""
self._call(OpCode(5), (method, framerate, output,))
return None
def se... | |
that is already open, we will just focus that tab.
:param filepath: path to file on disk
:type filepath: str
:return: bool -- whether or not the file was successfully loaded.
:rtype: bool
"""
if not filepath:
# TODO: The dialog should register the last opened folder into the
# user_dir and use that as the star... | |
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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... | |
def instance_profile_name(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "instance_profile_name", value)
@property
@pulumi.getter(name="instanceTypes")
def instance_types(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
"""
Set of EC2 Instance Types.
"""
return pulumi.get(self, "insta... | |
if isinstance(rows, Subset) else rows
for row in rows:
s = self.sparsity._rowptr[row]
e = self.sparsity._rowptr[row + 1]
diag = np.where(self.sparsity._colidx[s:e] == row)[0]
self._csrdata[s:e].fill(0)
if len(diag) == 1:
diag += s # offset from row start
self._csrdata[diag:diag + 1].fill(diag_val)
def zero(se... | |
<filename>app.py
import base64
import io
from urllib.parse import quote as urlquote
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_table
from dash_table.Format import Format, Scheme
import pandas as pd
import plotly.graph... | |
print('Jitter analysis: Working on neuron_id={}, readout_key={}'.format(neuron_id, readout_key))
lin_key = (ModelGroup.LinearModel & (ModelGroup & (ModelGroup.CNNModel & key))).fetch1('KEY')
key_lin = dict(key, **lin_key)
mei = (MEI() & key_lin).fetch1('mei')
target_mean, target_contrast, force_stats = (ImageCo... | |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# graph_tool -- a general graph manipulation python module
#
# Copyright (C) 2006-2015 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Fou... | |
"""
Mimic Training of Mask R-CNN
Written by wozhouh
"""
import numpy as np
import os
import multiprocessing
# Import Deep learning framework
import tensorflow as tf
import keras
import keras.backend as K
import keras.engine as KE
import keras.layers as KL
import keras.models as KM
# Import Mask-RC... | |
"Copper Pink": 0x946877,
"Copper Pipe": 0xDA8F67,
"Copper Pot": 0x936647,
"Copper Pyrite Green": 0x3E4939,
"Copper Red": 0xCB6D51,
"Copper River": 0xF7A270,
"Copper Roof Green": 0x6F978E,
"Copper Rose": 0x996666,
"Copper Rust": 0x95524C,
"Copper Tan": 0xDE8E65,
"Copper Trail": 0xC18978,
"Copper Turquoise": 0... | |
<filename>uptrends/models/page_element.py
# coding: utf-8
"""
Uptrends API v4
This document describes Uptrends API version 4. This Swagger environment also lets you execute API methods directly. Please note that this is not a sandbox environment: these API methods operate directly on your actual Uptrends account. F... | |
'California'},
{'city': 'Oregon', 'state': 'Ohio'},
{'city': 'Oregon', 'state': 'Wisconsin'},
{'city': 'Oregon City', 'state': 'Oregon'},
{'city': 'Orem', 'state': 'Utah'},
{'city': 'Orinda', 'state': 'California'},
{'city': 'Orland', 'state': 'California'},
{'city': 'Orland Hills', 'state': 'Illinois'},
{'city... | |
<gh_stars>1-10
# ---------------------------------------------------------------
# Copyright (c) 2021, NVIDIA Corporation. All rights reserved.
#
# This work is licensed under the NVIDIA Source Code License
# ---------------------------------------------------------------
import torch
import torch.nn as nn
import torch... | |
bullets_list_b:
if lb_b.x == la_b.x and lb_b.y == la_b.y:
# Collision found against bullet in list b.
la_b.hp = la_b.hp - lb_b.damage
lb_b.hp = lb_b.hp - la_b.damage
if lb_b.hp > 0:
lb_b.damage = math.ceil(lb_b.hp * lb_b.damage_ratio)
bullets_list_b_remaining.append(lb_b)
if la_b.hp <= 0:
# Targetable list a... | |
= range(1, n - 1)
sources = [n - 1]
topology.graph['icr_candidates'] = set(routers)
for v in sources:
fnss.add_stack(topology, v, 'source')
for v in receivers:
fnss.add_stack(topology, v, 'receiver')
for v in routers:
fnss.add_stack(topology, v, 'router')
# set weights and delays on all links
fnss.set_weights... | |
0.5*m.b67*m.b156 + 0.5*m.b67*m.b157 + 0.5*m.b67*m.b159 + 0.5*m.b67*m.b160 + m.b67*m.b167 + 0.5*
m.b67*m.b168 + 0.5*m.b67*m.b170 + m.b67*m.b171 + 0.5*m.b67*m.b172 + 0.5*m.b67*m.b173 + 0.5*m.b67*
m.b175 + 0.5*m.b67*m.b176 + 0.5*m.b67*m.b177 + 0.5*m.b67*m.b178 + 0.5*m.b67*m.b179 + 0.5*m.b67*
m.b183 + 0.5*m.b67*m.b186 +... | |
# coding=utf-8
# Copyright 2020 The Google Research Team 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/licenses/LICENSE-2.0
#
# Unless required by applica... | |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft = python sts = 4 ts = 4 sw = 4 et:
"""AFNI utility interfaces
Examples
--------
See the docstrings of the individual classes for examples.
.. testsetup::
# Change directory to provide relative paths for doc... | |
# Standard library
from __future__ import division
import re
import os
from io import StringIO
from math import exp
from collections import namedtuple
import timeit
import json
import itertools
# Conda packages
import pandas
import scipy.spatial.distance
import numpy as np
import matplotlib.pyplot as plt
# From https... | |
<filename>csl/solver_base.py
# -*- coding: utf-8 -*-
"""Base constrained learning solver
Base primal-dual solver.
"""
import numpy as np
import torch
import matplotlib.pyplot as plot
import logging
class SolverSettings():
"""Primal-dual solver settings
Attributes
----------
settings : `dict`, optional
Dict... | |
<reponame>hannahjzhang/2048<filename>autograder.py
starter = __import__("starter_2048", fromlist=['x'])
utils = __import__("utils", fromlist=['x'])
import time
import os
def tests_2048():
print("Testing...");
msg = "\nWhich option would you like to test?\n";
msg += "0\t\tQuit\n";
msg += "1\t\tget_piece and place... | |
"""Functions used by least-squares algorithms."""
from math import copysign
import numpy as np
from numpy.linalg import norm
from scipy.linalg import cho_factor, cho_solve, LinAlgError
from scipy.sparse import issparse
from scipy.sparse.linalg import LinearOperator, aslinearoperator
EPS = np.finfo(float).eps
# Fu... | |
not CircularRegion:
return False
return (areEquivalent(other.center, self.center)
and areEquivalent(other.radius, self.radius))
def __repr__(self):
return f'CircularRegion({self.center}, {self.radius})'
class SectorRegion(Region):
def __init__(self, center, radius, heading, angle, resolution=24, name=None... | |
i in [0,2]:
TVL = []
for j in range(3): #size of Triangle
TVL.append(QVL[(i+j)%4])
area += abs(.5 * (( (TVL[1][0] - TVL[0][0]) * (TVL[2][1] - TVL[0][1]) ) - ( (TVL[2][0] - TVL[0][0]) * (TVL[1][1] - TVL[0][1]) )) )
return area
def scale(PVL, S):
for i, Point in enumerate(PVL): #len(PVL)
for j, Coord in enumerat... | |
<filename>tests/unit/lib/deploy/test_deployer.py
from logging import captureWarnings
from operator import inv
from typing import Container, Iterable, Union
import uuid
import time
import math
from datetime import datetime, timedelta, timezone
from unittest import TestCase
from unittest.mock import patch, MagicMock, ANY... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.