input stringlengths 2.65k 237k | output stringclasses 1
value |
|---|---|
# -*- coding: utf-8 -*-
import os
import sys
import types
import unittest
import inspect
from lxml import etree
from . import XSL, XML, VERSION_LIST
from .core import get_module, get_stylesheet, get_source_version, get_migration_path, list_versions
from .main import parse_args
from .migrate import migrate_by_styleshe... | |
from typing import List, Dict, Sequence, Union, Tuple
from numbers import Number
import random
import numpy as np
from toolz import curry
from toolz.curried import get
from common import _tuple
__all__ = [
"resize", "resized_crop", "center_crop", "drop_boundary_bboxes",
"to_absolute_coords", "to_percent_coords", "... | |
std, c='m', marker='*')
ax.scatter(key, std1, c='b', marker='o')
ax.scatter(key, std2, c='y', marker='s')
if key > maxx:
maxx = key
print key, std, std1, std2
#label
ax.scatter(key-shift, std, c='m', marker='*', label=r'$\sigma (e)$')
ax.scatter(key, std1, c='b', marker='o', label=r'$\sigma (e_{1})$')
ax.sca... | |
<filename>gen/apache/aurora/api/ttypes.py<gh_stars>1-10
#
# Autogenerated by Thrift Compiler (1.0.0-dev)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
# options string: py
#
from thrift.Thrift import TType, TMessageType, TException, TApplicationException
from thrift.transport import TTranspor... | |
<reponame>yuejiaxiang/semEvel2020_task8
# -*- coding: UTF-8 -*-
# @Time : 2021/1/8
# @Author : <EMAIL>
# Apache License
# Copyright©2020-2021 <EMAIL> All Rights Reserved
import os
import json
import pickle
import random
import shutil
import re
import pandas as pd
from data_process.rule_base_unit import RuleBaseUnit
rb... | |
cache `event` information to ensure that we:
* Remember which event we're currently in across restarts
* Provide an on-demand informational embed without re-querying the branding repository
An event change should always be handled via this function, as it ensures that the cache is populated.
The #changelog notifi... | |
# Copyright (c) 2021 <NAME>. 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 source code must retain the above copyright
# notice, this list of conditions and the following d... | |
self.gds_validate_integer(ival_, node, 'tpInsc')
self.tpInsc = ival_
elif nodeName_ == 'nrInsc':
nrInsc_ = child_.text
nrInsc_ = self.gds_validate_string(nrInsc_, node, 'nrInsc')
self.nrInsc = nrInsc_
# end class TEmpregador
class TIdeVinculoNisObrig(GeneratedsSuper):
"""Informações do Vínculo"""
subclass = No... | |
parameters used for building the model
model_kwargs=dict(n_estimators=100,
max_depth=100,
max_features="auto"),
# parameters used for building the validation set
split_kwargs=dict(val_fraction=0.5,
subset=None,
shard_size=50000,
to_disk=False)))
register(f'ChEMBL_{standard_type}_{assay_chembl_id}-RandomFores... | |
<filename>ckan/tests/legacy/functional/test_package.py<gh_stars>10-100
# encoding: utf-8
import pytest
from six import string_types
from ckan.common import config
from difflib import unified_diff
from ckan.tests.legacy import url_for
import ckan.tests.legacy as tests
from ckan.tests.legacy.html_check import HtmlChec... | |
<gh_stars>0
import re
from datetime import datetime, date, timedelta
import json
from decimal import Decimal
from django.db.models import Sum, Q
from nt_s_common.decorator import cache_required
from .models import *
def show_notary_info_list():
notary_names = Notaries.objects.filter(flag=1).values_list('name')
re... | |
0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
0xe4, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
0x4f, 0... | |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Eviloid, 22.08.2019
import os, sys
import urllib, urllib2, urlparse, cookielib
import re, json
import xbmc, xbmcgui, xbmcplugin, xbmcaddon
import CommonFunctions
import sqlite3 as sql
PLUGIN_NAME = 'FanSerials'
common = CommonFunctions
common.plugin = PLUGIN_NAME
try:ha... | |
or tcl_user_app.fpga['custom'] != 'GAScore':
# Connect the AXI input switch to the Galapagos router
tcl_user_app.makeConnection(
'intf',
{
'name':'applicationRegion/custom_switch_inst',
'type':'intf',
'port_name':'stream_out_switch_V'
},
{'name':'applicationRegion/input_switch',
'type':'intf',
'port_name':'S... | |
<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 23 18:11:20 2021
@author: lukepinkel
"""
import numpy as np
import scipy as sp
import scipy.stats
import pandas as pd
from .rotation import rotate, oblique_constraint_derivs
from ..utilities.linalg_operations import vec, invec, vech, vecl, invecl, vecl_ind... | |
<reponame>uruzahe/carla
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2007-2020 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.... | |
<reponame>uruzahe/carla<filename>Co-Simulation/Sumo/sumo-1.7.0/tools/contributed/sumopy/coremodules/simulation/sumo.py
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2016-2020 German Aerospace Center (DLR) and others.
# SUMOPy module
# Copyright (C) 2012-2017 University of Bo... | |
import itertools
import logging
import netCDF4
import numpy
from .. import core
from ..constants import masked as cfdm_masked
from ..decorators import (
_inplace_enabled,
_inplace_enabled_define_and_cleanup,
_manage_log_level_via_verbosity,
)
from ..functions import abspath
from ..mixin.container import Container
... | |
for snp_index in sorted(self.considered_snp_indices):
snp_counter += 1
self.hessian_matrices[snp_index] = hessian_matrices[snp_counter]
# initialize std_error_values as an empty dictionary
self.std_error_values = dict()
# queue
queue_std_error = multiprocessing.Queue()
# thread to read from the queue
std_err... | |
in params:
path_params['entryId'] = params['entry_id'] # noqa: E501
query_params = []
if 'select' in params:
query_params.append(('$select', params['select'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api... | |
#!/usr/bin/env python3
import os
import gdal
import osr
import time
import h5py
import numpy as np
from collections import defaultdict
import isce3.extensions.isceextension as isce3
def runGeocode(self, frequency):
'''
This step maps locations on a DEM to slant range and azimuth time.
'''
# only execute worker i... | |
<gh_stars>0
"""Revocation registry admin routes."""
import logging
from asyncio import shield
from aiohttp import web
from aiohttp_apispec import (
docs,
match_info_schema,
querystring_schema,
request_schema,
response_schema,
)
from marshmallow import fields, validate, validates_schema
from marshmallow.excepti... | |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import common
class TestWorkOrderProcess(common.TransactionCase):
def setUp(self):
super(TestWorkOrderProcess, self).setUp()
self.source_location_id = self.ref('stock.stock_location_14')
self.wareh... | |
ip_version), ('subnet_address', subnet_address), ('gateway_address', gateway_address), ('dns_server', dns_server), ('dhcp_params', dhcp_params), ])
class yc_vnfd_connection_point_ref_nst__nst_netslice_subnet_instantiation_parameters_vld_vnfd_connection_point_ref(PybindBase):
"""
This class was auto-generated by the... | |
#!/usr/bin/python
import sys
import numpy
import os
import math
import functools
import rospy
import cv2
import rospkg
from cv_bridge import CvBridge, CvBridgeError
from cv_detection_camera_helper import CameraHelper
imgindex = 0
def __create_mask_image_from_template(reference_image, template, pos_x, pos_y):
'''
... | |
b'<KEY>'
b'<KEY>'
b'<KEY>'
b'<KEY>'
b'<KEY>'
b'340xQJFERMxUQ0BQ8yEW+1rNmufLEp1OZ35+/urVq09dvNxOW6reudRMmVg1FEV1cHDQXZhr'
b'5rzE6dRut+dm5wHEunMRUfWqmiTOzJTQmeklSZLnuQLjouj05mrboE59m0xTBkBCpJA6yqGz'
b'M/Pd7sxBv29maZZ9YBjQb+74N9eiiAtJGxaS6S8nAcKJ0FHz029pxLDQ5PIhhJAkSSwf8QZO'
b'<KEY>'
b'<KEY>'
b'<KEY>'
b'<KEY>'
... | |
<W> element
"""
return self.nest(SsmlW(words=words, role=role, **kwargs))
@deprecated_method('w')
def ssml_w(self, words=None, role=None, **kwargs):
"""
Create a <W> element
:param words: Words to speak
:param role: Customize the pronunciation of words by specifying the word’s part of speech or alternate mean... | |
# Copyright 2014 F5 Networks 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 writing,... | |
<gh_stars>1-10
#!/usr/bin/env python
'''
@author <NAME> <<EMAIL>>
@file ion/processes/data/ingestion/science_granule_ingestion_worker.py
@date 06/26/12 11:38
@description Ingestion Process
'''
from ion.services.dm.utility.granule.record_dictionary import RecordDictionaryTool
from ion.services.dm.utility.granule_utils i... | |
<reponame>ManchesterBioinference/burstInfer
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 18:00:10 2020
@author: Jon
"""
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 17 01:33:52 2020
@author: jbowl
"""
import scipy
import numpy as np
import datetime
print(datetime.datetime.now().time())
print('start program')
f... | |
from collections import OrderedDict, Iterable
from copy import deepcopy
from xml.etree import ElementTree as ET
from six import string_types
import openmc
from openmc.clean_xml import clean_xml_indentation
from openmc.checkvalue import check_type
class Geometry(object):
"""Geometry representing a collection of sur... | |
[], # Beverages, lemonade, frozen concentrate, pink, prepared with water
14544: [], # Beverages, tea, black, brewed, prepared with distilled water
14545: [], # Beverages, tea, herb, brewed, chamomile
14548: [], # Beverages, tea, instant, lemon, with added ascorbic acid
14550: [], # Alcoholic beverage, distilled, al... | |
<gh_stars>0
# Copyright (c) 2016-2018 Uber Technologies, 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 ... | |
<reponame>LMNS3d/sharpy
"""
@modified <NAME>
"""
import ctypes as ct
import numpy as np
import scipy as sc
import os
import itertools
import warnings
import sharpy.structure.utils.xbeamlib as xbeamlib
from sharpy.utils.solver_interface import solver, BaseSolver
import sharpy.utils.settings as settings
import sharpy.ut... | |
import geopandas
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib import cm
import matplotlib.ticker ... | |
tag: database.IgnoreThis = database.IgnoreThis.create(channelID = channel.id, authorID = VCMember.id)
tag.save()
print(f"Added: {VCMember.id}")
await channel.delete()
q.delete_instance()
embed = discord.Embed(title = f"{Emoji.archive} Force Ended Session", description = "Session has been forcefully removed.", ... | |
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - AttachFile action
This action lets a page have multiple attachment files.
It creates a folder <data>/pages/<pagename>/attachments
and keeps everything in there.
Form values: action=Attachment
1. with no 'do' key: returns file upload form
2. do=attach: accept file upl... | |
+ 2.0 * qz * qw, 1.0 - 2.0 * qx * qx - 2.0 * qz * qz, 2.0 * qy * qz - 2.0 * qx * qw],
[2.0 * qx * qz - 2.0 * qy * qw,2.0 * qy * qz + 2.0 * qx * qw, 1.0 - 2.0 * qy * qy - 2.0 * qx * qx]])
def add(self, q2):
"""Adds two quaternions
Arguments:
q2 -- A quaternion, to be added to self
Returns:
A Quaternion, wit... | |
for all trajectories.
>>> trajectories.get_duration()
"""
# ------------------------------------
# Return duration with get_duration().
# ------------------------------------
t_total = get_duration(self)
# ---------------------------
# Adding t_total to DataSet.
# ---------------------------
# Append t_tota... | |
"""Module containing multiple classes to interact with openmediavault
based on StaticCube https://github.com/StaticCube/python-synology"""
# -*- coding:utf-8 -*-
import requests
import urllib3
class FormatHelper(object):
"""Class containing various formatting functions"""
@staticmethod
def bytes_to_reada... | |
"gfdl-1.3": {
"description": "GNU Free Documentation License v1.3",
"name": "GFDL-1.3",
"url": "https://www.gnu.org/licenses/fdl-1.3.txt"
},
"gfdl-1.3-only": {
"description": "GNU Free Documentation License v1.3 only",
"name": "GFDL-1.3-only",
"url": "https://www.gnu.org/licenses/fdl-1.3.txt"
},
"gfdl... | |
test_instances_are_tracked(self):
"""_Package instances are tracked"""
pkg = _Package()
self.assertIn(pkg, _Package.instances())
def test_instance_refs_are_garbage_collected(self):
"""_Package instance refs are garbage collected with old instances"""
pkg = _Package()
pkg1_repr = "%r" % pkg
pkg = _Package()
# ... | |
extruding extrusion extrusions exuberantly exultantly eyeful
eyefuls eyeglass eyeglasses eyelet eyelets eyeliner eyeliners eyepiece
eyepieces eyestrain eyeteeth eyetooth f fa fabled fabulously
facetiously facetiousness facially facilitation facings factional
factionalism factitious factotum factotums faddish fag fagged... | |
computer_ids_list = self._get_endpoint_id_from_ip_hostname(action_result, value_to_search,
search_key_field)
# Something went wrong while getting computer ID based on given IP or hostname
if phantom.is_fail(get_endpoint_status):
return action_result.get_status()
# If no endpoint is found
if not computer_ids_lis... | |
# This class will overlay the clinical information we have on hand
#!/bin/env python3
import sys
import os
import traceback
import numpy as np
import itertools
from datetime import datetime
import random
import time
random.seed(time.time())
# relative imports
sys.path.append(os.path.dirname(os.path.abspath(__file__))... | |
<filename>04.py
"""
--- Day 4: Passport Processing ---
You arrive at the airport only to realize that you grabbed your North Pole Credentials instead of your passport. While these documents are extremely similar, North Pole Credentials aren't issued by a country and therefore aren't actually valid documentation for tr... | |
__author__ = 'mnowotka'
from django.db import models
from chembl_core_model.models import *
from chembl_core_db.db.models.abstractModel import ChemblCoreAbstractModel
from chembl_core_db.db.models.abstractModel import ChemblModelMetaClass
from django.utils import six
# ------------------------------------------------... | |
and end times for a build execution phase.
"""
"""End of time span."""
end_time: Optional[datetime]
"""Start of time span."""
start_time: Optional[datetime]
def __init__(self, end_time: Optional[datetime], start_time: Optional[datetime]) -> None:
self.end_time = end_time
self.start_time = start_time
class Im... | |
#! /bin/env python3
# -*- coding: utf-8 -*-
################################################################################
#
# This file is part of PYJUNK.
#
# Copyright © 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation file... | |
import numpy as np
from sfsimodels.models.abstract_models import PhysicalObject
from sfsimodels.models.systems import TwoDSystem
from sfsimodels.functions import interp_left, interp2d, interp3d
from .fns import remove_close_items, build_ele2_node_array
import hashlib
def sort_slopes(sds):
"""Sort slopes from bottom ... | |
trigger.
:Parameters:
- `trigger_link`: str, the link to the trigger.
- `options`: dict, the request options for the request.
:Returns:
dict
"""
path = base.GetPathFromLink(trigger_link)
trigger_id = base.GetResourceIdOrFullNameFromLink(trigger_link)
return self.DeleteResource(path,
'triggers',
trigger_id... | |
413
# ViReal64, read-write
KTM960X_ATTR_OUTPUT_PULSE_WIDTH = IVI_SPECIFIC_ATTR_BASE + 414
# - Voltage
KTM960X_ATTR_OUTPUT_VOLTAGE_AUTO_RANGE_ENABLED = (
IVI_SPECIFIC_ATTR_BASE + 420
) # ViBoolean, read-write
KTM960X_ATTR_OUTPUT_VOLTAGE_BASE_LEVEL = (
IVI_SPECIFIC_ATTR_BASE + 421
) # ViReal64, read-write
KTM960X_ATT... | |
postCellId="../AIBR/0/"/>
</projection>
<projection id="NC_SDQL_ALML_Acetylcholine" postsynapticPopulation="ALML" presynapticPopulation="SDQL" synapse="">
<connection id="0" preCellId="../SDQL/0/" postCellId="../ALML/0/"/>
</projection>
<projection id="NC_SDQL_AVAL_Acetylcholine" postsynapticPopulation="AVAL" pres... | |
import click
from collections import defaultdict
from copy import deepcopy
import io
import json
from langid.langid import LanguageIdentifier, model
import numpy as np
import os
import pickle
import random
import xml.sax
from .sequence_similarity import check_sequence_similarity, print_alignment_stats
from .database i... | |
output = self.view_builder.basic(self.request, self.instance)
self.assertThat(output, matchers.DictMatches(expected_server))
def test_build_server_with_project_id(self):
expected_server = {
"server": {
"id": self.uuid,
"name": "test_server",
"links": [
{
"rel": "self",
"href": self.self_link,
},
{
"rel": ... | |
the same length as the element_orbital_pairs
legend (bool): Determines if the legend should be included or not.
linewidth (float): Line width of the plain band structure plotted in the background
band_color (string): Color of the plain band structure
figsize (list / tuple): Desired size of the image in inches (widt... | |
request.user
bmrr =0.0
if user.is_authenticated:
bmrr = bmr.objects.filter(us=user).order_by('-id')[0]
bmrobjlist = bmr.objects.filter(us=user)
bmrlist = []
bmrdate = []
for i in bmrobjlist:
bmrlist.append(i.bmr)
bmrdate.append(i.date)
if request.method=="POST":
weight_metric = request.POST.get("weight-metri... | |
# -*- coding: utf-8 -*-
# Copyright 2020 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | |
['AMAPA', '/AP'],
['AMAZONAS', '/AM'],
['BAHIA', '/BA'],
['CEARA', '/CE'],
['DISTRITO FEDERAL', '/DF'],
['ESPIRITO SANTO', '/ES'],
['GOIAS', '/GO'],
['MARANHAO', '/MA'],
['MATO GROSSO DO SUL', '/MS'],
['MATO GROSSO', '/MT'],
['MINAS GERAIS', '/MG'],
['PARAIBA', '/PB'],
['PARANA', '/PR'],
['PER... | |
<gh_stars>1-10
#!/usr/bin/env python3
###############################################################################
# Program: EPI-ClusT.py
# Type: Python Script
# Version: 1.0
# Author: <NAME>
# Description: Empiral Phylogeny Informed Cluster Tool for identifying
# distance thresholds and defining clusters in phylo... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Train a neural network to classify image patches as street / no street.
Take (patch size)x(patch size) (3 color) patches and classify the center pixel.
If loss doesn't change after the first iterations, you have to re-run the
training.
"""
from __future__ import pri... | |
import re
from random import randint as r
FACE_MOVES = ["U", "D", "F", "B", "L", "R"]
SLICE_MOVES = ["M", "E", "S"]
WEDGE_MOVES = ["u", "d", "f", "b", "l", "r", "Uw", "Dw", "Fw", "Bw", "Lw", "Rw"]
ROTATIONS = ["x", "y", "z"]
move_dict = {"U": 0, "L": 1, "F": 2, "R": 3, "B": 4, "D": 5, "E": 0, "M": 1, "S": 2, "x": 0, "... | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Brew-file: Manager for packages of Homebrew
https://github.com/rcmdnk/homebrew-file
requirement: Python 2.7 or later
"""
from __future__ import print_function
import os
import sys
__prog__ = os.path.basename(__file__)
__description__ = __doc__
__author__ = "rcmdnk"... | |
<reponame>AngelRuizMoreno/Jupyter_Dock_devel
################################################################################
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## License as published by the Free Software Foundation; either
... | |
#!/usr/bin/env python
"""Make big QUOCKA cubes"""
from IPython import embed
import schwimmbad
import sys
from glob import glob
from tqdm import tqdm
import matplotlib.pyplot as plt
from radio_beam import Beam, Beams
from radio_beam.utils import BeamError
from astropy import units as u
from astropy.io import fits
from ... | |
import unittest
from unittest.mock import patch
from scrapy.http import HtmlResponse
from fire_emblem_data_scraper.constants import MAX_NUM_OTHER_IMAGES
from fire_emblem_data_scraper.spiders.characters.characters import CharactersSpider
class TestCharactersSpider(unittest.TestCase):
"""
TestCharactersSpider is a ... | |
# coding: utf-8
# Import libraries
import gmql as gl
import pandas as pd
from pandas import ExcelWriter
import pickle
import collections
def extract_expression(tumor, platform, gencode_version):
"""
The EXTRACT_EXPRESSION operation extracts expression values from TCGA for all the genes of interest and their candi... | |
'tcp:127.0.0.1:6633'])
subprocess.check_call([self.ovs, self.ovsdb,
'set', 'bridge', 'dp0',
'other-config:datapath-id=7266767372667673'])
log.info("Virtual switch dp0 set up complete !!!")
def AddPort(self, switchName, Port_No):
dp_veth = ''.join(['veth', '-', switchName[:3], '-', str(Port_No)])
vs_port_name = ... | |
"""Helper draw method for drawing of RooDataSet
>>> dataset.draw ( 'm', 'chi2<10' )
## cuts & weight
>>> dataset.draw ( 'm', '(chi2<10)*weight' )
## use drawing options
>>> dataset.draw ( 'm', '(chi2<10)*weight' , 'e1' )
## start form event #1000
>>> dataset.draw ( 'm', '(chi2<10)*weight' , 'e1' , 1000 )
##... | |
<filename>mc_manager/curses_helpers.py
import curses
from curses.textpad import Textbox, rectangle
class item_base():
"""The base class for menu items
"""
def init_curses(self):
"""A few curses settings shared across all items
"""
curses.noecho()
curses.cbreak()
curses.curs_set(0)
def display(self, y_pos, k... | |
return "{}, {}-normed, {} (by {})".format(
comp_map[comp][1], normalization, xvlong, algo
)
else:
return "Undefined"
def seconds_elapsed(elapsed):
""" Convert a string from the json file, like "5 days, 2:45:32.987", into integer seconds.
:param elapsed: string scraped from json file
:return: seconds represent... | |
<reponame>kwlzn/model-analysis
# 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 applicable la... | |
import environments.ControlledRangeVariance
from opebet import wealth_lb_1d, wealth_lb_2d, wealth_2d, wealth_lb_2d_individual_qps
import pickle
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
def getenv(wsq, tv=None):
wsupport = [0, 0.5, 2, 100]
env = environments.C... | |
subdir: str,
subcontents: Dict[str, Union[bool, Dict]],
):
"""Updates a directory's content tree with the content tree of a subdirectory."""
def update_dict(base: dict, update: dict):
for key in update:
# "/" can be in *base* if the directory's parent was re-checked
if key in base and key != "/":
update_dict(ba... | |
get_member returned nothing.
# This can be fixed with a slight breaking change to the return type,
# i.e. adding discord.Object to the list of it
# However, for now this is an acceptable compromise.
if target is not None:
ret[target] = overwrite
return ret
@property
def category(self):
"""Optional[:class:`~di... | |
<filename>SideBar.py
import tkinter as tk
import os,sys
import time
from PIL import Image,ImageTk
import threading
from tkinter.ttk import Progressbar, Style, Scale
from tkcolorpicker import askcolor
from tkinter import filedialog
import psutil as ps
from tkinter.scrolledtext import ScrolledText
import tkinte... | |
ok
def do_setup(self):
try:
for setup in self._setups:
setup(*self._current_params)
except NotImplementedError as e:
# allow skipping test
print(f"asv: skipped: {e !r} ")
return True
return False
def redo_setup(self):
if not self._redo_setup_next:
self._redo_setup_next = True
return
self.do_teardown()
... | |
<reponame>Tubbz-alt/adam
import logging
from abc import ABC
from itertools import chain
from pathlib import Path
from random import Random
from attr import attrib, attrs, evolve
from attr.validators import instance_of, optional
from immutablecollections import (
ImmutableSet,
ImmutableSetMultiDict,
immutabledict,
... | |
assert func(X[1], X[2]).round(5) == 0.67568
# In[35]:
def dice(u, v):
##### YOUR CODE HERE
return 1 - (2*np.sum(np.minimum(u, v))) / np.sum(u + v)
# In[36]:
if 'IS_GRADESCOPE_ENV' not in os.environ:
test_dice_implementation(dice)
# ### t-test reweighting [2 points]
#
#
# The t-test statistic can be t... | |
int(temp.split('%s_'%readme_name)[1]))
else:
numFile = 1
readme_name = 'ReadMe_%s.txt'%(numFile+1)
readme = open('%s%s/%s'%(path, outDir, readme_name), 'w')
readme.write(update)
readme.close()
# ------------------------------------------------------------------------
# setup all the slicers. set up randomSeed ... | |
<gh_stars>10-100
import pygame, sys , time , random
from pygame.locals import QUIT,K_UP,K_ESCAPE,KEYDOWN, K_LEFT, K_RIGHT,K_a,K_d
PURPLE = ((170,0,255))
BOX_SIZE = 20
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
BOARD_WIDTH = 10
score = 0
blue = ((0,255,255))
green = ((0,255,0))
pink = ((255,0,101))
yellow = ((255... | |
def test_create_mahindra_gps_device_log_with_valid_deleted_on(self):
data = self.minimum_valid_data.copy()
data["deleted_on"] = datetime.now()
self.client.credentials(HTTP_AUTHORIZATION=self.token)
response = self.client.post(self.create_url, data, format='json')
self.assertEqual(response.status_code, status.HTTP... | |
"""Implementations of the IPFP algorithm to solve for equilibrium and do comparative statics
in several variants of the `Choo and Siow 2006 <https://www.jstor.org/stable/10.1086/498585?seq=1>`_ model:
* homoskedastic with singles (as in Choo and Siow 2006)
* homoskedastic without singles
* gender-heteroskedastic: w... | |
<gh_stars>1-10
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.... | |
<filename>experimental/language_structure/vrnn/utils.py
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apach... | |
<gh_stars>0
#!/usr/bin/env python3
import sys
import copy
import rospy
import moveit_commander
import moveit_msgs.msg
import geometry_msgs.msg
from math import pi, radians
from std_msgs.msg import String
from moveit_commander.conversions import pose_to_list
from tf import transformations as tf
ROTATION_AXIS = 'sxyz'
... | |
return self.get_level(level)[local_win]
def get_global(self, level: int, global_win: int) -> np.ndarray:
"""
Get window using global index
Parameters
----------
level : int
The decimation level
global_win : int
Global window index
Returns
-------
np.ndarray
Window data
"""
index_offset = self.metadata... | |
device=device)
self.assertEqual(torch.mv(nm, _m), torch.mv(nm, _m, out=_m_out))
self.assertEqual(0, torch.isnan(torch.mv(nm, _m)).sum())
# torch.mm
mp = torch.randn((p, m), device=device).t()
np_out = torch.full((n, p), float('nan'), device=device)
self.assertEqual(torch.mm(nm, mp), torch.mm(nm, mp, out=np_out))... | |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# -----------
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 <NAME>
# uuid : 633f2088-bbe3-11eb-b9c2-33be0bb8451e
# author: <NAME>
# email : <EMAIL>
# date : 2021-05-23
# -----------
"""
The `repair` command has access to tools that can repair various
problems that... | |
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
name: ini
version_added: "2.4"
short_description: Uses an Ansible INI file as ... | |
<gh_stars>1-10
# Copyright 2016, FBPIC contributors
# Authors: <NAME>, <NAME>
# License: 3-Clause-BSD-LBNL
"""
This test file is part of FB-PIC (Fourier-Bessel Particle-In-Cell).
It tests the global PIC loop by launching a linear periodic plasma wave,
and letting it evolve in time. Its fields are then compared with th... | |
import keras
from keras.models import Model
from keras.layers import Input,Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.utils import multi_gpu_model
from keras.utils import plot_model
from keras import losses
import os
import tensorflow as tf
from keras import ... | |
"""
Testing numba implementation of the numba dictionary.
The tests here only check that the numba typing and codegen are working
correctly. Detailed testing of the underlying dictionary operations is done
in test_dictimpl.py.
"""
from __future__ import print_function, absolute_import, division
import sys
import num... | |
that part of the surface is now merged
centerlines = vmtk_resample_centerline(centerlines, length=0.1)
inlet = centerlines.GetPoint(0)
outlets = []
lines_to_compare = []
for i in range(centerlines.GetNumberOfLines()):
lines_to_compare.append(extract_single_line(centerlines, i))
outlets += lines_to_compare[-1].Ge... | |
self.get_plot_compare_behaviour_correlation(astroA_l)
saving_utils.save_plotly_fig(fig_behaviour_corr, behaviour_corr_path)
behaviour_corr_path = os.path.join(output_experiment_path_comparison, 'plots', 'correlations', 'behaviour_corr_dff')
fig_behaviour_corr = self.get_plot_compare_behaviour_correlation(astroA_l, ... | |
<gh_stars>0
"""Contains functions to perform detection, deblending and measurement
on images.
"""
from functools import partial
import astropy.table
import numpy as np
import skimage.feature
from btk import plot_utils
from btk.compute_metrics import Metrics_params
from btk.measure import Measurement_params
class ... | |
[]
prev_cfg_data = []
for _cfg, _cfg_sec, _cfg_repeat, _exclude_common_secs in cfg_file_list:
if not _cfg:
continue
if _cfg_repeat:
assert prev_cfg_data, "repeat cfg found without previous cfg data: {}".format(_cfg)
txt = 'Processing repeat parameters from {:s}'.format(_cfg)
if _exclude_common_secs:
txt = '{}... | |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ## ###############################################
#
# interfaceTools.py
# Contains all the tools for creating an interface
#
# Autor: <NAME>
# License: MIT
#
# ## ###############################################
from locale import normalize
from tkinter import * # Carga... | |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | |
from __future__ import unicode_literals
import re
import os
import six
import json
import time
import shlex
import atexit
import psutil
import requests
import tornado.gen
from orderedattrdict import AttrDict
from threading import Thread, Lock
from subprocess import Popen, PIPE, STDOUT # nosec
from six.moves.urllib.par... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.