input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<gh_stars>1-10
from __future__ import annotations
import uuid
import numpy as np
import pandas as pd
from aistac.handlers.abstract_handlers import ConnectorContract
from ds_discovery.components.abstract_common_component import AbstractCommonComponent
from ds_discovery.components.commons import Commons
from ds_discover... | |
return sqs.order_by(prop_order)
else:
return sqs.order_by('-django_ct')
class LocationAdvancedSearchForm(SearchForm):
"""Search form allows user to search Solr index by property
This allows the user to specify the property, type of search and
AND/OR methods for combining searches"""
keyword = forms.CharFie... | |
from direct.showbase.DirectObject import DirectObject
from DirectUtil import *
from DirectGeometry import *
from DirectGlobals import *
from DirectSelection import SelectionRay
from direct.interval.IntervalGlobal import Sequence, Func
from direct.directnotify import DirectNotifyGlobal
from direct.task import Task
CAM_... | |
'"y.__rop__(x)" is\n'
' tried. If this is also not implemented or returns '
'"NotImplemented",\n'
' a "TypeError" exception is raised. But see the following '
'exception:\n'
'\n'
'* Exception to the previous item: if the left operand is an '
'instance\n'
' of a built-in type or a new-style class, and th... | |
# 下加符 = ̪
0xA59C: 0x032C, # 下加符 = ̬
0xA59D: 0x032B, # 下加符 = ̫
0xA59E: 0x0329, # 下加符 = ̩
0xA59F: 0xFF5B, # 左开花括号 = {
0xA5A0: 0xFF5D, # 右闭花括号 = }
0xA5F7: 0x3016, # 左空方圆括号 = 〖
0xA5F8: 0x3017, # 右空方圆括号 = 〗
0xA5F9: 0x29DB, # ⧛
0xA5FA: 0xA5FA, # (vertical ⧛)
0xA5FB: 0x534D, # 卍
0xA5FC: 0xFE47, # 竖排上方括号 = ﹇
0xA5FD... | |
<reponame>mirfan899/MTTS
# -*- coding: UTF-8 -*-
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | | | | \ analysis
___/ | | | | ___/ of speech
http://www.sppas.org/
Use of this software is go... | |
:return: Whether the operation succeeded or not
"""
params = {'ImageId' : image_id,
'Attribute' : attribute}
return self.get_status('ResetImageAttribute', params)
# Instance methods
def get_all_instances(self, instance_ids=None):
"""
Retrieve all the instances associated with your account.
:type instance_id... | |
<reponame>wkerzendorf/forspy<gh_stars>0
try:
import numpy
from pipeline_display import *
from pipeline_product import *
from reflex_plot_widgets import *
from numpy.polynomial import Polynomial
numpy.seterr(invalid='ignore')
except ImportError:
donothing=1
class PlotableReducedArc :
def __init__(self, fits):
... | |
<reponame>sshaky2/python-netflow-v9-softflowd
#!/usr/bin/env python
import json
import time
import requests
import sys
import traceback
import re
import types
from abc import abstractmethod
from bottle import request, response
from ..smcontext import SmContext, ServiceManagerException
from ..smport import PortProvid... | |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
"""An implementation of the session and presentation layers as used in the D... | |
"FEGO": (8.90691666667, 22.7976666667),
"FEGR": (4.98863888889, 23.9280833333),
"FEGU": (6.51705555556, 18.2725555556),
"FEGZ": (6.34416666667, 16.3220555556),
"FGAB": (-1.41027777778, 5.62194444444),
"FGBT": (1.90527777778, 9.80555555556),
"FGSL": (3.75527777778, 8.70861111111),
"FHAW": (-7.96944444444, -14.393... | |
pd.read_csv('https://covidtracking.com/api/v1/states/daily.csv');
except:
print("ERROR: there was a problem loading the CTP dataset. Details: ")
for i in range(len(sys.exc_info())):
print(" " + str(sys.exc_info()[i]))
if verbose:
print('transforming CTP data...')
# transform our date to the standard format we'... | |
дивизионной артиллерии, различные боеприпасы. Масса 40-60 кг. Дальность огня: 20 км.',
'wpn_troops_type':'ВПК',
'wpn_cost':1000,
'wpn_cost_currency':'Эквестрийские биты',
'wpn_budget':0.02,
'wpn_name_new':'Снаряды 150-мм новые',
'wpn_name_mid':'Снаряды 150-мм устаревшие',
'wpn_name_old':'Снаряды 150-мм под списа... | |
fail = False
for dirname in examples:
print >>sys.stderr, "Testing %s..." % dirname
sys.stderr.flush()
try:
run(arguments=["test",
"--pkgdir",
os.path.join(examples_dir, dirname)],
defaults=defaults,
env_root=env_root)
except SystemExit, e:
fail = (e.code != 0) or fail
if fail and defaults.get("stopOnError"... | |
import numpy as np
def get_pieces_count(state):
count = 0
for s in state:
if s.isalpha():
count += 1
return count
def is_kill_move(state_prev, state_next):
return get_pieces_count(state_prev) - get_pieces_count(state_next)
def create_position_labels():
labels_array = []
letters = ['a', 'b', 'c', 'd', 'e', '... | |
<reponame>vishaltiwari/XNet<filename>tools/thermo/plot_expansion_no_parser.py
import os,sys,itertools
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as plticker
import matplotlib.gridspec as gridspec
import matplotlib.axes as plax
from datetime import datetime
from scipy import inter... | |
plot_format: Whether the plot is shown vertical or horizontal. \
Vertical is default and denoted as `vert` else horizontal is `hoz`
:type file_path: String
:type plot_format: String. Default 'vert'
:returns: Nothing. Saves the visual to the file path given.
:rtype: None
'''
if self.model is None:
raise ValueEr... | |
= Constraint(expr= m.b4 - m.b5 + m.b91 <= 1)
m.c68 = Constraint(expr= m.b4 - m.b6 + m.b92 <= 1)
m.c69 = Constraint(expr= m.b4 - m.b7 + m.b93 <= 1)
m.c70 = Constraint(expr= m.b4 - m.b8 + m.b94 <= 1)
m.c71 = Constraint(expr= m.b4 - m.b9 + m.b95 <= 1)
m.c72 = Constraint(expr= m.b4 - m.b10 + m.b96 <= 1)
m.c73 = Const... | |
role mentions.
""" # noqa: E501 - Line too long
@property
@abc.abstractmethod
def user_mentions(
self,
) -> undefined.UndefinedOr[typing.Union[snowflakes.SnowflakeishSequence[users.PartialUser], bool]]:
"""Whether and what user mentions should be enabled for this response.
Returns
-------
hikari.undefined.U... | |
\
hl.size != (ml,1):
raise TypeError("'hl' must be a dense 'd' matrix of " \
"size (%d,1)" %ml)
if Gq is None: Gq = []
if type(Gq) is not list or [ G for G in Gq if (type(G) is not matrix
and type(G) is not spmatrix) or G.typecode != 'd' or
G.size[1] != n ]:
raise TypeError("'Gq' must be a list of sparse or ... | |
connection, preferred_phy, accepted_phy)
def gecko_cmd_gatt_set_max_mtu(self, max_mtu):
return struct.pack('<4BH', 0x20, 2, 9, 0, max_mtu)
def gecko_cmd_gatt_discover_primary_services(self, connection):
return struct.pack('<4BB', 0x20, 1, 9, 1, connection)
def gecko_cmd_gatt_discover_primary_services_by_uuid(self,... | |
<reponame>overmeulen/qpid-dispatch<filename>tests/system_tests_drain_support.py
#
# 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... | |
def enter_drain(self):
self.state = BBRMode.BBR_DRAIN
self.pacing_gain = 1 / BBR_HIGH_GAIN # pace slowly
self.cwnd_gain = BBR_HIGH_GAIN # maintain cwnd
def check_drain(self):
if self.state == BBRMode.BBR_STARTUP and self.filled_pipe:
self.enter_drain()
if self.state == BBRMode.BBR_DRAIN and self.bytes_in_flight... | |
<filename>emma/core/metadata.py
#!/usr/bin/env python
# encoding: utf-8
"""
metadata.py
Created by <NAME> on 2008-02-11.
Copyright (c) 2008, 2009 <NAME> Web Studio, 2010, 2011, 2012 Django Web Studio. All rights reserved.
"""
import string
import sys
import os
import unittest
import subprocess
import re
import datetim... | |
"""
An n-th order discontinuous Galerkin solver for 1D scalar advection and inviscid Burgers eqn.
"""
from typing import NamedTuple
from sailfish.mesh import PlanarCartesianMesh
from sailfish.solver import SolverBase
from sailfish.kernel.library import Library
from numpy.polynomial.legendre import leggauss, Legendre
i... | |
<filename>template/template.py<gh_stars>0
# -*- coding: utf-8 -*-
# ---
# jupyter:
# celltoolbar: Edit Metadata
# hide_input: false
# ipub:
# bibliography: ExampleBib
# listcode: false
# listfigures: false
# listtables: false
# titlepage:
# address:
# - <NAME>
# - <NAME> Hall 322
# - Princeton University
# - Princeton,... | |
{
"color": "morado",
"size": "m",
"brand": "zara",
"precio": 4444
}
},
{
"id": 253,
"atrr": {
"color": "azul",
"size": "xs",
"brand": "polo",
"precio": 2333
}
},
{
"id": 254,
"atrr": {
"color": "morado",
"size": "xs",
"brand": "nike",
"precio": 4447
}
},
{
"id": 255,
"atrr": {
"color": "amar... | |
city, Colorado",28002),
("Laird CDP, Colorado",52),
("La Jara town, Colorado",835),
("La Junta city, Colorado",6914),
("La Junta Gardens CDP, Colorado",90),
("Lake City town, Colorado",454),
("Lakeside town, Colorado",8),
("Lakewood city, Colorado",153522),
("Lamar city, Colorado",7606),
("Laporte CDP, Colorado",2411),... | |
"""Load :class:`lime.lime_tabular.LimeTabularExplainer`."""
x_train = self.get_x_array('train', impute_nans=True)
y_train = self.get_y_array('train', impute_nans=True)
verbosity = self._get_verbosity_parameters(LimeTabularExplainer,
boolean=True)
for param in verbosity:
verbosity[param] = False
categorical_featu... | |
# -*- coding: utf-8 -*-
"""Cisco Identity Services Engine Node Services API wrapper.
Copyright (c) 2021 Cisco and/or its affiliates.
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 restri... | |
'DQX',
'\xe5\xa4\xa7\xe5\x86\xb6\xe5\x8c\x97': 'DBN',
'\xe5\xa4\xa7\xe5\x8f\xa3\xe5\xb1\xaf': 'DKP',
'\xe5\xa4\xa7\xe5\x90\x8c': 'DTV',
'\xe5\xa4\xa7\xe5\x9d\x9d': 'DBJ',
'\xe5\xa4\xa7\xe5\x9f\x94': 'DPI',
'\xe5\xa4\xa7\xe5\xa0\xa1': 'DVT',
'\xe5\xa4\xa7\xe5\xad\xa4\xe5\xb1\xb1': 'RMT',
'\xe5\xa4\xa7\xe5\xae\x8... | |
or text.lower() == 'sticker on':
if wait["selfbot"] == True:
if msg._from in owner:
wait["sticker"] = True
cl.sendMessage(msg.to,"Deteksi sticker diaktifkan")
elif cmd == "sticker off" or text.lower() == 'sticker off':
if wait["selfbot"] == True:
if msg._from in owner:
wait["sticker"] = False
cl.sendMessage(m... | |
"""Integration for chat integrations"""
from __future__ import unicode_literals
import logging
from djblets.db.query import get_object_or_none
from djblets.util.templatetags.djblets_utils import user_displayname
from reviewboard.accounts.models import Trophy
from reviewboard.admin.server import build_server_url
from ... | |
wantedTypes, branchList, pointer(listLen) )
for i in range(listLen.value):
print("Branch=" + OlxAPI.FullBranchName(branchList[i]))
return
def testOlxAPIGetSetObjTagsMemo():
# Test GetObjTags and GetObjMemo
argsGetEquipment = {}
argsGetEquipment["tc"] = TC_LINE
argsGetEquipment["hnd"] = 0 # Get all lines
while... | |
<reponame>prometheusresearch/rios.core
#
# Copyright (c) 2015, Prometheus Research, LLC
#
import re
from copy import deepcopy
import colander
from six import iteritems, iterkeys, string_types
from .common import ValidationError, RE_IDENTIFIER, IdentifierString, \
sub_schema, AnyType, OneOfType, StrictBooleanType... | |
0
self.nsample_array = np.abs(raw_data_array[:, :, :, :, 2])
if fix_old_proj:
self.fix_phase(use_ant_pos=fix_use_ant_pos)
# check if object has all required UVParameters set
if run_check:
self.check(
check_extra=check_extra,
run_check_acceptability=run_check_acceptability,
strict_uvw_antpos_check=strict_uvw_... | |
<gh_stars>1-10
"""
Created on May 23, 2010
@author: <NAME>
"""
import unittest
from qal.sql.types import *
from qal.dal.types import *
from qal.sql.sql import *
# from qal.tools.diff import diff_strings # Use when debugging tests
r_create_table_mysql = "CREATE TABLE Table1 (" + DEFAULT_ROWSEP + "\
`Table1ID` INTEGE... | |
including) _crsr_loc
self._crsr_loc : Tuple[int, int] # cursor position in logical buffer (lines can be longer than screen width)
# _crsr_loc gets moved by printing, and also by the screen editor.
# It may sit exactly on terminal border (col == _term_size[0]);
# in this case, it will wrap once written to.
self._te... | |
<gh_stars>1-10
#!/usr/bin/env python
#nknguyen at soe ucsc edu
#Tue Jul 17 09:09:24 PDT 2012
#Immuno-seq pipeline
'''
Overlap stats
'''
import os, sys, re, time, gzip, random
import random as rand
import cPickle as pickle
from optparse import OptionParser
from jobTree.scriptTree.target import Target
from jobTree.s... | |
import os
import stat
import re
import pdb
from pathlib import Path
import getpass
import numpy as np
import h5py as h5
import pandas as pd
import subprocess
from glob import glob
from tqdm import tqdm
from .dataset import _submit_slurm_job
import shutil
import yaml
import threading
import time
from datetime import t... | |
= ET.SubElement(output, "spanning-tree-info")
spanning_tree_mode = ET.SubElement(spanning_tree_info, "spanning-tree-mode")
rstp = ET.SubElement(spanning_tree_mode, "rstp")
rstp = ET.SubElement(rstp, "rstp")
port = ET.SubElement(rstp, "port")
auto_edge = ET.SubElement(port, "auto-edge")
auto_edge.text = kwargs.pop... | |
name, **kwargs): # noqa: E501
"""get device property by name # noqa: E501
# noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_device_property_by_name(device_id, name, async_req=True)
>>> result = thread.get()
... | |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
\brief Code to prepare data.
\copyright Copyright (c) 2021 Visual Computing group of Ulm University,
Germany. See the LICENSE file at the top-level directory of
this distribution.
''''''''''''''''''''''''''''''''''''''''''''''''''''''... | |
None, None, None]], [[6.6, 7.7, 8.8, 9.9, None], [None, None, None, None, None]]]
def test_rpad_regular_array():
content = awkward1.layout.NumpyArray(numpy.array([2.1, 8.4, 7.4, 1.6, 2.2, 3.4, 6.2, 5.4, 1.5, 3.9, 3.8, 3.0, 8.5, 6.9, 4.3, 3.6, 6.7, 1.8, 3.2]))
index = awkward1.layout.Index64(numpy.array([13, 9, 13, 4... | |
game.game_type == config['GAMETYPE']['PRESEASON']:
details_game = ("PRESEASON | {} | {}"
.format(game_date_short, game_time))
full_details = "{}\n{}\n{}".format(details_game, game.venue, game.game_hashtag)
details_coords = (145, 160)
else:
details_game = ("{} of 82 | {} | {}"
.format(game.preferred_team.games + ... | |
of second basis functions: 3
Open in the first direction
Open in the second direction
Polynomial
Periodic in the first direction
Periodic in the second direction
Knot 1: [0. 0. 0. 0. 1. 1. 1. 1.]
Knot 2: [0. 0. 0. 0. 1. 1. 1. 1.]
u0: 1.000000
u1: 0.000000
v0: 1.000000
v1: 128.000000
Control Points: 16
>>>... | |
= "http://images.cocodataset.org/val2017/000000039769.jpg"
>>> image = Image.open(requests.get(url, stream=True).raw)
>>> inputs = processor(images=image, return_tensors="pt")
>>> image_features = model.get_image_features(**inputs)
```""".format(
_CHECKPOINT_FOR_DOC
)
image_outputs = self.image_model(
pixel_v... | |
have taken it up, we have lunatics coming out of the woodwork to confess.",
"Every man-jack in the east end pointing the finger at everyone else.",
"Were they drained of blood? Excuse me? Were they drained of blood? No.",
"How old was she, the daughter? Seven.",
"What was her name? Charlotte.",
"Charlotte.",
"Is it the... | |
<gh_stars>1-10
import asyncio
import logging
import re
from cogs.utils.checks import *
from cogs.utils.mojang import *
log = logging.getLogger(__name__)
def list_factory(data):
items = []
for i in data:
items.append(i[0])
return items
class Hypixel(commands.Cog):
def __init__(self, bot):
self.bot = bot
@co... | |
\
'<tr>' + \
'<td>Supplies expense</td>' + \
'<td>' + r22c1 + '</td>' + \
'<td>' + r22c2 + '</td>' + \
'<td>' + r22c3 + '</td>' + \
'<td>' + r22c4 + '</td>' + \
'<td>' + r22c5 + '</td>' + \
'</tr>' + \
'<tr>' + \
'<td>Travel expense</td>' + \
'<td>' + r23c1 + '</td>' + \
'<td>' + r23... | |
GL/glext.h:693
# ARB_texture_mirrored_repeat (GL/glext.h:696)
GL_MIRRORED_REPEAT_ARB = 33648 # GL/glext.h:697
# ARB_depth_texture (GL/glext.h:700)
GL_DEPTH_COMPONENT16_ARB = 33189 # GL/glext.h:701
GL_DEPTH_COMPONENT24_ARB = 33190 # GL/glext.h:702
GL_DEPTH_COMPONENT32_ARB = 33191 # GL/glext.h:703
GL_TEXTURE_DEPTH_SI... | |
valid values are: `slb.s1.small`, `slb.s2.small`, `slb.s2.medium`,
`slb.s3.small`, `slb.s3.medium`, `slb.s3.large` and `slb.s4.large`.
"""
return pulumi.get(self, "load_balancer_spec")
@load_balancer_spec.setter
def load_balancer_spec(self, value: Optional[pulumi.Input[str]]):
pulumi.set(self, "load_balancer_spe... | |
datetime.timedelta(0, DEFAULT_STUDY_EXPIRATION_TIME)), cache_safe='true' if study.is_cache_safe else 'false')#time zone study.expiration_time.isoformat()
data_request_xml += '</DataRequest>'
logger.debug('data request %s', data_request_xml)
try:
response_from_node = urllib.request.urlopen(request_to_node, data_req... | |
from libsbml import *
import math
import new
import urllib2
# indicates whether we should perform SBML document consistency check.
# supressed by default because the MSR SBML library does not produce valid SBML.
supressConsistencyCheck = True
# get the array index of given species ID:
def getSpecIndex(specIdToArr... | |
+ self.sample_array_offset + 4])[0]
self.sample_array_offset += 4
self.decoration += ' offset:%d' % self.data_offset
if self.has_first_sample_flags:
self.first_sample_flags = struct.unpack('>I', \
self.fmap[self.offset+self.sample_array_offset:self.offset+self.sample_array_offset+4])[0]
self.sample_array_offset ... | |
'_inner'
from pymbolic import var, substitute
from pymbolic.mapper import IdentityMapper
from loopy.symbolic import get_dependencies
names = set(arrays)
class SubstMapper(IdentityMapper):
def map_subscript(self, expr, *args, **kwargs):
if expr.aggregate.name in names:
# get old index
old = var(owner.pre_spl... | |
0)
final_output = torch.cat([final_output_forward, sent_output_backward[0]], dim = 1)
return final_output
def sememe_sum(self, input_s):
emb_sememe = self.emb_sememe.weight
input_sememe = []
for i in range(input_s.size()[0]):
input_sememe.append(torch.mm(input_s[i].float(), emb_sememe))
input_sememe = torch.st... | |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 12 17:17:30 2021
@author: <NAME>
"""
import time
import itertools
import os
import sys
import numpy as np
import scipy as sc
from skimage import segmentation, measure, morphology, filters, transform
import stl
from numba import njit, prange
from src.Tools.c... | |
<reponame>sandernaert/brat
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from projectconfig import ProjectConfiguration
from verify_annotations import argparser
from annotation import Annotations,TextAnnotations
from ssplit import regex_sentence_boundary_gen
from ssplit import _sentence_boundary_gen
from os.path impo... | |
EDREAD reads data from the specified ascii output file so that it may
be used during postprocessing. After EDREAD, you must issue the STORE
command to store the data in time history variables. Once stored, the
variables can be viewed as plots of output item versus time.
The number of variables stored depends on th... | |
all headers in a FASTQ file unique by adding a number at the end of the header. Also, splits headers up to the first whitespace.\n');
sys.stderr.write('Usage:\n');
sys.stderr.write('\t%s %s <input_fastq_file> [<out_filtered_fastq_file>]\n' % (os.path.basename(sys.argv[0]), sys.argv[1]));
exit(0);
input_fastq_path ... | |
% (sPvMode, ', '.join(g_kasParavirtProviders),));
if len(self.asParavirtModes) == 0:
self.asParavirtModes = None;
else:
return iArg;
return iArg + 1;
def getResourceSet(self):
"""
Implements base.TestDriver.getResourceSet
"""
asResources = [];
for oTestVm in self.aoTestVms:
if not oTestVm.fSkip:
if oTest... | |
<reponame>CenterForOpenScience/SHARE
from collections import deque
from functools import reduce
import json
import logging
import re
import threading
import dateutil
import urllib
import types
import xmltodict
import pendulum
from lxml import etree
from django.conf import settings
from share.util import iris, DictHa... | |
since this was last called.
Data format: numpy array: [(timestamp, pool_id, neuron_index), ...]
Timestamps are in nanoseconds
"""
spk_ids, spk_times = self.driver.RecvXYSpikes(CORE_ID)
pool_ids, nrn_idxs, filtered_spk_times = self.last_mapped_network.translate_spikes(spk_ids, spk_times)
ret_data = np.array([fi... | |
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from spinup.utils.logx import Logger
import time
# import ray
# if not ray.is_initialized():
# ray.init(num_gpus=1)
def get_vars(scope):
return [x for x in tf.global_variables() if scope in x.name]
class ReplayBuffer:
"""
A simple FIF... | |
SEP)
program = cl.Program(self.context, kernelsource).build([options_string])
self.cl_kernel_time_integration = program.TimeIntegration
self.cl_kernel_update_displacement = program.UpdateDisplacement
self.cl_kernel_reduce_damage = program.ReduceDamage
# Set initial values in host memory
# horizons and horizons ... | |
expr: SizeParam) -> R:
return frozenset([expr])
def map_stack(self, expr: Stack) -> R:
return self.combine(frozenset([expr]), super().map_stack(expr))
def map_roll(self, expr: Roll) -> R:
return self.combine(frozenset([expr]), super().map_roll(expr))
def map_axis_permutation(self, expr: AxisPermutation) -> R:
... | |
N )
#
return that
# pad each mode to a new_length
def pad(this,new_length=None, apply=True, extend=True ):
# Pad each mode
ans = this if apply else this.copy()
treset=True
for z in this.lm:
for k in this.lm[z]:
ans.lm[z][k].pad( new_length=new_length, apply=apply, extend=extend )
if treset:
ans.t = ans... | |
(eta*ccms) * FDM(sc.q_arr, n)**2. * f2[Ei], axis=-1) # np.sum(_, axis=-1): summing over the q-columns
elif integrate == 'simps':
correction = (meeV**2. / mu_chie(m_chi)**2.) * simps(sc.q_arr**-2. * (eta*ccms) * FDM(sc.q_arr, n)**2. * f2[Ei], sc.q_arr, axis=-1) # simps(_, axis=-1): integrating over the q-columns
else... | |
'--movie', metavar = 'MOVIE', default = 'movie.json',
help = 'Specify the .json file describing the movie chunks.')
parser.add_argument('-ml', '--movie-length', metavar = 'LEN', type = float, default = None,
help = 'Specify the movie length in seconds (use MOVIE length if None).')
parser.add_argument('-a', '--abr',... | |
from __future__ import absolute_import
import weakref
import unicodedata
from fontTools.agl import AGL2UV
from fontTools.misc.py23 import basestring, range
from defcon.tools import unicodeTools
from defcon.objects.base import BaseDictObject
class UnicodeData(BaseDictObject):
"""
This object serves Unicode data for... | |
#
# Copyright (c) 2019, NVIDIA CORPORATION.
#
# 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 i... | |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import aiohttp
from settings import WOW_CLIENT_ID, WOW_CLIENT_SECRET, LOCALE
from constants import *
async def get_data(region, access_token, **kwargs):
"""Helper function that grabs data from the World of Warcraft API."""
if access_token == "credential_error":
return ac... | |
<filename>backend/generate_z3.py<gh_stars>10-100
import logging
from stencil_ir import *
from verify import *
from assertion_to_z3 import *
import generate_sketch
import asp.codegen.ast_tools as ast_tools
def loop_key(node):
import hashlib
return hashlib.sha224(tree_to_str(node)).hexdigest()[0:10]
class Z3Generator... | |
from abc import ABC, abstractmethod
from itertools import chain
from typing import List, Tuple, Iterator
from pysat.solvers import Solver
from ..structures import APTA, InconsistencyGraph
from ..variables import VarPool
CLAUSE = Tuple[int, ...]
CLAUSES = Iterator[CLAUSE]
def _implication_to_clauses(lhs: int, rhs: ... | |
import os
import sys
import time
import glob
import numpy as np
import torch
import utils
import logging
import argparse
import torch.nn as nn
import torch.utils
import torch.nn.functional as F
import torchvision.datasets as dset
import torch.backends.cudnn as cudnn
import copy
from model_search import Network
from gen... | |
"""Various sift utilities
Licensed under the 3-clause BSD License:
Copyright (c) 2011-2014, <NAME> (<EMAIL>)
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 retai... | |
<reponame>lintondf/MorrisonPolynomialFiltering
'''
Created on Feb 15, 2019
@author: NOOK
'''
import time
from typing import Tuple;
from netCDF4 import Dataset
from math import sin, cos, exp
import numpy as np
from numpy import array, array2string, diag, eye, ones, transpose, zeros, sqrt, mean, std, var,\
isscalar, a... | |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
This test checks simple acceptance of bigger blocks via p2... | |
null, 0.95],
[0.95, null, 0.33, 0.11],
[1.00, 0.95, 0.11, 1.00],
]
)
expected = array(
[
[0.63, 0.75, null, 1.00],
[0.75, 0.10, null, 0.95],
[null, null, null, null],
[1.00, 0.95, null, 1.00],
]
)
actual = filter_threshold_based_multiple_interdependency(
None, m, 0.33, 1, less_equal
)
assert_allclose(ac... | |
# Copyright 2020 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 ... | |
import tempfile
from collections import defaultdict
import pandas as pd
import six
from lazy_property import LazyProperty
from .. import numeric_datatypes, _pretty_print
from ..column.base import Column
from ..connection import Connection
from ..exception import TableDoesNotExistError, NoSuchColumnError
from ..util i... | |
<reponame>kyper999/OCRmyPDF
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# © 2013-16: jbarlow83 from Github (https://github.com/jbarlow83)
#
# Python FFI wrapper for Leptonica library
import argparse
import sys
import os
import logging
from tempfile import TemporaryFile
from ctypes.util import find_library
from .l... | |
<reponame>taDachs/jacoco-badge-generator<filename>JacocoBadgeGenerator.py<gh_stars>0
#!/usr/bin/env python3
#
# jacoco-badge-generator: Github action for generating a jacoco coverage
# percentage badge.
#
# Copyright (c) 2020-2021 <NAME>
# https://www.cicirello.org/
#
# MIT License
#
# Permission is hereby granted, f... | |
#!/usr/bin/env python
# coding: utf-8
# systems tools
import os
import shutil
import sys
import time
import sys
import signal
import random
# multiprocess
import threading
import psutil
#format
import string
import json
#sqlite
import sqlite3
#args
import argparse
#maths
import numpy as np
#strings
import re #re... | |
<reponame>kalxas/eoxserver
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-06 19:09
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import re
class Migration(migr... | |
#
# Name: updateCache.py.
# Author: <NAME> <<EMAIL>>
#
# This project is released under the terms of the MIT license,
# which you should find included in the LICENSE file.
#
# The purpose of this script is to keep a local backup of the
# complete contents of your gmail account. These are the
# elements it back... | |
Run "make" to regenerate code after modifying this file
"""
return pulumi.get(self, "location")
@location.setter
def location(self, value: pulumi.Input[str]):
pulumi.set(self, "location", value)
@property
@pulumi.getter(name="resourceGroup")
def resource_group(self) -> pulumi.Input[str]:
return pulumi.get(se... | |
#!/usr/bin/env python2
#
# TODO:
# - Task colors:
# - User-defined using config file.
# - Automagically chosen from color space.
# - Advanced algorithm (contact <NAME>).
# - Koos' specs:
# - Resources and tasks sorted in read-in order (default)
# or alphabetically (flag).
# - Have proper gnuplot behavior on windows/x11... | |
the console handler must be polled
self.consoleHandlerIsPolling = True
else:
# on UNIX the console handler use the normal file handler API
self.consoleHandlerIsPolling = False
self.createFileHandler(sys.stdin, consoleHandler.receiveCallback)
# ----------------------------------------------------------------... | |
<filename>bigchaindb/backend/query.py
"""Query interfaces for backends."""
from functools import singledispatch
from bigchaindb.backend.exceptions import OperationError
VALIDATOR_UPDATE_ID = 'a_unique_id_string'
PRE_COMMIT_ID = 'a_unique_id_string'
@singledispatch
def write_transaction(connection, signed_transacti... | |
k.name()):
if progress:
sys.stderr.write(".")
out.write('%s objects\n' % (klass.name()))
attrs = [attr for attr in klass.allAttrs() if attr.hasSQLColumn()]
colNames = [attr.name() for attr in attrs]
colNames.insert(0, klass.sqlSerialColumnName())
out.write(CSVJoiner.joinCSVFields(colNames) + "\n")
# write out ... | |
<filename>py4ami/text_lib.py
import unicodedata
import nltk
import json
import re
import xml.etree.ElementTree as ET
from collections import Counter
from pathlib import Path
from bs4 import BeautifulSoup
import os
import glob
import logging
logging.debug("loading text_lib")
from .file_lib import AmiPath, FileLib
NFKD... | |
"""Python utilities to load and wrap SEGGER JLink library."""
# The MIT License (MIT)
# Copyright (c) 2019 ezflash
#
# 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, incl... | |
ind_ptr | pdarray
CSR format array of the ROW pointers for the matrix
gb_rep | ak.GroupBy
Multi-level GroupBy representation of the matrix.
Organized by ROW, then COLUMN. Used internally.
primary_gb | ak.GroupBy
Single-level GroupBy on ROW indices. Used internally.
off_gb | ak.GroupBy
Single-level GroupBy on ... | |
<gh_stars>10-100
import os
import json
import argparse
import numpy as np
import pprint
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
from copy import deepcopy
from models.vae.parallelly_reparameterized_vae import ParallellyReparameterizedVAE
from models.vae.sequen... | |
<filename>manage_rancher.py
import requests
import os
import logging
import re
import random
import flask
from datetime import datetime
from typing import Dict, List, Optional
# to do: move latest_narr_version() so we don't need to import app
import app
# Module wide logger
logger: Optional[logging.Logger] = None
# S... | |
"""
Text search query language.
[ Grammar ]
Phrases:
the ducks find all instances of the "the ducks" (a bigram)
Query Expansion: [] brackets
[the ducks] "the ducks" or "the duck".
Equivalent to ("the duck" | "the ducks").
Expressions:
An expression can be:
- a phrase (e.g., "the ducks")
- a phrase with query ... | |
import asyncio
import math
import re
from datetime import datetime
from typing import Any, Dict, List, Optional, TypedDict
import pytz
from blossom_wrapper import BlossomAPI
from dateutil import parser
from discord import Embed, Forbidden, Reaction, User
from discord.ext import commands
from discord.ext.commands impor... | |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# ./create_JSON_file_of_sections_in_your_courses.py
#
# with the option "-v" or "--verbose" you get lots of output - showing in detail the operations of the program
#
# Can also be called with an alternative configuration file:
# ./create_JSON_file_of_sections_in_your_course... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.