input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
<filename>mumu/feature/_woe.py
# coding: utf-8
# ================================================
# Project: mumu
# File: feature/_woe.py
# Author: <NAME>
# Email: <EMAIL>
# Date: 2021/6/24 18:24
# Description:
# ================================================
import os
import string
import logging
import math
import ... | |
# Original file of get_SNP_list (archived)
# Step 01
# This code is to check Rsq values across all input file .info.gz
# Create two files of variants to be excluded and kept
# Below information is saved in .txt files (variant_excluded.txt and variant_kept.txt):
# - SNP, REF(0), ALT(1), and ALT_freq, MAF, Rsq (r2) per e... | |
#!/usr/bin/env python3
# utf-8
# The Audible Graph Reader Project
# Copyright 2020 Missouri State University
# 5.6.2020
# User must install pytesseract version 5
# The following must exist in same dir as this file:
# blank.wav, tutorial.wav, tonal_intro.wav, ffmpeg.exe,
# agr.ico, AGRHorizontalLogo.png... | |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.2'
# jupytext_version: 1.2.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %% [markdown]
# # Examples of structural change in the Abel-Hayashi... | |
is specifically designed to require,
# such as by intimate data communication or control flow between those
# subprograms and other parts of the work.
# The Corresponding Source need not include anything that users
# can regenerate automatically from other parts of the Corresponding
# Source.
# The Corresponding Sour... | |
not, then use the same technique as above (ends of helices)
if (options["-eigen"].value):
#do a SVD of the newly rotated coordinates to get the new eigenvectors
svdvector1=[]
svdvector2=[]
for i in range(0,lengthh1):
svdvector1.append(helix_1_CA_coords_rotated[i]-center1)
for i in range(0,lengthh2):
svdvector... | |
<reponame>felipeAraujo/Bet-Calculator<filename>test_bet.py
import unittest
from bet_calculator.bet_calculator import Bet_Calculator
from decimal import *
class Bet_Test_Case(unittest.TestCase):
"""Test the Bet_Calculator class"""
def setUp(self):
self.bet_calculator = Bet_Calculator()
def test_if_is_calculating_... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.0-a53ec6ee1b (http://hl7.org/fhir/StructureDefinition/CapabilityStatement) on 2019-01-22.
# 2019, SMART Health IT.
from . import domainresource
class CapabilityStatement(domainresource.DomainResource):
"""
A
s
t
a
t
e
m
e
n
t
o
f... | |
<reponame>SDriven/Dstl-Satellite-Imagery-Feature-Detection
# Training the U-Net
import matplotlib
matplotlib.use("Pdf")
import matplotlib.pyplot as plt
import time
from Preprocessing import M, init_logging
from datetime import datetime
import numpy as np
import pdb
import os
# os.environ['THEANO_FLAGS'] = 'mode=FAST_R... | |
<reponame>smithblack-0/Utility<filename>Utility/Torch/Archivist.py
import math
import uuid
import warnings
from typing import List
import torch
from torch import nn
from Utility.Torch import Learnables
from Utility.Torch import Activation
"""
Description:
The purpose of this module is to act as a container for hold... | |
# Copyright (c) 2022 <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, so... | |
4
self.assertEqual(weight_data, all_vars[4].data)
@unittest.skipIf(not TEST_CUDNN, 'CUDNN not available')
def test_cudnn_weight_tying(self):
rnns = [
nn.LSTM(10, 20, batch_first=True, bidirectional=True),
nn.GRU(10, 20, batch_first=True, bidirectional=True),
nn.RNN(10, 20, batch_first=True, bidirectional=True)
... | |
# Generated from ./CSharp4.g4 by ANTLR 4.5.2
from antlr4 import *
# This class defines a complete listener for a parse tree produced by CSharp4Parser.
class CSharp4Listener(ParseTreeListener):
# Enter a parse tree produced by CSharp4Parser#namespace_name.
def enterNamespace_name(self, ctx):
pass
# Exit a parse t... | |
<reponame>sandutsar/ccxt<filename>python/ccxt/async_support/buda.py<gh_stars>0
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import... | |
self.__port, "POST",
Authentication.URI_VDC_AUTHN_PROFILE,
body)
if autoRegCoprHDNImportOSProjects == 'true':
self.add_os_tenants()
def add_os_tenants(self):
profiles = self.list_os_tenants()
openstack_tenants = []
for pr in profiles:
pr['excluded']='false'
pr['os_id'] = pr.pop('id')
openstack_tenants.appe... | |
<filename>CytoPy/flow/gating/utilities.py<gh_stars>0
from shapely.geometry import Point, Polygon
from functools import partial
from sklearn.neighbors import KernelDensity, KDTree
import pandas as pd
import numpy as np
import inspect
def check_peak(peaks: np.array,
probs: np.array,
t: float = 0.05) -> np.array:
""... | |
<filename>minecraft/networking/packets.py
from io import BytesIO
from zlib import compress
from .types import (
VarInt, Integer, Float, Double, UnsignedShort, Long, Byte, UnsignedByte,
String, VarIntPrefixedByteArray, Boolean, UUID
)
class PacketBuffer(object):
def __init__(self):
self.bytes = BytesIO()
def se... | |
<reponame>s-akanksha/DialoGraph_ICLR21<filename>src/bot/cocoa/src/model/evaluate.py
import numpy as np
from src.model.preprocess import markers
from src.model.graph import Graph
from src.lib.bleu import compute_bleu
from src.lib.bleu import bleu_stats as get_bleu_stats
from src.lib.bleu import bleu as get_bleu
from src... | |
str(str_comp_01) + ')* np.ones(np.shape(self.yg))'
if str_comp_10.find('x') & str_comp_10.find('y') == -1:
str_comp_10 = '(' + str(str_comp_10) + ')* np.ones(np.shape(self.yg))'
if str_comp_11.find('x') & str_comp_11.find('y') == -1:
str_comp_11 = '(' + str(str_comp_11) + ')* np.ones(np.shape(self.yg))'
# evalua... | |
<reponame>ElsevierSoftwareX/SOFTX_2018_73<gh_stars>1-10
"""
This module provides a problem and solver class to solve solid mechanics
problems using the mixed function space functionality in FEniCS.
"""
from __future__ import print_function
import dolfin as dlf
from . import materials
from .utils import duplicate_expr... | |
<reponame>seanlam97/PDK_Generator
import yaml
from common.common_methods import convert_to_macro
class DRC():
"""Class associated with DRC params
A Process YAML is used to define DRC params and this class can create
the .lydrc (XML formatted) string, which can be written to a .lydrc file to
be used for KLayout's... | |
ki.kickoutFromGroup(op.param1,[op.param2])
ki.inviteIntoGroup(op.param1,[op.param3])
ko.acceptGroupInvitation(op.param1)
except:
try:
kc.kickoutFromGroup(op.param1,[op.param2])
kc.inviteIntoGroup(op.param1,[op.param3])
ko.acceptGroupInvitation(op.param1)
except:
try:
random.choice(ABC).findAndAddContactsByMid... | |
from training_config import Config, secs_to_str, update#, immut
from configparser import ConfigParser
import os
import shutil
import sys
import subprocess
import math
import random
from history import TrainTestHistory
from model_utils import newest_checkpoint
import bayes_search as bayes
import exploration_policy
impor... | |
<reponame>gharib85/ufss
#Standard python libraries
import os
import warnings
import copy
import time
import itertools
import functools
#Dependencies - numpy, scipy, matplotlib, pyfftw
import numpy as np
import matplotlib.pyplot as plt
import pyfftw
from pyfftw.interfaces.numpy_fft import fft, fftshift, ifft, ifftshift... | |
-1 else "Failed"
st.log("OSPF - Interface data {} check {}".format(key, result_str))
return result
def fetch_ip_route_summary(dut, vrf='default', key = 'ospf',version='ip', cli_type=''):
"""
:param dut:
:param vrf:
:param key:
:param match:
:return:
"""
st.log("Routing table summary on DUT {} , vrf {}.".fo... | |
'Rcmd.Isis.Instances.Instance.PrefixEventOfflines.PrefixEventOffline.TimeLine.LcIp',
[], [],
''' List of Linecards' completion point for IP
routes
''',
'lc_ip',
'Cisco-IOS-XR-infra-rcmd-oper', False),
_MetaInfoClassMember('lc-mpls', REFERENCE_LIST, 'LcMpls' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_infra_rcmd_op... | |
<reponame>thata/galaxy-dist
"""
Support for generating the options for a SelectToolParameter dynamically (based
on the values of other parameters or other aspects of the current state)
"""
import operator, sys, os, logging
import basic, validation
from galaxy.util import string_as_bool
import galaxy.tools
log = loggi... | |
# -*- coding: utf-8 -*-
# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
# authors:
# <NAME>, <EMAIL>
"""Functions related to facet recognition of nanocrystals."""
from scipy.ndimage.measurement... | |
<reponame>itsyaboyrocket/ttleveleditor
"""
UI for object property control
"""
import wx
import os
import math
from wx.lib.embeddedimage import PyEmbeddedImage
from wx.lib.scrolledpanel import ScrolledPanel
from wx.lib.agw.cubecolourdialog import *
from direct.wxwidgets.WxSlider import *
from pandac.PandaModules import... | |
<filename>dreamerv2/common/envs.py<gh_stars>0
import atexit
import os
import sys
import threading
import traceback
import cloudpickle
import gym
import numpy as np
class GymWrapper:
def __init__(self, env, obs_key='image', act_key='action'):
self._env = env
self._obs_is_dict = hasattr(self._env.observation_space... | |
age_conf = np.round(action_conf, 2), np.round(subject_conf, 2), np.round(age_conf, 2)
cm_filename_without_extension = filename_prefix + 'confusion_mat'
action_labels = np.delete(action_labels, action_ignore_idx, 0)
action_conf = np.delete(action_conf, action_ignore_idx, 0)
action_conf = np.delete(action_conf, actio... | |
# Copyright (c) 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | |
and proof tracing cannot be set together.'
if not self.glucose:
self.glucose = pysolvers.glucose3_new()
if bootstrap_with:
if type(bootstrap_with) == CNFPlus and bootstrap_with.atmosts:
raise NotImplementedError('Atmost constraints are not supported by Glucose3')
for clause in bootstrap_with:
self.add_clause(... | |
guard
self.assertIs(invalid_capturing_move, False)
except:
self.fail("Blue Horse from east should not be able to capture a blue piece")
"""GUARDS"""
# @visibility('visible')
def test_valid_move_for_guard(self):
"""GUARD: test valid moves for guard"""
g = JanggiGame()
try:
valid_move = g.make_move('d10','d9') ... | |
<reponame>sumedhpb/testrunner
import logger
import unittest
from membase.helper.rebalance_helper import RebalanceHelper
from couchbase_helper.cluster import Cluster
from basetestcase import BaseTestCase
from remote.remote_util import RemoteMachineShellConnection
from membase.helper.subdoc_helper import SubdocHelper
f... | |
.. [14] <NAME>. and <NAME>. "Parallelizing the dual revised
simplex method." Mathematical Programming Computation, 10 (1),
119-142, 2018. DOI: 10.1007/s12532-017-0130-5
.. [15] Harris, <NAME>. "Pivot selection methods of the Devex LP code."
Mathematical programming 5.1 (1973): 1-28.
.. [16] <NAME>, and <NAME>. "A ... | |
%s' % readret[1])
ret = readret[1]
self._flush_proxy_server()
return ret.strip()
def wait_for_transmit_done(self,chasId,card,port,timeout=180):
'''
wait for transmiting done
args:
- chasId: normally should be 1
- card: ixia card
- port: ixia port
- timeout: default 180s
return:
- 0: ok
- non zero: erro... | |
<gh_stars>0
#!/usr/bin/python
'''
Cloud project:
- Software Defined Networking (SDN)
-- project related algorithm (template)
<NAME>
'''
#import re
import numpy as np
#from scipy.optimize import minimize
#import scipy.io
TEM_OUT = 'fmin_iteration_out.txt'
'''
['EM', 'res_ratio', 'D', 'Weight', 'I', '... | |
bool. Whether to add embeddings for `token_type_ids`.
token_type_ids: (optional) int32 Tensor of shape [batch_size, seq_length].
Must be specified if `use_token_type` is True.
token_type_vocab_size: int. The vocabulary size of `token_type_ids`.
token_type_embedding_name: string. The name of the embedding table vari... | |
tuple else tuple(int(i)
for i in tsize[1:-1].split(',')) # if size is a string
lpdf = kwargs.get('pdf', False)
fpdf = kwargs.get('fpdf', False)
lpng = kwargs.get('png', False)
leps = kwargs.get('eps', False)
browser = kwargs.get('browser', False)
warnings = "" if kwargs.get("warnings", False) else "-q"
# path... | |
<reponame>gcpeixoto/FMECD
# Manipulação de Dados em *Python*
## A biblioteca *pandas*
## Índices dos valores máximos ou mínimos
* Os métodos **idxmin()** e **idxmax()** retornam o *index* cuja entrada fornece o valor mínimo ou máximo da *Serie* ou *DataFrame*.
* Se houverem múltiplas ocorrências de mínimos ou máximo... | |
<reponame>haydendigital/swiftly<gh_stars>10-100
"""
Contains the CLI class that handles the original command line.
"""
"""
Copyright 2011-2013 <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
... | |
<filename>homework_3/viola_jones.py<gh_stars>0
import numpy as np
import numpy.linalg as linalg
import skimage.color as skimage
import PIL
from PIL import Image, ImageDraw
import timeit
D = 64
TRAINING_SIZE = 1000
class WeakLearner:
"""A simple container class to store information defining a given
weak learner"... | |
of all
parts).
:param int part_size: size of each part of the file.
:return: a list of file-paths as strings, where each item corresponds
to one part of the multi-part file.
:rtype: list
"""
file_paths = []
num_parts = math.ceil(total_file_size / part_size)
for i in range(num_parts):
postfix = ('000000000' ... | |
from django.test import TestCase
from .models import (
DidatticaCds,
DidatticaCdsLingua,
DidatticaRegolamento,
DidatticaDipartimento,
ComuniAll,
TerritorioIt,
DidatticaTestiRegolamento,
DidatticaAttivitaFormativa,
DidatticaPdsRegolamento,
DidatticaTestiAf,
Personale,
DidatticaCopertura,
RicercaDocenteGrup... | |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2017 by University of Kassel and Fraunhofer Institute for Wind Energy and
# Energy System Technology (IWES), Kassel. All rights reserved. Use of this source code is governed
# by a BSD-style license that can be found in the LICENSE file.
import matplotlib.pyplot as plt
imp... | |
<gh_stars>10-100
# Copyright (C) 2002-2016 <NAME>
# Copyright (C) 2011-2016 Nginx, Inc.
# Copyright (C) 2017 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of s... | |
'delete', 'rule', f'name={teku_tcp_rule_name}'
])
log.info('Creating a new TCP firewall rule for Teku...')
process_result = subprocess.run([
'netsh', 'advfirewall', 'firewall', 'add', 'rule',
f'name={teku_tcp_rule_name}',
'dir=in',
'action=allow',
'service=any',
'profile=any',
'protocol=tcp',
f'localport={po... | |
if eki_cp is None:
eki_cp = {}
self._kdw_eki_cp_block_cipher_mode = eki_cp.get('block_cipher_mode')
self._kdw_eki_cp_padding_method = eki_cp.get('padding_method')
self._kdw_eki_cp_hashing_algorithm = eki_cp.get('hashing_algorithm')
self._kdw_eki_cp_key_role_type = eki_cp.get('key_role_type')
self._kdw_eki_cp_digi... | |
<gh_stars>0
# -*- coding: utf-8 -*-
"""
フォークリフトを操作するための以下のジョイスティックパーツを提供するモジュール。
* Logicool F710
* ELECOM JC-U4113S (X-Box互換モードのみ)
またジョイスティックパーツオブジェクトを返却するファクトリを
ラップした関数も提供する。
"""
from donkeycar.parts.controller import Joystick, JoystickController
class ForkliftJoystickController(JoystickController):
"""
フォークリフト操作... | |
repeat = range(10)
data_dir_out= '/Users/jinsongliu/External/MUSE_UQ_DATA/linear_oscillator/Data'
data_dir_in = '/Users/jinsongliu/External/MUSE_UQ_DATA/linear_oscillator/Data'
for iorder in orders:
for r in repeat:
filename = 'DoE_IS_McRE6R{:d}_weight.npy'.format(r)
weights = np.load(os.path.join(data_dir_out, ... | |
strand = row['strand']
methfreq = float(row["meth_freq"])
coverage = int(row["coverage"])
meth_cov = int(row["meth.count"])
unmeth_cov = int(row["canon.count"])
call_cnt += coverage
methcall_cnt += meth_cov
unmethcall_cnt += unmeth_cov
if strand not in ['+', '-']:
raise Exception(
f'strand={strand} for ro... | |
<reponame>juan-rael/google-cloud-python
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | |
1j * t_values[36]))
+ (R38 / (1 + w * 1j * t_values[37]))
+ (R39 / (1 + w * 1j * t_values[38]))
)
def KK_RC40_fit(params, w, t_values):
"""
Kramers-Kronig Function: -RC-
<NAME> (<EMAIL> / <EMAIL>)
"""
Rs = params["Rs"]
R1 = params["R1"]
R2 = params["R2"]
R3 = params["R3"]
R4 = params["R4"]
R5 = params["... | |
# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from Tea.model import TeaModel
class Config(TeaModel):
"""
Model for initing client
"""
def __init__(self, access_key_id=None, access_key_secret=None, security_token=None, protocol=None,
read_timeout=None, connect_timeout=None, http_pr... | |
<gh_stars>1-10
import uuid
import mongoengine as me
from mist.api import config
from mist.api.exceptions import BadRequestError
from mist.api.users.models import Organization
from mist.api.selectors.models import SelectorClassMixin
from mist.api.rules.base import NoDataRuleController
from mist.api.rules.base import... | |
Splitting
order = order_prob_token_log_probs.order
log_probs = order_prob_token_log_probs.log_probs
# Building the policy details
selected_orders += [order]
policy_details['locs'] += [loc]
policy_details['tokens'] += self.tokenize(order)
policy_details['log_probs'] += list(log_probs)
# Getting draw action and... | |
in df.columns:
cols += ['timestamp']
cols += [col for col in groupby if col in df.columns]
cols += [col for col in metrics if col in df.columns]
df = df[cols]
time_offset = DruidDatasource.time_offset(granularity)
def increment_timestamp(ts):
dt = utils.parse_human_datetime(ts).replace(
tzinfo=config.get("DRU... | |
<reponame>acrop/iotjs
#!/usr/bin/env python
# Copyright 2019-present Samsung Electronics Co., Ltd. and other contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | |
"dta": "Daur",
"dtb": "Labuk-Kinabatangan Kadazan",
"dtd": "Ditidaht",
"dth": "Adithinngithigh",
"dti": "Ana Tinga Dogon",
"dtk": "Tene Kan Dogon",
"dtm": "<NAME>",
"dto": "<NAME>",
"dtp": "Central Dusun",
"dtr": "Lotud",
"dts": "<NAME>",
"dtt": "<NAME>",
"dtu": "<NAME>",
"dty": "Doteli",
"dua": "Duala",
... | |
II111iiii
if 94 - 94: OOooOOo - I1IiiI
if ( O000oOOoOOO == 0 ) : return ( packet )
if 35 - 35: i11iIiiIii
if 27 - 27: O0 % i11iIiiIii - I1Ii111 * oO0o - I11i / Oo0Ooo
if 78 - 78: O0 * i11iIiiIii
if 62 - 62: OoO0O00 * I1Ii111 * Ii1I / ooOoO0o
if ( self . is_dist_name ( ) ) :
packet , self . address = lisp_decode... | |
<reponame>inonyi2002/stringsifter<filename>stringsifter/preprocess.py
# Copyright (C) 2019 FireEye, Inc. All Rights Reserved.
import re
import os
import json
import math
import numpy
import base64
import joblib
import string
import binascii
import fasttext
import unicodedata
import collections
import sklearn.pipeline
... | |
= staticmethod(_gui.GuiWidget_open_file)
else:
open_file = _gui.GuiWidget_open_file
if _newclass:
open_files = staticmethod(_gui.GuiWidget_open_files)
else:
open_files = _gui.GuiWidget_open_files
if _newclass:
open_folder = staticmethod(_gui.GuiWidget_open_folder)
else:
open_folder = _gui.GuiWidget_open_folde... | |
import pandas as pd
import os
from os.path import join
import sys
import time
from itertools import chain
sys.path.insert(1, '/home/nlp/ernstor1/rouge/SummEval_referenceSubsets/code_score_extraction')
import calculateRouge
import numpy as np
import glob
# from DataGenSalientIU_DUC_maxROUGE import greedy_selec... | |
"""
Primal and dual cuts for two stage bidding strategies of energy hubs
"""
from energy_hub.bidding_strategy.bidding_strategy import EnergyHubManagement # import the energy hub management class
from numpy import zeros, ones, array, eye, hstack, vstack, inf, transpose
import numpy as np
from solvers.mixed_integer_solv... | |
# SPDX-License-Identifier: BSD-2
from .internal.utils import _lib_version_atleast
if not _lib_version_atleast("tss2-fapi", "3.0.0"):
raise NotImplementedError("FAPI Not installed or version is not 3.0.0")
import contextlib
import json
import logging
import os
import tempfile
from typing import Any, Callable, Dict, L... | |
index not in tracked_foreground_index_to_tracker_map]
untracked_foreground_bboxes = [foreground_bboxes[index] for index in range(0, len(foreground_bboxes)) if index not in tracked_foreground_index_to_tracker_map]
return (
tracked_bboxes,
tracked_foreground_indexes,
tracked_foreground_contours,
tracked_foregrou... | |
<filename>stake-pool/py/stake_pool/instructions.py
"""SPL Stake Pool Instructions."""
from enum import IntEnum
from typing import List, NamedTuple, Optional
from construct import Struct, Switch, Int8ul, Int32ul, Int64ul, Pass # type: ignore
from solana.publickey import PublicKey
from solana.transaction import Account... | |
get_classes(self):
return specification_part + execution_part + internal_subprogram_part
def process_item(self):
if self.item is not None:
name = self.item.get_line().replace(' ','')\
[len(self.blocktype):].strip()
if name:
self.name = name
return BeginStatement.process_item(self)
# start of KGEN
def analyz... | |
reduced modulo 8.
"""
length = len(indices)
assert length < 4, "no term!"
assert True not in [x < 0 or x >= self.n_vars for x in indices], \
"indices out of bounds!"
assert False not in [indices[i] < indices[i+1]
for i in range(length-1)], \
"indices non-increasing!"
value = value % 8
if length == 0:
self.we... | |
<filename>tutorials/e2e-distributed-pytorch-image/src/pytorch_dl_train/train.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
This script implements a Distributed PyTorch training sequence.
IMPORTANT: We have tagged the code with the following expressions to walk you through
the key imp... | |
X 562.5 Pixels (Slightky Smaller than the RPI 7" Touch Screens)
self.mw.resizable(0, 0) #Don't allow resizing in the x or y direction
back = tk.Frame(master=self.mw,bg='Grey')
back.pack_propagate(0) #Don't allow the widgets inside to determine the frame's width / height
back.pack(fill=tk.BOTH, expand=1) #Expand the... | |
<filename>GUI_functions/build_asp.py
import pickle
# This is the script which builds a ASP model intended to be solved with clingo.
# This program has been test on Ubuntu 18.04 and CentOS 7.
# Using Clingo 5.3.0 installed via Conda
# Parsing the output of this program will require clyngor-with-clingo which may be insta... | |
#!/usr/bin/env python
#
# Copyright (c) 2015 - 2022, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of condit... | |
<filename>deepdream.py
#https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/tutorials/deepdream/deepdream.ipynb
# boilerplate code
from __future__ import print_function
import os
import sys
import struct
import cv2
import math
import time
import argparse
import numpy as np
import numpy.random as... | |
<gh_stars>100-1000
# UNICODE CHARACTER DATABASE
# This file was generated with the command:
# ./generate_unicodedb.py --unidata_version=8.0.0 --output=unicodedb_8_0_0 --base=unicodedb_5_2_0
from rpython.rlib.rarithmetic import r_longlong
import unicodedb_5_2_0 as base_mod
version = '8.0.0'
_names = {
983053: 'ACK',... | |
four meters deep",
"references": ["The south tower is an architectural masterpiece of the time; in spite of its remarkable height the foundation is less than four meters deep", "The south tower is an architectural masterpiece of the time; despite its remarkable height, the foundation is less than four metres deep"]
}... | |
from tests.util.test_util import get_endpoint_service_clients, get_client, get_service_description, get_service_descriptions, get_service_clients
from xrdsst.controllers.base import BaseController
from xrdsst.controllers.client import ClientController
from xrdsst.controllers.endpoint import EndpointController, Endpoint... | |
<gh_stars>0
import os
import sqlite3
# Please feel free to use this file however you wish.
# None of this is thread-safe, though, so don't try to do anything clever.
# If you want to make a new tag archive for use in hydrus, you want to do something like:
# import HydrusTagArchive
# hta = HydrusTagArchive.HydrusTag... | |
"mean_trimean_min_inner_2": np.mean(k_d_2_2),
"mean_trimean_min_outer_2": np.mean(k_d_2_1),
"mean_min_min_inner_1": np.mean(k_d_1_1),
"mean_min_min_outer_1": np.mean(k_d_1_2),
"mean_min_min_inner_2": np.mean(k_d_2_2),
"mean_min_min_outer_2": np.mean(k_d_2_1),
"std_n_cluster_1": np.std(n_cluster_1s),
"std_n_clust... | |
as <NAME>)
Research Scientist
Coastal Circulation
Bedford Institute of Oceanography
1 Challenge Dr.
P.O. Box 1006 Phone (902) 426-2307 (o)
Dartmouth, Nova Scotia Fax (902) 426-7827
CANADA B2Y 4A2 email <EMAIL>
_______________________________________________________________________
Release Date: Nov. 2000
""... | |
<filename>ietf/group/tests_review.py
# Copyright The IETF Trust 2016-2020, All Rights Reserved
# -*- coding: utf-8 -*-
import datetime
import debug # pyflakes:ignore
from pyquery import PyQuery
from django.urls import reverse as urlreverse
from ietf.review.policies import get_reviewer_queue_policy
from ietf.utils.... | |
<filename>pb_bss_eval/extraction/beamformer.py
""" Beamformer module.
The shape convention is to place time at the end to speed up computation and
move independent dimensions to the front.
That results i.e. in the following possible shapes:
X: Shape (F, D, T).
mask: Shape (F, K, T).
PSD: Shape (F, K, D, D).
The f... | |
Sequential(
nn.Conv2d(in_channels, head_ch, kernel_size=3, padding=1, bias=True),
nn.BatchNorm2d(head_ch),
nn.ReLU(inplace=True)
)
self.center_head = nn.Conv2d(head_ch, num_cls, kernel_size=3, stride=1, padding=1, bias=True)
# corner_map prediction head
self.corner_conv = Sequential(
nn.Conv2d(in_channels, hea... | |
<reponame>FlyBrainLab/CXcircuits<filename>models/Su_natcomms17/load_database.py
import csv
import json
import re
import sys
import pickle
import itertools
import logging
import path
from cxcircuits.parse_arborization import NeuronArborizationParser
import numpy as np
from pyorient.ogm import Graph, Config
import ne... | |
try:
from utils_formula_parser import FOL_individual_constants
from utils_logic_class import Classical2
from utils_models import substitute
from utils_natural_deduction import add_open_sups, register_steps, numerate_on_steps
except ModuleNotFoundError:
from exercises.templates.exercises.utils_formula_parser import... | |
not exist yet). If False, the contents
# of the chunk will be rendered verbatim.
supports_custom_tags = db.BooleanProperty(default=False)
# Optional identifier for the chunk in the system it was sourced from.
# Format is type_id:resource_id where type_id is an identifier that maps to
# an external system and resou... | |
= Residue.objects.filter(protein_conformation__protein__entry_name='gnaz_human').prefetch_related(
'protein_segment', 'display_generic_number', 'generic_number')
gproteinplot = DrawGproteinPlot(
gprotein_residues, "Gprotein", protein)
crystal = Structure.objects.get(pdb_code__index="3SN6")
aa_names = definitions.... | |
<reponame>chazzy1/nycdsaML
# coding: utf-8
# # Content
# __1. Exploratory Visualization__
# __2. Data Cleaning__
# __3. Feature Engineering__
# __4. Modeling & Evaluation__
# __5. Ensemble Methods__
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import warnings
from math import sqrt
warni... | |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tools import float_is_zero
from .test_sale_common import TestCommonSaleNoChart
from odoo.tests import Form
class TestSaleToInvoice(TestCommonSaleNoChart):
@classmethod
def setUpClass(cls):
super(TestSaleT... | |
#!/usr/bin/env python
"""
This file is part of the 'varbench' project developed by the
University of Pittsburgh with funding from the United States
National Science Foundation and the Department of Energy.
Copyright (c) 2017, <NAME> <<EMAIL>>
This is free software. You are permitted to use, redistribute, and
m... | |
get_md5(xml_config)
headers['Content-Type'] = 'application/xml'
params = {'lifecycle': ''}
url = self._conf.uri(bucket=Bucket)
logger.info("put bucket lifecycle, url=:{url} ,headers=:{headers}".format(
url=url,
headers=headers))
await self._request('PUT',
url=url,
data=xml,
headers=headers,
params... | |
"""
Dataloader for various shifts in FairFace
"""
from torch.utils.data import Dataset
from torchvision import transforms
import os
from PIL import Image
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from training.data_shifts.rand_augment_fairface import RandAugment_Fairfa... | |
10 days
a[40:43] -= 50 # too short -> 0
a[80:100] -= 30 # at the end and beginning
ts = tas_series(a)
ts.attrs["units"] = "C"
out = atmos.cold_spell_days(ts, thresh="-10 C", freq="MS")
np.testing.assert_array_equal(out, [10, 0, 12, 8, 0, 0, 0, 0, 0, 0, 0, 0])
out = atmos.cold_spell_frequency(ts, thresh="-10 C", ... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Knowledge Graph Utility Functions.
Interacts with OWL Tools API
* gets_ontology_classes
* gets_ontology_statistics
* gets_object_properties
* gets_ontology_class_dbxrefs
* gets_ontology_class_synonyms
* gets_ontology_definitions
* merges_ontologies
* ontology_file_for... | |
data += " content: | \n"
if isinstance(content, str):
content = content.split('\n')
for line in content:
# data += " %s\n" % line.strip()
data += " %s\n" % line
return data
def process_ignition_files(files=[], overrides={}):
"""
:param files:
:param overrides:
:return:
"""
filesdata = []
unitsdata = []
... | |
loaded through execfile
if self.objid(registered) == objid:
self[oid].remove(registered)
break
else:
self.warning('can\'t remove %s, no id %s in the registry',
objid, oid)
def all_objects(self):
"""return a list containing all objects in this registry.
"""
result = []
for objs in self.values():
result += o... | |
<gh_stars>1-10
import math
from itertools import product
from typing import List
from openmm import Vec3, unit, app
import gemmi
import numpy as np
from UmbrellaPipeline.utils import (
gen_pbc_box,
get_residue_indices,
get_centroid_coordinates,
)
from UmbrellaPipeline.path_finding import GridNode
class Grid:
def... | |
# Author: <NAME>
from collections import OrderedDict
from copy import copy
from kernel.type import TFun, boolT
class OpenTermException(Exception):
pass
class TermSubstitutionException(Exception):
pass
class TypeCheckException(Exception):
pass
class Term():
"""Represents a term in higher-order logic.
There ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.