input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
into first-tier attributes of the record object, like `details` and
`stacktrace`, for easy consumption.
Note the termination signal is not always an error, it can also be explicit
pass signal or abort/skip signals.
Attributes:
test_name: string, the name of the test.
begin_time: Epoch timestamp of when the test... | |
plt.gca()
p._attach(ax)
p.plot(ax, kwargs)
return ax
lineplot.__doc__ = dedent("""\
Draw a line plot with possibility of several semantic groupings.
{main_api_narrative}
{relational_semantic_narrative}
By default, the plot aggregates over multiple ``y`` values at each value of
``x`` and shows an estimate... | |
# -*- coding: utf-8 -*-
"""
Configuration for the simulations, for the single-player case.
"""
from __future__ import division, print_function # Python 2 compatibility
__author__ = "<NAME>"
__version__ = "0.9"
# Tries to know number of CPU
try:
from multiprocessing import cpu_count
CPU_COUNT = cpu_count() #: Number... | |
<reponame>jarethholt/teospy
"""Dry air Helmholtz potential and air-water virial coefficients.
This module implements the Helmholtz free energy of dry air and its
derivatives with respect to temperature and density. This module also
includes the virial coefficients for dry air-water vapour mixtures.
:Examples:
>>> dr... | |
view: elements may be silently omitted or re-ordered
* plenary view: provides a complete set or is an error condition
Generally, the comparative view should be used for most applications
as it permits operation even if there is data that cannot be
accessed. For example, a browsing application may only need to
ex... | |
r"""
:param Data: 事件详情
:type Data: str
:param RequestId: 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。
:type RequestId: str
"""
self.Data = None
self.RequestId = None
def _deserialize(self, params):
self.Data = params.get("Data")
self.RequestId = params.get("RequestId")
class DescribeLeakDetectionListRequest... | |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may ch... | |
1 if self.bias is not None else 0
params = output_channels * (kernel_ops + bias_ops)
flops = batch_size * params * output_height * output_width
list_conv.append(flops)
list_linear = []
def linear_hook(self, input, output):
batch_size = input[0].size(0) if input[0].dim() == 2 else 1
weight_ops = self.weight.... | |
<reponame>FrankMillman/AccInABox
import db.objects
from db.connection import db_constants as dbc
import rep.finrpt as rep_finrpt
import rep.tranrpt
from common import AibError
async def check_subledg(caller, params):
# called from gl_per_close process - check that all sub-ledgers for this period have been closed
con... | |
<filename>pyramid_crud/forms.py
import wtforms_alchemy
import six
from wtforms.ext.csrf.form import SecureForm
from wtforms.ext.sqlalchemy.fields import QuerySelectField
from .util import get_pks, meta_property
from sqlalchemy.orm.session import object_session
from sqlalchemy.orm.interfaces import MANYTOONE
from sqlalc... | |
if isinstance(o, Index):
tm.assert_index_equal(o, result)
else:
tm.assert_series_equal(o, result)
# check shallow_copied
assert o is not result
for null_obj in [np.nan, None]:
for orig in self.objs:
o = orig.copy()
klass = type(o)
if not self._allow_na_ops(o):
continue
if needs_i8_conversion(o):
values... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def all_messages():
"""
keep all messages in tr
Returns:
all messages in JSON
"""
return \
{
"scan_started": "Nettacker motoru başladı ...",
"options": "python nettacker.py [seçenekler]",
"help_menu": "Nettacker Yardım Menüsünü Göster",
"license": "Lütfen lisa... | |
#jfp was w1 = numpy.full( a1.shape, w1 )
#jfp was w2 = numpy.full( a2.shape, w2 )
w1 = numpy.full( mv1.shape, -1 )
w1[i] = sw1
w1 = numpy.ma.masked_less(w1,0)
w2 = numpy.full( mv1.shape, -1 )
w2[i] = sw2
w2 = numpy.ma.masked_less(w2,0)
if not force_scalar_avg and\
hasattr(w1,'shape') and len(w1.shape)>0 and h... | |
value(s):
+-------------------------------+-----------------------------------+
| Name | Value |
+===============================+===================================+
| commands | `list` of `Any` |
+-------------------------------+-----------------------------------+
"""
self.parent = parent
self._getter = ge... | |
<filename>avaml/aggregatedata/download.py
import json
import math
import os
import pickle
import re
import sys
import datetime as dt
import requests
from concurrent import futures
import numpy as np
from avaml import _NONE, CSV_VERSION, REGIONS, merge, Error, setenvironment as se, varsomdata, REGION_NEIGH
from varsomd... | |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from common_utils import *
from crypto_utils import *
from random import *
import os
MODE_TYPE = {
'MODE_UNSPECIFIED' : 0x0000,
'MODE_KEYINIT' : 0x0001,
'MODE_AESINIT_ENC' : 0x0002,
'MODE_AESINIT_DEC' : 0x0004,
'MODE_ENC' : 0x0008,
'MODE_DEC' : 0x0010,
'MODE_RANDO... | |
<reponame>sgraton/python-emploi-store
# encoding: utf-8
"""Unit tests for emploi_store module."""
import codecs
import datetime
import itertools
import tempfile
import shutil
import unittest
import mock
import requests_mock
import emploi_store
# TODO: Add more tests.
@requests_mock.Mocker()
class ClientTestCase(u... | |
response:
self.assertEqual(response.status, 200)
self.assertEqual(
await response.text(),
textwrap.dedent('''\
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
.highlight {
background-color: #ff0;
}
</style>
<title>Taguette Codebook</title>
</head>
<body>
<h1>Taguette Codebook</h1>
<h2>in... | |
the method "iterkeys()".\n'
'\n'
' Iterator objects also need to implement this method; '
'they are\n'
' required to return themselves. For more information on '
'iterator\n'
' objects, see Iterator Types.\n'
'\n'
'object.__reversed__(self)\n'
'\n'
' Called (if present) by the "reversed()" built-in ... | |
<filename>plugins/cisco_firepower_management_center/icon_cisco_firepower_management_center/actions/create_address_object/schema.py<gh_stars>0
# GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Creates a new address object"
class Input:
ADDRESS ... | |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
#
# scapy.contrib.description = IEC-60870-5-104 APCI / APDU layer definitions
# scapy.contrib.status = loads
"""
IEC 60870-5-104
~~~~~~~~~~~~... | |
None: return None
return self.name2imdbID(name)
def get_imdbCharacterID(self, characterID):
"""Translate a characterID in an imdbID.
Try an Exact Primary Name search on IMDb;
return None if it's unable to get the imdbID.
"""
name = getCharacterName(characterID,
'%scharacters.index' % self.__db,
'%scharacters.... | |
#!/usr/bin/env python
"""
pyOpt_optimizer
Holds the Python Design Optimization Classes (base and inherited).
Copyright (c) 2008-2013 by pyOpt Developers
All rights reserved.
Revision: 1.1 $Date: 08/05/2008 21:00$
Developers:
-----------
- Dr. <NAME> (GKK)
"""
from __future__ import print_function
# =================... | |
<filename>maiconverter/simai/simai.py
from __future__ import annotations
import math
from typing import Optional, Tuple, List, Union
from lark import Lark
from .tools import (
get_measure_divisor,
convert_to_fragment,
get_rest,
parallel_parse_fragments,
)
from ..event import NoteType
from .simainote import TapNot... | |
import sys, py
from rpython.translator.translator import TranslationContext
from rpython.annotator import unaryop, binaryop
from rpython.rtyper.test import snippet
from rpython.rtyper.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
from rpython.rlib.rarithmetic import (
r_int, r_uint, r_longlong, r_ulongl... | |
"""
Args:
keys (list or str): the column name(s) to apply the `func` to
func (callable): applied to each element in the specified columns
"""
return [[func(v) for v in self[key]] for key in keys]
def merge_rows(self, key, merge_scalars=True):
"""
Uses key as a unique index an merges all duplicates rows. Use
c... | |
<gh_stars>0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2015-2016, <NAME> <EMAIL>
# pylint: disable=too-many-public-methods
# pylint: disable=unus... | |
self.update()
def EventFullscreenSwitch( self, event ):
self.parentWidget().FullscreenSwitch()
def KeepCursorAlive( self ):
self._InitiateCursorHideWait()
def ProcessContentUpdates( self, service_keys_to_content_updates ):
if self._current_media is None:
# probably a file view stats update ... | |
page = requests.get(date_url)
soup = bs4.BeautifulSoup(page.content, 'lxml')
raw_date = soup.findAll('li', attrs = {'class': 'b-list__box-list-item'})[0].text
raw_date = raw_date.replace('\n', '')
raw_date = raw_date.replace('Date:', '')
raw_date = raw_date.replace(' ', '')
raw_date = raw_date.replace(',', '')
d... | |
True
else:
t[0] = False
def p_arg_list_opt(t):
''' arg_list_opt : arg_list
|'''
if len(t)== 2:
t[0] = t[1]
else:
t[0] = []
def p_arg_list(t):
''' arg_list : arg_list COMA ID
| ID'''
if len(t) == 4:
t[1].append(t[3])
t[0] = t[1]
else:
t[0] = [t[1]]
def p_ins_create_pl(t):
'''ins_create_pl : CREATE o... | |
<reponame>MCSitar/colab-zirc-dims<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Utility functions (e.g., loading datasets, calculating scale factors) for single
image-per-shot datasets (non-ALC).
"""
import os
import copy
import skimage.io as skio
import pandas as pd
from . import czd_utils
__all__ = ['find_Align',
'ind... | |
#!/usr/bin/env python
# Copyright (c) 2004-2006 ActiveState Software Inc.
#
# Contributors:
# <NAME> (<EMAIL>)
"""
pythoncile - a Code Intelligence Language Engine for the Python language
Module Usage:
from pythoncile import scan
mtime = os.stat("foo.py")[stat.ST_MTIME]
content = open("foo.py", "r").read()
scan... | |
' '.join(filter_options)))
# if address-family and address-book-type have not been set then default
if not filter_type:
filter_type = 'mixed'
term_dup_check = set()
new_terms = []
self._FixLargePolices(terms, filter_type)
for term in terms:
if set(['established', 'tcp-established']).intersection(term.option)... | |
<gh_stars>10-100
import os
import shutil
import sys
import time
import requests
import qdarkstyle
from PyQt5.QtCore import QPersistentModelIndex, Qt, QThread, QUrl, pyqtSignal
from PyQt5.QtGui import QDesktopServices, QImage, QPixmap
from PyQt5.QtWidgets import (
QAbstractItemView,
QApplication,
QFileDialog,
QMainW... | |
"""
HTTP Exception
--------------
This module processes Python exceptions that relate to HTTP exceptions
by defining a set of exceptions, all subclasses of HTTPException.
Each exception, in addition to being a Python exception that can be
raised and caught, is also a WSGI application and ``webob.Response``
object.
Thi... | |
distance to any main track. If overlapping, they are relegated to the end of the list
The closest unassigned track is then assigned. If all but 1 of the tracks overlap with the gallery track, it is assigned the non overlapping.
If there are M < N main tracks that dont overlap with the gallery track, only compare thes... | |
information for
the superelement. Some or all of this info is in the `uset`
table, but if a coordinate system is not used as an output
system of any grid, it will not show up in `uset`. That is why
`cstm` is here. `cstm` has 14 columns::
cstm = [ id type xo yo zo T(1,:) T(2,:) T(3,:) ]
Note that each `cstm` alw... | |
"some text",
"type": IOTypes.STR,
},
{
"name": "input2",
"description": "some text",
"type": IOTypes.FLOAT,
},
{
"name": "input3",
"description": "some text",
"type": IOTypes.BOOL,
"is_optional": True,
"value": True,
},
],
"container": {"image": "test"},
}
],
}
config = DagConfig.from_dict(config_di... | |
"""
A class for the OKR graph structure
Author: <NAME> and <NAME>
"""
import os
import copy
import logging
import itertools
import xml.etree.ElementTree as ET
import re
import stop_words
from collections import defaultdict
NULL_VALUE = 0
STOP_WORDS = stop_words.get_stop_words('en')
class MentionType... | |
<filename>turbogears/widgets/tests/test_widgets.py
import itertools
import cherrypy
from turbogears import controllers, expose, widgets, validators, view
from turbogears.testutil import call, catch_validation_errors
try:
set
except NameError: # Python 2.3
from sets import Set as set
class Request:
input_values =... | |
<gh_stars>10-100
# Copyright 2017 AT&T Corporation.
# 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 b... | |
<reponame>hypergravity/starlight_wrapper
# -*- coding: utf-8 -*-
"""
Author
------
<NAME>
Email
-----
<EMAIL>
Created on
----------
- Sat Jul 16 22:30:00 2016
Modifications
-------------
- Sat Jul 16 22:30:00 2016 framework
- Sun Jul 17 23:00:00 2016 StarlightGrid
- Mon Jul 18 09:27:00 2016
Aims
----
- to generat... | |
= cc.half()
# NOTE: test TorchScript-compatible!
cc = torch.jit.script(cc)
for t in range(T):
cc.split_embedding_weights()[t].data.copy_(bs[t].weight)
x = torch.cat([x.view(1, B, L) for x in xs], dim=0)
xw = torch.cat([xw.view(1, B, L) for xw in xws_acc_type], dim=0)
(indices, offsets) = get_table_batched_off... | |
user to share with selected')
else:
for selected_pe_result in pe_results:
for selectedUser in users:
try:
# print "Try barruan"
# code that produces error
post = m.share_pe_results.objects.create(user=User.objects.get(pk=selectedUser),
pe_results=m.PE_results.objects.get(
pk=selected_pe_result), )
except Inte... | |
:ivar gtk.Entry txtProgramProb: the gtk.Entry() to enter and display the
average program probability of observing
a failure.
:ivar gtk.Entry txtTTFF: the gtk.Entry() to enter and display the length of
the first test phase.
"""
def __init__(self, controller, listbook):
"""
Method to initialize the Work Book vie... | |
"""
Flex bond message channels
"""
#
# Copyright 2020 The FLEX 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
#
#... | |
second to complete
return True
def restart(self) -> bool:
response = self.send_message("restartController") # Restart the controller
time.sleep(1) # Give it 1 second to complete
return True
def get_control_constants(self):
return json.loads(self.send_message("getControlConstants", read_response=True))
def se... | |
<filename>tools/mo/openvino/tools/mo/back/add_outputs_recursive.py
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from math import ceil
import numpy as np
from openvino.tools.mo.ops.If import If
from openvino.tools.mo.ops.loop import Loop
from openvino.tools.mo.ops.tensor_iterator import ... | |
<gh_stars>1-10
"""
Copyright 2020 XuaTheGrate
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,... | |
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader, TensorDataset
from ..utils import per_example_grad_conv
from ..object.vector import PVector, FVector
from ..layercollection import LayerCollection
class Jacobian:
"""
Computes jacobians :math:`\mathbf{J}_{ijk}=\\frac{\partial f\le... | |
<gh_stars>10-100
import datetime
from itertools import product
from tempfile import mkdtemp
import os
import numpy as np
import pycuda.autoinit
from pycuda.compiler import SourceModule
from pycuda.gpuarray import GPUArray, to_gpu
from tf_implementations.forward_pass_implementations\
import build_multi_view_cnn_forwa... | |
Error')
error = str(error)
return render_template('Errors.html', Httperror=httpcode, error=error, errorType=errortype)
@app.route('/Plots/countNonPayloadPerNode', methods=['POST', 'GET'])
def NonPayloadQueriesPerNode():
if request.method == 'POST':
try:
param = request.form
# get the request parameter... | |
# Dedicated to the public domain under CC0: https://creativecommons.org/publicdomain/zero/1.0/.
'''
`craft-py-ext` is an experimental tool for generating the boilerplate to build simple CPython extensions.
It should be considered a work in progress.
To use it, you write a `.pyi` type declaration file, and then genera... | |
from datetime import datetime
from urllib.parse import urlencode
from operator import itemgetter
import json
import pytz
from django.contrib.gis.geos import Point
from django.urls import reverse
from mock import patch
from rest_framework import status
from rest_framework.test import APITestCase
from robber import expe... | |
<filename>pypy/module/_ssl/interp_ssl.py<gh_stars>10-100
from pypy.rpython.rctypes.tool import ctypes_platform
from pypy.rpython.rctypes.tool.libc import libc
import pypy.rpython.rctypes.implementation # this defines rctypes magic
from pypy.interpreter.error import OperationError
from pypy.interpreter.baseobjspace impo... | |
(isinstance(mean_local, list) == True)): # Checks to see if we are dealing with arrays.
N_times_mean_local = np.multiply(N_local, mean_local)
N_times_var_local = np.multiply(N_local, np.multiply(std_local, std_local))
N_local = np.array(N_local).astype(float)
N_times_mean_local = np.array(N_times_mean_local).a... | |
<reponame>Jamal-dev/asymproj_edge_dnn_tensorFlow2
# Copyright 2017 Google 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-... | |
supported
try: audioop.bias(b"", 3, 0) # test whether 24-bit audio is supported (for example, ``audioop`` in Python 3.3 and below don't support sample width 3, while Python 3.4+ do)
except audioop.error: # this version of audioop doesn't support 24-bit audio (probably Python 3.3 or less)
raw_data = b"".join(raw_data... | |
<reponame>ian-cooke/basilisk_mag
''' '''
'''
ISC License
Copyright (c) 2016, Autonomous Vehicle Systems Lab, University of Colorado at Boulder
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this ... | |
*
sage: P = back_circulant(2)
sage: P[1,1] = -1
sage: P.random_empty_cell()
[1, 1]
"""
cells = {}
for r in range(self.nrows()):
for c in range(self.ncols()):
if self[r, c] < 0:
cells[ (r,c) ] = True
cells = list(cells)
if not cells:
return None
rc = cells[ ZZ.random_element(len(cells)) ]
return [rc... | |
networks = []
if all(id in cached_purenets for id in self.networks):
for id in self.networks:
qlknet = cached_purenets[id]['net'].to_QuaLiKizNN(cached_purenets=cached_purenets)
networks.append(qlknet)
else:
nets = {net.id: net for net in Network.select().where(Network.id.in_(network_ids))}
for id in self.network... | |
<gh_stars>1-10
"""
---------------------------------------------------------------------
-- Author: <NAME>
---------------------------------------------------------------------
Semisupervised generative model with metric embedding auxiliary task
"""
import matplotlib.pyplot as plt
import tensorflow as tf
import nump... | |
<gh_stars>1000+
from typing import Text, List, Any, Tuple, Callable, Dict, Optional
import dataclasses
import numpy as np
import pytest
from rasa.engine.graph import ExecutionContext
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import ModelStorage
from rasa.nlu.featurizers.sparse... | |
#
# Tobii controller for PsychoPy
#
# author: <NAME>
# Distributed under the terms of the GNU General Public License v3 (GPLv3).
#
# edited by: <NAME> and <NAME>
#
#
from __future__ import division
from __future__ import absolute_import
import types
import datetime
import numpy as np
import time
import warnings
imp... | |
time range to draw.
All child chart instances are updated when time range is updated.
Args:
t_start: Left boundary of drawing in units of cycle time or real time.
t_end: Right boundary of drawing in units of cycle time or real time.
seconds: Set `True` if times are given in SI unit rather than dt.
Raises:
Vis... | |
<filename>tests/tools/copy_table_to_blackhole_table_test.py
# -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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/licens... | |
#
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | |
<filename>L10_packet_dir/For_Job_01_L10_Game_fool_card_desc.py
#!python3.7
#coding: utf-8
# Желательно настроить шрифт (File-Settings-Editor-Font) - Consolas, size:13, Line spacing:0.8
# <NAME>, к домашнему заданию урока №9 (Python)
class Game_fool_card_desc:
#---------------------------------------------------------... | |
"""
This module provides the DataCoordinator class for reading data from
atomistic codes and organizing data into DataFrames using Pandas.
"""
import os
import re
import io as pio
import fnmatch
from typing import List, Dict, Tuple
import numpy as np
import pandas as pd
import tables
import ase
from ase im... | |
emoji_name[1:]
if emoji_name.endswith(":"):
emoji_name = emoji_name[:-1]
if nextcord.utils.get(client.emojis, name=emoji_name) != None:
emoji_list = [names.name for names in client.emojis if names.name == emoji_name]
le = len(emoji_list)
if le >= 2:
if number > le - 1:
number = le - 1
user = getattr(ctx, 'auth... | |
To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.video_convert_to_still_frames(async_req=True)
>>> result = thread.get()
:param async_req bool
:param file input_file: Input file to perform the operation on.
:param str file_url: Optional; URL of a video file being used for convers... | |
# -*- coding: utf-8 -*-
if __name__ == "__main__":
import os
import sys
# If you run tests in-place (instead of using py.test), ensure local version is tested!
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from greenery.fsm import *
def test_fsm():
# Buggggs.
abstar = fsm(
a... | |
import azure.mgmt.batchai as batchai
from azure.storage.file import FileService
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
from datetime import datetime
import os
def setup_bai(
aad_client_id: str = None,
aad_secret: str = None,
aad_ten... | |
<reponame>gitguige/openpilot0.8.9
#!/usr/bin/env python3
import argparse
import carla # pylint: disable=import-error
import math
import numpy as np
import time
import threading
from cereal import log
from multiprocessing import Process, Queue
from typing import Any
import cereal.messaging as messaging
from common.para... | |
offsety = row_keys.unique_count+1
if Accum2.DebugMode: print("**stack len", len(arr), offsety, " showfilterbase:", showfilter_base)
# add showfilter column first if we have to
if showfilter:
newds[FILTERED_LONG_NAME] = arr[0: offsety]
# skip showfilter row for loop below (already added or not added abov... | |
#!/usr/bin/env python
"""
Calculate several measures of segregation in a given data set.
The assumption is that the dataset will be a dictionary-like object
that we can index for one of several parameters to get the required
data.
"""
import sys
import operator
from nces_parser import NCESParser
# ==================... | |
"""
Provide the groupby split-apply-combine paradigm. Define the GroupBy
class providing the base-class of operations.
The SeriesGroupBy and DataFrameGroupBy sub-class
(defined in pandas.core.groupby.generic)
expose these user-facing objects to provide specific functionality.
"""
from contextlib import contextmanager... | |
sec_channel_offset=567 ht vht' ]:
if "FAIL" not in dev[0].request("TDLS_CHAN_SWITCH " + args):
raise Exception("Unexpected success on invalid TDLS_CHAN_SWITCH: " + args)
def test_wpas_ctrl_addr(dev):
"""wpa_supplicant ctrl_iface invalid address"""
if "FAIL" not in dev[0].request("TDLS_SETUP "):
raise Exception("U... | |
"""
Character object
--
Author : Drlarck
Last update : 1/11/20 by DrLarck
"""
import asyncio
# util
from utility.graphic.embed import CustomEmbed
from utility.graphic.icon import GameIcon
from utility.graphic.color import GameColor
from utility.entity.ability import Ability
class Character:
def __init__(self, ... | |
0x88, 0x98, 0x22,
0x22, 0x81, 0x15, 0x24, 0x24, 0x32, 0x42, 0x43,
0x82, 0x64, 0x22, 0x12, 0x26, 0x84, 0x84, 0x48,
0x41, 0x82, 0x61, 0x86, 0x17, 0x41, 0x2c, 0x74,
0x24, 0x21, 0x14, 0x24, 0x08, 0x90, 0x11, 0x28,
0x40, 0x04, 0x81, 0x17, 0x44, 0x4a, 0x01, 0x00,
0x42, 0x48, 0x80, 0x12, 0x18, 0x84, 0x31, 0x28,
0x84, 0... | |
size)
"""
return self.tfidfMatrix
def getTFIDFVectors(self, ngrams=1):
"""
Return docs with TFIDF values instead of tokens
"""
if ngrams != 1:
raise Exception("ngrams > 1 not yet implemented")
if self.tfidfVectors is None:
tfidfScores = []
pbar = ProgressBar(len(self.docs), verbose=self.verbose and (len(se... | |
attribute_names = self.library.execute_javascript(
"(element) => element.getAttributeNames()", selector
)
expected = list(assertion_expected)
return list_verify_assertion(
attribute_names, assertion_operator, expected, "Attribute names", message
)
@keyword(tags=("Getter", "Assertion", "PageContent"))
@with_ass... | |
#
# Copyright 2017 Mycroft AI 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... | |
# coding: utf-8
"""
finAPI RESTful Services
finAPI RESTful Services # noqa: E501
OpenAPI spec version: v1.42.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from sw... | |
#error_var = max_error(post_var - prior_var) # Max distance
### MC error
var_est = np.sum((bnn_grid_post - post_mean.reshape(1,-1))**2, 0) / (n_samp - 1) # unbiased estimate of variance
mc_error_mean = np.max(np.sqrt(var_est / n_samp)) # max over inputs
##
return error_mean, None, mc_error_mean
def distance_to_... | |
<filename>toytree/TreeParser.py
#!/usr/bin/env python
"""
A newick/nexus file/string parser based on the ete3.parser.newick. Takes as
input a string or file that contains one or multiple lines that contain
newick strings. Lines that do not contain newick strings are ignored, unless
the #NEXUS is in the header in whi... | |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 5 05:47:03 2018
@author: zg
"""
import numpy as np
#from scipy import io
import scipy.io
#import pickle
from sklearn.model_selection import StratifiedKFold
#import sklearn
from scipy.sparse import spdiags
from scipy.spatial import distance
#impor... | |
#!/usr/bin/env python3
# Copyright (c) 2018 The Zcash developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php .
from test_framework.authproxy import JSONRPCException
from test_framework.test_framework import BitcoinTestFramewor... | |
memeber_set:
memeber_set.remove(name)
if len(memeber_set) > 0:
warnings.warn("%s fileds are useless." % ",".join(memeber_set))
class DescribeTawInstancesResponse(AbstractModel):
"""DescribeTawInstances返回参数结构体
"""
def __init__(self):
r"""
:param InstanceSet: 实例列表
:type InstanceSet: list of RumInstanceInfo... | |
% iIii1I11I1II1 / O0
if 54 - 54: iII111i - I1Ii111
if 88 - 88: iII111i * OoO0O00 % OoooooooOO / oO0o
if 7 - 7: i1IIi
if 30 - 30: oO0o . i1IIi / I11i
if 23 - 23: i1IIi + oO0o % iII111i - OoO0O00 - i1IIi
if 74 - 74: Ii1I + I11i . OoooooooOO - I1ii11iIi11i
iiI = iiI . encode ( )
iiI += IiIi1iiI11
OoOooO00 = [ oO0... | |
# pylint: disable=R0902,R0904,R0914
"""
All static loads are defined in this file. This includes:
* LOAD
* GRAV
* ACCEL
* ACCEL1
* FORCE / MOMENT
* FORCE1 / MOMENT1
* FORCE2 / MOMENT2
* MOMENT
* PLOAD
* PLOAD2
* PLOAD4
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as... | |
tensors (keys == different regularization types, e.g. 'entropy').
"""
return dict()
def tf_loss(self, states, internals, actions, terminal, reward, update):
"""
Creates and returns the single loss Tensor representing the total loss for a batch, including
the mean loss per sample, the regularization loss of the b... | |
<gh_stars>1-10
import os
import pickle
import plotly.graph_objects as go
import sys
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath)
import countries # noqa: E402
from regions import Electoral_Region # noqa: E402
import electoral_systems # noqa: E402
class Election():
"""
Class repre... | |
"""
:program:`javaproperties`
-------------------------
NAME
^^^^
:program:`javaproperties` — Basic manipulation of Java ``.properties`` files
SYNOPSIS
^^^^^^^^
.. code-block:: shell
javaproperties get [<OPTIONS>] <file> <key> ...
javaproperties select [<OPTIONS>] <file> <key> ...
javaproperties set [<OPTIONS>]... | |
Initialize the superclass. :)
super(Mol2_Reader,self).__init__(fnm)
## The parameter dictionary (defined in this file)
self.pdict = mol2_pdict
## The atom numbers in the interaction (stored in the parser)
self.atom = []
## The mol2 file provides a list of atom names
self.atomnames = []
## The section that we're... | |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for failure module.
"""
import re
import sys
import StringIO
import traceback
import pdb
from twisted.trial import unittest, util
from twisted.python import failure
try:
from twisted.test import raiser
except ImportError:
rais... | |
#!/usr/bin/env python
"""
analyse Elasticsearch query
"""
import json
from elasticsearch import Elasticsearch
from elasticsearch import logger as es_logger
from collections import defaultdict, Counter
import re
import os
from datetime import datetime
# Preprocess terms for TF-IDF
import numpy as np
import pandas as pd... | |
self.flakes('''
try:
pass
finally:
continue
''', m.ContinueInFinally)
def test_breakOutsideLoop(self):
self.flakes('''
break
''', m.BreakOutsideLoop)
self.flakes('''
def f():
break
''', m.BreakOutsideLoop)
self.flakes('''
while True:
pass
else:
break
''', m.BreakOutsideLoop)
self.flakes('''
whi... | |
<filename>NNDB/model.py
from peewee import *
from peewee import (FloatField, FloatField, ProgrammingError, IntegerField, BooleanField,
AsIs)
# Param, Passthrough)
from peewee import fn
import numpy as np
import inspect
import sys
from playhouse.postgres_ext import PostgresqlExtDatabase, ArrayField, BinaryJSONField, JS... | |
"OMOVS",
"OMRAH",
"ONCER",
"ONCES",
"ONCET",
"ONCUS",
"ONELY",
"ONERS",
"ONERY",
"ONIUM",
"ONKUS",
"ONLAY",
"ONNED",
"ONTIC",
"OOBIT",
"OOHED",
"OOMPH",
"OONTS",
"OOPED",
"OORIE",
"OOSES",
"OOTID",
"OOZED",
"OOZES",
"OPAHS",
"OPALS",
"OPENS",
"OPEPE",
"OPING",
"OPPOS",
"OPSIN",
"OPTED",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.