input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
import pickle
import datetime
import pytest
import six
import uuid
from pyrsistent import (
PRecord, field, InvariantException, ny, pset, PSet, CheckedPVector,
PTypeError, pset_field, pvector_field, pmap_field, pmap, PMap,
pvector, PVector, v, m)
class ARecord(PRecord):
x = field(type=(int, float))
y = field()
... | |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | |
.. attribute:: is_peer_address_checked
True if peer address is checked
**type**\: bool
"""
_prefix = 'tunnel-l2tun-oper'
_revision = '2015-11-09'
def __init__(self):
super(L2Tp.Classes.Class, self).__init__()
self.yang_name = "class"
self.yang_parent_name = "classes"
self.is_top_level_class = Fals... | |
= '2222122020' #provided by <NAME>, <NAME> and <NAME>
addinfo_f = 'It should be noted that ACCESS-CM2 continues to utilise JULES representations for some terrestrial processes, particularly dust source/deposition and river routing'
cmip_f = 6
rgb_f = 'blue'
marker_f = '<'
latres_atm_f = 145 #from in metadata in fi... | |
# -*- coding: utf-8 -*-
from __future__ import division, unicode_literals
import argparse
import os
import sys
from . import config
from . import update
from .messages import *
def main():
# Hack around argparse's lack of optional subparsers
if len(sys.argv) == 1:
sys.argv.append("spec")
argparser = argparse.Ar... | |
<filename>SiSp/dataloader.py
"""SiSp dataloader
"""
# python2, 3 compatibility
from __future__ import absolute_import, division, print_function
import pandas as pd
import numpy as np
import pysam
import itertools
import subprocess
import shlex
import os
from optparse import OptionParser, OptionGroup
import sys
if sys.... | |
<gh_stars>10-100
"""
Tests for various Pyflakes behavior.
"""
from sys import version_info
from pyflakes import messages as m
from pyflakes.test.harness import TestCase, skip, skipIf
class Test(TestCase):
def test_duplicateArgs(self):
self.flakes('def fu(bar, bar): pass', m.DuplicateArgument)
def test_localRef... | |
import json
from django.urls import reverse
from django.contrib.gis.geos import Polygon, Point, MultiPolygon
from rest_framework import status
from main.models import Record, Dataset
from main.tests.api import helpers
class TestJsonSearchAndOrdering(helpers.BaseUserTestCase):
def test_filter_dataset(self):
datas... | |
"address": "0x68d53441c0e253f76c500e551bdeA3D102206C9a",
"ens_address": "",
"decimals": 18,
"website": "https://dimensions.network/",
"logo": {
"src": "https://dimensions.network/static/home/img/branding/logo_o_400px.png",
"width": "400",
"height": "400",
"ipfs_hash": ""
},
"support": {
"email": "<EMAIL>",
... | |
Closest feature of each type
if held_obj_name == "onion":
all_features["p{}_closest_onion".format(i)] = (0, 0)
else:
make_closest_feature(i, "onion", self.get_onion_dispenser_locations() + counter_objects["onion"])
make_closest_feature(i, "empty_pot", pot_state["empty"])
make_closest_feature(i, "one_onion_pot", ... | |
from __future__ import print_function, division
import hashlib
from copy import deepcopy
import h5py
import numpy as np
from ..util.meshgrid import meshgrid_nd
from ..util.functions import FreezableClass, is_numpy_array, monotonically_increasing, link_or_copy
from astropy import log as logger
from .grid_helpers impo... | |
format: Symbol("delu_el") where el is the name of
the element
chempot_range ([max_chempot, min_chempot]): Range to consider the
stability of the slabs.
miller_index (list): Miller index for a specific facet to get a
dictionary for.
delu_dict (Dict): Dictionary of the chemical potentials to be set as
constant. No... | |
connected PNs for the "stealing" of connections with a
priority on towards PNs with an above-average number of outgoing connections.
This ensures an even distribution of the connections going from the PN layer.
"""
# don't extend if there's a limit.
if self.max_pn_size is not None and self.pn_size == self.max_pn_s... | |
import utils
import os
import random
import pandas as pd
import matplotlib.pyplot as plt
from collections import defaultdict
import jellyfish # for Levenshtein distance
import re
import math
import nltk
from nltk.tokenize import sent_tokenize # for sentence tokenization
from nltk.tokenize import word_token... | |
will be bypassed.
.. note:: The UTC to TT correction is only carried out for dates after
January 1st, 1972.
:param args: Either JDE, Epoch, date, datetime or year, month, day,
hours, minutes, seconds values, by themselves or inside a tuple or
list
:type args: int, float, :py:class:`Epoch`, tuple, list, date,
d... | |
<gh_stars>0
#! /usr/bin/env python
# 22 October 2010
# <NAME>
# <EMAIL>
#
# Neuromorphometrics, Inc.
# 22 Westminster Street
# Somerville, MA 02144-1630 USA
#
# http://neuromorphometrics.com
#
#*********************************************************************
#
# (c) Copyright 2010 Neuromorphometrics, Inc. Al... | |
"Ice Caves"
elif theme == "olmec":
return "Olmec"
elif theme == "volcano":
return "Volcana"
elif theme == "surface":
return "Surface"
return "Unknown"
# Path to the background image that will be shown behind the grid.
def background_for_theme(self, theme):
def background_file(theme):
if theme == "cave":
re... | |
** n_ * WC("b", S(1)))
** WC("p", S(1)),
x_,
),
cons2,
cons3,
cons8,
cons29,
cons50,
cons127,
cons19,
cons4,
cons52,
cons48,
cons228,
cons258,
cons40,
)
rule1318 = ReplacementRule(pattern1318, replacement1318)
pattern1319 = Pattern(
Integral(
(x_ * WC("f", S(1))) ** WC("m", S(1))
* (a_ + x_ ** n2... | |
hostname=hn101)
aggregator.assert_metric(metric_name, value=0.0, tags=tags101 + ['port:eth101/1/35'], hostname=hn101)
aggregator.assert_metric(metric_name, value=0.0, tags=tags101 + ['port:eth101/1/36'], hostname=hn101)
aggregator.assert_metric(metric_name, value=0.0, tags=tags101 + ['port:eth101/1/37'], hostname=hn... | |
if arguments.get('limit') is None:
limit = 0
else:
limit = int(arguments.get('limit'))
try:
# Creates the full query
if len(sort) and offset:
entities = self.mongodb.mongoConn.Entities.find(
query, fields).skip(offset).sort(sort).limit(limit)
elif offset:
entities = self.mongodb.mongoConn.Entities.find(
que... | |
import os.path
import parsers.variable_list_parser
# A lookup dictionary for setting up code generation rules.
# Key: Type of autocoded entity. Used to generate varibles, then list of code generation items
# First entry in list: Name of XML file suffix
# Second entry in list: List of suffixes of generated source files... | |
from CommonServerPython import DemistoException
SEND_UPLOADED_FILE_TO_SENDBOX_ANALYSIS_CONTEXT = {
'submitted_id': 'id',
'state': 'created',
'created_timestamp': '2020-05-12T15:34:11Z',
'environment_id': 160,
'sha256': 'sha256'
}
SEND_URL_TO_SANDBOX_ANALYSIS_CONTEXT = {
'submitted_id': 'id',
'state': 'created'... | |
# -*- coding: utf-8
"""Module for fluid property integration.
TESPy uses the CoolProp python interface for all fluid property functions. The
TESPyFluid class allows the creation of lookup table for custom fluid
mixtures.
This file is part of project TESPy (github.com/oemof/tespy). It's copyrighted
by the contributo... | |
from imblearn.over_sampling import SMOTE
from imblearn.under_sampling import RandomUnderSampler
from sklearn.linear_model import LinearRegression, Ridge, Lasso, ElasticNet, LogisticRegression
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.preprocessing import StandardScaler, MinMaxScale... | |
# Copyright 2016-2018 Scality
#
# 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, sof... | |
<gh_stars>1-10
# import all the required files i.e. numpy , pandas and math library
import numpy as np
import pandas as pd
from pandas import DataFrame , Series
import math
# All the indicators are defined and arranged in Alphabetical order
# ------------------> A <------------------------
# [0] __ Average True Ran... | |
'Image Sequence',
'Flame Render',
'Flame Batch File',
]
flameMenuApp.__init__(self, framework)
self.connector = connector
# app defaults
if not self.prefs.master.get(self.name):
self.prefs['show_all'] = True
self.prefs['current_page'] = 0
self.prefs['menu_max_items_per_page'] = 128
def __getattr__(self, n... | |
<gh_stars>10-100
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to u... | |
matrix : array
Pearson coefficient correlation matrix
'''
print('Compute OPD-to-OPD Pearson correlation coefficient')
nimg = data.shape[0]
# pupil mask
if pupil_mask is None:
mask = (data[0] != 0)
else:
mask = (pupil_mask != 0)
# compute correlation matrix
t0 = time.time()
matrix_prs = np.full((ni... | |
<gh_stars>0
# -*- coding: utf-8 -*-
#! \file ./tools/data/tr20140118.py
#! \author <NAME>, <jkucera AT redhat.com>
#! \stamp 2018-04-10 01:23:17 (UTC+01:00, DST+01:00)
#! \project passwd maintenance tools
#! \license MIT
#! \version 0.0.0
#! \fdesc Translation data.
#
def setup(t25l):
pofiles = t25l.PoFileSet()
po ... | |
# Import ML Library
import pandas as pd
import numpy as np
from sklearn import preprocessing
import warnings
warnings.filterwarnings(action='ignore', category=UserWarning, module='gensim')
import gensim
from gensim.test.utils import datapath
import pyLDAvis.gensim
from gensim.corpora import Dictionary
# Import helper L... | |
width=1, height=2)
expected = (
'<table:table table:name="A Table">'
"<table:table-column/>"
"<table:table-row>"
"<table:table-cell/>"
"</table:table-row>"
"<table:table-row>"
"<table:table-cell/>"
"</table:table-row>"
"</table:table>"
)
self.assertEqual(table.serialize(), expected)
def test_display(self)... | |
"""
This function tests that loadCSV loads label names
correctly.
"""
result_Sample_Static = pycgmIO.loadCSV(self.filename_Sample_Static)
labels_results = result_Sample_Static[2][0:50]
expected_labels_results = ['LFHD', 'RFHD', 'LBHD', 'RBHD', 'C7', 'T10',
'CLAV', 'STRN', 'RBAK', 'LSHO', 'LELB', 'LWRA', 'LWRB', ... | |
defined by the
# pattern. The synaptic weight will be proportional to the value defined by
# the pattern.
# - 'impact_modulation': STDP strengthens connections where a presynaptic spike
# causes a postsynaptic one. To strengthen connections that may excite the
# desired pattern, this method targets the way how synapses... | |
of type {key_field}, with underlying type of {getattr(key_field, '_ty')} "
"is not hashable"
)
self._custom_deep_copy_implementation = True
super().__init__(*args, **kwargs)
self._set_immutable(getattr(self, "_immutable", False))
def __set__(self, instance, value):
if not isinstance(value, dict):
raise TypeErr... | |
from transformers import Trainer, TrainingArguments, BertConfig, RobertaConfig, ElectraConfig
from transformers import HfArgumentParser
from transformers import BertTokenizerFast, RobertaTokenizerFast
from transformers import RobertaForMaskedLM
import transformers
transformers.logging.set_verbosity_debug()
import torc... | |
1/pressure)
:param M_guess: float guess saturation loading (units: loading)
"""
# parameter names (cannot rely on order in Dict)
param_names = [param for param in self.params.keys()]
# guess
guess = np.array([self.param_guess[param] for param in param_names])
def residual_sum_of_squares(params_):
"""
Residual... | |
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Test the Cost Model serializers."""
import logging
import random
from decimal import Decimal
from uuid import uuid4
import faker
from rest_framework import serializers
from tenant_schemas.utils import tenant_context
from api.iam.test.iam_test_... | |
<filename>lowhaio.py
import asyncio
import contextlib
import ipaddress
import logging
import urllib.parse
import ssl
import socket
from aiodnsresolver import (
TYPES,
DnsError,
Resolver,
ResolverLoggerAdapter,
)
class HttpError(Exception):
pass
class HttpConnectionError(HttpError):
pass
class HttpDnsError(... | |
93: OoooooooOO / I1Ii111
if 91 - 91: I1Ii111
if 18 - 18: ooOoO0o * I11i
if 53 - 53: I11i . i11iIiiIii - iIii1I11I1II1 / I1Ii111
if 86 - 86: i1IIi % OoO0O00 - OoooooooOO
for OO0Ii1iii1iIIII in lisp_crypto_keys_by_rloc_decap :
OOOO0o = OO0Ii1iii1iIIII . split ( ":" )
if ( len ( OOOO0o ) == 1 ) : continue
OOOO0o =... | |
#!/usr/bin/python
import re
import sys
import os
import platform
is_windows = platform.system().lower().startswith("win")
import subprocess
import shutil
from markdown2 import *
from datetime import *
from multiprocessing import Process
from utils import *
from jira import *
from docbook import *
try:
from xml.etree.... | |
<filename>grasp_evaluator/grasp_evaluator.py
# Copyright (c) 2020 NVIDIA Corporation
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the r... | |
not None:
energy_levels = energy_levels[energy_levels >= E_min]
if E_max is not None:
energy_levels = energy_levels[energy_levels <= E_max]
bins = np.arange(0, bin_max + bin_width, bin_width)
n_bins = len(bins)
counts = np.zeros(n_bins)
for i in range(n_bins - 1):
counts[i] = np.sum(bins[i] <= energy_levels[... | |
# Copyright 2022 TerraPower, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | |
<= partitionedArray[kthElement]) and
np.all(partitionedArray[kthElement:] >= partitionedArray[kthElement]))
shapeInput = np.random.randint(20, 100, [2, ])
shape = NumCpp.Shape(shapeInput[0].item(), shapeInput[1].item())
cArray = NumCpp.NdArrayComplexDouble(shape)
real = np.random.randint(1, 100, [shape.rows, shap... | |
<filename>test/test_allkinds.py
# type: ignore
"""
test_allkinds.py
Tests for GreynirCorrect module
Copyright (C) 2021 by <NAME>.
This software is licensed under the MIT License:
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files ... | |
= Constraint(expr= - m.x1712 + m.x1713 - m.x2675 + m.x2867 == 0)
m.c703 = Constraint(expr= - m.x1713 + m.x1714 - m.x2676 + m.x2868 == 0)
m.c704 = Constraint(expr= - m.x1714 + m.x1715 - m.x2677 + m.x2869 == 0)
m.c705 = Constraint(expr= - m.x1715 + m.x1716 - m.x2678 + m.x2870 == 0)
m.c706 = Constraint(expr= - m.x1716... | |
<gh_stars>0
#!/usr/bin/env python
##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
import builtins as builtin
except ImportError:
import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCo... | |
"""
Serve ingstion statistics for consumption in to a Sheets spreadsheet.
Development:
$ adev runserver server.py
"""
import asyncio
import csv
import logging
import os
import sys
from datetime import datetime
from io import StringIO
import stripe
from aiohttp import web
from aiohttp.web_request import Request
from ... | |
"8": {}, "9": {}},
"ospfv3AsLsdbEntry": {"4": {}, "5": {}, "6": {}, "7": {}, "8": {}},
"ospfv3CfgNbrEntry": {"5": {}, "6": {}},
"ospfv3GeneralGroup": {
"1": {},
"10": {},
"11": {},
"12": {},
"13": {},
"14": {},
"15": {},
"16": {},
"17": {},
"18": {},
"19": {},
"2": {},
"20": {},
"21": {},
"22": {},
"... | |
(y < y1))
elif side in (-1, 'l', 'left'):
ind = np.logical_and((y >= y0), (y < y1))
elif side in (1, 'r', 'right'):
ind = np.logical_and((y > y0), (y <= y1))
elif side in (2, 'b', 'both'):
ind = np.logical_and((y >= y0), (y <= y1))
else:
raise ValueError("unknow value of side!")
return np.where(ind) if i_ else... | |
(16 - len(s)) + s
coords = [divmod(i, 4) for i in range(len(s)) if s[i] == '1']
for c in coords:
board[c] = color
return board
def _getBlankBoard(self):
# TODO: change to numpy.array
board = []
for x in range(BOARDWIDTH):
board.append([EMPTY_SPACE] * BOARDHEIGHT)
return board
def _getSwappingGems(self, bo... | |
2620, " Xlimli": 2621,
"hatXp": -2622, "at X ": 2623, "fXrat": 2624, "aGcX": 2626, "dIz X": 2627,
"ay X ": 2628, "elCX": -2629, "ihtX": -2630, "Xon": -2631, " hXzi": 2632,
"Xrna": 2633, "anrX": 2634, "GzX": 2635, "Xdv": 2636, " idarX": -2637,
"ap lX ": 2638, "bartX": 2639, "rkCX": 2640, "Xpla": 2641, "hIrXs": -2642... | |
import json
import logging
import os
import glob
from os.path import join, exists
import shutil
import tempfile
import dateutil.parser
from util.job_util import exec_command
from pm_proxy.pm_base import PackageManagerProxy
class NpmjsProxy(PackageManagerProxy):
# npm-scripts: How npm handles the "scripts" field
# ... | |
<filename>scripts/data_processing_combined.py
"""
This module processes the data of simulated pairwise interactions.
The maximum characters per line is set to be 120.
"""
import glob
import os
import shelve
import platform
# import cv2 as cv
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# imp... | |
import ops.utils
import networkx as nx
import pandas as pd
import numpy as np
import scipy.spatial.kdtree
from collections import Counter
from scipy.spatial.distance import cdist
from scipy.interpolate import UnivariateSpline
from statsmodels.stats.multitest import multipletests
def format_stats_wide(df_stats):
in... | |
<gh_stars>0
#!/usr/bin/env python
# Programmer: <NAME>, <NAME>
# General-purpose Python library imports
import json
import os
import re
import socket
import subprocess
import sys
import tempfile
import time
import unittest
# Third party libraries
import boto.ec2
from flexmock import flexmock
import SOAPpy
# AppSc... | |
import pandas
import numpy as np
from cornellGrading import cornellQualtrics
import os
def genReadingAssignments(infile, outfile):
# generate reading assignments
# infile must be xlsx with two sheets (Readers & Canddiates)
# grab all input data
if isinstance(infile, str):
tmp = pandas.ExcelFile(infile, engine="... | |
ZCA(bias=0.1)
zca.fit(X)
self.norm = zca
elif self.normalization == '-1:1':
self.norm = lambda x: ((x - np.min(x)) / (np.max(x) - np.min(x)) * 2.0 - 1.0)
def preprocess(self, X):
'''Take an image in X, and transform it with local contrast normalization.
Parameters
----------
X : numpy.ndarray
image to perfo... | |
"":
try:
nodeid = int(self.NodeID.GetValue(), 16)
except:
message = _("Node ID must be integer!")
if message != "":
message = wx.MessageDialog(self, message, _("ERROR"), wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
self.NodeName.SetFocus()
else:
self.EndModal(wx.ID_OK)
def GetValues(self):
n... | |
# Perform tolerance sweep tolerance by ESM-SSP and well-characterized errors
# for an audience seeking to emulate from the full CMIP6 archive and for the
# scenarioMIP approach, for all ESMs
# For each ESM, loop over various tolerances and generate Ndraws = 500
# GSAT trajectories. Archives with and without each targe... | |
int number <= {0}. {1}".format(max, msg))
return
return result
def input_float(self, input_name, min=None, max=None, msg=None):
input_txt = str(self.uiList[input_name].text())
result = None
try:
result = float(input_txt)
except (ValueError, TypeError):
return
# min
if min != None:
if result < mi... | |
<filename>modules/s3/pyvttbl/pystaggrelite3.py
from __future__ import print_function
# Copyright (c) 2011, <NAME> [see LICENSE.txt]
# This software is funded in part by NIH Grant P20 RR016454.
"""
This module contains custom aggregators for sqlite3
sqlite has the following aggregate functions built-in:
avg... | |
from typing import List, Dict, Tuple, Optional
from itertools import product, chain
from collections import Counter
from random import choice
from copy import deepcopy
import numpy as np
from sudoku import Sudoku, SudokuElement
class SudokuSolver:
def __init__(self, sudoku: Sudoku):
self.s: Sudoku = sudoku
self.... | |
"""
The physcalc module contains the routine that calculates the ionic
fraction and the NEI X-ray spectrum based on the physical conditions
in an ASCII file.
V0.1 - <NAME>, May 22, 2019: initial release
V0.2 - <NAME>, May 28, 2019: separate the CIE and NEI case
V0.3 - <NAME>, Jun 01, 2019: standardize for github uploa... | |
<gh_stars>0
#!/usr/bin/env python3
import configparser
from datetime import datetime
import spotipy
from random import random
import logging
import time
import sys
import os
from io import BytesIO
import os.path
from spotipy.oauth2 import SpotifyOAuth
from spotipy.cache_handler import CacheFileHandler
import simplejso... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' Resistive-capacitive model implementation.
The class have methods for setting potential of streamer heads,
and for relaxing the potential each iteration.
The class have methods to get RC-factors for
resistance in channel, capacitance towards the plane,
breakdow... | |
'vProvinceState': User.clsPhysicalAddress.readProvinceState(),
'vCountry': User.clsPhysicalAddress.readCountry(),
'CountryList': self.Country_list,
'vPostalZipCode': User.clsPhysicalAddress.readPostalZipCode(),
'vPreferredLanguage': User.clsPrivate.readPrefferedLanguage(),
'vMaritalStatus': User.clsPrivate.readMar... | |
# Copyright (c) 2018 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
from json import JSONDecodeError
from typing import Any, Dict, List, Optional, Set, Tuple, cast, TYPE_CHECKING
import json
import os
import shutil
import zipfile
import tempfile
import urllib.parse # For interpreting escape char... | |
<filename>test/unit/common/middleware/test_recon.py
# Copyright (c) 2010-2012 OpenStack, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | |
<reponame>nuagenetworks/nuage-openstack-neutron
# Copyright 2018 NOKIA
#
# 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 ap... | |
<filename>se_resnext50/src/models/resnet_bam_wider.py
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | |
from __future__ import division
from tensorflow.examples.tutorials.mnist import input_data
import re
from ops import *
from utils import *
from kh_tools import *
import logging
import matplotlib.pyplot as plt
class ALOCC_Model(object):
def __init__(self, sess,
input_height=45,input_width=45, output_height=64, output... | |
if not os.path.isdir(os.path.dirname(name)):
if makedirs:
_makedirs(name, user=user, group=group, mode=mode)
else:
return _error(
ret, 'No directory to create {0} in'.format(name))
if not os.path.isdir(name):
_makedirs(name, user=user, group=group, mode=mode)
os.makedirs(name)
if not os.path.isdir(name):
retu... | |
"""
Tests for Markov Regression models
Author: <NAME>
License: BSD-3
"""
from __future__ import division, absolute_import, print_function
import os
import warnings
import pytest
import numpy as np
from numpy.testing import assert_allclose
import pandas as pd
from sm2.tsa.regime_switching import markov_switching, mar... | |
from __future__ import annotations
import torch
import numpy as np
from torch import nn
from torch import Tensor
from collections import OrderedDict
from typing import List
from functools import partial
from glasses.nn.blocks import ConvBnAct
from glasses.nn.att import ChannelSE
from ....models.utils.scaler import Comp... | |
#import required packages
import pandas as pd
import re
import html.parser
import urllib.request
import urllib.parse
import string
def read_glove_vecs(file):
with open(file, 'r') as f:
words = set()
word_to_vec_map = {}
for line in f:
line = line.strip().split()
word = line[0]
words.add(word)
word_to_vec_map... | |
[t[1], t[2],t[3],t[4]] , childsProduction)
addCad("**\<ASIG_BASICA>** ::= ':''=' \<EXP> ';' ")
t[0] = Declaration(t[1], False, None, True, t[4], t.slice[1].lineno, t.slice[1].lexpos, graph_ref)
elif len(t) == 4:
childsProduction = addNotNoneChild(t,[3])
graph_ref = graph_node(str("asig_basica"), [t[1], t[2],t[3]] ... | |
today.
assert self.client.get(path, headers={
'if-modified-since': http_date(yesterday.timestamp),
'if-unmodified-since': http_date(today.timestamp),
}).status_code == 304
# Send me the resource if it has been modified between two days ago
# and yesterday.
assert self.client.get(path, headers={
'if-modified-si... | |
FXA_STORE_ACCESS_TOKEN = config("FXA_STORE_ACCESS_TOKEN", default=False, cast=bool)
FXA_STORE_ID_TOKEN = config("FXA_STORE_ID_TOKEN", default=False, cast=bool)
FXA_SUPPORT_FORM = config(
"FXA_SUPPORT_FORM", default="https://accounts.firefox.com/support"
)
FXA_SET_ISSUER = config("FXA_SET_ISSUER", default="https://... | |
# 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 agre... | |
#############################################################################
#
# Author: <NAME>, <NAME>
#
# Copyright: <NAME> TSRI 2000
#
#############################################################################
#
# $Header: /opt/cvs/python/packages/share1.5/AutoDockTools/autodpfCommands.py,v 1.100.2.5 2016/02/23... | |
Commit.from_string(self.make_commit_text(encoding=b"UTF-8"))
self.assertEqual(b"UTF-8", c.encoding)
def test_check(self):
self.assertCheckSucceeds(Commit, self.make_commit_text())
self.assertCheckSucceeds(Commit, self.make_commit_text(parents=None))
self.assertCheckSucceeds(Commit, self.make_commit_text(encoding=... | |
<gh_stars>10-100
# coding: utf-8
from itertools import product
from collections import OrderedDict
import numpy as np
from sympy import Abs, S, cacheit
from sympy import Indexed, Matrix, ImmutableDenseMatrix
from sympy import expand
from sympy.core import Basic, Symbol
from sympy.core import Add, Mul, Pow
from sympy... | |
<reponame>Dan-Eli/FGP_Docs
import os
import sys
import codecs
import csv
import re
import collections
import argparse
import json
import ast
import traceback
import inflect
import operator
import Tkinter, Tkconstants, tkFileDialog
from openpyxl import *
from openpyxl.styles import *
from openpyxl.workshe... | |
(parent.board.max_filesize * 1000):
error_message = "File size is " + str(reply.image.size - (parent.board.max_filesize *1000)) + " bytes larger than the maximum of " + str(parent.board.max_filesize) + " kilobytes."
return render_to_response('imageboard/post.html', {'board_list':board_list, 'form':form, 'delform':D... | |
np.ma.masked_array(vis_to_avg, mask=mask)
nsample_to_avg = np.ma.masked_array(nsample_to_avg, mask=mask)
avg_vis = np.ma.average(
vis_to_avg, weights=nsample_to_avg, axis=0
)
avg_nsample = np.sum(nsample_to_avg, axis=0)
avg_flag = np.all(flags_to_avg, axis=0)
temp_data_array[this_obj_ind] = avg_vis
temp_nsam... | |
'SingleMuon'),
PhysicsParkingScoutingMonitor = cms.vstring('ParkingScoutingMonitor'),
RPCMON = cms.vstring('RPCMonitor'),
ScoutingCalo = cms.vstring('ScoutingCaloCommissioning',
'ScoutingCaloHT'),
ScoutingPF = cms.vstring('ScoutingPFCommissioning',
'ScoutingPFHT',
'ScoutingPFMuons')
)
process.transferSystem ... | |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed ... | |
import pandas as pd
import codecs
import json
from collections import defaultdict, OrderedDict
import numpy as np
from tqdm import tqdm
import gensim
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import f1_score
from sklearn.model_selection imp... | |
<filename>makehuman-master/buildscripts/ppa/buildPPA.py<gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
MakeHuman debian package build script
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehumancommunity.org/
**Github Code Home Page:** https://github.com/makehumancommunity/
**Aut... | |
################################
# WAVE FUNCTION COLLAPSE IN 2D #
################################
# Original WFC implementation by <NAME> @mxgmn on github
# Python implementation by <NAME> @Coac on github
# Blender implementation by <NAME> @benkl on github
import time
import os
import numpy as np
import random
impor... | |
<reponame>rlr/kitsune<gh_stars>1-10
import json
import logging
import random
import time
from datetime import date, datetime, timedelta
from django.conf import settings
from django.contrib import auth
from django.contrib import messages
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.conte... | |
additionally be used (see below). For the energy density, a block by block check against relevant summed energy terms in scalar.dat or dmc.dat files is additionally made.'
)
parser.add_option('-f','--fixed','--fixed_sum',dest='fixed_sum',
action='store_true',default=False,
help = 'Full sum of data takes on a fixed,... | |
here. Can reduce number of POs
print 'First isomorphism: ',res
if res == True:
did_iso_1 = True
abc('&get;&scl;&put')
write_file('iso1')
leq = eq_classes()
## print leq
map1 = create_map(leq,N) #creates map into original if there were isomorphisms
## print map1
if not count_less(L,0) == N:
print 'L = %s'%sumsi... | |
the method checks if the utterance contains the given vocab
thereby allowing the user to say things like "yes, please" and still
match against "Yes.voc" containing only "yes". An exact match can be
requested.
The method first checks in the current Skill's .voc files and secondly
in the "res/text" folder of mycrof... | |
<reponame>Louwrensth/tofu
"""
This module contains tests for tofu.geom in its structured version
"""
# Built-in
import os
import warnings
# Standard
import numpy as np
import matplotlib.pyplot as plt
# Nose-specific
from nose import with_setup # optional
# tofu-specific
from tofu import __version__
import tofu.util... | |
from fabric2 import Connection
from fabric2 import task
from fabric2 import config
import os
import time
from xml.etree import ElementTree as ET
import uuid
import glob
import json
import urllib.parse
import io
workflow_components = ['input.xml', 'binding.xml', 'flow.xml', 'result.xml', 'tool.xml']
@task
def release_... | |
"""Staged parameters for senders comply with constraints"""
if len(self.senders) > 0:
valid, response = self.check_staged_complies_with_constraints("sender", self.senders)
if valid:
return test.PASS()
else:
return test.FAIL(response)
else:
return test.UNCLEAR("Not tested. No resources found.")
def... | |
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import numpy as np
import scipy.io as sio
import gym
import time
import random
import datetime
import os
import imageio
import glob
import tqdm
import json
def get_center_state(env):
total_buffer_list = np.zeros([env.agent_num, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.