input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
graph = get_image()
return graph
def get_plot_girls_secondary(**kwargs):
plt.switch_backend('AGG')
data = kwargs.get('data')
for _ in data.shape:
ger = (data['enrollment'] / data['age_12_to_16_years']) * 100
academic_year = data.academic_year
sns.set(font_scale=1)
sns.set_style("white")
ax = ger.plot.bar(fig... | |
\
and x.code == 2091 and 'ORA-02291' in x.message:
six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
raise
def schema_editor(self, *args, **kwargs):
"Returns a new instance of this backend's SchemaEditor"
return DatabaseSchemaEditor(self, *args, **kwargs)
# Oracle doesn... | |
<reponame>sleibrock/chain.py
#!/usr/bin/env python
"""
Prelude.py
Aimed to recreate some basic functions from
GHC's "Prelude" collection
Included in this package:
* Typeclass definition dictionary
* Typechecking functions
* Basic Prelude collection for Unit calculations
Some rules:
* Don't use keyword argument... | |
<filename>module_build_service/web/mmd_resolver.py<gh_stars>0
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
from __future__ import absolute_import
import collections
import itertools
import solv
from module_build_service.common import log, conf, models
class MMDResolver(object):
"""
Resolves dependencies... | |
#!/usr/bin/env python
# coding: utf-8
# ## Overview
# It is a follow-up notebook to "Fine-tuning ResNet34 on ship detection" (https://www.kaggle.com/iafoss/fine-tuning-resnet34-on-ship-detection/notebook) and "Unet34 (dice 0.87+)" (https://www.kaggle.com/iafoss/unet34-dice-0-87/notebook) that shows how to evaluate th... | |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | |
solvationEntry(request, section, subsection, index):
"""
A view for showing an entry in a solvation database.
"""
# Load the solvation database
database.load('solvation', section)
# Determine the entry we wish to view
try:
db = database.get_solvation_database(section, subsection)
except ValueError:
raise Htt... | |
<filename>nca47/agent/firewall_driver/fw_driver.py
from oslo_serialization import jsonutils as json
from oslo_config import cfg
from oslo_log import log as logging
from nca47.agent.firewall_driver import soap_client
from nca47.api.controllers.v1 import tools
from nca47.common.exception import DerviceError as derviceErr... | |
"""
Module containing grid definition and every addition needed for it.
"""
from __future__ import annotations
from typing import Union, List, Tuple
import pygame
from pyggui.gui.item import StaticItem
class Cell(StaticItem):
"""
Class for representing a single rectangle in the grid that is placed in the i, j po... | |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import mxnet as mx
import numpy as np
from config import config
ACT_BIT = 1
bn_mom = 0.9
workspace = 256
memonger = False
def Conv(**kwargs):
body = mx.sym.Convolution(**kwargs)
return body
def Act(data, ... | |
(len(res) > 2):
# More than one plot
pl.legend(loc='lower right')
pl.grid()
pl.show()
pl.close()
if plotReturnData or returnData:
return res
################## WAVETABLE COMMANDS #################
'''
@loadWavetable@
loadWavetable(list,second=False)
Load one wavetable on the hardware board... | |
"""
# Arrange
source_markdown = """a[foo][baβr]a
[baβr]: /url 'title'"""
expected_tokens = [
"[para(1,1):]",
"[text(1,1):a:]",
"[link(1,2):full:/url:title:::baβr:foo:::::]",
"[text(1,3):foo:]",
"[end-link::]",
"[text(1,18):a:]",
"[end-para:::True]",
"[BLANK(2,1):]",
"[link-ref-def(3,1):True... | |
self.Resources["ItemsPanelTemplate"] = items_panel_template
item_container_template = kwargs.get('item_container_template', None)
if item_container_template:
self.Resources["ItemContainerTemplate"] = item_container_template
item_template = kwargs.get('item_template', None)
if item_template:
self.Resources["Item... | |
0xA8C3, # 中文阴圈码卅(⏺ + 卅)
0xA8C4: 0x4E00, # 注音符号— = 一
0xA8EA: 0xA8EA, # 中文阴框码一(⏹ + 一)
0xA8EB: 0xA8EB, # 中文阴框码二(⏹ + 二)
0xA8EC: 0xA8EC, # 中文阴框码三(⏹ + 三)
0xA8ED: 0xA8ED, # 中文阴框码四(⏹ + 四)
0xA8EE: 0xA8EE, # 中文阴框码五(⏹ + 五)
0xA8EF: 0xA8EF, # 中文阴框码六(⏹ + 六)
0xA8F0: 0xA8F0, # 中文阴框码七(⏹ + 七)
0xA8F1: 0xA8F1, # 中文阴框码八(⏹ + 八)
0x... | |
<filename>aioboto3lite/aioboto3lite.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
# to you under the Apache License, Versi... | |
self, namespaces ):
return '-'.join( namespaces )
def _EditNamespaceSort( self, namespaces ):
# users might want to add a namespace with a hyphen in it, so in lieu of a nice list to edit we'll just escape for now mate
correct_char = '-'
escaped_char = '\\-'
escaped_namespaces = [ namespace.replace( corr... | |
= Constraint(expr= - m.b133 + m.x594 <= 0)
m.c1355 = Constraint(expr= - m.b134 + m.x595 <= 0)
m.c1356 = Constraint(expr= - m.b135 + m.x596 <= 0)
m.c1357 = Constraint(expr= - m.b136 + m.x597 <= 0)
m.c1358 = Constraint(expr= - m.b137 + m.x598 <= 0)
m.c1359 = Constraint(expr= - m.b138 + m.x599 <= 0)
m.c1360 = Constr... | |
self.walls[(Num_layer ) * 6 + 4]) / 3
self.Vec_12[Num_layer].pos = self.walls[(Num_layer) * 6 + 0] + self.walls[(Num_layer) * 6 + 1]
self.Vec_12[Num_layer].axis = vector.norm(self.walls[(Num_layer) * 6 + 2] + self.walls[(Num_layer) * 6 + 3] - (
self.walls[(Num_layer) * 6 + 0] + self.walls[(Num_layer) * 6 + 1]))... | |
<reponame>kevindwei/adminset
import os, datetime, mimetypes, re, inspect, time, logging
try:
from PIL import Image
except ImportError:
import Image
from base64 import b64encode, b64decode
from string import maketrans
from tarfile import TarFile
from django.core.cache import cache
from django.utils.translation import ... | |
r"""Downloads and converts Market1501 data to TFRecords of TF-Example protos.
This module downloads the Market1501 data, uncompresses it, reads the files
that make up the Market1501 data and creates two TFRecord datasets: one for train
and one for test. Each TFRecord dataset is comprised of a set of TF-Example
protoco... | |
[]
# l_list = Approval.objects.filter(
# submitter=request.user,
# status='current',
# )
# for l in l_list:
# lchild = l.child_obj
# # mooring text required?
# if type(lchild) == MooringLicence:
# if Mooring.objects.filter(mooring_licence=lchild):
# mooring = Mooring.objects.filter(mooring_licence=lchild)[0]
... | |
name, color, data):
try:
level = str(utils.comma(int(data['player']['achievements']['bedwars_level']))) + ' ⭐'
except:
level = 'N/A'
try:
games_played = data['player']['stats']['Bedwars']['four_four_games_played_bedwars']
except:
games_played = 'N/A'
try:
exp = data['player']['stats']['Bedwars']['Experience']... | |
<filename>designs/kitaplarim.py
qt# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'kitaplarim.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doi... | |
assert data.ExtraFileExtensionsHelpTexts2 == "string"
assert data.Failed == "string"
assert data.FailedDownloadHandling == "string"
assert data.FailedLoadingSearchResults == "string"
assert data.FailedToLoadMovieFromAPI == "string"
assert data.FailedToLoadQueue == "string"
assert data.FeatureRequests == "string"
... | |
<reponame>OCR-D/ocrd_segment
from __future__ import absolute_import
import sys
import os
import json
from itertools import chain
import click
import numpy as np
from skimage import draw
from PIL import Image
from shapely.geometry import Polygon
from ocrd import Processor
from ocrd_utils import (
getLogger,
initLogg... | |
<reponame>IsaiahPressman/Kaggle_Hungry_Geese<gh_stars>0
from kaggle_environments import make as kaggle_make
from kaggle_environments.envs.hungry_geese.hungry_geese import Action, Configuration, row_col
from typing import *
import torch
from ..config import N_PLAYERS
from .goose_env import ObsType
from ..utils i... | |
# Gauss-seidel solver is used
import numpy as np
import math
import time
# Constants
rho = 1.19 # Density of air (kg/m^3)
Cp = 1005 # Specific heat of air (J/kg-K)
visc_k = 1.5462e-5 # Kinematic viscosity of air (m^2/s)
visc_d = 1.84e-5 # Dynamic viscosity of air (N-s/m^2)
k_air = 0.0261 # Thermal conductivity of ai... | |
updating. "
"Please wait a few seconds and try again.")
return
jobView.updating_now = True
try:
self.progress = ExecutionProgressDialog(self.vistrail_view)
self.progress.show()
if not self.jobMonitor.currentWorkflow():
self.create_job = True
result = self.execute_current_workflow(reason=reason, sinks=sinks)... | |
<filename>code/mesh_recons/fnnrecon.py
import numpy as np
import os, sys
import math, time
from scipy.interpolate import InterpolatedUnivariateSpline as iuspline
from matplotlib import pyplot as plt
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import tensorflow_probability as tfp
import mesh_tensorflow a... | |
"""
Calculate the bounding box of the polygons.
Returns
-------
out : Numpy array[2, 2] or None
Bounding box of this polygon in the form [[x_min, y_min],
[x_max, y_max]], or None if the polygon is empty.
"""
if len(self.polygons) == 0:
return None
return numpy.array(
(
(
min(pts[:, 0].min() for pts in sel... | |
"python-ciscoconfparse",
"rubygem-chef-server-api",
"rubygem-extlib",
"rubygem-sprockets-helpers",
"rubygem-sqlite3",
"patterns-cloud",
"suse-openstack-cloud-user",
"python-fake-factory",
"rubygem-multipart-post",
"rubygem-ember-source",
"python-aioeventlet",
"yast2-crowbar",
"xtrabackup",
"openstack-dashb... | |
# "ts":1590228000000,
# "o":"9139.59",
# "c":"9131.94",
# "h":"9139.99",
# "l":"9121.71",
# "v":"25.20648"
# }
# }
#
data = self.safe_value(ohlcv, 'data', {})
return [
self.safe_integer(data, 'ts'),
self.safe_number(data, 'o'),
self.safe_number(data, 'h'),
self.safe_number(data, 'l'),
self.safe_number(da... | |
Constraint(expr= m.b5 - m.b13 + m.b40 <= 1)
m.c94 = Constraint(expr= m.b5 - m.b15 + m.b41 <= 1)
m.c95 = Constraint(expr= m.b5 - m.b17 + m.b42 <= 1)
m.c96 = Constraint(expr= m.b5 - m.b19 + m.b43 <= 1)
m.c97 = Constraint(expr= m.b5 - m.b21 + m.b44 <= 1)
m.c98 = Constraint(expr= m.b5 - m.b23 + m.b45 <= 1)
m.c99 = Co... | |
<filename>microstrategy_api/task_proc/task_proc.py<gh_stars>0
import re
import urllib.parse
import warnings
from enum import Enum
import time
from fnmatch import fnmatch
from typing import Optional, List, Set, Union
import requests
import logging
from bs4 import BeautifulSoup
from microstrategy_api.task_proc.doc... | |
<filename>DNN/Intention/NeuralNet_BinaryClass-Intention.py
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 15 21:56:08 2020
@author: <NAME>
"""
# STEP1----------------- # Importing the libraries------------
#-------------------------------------------------------------
import os
import numpy as np
import matp... | |
"""
This test suite contains tests to validate certificate create/edit/delete with
different possible way and with different roles of users.
Test requirement:
Below Env variables need to be set
CATTLE_TEST_URL - url to rancher server
ADMIN_TOKEN - Admin token from rancher
USER_TOKEN - User token from rancher
RANCHER_CL... | |
958361, 958367, 958369, 958381, 958393,
958423, 958439, 958459, 958481, 958487, 958499, 958501, 958519,
958523, 958541, 958543, 958547, 958549, 958553, 958577, 958609,
958627, 958637, 958667, 958669, 958673, 958679, 958687, 958693,
958729, 958739, 958777, 958787, 958807, 958819, 958829, 958843,
958849, 958871, 958... | |
<gh_stars>0
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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, eithe... | |
<filename>intrinsic/dashboard.py
from plagcomps.intrinsic.featureextraction import FeatureExtractor
from plagcomps.evaluation.intrinsic import evaluate_n_documents
from plagcomps.shared.util import IntrinsicUtility
from plagcomps.shared.util import BaseUtility
from plagcomps.dbconstants import username
from plagcomps.d... | |
0.00435488,
'Renaming Unit/Int Front End RAT/Subthreshold Leakage with power gating': 0.00248228,
'Renaming Unit/Peak Dynamic': 3.58947,
'Renaming Unit/Runtime Dynamic': 0.32097,
'Renaming Unit/Subthreshold Leakage': 0.0552466,
'Renaming Unit/Subthreshold Leakage with power gating': 0.0276461,
'Runtime Dynamic': ... | |
= CONFIG.FILTERS.SOBEL_3x3
# find best threshold for first level
for sigma in range(100, 175, 25):
s = sigma / 100
blured_img = Application.do_gaussian_blur_image_job(port_input_name='GREY', sigma=s,
port_output_name='BLURED_S_' + str(s).replace('.', '_'))
for low in range(70, 150, 10):
for high in range(90, 20... | |
import pytest
from polyline import ClosedPolyline
def test_polygon_init_empty():
path = ClosedPolyline()
assert not len(path)
def test_polygon_init_nonempty():
"""You can give any number of points to a path at instantiation"""
points = [(0, 0), (5, 0), (5, 5), (5, 10), (10, 10)]
path = ClosedPolyline(*points)... | |
<reponame>carderne/descarteslabs-python
# -*- coding: utf-8 -*-
import pytest
import responses
import textwrap
import warnings
from datetime import datetime
from mock import patch
from descarteslabs.client.exceptions import BadRequestError
from .. import properties
from ..attributes import AttributeValidationError, ... | |
<reponame>darcy-xiao/TupleNet
from __future__ import print_function
import os
import sys
import subprocess
import time
import struct
import socket
from optparse import OptionParser
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_dir)
from lcp.flow_common import table_note... | |
<gh_stars>0
import os
import sys
import time
import glob
import numpy as np
import torch
import util
import logging
import argparse
import torch.nn as nn
import torch.utils
import utils
from matplotlib import pyplot as plt
import torch.nn.functional as F
import torchvision.datasets as dset
import torch.backends.cudnn a... | |
# =================================================================
# Copyright (C) 2021-2021 52°North Spatial Information Research GmbH
#
# 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... | |
<reponame>functor/operator<filename>plsync/mlabconfig_test.py
"""Tests for mlabconfig."""
import contextlib
import logging
import mlabconfig
import mock
import optparse
import os
from planetlab import model
import StringIO
import textwrap
import time
import unittest
@contextlib.contextmanager
def OpenStringIO(sio):
... | |
<gh_stars>1-10
import os
import sys
import math
import pytest
import numpy as np
import osmnx as ox
import logging as lg
import networkx as nx
import anprx.core as core
import anprx.helpers as helpers
import anprx.exceptions as exceptions
from anprx.constants import Units
###
###
def get_lat_lng():
latitudes = [54.... | |
from time import sleep
from pysphere import VITask, FaultTypes
from pysphere.vi_virtual_machine import VIVirtualMachine
from pysphere.resources.vi_exception import VIException, VIApiException
from pysphere.vi_mor import VIMor
from pysphere.vi_task import VITask
import ssl
import pypacksrc
import re, subprocess
def ... | |
<reponame>whoarethebritons/appscale
""" Utility functions used by the AdminServer. """
import errno
import json
import hmac
import logging
import os
import shutil
import socket
import tarfile
from appscale.common.constants import HTTPCodes
from appscale.common.constants import InvalidConfiguration
from appscale.commo... | |
city, Montana",1808),
("East Missoula CDP, Montana",2132),
("Edgar CDP, Montana",103),
("Ekalaka town, Montana",373),
("Elkhorn CDP, Montana",0),
("Elliston CDP, Montana",230),
("Elmo CDP, Montana",177),
("Emigrant CDP, Montana",233),
("Ennis town, Montana",925),
("Eureka town, Montana",1405),
("Evaro CDP, Montana",416... | |
import time
import os
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from astropy.io import fits
from gwcs import wcstools
from gwcs.utils import _toindex
from jwst import datamodels
from jwst.assign_wcs import nirspec
from . import auxiliary_functions as auxfunc
"""
This script tests the pipe... | |
from __future__ import annotations
from typing import TYPE_CHECKING, Dict, List, NewType, Optional, Tuple, Union
if TYPE_CHECKING:
from typing_extensions import Literal
_OTTypeAction = NewType('_OTTypeAction', int)
_OTTypeActionNop = _OTTypeAction(0)
_OTTypeActionSkip = _OTTypeAction(1)
_OTTypeActionInsert = _OTT... | |
controllers.get_issue_by_jid() com vários itens, deve
deve retorna uma lista considerando o valor explicito do atributo
``order_by``
"""
journal = utils.makeOneJournal()
self._make_one({'_id': '1', 'journal': journal.id, 'number': '10'})
self._make_one({'_id': '2', 'journal': journal.id, 'number': '9'})
self._... | |
from typing import AnyStr, Callable, Optional, List, Dict, Any
from typing_extensions import Literal
import sys
import os
import json
from functools import partial
from PySide2 import QtCore, QtGui, QtWidgets
from PySide2.QtGui import QIcon
from compas.data import Data
from ..views import View120
from ..views impo... | |
- 2 * self.V.T @ M @ self.B, self.V)
self.poly4 = Polynomial(self.P, self.x + self.v,
- 2 * self.V.T @ M @ self.A, self.V)
self.poly_deriv = [Polynomial(self.P, self.x + self.v, self.V,
(self.A[i,:] @ self.Z)[0] * self.V, deriv=True,
deriv_index=i) for i in self.zero_rows]
self.poly5 = Polynomial(self.c2, self.x ... | |
)
# Now make the master attribute
jsonDebug( 'Creating master light data attribute' )
attr = ldAttr.create( name, shortName,
ldChildren[0], ldChildren[1], ldChildren[2],
ldChildren[3], ldChildren[4], ldChildren[5],
ldChildren[6], ldChildren[7] )
jsonDebug( 'Setting master light ... | |
is None:
print ("Mask file compulsory. Please provide mask='maskfilepath.ply'")
else:
# rweights = np.array([])
datR, rweights = randcatprep(datfile, randcatsize, maskfile, cosmology)
# randfile='./randcat.dat'
# datR, rweights=datprep(randfile,'random',cosmology)
else:
datR, rweights = datprep(randfile, 'rando... | |
def clearCache(group, x = 0, y = 0):
if confirm("Reset the Autoscript Tag cache?"):
global savedtags
savedtags = { }
notify("{} reset the global tag cache.".format(me))
if confirm("Reset the Attachment Dictionary?\nNote: Cards will no longer be attached."):
setGlobalVariable('cattach', "{ }")
notify("{} reset t... | |
<reponame>ChristopherMayes/PyCSR2D
from csr2d.deposit import histogram_cic_2d
from csr2d.central_difference import central_difference_z
from csr2d.core2 import psi_sx, psi_s, psi_x0, psi_x0_hat, Es_case_B0, Es_case_A, Fx_case_A, Es_case_C, Fx_case_C, Es_case_D
from csr2d.core2 import psi_s_SC, psi_x0_SC
from csr2d.conv... | |
<filename>src/lib/Bcfg2/Server/Core.py
"""Bcfg2.Server.Core provides the runtime support for Bcfg2 modules."""
import os
import atexit
import logging
import select
import sys
import threading
import time
import inspect
import lxml.etree
from traceback import format_exc
import Bcfg2.settings
import Bcfg2.Server
import ... | |
% ('nan', x[1])
elif ~pd.isnull(x[0]) and pd.isnull(x[1]):
return u'<table style="background-color:#0000ff;font-weight:bold;">'+\
'<tr><td>%s</td></tr><tr><td>%s</td></tr></table>' % (x[0],'nan')
else:
return u'<table style="background-color:#ff0000;font-weight:bold;">'+\
'<tr><td>%s</td></tr><tr><td>%s</td></tr>... | |
# -*- coding: utf-8 -*-
"""
This module contains methods for generating statistics about the alignments generated by amplimap.
This includes the number of reads and read families per probe, per sample as well as data on off-target
alignments.
"""
# python 3 compat
# http://python-future.org/compatible_idioms.html
from... | |
5.725E-03 3.450E-01 2.000E+05 0.000E+00 0.000E+00 8.359E+05
3.58483819E-03 5653.1 1.133E+01 1.011E+11 6.184E-03 3.443E-01 2.000E+05 0.000E+00 0.000E+00 8.135E+05
4.50339792E-03 5687.5 1.424E+01 1.236E+11 6.727E-03 3.462E-01 2.000E+05 0.000E+00 0.000E+00 7.959E+05
5.62492776E-03 5722.0 1.779E+01 1.504E+11 7.376E-03 3... | |
import tensorflow as tf
import numpy as np
try:
from models.read_util.read_train_data import get_all_bearings
except:
from ..read_util.read_train_data import get_all_bearings
# from read_train_data import get_all_bearings
VIB_SIZE = 2000
step = 20
IMAGE_SIZE = VIB_SIZE//step
# Global constants describing the CIFAR... | |
driver = config_json.get('driver')
self.assertEqual(driver, {})
###
# Commands
###
cmds = config_json.get('commands')
self.assertIsNotNone(cmds)
self.assertIsNotNone(cmds.get(DriverEvent.START_AUTOSAMPLE))
self.assertIsNotNone(cmds.get(DriverEvent.STOP_AUTOSAMPLE))
###
# Parameters
###
params = config_jso... | |
# Original Version: <NAME> (http://carpedm20.github.io)
# + Source: https://github.com/carpedm20/DCGAN-tensorflow/blob/e30539fb5e20d5a0fed40935853da97e9e55eee8/model.py
# + License: MIT
# [2016-08-05] Modifications for Completion: <NAME> (http://bamos.github.io)
# + License: MIT
from __future__ import division
import ... | |
<reponame>jsmith00/contrail-controller
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import gevent
import gevent.queue
import gevent.wsgi
import os
import sys
import logging
import pdb
import json
from pprint import pprint
import functools
import socket
import time
import errno
import re
import c... | |
from app.utilities import utils
from app.data.database import DB
from app.data.item_components import ItemComponent
from app.data.components import Type
from app.engine import action, combat_calcs, equations, banner
from app.engine import item_system, skill_system, item_funcs
from app.engine.game_state impo... | |
import numpy as np
import torch as th
from problem2 import random_policy
# Note: please don't import any new package. You should solve this problem using only the package(s) above.
#-------------------------------------------------------------------------
'''
Problem 3: Q Network (35 points)
In this problem, you wil... | |
<reponame>uhlerlab/graphical_models
# Author: <NAME>
"""Base class for causal DAGs
"""
from collections import defaultdict
import numpy as np
import itertools as itr
from graphical_models.utils import core_utils
import operator as op
from graphical_models.custom_types import Node, DirectedEdge, NodeSet, warn_untested
... | |
<gh_stars>1-10
from __future__ import absolute_import
import bisect
import functools
import itertools
import logging
import math
import operator
import zlib
from calendar import Calendar
from collections import OrderedDict, namedtuple
from datetime import datetime, timedelta
import pytz
from django.utils import datef... | |
!= '' and economy.is_living(x)
and x != spouse
and (economy.people[x].supported is None or
economy.people[x].supported == p.id)
and economy.people[x].age >= 18]
if l1:
u = max(l1, key=lambda x: x[1])[1]
l2 = [x for x, y in l1 if y == u]
fst_heir = max(l2, key=lambda x:
economy.people[x].asset_value())... | |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import scipy.linalg
import scipy.special
from . import thops
def nan_throw(tensor, name="tensor"):
stop = False
if ((tensor!=tensor).any()):
print(name + " has nans")
stop = True
if (torch.isinf(tensor).any()):
print(name + " h... | |
+ 1;
// Auto-padding if requested
if (padH_l == -1 || padH_r == -1) { // vertical half padding
padH_l = padH_r = dil_kH / 2;
}
else if (padH_l == -2 || padH_r == -2) { // vertical full padding
padH_l = padH_r = dil_kH - 1;
}
else if (padH_l < 0 || padH_r < 0) {
PyErr_SetString(PyExc_ValueError, "BaseGpuCorrMM... | |
<reponame>xuhao1/taichi_three
import taichi as ti
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
ti.init(arch=ti.gpu)
@ti.data_oriented
class lbm_solver:
def __init__(self,
nx, # domain size
ny,
niu, # viscosity of fluid
# [left,top,right,bottom] boundary conditions: 0 -> Dirichle... | |
# ******************************************************************************
# pysimm.cassandra module
# ******************************************************************************
#
# ******************************************************************************
# License
# *************************************... | |
# noinspection SpellCheckingInspection
icons_smileys_people = [
['😀', ' Grinning Face'],
['😃', ' Grinning Face with Big Eyes'],
['😄', ' Grinning Face with Smiling Eyes'],
['😁', ' Beaming Face with Smiling Eyes'],
['😆', ' Grinning Squinting Face'],
['😅', ' Grinning Face with Sweat'],
['🤣', ' Rolling on the... | |
= ccols = 0
pos = []
pos2 = []
for x in i:
#if x == ';':
if x is Ellipsis:
rows.append([])
if final_cols > 0 and final_cols != ccols:
error("Incompatible shapes!")
else:
final_cols = ccols
final_rows += crows
ccols = 0
pos.append(Ellipsis)
elif isinstance(x, mvar):
shp = x.msize
if len(s... | |
and not request.POST.get("reset"):
form = PublicationForm(request.POST)
if form.is_valid():
events = []
# start by notifying the RFC Editor
import ietf.sync.rfceditor
response, error = ietf.sync.rfceditor.post_approved_draft(settings.RFC_EDITOR_SYNC_NOTIFICATION_URL, doc.name)
if error:
return render(request, ... | |
hands = ['''Game Hand #712008727 - Tournament #24095328 - Holdem(No Limit) - Level 9 (2500.00/5000.00)- 2021/02/20 18:46:52 UTC
Table '3' 9-max Seat #2 is the button
Seat 1: MateusVR (146796.00)
Seat 2: PotNoodle99912 (155072.00)
Seat 3: Frank126 (97418.00)
Seat 4: TiltedMILF (53800.00)
Seat 5: What_Truth (43825.00)
Se... | |
routes
''',
'maximum_routes',
'Cisco-IOS-XR-ipv4-pim-cfg', False),
_MetaInfoClassMember('warning-threshold', ATTRIBUTE, 'int' , None, None,
[('1', '200000')], [],
''' Set threshold to print warning
''',
'warning_threshold',
'Cisco-IOS-XR-ipv4-pim-cfg', False),
],
'Cisco-IOS-XR-ipv4-pim-cfg',
'routes',
_y... | |
None:
DOM.suspend()
else:
logger.error("%s does not exist." % self.vm_name)
self._disconnect()
def machine_resume(self):
"""
Resume a paused machine
"""
logger.debug("Resuming machine %s..."%self.vm_name)
DOM = self._connect()
if DOM is not None:
DOM.resume()
else:
logger.error("%s does not exist." % ... | |
import os
import logging
import tensorflow as tf
import random
from model_factory import get_emb_vec
logger = logging.getLogger(__name__)
global tf_image, tf_label, status
import numpy as np
class Preprocess:
def __init__(self, directory_path, filetype, tfrecord_image, tfrecord_label):
"""
Return a randomized list... | |
import base64, discord, hashlib, math, os, requests, time, traceback, youtube_dl
from discord.utils import get
from utils.datautils import config, data, default, discard, save_data, set_client
from utils.discordbot import BotClient, emoji_shorthand, send
from utils.errors import BotError
from utils.logging import log... | |
to program a check for such very unlikely inputs.
(IterableObject(b"abc"), [97, 98, 99]), # The blueprint only sees 'IterableObject', not 'bytes', when checking the input data type. However, it's OK that the blueprint accepts it, as it would be unnecessarily complicated to program a check for such very unlikely inputs... | |
<reponame>cybrnode/pyzkaccess
from datetime import datetime
from enum import Enum
from unittest.mock import Mock, call
import pytest
from pyzkaccess.device import ZK400
from pyzkaccess.enum import SensorType, VerifyMode
from pyzkaccess.param import (
DaylightSavingMomentMode1,
DaylightSavingMomentMode2,
DevicePara... | |
foo_clip_output2 = "fooclip_output2"
arcpy.MultipartToSinglepart_management(foo_clip_output, foo_clip_output2)
# Select by location - intersect of centerline and inundated_area_clip
subreach_x = (r"ScriptOutputs/subreach_{}".format(puppy))
foo_subreach = arcpy.SelectLayerByLocation_management(foo_clip_output2,'... | |
<gh_stars>1000+
#
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 <NAME> and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as publi... | |
ELSE 0 END AS Unset_No_Basics
FROM (
SELECT participant_id,
hpo_id,
sign_up_time,
consent_for_study_enrollment_time,
enrollment_status_member_time,
enrollment_status_core_stored_sample_time,
participant_origin,
MAX(WhatRaceEthnicity_Hispanic) AS WhatRaceEthnicity_Hispanic,
MAX(WhatRaceEthnicity_Black) AS What... | |
"""Define tests for v3 System objects."""
# pylint: disable=protected-access,too-many-arguments,unused-argument
from datetime import datetime, timedelta
import logging
import aiohttp
import pytest
import pytz
from simplipy import API
from simplipy.errors import (
EndpointUnavailableError,
InvalidCredentialsError,
... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 <NAME> <<EMAIL>>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
This module contains various general utility functions.
"""
from __future__ import with_statement
import logging
import warnings
logger = logging.getLo... | |
<gh_stars>0
# coding: utf-8
"""
Prisma Cloud Compute API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 21.04.439
Generated by: https://openapi-generator.tech
"""
try:
from inspect import getfullargsp... | |
import pytz
from datetime import datetime
import pendulum
from ..conftest import assert_datetime
def test_equal_to_true():
d1 = pendulum.datetime(2000, 1, 1, 1, 2, 3)
d2 = pendulum.datetime(2000, 1, 1, 1, 2, 3)
d3 = datetime(2000, 1, 1, 1, 2, 3, tzinfo= pendulum.UTC)
assert d2 == d1
assert d3 == d1
def test... | |
1,
"cluster": "test",
"hostname": hostname,
"tf_version": "0001",
"event_type": "DEVICE_SNAPSHOT",
"device_infos": [],
"data": data_1
}
data_2 = {
"gcertstatus": "LOAS2",
"krbstatus": "KRB2"
}
host_event_2 = {
"time": 2,
"cluster": "test",
"hostname": hostname,
"tf_version": "0001",
"event_type": "DEVI... | |
import os
import sys
import random
import torch
import torch.nn as nn
import numpy as np
from itranslit.config import LANGDATA
from itranslit.utils import download_model_and_get_path
class Encoder(nn.Module):
'''
Simple RNN based encoder network
'''
def __init__(self, input_dim, embed_dim, hidden_dim ,
rnn_type ... | |
])
self._pad0048 = v_bytes(size=4)
class _unnamed_29211(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.Head = v_uint64()
class ALPC_COMPLETION_LIST_STATE(vstruct.VStruct):
def __init__(self):
vstruct.VStruct.__init__(self)
self.u1 = _unnamed_27537()
class WHEA_ERR... | |
<reponame>scratchmex/django-rest-framework
import pytest
from django.db import models
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.test import TestCase
from rest_framework import generics, renderers, serializers, status
from rest_framework.response import Response
from res... | |
a contribution, assessment, review is in a certain stage
in the workflow, its record may be closed to others than the owner, and
after finalization, some fields may be open to authenticated users or
the public.
This method determines the record is readable by the current user.
If the record is not part of the wo... | |
a substring of shorttext exist within longtext such that the
substring is at least half the length of longtext?
Closure, but does not reference any external variables.
Args:
longtext: Longer string.
shorttext: Shorter string.
i: Start index of quarter length substring within longtext.
Returns:
Five element Ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.