content stringlengths 0 1.55M |
|---|
<import_stmt>collections<def_stmt>canonicalize json_obj preserve_sequence_order=<true><block_start>"""
This function canonicalizes a Python object that will be serialized as JSON.
Example usage: json.dumps(canonicalize(my_obj))
Args:
json_obj (object): the Python object that will later be serialized ... |
# Copyright (C) 2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
<try_stmt><block_start><import_stmt>e2e.fixtures<import_from_stmt>e2e.conftest_utils *# noqa
<import_from_stmt>e2e.conftest_utils pytest_addoption<as>_e2e_pytest_addoption# noqa
<import_from_stmt>e2e config# noqa
<import_from_stmt>e2e.... |
"""Validation for UDFs.
Warning: This is an experimental module and API here can change without notice.
DO NOT USE DIRECTLY.
"""<import_from_stmt>inspect Parameter Signature signature<import_from_stmt>typing Any Callable List<import_stmt>ibis.common.exceptions<as>com<import_from_stmt>ibis.expr.datatypes DataType<def_... |
<import_from_stmt>datetime datetime<line_sep># ensure an rpc peer is added
<def_stmt>addpeer p rpcpeer<block_start>pid=rpcpeer['id']<if_stmt>pid<not><in>p.persist['peerstate']<block_start>p.persist['peerstate'][pid]={'connected':rpcpeer['connected'] 'last_seen':datetime.now()<if>rpcpeer['connected']<else><none> 'avail'... |
<import_stmt>sys<import_stmt>scipy.stats<line_sep>normal=scipy.stats.norm(0 1)<def_stmt>phi_major x<block_start><return>normal.cdf(x)<block_end><def_stmt>phi_minor x<block_start><return>normal.pdf(x)<block_end><def_stmt>v x t<block_start>xt=x-t<line_sep>denom=phi_major(xt)<line_sep><return>-xt<if>(denom<l>sys.float_inf... |
# Status: Being ported by Steven Watanabe
# Base revision: 47077
#
# Copyright (c) 2005 <NAME>.
# Copyright 2006 <NAME>
# Copyright (c) 2008 <NAME>
#
# Use, modification and distribution is subject to the Boost Software
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
# http://www.boost.org/LICENSE_1_0.... |
# -*- coding: utf-8 -*-
# The MIT License (MIT) - Copyright (c) 2016-2021 <NAME>.
<import_stmt>pytest<import_from_stmt>skidl netlist_to_skidl<import_from_stmt>.setup_teardown get_filename setup_function teardown_function<def_stmt>test_parser_1 <block_start>netlist_to_skidl(get_filename("Arduino_Uno_R3_From_Scratch.net"... |
"""Implementations of algorithms for continuous control."""<import_stmt>functools<import_from_stmt>typing Optional Sequence Tuple<import_stmt>jax<import_stmt>jax.numpy<as>jnp<import_stmt>numpy<as>np<import_stmt>optax<import_from_stmt>jaxrl.agents.sac temperature<import_from_stmt>jaxrl.agents.sac.actor update<as>update_... |
"""Example revision
Revision ID: fdf0cf6487a3
Revises:
Create Date: 2021-08-09 17:55:19.491713
"""<import_from_stmt>alembic op<import_stmt>sqlalchemy<as>sa<line_sep># revision identifiers, used by Alembic.
revision="<KEY>"<line_sep>down_revision=<none><line_sep>branch_labels=<none><line_sep>depends_on=<none><def_stmt... |
# -*- Python -*-
<import_stmt>os<line_sep># Setup config name.
config.name='MemorySanitizer'+getattr(config 'name_suffix' 'default')<line_sep># Setup source root.
config.test_source_root=os.path.dirname(__file__)<line_sep># Setup default compiler flags used with -fsanitize=memory option.
clang_msan_cflags=(["-fsanitize... |
## -*- encoding: utf-8 -*-
"""
This file (./domaines_doctest.sage) was *autogenerated* from ./domaines.tex,
with sagetex.sty version 2011/05/27 v2.3.1.
It contains the contents of all the sageexample environments from this file.
You should be able to doctest this file with:
sage -t ./domaines_doctest.sage
It is always ... |
# Copyright 1996-2021 Cyberbotics 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-2.0
#
# Unless required by applicable law or agreed to in... |
<import_from_stmt>django.shortcuts render<import_from_stmt>django.views View<line_sep># Create your views here.
<def_stmt>simple request<block_start><return>render(request 'tmpl/simple.html')<block_end><def_stmt>guess request<block_start>context={'zap':'42'}<line_sep><return>render(request 'tmpl/guess.html' context)<bl... |
<import_stmt>requests<import_stmt>jsonpickle<import_from_stmt>requests_oauthlib OAuth1<import_from_stmt>urllib.parse parse_qs urlencode<import_stmt>cherrypy<import_from_stmt>collections defaultdict<import_stmt>json<import_stmt>os<import_stmt>re<import_from_stmt>collections defaultdict<line_sep># For readable serializat... |
<import_stmt>copy<import_stmt>pickle<import_stmt>tcod<def_stmt>test_tcod_random <arrow><none><block_start>rand=tcod.random.Random(tcod.random.COMPLEMENTARY_MULTIPLY_WITH_CARRY)<assert_stmt>0<le>rand.randint(0 100)<le>100<assert_stmt>0<le>rand.uniform(0 100)<le>100<line_sep>rand.guass(0 1)<line_sep>rand.inverse_guass(0 ... |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
# Copyright 1999-2021 Alibaba Group Holding 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-2.0
#
# Unless required by applicable law or a... |
<import_stmt>sys<import_stmt>socket<line_sep>conn=socket.create_connection(('0.0.0.0' 8080))<line_sep>msgs=[# 0 Keep-Alive, Transfer-Encoding chunked
'GET / HTTP/1.1\r\nConnection: Keep-Alive\r\n\r\n' # 1,2,3 Close, EOF "encoding"
'GET / HTTP/1.1\r\n\r\n' 'GET / HTTP/1.1\r\nConnection: close\r\n\r\n' 'GET / HTTP/1.0\r\... |
# Copyright (c) 2010-2017 <NAME>
#
# 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 use, copy, modify, merge, publish, distrib... |
# -*- coding: utf-8 -*-
<import_from_stmt>gi.repository.GdkPixbuf Pixbuf<import_from_stmt>os makedirs<def_stmt>main <block_start><for_stmt>size (16 22 24 32 48 64 128 256 512)<block_start>icon=Pixbuf.new_from_file_at_scale("formiko.svg" size size <true>)<line_sep>makedirs("%dx%d"%(size size))<line_sep>icon.savev("%dx%d... |
###
### This file was automatically generated
###
<import_from_stmt>archinfo.arch register_arch Endness Register<import_from_stmt>.common ArchPcode<class_stmt>ArchPcode_PowerPC_LE_32_QUICC(ArchPcode)<block_start>name='PowerPC:LE:32:QUICC'<line_sep>pcode_arch='PowerPC:LE:32:QUICC'<line_sep>description='PowerQUICC-III 32... |
<import_from_stmt>importlib _bootstrap<import_from_stmt>. util<import_stmt>collections<import_stmt>imp<import_stmt>sys<import_stmt>unittest<class_stmt>PathHookTests(unittest.TestCase)<block_start>"""Test the path hook for extension modules."""<line_sep># XXX Should it only succeed for pre-existing directories?
# XXX Sh... |
load("//tools/bzl:maven_jar.bzl" "maven_jar")<def_stmt>external_plugin_deps omit_commons_codec=<true><block_start>JACKSON_VERS="2.10.2"<line_sep>maven_jar(name="scribejava-core" artifact="com.github.scribejava:scribejava-core:6.9.0" sha1="ed761f450d8382f75787e8fee9ae52e7ec768747" )<line_sep>maven_jar(name="jackson-anno... |
#
# This file is part of LiteX.
#
# Copyright (c) 2014-2019 <NAME> <<EMAIL>>
# Copyright (c) 2019 msloniewski <<EMAIL>>
# Copyright (c) 2019 vytautasb <<EMAIL>>
# SPDX-License-Identifier: BSD-2-Clause
<import_stmt>os<import_stmt>subprocess<import_stmt>sys<import_stmt>math<import_from_stmt>shutil which<import_from_stmt>... |
<import_stmt>Crypto.Random.random<as>rand<import_stmt>itertools<import_stmt>math#for log
<import_stmt>sys<def_stmt>decomposition i#from stack exchange, don't think it's uniform
<block_start><while_stmt>i<g>0<block_start>n=rand.randint(1 i)<line_sep><yield>n<line_sep>i<augsub>n<block_end><block_end><def_stmt>Decompositi... |
'''OpenGL extension ARB.transform_feedback_instanced
This module customises the behaviour of the
OpenGL.raw.GL.ARB.transform_feedback_instanced to provide a more
Python-friendly API
Overview (from the spec)
Multiple instances of geometry may be specified to the GL by calling
functions such as DrawArraysInstance... |
# -*- coding: utf-8 -*-
"""
Geometrical functions
---------------------
References
----------
.. [W1] Wikipedia: https://de.wikipedia.org/wiki/Ellipse#Ellipsengleichung_(Parameterform)
.. [WAE] Wolfram Alpha: Ellipse. (http://mathworld.wolfram.com/Ellipse.html)
"""<import_stmt>numpy<as>np<import_from_stmt>typing Unio... |
<import_stmt>dataclasses<import_stmt>inspect<import_from_stmt>dataclasses dataclass field<import_from_stmt>pprint pprint<import_stmt>attr<class_stmt>ManualComment<block_start><def_stmt>__init__ self id:int text:str<block_start>self.id:int=id<line_sep>self.text:str=text<block_end><def_stmt>__repr__ self<block_start><ret... |
#
# Copyright (C) 2001,2002,2003 <NAME> and Rational Discovery LLC
#
""" Functionality for ranking bits using info gains
**Definitions used in this module**
- *sequence*: an object capable of containing other objects which supports
__getitem__() and __len__(). Examples of these include lists, tuples, an... |
<import_stmt>copy<import_stmt>math<import_stmt>logging<import_from_stmt>typing Dict List Optional Tuple Union<import_stmt>os<import_stmt>numpy<as>np<import_stmt>torch<import_stmt>torch.nn<as>nn<import_stmt>torch.nn.functional<as>F<import_stmt>torch.jit<as>jit<import_stmt>torch.autograd<import_stmt>contextlib<import_stm... |
# Copyright (C) 2013 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... |
<import_stmt>os<import_stmt>sys<import_from_stmt>pyspark.sql.types *<line_sep>PATH="/home/ubuntu/work/ml-resources/spark-ml/data"<line_sep>SPARK_HOME="/home/ubuntu/work/spark-2.0.0-bin-hadoop2.7/"<line_sep>os.environ['SPARK_HOME']=SPARK_HOME<line_sep>sys.path.append(SPARK_HOME+"/python")<import_from_stmt>pyspark SparkC... |
<import_from_stmt>rest_framework.test APITestCase APIClient<import_from_stmt>django.urls reverse<import_from_stmt>rest_framework.authtoken.models Token<class_stmt>UserTest(APITestCase)<block_start>"""
Test the User APIv2 endpoint.
"""<line_sep>fixtures=['dojo_testdata.json']<def_stmt>setUp self<block_start>toke... |
# -*- coding: utf-8 -*-
<import_stmt>pytest<import_from_stmt>mock Mock<import_from_stmt>bravado_core.exception SwaggerMappingError<import_from_stmt>bravado_core.operation Operation<import_from_stmt>bravado_core.param get_param_type_spec<import_from_stmt>bravado_core.param Param<import_from_stmt>bravado_core.spec Spec<l... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -------------------------------------------------------------------... |
<import_from_stmt>django.db migrations<def_stmt>rename_sslyze_parser apps schema_editor<block_start>Test_Type_model=apps.get_model('dojo' 'Test_Type')<try_stmt><block_start>test_type_sslyze=Test_Type_model.objects.get(name='SSLyze 3 Scan (JSON)')<line_sep>test_type_sslyze.name='SSLyze Scan (JSON)'<line_sep>test_type_ss... |
<import_from_stmt>collections defaultdict<import_stmt>graphene<import_stmt>pytest<import_from_stmt>django.core.exceptions ValidationError<import_from_stmt>....shipping.error_codes ShippingErrorCode<import_from_stmt>..mutations BaseChannelListingMutation<def_stmt>test_validate_duplicated_channel_ids channel_PLN channel_... |
#! /usr/bin/python2
# -*- coding: utf-8 -*-
"""
Clock function to take running time following Segmatch.
"""<line_sep># BSD 3-Clause License
#
# Copyright (c) 2019, FPAI
# Copyright (c) 2019, SeriouslyHAO
# Copyright (c) 2019, xcj2019
# Copyright (c) 2019, Leonfirst
#
# All rights reserved.
#
# Redistribution and use in... |
<import_stmt>os<import_stmt>glob<line_sep>subdirs=glob.glob("tests/periodicities/*")<line_sep>subdirs=['tests/periodicities/Month' 'tests/periodicities/Minute' 'tests/periodicities/Week' 'tests/periodicities/Business_Hour' 'tests/periodicities/Business_Day' 'tests/periodicities/Second' 'tests/periodicities/Semi_Month' ... |
<import_from_stmt>forest_fire.server server<line_sep>server.launch()<line_sep> |
<import_from_future_stmt> unicode_literals<import_from_stmt>django.contrib.auth.models User<import_from_stmt>djblets.webapi.errors PERMISSION_DENIED<import_from_stmt>reviewboard.reviews.models ScreenshotComment<import_from_stmt>reviewboard.webapi.resources resources<import_from_stmt>reviewboard.webapi.tests.base BaseWe... |
# --------------------------------------------------------------------------------------
# Copyright (c) 2013-2021, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# --------------------------------------... |
"""
Check for Office file types
ViperMonkey is a specialized engine to parse, analyze and interpret Microsoft
VBA macros (Visual Basic for Applications), mainly for malware analysis.
Author: <NAME> - http://www.decalage.info
License: BSD, see source code or documentation
Project Repository:
https://github.com/decala... |
<import_from_stmt>st2tests.base BaseSensorTestCase<import_from_stmt>third_party_resource ThirdPartyResource<class_stmt>ThirdPartyResourceTestCase(BaseSensorTestCase)<block_start>sensor_cls=ThirdPartyResource<def_stmt>test_k8s_object_to_st2_trigger_bad_object self<block_start>k8s_obj={'type':'kanye' 'object':{'kind':'pr... |
<import_from_stmt>cx_core integration<as>integration_module<import_from_stmt>cx_core.controller Controller<def_stmt>test_get_integrations fake_controller:Controller<block_start>integrations=integration_module.get_integrations(fake_controller {})<line_sep>inteagration_names={i.name<for>i integrations}<assert_stmt>inteag... |
<import_stmt>datetime<import_stmt>os<import_from_stmt>io BytesIO<import_stmt>logging<import_from_stmt>functools wraps<import_from_stmt>copy deepcopy<import_from_stmt>collections Counter<import_stmt>slugify<import_stmt>yaml<import_stmt>mistune<import_stmt>requests<import_from_stmt>flask Blueprint Flask render_template a... |
# flake8: noqa
"""This is the main public API of Morepath.
Additional public APIs can be imported from the :mod:`morepath.error`
and :mod:`morepath.pdbsupport` modules. For custom directive
implementations that interact with core directives for grouping or
subclassing purposes, or that need to use one of the Morepath
... |
<import_from_stmt>locust HttpUser TaskSet task constant<import_from_stmt>locust LoadTestShape<class_stmt>UserTasks(TaskSet)<block_start>@task<def_stmt>get_root self<block_start>self.client.get("/")<block_end><block_end><class_stmt>WebsiteUser(HttpUser)<block_start>wait_time=constant(0.5)<line_sep>tasks=[UserTasks]<bloc... |
<import_stmt>typer<def_stmt>name_callback value:str<block_start><if_stmt>value<ne>"Camila"<block_start><raise>typer.BadParameter("Only Camila is allowed")<block_end><return>value<block_end><def_stmt>main name:str=typer.Option(<ellipsis> callback=name_callback)<block_start>typer.echo(f"Hello {name}")<block_end><if_stmt>... |
"""Randomize the minitaur_gym_alternating_leg_env when reset() is called.
The randomization include swing_offset, extension_offset of all legs that mimics
bent legs, desired_pitch from user input, battery voltage and motor damping.
"""<import_stmt>os inspect<line_sep>currentdir=os.path.dirname(os.path.abspath(inspect.... |
<import_from_stmt>typing Dict Tuple Optional<import_from_stmt>pathlib Path<import_stmt>asyncio<import_from_stmt>._mask Mask<import_from_stmt>._event Event<import_from_stmt>._base InotifyBase<line_sep>__all__=('Minotaur' )<class_stmt>Notification<block_start>__slots__=('_path' '_type' '_isdir' '_unmount' '_qoverflow' )<... |
"""!
@brief Collection of examples devoted to containers.
@authors <NAME> (<EMAIL>)
@date 2014-2020
@copyright BSD-3-Clause
"""<line_sep> |
<import_stmt>pytest<import_stmt>torch<line_sep>@pytest.fixture(autouse=<true>)<def_stmt>manual_seed_zero <block_start>torch.manual_seed(0)<block_end>@pytest.fixture(scope='session')<def_stmt>cuda_sleep # Warm-up CUDA.
<block_start>torch.empty(1 device='cuda')<line_sep># From test/test_cuda.py in PyTorch.
start=torch.cu... |
# -*- coding: utf-8 -*-
<import_from_stmt>..Qt QtCore QtGui<class_stmt>DockDrop(object)<block_start>"""Provides dock-dropping methods"""<def_stmt>__init__ self allowedAreas=<none><block_start>object.__init__(self)<if_stmt>allowedAreas<is><none><block_start>allowedAreas=['center' 'right' 'left' 'top' 'bottom']<block_end... |
"""Consts for Kaiterra integration."""<import_from_stmt>datetime timedelta<import_from_stmt>homeassistant.const CONCENTRATION_MICROGRAMS_PER_CUBIC_METER CONCENTRATION_MILLIGRAMS_PER_CUBIC_METER CONCENTRATION_PARTS_PER_BILLION CONCENTRATION_PARTS_PER_MILLION PERCENTAGE Platform <line_sep>DOMAIN="kaiterra"<line_sep>DISPA... |
<import_from_stmt>flask request<import_from_stmt>apps.auth.auth_require required<import_from_stmt>apps.project.business.issue IssueBusiness IssueRecordBusiness IssueDashBoardBusiness<import_from_stmt>apps.project.extentions parse_json_form validation parse_list_args2<import_from_stmt>library.api.render json_detail_rend... |
#encoding:utf-8
<import_from_stmt>utils weighted_random_subreddit<line_sep>t_channel='@news756'<line_sep>subreddit=weighted_random_subreddit({'politics':0.5 'news':0.5})<def_stmt>send_post submission r2t<block_start><return>r2t.send_simple(submission text='{title}\n\n{self_text}\n\n/r/{subreddit_name}\n{short_link}' gi... |
"""
DocumentNGramSymWinGraph.py
Created on May 23, 2017, 4:56 PM
"""<import_stmt>networkx<as>nx<import_stmt>pygraphviz<as>pgv<import_stmt>matplotlib.pyplot<as>plt<import_from_stmt>networkx.drawing.nx_agraph graphviz_layout<import_from_stmt>DocumentNGramGraph DocumentNGramGraph<class_stmt>DocumentNGramSymWinGrap... |
<import_stmt>numpy<as>np<import_stmt>pytest<import_from_stmt>pandas DataFrame Series concat <import_stmt>pandas._testing<as>tm<line_sep>@pytest.mark.parametrize("func" ["cov" "corr"])<def_stmt>test_ewm_pairwise_cov_corr func frame<block_start>result=getattr(frame.ewm(span=10 min_periods=5) func)()<line_sep>result=resul... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
<import_from_stmt>typing Callable Dict<import_stmt>torch<import_stmt>torch.nn<as>nn<import_from_stmt>nni.retiarii model_wrapper<import_from_stmt>nni.retiarii.nn.pytorch NasBench201Cell<line_sep>__all__=['NasBench201']<line_sep>OPS_WITH_STRIDE={'no... |
<import_stmt>os<import_stmt>sys<import_stmt>numpy<as>np<import_stmt>matplotlib.pyplot<as>plt<import_stmt>flopy<def_stmt>run <block_start>workspace=os.path.join("lake")<line_sep># make sure workspace directory exists
<if_stmt><not>os.path.exists(workspace)<block_start>os.makedirs(workspace)<block_end>fext="png"<line_sep... |
<import_from_stmt>changes.api.base APIView<import_from_stmt>changes.lib.coverage get_coverage_by_build_id merged_coverage_data<import_from_stmt>changes.models.build Build<class_stmt>BuildTestCoverageAPIView(APIView)<block_start><def_stmt>get self build_id<block_start>build=Build.query.get(build_id)<if_stmt>build<is><no... |
#Autogenerated schema
<import_from_stmt>openpyxl.descriptors.serialisable Serialisable<import_from_stmt>openpyxl.descriptors Typed String Bool Sequence <import_from_stmt>openpyxl.descriptors.excel CellRange<class_stmt>Extension(Serialisable)<block_start>tagname="extension"<line_sep>uri=String(allow_none=<true>)<def_stm... |
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2021/7/25 19:30
# @author : Mo
# @function: predict model, 预测模块-多类分类
# 适配linux
<import_stmt>platform<import_stmt>json<import_stmt>sys<import_stmt>os<line_sep>path_root=os.path.abspath(os.path.join(os.path.dirname(__file__) "../.."))<line_sep>path_sys=os.path.join... |
# Copyright 2016 The TensorFlow Authors. 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 applica... |
<import_stmt>numpy<as>np<class_stmt>ProbAbsoluteShading(object)<block_start><def_stmt>__init__ self params<block_start>self.params=params<block_end><def_stmt>cost self s_nz<block_start><if_stmt>self.params.abs_shading_weight<block_start><if_stmt>self.params.abs_shading_log<block_start><return>self.params.abs_shading_we... |
<def_stmt>find_accounts search_text# perform search...
<block_start><if_stmt><not>db_is_available<block_start><return><none><block_end># returns a list of account IDs
<return>db_search(search_text)<block_end>accounts=find_accounts('python')<if_stmt>accounts<is><none><block_start>print("Error: DB not available")<block_e... |
"""
PyTorch Profiler With TensorBoard
====================================
This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler
to detect performance bottlenecks of the model.
Introduction
------------
PyTorch 1.8 includes an updated profiler API capable of
recording the CPU side operations ... |
# python 3.7
"""Utility functions for image editing from latent space."""<import_stmt>os.path<import_stmt>numpy<as>np<line_sep>__all__=['parse_indices' 'interpolate' 'mix_style' 'get_layerwise_manipulation_strength' 'manipulate' 'parse_boundary_list']<def_stmt>parse_indices obj min_val=<none> max_val=<none><block_start... |
#
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... |
<import_stmt>numpy<as>np<import_stmt>os<import_from_stmt>chainercv.chainer_experimental.datasets.sliceable GetterDataset<import_from_stmt>chainercv.utils read_image<line_sep>linemod_object_diameters={'ape':0.103 'benchvise':0.286908 'cam':0.173 'can':0.202 'cat':0.155 'driller':0.262 'duck':0.109 'eggbox':0.176364 'glu... |
# -*- encoding: utf-8 -*-
"""Utility functions for computing combinations of dimensions and hierarchy
levels"""<import_from_future_stmt> absolute_import<import_stmt>re<import_stmt>os.path<import_stmt>json<import_from_stmt>collections OrderedDict<import_from_stmt>.errors ModelInconsistencyError ArgumentError Configurati... |
<import_stmt>torch<import_stmt>torch.nn<as>nn<import_stmt>torch.nn.functional<as>F<import_from_stmt>modules Conv ResBlock<class_stmt>Wavenet_Student(nn.Module)<block_start><def_stmt>__init__ self num_blocks_student=[1 1 1 1 1 1] num_layers=10 front_channels=32 residual_channels=64 gate_channels=128 skip_channels=64 ker... |
#! /usr/bin/env python
<import_from_future_stmt> print_function<import_stmt>pandas<as>pd<import_stmt>numpy<as>np<import_stmt>argparse<def_stmt>generate_csv start_index fname<block_start>cols=[str('A'+str(i))<for>i range(start_index NUM_COLS+start_index)]<line_sep>data=[]<for_stmt>i range(NUM_ROWS)<block_start>vals=(np.... |
"""Test suite for the {{ cookiecutter.project_slug_no_hyphen }} package."""<line_sep> |
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
"""Pybricks robotics module."""<import_from_stmt>_pybricks.robotics DriveBase<line_sep> |
# coding=utf-8
# Copyright 2021 The Google Research 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
# Copyright (c) Uber Technologies, Inc. and its affiliates.
# Copyright (c) 2021 Kuaishou AI Platform & DS3 Lab.
#
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
<import_from_stmt>distutils.version LooseVersion<i... |
"""
Created on July 20, 2020
Updated on May 19, 2021
model: Product-based Neural Networks for User Response Prediction
@author: <NAME>(<EMAIL>)
"""<import_stmt>tensorflow<as>tf<import_from_stmt>tensorflow.keras Model<import_from_stmt>tensorflow.keras.regularizers l2<import_from_stmt>tensorflow.keras.layers Embedding ... |
<import_stmt>time<import_stmt>sys<import_stmt>os<import_stmt>numpy<as>np<import_stmt>torch<import_stmt>torch.nn<as>nn<import_stmt>torchvision.models<as>models<import_from_stmt>torch.nn.utils.rnn pack_padded_sequence<import_from_stmt>model.base_torch BaseModel<import_from_stmt>model.utils.general init_dir get_logger<imp... |
# encoding: utf-8
#
# Copyright (c) 2019 <NAME> <<EMAIL>>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2019-09-06
#
"""Overlay check mark on icons."""<import_from_future_stmt> print_function absolute_import<import_from_stmt>Cocoa NSBitmapImageRep NSPNGFileType NSImage NSMakeSize NSCompositeCop... |
"""
==========================================================
Fitting model on imbalanced datasets and how to fight bias
==========================================================
This example illustrates the problem induced by learning on datasets having
imbalanced classes. Subsequently, we compare different approac... |
# This sample tests the checker's ability to enforce
# type invariance for type arguments.
# pyright: strict
<import_from_stmt>typing Dict Union<line_sep>foo:Dict[Union[int str] str]={}<line_sep>bar:Dict[str str]={}<line_sep># This should generate an error because
# both type parameters for Dict are invariant,
# and st... |
# coding: utf-8
# quote from kmaiya/HQAutomator
# 谷歌搜索部分原版搬运,未做修改
<import_stmt>time<import_stmt>json<import_stmt>requests<import_stmt>webbrowser<line_sep>questions=[]<def_stmt>get_answer <block_start>resp=requests.get('http://htpmsg.jiecaojingxuan.com/msg/current' timeout=4).text<line_sep>resp_dict=json.loads(resp)... |
"""Classes representing color entries and mappings."""<line_sep># =============================================================================
# IMPORTS
# =============================================================================
<import_from_future_stmt> annotations<line_sep># Standard Library
<import_stmt>re<impo... |
"""
Holds global celery application state and startup / shutdown handlers.
"""<import_from_stmt>celery Celery<import_from_stmt>celery.app app_or_default<import_from_stmt>celery.signals beat_init worker_process_init worker_process_shutdown setup_logging <import_from_stmt>ichnaea.log configure_logging<import_from_stmt>ic... |
#===============================================================================
# Copyright 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... |
<import_from_stmt>pudzu.charts *<import_from_stmt>pudzu.sandbox.bamboo *<import_stmt>seaborn<as>sns<line_sep># generate map
df=pd.read_csv("datasets/euvotes.csv").set_index('country')<line_sep>palette=tmap(RGBA sns.cubehelix_palette(11 start=0.2 rot=-0.75))<line_sep>ranges=[20000000 10000000 5000000 2000000 1000000 500... |
#! /usr/bin/env python
# This file is part of khmer, https://github.com/dib-lab/khmer/, and is
# Copyright (C) 2011-2015, Michigan State University.
# Copyright (C) 2015, The Regents of the University of California.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted pro... |
# 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.org for more info... |
<import_from_stmt>ctypes c_int<import_from_stmt>.dll _bind<line_sep>__all__=[# Enums
"SDL_BlendMode" "SDL_BLENDMODE_NONE" "SDL_BLENDMODE_BLEND" "SDL_BLENDMODE_ADD" "SDL_BLENDMODE_MOD" "SDL_BLENDMODE_MUL" "SDL_BLENDMODE_INVALID" "SDL_BlendOperation" "SDL_BLENDOPERATION_ADD" "SDL_BLENDOPERATION_SUBTRACT" "SDL_BLENDOPERAT... |
<import_from_stmt>six python_2_unicode_compatible<import_from_stmt>.base QuickbooksManagedObject QuickbooksTransactionEntity Ref CustomField MetaData<line_sep>@python_2_unicode_compatible<class_stmt>CompanyCurrency(QuickbooksManagedObject QuickbooksTransactionEntity)<block_start>"""
QBO definition: Applicable only ... |
<import_from_stmt>foundations_spec *<import_from_stmt>unittest.mock call<class_stmt>TestArtifactDownloader(Spec)<block_start>mock_archiver=let_mock()<line_sep>make_directory_mock=let_patch_mock('os.makedirs')<line_sep>@let<def_stmt>source_directory self<block_start><return>self.faker.uri_path()<block_end>@let<def_stmt>... |
# -*- coding: utf-8 -*-
<import_stmt>os<import_from_stmt>vilya.models.project CodeDoubanProject<import_from_stmt>vilya.models git<import_from_stmt>tests.base TestCase<import_from_stmt>tests.utils mkdtemp<import_from_stmt>vilya.libs gyt<import_from_stmt>vilya.libs.permdir get_repo_root<class_stmt>TestGit(TestCase)<block... |
<import_stmt>numpy<as>np<import_stmt>sys<import_stmt>json<import_stmt>glob<import_stmt>os.path<as>osp<import_stmt>cv2<def_stmt>compute_whdr reflectance judgements delta=0.1<block_start>points=judgements['intrinsic_points']<line_sep>comparisons=judgements['intrinsic_comparisons']<line_sep>id_to_points={p['id']:p<for>p p... |
__title__='The Onion Box'<line_sep>__description__='Dashboard to monitor Tor node operations.'<line_sep>__version__='20.2'<line_sep>__stamp__='20200119|095654'<line_sep> |
<import_stmt>glob<import_stmt>pandas<as>pd<import_from_stmt>configparser ConfigParser<import_stmt>os<import_from_stmt>simba.drop_bp_cords *<def_stmt>multiplyFreeHand inifile currVid<block_start>_,CurrVidName,ext=get_fn_ext(currVid)<line_sep>config=ConfigParser()<line_sep>configFile=str(inifile)<line_sep>config.read(con... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 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... |
###
# Copyright (c) 2020-2021, The Limnoria Contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.