input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
import telegram
import sqlite3
import function
import cardfunction
import thread_lock
import ast
import air
import drawmap
import os
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, CallbackQueryHandler, MessageHandler, Filters
org_dir = os.getcwd()
cl... | |
from datetime import datetime, date
import numpy
import pandas
import copy
import uuid
from past.builtins import basestring # pip install future
from pandas.io.formats.style import Styler
from functools import partial, reduce
from .offline import iplot, plot
from IPython.core.display import HTML, display
import pl... | |
complex numbers::
>>> mp.dps = 50
>>> erf(0.5)
0.52049987781304653768274665389196452873645157575796
>>> mp.dps = 25
>>> erf(1+j)
(1.316151281697947644880271 + 0.1904534692378346862841089j)
Evaluation is supported for large arguments::
>>> mp.dps = 25
>>> erf('1e1000')
1.0
>>> erf('-1e1000')
-1.0
>>> erf(... | |
will serve as the App Mesh proxy.
"""
return pulumi.get(self, "container_name")
@property
@pulumi.getter
def properties(self) -> Optional[Mapping[str, str]]:
"""
Set of network configuration parameters to provide the Container Network Interface (CNI) plugin, specified a key-value mapping.
"""
return pulumi.ge... | |
<filename>nipype/interfaces/base/traits_extension.py
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
Traits extension
................
This module contains Trait classes that we've pulled from the
traits source and fixed due ... | |
<reponame>bogdandm/attrs-api-client<gh_stars>100-1000
import argparse
import configparser
import importlib
import itertools
import json
import os.path
import re
import sys
from collections import defaultdict
from datetime import datetime
from pathlib import Path
from typing import Any, Callable, Dict, Generator, Iterab... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Zinc grammar specification.
# (C) 2016 VRT Systems
#
# vim: set ts=4 sts=4 et tw=78 sw=4 si:
import datetime
import logging
import re
import sys
import iso8601
import pyparsing as pp
import six
# Bring in special Project Haystack types and time zones
from .datatypes import ... | |
Don't want a box frame
for t in leg.get_texts(): # Reduce the size of the text
t.set_fontsize(PlotScripts.global_legendsize)
outputFile = './%s%s' %(output_tag, output_format)
plt.savefig(outputFile, bbox_inches='tight') # Save the figure
print('Saved file to {0}'.format(outputFile))
plt.close()
if (paper_plo... | |
<filename>zaza/openstack/utilities/series_upgrade.py
# Copyright 2020 Canonical 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 ... | |
' database: [20]')
@patch('charmhelpers.contrib.openstack.utils.port_has_listener')
@patch.object(openstack, 'juju_log')
@patch('charmhelpers.contrib.openstack.utils.status_set')
@patch('charmhelpers.contrib.openstack.utils.is_unit_paused_set',
return_value=False)
def test_set_os_workload_status_complete_ports_n... | |
getTransmitterCWFrequencyRes(cls):
return None if not cls.transmitterSupportsCW() else cls.txType.toneGenType.frqRes
##
# \brief Gets the CW tone generator amplitude range for transmitters on the radio.
#
# \copydetails CyberRadioDriver::IRadio::getTransmitterCWAmplitudeRange()
@classmethod
def getTransmitterCW... | |
<gh_stars>0
#!/usr/bin/env python
# Copyright (c) 2011-2020, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
"""
Zonal Statistics
^^^^^^^^^^^^^^^^
This module supports you in computing statistics over spatial zones. A typical
application would be to compute mean areal precipita... | |
has over lap with tasks
while True:
doorbell = self.dp_sched_mail_box.when_any()
yield doorbell
# rejected or permitted tasks
dp_processed_task_idx = []
# ensure the scheduler is really lazy to process getter, wait for all quota incremented
assert (
self.env.peek() != self.env.now
or self.env._queue[0][1] == ... | |
MD5 Authentication TLV
h = data[offset+tlv_length+2-16:] # MD5 hash, last 16 bytes
salt = salt + data[offset:offset+tlv_length+2].replace(h, "\x00" * 16)
uses_authentication = True
offset = offset + tlv_length + 2
else:
break
except:
break
if uses_authentication:
sys.stdout.write("%d:$hsrp$%s$%s\n" % (index,... | |
"sim2": "Comparison Run", "m1": r"$M_{\text{ej}}^a$", "m2": r"$M_{\text{ej}}^b$", "tmax":r"$t_{\text{max}}$", "err":r"$\Delta$"}
# precs = ["", "", ".2f", ".2f", ".1f", "d"]
#
# size = '{'
# head = ''
# for i, v_n in enumerate(cols):
# v_n = lbl_dic[v_n]
# size = size + 'c'
# head = head + '{}'.format(v_n)
# if v_n != ... | |
<gh_stars>0
import os
import pickle
import os
import pickle
import argparse
import time
import subprocess
import shutil
import torch
from torch.autograd import Variable
import numpy as np
from utils import DataLoader
from helper import getCoef, sample_gaussian_2d, get_mean_error, get_final_error
from helper import *
... | |
8)
# Bits reserved_0
# Bits PA_LEVEL_7
# Output power level for 7th slot.
# Register PA_POWER6
def setPA_POWER6(self, val):
"""Set register PA_POWER6"""
self.write(REG.PA_POWER6, val, 8)
def getPA_POWER6(self):
"""Get register PA_POWER6"""
return self.read(REG.PA_POWER6, 8)
# Bits reserved_0
... | |
<filename>instmakelib/instmake_log.py
# Copyright (c) 2010 by Cisco Systems, Inc.
"""
Variables and functions to aid in reading instmake logs.
"""
from __future__ import nested_scopes
import cPickle as pickle
import sys
import os
import gzip
import socket
from instmakelib import instmake_toolnames
from instmakelib imp... | |
with data types which are not safe to be stored in text form
(i.e. BLOB) are converted to Base64, hence the size of such columns
cannot exceed approximately 0.74 * max_allowed_packet bytes, as
configured through that system variable at the target server.
Details
This operation writes table data dump to the speci... | |
# loop until the entire file is read
while not end_of_file:
# read up to the start of a record by finding the sync marker
end_of_file = self.find_record_start()
if end_of_file:
# make sure we break out of this loop if there are no more bytes in the file
continue
# now that the sync marker has been found, get t... | |
to a the right space before
using the :class:`Averager` object, and also automates the
boundary recovery process. If no boundary method is specified,
this simply performs the action of the :class: `Averager`.
:arg v_in: the :class:`ufl.Expr` or
:class:`.Function` to project. (e.g. a VDG0 function)
:arg v_out: :c... | |
# Copyright (c) 2013 Rackspace, Inc.
# Copyright (c) 2015 Catalyst IT 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 b... | |
<reponame>HDRUK/schemata<filename>docs/dataset/2.0.0/impact-assessment/generated_mapping.py
#### START DEFINE MAPPING v1 --> v2 ####
def map_identifier(dm_v1, dm_v2):
dm_id = dm_v1.get('id', None)
if dm_id:
dm_v2['identifier'] = f"https://web.www.healthdatagateway.org/dataset/{dm_id}"
def map_version(dm_v1, dm_v2)... | |
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 5 14:59:30 2016
@author: alex
"""
from AlexRobotics.dynamic import Hybrid_Manipulator as HM
from AlexRobotics.control import ComputedTorque as CTC
from AlexRobotics.estimation import ManipulatorDisturbanceObserver as OBS
import numpy as np
'''
#######################... | |
0.00032777508],
[1447.06506, 0.00107791089, 0.000314022414],
[1467.23621, 0.00104861567, 0.000300961867],
[1487.68884, 0.00102122454, 0.00028841052],
[1508.42639, 0.00099408708, 0.000274052145],
[1529.453, 0.000966451073, 0.000259600638],
[1550.77271, 0.0009381891, 0.000246109441],
[1572.38977, 0.000909807102, 0... | |
<reponame>virbickt/tlc-data-pipeline
import os
import time
import pyodbc
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.sql import SqlManagementClient
from dotenv import find_dotenv, load_dotenv
load_dotenv(find_dotenv())
cla... | |
<reponame>ecdavis/pants<filename>pants/server.py
###############################################################################
#
# Copyright 2011-2012 Pants Developers (see AUTHORS.txt)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) The Lab of Professor <NAME> (<EMAIL>),
# School of Computer Science and Engineering, South China University of Technology.
# A-Tune is licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You ... | |
from copy import deepcopy
from json import dumps
from re import IGNORECASE, escape, findall
from typing import (
Dict,
Iterable,
Iterator,
List,
MutableMapping,
Optional,
Tuple,
Type,
Union,
)
from kiss_headers.structures import CaseInsensitiveDict
from kiss_headers.utils import (
extract_comments,
header_c... | |
n_Ex_b = (gx_mask[occb]).sum() + (ux_mask[occb]).sum()
n_Ey_b = (gy_mask[occb]).sum() + (uy_mask[occb]).sum()
if abs(n_Ex_a - n_Ey_a) == 1 and abs(n_Ex_b - n_Ey_b) == 1:
# open-shell for both alpha det and beta det e.g. the
# valence part of O2 molecule
addr_x_a, addr_y_a = search_open_shell_det(occa)
addr_x_b, ... | |
<filename>worldcupper.py<gh_stars>0
"""
https://www.fifaindex.com/teams/?type=1
https://www.fifaindex.com/teams/fifa07_3/?league=78&type=1
https://www.fifaindex.com/teams/fifa06_2/?league=78&type=1
Attacks per game - average unknown
Number of attacks,
Goals per game
http://www.slate.com/articles/sports/sports_nut/201... | |
import os
from pathlib import Path
import joblib
import pandas as pd
import numpy as np
from multiprocessing import Pool
from collections import defaultdict
import functools
import re
import sys
sys.path.insert(0, './code')
from utils import DataLogger # noqa: E402
class DataNotFoundException(Exception):
pass
... | |
from operator import add, sub
import numpy as np
from scipy.stats import norm
class Elora:
def __init__(self, times, labels1, labels2, values, biases=0):
"""
Elo regressor algorithm for paired comparison time series prediction
Author: <NAME>
Args:
times (array of np.datetime64): comparison datetimes
labels1... | |
weights to use for both CNTK and ELL layers
# CNTK has these in filters, channels, rows, columns order
weightValues = np.random.uniform(
low=-5, high=5, size=(5, 2, 3, 3)).astype(np.float32)
# create an ELL Tensor from the cntk weights, which re-orders the
# weights and produces an appropriately dimensioned tenso... | |
a is defined in aSet
# As a result, any option defined as 'a' will be used if the
# user specifies the 'b'
ret = a in aSet
if ret:
if b in bSet:
raise OptionMatcherException(
'Bad alias:' + a + '/' + b + ' in ' + self.describe())
bSet.add(b)
for each in self.flags, self.options, self.prefixes:
try:
each[b] =... | |
return directory_list
def old_list_directory(self, encoded_pathspec, recursive=False):
"""Lists a directory using a pathspec or list of pathspecs"""
directory_list = []
pathspec = PathspecHelper._decode_pathspec(encoded_pathspec)
directory_list.extend(self._list_directory(
resolver.Resolver.OpenFileEntry(pathsp... | |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
####################
# Interface to NetworkOwl device
# Reads solar PV generation, electricity usage, weather, heating & hot water data & updates device states
# Reads 3 phases if device type is Intution-lc
# V1.6 16 January 2018
# https://smudger4.github.io
#
#
# v1.6: re... | |
# Copyright 2019 DeepMind Technologies Limited.
#
# 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 ... | |
devices is set to be RTSI 7. Note: If the reference
clock source is set to a value other than None,
configure_for_homogeneous_triggers cannot configure the reference
clock source. Start Triggers If the start trigger is set to None (no
trigger configured) for all sessions, the sessions are configured to
share the s... | |
<filename>powerprotect/assetsource.py<gh_stars>0
import paramiko
from powerprotect.ppdm import Ppdm
from powerprotect.credential import Credential
from powerprotect import exceptions
from powerprotect import get_module_logger
from powerprotect import helpers
assetsource_logger = get_module_logger(__name__)
assetsource... | |
<gh_stars>0
import getpass
import json
import requests
import urllib.request, urllib.parse, urllib.error
import app_setup
import queue
import threading
class Robinhood:
endpoints = {
"login": "https://api.robinhood.com/api-token-auth/",
"investment_profile": "https://api.robinhood.com/user/investment_profile/",
... | |
# -*- coding: utf-8 -*-
"""
# @Time : 24/10/18 2:40 PM
# @Author : <NAME>
# @FileName: plot_result.py
# @Software: PyCharm
# @Github : https://github.com/hzm2016
"""
import collections
import matplotlib.pyplot as plt
import numpy as np
import pickle
import copy as cp
from baselines.deepq.assembly.src.value_functions im... | |
replaced.')
cls._disable_account()
auth_client = AuthClient(credentials.token,
credentials.base_url,
**credentials.connection_parameters())
service_urls = auth_client.current_service_urls()
user_hubs = auth_client.user_hubs()
preferences = preferences or {}
for hub_info in user_hubs:
# Build credentials.
prov... | |
<reponame>jnthn/intellij-community<gh_stars>100-1000
#
# epydoc.css: default epydoc CSS stylesheets
# <NAME>
#
# Created [01/30/01 05:18 PM]
# $Id: html_css.py 1634 2007-09-24 15:58:38Z dvarrazzo $
#
"""
Predefined CSS stylesheets for the HTML outputter (L{epydoc.docwriter.html}).
@type STYLESHEETS: C{dictionary} fro... | |
import logging
import time
import io
import pickle
import multiprocessing
import bagua_core as B
from bagua.service import AutotuneService
from . import env
from .env import (
get_master_addr,
get_world_size,
get_rank,
get_local_rank,
get_node_rank,
get_default_bucket_size,
get_bagua_service_port,
get_autotune_... | |
<reponame>mbmetcalfe/Abbot<gh_stars>0
#!/usr/local/bin/python3.6
import discord
from discord.ext import commands
from discord.ext.commands.bot import _get_variable
from config import Config, ConfigDefaults
from permissions import Permissions, PermissionsDefaults
from utils import load_file, write_file, sane_round_int
... | |
255, 255, 255],
10477: [255, 255, 0, 0, 255, 255, 255, 255],
10478: [15, 15, 240, 240, 255, 255, 255, 255],
10479: [255, 255, 240, 240, 255, 255, 255, 255],
10480: [0, 0, 15, 15, 15, 15, 255, 255],
10481: [240, 240, 15, 15, 15, 15, 255, 255],
10482: [0, 0, 255, 255, 15, 15, 255, 255],
10483: [240, 240, 255, 255,... | |
<filename>modes/Particles/zoe.py
#!/usr/local/bin/python
#
# $Id: //projects/zoe/zoe.py#1 $ $Date$
"""
A simple OpenGL rendering engine.
"""
__program__ = 'zoe'
__version__ = '1.0a'
__url__ = 'http://www.alcyone.com/pyos/zoe/'
__author__ = '<NAME> <<EMAIL>>'
__copyright__ = 'Copyright (C) 2000-2002 <NAME>'
__license_... | |
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import numpy as np
>>> import pandas as pd
>>> import random
>>> import matplotlib.pyplot as plt
>>> t_1= pd.read_excel("C:/Users/BrettData/De... | |
<gh_stars>10-100
#!/usr/bin/python
# -*- coding: utf-8 -*-
from abra.config import DEFAULT_ALPHA, logger
from abra.mixin import InitRepr
from statsmodels.stats.api import DescrStatsW, CompareMeans
from statsmodels.distributions.empirical_distribution import ECDF
from statsmodels.stats.power import tt_ind_solve_power, z... | |
= "", sPassword = "", cbSize = 0, eFileType = 0):
tdTestGuestCtrlBase.__init__(self);
self.oCreds = tdCtxCreds(sUser, sPassword, sDomain = "");
self.sFile = sFile;
self.cbSize = cbSize;
self.eFileType = eFileType;
class tdTestFileIO(tdTestGuestCtrlBase):
"""
Test for the IGuestFile object.
"""
def __init__(se... | |
<gh_stars>1-10
"""
CanvasSync by <NAME>
February 2017
---------------------------------------------
user_prompter.py, module
A collection of functions used to prompt the user for settings.
"""
# TODO
# - Comments
# - Make a Y/N function to reduce code redundancy
# Future
from __future__ import print_function
# I... | |
<reponame>shJimmyw/MacAndCheese
import discord
import DiscordCredentials
import asyncio
import requests
import json
import string
import youtube_dl
import time
import random
import logging
from player import vidPlayer
from discord.ext.commands import Bot
logger = logging.getLogger('discord')
logger.setLevel(logging.DE... | |
# Copyright 2019-2021 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | |
source,
str((3, 6)): a.dis_code(shu.__code__, shu, (3, 6, 1)),
}
expected_new = old.copy()
expected_new["_version"] = 3
expected_new[str(sys.version_info[:2])] = (
a.dis_code(shu.__code__, shu, sys.version_info),
"",
)
assert expected_new != old
with pytest.raises(ppg.NothingChanged) as e:
a.run(None, None)
... | |
'zipcode': 458000},
2714: {'name': '凤泉区', 'pid': 246, 'zipcode': 453700},
2715: {'name': '卫滨区', 'pid': 246, 'zipcode': 453700},
2716: {'name': '卫辉市', 'pid': 246, 'zipcode': 453700},
2717: {'name': '原阳县', 'pid': 246, 'zipcode': 453700},
2718: {'name': '封丘县', 'pid': 246, 'zipcode': 453700},
2719: {'name': '延津县', 'p... | |
skip_save_training_statistics: (bool, default: `False`) disables
saving training statistics JSON file.
:param skip_save_model: (bool, default: `False`) disables
saving model weights and hyperparameters each time the model
improves. By default Ludwig saves model weights after each epoch
the validation metric improv... | |
"""Normalization helper functions"""
from __future__ import absolute_import, print_function, division
import numpy as np
from cddm.conf import CDTYPE, FDTYPE
from cddm.print_tools import print1,print2, enable_prints, disable_prints
from cddm._core_nb import _normalize_cdiff_1,_normalize_cdiff_3,\
_normalize_ccorr_... | |
<reponame>ciex/souma
import logging
import json
from dateutil.parser import parse as dateutil_parse
from uuid import uuid4
from nucleus import create_session, notification_signals, PersonaNotFoundError, UnauthorizedError, VesicleStateError, CHANGE_TYPES
from nucleus.models import Persona, Star, Planet, Starmap, Group... | |
<filename>Machine_Learning/K_Fold_Cross_Validation.py
#!/usr/bin/env python
# coding: utf-8
# # Tarea #3
# # Estudiante: <NAME>
# ## Importando bibliotecas
# In[1]:
import os
import pandas as pd
import numpy as np
from sklearn.svm import SVC
from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_... | |
'''
def run_process_stdinput(args_lst, byte_obj):
try:
if args.verbosity > 0:
print("Trying to execute the following command with input from " +
"STDIN:")
print(" ".join(args_lst))
result = subprocess.run(args_lst, input=byte_obj,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if args.verbosity > 0:
print("... | |
<reponame>Annie201/pywikibot-core<filename>tests/tools_ip_tests.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Test IP module/regex."""
#
# (C) Pywikibot team, 2012-2015
#
# Distributed under the terms of the MIT license.
from __future__ import unicode_literals
__version__ = '$Id: b9c364602d083b989181228423d61cf6f2a5... | |
import tkinter
from math import sqrt, sin, cos, atan, radians, pi
from evolution import *
def magnitude(vector):
# Take a list/tuple that represents a vector and return its magnitude.
return sqrt(sum([i ** 2 for i in vector]))
def direction(td_vector):
# Take a 2d vector (list with two elements) and return the an... | |
# -*- coding: utf-8 -*-
"""
***************************************************************************
repo.py
---------------------
Date : November 2013
Copyright : (C) 2013-2016 Boundless, http://boundlessgeo.com
***************************************************************************
* *
* This program is f... | |
(q1+q2)*B[(2, 1)] + (q1+q2)*B[(3, 0)] + q1*B[(0, 3)]
For `T_0`, we can note that, in the projection, `\delta`
is mapped to `q`::
sage: T[0](x)
(-q^2*q1-q^2*q2)*B[(1, 2)] + (-q*q1-q*q2)*B[(2, 1)] + (-q^3*q2)*B[(0, 3)]
Note that there is no translation part, and in particular
1 is an eigenvector for all `T_i`'s:... | |
################################################################################
# #
# Author: #
# #
# <NAME>, PhD #
# Senior Specialist #
# RedCastle Resources, Inc. #
# Working onsite at: #
# USDA Forest Service #
# Remote Sensing Applications Center (RSAC) #
# 2222 West 2300 South #
# Salt Lake City, UT 84119 #
# Of... | |
the main program window.
This [unfortunately] needs to rely on a search methodology to target entry field widgets that need updating,
because they can be destroyed and re-created (thus, early references to existing widgets can't be trusted). """
# Convert the value to a bytearray and create a list
new... | |
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client.transport.enable_secret_version), "__call__"
) as call:
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
resources.SecretVersion()
)
await client.enable_secret_version(request)
# Establish that the ... | |
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6
W -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6
Y -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 6
A C D E F G H I K L M N P Q R S T V W Y""",
)
mat = SubsMat.SeqMat(MatrixInfo.johnson)
self.assertEqual(len(mat), 210)
self.checkMatrix(
mat,
"""\
... | |
= PickPlace
option_vars = []
def place_on_table_sampler(state: State, goal: Set[GroundAtom],
rng: np.random.Generator,
objs: Sequence[Object]) -> Array:
# Always at the current location.
del goal, rng # this sampler is deterministic
assert len(objs) == 1
held_obj = objs[0]
x = state.get(held_obj, "pose") + st... | |
__project__ = 'OCRErrorCorrectpy3'
__author__ = 'jcavalie'
__email__ = "<EMAIL>"
__date__ = '6/23/14'
import os
import pickle
import gc
import string
from collections import deque
import math
from difflib import SequenceMatcher
import regex
from nltk.probability import ConditionalFreqDist
from ParallelOCRalign_Globa... | |
compute now
# Load reference point value @ w_iter
# refpath_ptr = [prev_idx, curr_xr]
if xr_detect_activated:
ref_zn = ref_path_get_BS(
Zn_path, w_iter,
has_xr, ref_index_xr, refx_xr, refy_xr, refpath_ptr,
out_is_xr, out_xr, 0, 1
)
ref_xn_xr, ref_yn_xr = ensure_xr_BS(
ref_zn, out_xr[0], out_xr[1], out_is_xr[0... | |
'''
Created on Oct 10, 2020
@author: Bill
'''
import csv
import datetime
import os
import shapefile
from distro import linux_distribution
from pip._internal.vcs import git
from OWI_sqlfile import execute_statements_from_file
from OWI_sqlite import c4db
from OWI_config import OWI_version_40 as C
from OWI_config impor... | |
<reponame>Del9fina/robel
# Copyright 2019 The ROBEL 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 l... | |
' * alignment
tags = get_tag(addr)
prefix = line_prefix(addr)
else:
alignment = 0
for i in range(length):
if ((i + alignment) % bpl) == 0:
flush()
prefix = line_prefix(addr + i)
line = chars = ""
tags = get_tag(addr + i)
if ((i + alignment) & 1) == 0:
line += ' '
val = source.get_byte(addr + i)
ch = "."
... | |
include extra space flag is set,
# the command line is not empty or invalid
# and the last element in the command line is a
# space character
if include_extra_space and command_line and command_line[-1] == " ":
# adds an empty element to the line split
# representing the extra space
line_split.append("")
... | |
<reponame>joshua-gould/anndata
from __future__ import annotations
from os import PathLike
from collections.abc import Mapping
from functools import partial
from typing import Union
from types import MappingProxyType
from warnings import warn
import h5py
import numpy as np
import pandas as pd
from scipy import sparse
... | |
"""Generator of dynamically typed draft stubs for arbitrary modules.
Basic usage:
$ mkdir out
$ stubgen urllib.parse
=> Generate out/urllib/parse.pyi.
For Python 2 mode, use --py2:
$ stubgen --py2 textwrap
For C modules, you can get more precise function signatures by parsing .rst (Sphinx)
documentation for e... | |
<reponame>migleankstutyte/kaavapino<gh_stars>1-10
import copy
import datetime
import numpy as np
from typing import List, NamedTuple, Type
from actstream import action
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.core.serializers.json import DjangoJSO... | |
<gh_stars>1-10
# Standard Library
import copy
import enum
import json
import re
from typing import Any, List, Mapping, Optional, Tuple, Union
# Third Party
from loguru import logger
from pydantic import BaseModel, Field, root_validator
# Local
import bel.core.settings as settings
import bel.db.arangodb
import bel.ter... | |
<reponame>dotupNET/ghcloneall<filename>tests.py
import os
import re
import subprocess
import sys
try:
from cStringIO import StringIO
except ImportError: # pragma: PY3
from io import StringIO
import pytest
import requests
import requests_cache
import ghcloneall
class MockResponse:
def __init__(self, status_code... | |
univariate
# statistics and their confidence limits, but no multivariate
# statistic.
statistics = {"tests_passed": _passed,
"R": _R, # Univariate PSRFs
"confidence_limits": _Ru} # Univariate confidence limits
return _test, statistics
def _multivariate_R(self, X):
L, N, M = X.shape
fN = float(N)... | |
<reponame>ameet-1997/Prioritized_Experience_Replay
#!/usr/bin/python
# -*- encoding=utf-8 -*-
# author: Ian
# e-mail: <EMAIL>
# description:
import sys
import math
import random
import numpy as np
from baselines.her.binary_heap import BinaryHeap
"""
Important point
self.learn_start > self.batch_size
and self.learn... | |
x0, n_compounds, names, c0_from_df, single_point = _parse_c0(
c0, names, solvent_density
)
_check_c0(x0)
N, logK = _parse_N_input(N, logK, names, c0_from_df, solvent_density)
_check_N(N, n_compounds)
logK = _parse_K(K, logK, N, solvent_density)
_check_logK(N, logK)
A = _parse_A(A, names, c0_from_df)
_check_... | |
except AttributeError as e:
raise ValueError(str(e) + ". Type %d not understood" % type)
return f
def _eval_fun(f, tmp, n, axis, nm, overwrite_x):
if axis == -1 or axis == len(tmp.shape) - 1:
return f(tmp, n, nm, overwrite_x)
tmp = numpy.swapaxes(tmp, axis, -1)
tmp = f(tmp, n, nm, overwrite_x)
return numpy.swa... | |
img) for img in imgs]
boxes = [
cv2_transform.scale_boxes(self._crop_size, boxes[0], height, width)
]
imgs, boxes = cv2_transform.spatial_shift_crop_list(
self._crop_size, imgs, 1, boxes=boxes
)
if self._test_force_flip:
imgs, boxes = cv2_transform.horizontal_flip_list(
1, imgs, order="HWC", boxes=b... | |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | |
# -*- coding: utf-8 -*-
# File generated according to Generator/ClassesRef/Mesh/MeshSolution.csv
# WARNING! All changes made in this file will be lost!
"""Method code available at https://github.com/Eomys/pyleecan/tree/master/pyleecan/Methods/Mesh/MeshSolution
"""
from os import linesep
from sys import getsizeof
from ... | |
float(k)
i += 1
cpx = self._cplex
self.cpx_adapter.multiobjsetobj(cpx._env._e, cpx._lp, objidx, objind=indices, objval=koefs,
priority=priority, weight=weight, abstol=abstol, reltol=reltol, objname=objname)
def _fast_update_linearct_coefs(self, ct_index, var_indices, coefs):
assert len(var_indices) == len(coefs... | |
import numpy as np
import six
import logging
import os
import networkx as nx
from lxml import etree
from sumolib import checkBinary
from sumolib.net import readNet
import traci
from trafficgraphnn.genconfig import ConfigGenerator
from trafficgraphnn.utils import (
parse_detector_output_xml, parse_tls_output_xml, ite... | |
activation='sigmoid')(x)
else:
x = conv3d_model2.output
x = Dense(name='emb_' + data_types[1] + self._backbone,
units=attention_size,
activation='sigmoid')(x)
encoder_outputs.append(x)
##############################################
for i in range(2, core_size):
network_inputs.append(Input(shape=data_sizes[i... | |
"get_membership_status",
return_value=self.member_status) as patch_getmem,\
patch.object(self.syn, "get_team_open_invitations",
return_value=[]) as patch_get_invites,\
patch.object(self.syn, "getUserProfile",
return_value=self.profile) as patch_get_profile,\
patch.object(self.syn, "send_membership_invitation",
r... | |
import random
import logging
import discord
from discord.ext import commands
from sqlalchemy import orm
from kaztron import KazCog
from kaztron.config import SectionView
from kaztron.driver.pagination import Pagination
from kaztron.theme import solarized
from kaztron.utils.checks import mod_only
from kaztron.utils.di... | |
<filename>lx16a.py<gh_stars>0
import serial
import weakref
#################################
# Created by: <NAME> #
# Questions? Bugs? Email me at #
# <EMAIL> #
# Version 0.8.0 #
# Published on November 4, 2018 #
#################################
# getServos() implementation from:
# http://effbot.org/pyfaq/how-do-i-g... | |
the server, and will be ignored when sending a request.
:ivar id: Resource Id.
:vartype id: str
:ivar name: Resource Name.
:vartype name: str
:param kind: Kind of resource.
:type kind: str
:ivar type: Resource type.
:vartype type: str
:ivar entries: List of log entry messages.
:vartype entries: list[~azure.m... | |
import datetime
import numpy as np
import pytest
from testfixtures import LogCapture
from greykite.common.constants import LOGGER_NAME
from greykite.common.constants import PREDICTED_COL
from greykite.common.constants import PREDICTED_LOWER_COL
from greykite.common.constants import PREDICTED_UPPER_COL
from greykite.c... | |
<filename>microbenthos/model/simulation.py
"""
Module to handle the simulation of microbenthos models
"""
from __future__ import division
import importlib
import logging
import time
from collections import deque
from fipy import PhysicalField, Variable
from .model import MicroBenthosModel
from ..utils import CreateM... | |
a common
# use-case for it.
return (str.format(
'unsatisfiable dependency: "{}" ({}) is installed,'
' but "{}" requires {}', node.name,
required_version, depender_name, version_spec),
new_pkgs)
else:
normal_version = _normalize_version_tag(required_version)
req_semver = semver.Version.coerce(normal_version)
... | |
import sys, os, re
import numpy as np
import time
import argparse
import pickle
from random import *
import math
from hypredriver import hypredriver
sys.path.insert(0, os.path.abspath(__file__ + "/../hypre_driver/"))
solver = 3 # Bommer AMG
# max_setup_time = 1000.
# max_solve_time = 1000.
coeffs_c = "-c 1 1 1 " # sp... | |
from __future__ import annotations
import json
import tempfile
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
import python_on_whales.components.image.cli_wrapper
from python_on_whales.client_config import (
ClientConfig,
DockerCLICaller,
ReloadableObject,
)
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.