input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
= {'minx': xmin, 'miny': ymin, 'maxx':xmax, 'maxy':ymax}
wkt = template % r1
if srs_wkt is not None:srs=osr.SpatialReference(wkt=srs_wkt)
geom = ogr.CreateGeometryFromWkt(wkt,srs)
return geom
def ReprojectGeom(geom,src_srs,tgt_srs):
''' Reproject a geometry object.
@type geom: C{ogr.Geometry}
@param ... | |
# Copyright (C) 2013 <NAME>
# See Copyright Notice in rominfo.py
from rominfo import RomInfoParser
class GensisParser(RomInfoParser):
"""
Parse a Sega Gensis image. Valid extensions are smd, gen, 32x, md, bin, iso, mdx.
Sega Gensis header references and related source code:
* http://www.zophar.net/fileuploads/2/1... | |
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 534113920
"""
"""
random actions, total chaos
"""
board = gamma_new(8, 7, 5, 8)
assert board is not None
assert gamma... | |
1887], [988, 2454], [1284, 3347], [663, 1067],
[3001, 1365], [3816, 4281], [3723, 494], [2051, 4633], [4669, 433], [2682, 4881], [485, 3333], [3939, 812],
[3098, 768], [3690, 4387], [3078, 4292], [2538, 45], [1307, 275], [1983, 147], [4551, 4662], [4076, 4929],
[1095, 1584], [912, 3754], [3724, 517], [1067, 4934], [... | |
"Headlines_Cleanup",
"productType": None,
"deleteGrids": [
("Fcst", "Hazards", "SFC", "all", "all"),
],
},
### Null always distinct TK 4264
{
"name": "NullDistinct1",
"commentary": "Null Distinct from Non-Null",
"productType": "Phrase_Test_Local",
"createGrids": [
("Fcst", "Wind", "VECTOR", 0, 6, (2,"N"), ... | |
<filename>skdecide/builders/domain/dynamics.py
# Copyright (c) AIRBUS and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
import functools
from typing import Optional
from skdecide.core impo... | |
AVPNV_Grouped, 64),
526: ('MAC-Address-Mask-Pattern', AVPNV_OctetString, 64),
527: ('EUI64-Address', AVPNV_OctetString, 64),
528: ('EUI64-Address-Mask', AVPNV_Grouped, 64),
529: ('EUI64-Address-Mask-Pattern', AVPNV_OctetString, 64),
530: ('Port', AVPNV_Integer32, 64),
531: ('Port-Range', AVPNV_Grouped, 64),
532:... | |
parsable .uc file
so we explicitly check the exit status
"""
return exit_status == 0
def getHelp(self):
"""Method that points to documentation"""
help_str =\
"""
USEARCH is hosted at:
http://www.drive5.com/usearch/
The following papers should be cited if this resource is used:
Edgar,RC, Haas,BJ, Clemente... | |
# util/_py_collections.py
# Copyright (C) 2005-2022 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: https://www.opensource.org/licenses/mit-license.php
from __future__ import annotations
from itertools import filterfalse
from ... | |
import itertools
import logging
import json
import operator
import time
from collections import defaultdict
from typing import List, Tuple, Dict
from mip import Model, minimize, CONTINUOUS, xsum, OptimizationStatus
from rapidstream.BE.Utilities import isPairSLRCrossing
from rapidstream.BE.Device.U250 import idx_of_le... | |
and total acc time as functions of LCL cells and PM meshes for each
charge assignment order sequence.
Parameters
----------
data_df : pandas.DataFrame, Optional
Timing study data. If `None` it will look for previously saved data, otherwise it will run
:meth:`sarkas.processes.PreProcess.timing_study_calculation` ... | |
<gh_stars>0
from datetime import datetime
from sqlalchemy import and_
from flask import jsonify, request, make_response, Request
from flask_security import current_user
from src import api, CustomerResource, AdminResource, OpenResource, db
from .models import Product, Rating, Description, SpecificDetails, CustomerQues... | |
list of the bounds for the hyperparameters."""
return [
Integer(10, 500, name="n_estimators"),
Categorical(half_to_one_inc, name="max_samples"),
Categorical(half_to_one_inc, name="max_features"),
Categorical([True, False], name="bootstrap"),
Categorical([True, False], name="bootstrap_features"),
]
cl... | |
<filename>ecmwfapi/custom_http/custom_http.py
#
# (C) Copyright 2012-2013 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted... | |
<reponame>chuckie82/psgeom<filename>psgeom/camera.py<gh_stars>0
#!/usr/bin/env python
"""
Detector Geometries
===================
Briefly, geometries are organized heriarchically: there are `SensorElements`
that compose the leaves of a tree. These represent arbitrary objects that
actually measure e.g. photon intensit... | |
import psycopg2
import os
from faker import Faker
from random import randint
from dotenv import load_dotenv
load_dotenv()
DATABASE = os.getenv('DATABASE')
DATABASE_USERNAME = os.getenv('DATABASE_USERNAME')
DATABASE_PASSWORD = os.getenv('DATABASE_PASSWORD')
# DATABASE_URL = os.environ.get('DATABASE_URL')
con = psycopg... | |
' ' + row["idol"] + ' (CV.' + row["cv"] + ')')
name[langint] += '[' + lim + rarity_str[row["rarity"]] + ']' + row["name"] + ' ' + row["idol"] + ' (CV.' + row["cv"] + ')\n'
print('Actived ' + str(len(mlg_data[langint])) + ' cards.([FES]' + str(count[3]) + ', [SSR]' + str(count[2]) + ', [SR]' + str(count[1]) + ', [R]' ... | |
for source in self.__getattribute__(dtype).column_data:
# Each datatype might have multiple sources..
# .column_data is a dict in each datatypes DataFrameHandler object
df = self.__getattribute__(dtype).column_data[source]
if not all([item in df.columns for item in mandatory_keys]):
raise exceptions.MissingKeyInD... | |
Shuts down the server
:param server_id: Id of the server to be shut down
:type: ``str``
:param method: Method of shutting down "SOFTWARE" or "HARDWARE"
:return: Instance of class ``Node``
:rtype: :class: `Node`
"""
shutdown_body = {
'action': 'POWER_OFF',
'method': method
}
response = self.connection.req... | |
'request': {
'$ref': (_DESCRIPTOR_PATH_PREFIX +
'ApiConfigTestPutRequest')
}
},
'MyService.entries_roundtrip': {
'request': {
'$ref': (_DESCRIPTOR_PATH_PREFIX +
'ApiConfigTestAllFields')
},
'response': {
'$ref': (_DESCRIPTOR_PATH_PREFIX +
'ApiConfigTestAllFields')
}
},
'MyService.items_put': {
'request'... | |
# -o--
"""
MOSMusic.py (module)
Initial focus: Generate MIDI scale sequences.
PUBLIC ENUMS--
. Key
. MIDINote
. Direction
. ModeNames
PUBLIC DICTIONARIES--
. Modes
. ModesAdditional
. Ornaments
HELPER FUNCTIONS--
. subdivisionPerBeat()
. findScaleForMode()
GENERATOR FUNCTIONS--
. generateScaleSe... | |
<reponame>SuperMap/iClientPython
from unittest import TestCase, mock
from iclientpy.portal import Portal, MapShareSettingBuilder, DataShareSettingBuilder
from iclientpy.rest.api.model import GetMapsResult, ViewerMap, MethodResult, MyDatasMethodResult, DataItem, Status, \
DataItemType, MyDataUploadProcess, Layer, Ge... | |
10
IGMPv3.fixup(pkt,invalid_ttl = set_ttl)
else:
IGMPv3.fixup(pkt)
sendp(pkt, iface=iface)
if delay != 0:
time.sleep(delay)
def send_igmp_join_recvQuery(self, groups, rec_queryCount = None, src_list = ['1.2.3.4'], ip_pkt = None, iface = 'veth0', delay = 2):
self.onos_ssm_table_load(groups, src_list)
igmp = IG... | |
<gh_stars>1-10
SAMPLE_PROXY_LIST = [
{
'ip': '192.168.127.12',
'port': '53281',
'country_code': 'BR',
'country': 'Brazil',
'type': 'https'
}, {
'ip': '172.16.58.3',
'port': '8080',
'country_code': 'TH',
'country': 'Thailand',
'type': 'http'
}, {
'ip': '172.16.31.10',
'port': '8080',
'country_code': 'TH'... | |
<gh_stars>0
import cqc.pythonLib as cqc
from simulaqron.settings import simulaqron_settings
from simulaqron.network import Network as SimulaNetwork
from qunetsim.backends.rw_lock import RWLock
from qunetsim.backends.safe_dict import SafeDict
from qunetsim.objects.qubit import Qubit
class CQCBackend(object):
"""
Th... | |
coincides with the schedule the first
execution_date will be start_date, otherwise it will be start_date +
interval.
"""
dag = DAG(
dag_id='test_scheduler_auto_align_1',
start_date=timezone.datetime(2016, 1, 1, 10, 10, 0),
schedule_interval="4 5 * * *"
)
DummyOperator(
task_id='dummy',
dag=dag,
owner='airfl... | |
<reponame>adrn/astrobase
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''rfclass.py - <NAME> (<EMAIL>) - Dec 2017
License: MIT. See the LICENSE file for more details.
Does variable classification using random forests. Two types of classification
are supported:
- Variable classification using non-periodic features: ... | |
self.nodeInfo = nodeInfo
self.action = action
self.time_stamp = time_stamp
def read(self, iprot):
if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
fastbinary.decode_binary(self, ... | |
str
"""
return self._auth_realm
@auth_realm.setter
def auth_realm(self, auth_realm):
"""Sets the auth_realm of this CreateLdapServerXo.
The SASL realm to bind to. Required if authScheme is CRAM_MD5 or DIGEST_MD5 # noqa: E501
:param auth_realm: The auth_realm of this CreateLdapServerXo. # noqa: E501
:type: st... | |
<reponame>ChildMindInstitute/SM_EEG<filename>SM_openSMILE/openSMILE_preprocessing/noise_replacement/noise_replacement.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
noise_replacement.py
Script to replace silenced noises in data sound files.
Author:
– <NAME>, 2016–2017 (<EMAIL>)
© 2016–2017, Child Mind Instit... | |
#
# Copyright 2004,2005 <NAME> <<EMAIL>>
#
# This file forms part of Infotrope Polymer.
#
# Infotrope Polymer 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 Foundation; either version 2 of the License, or
# (at your opti... | |
compound dtype
# normally for cpd dtype, __resolve_dtype__ takes a list of DtypeSpec objects
cpd_type = [dict(name='cpd_float', dtype=np.dtype('float64')),
dict(name='cpd_int', dtype=np.dtype('int32'))]
kwargs['dtype'] = HDF5IO.__resolve_dtype__(cpd_type, my_list[0])
dset = self.file.create_dataset('dset%d' % self... | |
dict's keys
if not labels_set.issubset(set(labels_mapping)):
# because there's some label in labels
# that's not in labels_mapping
print('found labels in {} not in labels_mapping, '
'skipping file'.format(filename))
continue
print('making .spect file for {}'.format(filename))
if 'freq_cutoffs' in sp... | |
botApiResponse object as second member
"""
data = {
}
return self.response(self.sendRequest("logOut", data), bool)
def close(self, ):
"""Use this method to close the bot instance before moving it from one local server to another. You need to delete the webhook before calling this method to ensure that the bot is... | |
<reponame>QuentinAndre/pysprite<filename>pysprite/psprite.py
import numpy as np
import math
def deviation(data, u):
return (sum([(i - u) ** 2 for i in data]) / (len(data) - 1)) ** .5
def deviation_dict(data, u):
return (sum([((i - u) ** 2) * data[i] for i in data]) / (sum(data.values()) - 1)) ** .5
def SPRITE(u... | |
<reponame>arthur-hav/QtB3Poker<filename>server/server.py<gh_stars>1-10
#!/usr/bin/env python3
import json
import time
import itertools
from deuces import Card, evaluator
import os
from math import floor
import struct
import queue
from pymongo import MongoClient
import datetime
import requests
import threading
from cry... | |
Constraint(expr= m.b227 - m.b233 + m.b278 <= 1)
m.c2059 = Constraint(expr= m.b227 - m.b234 + m.b279 <= 1)
m.c2060 = Constraint(expr= m.b228 - m.b229 + m.b280 <= 1)
m.c2061 = Constraint(expr= m.b228 - m.b230 + m.b281 <= 1)
m.c2062 = Constraint(expr= m.b228 - m.b231 + m.b282 <= 1)
m.c2063 = Constraint(expr= m.b228 -... | |
# Command line script for checking agreement in the Icelandic pronunciation dictionary, which is in a tab-seperated .csv format
# Errors, discrepancies and suspicious-looking entries printed to a text file.
# The two arguments are by default 'ice_pron_dict_complete_2106.csv' and 'check_agreement_output.txt' (overwritte... | |
"""
ClassExpression :=
Class |
ObjectIntersectionOf | ObjectUnionOf | ObjectComplementOf | ObjectOneOf |
ObjectSomeValuesFrom | ObjectAllValuesFrom | ObjectHasValue | ObjectHasSelf |
ObjectMinCardinality | ObjectMaxCardinality | ObjectExactCardinality |
DataSomeValuesFrom | DataAllValuesFrom | DataHasValue |
Data... | |
<filename>tests/metadata/test_ddl.py
#!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | |
11:00",
"2009/9/26 12:00",
"2009/9/26 13:00",
"2009/9/26 14:00",
"2009/9/26 15:00",
"2009/9/26 16:00",
"2009/9/26 17:00",
"2009/9/26 18:00",
"2009/9/26 19:00",
"2009/9/26 20:00",
"2009/9/26 21:00",
"2009/9/26 22:00",
"2009/9/26 23:00",
"2009/9/27 0:00",
"2009/9/27 1:00",
"2009/9/27 2:00",
"2009/9/27 3:0... | |
<gh_stars>1-10
from __future__ import print_function, division, absolute_import, unicode_literals
from builtins import bytes, dict, object, range, map, input#, str
from future.utils import itervalues, viewitems, iteritems, listvalues, listitems
from io import open
import numpy as np
import math
import random
from time... | |
LAING DIGIT ONE': 43505,
'MYANMAR TAI LAING DIGIT SEVEN': 43511,
'MYANMAR TAI LAING DIGIT SIX': 43510,
'MYANMAR TAI LAING DIGIT THREE': 43507,
'MYANMAR TAI LAING DIGIT TWO': 43506,
'MYANMAR TAI LAING DIGIT ZERO': 43504,
'NABATAEAN CRUCIFORM NUMBER FOUR': 67755,
'NABATAEAN LETTER ALEPH': 67713,
'NABATAEAN LETTER AYIN': ... | |
Diabetology">Cardiovascular Diabetology</a></i></td>
<td>Cardiology</td>
<td><a href="/wiki/BioMed_Central" title="BioMed Central">BioMed Central</a></td>
<td>English</td>
<td>2002-present
</td></tr>
<tr>
<td><i><a href="/wiki/Cephalalgia_(journal)" title="Cephalalgia (journal)">Cephalalgia</a></i></td>
<td>Headache</t... | |
in keys])
# make weights if None
if wgts is None:
wgts = odict()
for i, k in enumerate(keys):
wgts[k] = np.ones_like(ydata[k], dtype=np.float)
# fill nans and infs
fill_dict_nans(ydata, wgts=wgts, nan_fill=0.0, inf_fill=0.0)
# setup linsolve equations
eqns = odict([(k, "phi_{}_{} - phi_{}_{}".format(k[0], s... | |
= DataFrame(data, index=dr, columns=list("A"))
df_rev = DataFrame(data, index=dr[[3, 4, 5] + [0, 1, 2]], columns=list("A"))
# index is not monotonic increasing or decreasing
msg = "index must be monotonic increasing or decreasing"
with pytest.raises(ValueError, match=msg):
df_rev.reindex(df.index, method="pad")
w... | |
new_vm._push(115792089237316195423570985008687907853269984665640564039457584007913129639935)
last_exception, last_returned = self._execute(new_vm)
self.assertEqual(last_exception, 'OOG')
def test_SHA3_20(self):
#Make the constraint store
constraints = ConstraintSet()
#make the ethereum world state
world = evm.E... | |
<reponame>carderne/descarteslabs-python<gh_stars>0
import pytest
import unittest
import textwrap
from copy import deepcopy
from datetime import datetime
from enum import Enum
from ..catalog_base import CatalogObject
from ..attributes import (
Attribute,
Timestamp,
EnumAttribute,
utc,
MappingAttribute,
ListAttrib... | |
ID of the compute node.
:param str node_state: State of the compute node. Values are idle, running, preparing, unusable, leaving and preempted.
:param float port: SSH port number of the node.
:param str private_ip_address: Private IP address of the compute node.
:param str public_ip_address: Public IP address of th... | |
<gh_stars>10-100
import json
import os
import ui
import requests
import xml.etree.cElementTree
import threading
import ui
import time
import math
import tarfile
import plistlib
import console
import sqlite3
import shutil
import copy
from urllib.parse import urlparse
from os.path import splitext, basename
from objc_ut... | |
steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["backgroundcolor"]
@backgroundcolor.setter
def backgroundcolor(self, val):
self["backgroundcolor"] = val
# calendar
# --------
@property
def calendar(self):
"""
... | |
lbl='제도 용지'),
2600: SParentCategory(d=array([227]), lbl='프랑스'),
2601: SParentCategory(d=array([], dtype=int32), lbl='후미등'),
2602: SParentCategory(d=array([], dtype=int32), lbl='쿨스카프'),
2603: SParentCategory(d=array([], dtype=int32), lbl='워터파크'),
2604: SParentCategory(d=array([], dtype=int32), lbl='기타 홍삼/인삼가공'),
2... | |
"""
Copyright (C) 2011 <NAME>
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy ... | |
d_source + d_target - d_source_target
# if at least 2 interactions
# or previous point is a diffraction
if (len(tahe)<2) or (len(visited[-2])==1) or (len(visited[-1])==1):
ratio = 1.0
ratio2 = 1.0
else:
# Determine the origin of the cone
# either the transmitter (ilast =0)
# or the last diffraction point (il... | |
"""Points-to / dataflow / cfg graph engine.
It can be used to run reaching-definition queries on a nested CFG graph
and to model path-specific visibility of nested data structures.
"""
import collections
import logging
from pytype import metrics
import pytype.utils
log = logging.getLogger(__name__)
_variable_s... | |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 17 14:15:59 2020
Modified a lot between April 2020 and July 2021
@author: <NAME>
email: <EMAIL>
This code generates a single fluorescence peak for a given atomic species,
oven geometry, and oven temperature. The default atomic angular distribution
is the molecul... | |
(logging.level): Default setting is logging.INFO
Raises:
GPUdbException: If the value passed is not one of logging.INFO
or logging.DEBUG etc.
"""
try:
self._logger.setLevel(value)
except (ValueError, TypeError, Exception) as ex:
raise GPUdbException("Invalid log level: '{}'".format(str(ex)))
class _TableEven... | |
1))
Turbine.servcall(self, dae)
def init1(self, dae):
self.servcall(dae)
mva = self.system.mva
self.p0 = mul(self.p0, 1)
self.v120 = self.v12
self.toMb = div(mva, self.Sn) # to machine base
self.toSb = self.Sn / mva # to system base
rs = matrix(self.rs)
xd = matrix(self.xd)
xq = matrix(self.xq)
psip = mat... | |
<reponame>lygztq/gomoku
# coding=utf-8
from __future__ import print_function
import numpy as np
class Board(object):
"""Board class for training.
Attributes:
width: The width of board.
height: The height of board.
numberToWin: How many stones need on a line to win
"""
kPlayerWhite = 0
kPlayerBlack = 1
kEmp... | |
code += \
"\tsw $a0 0($sp)\n" + \
"\taddiu $sp $sp -4\n"
code += ctx.getChild(2).accept(self)
code += \
"\tmove $t2 $a0\n" \
"\tlw $t1 4($sp)\n" \
"\taddiu $sp $sp 4\n"\
"\tla $a0 bool_const1\n" \
"\tla $a1 bool_const0\n"
if self.CurrentType == "String" or self.CurrentType == "Int" or self.CurrentType == "Boo... | |
<reponame>gist-ailab/bop_toolkit<gh_stars>100-1000
# Author: <NAME> (<EMAIL>)
# Tsinghua University
# Adapted based on the glumpy version: "./renderer_py.py"
"""A Python Vispy based renderer."""
import os
os.environ["PYOPENGL_PLATFORM"] = "egl"
import numpy as np
import vispy
from vispy import app, gloo
import OpenGL... | |
and isHalted not found in library. Not supported.\n')
MSP430_Error_Number = MSP430mspgcc.MSP430_Error_Number
MSP430_Error_Number.argtypes = []
MSP430_Error_Number.restype = ctypes.c_long
MSP430_Error_String = MSP430mspgcc.MSP430_Error_String
MSP430_Error_String.argtypes = [ctypes.c_long]
MSP430_Error_String.resty... | |
('do not identified phase')
#TODO: change if cable type has 0 R1
if lineund.LineCableID in ['CableWith0R1','Cable2With0R1']:
Line = Line + ' R1=1.00E-07 R0=0 X1=0 X0=0 B1=0 B0=0 length=1'
else:
Line = Line + ' geometry='+ lineund.DeviceNumber
Line = Line + ' length='+ lineund.Length
Line = L... | |
# Copyright 2021 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/LICENSE-2.0
#
# Unless required by applicable law or ag... | |
2, 2, 2), 348),
Sample(False, (3, 2, 1, 2, 3, 1), 349),
Sample(False, (3, 2, 1, 2, 3, 2), 350),
Sample(False, (3, 2, 1, 2, 4, 1), 351),
Sample(False, (3, 2, 1, 2, 4, 2), 352),
Sample(True, (3, 2, 1, 3, 1, 1), 353),
Sample(True, (3, 2, 1, 3, 1, 2), 354),
Sample(False, (3, 2, 1, 3, 2, 1), 355),
Sample(False, (3, ... | |
<reponame>jlovering/ChallengerParser<gh_stars>0
import unittest
import logging
import sys
import re
import testCaseSoT
import ChallengerParser as parser
import ChallengerGrammar
import tatsu
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
class DayTest():
def deepCompare(self, struct1, struct2):
truthy... | |
# Copyright 2018 Xanadu Quantum Technologies 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 t... | |
# Copyright © 2019 Province of British Columbia
#
# 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 ... | |
0x10ff12.
Call to 0x10ff12 returns 'OK' as the result of timeout change.
:param timeout: power timeout in range (0x0001, 0xfff0)
:type timeout: int
:param wait: wait for response
:type wait: bool
"""
timeout = max(min(0xfff0, timeout), 0x0001)
strtimeout = '{0:0{1}X}'.format(timeout, 4)
if wait:
return se... | |
<gh_stars>10-100
"""Planar segway example."""
from matplotlib.pyplot import figure, grid, legend, plot, show, subplot, suptitle, title
from numpy import arange, array, concatenate, cos, identity, linspace, ones, sin, tanh, tile, zeros
from numpy.random import uniform
from scipy.io import loadmat, savemat
from sys impo... | |
<reponame>secuof/binaryanalysis
#!/usr/bin/python
## Binary Analysis Tool
## Copyright 2011-2016 <NAME> for Tjaldur Software Governance Solutions
## Licensed under Apache 2.0, see LICENSE file for details
'''
This module contains methods that should be run before any of the other
scans.
Most of these methods are to ... | |
<reponame>derNarr/synchronicity
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import division
import math
import random
from psychopy import visual, core
from helper import create_run_trial, create_show_text
class BaseStim(object):
"""
Base stimulus for moving dots.
This class encapsulates t... | |
# coding=utf-8
from __future__ import division
from search_module.python_from_feng.se.config import root
import pickle
import time
import jieba, math
import jieba.posseg as pseg
class Subject:
#subs = [{"code": '0828', "k": 36}, {"code": '0829', "k": 14}]
#self.subs = subs
#self.Subject_for_teacher = {sub['code']: ... | |
Size:').grid(row=5, column=0)
d_length_drop = tk.OptionMenu(right_frame, d_length_select, *d_length_list, command=update_deriv)
d_length_drop.grid(row=5, column=1)
# Autoscale Toggle
ascale_label = tk.Label(right_frame, text='Autoscale arrows:')
ascale_label.grid(row=7, column=0)
ascale_toggle = tk.Button(right_frame,... | |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from collections import OrderedDict
from webkitpy.common.host_mock import MockHost
from webkitpy.common.system.filesystem_mock import MockFi... | |
from pyapprox.models.wrappers import ActiveSetVariableModel
from pyapprox.cvar_regression import smooth_max_function_first_derivative,\
smooth_max_function_second_derivative
import numpy as np
from scipy.optimize import minimize, Bounds
from functools import partial
from scipy.stats import gaussian_kde as KDE
from pya... | |
178, 364, 881, 102, 889, 873, 976,
191, 973, 742, 680, 718, 585, 924, 638, 936,
62, 644],
[565, 513, 575, 193, 561, 750, 953, 226, 691,
562, 655, 294, 877, 651, 343, 328, 599, 277,
883, 447],
[224, 782, 630, 902, 677, 276, 35, 489, 941,
122, 950, 593, 808, 738, 901, 228, 621, 730,
567, 484],
[252, 491, 679, 88... | |
<filename>sandbox/grist/test_engine.py
import difflib
import functools
import json
import unittest
from collections import namedtuple
from pprint import pprint
import six
import actions
import column
import engine
import logger
import useractions
import testutil
import objtypes
log = logger.Logger(__name__, logger.D... | |
try:
import numpy as np
import networkx as nx
from hmm_profile import reader
from hmm_profile.models import HMM
import time
except ImportError:
print('[Error] Seems you do not have the required python packages. Please check it.')
# python modules
from math import log
from typing import List, Dict, Tuple, Any
fro... | |
20 to the y axis
# adding the text on the given location
hlp.AddText("Efficiency O(nlogn):", (520, 200))
# adding the text on the given location
hlp.AddText(str(efficiency), (540, 230), hlp.white)
# updates the screen every turn
pygame.display.flip()
# will not run more than 30 frames per second
clock.tick(30)
... | |
'return_failure_list': [ return_failure_list, 'return-failure-list', [ bool, 'None' ], False ],
'query': [ query, 'query', [ SnapmirrorInfo, 'None' ], False ],
}, {
'num-succeeded': [ int, False ],
'num-failed': [ int, False ],
'success-list': [ SnapmirrorBreakIterInfo, True ],
'failure-list': [ SnapmirrorBreakIt... | |
of expected '{}'".format(tok, etok))
def _raise_exception(self, msg):
""" Raise a Parsing exception
Args:
msg: Exception message
"""
raise FznParserException(self.tokenizer.build_error_string(msg))
class FznParser(object):
""" Reader of FZN file format """
__slots__ = ('model', # Read model
'compiled', # ... | |
IIi11IIiIii1 = float((float(speed) - float(iII11I1Ii1))) * float((float(o0o0oOo0oO) / float(oOo0OoOOo0)))
elif speed <= 20:
I1iIII1 = 29
iIii = 58
oOo0OoOOo0 = 10
iII11I1Ii1 = 10
o0o0oOo0oO = (iIii - I1iIII1)
IIi11IIiIii1 = I1iIII1 + float((float(speed) - float(iII11I1Ii1))) * float(
(float(o0o0oOo0oO) / float(... | |
0.5
print ("final max_scores = ", max_scores)
if (max_scores == 0.0).any():
print ("WARNING, removing 0.0 max_scores!")
max_score_min = (max_scores[max_scores > 0.0]).min()
# TODO:Find reasonable way to fix this, is this causing the distorted reconstructions???
max_scores += max_score_min * 0.001
# max_scores ... | |
<gh_stars>1-10
import torch
import numpy as np
import math
def radectolm(ra,dec,ra0,dec0):
# return source direction cosines [l,m,n] obtained for a source at spherical
# coordinates (ra,dec) with respect to phase center (ra0,dec0).
if dec0<0.0 and dec>=0.0:
dec0=dec0+2.0*math.pi
l=math.sin(ra-ra0)*math.cos(dec)
... | |
<reponame>macrocosme/frbpoppy<gh_stars>10-100
"""Class to generate a cosmic population of FRBs."""
import numpy as np
from frbpoppy.misc import pprint
from frbpoppy.number_density import NumberDensity
from frbpoppy.population import Population
import frbpoppy.direction_dists as did
import frbpoppy.dm_dists as dmd
impo... | |
Bond(None, None, order=order1)
bond2 = Bond(None, None, order=order2)
if order1 == order2:
self.assertTrue(bond1.isSpecificCaseOf(bond2))
else:
self.assertFalse(bond1.isSpecificCaseOf(bond2))
def testCopy(self):
"""
Test the Bond.copy() method.
"""
bond = self.bond.copy()
self.assertEqual(self.bond.order, ... | |
<reponame>mrsempress/mmdetection<filename>mmdet/models/anchor_heads/ctx_head.py
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from mmdet.core import multi_apply, multiclass_nms
from mmdet.core.bbox import bbox_overlaps
from mmdet.core.utils.common impo... | |
A dictionary with lists of functions that should be called after
#: each request. The key of the dictionary is the name of the module
#: this function is active for, `None` for all requests. This can for
#: example be used to open database connections or getting hold of the
#: currently logged in user. To register ... | |
import pytest
import datetime
import shutil
import os
from textwrap import dedent
from os.path import join
from ...api import Gradebook, MissingEntry
from .. import run_nbgrader
from .base import BaseTestApp
class TestNbGraderDb(BaseTestApp):
def test_help(self):
"""Does the help display without error?"""
run_n... | |
region index
found_lines = sorted(temp_fl, key=itemgetter(3)) # used to be 2, 3 works better
if len(found_lines) == 0:
print "No lines with label '%s' found in current regions" % tiedz_lbl
return
#######################################################
# extract data and plot it
if not saveFi... | |
= simu.result[i].reshape(-1)
datai *= soft_iron_param
result = cs.solve_1mag(
datai.reshape(-1), pSensori.reshape(-1), param)
param = result.copy()
results += {'X0': param[4], 'Y0': param[5], 'Z0': param[6]}
return results.cal_loss()
def compare_hardiron(self, loop):
results = []
pool = Pool()
for i in rang... | |
construct the instance.
"""
cls.to_runner_api_parameter = (
lambda self, unused_context: (urn, None, self._get_component_coders()))
# pylint: disable=unused-variable
@Coder.register_urn(urn, None)
def from_runner_api_parameter(unused_payload, components, unused_context):
if components:
return cls(*components)
... | |
= v['prefactor']*np.exp(v['m']*np.square(np.cos(np.radians(x-v['x_center'])))) + v['baseline']
return m
def func2minimize(params, x, data):
v = params.valuesdict()
m = model(v, x)
return m - data
params = lmfit.Parameters()
params.add('prefactor', value=np.max(line.y)*0.1, min=0)
params.add('x_center', ... | |
# This file is part of beets.
# Copyright 2015, <NAME>
#
# 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
# without limitation the rights to use, copy, modify, m... | |
,
("240910", "<NAME>", "RN", ) ,
("240920", "PASSAGEM", "RN", ) ,
("240930", "PATU", "RN", ) ,
("240933", "<NAME>", "RN", ) ,
("240940", "<NAME>", "RN", ) ,
("240950", "<NAME>", "RN", ) ,
("240960", "<NAME>", "RN", ) ,
("240970", "<NAME>", "RN", ) ,
("240980", "<NAME>", "RN", ) ,
("240990", "PENDÊNCIAS", "RN"... | |
# Apache License Version 2.0
# Copyright 2022 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | |
k in range(0,instancesPopulation):
for l in IDList:
if train_dataset.Patient[k] == l:
instanceToTransfer_Index = train_dataset.index[k]
instanceToTrasferList_index = instanceToTrasferList_index + [instanceToTransfer_Index]
train_dataset_instancesToTransfer = train_dataset.take(instanceToTrasferList_index)
... | |
import copy
import itertools
import logging
import sys
from collections import namedtuple
from .task import NeedInputsException
from .task import NEED_INPUTS, OPEN_STATUS_LIST, BAD_QA_STATUS,\
JOB_PENDING, REPROC, RERUN, FAILED_NEEDS_REPROC, NEEDS_QA
from . import XnatUtils
from . import utilities
LOGGER = logging.... | |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.