input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
'duk_bi_thread_constructor',
'callable': True,
'constructable': True,
'values': [],
'functions': [
# 'yield' is a reserved word but does not prevent its use as a property name
{ 'name': 'yield', 'native': 'duk_bi_thread_yield', 'length': 2 },
{ 'name': 'resume', 'native': 'duk_bi_thread_resume', 'lengt... | |
#!/usr/bin/env python
#____________________________________________________________
#
#
# A very simple way to make plots with ROOT via an XML file
#
# <NAME>
# <EMAIL>
#
# Fermilab, 2010
#
#____________________________________________________________
"""
plotBeamSpotDB
A very simple script to plot the beam spot da... | |
<reponame>Zac-hills/d3m-primitives
import os
import copy
import typing
import sys
import logging
import numpy as np
import pandas as pd
from Simon import Simon
from Simon.penny.guesser import guess
from d3m.primitive_interfaces.unsupervised_learning import (
UnsupervisedLearnerPrimitiveBase,
)
from d3m.primitive_inte... | |
<gh_stars>0
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""Tasks for RL."""
import abc
import copy
import itertools
import random
import numpy as np
from six.moves import xrange
from common import bf # brain coder
from common import reward as r # brai... | |
# encoding: UTF-8
'''
本文件中实现了CTA策略引擎,针对CTA类型的策略,抽象简化了部分底层接口的功能。
关于平今和平昨规则:
1. 普通的平仓OFFSET_CLOSET等于平昨OFFSET_CLOSEYESTERDAY
2. 只有上期所的品种需要考虑平今和平昨的区别
3. 当上期所的期货有今仓时,调用Sell和Cover会使用OFFSET_CLOSETODAY,否则
会使用OFFSET_CLOSE
4. 以上设计意味着如果Sell和Cover的数量超过今日持仓量时,会导致出错(即用户
希望通过一个指令同时平今和平昨)
5. 采用以上设计的原因是考虑到vn.trader的用户主要是对TB、MC和金字塔类... | |
# -*- coding: utf-8 -*-
import unittest
import pytest
from skosprovider.skos import (
Label,
Note,
Source,
ConceptScheme,
Concept,
Collection,
label,
find_best_label_for_type,
filter_labels_by_language,
dict_to_label,
dict_to_note,
dict_to_source
)
class LabelTest(unittest.TestCase):
def setUp(self):
... | |
<gh_stars>1-10
cis_1_2_4 = [(
'CIS 1.2.4',
{
"set": {
"--kubelet-https": "false",
},
},
'/etc/kubernetes/manifests/kube-apiserver.yaml',
'failed'
),
(
'CIS 1.2.4',
{
"set": {
"--kubelet-https": "true",
},
},
'/etc/kubernetes/manifests/kube-apiserver.yaml',
'passed'
),
(
'CIS 1.2.4',
{
"unset": [
"--... | |
= traj_node._children[name]
hdf5_group = getattr(hdf5_group, name)
# Store final group and recursively everything below it
if current_depth <= max_depth:
self._tree_store_nodes_dfs(traj_node, leaf_name, store_data=store_data,
with_links=with_links, recursive=recursive,
max_depth=max_depth, current_depth=current... | |
#set up glyph for visualizing point cloud
sphereSource = vtk.vtkSphereSource()
sphereSource.SetRadius(self.sampleSizeScaleFactor/300)
glyph = vtk.vtkGlyph3D()
glyph.SetSourceConnection(sphereSource.GetOutputPort())
glyph.SetInputData(polydata)
glyph.ScalingOff()
glyph.Update()
#display
modelNode=slicer.mrmlSc... | |
for bld.program for simpler target configuration.
The linker script is added as env input/output dependency for the
target.
Based on the target name all related targets are created:
- binary: <target>.<format>
- linker information: <target>.<format>.xml
- map information: <target>.<format>.map
"""
if "target"... | |
"""
This module implements an inversion of control framework. It allows
dependencies among functions and classes to be declared with decorators and the
resulting dependency graphs to be executed.
A decorator used to declare dependencies is called a :class:`ComponentType`, a
decorated function or class is called a comp... | |
logic for rendering objects with the console protocol.
You are unlikely to need to use it directly, unless you are extending the library.
Args:
renderable (RenderableType): An object supporting the console protocol, or
an object that may be converted to a string.
options (ConsoleOptions, optional): An options obj... | |
<gh_stars>0
"""
Create a CrowdFlower job to collect relevance judments for domain, query pairs.
This script will read a file of domain, query pairs from the command-line, and collect results from
Cetera for each pair. You may optionally specify different experimental groups (eg. baseline
vs. experiment1) via the `-g` ... | |
tip
if root_block.header.total_difficulty <= self.root_tip.total_difficulty:
check(
self.__is_same_root_chain(
self.root_tip,
self.db.get_root_block_header_by_hash(
self.header_tip.hash_prev_root_block
),
)
)
return False
# Switch to the root block with higher total diff
self.root_tip = root_block.header
... | |
required
def test_create_tempo_go_gps_device_with_vehicle_status(self):
self.minimum_valid_data["vehicle_status"] = "unloaded"
self.client.credentials(HTTP_AUTHORIZATION=self.token)
response = self.client.post(self.create_url, self.minimum_valid_data, format='json')
self.assertEqual(response.status_code, status.HT... | |
import math
import time
import numpy as np
import multiprocessing as mp
from typing import List, Callable
from flare.kernels.utils import from_mask_to_args, from_grad_to_mask
_global_training_data = {}
_global_training_labels = {}
def queue_wrapper(result_queue, wid,
func, args):
"""
wrapper function for multipro... | |
<reponame>scivision/isrutils<gh_stars>1-10
#!/usr/bin/env python
from configparser import ConfigParser
from pathlib import Path
import logging
from sys import stderr
from time import time
import h5py
from datetime import datetime
import numpy as np
from numpy.ma import masked_invalid
import xarray
from matplotlib.pyplo... | |
and body.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
Returns:
str
Response Object
"""
self.apply_kwargs_defaults(kwargs=kwargs, return_http_data_only=True, async_req=False)
kwargs['payload'] = \
payload
return self.post_headline_v1_h... | |
"""Copyright (c) 2021 <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, merge, publish, distribute, sublicen... | |
<reponame>CHCMATT/Code
import re
import time
import traceback
import threading
import socket
import asyncore
import asynchat
import os
from util import output, database
from util.tools import convertmask
from util.web import uncharset, shorten
from core import triggers
from core.dispatch import dispatch
cwd = os.getc... | |
function
def rk4(x0, y0, f):
ds = 0.01 #min(1./NGX, 1./NGY, 0.01)
stotal = 0
xi = x0
yi = y0
xb, yb = blank_pos(xi, yi)
xf_traj = []
yf_traj = []
while check(xi, yi):
# Time step. First save the point.
xf_traj.append(xi)
yf_traj.append(yi)
# Next, advance one using RK4
try:
k1x, k1y = f(xi, yi)
k2x, k2y... | |
<reponame>oleksandr-pavlyk/cpython
import binascii
import functools
import hmac
import hashlib
import unittest
import unittest.mock
import warnings
from test.support import hashlib_helper, check_disallow_instantiation
from _operator import _compare_digest as operator_compare_digest
try:
import _hashlib as _hashopen... | |
+ 12*m.b69 + 12*m.b70 - m.x176 - m.x181 - m.x182 + m.x386 + m.x391 + m.x392 <= 12)
m.c4306 = Constraint(expr= 12*m.b66 + 12*m.b69 + 12*m.b70 - m.x178 - m.x181 - m.x182 + m.x388 + m.x391 + m.x392 <= 12)
m.c4307 = Constraint(expr= 12*m.b72 + 12*m.b75 - m.x184 - m.x187 + m.x282 + m.x285 + m.x380 + m.x383 <= 12)
m.c4308... | |
<reponame>preranaandure/wildlifecompliance<gh_stars>1-10
import abc
import ast
import logging
import datetime
from datetime import date, timedelta
from concurrency.exceptions import RecordModifiedError
from django.core.exceptions import ValidationError, FieldError
from django.db import transaction
from django.db.uti... | |
#!/usr/bin/env python
# Copyright (c) 2002-2009 ActiveState Software Inc.
# License: MIT (see LICENSE.txt for license details)
# Author: <NAME>
"""An improvement on Python's standard cmd.py module.
As with cmd.py, this module provides "a simple framework for writing
line-oriented command intepreters." This module pro... | |
self.abort("Failed to build the required target(s)")
if self.exception is not None:
return self.exception
for action in self.new_persistent_actions:
for name, partial_up_to_date in action.required.items():
full_up_to_date = Invocation.up_to_date.get(name)
if full_up_to_date is None:
partial_up_to_date.mtime_ns... | |
import contextvars
import functools
import platform
import sys
import threading
import time
import types
import warnings
import weakref
from contextlib import contextmanager, ExitStack
from math import inf
from textwrap import dedent
import gc
import attr
import outcome
import sniffio
import pytest
from .tutil import... | |
<gh_stars>0
import copy
import logging
import re
import typing
from contextlib import suppress
from inspect import getdoc, iscoroutinefunction
import discord
from discord.ext import commands
from . import context, error, http, model
from .utils import manage_commands
from .utils.manage_components import get_component... | |
<reponame>hitfee01/3DDeepBoxRetina2D
# from https://github.com/amdegroot/ssd.pytorch
import torch
from torchvision import transforms
import cv2
import numpy as np
import types
from numpy import random
from Archs_2D.BBox import BBoxes
def intersect(box_a, box_b):
max_xy = np.minimum(box_a[:, 2:], box_b[2:])
min_xy... | |
<gh_stars>100-1000
# Copyright 2019 Xiaomi, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | |
"""
mcpython - a minecraft clone written in python licenced under the MIT-licence
(https://github.com/mcpython4-coding/core)
Contributors: uuk, xkcdjerry (inactive)
Based on the game of fogleman (https://github.com/fogleman/Minecraft), licenced under the MIT-licence
Original game "minecraft" by Mojang Studios (www.m... | |
"""
The :mod:`scikitplot.metrics` module includes plots for machine learning
evaluation metrics e.g. confusion matrix, silhouette scores, etc.
"""
from __future__ import absolute_import, division, print_function, \
unicode_literals
import itertools
import matplotlib.pyplot as plt
import numpy as np
from sklearn.me... | |
= instance
# if we do have the key only set it if source is not None
elif source is not None:
self.sources[key] = source
self.instances[key] = instance
# if setting in cached settings add
if key in SETTINGS_CACHE_KEYS:
SETTINGS_CACHE[key] = copy.deepcopy(value)
# then do the normal dictionary setting
super(Par... | |
PhoneA.
Swap active call on PhoneA.
Merge calls to conference on PhoneA.
Hangup on PhoneC, check call continues between AB.
Hangup on PhoneB, check A ends.
"""
ads = self.android_devices
tasks = [(phone_setup_iwlan,
(self.log, ads[0], False, WFC_MODE_WIFI_ONLY,
self.wifi_network_ssid, self.wifi_network_pass)... | |
u'man bouncing ball medium skin tone': u'\U000026f9\U0001f3fd\U0000200d\U00002642\U0000fe0f',
u'man bouncing ball mediumdark skin tone': u'\U000026f9\U0001f3fe\U0000200d\U00002642\U0000fe0f',
u'man bouncing ball dark skin tone': u'\U000026f9\U0001f3ff\U0000200d\U00002642\U0000fe0f',
u'woman bouncing ball': u'\U00002... | |
resonance['FSMothersNumbers'])
# Choose the offshellness
special_mass = (1.0 + options['offshellness'])*mass
# Discard impossible kinematics
if special_mass<final_state_energy:
raise InvalidCmd('The offshellness specified (%s) is such'\
%options['offshellness']+' that the resulting kinematic is '+\
'imposs... | |
Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of... | |
"""
This class controls the textbox GUI for any shop state.
A Gui object is created and updated by the shop state.
"""
import pygame as pg
from harren.data import setup, observer
from harren.data.components import textbox
from harren.data import constants as c
from harren.py_compat import pickle
class Gui(object):
"... | |
SolveMethod.NUMPY_SOLVE,
_delete_truss_after: bool = False, _override_res: Optional[tuple[dict]] = None):
self.truss = truss
self.sig_figs = sig_figs
warnings.filterwarnings('ignore')
if _override_res is None:
self.results = truss.calculate(solution_method=solution_method)
self.tensions, self.reactions, self.... | |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_impor... | |
from collections import namedtuple, OrderedDict
from deepnp.functions import *
import deepnp.initializers as init
class RNNCell:
def __init__(self, batch_size, input_dim, hidden_dim, Wx=None, Wh=None, bias=None):
N, D, H = batch_size, input_dim, hidden_dim
Wx = init.normal(D, H) if Wx is None else Wx
Wh = init.n... | |
= thread.get()
:param async_req bool
:param str id: (required)
:param str id2: id
:param str image: image
:param str user: user
:return: ScreeningMode
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'id2', 'image', 'user'] # noqa: E501
all_params.append('omit')
... | |
import discord
from discord.ext import commands
from math import ceil
import random
class RpsButtons(discord.ui.View):
"""
Contains the RPS Game Buttons.
"""
def __init__(self, author, member):
super().__init__(timeout=60)
self.author = author
self.member = member
self.authorchoice = None
self.memberchoice ... | |
import csv
import psycopg2
import psycopg2.extras
import sys
import pprint
from datetime import date
import holidays
import traceback
REPORTED_DATETIME_INDEX = 0
CITY_INDEX = 1
STATE_INDEX = 2
SHAPE_INDEX = 3
DURATION_INDEX = 4
SUMMARY_INDEX = 5
POSTED_DATE_INDEX = 6
CONNECTION_STRING = "host='localhost' dbname='postg... | |
"""
============
Polarization
============
Provides functions for:
- Creating initial belief configurations for various scenarios.
- Creating influence graphs for various scenarios.
- The Esteban-Ray polarization measure.
- Discretizing a belief state into a distribution.
- Updating the belief state of an agent, see t... | |
seqfeature_dbxref
# table as seqfeature_id, dbxref_id, and rank tuples
self._load_seqfeature_dbxref(qualifiers[qualifier_key],
seqfeature_id)
def _load_seqfeature_dbxref(self, dbxrefs, seqfeature_id):
"""Add database crossreferences of a SeqFeature to the database (PRIVATE).
o dbxrefs List, dbxref data from th... | |
x in range(13): #If they are supposed to give Item, write text
ROM.write(Item1text[x])
Pointer+=1
if GiveJet == y:
for x in range(13):
ROM.write(Item2text[x])
Pointer+=1
if GiveI3 == y:
for x in range(13):
ROM.write(Item3text[x])
Pointer+=1
if y == 7:
ROM.write(b'\x00') #If this is the last one,... | |
<filename>src/cbapi/connection.py
#!/usr/bin/env python
"""Manages the CBAPI connection to the server."""
from __future__ import absolute_import
import requests
import sys
from requests.adapters import HTTPAdapter, DEFAULT_POOLBLOCK, DEFAULT_RETRIES, DEFAULT_POOLSIZE, DEFAULT_POOL_TIMEOUT
try:
from requests.packag... | |
<gh_stars>100-1000
# Copyright 2017-2019 typed_python 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 applicable ... | |
<filename>core/people/person.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from sqlalchemy import create_engine, Table
from sqlalchemy import Column, Integer, String, DateTime, Date
from sqlalchemy import MetaData, UnicodeText, text, Index
from sqlalchemy.orm import mapper, sessionmaker, scoped_session
#from sqlalch... | |
"""
Classes to perform actions on simulation trajectories
"""
from __future__ import division, print_function, absolute_import
import os
from collections import namedtuple
import MDAnalysis as md
import MDAnalysis.core.AtomGroup as AtomGroup
import MDAnalysis.analysis.align as align
import MDAnalysis.lib.util as mdut... | |
self.type))
packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
length = sum([len(x) for x in packed])
packed[1] = struct.pack("!H", length)
return functools.reduce(lambda x,y: x+y, packed)
@staticmethod
def unpack(reader):
subtype, = reader.peek('!H', 0)
subclass = bundle_features_prop.sub... | |
which_mc = self.vBucketMap[vBucketId]
for server in self.memcacheds:
if server != which_mc:
return self.memcacheds[server]
def set(self, key, exp, flags, value):
vb_error = 0
while True:
try:
return self._send_op(self.memcached(key).set, key, exp, flags, value)
except MemcachedError as error:
if error.status... | |
import re
import itertools
import os
import pandas as pd
import numpy as np
from prettytable import PrettyTable
from tqdm import tqdm
def get_char(seq):
"""split string int sequence of chars returned in pandas.Series"""
chars = list(seq)
return pd.Series(chars)
class SeqProcessConfig(object):
def __init__(self, ... | |
2a552bb">sources</a>', output_text
)
# Add a new commit on the repo from
newpath = tempfile.mkdtemp(prefix="pagure-fork-test")
gitrepo = os.path.join(self.path, "repos", "test.git")
repopath = os.path.join(newpath, "test")
clone_repo = pygit2.clone_repository(
gitrepo, repopath, checkout_branch="feature"
)
d... | |
<filename>src/software/dAMP/triage.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# *****************************************************************************/
# * Authors: <NAME>
# *****************************************************************************/
# @package triage
from __future__ import absolute_i... | |
<filename>alphad3m/alphad3m/grpc_api/grpc_server.py<gh_stars>0
"""GRPC server code, exposing AlphaD3M over the TA3-TA2 protocol.
Those adapters wrap the D3mTa2 object and handle all the GRPC and protobuf
logic, converting to/from protobuf messages. No GRPC or protobuf objects should
leave this module.
"""
import grp... | |
import random
import numpy
import simpy
from file_manager import SharedFile
def new_inter_session_time():
"""
Ritorna un valore per l'istanza di "inter-session time"
"""
return numpy.random.lognormal(mean=7.971, sigma=1.308)
def new_session_duration():
"""
Ritorna un valore per l'istanza di "session time"
""... | |
<reponame>pmp-p/wapy-pack<filename>wapy-lib/readline/pyreadline.py<gh_stars>0
# Incremental readline compatible with micropython/lib/readline.c, credits https://github.com/dhylands
import sys
try:
import ulogging as logging
except:
import logging
try:
import signal
except:
signal = None
DEBUG = 0
CTRL_A = b"\x... | |
<filename>extract_haplotype_read_counts.py<gh_stars>0
#!/bin/env python
#
# Copyright 2013 <NAME> and <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... | |
array is full
if i_dt_csa >= nb_dt_csa:
break
# Calculate the new time
t_csa += self.history.timesteps[i_dt_csa]
i_dt_csa += 1
# Exit the loop if the array is full
if (i_dt_csa + 1) >= nb_dt_csa:
break
# If the array has been read completely, but the sfr_input array is
# not full, fil the rest of the array... | |
<gh_stars>0
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.utils.data import download_file
import os
import random
class FakeStars():
"""
A class object that generates fake sources or fake images.
NOTE- The generate sources are generated using statistical information f... | |
<reponame>gargrohin/sngan.pytorch
import torch.nn as nn
from .gen_resblock import GenBlock
import numpy as np
import torch
class Generator(nn.Module):
def __init__(self, args, activation=nn.ReLU(), n_classes=0):
super(Generator, self).__init__()
b = np.load('ResNetGenerator_850000.npz')
lst = b.files
for ite... | |
not self.fs.exists(path):
raise AssertionError(
'Input path %s does not exist!' % (path,))
def _check_output_not_exists(self):
"""Verify the output path does not already exist. This avoids
provisioning a cluster only to have Hadoop refuse to launch.
"""
if self.fs.exists(self._output_dir):
raise IOError(
'Out... | |
import numpy as np
import librosa
from scipy import interpolate
import pywt
from matplotlib.image import imsave
from scipy.signal import butter, lfilter, freqz
from matplotlib import pyplot as plt
from imageProcessingUtil import ImageProcessing
import SimpleITK as sitk
class AudioProcessing(object):
... | |
"""
Auxiliary drawables for 2D game support.
This module provides support for non-rectangular objects such as triangles, polygons,
and paths (e.g. lines with width).
Author: <NAME> (wmw2)
Date: August 1, 2017 (Python 3 version)
"""
# Lower-level kivy modules to support animation
from kivy.graphics import *
from kivy... | |
your ID. Please try logging in again.')
return response
except Exception as e:
log.error("%s type exception raised setting response following ID "
"Approval: %s", e.__class__.__name__,
traceback.format_exc())
response = self._render.errorPage(self.environ,
self.start_response,
'An error occurred setting additi... | |
),
"DR12a_5" : ( 33218, 33219 ),
"DR12a1_5" : ( 33219, 33220 ),
"DR12a2_5" : ( 33220, 33221 ),
"DR12b_5" : ( 33221, 33222 ),
"DR12b1_5" : ( 33222, 33223 ),
"DR12c_5" : ( 33223, 33224 ),
"DR12cSpecify_5" : ( 33224, 33449 ),
"DR12c1_5" : ( 33449, 33450 ),
"DR13a_" : ( 33450, 33451 ),
"DR13b_" : ( 33451, 33452 )... | |
<reponame>saucec0de/sifu
#!/usr/bin/env python3
#
# Copyright (c) <NAME>, 2020
# <EMAIL>
#
# SPDX-License-Identifier: MIT
#
# This file implements analysis of stderr
#
import results
import json
import yaml
import sys
import re
injectFileName = "inject.yaml"
def call_analyse(identifier = None, fname = "func"):
# Not... | |
<gh_stars>0
"""IEM Cow (NWS Storm Based Warning Verification) API
See [IEM Cow](https://mesonet.agron.iastate.edu/cow/) webpage for the user
frontend to this API and for more discussion about what this does.
While this service only emits JSON, the JSON response embeds to GeoJSON objects
providing the storm reports an... | |
# TODO: remove commented code once the new function has been tested
# if len(mesh.materials) == 0:
# if mesh.name in bpy.data.materials:
# mat = bpy.data.materials[mesh.name]
# else:
# mat = bpy.data.materials.new(name=mesh.name)
# mat.use_nodes=True
# mesh.materials.append(mat)
# else:
# i = 0
# for m in mes... | |
# noinspection PyPackageRequirements
import datawrangler as dw
import os
import sys
import numpy as np
import pandas as pd
import ast
import json
import datetime
import quail
import nltk
import warnings
import pickle
import datetime as dt
# noinspection PyPackageRequirements
from spellchecker import SpellChecker
from ... | |
"""
Module containing the three basic classes: Parameters, Particles, Species.
"""
from copy import deepcopy
from numpy import array, cross, ndarray, pi, sqrt, tanh, zeros
from scipy.constants import physical_constants
from scipy.linalg import norm
from .plasma import Species
from .utilities.exceptions import Particl... | |
# -*- encoding:utf-8 -*-
"""
边裁基础实现模块
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import logging
import os
from abc import abstractmethod
import numpy as np
import sklearn.preprocessing as preprocessing
from enum import Enum
from sklearn.metrics.p... | |
<gh_stars>0
from .fhirbase import fhirbase
class Sequence(fhirbase):
"""
Raw data describing a biological sequence.
Attributes:
resourceType: This is a Sequence resource
identifier: A unique identifier for this particular sequence instance.
This is a FHIR-defined id.
type: Amino Acid Sequence/ DNA Sequence / ... | |
# synchronize() handles things in this case
return
# it is actually _get_dcvalue_from_file that guarantees that
# referenced nodes actually exist in the file...
# if xmlpath=="dc:summary/dc:dest":
# import pdb as pythondb
# pythondb.set_trace()
# pass
newval=self._get_dcvalue_from_file(xmldocobj,xmlpath,ETxmlp... | |
<filename>libtaxii/taxii_default_query.py
# Copyright (c) 2017, The MITRE Corporation
# For license information, see the LICENSE.txt file
"""
Creating, handling, and parsing TAXII Default Queries.
"""
import numbers
import datetime
from operator import attrgetter
import os
import dateutil.parser
from lxml import et... | |
<gh_stars>1-10
"""Abstract class to define the API for an SPH scheme. The idea is that
one can define a scheme and thereafter one simply instantiates a suitable
scheme, gives it a bunch of particles and runs the application.
"""
class Scheme(object):
"""An API for an SPH scheme.
"""
def __init__(self, fluids, so... | |
<gh_stars>0
from typing import Optional, Union
import discord
import time
import importlib
import asyncio
import aiohttp
from discord.ext import commands
from fcts import args, checks
importlib.reload(args)
importlib.reload(checks)
from libs.classes import Zbot, MyContext
class Partners(commands.Cog):
def __init__(s... | |
import random
import math
import sc2
import time
import argparse
from MapAnalyzer.MapData import MapData
from sc2 import Difficulty
from sc2.player import Bot, Computer
from sc2.constants import *
from sc2.ids.unit_typeid import UnitTypeId
from sc2.ids.ability_id import AbilityId
from sc2.position import Point2, Point3... | |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import warnings
class grapher(object):
"""
A simple class covering typical use of generating graphs.
Exmple of usage:
0) import class by using "from matgrapher import grapher"
1) create new object i.e. "gr = grapher.grapher()"
2) loa... | |
layer names that will be visible
# group_off = a list of layer names that will not be visible
def layer_visibility(self, group_on, groups_off):
for fc in groups_off:
iface.setActiveLayer(fc)
node = self.tc_root.findLayer(iface.activeLayer().id())
node.setItemVisibilityChecked(False)
for fc in group_on:
iface.se... | |
[{'locale' : 'en', 'text' : 'Validated by a medical structure outside France'},{'locale' : 'es', 'text' : 'Validado por una autoridad francesa'},{'locale' : 'it', 'text' : 'Convalidato da autorità diversa da francese'},{'locale' : 'tr', 'text' : ''},{'locale' : 'de', 'text' : '-'}, {'locale' : 'fr', 'text' : 'Validé pa... | |
Does the standard V1 subnetowrk synthesis.
:param username: The user/users to synthesize for. If None, we group
synthesize across all. If a single user, we sythesize for that user
across all. If it is a list, we synthesize for the group that is that
list of users.
:return: Nothing
'''
# First we need our globa... | |
from __future__ import annotations
import datetime
import os
import shutil
import typing
from typing import Union, Any, IO, Type, Optional, List, Tuple
import dill
class FileCheck:
@staticmethod
def exists(full_path: str) -> bool:
return os.path.exists(full_path)
@staticmethod
def has_quarry(full_path: str, ... | |
# from https://github.com/amdegroot/ssd.pytorch
import torch
from torchvision import transforms
import cv2
import numpy as np
import types
from numpy import random
from Archs_2D.BBox import BBoxes
def intersect(box_a, box_b):
max_xy = np.minimum(box_a[:, 2:], box_b[2:])
min_xy = np.maximum(box_a[:, :2], box_b[:2]... | |
<gh_stars>0
import numpy as np
from numpy.testing._private.utils import _assert_no_gc_cycles_context
class Node():
def __init__(self, value=None, attribute_name="root", attribute_index=None, branches=None):
"""
This class implements a tree structure with multiple branches at each node.
If self.branches is an empt... | |
<gh_stars>1-10
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 29 17:03:37 2020
@author: zmg
"""
from pathlib import Path
import sys
from scipy.stats import linregress
from scipy import stats
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from datetime import datetime
impo... | |
<gh_stars>1-10
import json
from typing import List
from unittest import mock
import boto3
import pandas as pd
import pytest
from moto import mock_s3
from ruamel.yaml import YAML
import great_expectations.exceptions.exceptions as ge_exceptions
from great_expectations import DataContext
from great_expectations.core.bat... | |
EPIGRAPHIC LETTER REVERSED P': None,
'LATIN LETTER AIN': None,
'LATIN LETTER SMALL CAPITAL A': None,
'LATIN LETTER SMALL CAPITAL AE': None,
'LATIN LETTER SMALL CAPITAL BARRED B': None,
'LATIN LETTER SMALL CAPITAL C': None,
'LATIN LETTER SMALL CAPITAL D': None,
'LATIN LETTER SMALL CAPITAL E': None,
'LATIN LETTER SMALL C... | |
= 0
self._createAllTables()
self._loadServers()
def _createAllTables(self):
"""Helper: check for the existence of all the tables and indices
we plan to use, and create the missing ones."""
self._lock.acquire()
try:
# FFFF There are still a few sucky bits of this DB design.
# FFFF First, we depend on SQLite's ... | |
# ignorelongline
'1f69c': {'canonical_name': 'tractor', 'aliases': []},
# kick_scooter and scooter seem better for Places/14 and Places /16 than
# scooter and motor_scooter.
'1f6f4': {'canonical_name': 'kick_scooter', 'aliases': []},
'1f6b2': {'canonical_name': 'bike', 'aliases': ['bicycle']},
# see Places/14. Ca... | |
= "Rollout"
deployment_or_rollout = await Rollout.read(*read_args)
init_args = dict(rollout_config = deployment_or_rollout_config, rollout = deployment_or_rollout)
else:
raise NotImplementedError(f"Unknown configuration type '{type(deployment_or_rollout_config).__name__}'")
if not deployment_or_rollout:
raise Val... | |
#! /usr/bin/env python3
# coding=utf-8
# Copyright 2018 The Uber AI 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 req... | |
d = Encodable.parents_encode(self, __class__)
return d
class FactorTypesRelationUnidirectionalLinearTransformObservation(FactorTypesRelationObservation, Encodable):
"""
Expression of an Unidirectional Linear Transform, from an origin FactorType to a destination FactorType
A weight can be a expression containing ... | |
struct.calcsize(pattern)
val1.fx = struct.unpack(pattern, str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(str[start:end])
pattern = '<%sf'%length
start = end
end += struct.calcsize(pattern)
val1.fy = struct.unpack(pattern, str[start:end])
start = end
end += 4
(length,) = _struct_I.unpack(st... | |
from __future__ import division #brings in Python 3.0 mixed type calculation rules
import logging
import numpy as np
import pandas as pd
class ScreenipFunctions(object):
"""
Function class for screenip.
"""
def __init__(self):
"""Class representing the functions for screenip"""
super(ScreenipFunctions, self).__... | |
ck, cache_name):
nlst = nls.copy()
def fun(at):
vec = nm.r_[ufun(at), vfun(at), at]
aux = nls.fun(vec)
i3 = len(at)
rt = aux[:i3] + aux[i3:2*i3] + aux[2*i3:]
return rt
@_cache(self, cache_name, self.conf.is_linear)
def fun_grad(at):
vec = None if self.conf.is_linear else nm.r_[ufun(at), vfun(at), at]
M, ... | |
int_proto_state,
'interface-mac': None,
'ip-address': ip_address}
x = next((x for x in result if int_type == x['interface-type'] and
int_name == x['interface-name']), None)
if x is not None:
results.update(x)
ip_result.append(results)
return ip_result
@staticmethod
def get_interface_detail_request(last_inter... | |
self.vtType in id_scope.remap:
id_remap[(id_scope.remap[self.vtType], self.db_id)] = new_id
else:
id_remap[(self.vtType, self.db_id)] = new_id
cp.db_id = new_id
if hasattr(self, 'db_objectId') and (self._db_what, self._db_objectId) in id_remap:
cp._db_objectId = id_remap[(self._db_what, self._db_objectId)]
if ha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.