input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
# coding: utf-8
"""
Stitch Connect
https://www.stitchdata.com/docs/developers/stitch-connect/api # noqa: E501
The version of the OpenAPI document: 0.4.1
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from stitch_connect_client.configuration import Configurati... | |
if center_pt is None:
center_pt = (663, 492)
self.center = center_pt
self.scale = np.sqrt(8)
self.true_center_x, self.true_center_y = self.position_xformer(self.center)
# print(self.position_xformer(self.center))
self.fish_angle = 0
self.center_x = self.true_center_x.copy()
self.center_y = self.true_center_y... | |
0.02
2 5.80e+05 754.18 | 648.31 153.8 139 28 | 0.29 0.22 21.32 0.02
2 5.93e+05 754.18 | 687.98 0.0 154 0 | 0.30 0.23 19.56 0.02
2 6.02e+05 754.18 | 433.99 0.0 95 0 | 0.30 0.23 20.28 0.02
2 6.11e+05 754.18 | 592.46 233.4 127 41 | 0.30 0.23 21.65 0.02
2 6.19e+05 754.18 | 443.31 0.0 89 0 | 0.30 0.23 20.45 0.02
2 6.2... | |
import torch.nn as nn
import torch.nn.functional as F
from .position_encoding import *
from typing import Optional
from torch import Tensor
import copy
def aligned_bilinear(tensor, factor):
assert tensor.dim() == 4
assert factor >= 1
assert int(factor) == factor
if factor == 1:
return tensor
h, w = tensor.siz... | |
<filename>tests/test_derivatives.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright 2014-2019 OpenEEmeter contributors
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.a... | |
"""
TransitionMap and derived classes.
"""
import numpy as np
from importlib_resources import path
from numpy import array
from flatland.core.grid.grid4 import Grid4Transitions
from flatland.core.grid.grid4_utils import get_new_position, get_direction
from flatland.core.grid.grid_utils import IntVector2DArray, IntVec... | |
import difflib
import logging
from typing import List, Optional, Set
from irrd.conf import get_setting
from irrd.rpki.status import RPKIStatus
from irrd.rpki.validators import SingleRouteROAValidator
from irrd.rpsl.parser import UnknownRPSLObjectClassException, RPSLObject
from irrd.rpsl.rpsl_objects import rpsl_object... | |
<gh_stars>0
# coding=utf-8
# Copyright (c) 2020 <NAME>
# Copyright (c) 2017 <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 righ... | |
"""functions related to modeling"""
import pymel.internal.factories as _factories
import pymel.core.general as _general
if False:
from maya import cmds
else:
import pymel.internal.pmcmds as cmds # type: ignore[no-redef]
def pointPosition(*args, **kwargs):
return _general.datatypes.Point(cmds.pointPosition(*args, ... | |
#!/usr/bin/env python
# encoding: utf-8
"""
towerstruc.py
Created by <NAME> on 2012-01-20.
Copyright (c) NREL. All rights reserved.
HISTORY: 2012 created
-7/2014: R.D. Bugs found in the call to shellBucklingEurocode from towerwithFrame3DD. Fixed.
Also set_as_top added.
-10/2014: R.D. Merged back with some changes ... | |
but the list of '
f'legend_labels is length {len(legend_labels)}.'
)
else:
legend_labels = self.categories
try:
self.ax.legend(
patches, legend_labels, numpoints=1,
**legend_kwargs, **addtl_legend_kwargs
)
except TypeError:
raise ValueError(
f'The plot is in categorical legend mode, implying a '
f'"matplot... | |
"""
This module generates Inverse Discrete Hartley Transform matrix (IDHT). |br|
Frequencies represented by the rows of the generated IDHT matrix:
freq. (cos) (sin)
^ /. /.
| / . / .
| / . / .
| / . / .
| / . / .
| / . / .
| / . / .
| / . / .
|/ . / .
|1-------N----------2N---> indices of columns
.
N +... | |
import argparse
import random
import os
import time
import datetime
import itertools
import numpy as np
import torch
from torch import nn, autograd, optim
from torch.nn import functional as F
from torch.utils import data
from torchvision import transforms, utils
from model import Generator, Discriminato... | |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use... | |
<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
from __future__ import unicode_literals, division, absolute_import, print_function
from .compatibility_utils import PY2, bstr, utf8_str
if PY2:
range = xrange
import os
import struct
# note: struct pa... | |
<reponame>mhilton/juju-charm-helpers
import io
import os
import contextlib
import unittest
from copy import copy
from tests.helpers import patch_open
from testtools import TestCase
from mock import MagicMock, patch, call
from charmhelpers.fetch import ubuntu as fetch
from charmhelpers.core.hookenv import flush
import... | |
samples1 = param.draw_samples((10, 5), random_state=np.random.RandomState(1234))
samples2 = param.draw_samples((10, 5), random_state=np.random.RandomState(1234))
assert np.array_equal(samples1, samples2)
def test_parameters_Poisson():
reseed()
eps = np.finfo(np.float32).eps
param = iap.Poisson(1)
sample = para... | |
trees are considered the same if they are structurally
identical, and the nodes have the same value.
Example 1:
(1) (1)
/ \ / \
(2) (3) (2) (3)
Input: p = [1,2,3], q = [1,2,3]
Output: true
Example 2:
Input: p = [1,2], q = [1,null,2]
Output: false
Example 3:
Input: p = [1,2,1], q = [1,1,2]
Output: false
... | |
##### Folder Cleaner
#####
##### © <NAME> - 2020
##### for Python 3
#####
from subprocess import check_output # Using this import just to install the dependencies if not.
# I will only use my two libraries filecenter and lifeeasy and will not import anything else after they are installed.
# IMPORTS
try:
import file... | |
# -*- coding: utf-8 -*-
from __future__ import with_statement
from django.contrib.sites.models import Site
from cms.utils.urlutils import admin_reverse
from djangocms_text_ckeditor.models import Text
from django.core.cache import cache
from django.core.management.base import CommandError
from django.core.management im... | |
solstice). Invert a
light curve from one orbital phase and you will also fit some
East-West structure of the kernel, like the longitudinal width.
Or invert from two different phases and you fit some North-South
structure, like the **change in** dominant colatitude. So, kernel
characteristics help us estimate const... | |
disp_staging_sts_operation = {
k : get_message(v,request.user.get_lang_mode(), showMsgId=False)
for k,v in RuleDefs.DISP_STAGING_STS_OPERATION.items()
}
data = {
'msg': msg,
'now': now,
'staging_list': staging_list,
'staging_history_list': staging_history_list,
'apply_rule_manage_id_dic': apply_rule_manage_id... | |
data over the connection.
# - We really should wrap a do/try loop around this, so if the send fails,
# that will be handled gracefully. (E.g., if the send fails, do we really
# want to raise the 'sent' flag?)
msg.sent.rise() # Announce that this message has been sent (if anyone cares).
#<------
#|-------------... | |
created by the service api backend with the allocated nodePort. Will use user-specified nodePort value if specified by the client. Only effects when Type is set to LoadBalancer and ExternalTrafficPolicy is set to Local.
"""
return pulumi.get(self, "health_check_node_port")
@health_check_node_port.setter
def health... | |
in range(len(RBbasis)):
u = RBbasis[i]
if isinstance(bilinear_part, LincombOperator) and self.fin_model is False:
for j, op in enumerate(bilinear_part.operators):
rhs_operators.append(VectorOperator(op.apply(u)))
rhs_coefficients.append(ExpressionParameterFunctional('basis_coefficients[{}]'.format(i),
{'basis_coe... | |
# -*- coding: utf-8 -*-
'''
Module: jelephant.analysis.sta
Contains functions to calculate spike-triggered averages of AnalogSignals.
'''
import numpy as np
import scipy.signal
import quantities as pq
from neo.core import AnalogSignal, AnalogSignalArray
if __name__ == '__main__':
pass
#========================... | |
<gh_stars>10-100
# Apache v2 license
# Copyright (C) 2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# This file is copied from https://github.com/clovaai/length-adaptive-transformer
# coding=utf-8
# Length-Adaptive Transformer
# Copyright (c) 2020-present NAVER Corp.
# Apache License v2.0
#####
# Ori... | |
<gh_stars>10-100
# Copyright (C) 2019 by eHealth Africa : http://www.eHealthAfrica.org
#
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with
... | |
<reponame>verypluming/SyGNS
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script computes an F-score between two DRSs. It is based on and very similar to SMATCH.
For detailed description of smatch, see http://www.isi.edu/natural-language/drs/smatch-13.pdf
As opposed to AMRs, this script takes the clauses dir... | |
"""Common classes and functions."""
from datetime import tzinfo
from enum import Enum, IntEnum
from typing import (
Any,
Callable,
Dict,
NamedTuple,
Optional,
Tuple,
Type,
TypeVar,
Union,
cast,
)
import arrow
from arrow import Arrow
from dateutil import tz
from .const import (
STATUS_AUTH_FAILED,
STATUS_... | |
<filename>sdk/python/pulumi_alicloud/clickhouse/db_cluster.py
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import An... | |
not None
nbin = edges.shape[0]+1
if weighted:
count = zeros(nbin, dtype=w.dtype)
if normed:
count = zeros(nbin, dtype=float)
w = w/w.mean()
else:
count = zeros(nbin, int)
binindex = digitize(a, edges)
# Count the number of identical indices.
flatcount = bincount(binindex, w)
# Place the count in the hist... | |
#!/usr/bin/env python
#
# Copyright (c) 2019 Idiap Research Institute, http://www.idiap.ch/
# Written by <NAME> <<EMAIL>>
#
"""Download the Swedish Traffic Signs dataset and create the Speed Limit Signs
dataset from and train with attention sampling.
NOTE: Swedish Traffic Signs dataset is provided from
https://www.c... | |
HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.things_v2_show(id, async_req=True)
>>> result = thread.get()
:param async_req bool: execute request asynchronously
:param str id: The id of the thing (required)
:param bool show_deleted: If true, shows the ... | |
from __future__ import division, absolute_import, print_function
from past.builtins import xrange
import numpy as np
import esutil
import time
import matplotlib.pyplot as plt
from .fgcmUtilities import objFlagDict
from .fgcmUtilities import obsFlagDict
from .sharedNumpyMemManager import SharedNumpyMemManager as snm... | |
<reponame>desihub/desisurvey
"""Manage static information associated with tiles, programs and passes.
Each tile has an assigned program name. The program names
(DARK, BRIGHT) are predefined in terms of conditions on the
ephemerides, but not all programs need to be present in a tiles file.
Pass numbers are arbitrary in... | |
from abc import ABCMeta, abstractmethod
from typing import Dict, List, Tuple
from . import violation
from .violation import Violation
from sqlint.config import Config
from sqlint.syntax_tree import SyntaxTree, Node
from sqlint.parser import Token
from sqlint.parser.keywords import format as format_keyword
class Chec... | |
import json
import requests
from http import client as http_client
import pickle
import os
from bs4 import BeautifulSoup
from factorial.exceptions import AuthenticationTokenNotFound, UserNotLoggedIn, ApiError
import hashlib
import logging
import logging.config
import random
from datetime import date
from constants impo... | |
<reponame>pulumi/pulumi-databricks
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Seque... | |
<filename>tests/metrics/test_metrics.py
import unittest
import numpy as np
from sklearn.metrics import accuracy_score, f1_score, fbeta_score, precision_score, recall_score
import torch
from src.metrics import AccuracyMeter, F1Meter, FbetaMeter, PrecisionMeter, RecallMeter, \
MeanIntersectionOverUnionMeter, far, frr,... | |
import logging
import os
import pandas as pd
from brownie import Contract, chain, convert, web3
from pandas.core.frame import DataFrame
from requests import get
from ypricemagic import magic
from ypricemagic.utils.utils import Contract_with_erc20_fallback
from eth_abi import encode_single
moralis = 'https://deep-ind... | |
r"""
根据条件将当前 OID 选择集和另一个 OID 选择集进行集合操作,并得到新的 OID 选择集对象:type pSrcSet: :py:class:`GsSelectionSet`
:param pSrcSet: 需要合并操作的选择集:type eOperation: int
:param eOperation: 合并操作类型 :rtype: GsSmarterPtr< GsSelectionSet >
:return: 返回新的选择集
"""
return _gskernel.GsSelectionSet_Combine(self, pSrcSet, eOperation)
__swig_de... | |
<reponame>sagnik/hub
"""Utilities for running MRC
This includes some utilities for MRC problems, including an iterable PyTorch loader that doesnt require examples
to fit in core memory.
"""
import numpy as np
from eight_mile.utils import Offsets, Average, listify
from eight_mile.pytorch.layers import WithDropout, Den... | |
__all__ = [
"eval_nls",
"ev_nls",
"eval_min",
"ev_min",
]
from grama import add_pipe, pipe, custom_formatwarning, df_make
from grama import eval_df, eval_nominal, eval_monte_carlo
from grama import comp_marginals, comp_copula_independence
from grama import tran_outer
from numpy import Inf, isfinite
from numpy.rand... | |
from datetime import datetime, timezone
from typing import Union, List, Dict, Tuple
from .covidstatistics import *
from .exceptions import NotFound, BadSortParameter, BadYesterdayParameter, BadTwoDaysAgoParameter, BadAllowNoneParameter
from .covidendpoints import *
class Covid:
"""
Handles interactions with the Ope... | |
'',
'next': '',
'page': 1,
})
self.assertAPINotes(resp_json, self.normal.note_set.order_by(Note.id))
# do a filter following a join
resp = self.app.get('/api/note/?user__username=admin&ordering=id')
resp_json = self.response_json(resp)
self.assertAPIMeta(resp_json, {
'model': 'note',
'previous': '',
'next'... | |
# -*- coding: utf-8 -*-
"""
Parsing of grammar files
"""
from typing import Tuple, List, Iterable, FrozenSet, Any
from pyramids.categorization import Category, Property, LinkLabel
from pyramids.rules.conjunction import ConjunctionRule
from pyramids.rules.last_term_match import LastTermMatchRule
from pyramids.rules.o... | |
<reponame>Jumpscale/sandbox_linux
# Copyright (c) 2013-2015 by <NAME> <<EMAIL>>.
# All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v1.0 which accompanies this
# distribution and is available at:
#
# http://www.eclipse.org/legal/epl-... | |
and nans in mag
# set to zero points that are not defined or inf
# and mark them on axis
isnan_arr = np.isnan(mag)
for i in range(x_len):
for j in range(y_len):
if isnan_arr[i, j]:
# colour this region as a shaded square
rect = patch.Rectangle((self.xg[i, j] - dist_points/2, self.yg[i, j] - dist_points/2), dist... | |
with the returned read value as
well as the completion:
oncomplete(completion, data_read)
:param object_name: name of the object to read from
:type object_name: str
:param length: the number of bytes to read
:type length: int
:param offset: byte offset in the object to begin reading from
:type offset: int
:p... | |
import re
import ssl
import sys
import json
import base64
import urllib2
import threading
from core.alert import *
from core._time import now
from subprocess import Popen, PIPE
from core.targets import target_type
from core.log import __log_into_file
devs = {};
ipList = []
httpPort = 80
debug = 0
scanid = ''
scancmd =... | |
of the TIN nodes.
distances: numpy real-type array with the distances between each connection in the TIN.
globalIDs: numpy integer-type array containing for local nodes their global IDs.
To solve channel incision and landscape evolution, the algorithm follows the O(n)-efficient ordering
method from Braun and Wille... | |
= tuple(size)
def transpose(self, method):
if method not in (FLIP_LEFT_RIGHT, FLIP_TOP_BOTTOM):
raise NotImplementedError(
"Only FLIP_LEFT_RIGHT and FLIP_TOP_BOTTOM implemented"
)
flipped_polygons = []
for polygon in self.polygons:
flipped_polygons.append(polygon.transpose(method))
return PolygonList(flippe... | |
# Copyright 2019 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | |
form a balanced incomplete block design.
Now, considering a multiplicative generator `z` of `GF(q^{d+1})`, we get a
transitive action of a cyclic group on our projective plane from which it is
possible to build a difference set.
The construction is given in details in [Stinson2004]_, section 3.3.
EXAMPLES::
s... | |
DB
Args:
user_id (str): user's fence email id
Returns:
bool: user in fence DB with user_email
"""
session = get_db_session(db)
user = (session.query(User).filter(User.email == user_email)).first()
return user
def user_has_access_to_project(user, project_id, db=None):
"""
Return True IFF user has access ... | |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use... | |
or of different materials connected by seams. Some or all of these materials can be
designed to fail when subjected to temperatures above a certain temperature range causing melting or some
other destructive process to occur to these materials. These failures can create access points from the
ceiling through the ... | |
#put the columns two at a time in a dataframe
# dataframe and visualization tools
import pandas as pd
import numpy as np
import matplotlib as mlp
import time
from matplotlib import pyplot as plt
import wx
import os
import numpy.polynomial.polynomial as poly
import statistics as stats
from statistics import mode
from ... | |
<filename>autotest/gcore/basic_test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test basic GDAL open
# Author: <NAME> <even dot rouault at mines dash paris dot org>
#
#################... | |
"""
raise NotImplementedError
def Save(self):
"""Saves the changes made to the record.
This performs an update to the record, except when `create_new` if set to
True, in which case the record is inserted.
Arguments:
% create_new: bool ~~ False
Tells the method to create a new record instead of updating a cur... | |
<filename>oks.py<gh_stars>1-10
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import os
import sys
import os.path
import datetime
import re
import locale
import gtk
import gobject
from core.output.handlers.string import StringOutputHandler
from core.output.handlers.view import ViewOutputHandler
import oks
from oks.db.m... | |
draws a resistor
parent: parent object
position: position [x,y]
value: string with resistor value. If it ends with 'ohm', 'OHM' or 'Ohm', proper Ohm symbol will be added. (Default 'R')
label: label of the object (it can be repeated)
angleDeg: rotation angle in degrees counter-clockwise (default 0)
flagVolt: i... | |
<filename>Engine/Extras/Maya_AnimationRiggingTools/MayaTools/General/Scripts/perforceUtils.py<gh_stars>1-10
import maya.cmds as cmds
from P4 import P4,P4Exception
import os, cPickle
from functools import partial
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def p4_getLatestRevi... | |
# -*- coding: utf-8 -*-
#
# This file is part of the python-chess library.
# Copyright (C) 2012-2019 <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Li... | |
<gh_stars>0
from logging import Logger
from os.path import join
from typing import Any, Dict, List, Optional, Union
import requests
import pandas as pd
from requests.exceptions import HTTPError
from .commons import figshare_stem, figshare_group
from .delta import Delta
from redata.commons.logger import log_stdout
#... | |
= map
def to_python(self, value):
return value
def to_url(self, value):
if isinstance(value, (bytes, bytearray)):
return _fast_url_quote(value)
return _fast_url_quote(str(value).encode(self.map.charset))
class UnicodeConverter(BaseConverter):
"""This converter is the default converter and accepts any string ... | |
<reponame>ckarageorgkaneen/pybpod-api
# !/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
import math
import socket
import sys
from confapp import conf as settings
from datetime import datetime as datetime_now
from pybpodapi.bpod.hardware.hardware import Hardware
from pybpodapi.bpod.hardware.channels import Ch... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Simple BPG Image viewer.
Copyright (c) 2014-2018, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain th... | |
"""Base class git action manager (subclasses will accommodate each type)"""
from peyotl.utility.str_util import is_str_type
from peyotl.nexson_syntax import write_as_json
from peyotl.utility import get_logger
import os
# noinspection PyUnresolvedReferences
from sh import git # pylint: disable=E0611
import shutil
import... | |
<filename>poker/hand.py
import re
import random
import itertools
import functools
from decimal import Decimal
from pathlib import Path
from cached_property import cached_property
from ._common import PokerEnum, _ReprMixin
from .card import Rank, Card, BROADWAY_RANKS
__all__ = [
"Shape",
"Hand",
"Combo",
"Range",
... | |
<gh_stars>0
# @copyright@
# Copyright (c) 2006 - 2018 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
import asyncio
import ipaddress
from itertools import filterfalse
import json
import logging
from logging.handlers import RotatingFi... | |
= settings.get_inv_multiple_req_items()
recurring = settings.get_inv_req_recurring()
req_status_writable = settings.get_inv_req_status_writable()
requester_label = settings.get_inv_requester_label()
transit_status = settings.get_inv_req_show_quantity_transit()
use_commit = settings.get_inv_use_commit()
use_req_nu... | |
#!/usr/bin/env impala-python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (th... | |
<reponame>steppi/gilda
"""This script benchmarks Gilda on the BioCreative VII BioID corpus.
It dumps multiple result tables in the results folder."""
import json
import os
from collections import defaultdict
from copy import deepcopy
from datetime import datetime
from functools import lru_cache
from textwrap import ded... | |
<reponame>HagaiHargil/python-ca-analysis-bloodflow<filename>calcium_bflow_analysis/calcium_over_time.py<gh_stars>0
"""
A module designed to analyze FOVs of in vivo calcium
activity. This module's main class, :class:`CalciumOverTime`,
is used to run
"""
from enum import Enum
from pathlib import Path
from collections imp... | |
out_data = in_data.copy()
# series
in_series = pd.Series(in_data)
out_series = pd.Series(out_data)
result = coerce_dtypes(in_series, float)
assert_series_equal(result, out_series)
# dataframe
in_df = pd.DataFrame({self.col_name: in_data})
out_df = pd.DataFrame({self.col_name: out_data})
result = coerce_dtyp... | |
import matplotlib
from maskgen.maskgen_loader import MaskGenLoader
from maskgen.ui.semantic_frame import SemanticFrame
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
matplotlib.use("TkAgg")
import logging
from matplotlib.figure import Figure
from Tkinter import *
import matplotlib.patches as mpatches
... | |
<gh_stars>1-10
# Copyright 2014 Huawei Technologies Co. Ltd
#
# 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 la... | |
2.0; Windows 3.1)',
'Opera/9.80 (Windows NT 5.1; U; en-US) Presto/2.8.131 Version/11.10',
'Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; rev1.5; Windows NT 5.1;)',
'Mozilla/5.0 (Windows; U; Windows CE 4.21; rv:1.8b4) Gecko/20050720 Minimo/0.007',
'BlackBerry9000/5.0.0.93 Profile/MIDP-2.0 Config... | |
r"""
Series constructor for modular forms for Hecke triangle groups
AUTHORS:
- Based on the thesis of <NAME> (2008)
- <NAME> (2013): initial version
.. NOTE:
``J_inv_ZZ`` is the main function used to determine all Fourier expansions.
"""
#***************************************************************************... | |
<reponame>ShegnkaiWu/IoU-aware-single-stage-object-detector-for-accurate-localization<filename>mmdet/models/anchor_heads/iou_aware_retina_head.py
import numpy as np
import torch.nn as nn
import torch
from mmcv.cnn import normal_init
from .anchor_head import AnchorHead
from ..utils import bias_init_with_prob, ConvModul... | |
= pp.Group(pp.Word("a")("A"))
bbb = pp.Group(pp.Word("b")("B"))
ccc = pp.Group(":" + pp.Word("c")("C"))
g1 = "XXX" + (aaa | bbb | ccc)[...]
teststring = "XXX b bb a bbb bbbb aa bbbbb :c bbbbbb aaa"
names = []
print(g1.parseString(teststring).dump())
for t in g1.parseString(teststring):
print(t, repr(t))
try:
... | |
<filename>httprunner/loader.py
import collections
import csv
import importlib
import io
import json
import os
import sys
import yaml
from httprunner import built_in, exceptions, logger, parser, utils, validator
from httprunner.compat import OrderedDict
sys.path.insert(0, os.getcwd())
project_mapping = {
"debugtalk"... | |
'.' + 'testMemeValidity'
Graph.logQ.put( [logType , logLevel.DEBUG , method , "entering"])
results = []
resultSet = []
#try:
testFileName = os.path.join(testDirPath, "Meme_Validity.atest")
readLoc = codecs.open(testFileName, "r", "utf-8")
allLines = readLoc.readlines()
readLoc.close
n = 0
memeValid = False
... | |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | |
#!/usr/bin/env python
# reference: c041828_ISO_IEC_14496-12_2005(E).pdf
##################################################
# reader and writer
##################################################
import struct
from io import BytesIO
def skip(stream, n):
stream.seek(stream.tell() + n)
def skip_zeros(stream, n):
a... | |
<reponame>dgasmith/EEX
"""
Contains the DataLayer class (name in progress) which takes and reads various pieces of data
"""
import copy
import json
import os
import numpy as np
import pandas as pd
from . import energy_eval
from . import filelayer
from . import metadata
from . import units
from . import utility
from ... | |
import os.path
from datetime import datetime
from unittest import mock
from unittest.mock import MagicMock
import chardet
import tablib
from core.admin import (
AuthorAdmin,
BookAdmin,
BookResource,
CustomBookAdmin,
ImportMixin,
)
from core.models import Author, Book, Category, EBook, Parent
from django.contrib.a... | |
<gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function
from __future__ import absolute_import
'''
author: <NAME>
organization: I2BM, Neurospin, Gif-sur-Yvette, France
organization: CATI, France
license: `CeCILL-B <http://www.cecill.info/licences/Licence_CeCILL_B-en.html>`_
'''
# T... | |
_booleancondition_ is not None:
self.set_booleancondition(_booleancondition_)
if _r_par_ is not None:
self.set_rpar(_r_par_)
def clone(self):
return AStatementCondition(self.clone_node(self._l_par_),
self.clone_node(self._booleancondition_),
self.clone_node(self._r_par_))
def apply(self, analysis):
analysis.... | |
SET CURRENTLY ACTIVE LAYER AS THE NEWLY CREATED LAYER
self.currently_active_fault_id = self.total_fault_count
# CREATE NEW LAYER OBJECT
new_fault = Fault()
# SOURCE NEW NODES FROM USER CLICKS
new_fault.id = self.currently_active_fault_id
new_fault.name = str('Fault')
new_fault.x_nodes = self.new_plotx
new_fau... | |
<filename>groups/bsl/bslmf/bslmf.gyp
{
'variables': {
'bslmf_sources': [
'bslmf_addconst.cpp',
'bslmf_addcv.cpp',
'bslmf_addlvaluereference.cpp',
'bslmf_addpointer.cpp',
'bslmf_addreference.cpp',
'bslmf_addrvaluereference.cpp',
'bslmf_addvolatile.cpp',
'bslmf_arraytopointer.cpp',
'bslmf_assert.cpp',
'bslmf_... | |
# -*- coding: utf-8 -*-
"""Functions for generating training data and training networks."""
from __future__ import division
from __future__ import print_function
import collections
import copy
import itertools
import logging
import random
# for debugging
logging.basicConfig(level=logging.DEBUG)
import matplotlib a... | |
<reponame>dib-lab/2018-snakemake-eel-pond
#! /usr/bin/env python
"""
Execution script for snakemake elvers.
"""
# ref: https://github.com/ctb/2018-snakemake-cli/blob/master/run
import argparse
import os
import sys
import pprint
import yaml
import glob
import collections
import snakemake
import shutil
import subprocess... | |
tcp --dport %s -j %s' % (self.port, chain_name))
ipt.add_rule('-A %s -d %s -j ACCEPT' % (chain_name, current_ip_with_netmask))
ipt.add_rule('-A %s ! -d %s -j REJECT --reject-with icmp-host-prohibited' % (chain_name, current_ip_with_netmask))
ipt.iptable_restore()
@lock.file_lock('/run/xtables.lock')
def delete(se... | |
3: [
# vertices
(0, 0), (0, 3), (3, 3), (3, 0),
# edges
(1, 0), (2, 0),
(3, 1), (3, 2),
(1, 3), (2, 3),
(0, 1), (0, 2),
# volume
(1, 1), (2, 1),
(1, 2), (2, 2),
],
}[self.order]
class GmshHexahedralElement(GmshTensorProductElementBase):
dimensions = 3
@memoize_method
def gmsh_node_tuples(self):
# gms... | |
<reponame>suryaavala/zen_search<filename>tests/test_entity_engine.py
import json
import os
import unittest
import pytest
from zensearch.entity_engine import Entity
from zensearch.exceptions import DuplicatePrimaryKeyError, PrimaryKeyNotFoundError
def write_to_file(content, file_name):
with open(file_name, "w") as f... | |
<gh_stars>0
from __future__ import annotations
import ctypes as ct
import os
from contextlib import contextmanager
from sys import executable as _python_interpretor
from typing import List
try:
# for use from outside the package, as a python package
from .pyomexmeta_api import PyOmexMetaAPI, eUriType, eXm... | |
<gh_stars>100-1000
import timeboard as tb
from timeboard.interval import Interval
from timeboard.exceptions import OutOfBoundsError, PartialOutOfBoundsError
import datetime
import pandas as pd
import pytest
def tb_10_8_6_hours(workshift_ref='start', worktime_source='duration'):
shifts = tb.Marker(each='D', at=[{'hou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.