content stringlengths 27 928k | path stringlengths 4 230 | size int64 27 928k | nl_text stringlengths 21 396k | nl_size int64 21 396k | nl_language stringlengths 2 3 | nl_language_score float64 0.04 1 |
|---|---|---|---|---|---|---|
__all__ = ["ZeroInflatedPoisson", "ZeroInflatedGeneralizedPoisson",
"ZeroInflatedNegativeBinomialP"]
import warnings
import numpy as np
import statsmodels.base.model as base
import statsmodels.base.wrapper as wrap
import statsmodels.regression.linear_model as lm
from statsmodels.discrete.discrete_model impo... | statsmodels/discrete/count_model.py | 43,570 | Derivative of the expected endog with respect to the parameters.
Parameters
----------
params : ndarray
parameter at which score is evaluated
Returns
-------
The value of the derivative of the expected endog with respect
to the parameter vector.
derivative of score_obs w.r.t. endog
Parameters
----------
params :... | 8,193 | en | 0.707109 |
"""
===============================
Filling holes and finding peaks
===============================
In this example, we fill holes (i.e. isolated, dark spots) in an image using
morphological reconstruction by erosion. Erosion expands the minimal values of
the seed image until it encounters a mask image. Thus, the seed... | doc/examples/plot_holes_and_peaks.py | 2,623 | ===============================
Filling holes and finding peaks
===============================
In this example, we fill holes (i.e. isolated, dark spots) in an image using
morphological reconstruction by erosion. Erosion expands the minimal values of
the seed image until it encounters a mask image. Thus, the seed ima... | 591 | en | 0.740615 |
from spinnman.messages.scp.abstract_messages.abstract_scp_request\
import AbstractSCPRequest
from spinnman.messages.sdp.sdp_header import SDPHeader
from spinnman.messages.sdp.sdp_flag import SDPFlag
from spinnman.messages.scp.scp_request_header import SCPRequestHeader
from spinnman.messages.scp.scp_command import S... | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/messages/scp/impl/scp_dpri_get_status_request.py | 1,415 | An SCP Request to get the status of the dropped packet reinjection
:param x: The x-coordinate of a chip, between 0 and 255
:type x: int
:param y: The y-coordinate of a chip, between 0 and 255
:type y: int
:param p: The processor running the dropped packet reinjector, between 0 and 17
:type p: int | 317 | en | 0.883815 |
class ComConversionLossAttribute(Attribute, _Attribute):
"""
Indicates that information was lost about a class or interface when it was imported from a type library to an assembly.
ComConversionLossAttribute()
"""
def __init__(self, *args):
""" x.__init__(...) initializes x; see x.__cl... | release/stubs.min/System/Runtime/InteropServices/__init___parts/ComConversionLossAttribute.py | 503 | Indicates that information was lost about a class or interface when it was imported from a type library to an assembly.
ComConversionLossAttribute()
x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; s... | 356 | en | 0.770597 |
import subprocess
def test_CLI_coffee_call():
return_code = subprocess.call([
# path is or should be in a setting somewhere
'/home/pi/Programming/Automation/executables/rfoutlets_coffee.py',
'1000',
'-d',
'0',
'--test'
])
assert return_code == 0
| tests/test_coffee.py | 308 | path is or should be in a setting somewhere | 43 | en | 0.950376 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3.dev20161004124613 on 2016-10-10 12:42
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('api', '0003_recordtag'),
]
operations = [
mig... | compass-api/G4SE/api/migrations/0004_geoservicemetadata.py | 3,940 | -*- coding: utf-8 -*- Generated by Django 1.10.3.dev20161004124613 on 2016-10-10 12:42 | 86 | en | 0.607553 |
from .base import * # noqa
# Debugging to be enabled locally only
DEBUG = True
# Set the cache backend for development
CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}}
# This key to be used locally only.
SECRET_KEY = "foo"
# Enable FE component library
PATTERN_LIBRARY_ENABLED = Tr... | alpha/settings/dev.py | 1,530 | noqa Debugging to be enabled locally only Set the cache backend for development This key to be used locally only. Enable FE component library Allow all the hosts locally only. Allow requests from the local IPs to see more debug information. This is only to test Wagtail emails. Display sent emails in the console while d... | 772 | en | 0.855348 |
#
# @lc app=leetcode.cn id=35 lang=python3
#
# [35] search-insert-position
#
None
# @lc code=end | codes_auto/35.search-insert-position.py | 96 | @lc app=leetcode.cn id=35 lang=python3 [35] search-insert-position @lc code=end | 79 | en | 0.390174 |
# coding=utf-8
"""
This is the custom functions for youtube mirror
please copy it to YOUR_EWM_FOLDER/custom_func.py
Without this file, twitter mirror won't work normally
"""
import re
from random import randint
import traceback
from zmirror import *
# 如果你想视频服务器和网页服务器分开, 通过多个视频服务器来进行负载均衡,
# 请设置在主网页服务器上设置 is_master ... | more_configs/custom_func_youtube.py | 5,152 | This is the custom functions for youtube mirror
please copy it to YOUR_EWM_FOLDER/custom_func.py
Without this file, twitter mirror won't work normally
coding=utf-8 如果你想视频服务器和网页服务器分开, 通过多个视频服务器来进行负载均衡, 请设置在主网页服务器上设置 is_master = True ,在视频服务器上部署后设置 is_master = False 在主服务器上的 videocdn_domain_list 中设置好视频服务器的域名 在每个视频... | 1,005 | zh | 0.686926 |
#-------------------------------------------------------------------------------
# elftools: elf/sections.py
#
# ELF sections
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from ..common.exceptions import ELFCompr... | elftools/elf/sections.py | 16,664 | ARM attribute object - representing a build attribute of ARM ELF files.
ELF .ARM.attributes section.
Subsection of an ELF .ARM.attributes section.
Subsubsection of an ELF .ARM.attributes section's subsection.
ELF NOTE section. Knows how to parse notes.
ELF NULL section
ELF .SUNW Syminfo ta... | 3,836 | en | 0.791034 |
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache License, Version 2.0 (the
#"License"); you may not use thi... | hadoop-mapreduce1-project/src/contrib/hod/hodlib/Common/setup.py | 45,814 | Licensed to the Apache Software Foundation (ASF) under oneor more contributor license agreements. See the NOTICE filedistributed with this work for additional informationregarding copyright ownership. The ASF licenses this fileto you under the Apache License, Version 2.0 (the"License"); you may not use this file exce... | 3,551 | en | 0.819381 |
# Generated by Django 3.0.5 on 2020-04-21 18:33
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("main", "0004_auto_20200324_0009"),
]
operations = [
... | main/migrations/0005_auto_20200421_1833.py | 1,091 | Generated by Django 3.0.5 on 2020-04-21 18:33 | 45 | en | 0.606901 |
"""Helper classes for easy recording of videos and images. The classes automatically
find a suitable name for the output file given a specific pattern.
"""
from abc import ABC, abstractmethod
import cv2
import os
from glob import glob
class Recorder(ABC):
def __init__(self, path, file_pattern):
existing =... | Source Codes/Assignment1/record.py | 1,114 | Helper classes for easy recording of videos and images. The classes automatically
find a suitable name for the output file given a specific pattern. | 148 | en | 0.69916 |
# 發送信件
import os
import sys
import smtplib
import getpass
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
COMMASPACE = ', '
def main():
sender = input("Please enter your email here:")
gmail_password = getpass.getpass("Please enter your password he... | sendmail.py | 1,775 | 發送信件 建立郵件主題 檔案位置 加入檔案到MAIL底下 寄送EMAIL | 36 | zh | 0.991706 |
import numpy as np
from dipy.viz import actor, window, widget, fvtk
from dipy.data import fetch_viz_icons, read_viz_icons
import numpy.testing as npt
from dipy.testing.decorators import xvfb_it
@xvfb_it
@npt.dec.skipif(not actor.have_vtk)
@npt.dec.skipif(not actor.have_vtk_colors)
def test_button_and_slider_widgets()... | dipy/viz/tests/test_fvtk_widgets.py | 5,776 | create some minimalistic streamlines the show manager allows to break the rendering process in steps so that the widgets can be added properly This callback is used to update the buttons/sliders' position so they can stay on the right side of the window when the window is being resized. show_manager.add_window_callback... | 765 | en | 0.765771 |
import logging
import random
import sys
from python3_gearman import compat
from python3_gearman.connection_manager import GearmanConnectionManager
from python3_gearman.worker_handler import GearmanWorkerCommandHandler
from python3_gearman.errors import ConnectionError
gearman_logger = logging.getLogger(__name__)
POL... | client/python3_gearman/worker.py | 10,521 | GearmanWorker :: Interface to accept jobs from a Gearman server
Polling callback to notify any outside listeners whats going on
with the GearmanWorker.
Return True to continue polling, False to exit the work loop
Check to see if we hold the job lock
Create a new job using our self.job_class
Return a shuffled list of c... | 1,783 | en | 0.876992 |
# test_services.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro).
# This copyright was auto-generated on Wed, Sep 1, 2021 5:05:54 PM
# pylint: disable = redefined-outer-name
import uuid
from typing import List, Dict
import pytest
from open_gopro.ble.services import UUIDs, UUI... | demos/python/sdk_wireless_camera_control/tests/unit/test_services.py | 4,323 | test_services.py/Open GoPro, Version 2.0 (C) Copyright 2021 GoPro, Inc. (http://gopro.com/OpenGoPro). This copyright was auto-generated on Wed, Sep 1, 2021 5:05:54 PM pylint: disable = redefined-outer-name Get all attributes by nested looping through services | 261 | en | 0.784279 |
"""
Polimorfismo e o principio onde permite que classes derivadas
de uma mesma superclasse tenha metodos iguais (com a mesma
assinatura) mas comportamentos diferentes
Mesma assinatura - Mesma quantidade e tipo de parametros
"""
from abc import ABC, abstractmethod
class A(ABC):
@abstractmethod
def fala(self, m... | 3 - python POO/106 - Polimorfismo/polimorfismo.py | 548 | Polimorfismo e o principio onde permite que classes derivadas
de uma mesma superclasse tenha metodos iguais (com a mesma
assinatura) mas comportamentos diferentes
Mesma assinatura - Mesma quantidade e tipo de parametros | 219 | pt | 0.935718 |
# 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... | smu/geometry/get_bond_length_distribution.py | 2,903 | Generate the dot separated form of a bond length distribution component.
Scan Conformer protos to extract bond length distributions.
Generate bond length distibutions.
Args:
input_fname: An existing TFRecord file containing Conformer protos.
output_fname: An output file that will be created that contains all bond
... | 1,186 | en | 0.777088 |
#!/usr/bin/env python3
import os
import json
import re
import pathlib
import subprocess
from argparse import ArgumentParser
rex = re.compile(r'version = "(\S+)"')
def regex_matches(relpath, regex=rex):
p = pathlib.Path(relpath)
assert p.exists()
for line in open(str(p)):
m = regex.match(line)
... | scripts/set_core_version.py | 3,356 | !/usr/bin/env python3 1.25.0 subprocess.call(["cargo", "update", "-p", "deltachat"]) | 84 | en | 0.228549 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Takes the same arguments as Windows link.exe, and a definition of libraries
to split into subcomponents. Does multiple passes of link.exe invocation to
de... | tools/win/split_link/split_link.py | 14,499 | Copyright 2013 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. This can be set to ignore data exports. The resulting DLLs will probably not run, but at least they can be generated. The log of data exports will still be output. ... | 1,428 | en | 0.910439 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import unittest
import os, sys, io, os.path, tempfile
from copy import copy
from contextlib import contextmanager
from jinja2.exceptions import UndefinedError
from j2cli.cli import render_command
@contextmanager
def mktemp(contents):
""" Create a t... | tests/render-test.py | 10,305 | Helper test shortcut
Create a temporary file with the given contents, and yield its path
Test --customize
Test that an extension is enabled
Test --undefined
-*- coding: utf-8 -*-: The expected output Filename Format Stdin Filename Format Stdin Filename Format Stdin Filename Format Stdin Environment! In this case... | 1,371 | en | 0.751331 |
# Copyright (c) OpenMMLab. All rights reserved.
import os
import warnings
import numpy as np
from mmcv import Config
from xtcocotools.cocoeval import COCOeval
from ...builder import DATASETS
from .topdown_coco_dataset import TopDownCocoDataset
@DATASETS.register_module()
class TopDownCocoWholeBodyDataset(TopDownCoc... | mmpose/datasets/datasets/top_down/topdown_coco_wholebody_dataset.py | 8,988 | CocoWholeBodyDataset dataset for top-down pose estimation.
"Whole-Body Human Pose Estimation in the Wild", ECCV'2020.
More details can be found in the `paper
<https://arxiv.org/abs/2007.11858>`__ .
The dataset loads raw features and apply specified transforms
to return a dict containing the image tensors and other in... | 1,208 | en | 0.644902 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from mozbuild.makeutil import (
Makefile,
read_dep_makefile,
Rule,
)
from mozunit import main
import os
impo... | python/mozbuild/mozbuild/test/test_makeutil.py | 5,025 | This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. | 192 | en | 0.934305 |
# NAMI2 outline / thoughts
# This is the middle module in a series of three
# Fhe first module does data preprocessing, creating a .csv for this module
# Preprocessing can be done manually - no one should expect us
# to be able to process data from machines we have never worked with
# This modules is the most import... | nami2.py | 5,847 | NAMI2 outline / thoughts This is the middle module in a series of three Fhe first module does data preprocessing, creating a .csv for this module Preprocessing can be done manually - no one should expect us to be able to process data from machines we have never worked with This modules is the most important since it co... | 4,228 | en | 0.883879 |
import re
import math
import time as t
from datetime import date,datetime,time,timedelta
import pytz
from os import path,getcwd
from enum import Enum
from .base import *
class ExpressionError(Exception):pass
class Operand():
@property
def value(self):
pass
def __add__(self, other):return Additio... | base/py_expression.py | 36,817 | def __pow__(self, other):return Exponentiation([other,self]) def __floordiv__(self, other):return FloorDivision([other,self]) https://stackabuse.com/how-to-format-dates-in-python/ https://www.programiz.com/python-programming/datetime https://docs.python.org/2.5/lib/string-methods.html if all the operands are constant... | 516 | en | 0.498276 |
# -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2013-2017 Isis Lovecruft
# (c) 2007-2017, The Tor Project, Inc.
# (c) 2007... | bridgedb/test/test_https_distributor.py | 16,874 | Tests for :class:`HTTPSDistributor`.
Reset all bridge blocks in between test method runs.
A request for IPv4 bridges should return IPv4 bridges.
Asking for bridge addresses which are simultaneously IPv4 and IPv6
(in that order) should return IPv4 bridges.
A request for IPv6 bridges should return IPv6 bridges.
Asking fo... | 2,318 | en | 0.905455 |
import logging
import os
import re
import signal
from collections import defaultdict, namedtuple
from concurrent.futures import CancelledError, ProcessPoolExecutor, wait
from contextlib import contextmanager
from functools import wraps
from multiprocessing import Manager
from typing import Iterable, Mapping, Optional
... | dvc/repo/experiments/__init__.py | 20,705 | Class that manages experiments in a DVC repo.
Args:
repo (dvc.repo.Repo): repo instance that these experiments belong to.
Run dvc repro for the specified BaseExecutors in parallel.
Returns dict containing successfully executed experiments.
Resume an existing (checkpoint) experiment.
Experiment will be reproduced... | 3,490 | en | 0.80732 |
"""Per-prefix data, mapping each prefix to a dict of locale:name.
Auto-generated file, do not edit by hand.
"""
from ..util import u
# Copyright (C) 2011-2018 The Libphonenumber Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | sam-app/phonenumbers/geodata/data22.py | 927,988 | Per-prefix data, mapping each prefix to a dict of locale:name.
Auto-generated file, do not edit by hand.
Copyright (C) 2011-2018 The Libphonenumber 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 Lic... | 677 | en | 0.842867 |
#
# Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/
# Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch>,
# Apoorv Vyas <avyas@idiap.ch>
#
import os
import time
import unittest
import torch
from torch.nn.init import normal_
from fast_transformers.aggregate import aggregate, broadcast... | tests/sparse_product/test_clustered_sparse_product_gpu.py | 5,252 | Copyright (c) 2020 Idiap Research Institute, http://www.idiap.ch/ Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch>, Apoorv Vyas <avyas@idiap.ch> Cluster the hashes and return the cluster index per query | 219 | en | 0.490782 |
# Copyright 2016 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 ... | video_level_models.py | 7,579 | CNN model with L2 regularization.
Logistic model with L2 regularization.
A softmax over a mixture of logistic models (with L2 regularization).
ResNet model with L2 regularization.
Creates a CNN model.
Args:
model_input: 'batch' x 'num_features' matrix of input features.
vocab_size: The number of classes in the dat... | 2,603 | en | 0.826813 |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from pcdet.ops.iou3d_nms_diff.iou3d_nms_diff_utils import boxes_iou3d_gpu_differentiable
from . import box_utils
class SigmoidFocalClassificationLoss(nn.Module):
"""
Sigmoid focal cross entropy loss.
"""
def __init... | pcdet/utils/loss_utils.py | 20,306 | nn.Module warpper for focal loss
Regression loss for an output tensor
Arguments:
output (batch x dim x h x w)
mask (batch x max_objects)
ind (batch x max_objects)
target (batch x max_objects x dim)
Regression loss for an output tensor
Arguments:
output (batch x dim x h x w)
mask (batch x max_objects)
ind ... | 6,031 | en | 0.609906 |
import numpy as np
import yaml
from dask.distributed import Client, LocalCluster, as_completed
import argparse
from os.path import exists, join
from os import makedirs
from mlmicrophysics.data import subset_data_files_by_date, assemble_data_files
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifie... | scripts/search_ml_model_params.py | 14,447 | Args:
model_params:
num_settings:
random_state:
Returns:
Train a single machine learning model configuration to predict each microphysical tendency.
Args:
classifier_model_name:
classifier_model_config:
regressor_model_name:
regressor_model_config:
config_index:
train_scaled_input:... | 489 | en | 0.351866 |
from __future__ import absolute_import, unicode_literals
from unittest import TestCase as UnitTestCase
import django
from django.contrib.contenttypes.models import ContentType
from django.core import serializers
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.test import TestCase,... | tests/tests.py | 23,905 | Ported from Jonathan Buchanan's `django-tagging
<http://django-tagging.googlecode.com/>`_
Make sure manager override defaults and sets correctly.
Adding an integer as a tag should raise a ValueError (#237).
Test that pears are more similar to apples than watermelons
Double quotes can contain commas
Test with comma-deli... | 1,365 | en | 0.84603 |
from tests.base_client import test_redis
from tests.base_client import client
# General redis read-write
def test_redis_read_write(client):
test_redis.mset({'uuid': 'lws_dstate_xxx-xxxx-xxxx'})
assert test_redis.get('uuid') == 'lws_dstate_xxx-xxxx-xxxx'
| webflaskapi/tests/integration/test_redis.py | 265 | General redis read-write | 24 | en | 0.92785 |
# Generated by Django 3.0.8 on 2020-07-05 20:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('account', '0001_initial'),
('member', '0001_initial'),
]
operations = [
migrations.AlterField(
... | app/member/migrations/0002_auto_20200705_2027.py | 501 | Generated by Django 3.0.8 on 2020-07-05 20:27 | 45 | en | 0.662556 |
# -*- coding: utf-8 -*-
#================================================================
# Don't go gently into that good night.
#
# author: klaus
# description:
#
#================================================================
import os
import sys
CURRENT_FILE_DIRECTORY = os.path.abspath(os.path.dirname(__f... | dlhammer/test/test_logger.py | 563 | -*- coding: utf-8 -*-================================================================ Don't go gently into that good night. author: klaus description:================================================================ | 220 | en | 0.726902 |
import re
import string
import sys
import warnings
from operator import itemgetter
from sys import version_info
import nltk
from unidecode import Cache, _warn_if_not_unicode
def main():
LANGUAGES = {'de': 'german', 'en': 'english'}
lang = LANGUAGES[sys.argv[1]]
for line in sys.stdin:
for sentence... | create_corpus.py | 5,753 | prevent multiple spaces remove any special chars if token was a number, replace it with <unk> token modified version from unidecode.unidecode_expect_ascii that does not replace umlauts modified version from unidecode._unidecode that keeps umlauts Basic ASCII, ä/Ä, ö/Ö, ü/Ü Characters in Private Use Area and above are i... | 456 | en | 0.732408 |
"""
merged implementation of the cache provider
the name cache was not chosen to ensure pluggy automatically
ignores the external pytest-cache
"""
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
import py
import six
import attr
import pytest
import json
import shu... | src/_pytest/cacheprovider.py | 12,521 | Plugin which implements the --lf (run last-failing) option
Plugin which implements the --nf (run new-first) option
Return a cache object that can persist state between testing sessions.
cache.get(key, default)
cache.set(key, value)
Keys must be a ``/`` separated value, where the first part is usually the
name of yo... | 1,845 | en | 0.761 |
import os
import shutil
from webpack.conf import settings
def write_file(file_name, content):
with open(file_name, 'w') as _file:
_file.write(content)
def read_file(file_name):
with open(file_name, 'r') as _file:
return _file.read()
def clean_output_root():
# Clean out any files genera... | tests/utils.py | 437 | Clean out any files generated from previous test runs | 53 | en | 0.76205 |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... | jdcloud_sdk/services/vm/models/Policy.py | 1,019 | :param policyId: (Optional) 自动任务策略ID。
:param policyType: (Optional) 自动任务策略类型,当前只支持 `AutoImage` 自动备份镜像。
coding=utf8 Copyright 2018 JDCLOUD.COM 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 htt... | 739 | en | 0.730884 |
# 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... | CIFAR_tests/gaussian_moments.py | 10,396 | Compute delta for given log_moments and eps.
Args:
log_moments: the log moments of privacy loss, in the form of pairs
of (moment_order, log_moment)
eps: the target epsilon.
Returns:
delta
Compute epsilon for given log_moments and delta.
Args:
log_moments: the log moments of privacy loss, in the form of pa... | 3,065 | en | 0.723912 |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the users object"""
class Meta:
model = get_user_model()
fields = (... | app/user/serializers.py | 1,729 | Serializer for the user authentication object
Serializer for the users object
Create a new user with encrypted password and return it
Update a user, setting the password correctly and return it
Validate and authenticate the user | 228 | en | 0.714163 |
# coding: utf-8
"""
Memsource REST API
Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource.com/blog/2017/10/24/introducing-rest-apis... | test/test_project_workflow_step_dto_v2.py | 1,325 | ProjectWorkflowStepDtoV2 unit test stubs
Test ProjectWorkflowStepDtoV2
Memsource REST API
Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource... | 799 | en | 0.511122 |
#!/usr/bin/env python3
# ----------------------------------------------------------------------------
#
# Copyright 2018 EMVA
#
# 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://ww... | src/harvesters_gui/_private/frontend/pyqt5/device_list.py | 2,547 | !/usr/bin/env python3 ---------------------------------------------------------------------------- Copyright 2018 EMVA 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/licens... | 861 | en | 0.788451 |
"""Commonly used tensor functions."""
import math
from typing import Union, Optional
import tensorflow as tf
import numpy as np
from .factory import AbstractTensor
def binarize(tensor: tf.Tensor,
bitsize: Optional[int] = None) -> tf.Tensor:
"""Extract bits of values in `tensor`, returning a `tf.Tenso... | tf_encrypted/tensor/shared.py | 3,325 | Extract bits of values in `tensor`, returning a `tf.Tensor` with same
dtype.
Extract bits of values in `tensor`, returning a list of tensors.
Generic convolution implementation with im2col over AbstractTensors.
Generic implementation of im2col on tf.Tensors.
Commonly used tensor functions.
return tf.stack(bits, axis=... | 501 | en | 0.73762 |
import sys
import utils
from statistics import Statistics
from connect import connect
import printer
from configloader import ConfigLoader
from rafflehandler import Rafflehandler
import rafflehandler
import OnlineHeart
import asyncio
from cmd import Cmd
def fetch_real_roomid(roomid):
if roomid:
real_r... | bili_console.py | 6,334 | print('是谁', giftid) inst.loop.call_soon_threadsafe(inst.queue_console.put_nowait, request) 对10号单独简陋处理 print('检测') | 113 | zh | 0.18405 |
import unittest
from _2015 import d22_wizard
class TestWizard(unittest.TestCase):
# damage, heal, acBonus, manaRecharge
def test_evaluateSpellEffects_effects_empty(self):
w = d22_wizard.Wizard(0, 0)
activeEffects = {}
effects = w._evaluateSpellEffects(activeEffects)
self.assert... | test/test_wizard.py | 3,873 | damage, heal, acBonus, manaRecharge | 35 | en | 0.70451 |
import numpy as np
np.random.seed(0)
ADOPT = 0
OVERRIDE = 1
WAIT = 2
class Environment(object):
def __init__(self, mining_powers, gammas, T):
# relative mining strengths.
self.mining_powers = mining_powers
self.gammas = gammas
self.num_miners = len(mining_powers)
#... | proof_of_work/multiagent/turn_based/v5/environmentv5.py | 2,938 | relative mining strengths. termination parameters chain variables chop chain to proper length | 93 | en | 0.459925 |
"""
Statistical tools for time series analysis
"""
from statsmodels.compat.python import (iteritems, range, lrange, string_types,
lzip, zip, long)
from statsmodels.compat.scipy import _next_regular
import numpy as np
from numpy.linalg import LinAlgError
from scipy import stats
f... | statsmodels/tsa/stattools.py | 45,893 | Returns the results for the lag length that maximizes the info criterion.
Parameters
----------
mod : Model class
Model estimator class
endog : array-like
nobs array containing endogenous variable
exog : array-like
nobs by (startlag + maxlag) array containing lags and possibly other
variables
startlag ... | 24,198 | en | 0.684042 |
"""
ASGI config for ecom project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS... | ecom/asgi.py | 385 | ASGI config for ecom project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ | 210 | en | 0.731462 |
"""Tests for the smarttub integration."""
from datetime import timedelta
from openpeerpower.components.smarttub.const import SCAN_INTERVAL
from openpeerpower.util import dt
from tests.common import async_fire_time_changed
async def trigger_update(opp):
"""Trigger a polling update by moving time forward."""
... | tests/components/smarttub/__init__.py | 464 | Tests for the smarttub integration. | 35 | en | 0.695962 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | src/tests/test_proxies/test_streams/test_main.py | 1,051 | !/usr/bin/python Copyright 2018-2021 Polyaxon, 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 w... | 579 | en | 0.834661 |
"""This file contains utils for BEHAVIOR demo replay checkpoints."""
import json
import os
from igibson.objects.articulated_object import URDFObject
import pybullet as p
from igibson.utils.utils import restoreState
def save_task_relevant_state(env, root_directory, filename="behavior_dump"):
json_path = os.path.... | igibson/utils/checkpoint_utils.py | 4,212 | This file contains utils for BEHAVIOR demo replay checkpoints.
Save the dump in a file. Save the dump in a file. Save the simulation state. Save the dump in a file. Restore the simulation state. p.restoreState(fileName=bullet_path) NOTE: For all articulated objects, we need to force_wakeup for the visuals in the simu... | 997 | en | 0.811794 |
import json
import re
import sys
from argparse import ArgumentParser, ArgumentTypeError
from enum import Enum
from pathlib import Path
from typing import Any, Iterable, List, NewType, Optional, Tuple, Union
import dataclasses
DataClass = NewType("DataClass", Any)
DataClassType = NewType("DataClassType", Any)
def st... | toolbox/KGArgsParser.py | 21,157 | This subclass of `argparse.ArgumentParser` uses type hints on dataclasses to generate arguments.
The class is designed to play well with the native argparse. In particular, you can add more (non-dataclass backed)
arguments to the parser after initialization and you'll get the output back after parsing as an additional... | 13,573 | en | 0.275277 |
"""
Class for package details.
"""
import json
from typing import Any, Dict, List
def _log_info(msg: str) -> None:
print(msg)
class PackageAPI:
"""Package API class
This class is used to hold the interface of a given package
being analyzed by doppel. It's comparison operators enable comparison
... | doppel/PackageAPI.py | 3,440 | Package API class
This class is used to hold the interface of a given package
being analyzed by doppel. It's comparison operators enable comparison
between interfaces and its standard JSON format allows this comparison
to happen across programming languages.
Class containing data that describes a package API
:param p... | 1,307 | en | 0.831671 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.contrib.sites.models import Site
from django.core.exceptions import PermissionDenied
from django.utils.encoding import smart_text
from django.utils.translation import (
ugettext_lazy as _,
get_language,
)
fro... | cms/forms/wizards.py | 9,200 | Special widget for the page_type choice-field. This simply adds some JS for
hiding/showing the content field based on the selection of this select.
Special widget for the slug field that requires Title field to be there.
Adds the js for the slugifying.
Validates that either the slug is provided, or that slugification f... | 1,407 | en | 0.843802 |
# 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, software
# d... | tempest/scenario/orchestration/test_server_cfn_init.py | 5,464 | 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, software distributed under th... | 1,107 | en | 0.956707 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/client/dialogs/ssh_host_key.py
#
# 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
#... | king_phisher/client/dialogs/ssh_host_key.py | 6,930 | A base class for dialogs which show information about SSH host keys. It is
assumed that the widgets defined in :py:attr:`.dependencies` are present
including one button to accept the host key, and one to reject. The class's
default response can be set using :py:attr:`.default_response`.
A dialog that shows an SSH host ... | 2,818 | en | 0.884267 |
"""
generate_data.py
Core script for generating training/test addition data. First, generates random pairs of numbers,
then steps through an execution trace, computing the exact order of subroutines that need to be
called.
"""
import pickle
import numpy as np
from tasks.bubblesort.env.trace import Trace
def genera... | tasks/bubblesort/env/generate_data.py | 1,072 | Generates addition data with the given string prefix (i.e. 'train', 'test') and the specified
number of examples.
:param prefix: String prefix for saving the file ('train', 'test')
:param num_examples: Number of examples to generate.
generate_data.py
Core script for generating training/test addition data. First, gene... | 468 | en | 0.568644 |
# Format of required info for batch runs.
debug = 0
AMQPdebug = 0
debugTimer = 0
simNotes = """
Step of load up 10%, Reff Enabled
"""
# Simulation Parameters Dictionary
simParams = {
'timeStep': 1.0,
'endTime': 60.0,
'slackTol': 1,
'PY3msgGroup' : 3,
'IPYmsgGroup' : 60,
'Hinput' : 0.0, # MW*se... | testCases/sixMachine/sixMachineStep4.py | 1,156 | Format of required info for batch runs. Simulation Parameters Dictionary MW*sec of entire system, if !> 0.0, will be calculated in code Untested System F base in Hertz w in swing equation will not be assumed 1 if true Mathematical Options Data Export Parameters relative path from cwd Export mirror with all data if IPY... | 424 | en | 0.643446 |
""" GIGATL experiment specifications
dimpart contains
- "netcdfdimnames": how to map netCDF to CROCO dimensions
- "domainpartition": which CROCO dimensions are tiled
"""
import os
import sys
import glob
from shapely.geometry.polygon import Polygon
import pickle
from pretty import BB
import pretty
import tempf... | paragridded/giga_tools.py | 15,600 | Convert the two pairs of (lower, left), (top, right) in (lat, lon)
into the four pairs of (lat, lon) of the corners
check that all paths are properly defined
Determine which tiles are inside `domain`
The function uses `corners` the list of corners for each tile
Scan dirgiga for *tar files
Reconstruct how netCDF files... | 2,730 | en | 0.645198 |
"""Helper methods to handle the time in Home Assistant."""
import datetime as dt
import re
from typing import Any, Dict, List, Optional, Tuple, Union, cast
import pytz
import pytz.exceptions as pytzexceptions
import pytz.tzinfo as pytzinfo
from homeassistant.const import MATCH_ALL
DATE_STR_FORMAT = "%Y-%m-%d"
UTC = ... | homeassistant/util/dt.py | 12,603 | Return the first value in arr greater or equal to cmp.
Return None if no such value exists.
Convert a UTC datetime object to local time zone.
Convert a date/time into a unix time (seconds since 1970).
Return a datetime as UTC time.
Assumes datetime without tzinfo to be in the DEFAULT_TIME_ZONE.
Find the next datetime... | 4,029 | en | 0.855616 |
#!/usr/bin/python3
from subprocess import Popen, PIPE
import re
import argparse
import signal
import random
import socket
from collections import defaultdict
import sys
import subprocess
try:
import picamera
except ImportError:
subprocess.call([sys.executable, "-m", "pip", "install", "picamera"])
finally:
... | other/gstreamcam.py | 4,672 | !/usr/bin/python3 add individual streams to SDP is parameter an action? save sdp port = arguments.port print(parameters) args.hostname = socket.gethostbyname(args.hostname) | 172 | en | 0.265009 |
import os
from typing import Optional
from pytorchltr.utils.downloader import DefaultDownloadProgress
from pytorchltr.utils.downloader import Downloader
from pytorchltr.utils.file import validate_and_download
from pytorchltr.utils.file import extract_zip
from pytorchltr.utils.file import dataset_dir
from pytorchltr.da... | pytorchltr/datasets/svmrank/mslr10k.py | 5,268 | Utility class for downloading and using the MSLR-WEB10K dataset:
https://www.microsoft.com/en-us/research/project/mslr/.
This dataset is a smaller sampled version of the MSLR-WEB30K dataset.
Args:
location: Directory where the dataset is located.
split: The data split to load ("train", "test" or "vali")
fo... | 1,115 | en | 0.655811 |
# -*- coding: utf-8 -*-
import zeit.wochenende.interfaces
import zeit.wochenende.testing
from zeit.cms.testcontenttype.testcontenttype import ExampleContentType
class SectionTest(zeit.wochenende.testing.FunctionalTestCase):
def test_zwe_ressort_content_is_zwe_content(self):
content = ExampleContentType()... | core/src/zeit/wochenende/tests/test_interfaces.py | 560 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os,glob
from setuptools import setup, find_packages
setup(
name = 'qcon',
version = '2.5',
scripts=['qcon/qcon.py'],
packages=['qcon'],
author = 'pawnhearts',
author_email = 'ph@kotchan.org',
description = """qcon is program for hiding... | setup.py | 1,282 | !/usr/bin/env python -*- coding: utf-8 -*- | 42 | en | 0.34282 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = "Ricardo Ribeiro"
__credits__ = ["Ricardo Ribeiro"]
__license__ = "MIT"
__version__ = "0.0"
__maintainer__ = "Ricardo Ribeiro"
__email__ = "ricardojvr@gmail.com"
__status__ = "Development"
import pyforms.Utils.tools as tools
from PyQ... | pyforms/gui/Controls/ControlCheckBox.py | 1,786 | !/usr/bin/python -*- coding: utf-8 -*- | 38 | en | 0.437977 |
# Importamos testcase
from flask_testing import TestCase
# Importamos nuesra app desde el main de nuestra aplicacion
from main import app
from flask import current_app, url_for
# Creamos una nueva clase que se llama main test
class MainTest(TestCase):
# Creamos el metodo create app que retorna una aplicacion de f... | tests/test_base.py | 2,870 | Importamos testcase Importamos nuesra app desde el main de nuestra aplicacion Creamos una nueva clase que se llama main test Creamos el metodo create app que retorna una aplicacion de flask Configuramos nuestra app para testing de esta manera flask reconoce que se trata de un ambiente de pruebas Indicamos que no vamos... | 1,208 | es | 0.932991 |
import re
import pygtrie as trie # type: ignore
from functools import reduce
__ALL__ = ('PrefixTokenizers', 'PrefixSearch')
class PrefixTokenizers:
# This string here is just an arbitrary long string so that
# re.split finds no matches and returns the entire phrase
ENTIRE_PHRASE = '::gooey/tokenizatio... | gooey/gui/components/filtering/prefix_filter.py | 3,562 | A trie backed index for quickly finding substrings
in a list of options.
Splits the `choice` into a series of tokens based on
the user's criteria.
If suffix indexing is enabled, the individual tokens
are further broken down and indexed by their suffix offsets. e.g.
'Banana', 'anana', 'nana', 'ana'
Cleans and toke... | 588 | en | 0.763667 |
from chainer import backend
from chainer import function
from chainer import utils
from chainer.utils import type_check
class DeCov(function.Function):
"""DeCov loss (https://arxiv.org/abs/1511.06068)"""
def __init__(self, reduce='half_squared_sum'):
self.h_centered = None
self.covariance = ... | chainer/functions/loss/decov.py | 3,084 | DeCov loss (https://arxiv.org/abs/1511.06068)
Computes the DeCov loss of ``h``
The output is a variable whose value depends on the value of
the option ``reduce``. If it is ``'no'``, it holds a matrix
whose size is same as the number of columns of ``y``.
If it is ``'half_squared_sum'``, it holds the half of the
squared... | 1,141 | en | 0.747542 |
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu Nguyen" at 15:39, 20/04/2020 %
# ... | opfunu/cec/cec2005/F8.py | 2,038 | !/usr/bin/env python ------------------------------------------------------------------------------------------------------% Created by "Thieu Nguyen" at 15:39, 20/04/2020 % ... | 742 | en | 0.415004 |
# Copyright 2017 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... | tensorflow/python/debug/lib/source_remote_test.py | 8,243 | Find the first trace of an op that belongs to the TF Python library.
Assert gRPC debug server is started with unlimited message size.
Unit tests for source_remote.
Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file exce... | 1,038 | en | 0.821001 |
# authors_name = 'Preetham Ganesh'
# project_title = 'Multi Sensor-based Human Activity Recognition using OpenCV and Sensor Fusion'
# email = 'preetham.ganesh2015@gmail.com'
import numpy as np
import os
import pandas as pd
import itertools
import logging
import sklearn.pipeline
from sklearn.metrics import accuracy_sc... | codes/model_training_testing.py | 24,321 | Appends the metrics for the current model and current parameter combination to the main dataframe.
Args:
current_model_name: Name of the model currently being trained.
current_combination_name: Current combination of parameters used for training the model.
current_split_metrics: Metrics for the current par... | 8,727 | en | 0.779472 |
import cv2
import keras
import math
import matplotlib.pyplot as plt
import numpy as np
import random
import warnings
from generators.utils import get_affine_transform, affine_transform
from generators.utils import gaussian_radius, draw_gaussian, gaussian_radius_2, draw_gaussian_2
class Generator(keras.utils.Sequence... | generators/common.py | 24,551 | Abstract generator class.
Keras sequence method for generating batches.
Initialize Generator object.
Args:
batch_size: The size of the batches to generate.
group_method: Determines how images are grouped together (defaults to 'ratio', one of ('none', 'random', 'ratio')).
shuffle_groups: If True, shuffles t... | 5,848 | en | 0.554401 |
#https://leetcode.com/problems/reverse-linked-list/
# Iterative method
#Approach :
# Store the head in a temp variable called current .
# curr = head , prev = null
# Now for a normal linked list , the current will point to the next node and so on till null
# For reverse linked list, the current node should po... | DSA 450 GFG/reverse_linked_list_iterative.py | 960 | https://leetcode.com/problems/reverse-linked-list/ Iterative methodApproach : Store the head in a temp variable called current . curr = head , prev = null Now for a normal linked list , the current will point to the next node and so on till null For reverse linked list, the current node should point to the previo... | 664 | en | 0.837332 |
# Generated by Django 2.2.8 on 2020-01-05 15:27
from django.db import migrations
import pyuploadcare.dj.models
class Migration(migrations.Migration):
dependencies = [
('awards', '0005_auto_20200104_1643'),
]
operations = [
migrations.AlterField(
model_name='projo_post',
... | awards/migrations/0006_auto_20200105_1827.py | 425 | Generated by Django 2.2.8 on 2020-01-05 15:27 | 45 | en | 0.622039 |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/03_models.base_models.ipynb (unless otherwise specified).
__all__ = ['MLBEndpointBase', 'MLBEndpointReference', 'CustomInt', 'PositionBase', 'PlayerHandedness', 'PersonBase',
'MLBPerson', 'Coordinates', 'TimeZone', 'VenueLocation', 'TurfType', 'RoofType', 'Fie... | MLB_DataDevTools/models/base_models.py | 3,242 | AUTOGENERATED! DO NOT EDIT! File to edit: nbs/03_models.base_models.ipynb (unless otherwise specified). Internal Cell Cell Cell one or more validators may be yielded which will be called in the order to validate the input, each validator will receive as an input the value returned from the previous validator Cell Cell ... | 371 | en | 0.792855 |
import torch
import torch.autograd as autograd
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from networks.embedding import *
from networks.encoder import *
from networks.selector import *
from networks.classifier import *
from .Model import Model
... | PCNN+WA+PF/models/PCNN_ONE.py | 556 | self.selector = One(config, config.hidden_size * 3) | 51 | en | 0.111818 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# stdlib imports
import os.path
import re
# third party imports
import numpy as np
import pandas as pd
import pkg_resources
# Local imports
from gmprocess.metrics.station_summary import StationSummary
from gmprocess.core.stationstream import StationStream
from gmprocess.... | tests/gmprocess/metrics/imt/fas_greater_of_two_test.py | 3,047 | Testing based upon the work provided in
https://github.com/arkottke/notebooks/blob/master/effective_amp_spectrum.ipynb
!/usr/bin/env python -*- coding: utf-8 -*- stdlib imports third party imports Local imports pgms.to_pickle(fas_file) | 236 | en | 0.642955 |
import os
import nuke
import pyblish.api
import pype
class ExtractReviewData(pype.api.Extractor):
"""Extracts movie and thumbnail with baked in luts
must be run after extract_render_local.py
"""
order = pyblish.api.ExtractorOrder + 0.01
label = "Extract Review Data"
families = ["review"]
... | pype/plugins/nuke/publish/extract_review_data.py | 6,417 | Extracts movie and thumbnail with baked in luts
must be run after extract_render_local.py
Store selection Deselect all nodes to prevent external connections Restore selection get path get first and last frame get input process and connect it to baking create write node retime for Render frames Clean up Select only t... | 347 | en | 0.790302 |
"""
TODO docs
High-level commands to execute tasks
"""
from watsoncloud.foo.project_settings import *
from watsoncloud.foo.audio_video import *
from watsoncloud.foo.watson import *
from multiprocessing import Process
from os.path import exists
def init_project(video_filename):
# creates a project directory and ... | watsoncloud/foo/high.py | 2,393 | project_slug: ./projects/audiostreams/filename.wav
TODO docs
High-level commands to execute tasks
creates a project directory and a copy of the file returns the project slug extracts audio from existing video file creates segments yields filenames of segments segments the audio (via a generator) Send each audio segm... | 582 | en | 0.802804 |
# coding=utf8
from __future__ import unicode_literals
import codecs
from pyecharts import (Bar, Scatter3D)
from pyecharts import Page
from pyecharts.conf import configure, online
from test.constants import RANGE_COLOR, CLOTHES
def create_three():
# bar
v1 = [5, 20, 36, 10, 75, 90]
v2 = [10, 25, 8, 60, 2... | pyecharts-0.3.1/test/test_custom_render.py | 2,005 | coding=utf8 bar scatter3D page.js_dependencies = ['echarts.min'] | 64 | en | 0.269487 |
# This file is part of the pyMOR project (http://www.pymor.org).
# Copyright 2013-2020 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
""" This module provides widgets for displaying plots of
scalar data assigned to one- and two-dime... | src/pymor/discretizers/builtin/gui/matplotlib.py | 10,807 | Setup MPL figure display with empty data.
Load new data into existing plot objects.
Load new data into existing plot objects.
This module provides widgets for displaying plots of
scalar data assigned to one- and two-dimensional grids using
:mod:`matplotlib`. These widgets are not intended to be used directly.
This fi... | 861 | en | 0.752713 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | scripts/world_bank/worldbank.py | 15,922 | Generates World Bank StatVar for a row in the indicators dataframe.
Downloads World Bank country data for all countries and
indicators provided.
Retains only the unique indicator codes provided.
Args:
worldbank_countries: Dataframe with ISO 3166 alpha 3 code for each
country.
indicator_code: Data... | 5,641 | en | 0.827417 |
#coding=utf-8
#
# Created on Apr 23, 2014, by Junn
#
#
import json
from django.http import HttpResponse
from django.shortcuts import render_to_response
from django.template.context import RequestContext
from rest_framework.response import Response as RfResponse
from core import codes
import urllib
... | apps/utils/http.py | 3,479 | for simple dict response, like success and failed, etc
for object json response
data为字典类型数据
从远端下载文件, 并构建request.FILES中的uploaded file对象返回.
@param url: 文件url路径, 如http://abc.im/12345.jpg
@return: SimpleUploadedFile object, it is containned by the request.FILES(dictionary-like object)
返回常量错误码. msg可格式化具有占位符的字符串
params:... | 799 | en | 0.442873 |
#coding:utf-8
"""
@author : linkin
@email : yooleak@outlook.com
@date : 2018-11-07
"""
import asyncio
import datetime
async def send_async_http(session,method,url,*,
retries=1,
interval=1,
wait_factor=2,
... | tools/async_tools.py | 2,375 | @author : linkin
@email : yooleak@outlook.com
@date : 2018-11-07
coding:utf-8 -1 表示无限次失败重试 0 表示不进行失败重试 | 109 | zh | 0.35712 |
from django.test import TestCase, Client
from assertpy import assert_that
from rest_framework import status
from rest_framework.test import APIClient
from .factories import RecipeFactory, IngredientFactory
from ..models import Recipe
from ..serializers import RecipeSerializer
import factory
LIST_SIZE = 3
class Recip... | src/recipes/tests/test_recipe_update.py | 2,799 | it seem that after this is called Django magic happens and the Django client in injected that is, cls.client = APIClient() does not work as expected | 148 | en | 0.980691 |
# Copyright 2019 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 law or agreed to in writing, ... | bigquery/samples/tests/test_client_query_batch.py | 831 | Copyright 2019 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 law or agreed to in writing, software distribut... | 548 | en | 0.871573 |
# Copyright 2015 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... | tensorflow/python/kernel_tests/batch_matmul_op_test.py | 8,534 | Tests for tensorflow.ops.tf.BatchMatMul.
Copyright 2015 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 U... | 1,224 | en | 0.781222 |
"""Here we define the exported functions, types, etc... which need to be
exported through a global C pointer.
Each dictionary contains name -> index pair.
Whenever you change one index, you break the ABI (and the ABI version number
should be incremented). Whenever you add an item to one of the dict, the API
needs to ... | numpy/core/code_generators/numpy_api.py | 18,262 | Here we define the exported functions, types, etc... which need to be
exported through a global C pointer.
Each dictionary contains name -> index pair.
Whenever you change one index, you break the ABI (and the ABI version number
should be incremented). Whenever you add an item to one of the dict, the API
needs to be ... | 942 | en | 0.592923 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import WebDriverException
import time
from django.test import LiveServerTestCase
MAX_WAIT = 10
class NewVisitorTest(LiveServerTestCase):
def setUp(self):
self.browser = webdriver.Firefox()
... | functional_tests/tests.py | 4,528 | Edith has heard about a cool new online to-do app. She goes to check out its homepage She notices the page title and header mention to-do lists She is invited to enter a to-do item straight away She types "Buy peacock feathers" into a text box (Edith's hobby is tying fly-fishing lures) When she hits enter, the page upd... | 1,124 | en | 0.932971 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 by Murray Altheim. All rights reserved. This file is part
# of the Robot Operating System project, released under the MIT License. Please
# see the LICENSE file included as part of this package.
#
# author: Murray Altheim
# created: 2021-03-06
# ... | lib/gps.py | 4,793 | A wrapper around the PA1010d GPS library. Provides individual
properties for each of the GPS outputs.
!/usr/bin/env python3 -*- coding: utf-8 -*- Copyright 2020-2021 by Murray Altheim. All rights reserved. This file is part of the Robot Operating System project, released under the MIT License. Please see the LICENSE f... | 1,658 | en | 0.357139 |
import itertools
import sys
import time
import signal
from .fancycli import fancywait
from .fancycli.platform import isatty
def skipcallback(handler):
raise StopIteration
class ShellNextFrontend:
def __init__(self, use_status_line, show_toggle):
self.show_toggle = show_toggle
self.use_status... | Arknights/shell_next.py | 10,465 | auto [+-rR[N]] stage1 count1 [stage2 count2] ...
按顺序挑战指定关卡特定次数直到理智不足
collect
收集每日任务和每周任务奖励
connect [connector type] [connector args ...]
连接到设备
支持的设备类型:
connect adb [serial or tcpip endpoint]
help
输出本段消息
interactive
进入交互模式,减少按键次数(
quick [+-rR[N]] [n]
重复挑战当前画面关卡特定次数或直到理智不足
+r/-r 是否自动回复... | 432 | zh | 0.695866 |
from dataloader import AmazonProductDataloader
from inverted_index import InvertedIndex
from utils import preprocess_text
import numpy as np
class BM25SearchRelevance:
def __init__(self, inverted_index, b=0.65, k1=1.6):
self.inverted_index = inverted_index
self.b = b
self.k1 = k1
se... | lecture1/code/bm25_search_relevance.py | 1,644 | returns top k documents | 23 | en | 0.095216 |
"""
Pre-defined query strategy for noisy oracles.
In reality, the labels given by human is not always correct. For one hand,
there are some inevitable noise comes from the instrumentation of experimental
setting. On the other hand, people can become distracted or fatigued over time,
introducing variability in the qual... | alipy/query_strategy/noisy_oracles.py | 25,140 | This strategy will select instance by uncertainty and query from all
oracles and return the majority vote result.
Parameters
----------
X: 2D array, optional (default=None)
Feature matrix of the whole dataset. It is a reference which will not use additional memory.
y: array-like, optional (default=None)
Label... | 13,084 | en | 0.720625 |
import komand
from .schema import LabelIssueInput, LabelIssueOutput
# Custom imports below
class LabelIssue(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name='label_issue',
description='Label Issue',
input=LabelIssueInput(),
out... | jira/komand_jira/actions/label_issue/action.py | 1,043 | Add label to issue
Custom imports below | 41 | en | 0.545723 |
"""OAuth1 module written according to http://oauth.net/core/1.0/#signing_process"""
import base64
import hmac
import requests # requests must be loaded so that urllib receives the parse module
import time
import urllib
from hashlib import sha1
from six import b
from uuid import uuid4
use_parse_quote = not hasattr(ur... | emailage/signature.py | 4,243 | Adds dict entries to the user's params dict which are required for OAuth1.0 signature generation
:param secret: API secret
:param params: dictionary of values which will be sent in the query
:param nonce: (Optional) random string used in signature creation, uuid4() is used if not provided
:param timestamp: (Optional) ... | 2,390 | en | 0.396612 |
from numbers import Number
from typing import Dict, Sequence, Tuple, Union
import torch
from meddlr.transforms.base.spatial import (
AffineTransform,
FlipTransform,
Rot90Transform,
TranslationTransform,
)
from meddlr.transforms.build import TRANSFORM_REGISTRY
from meddlr.transforms.param_kind import P... | meddlr/transforms/gen/spatial.py | 6,862 | Affine only supports 2D spatial transforms | 42 | en | 0.843221 |
# This file is a part of ninfs.
#
# Copyright (c) 2017-2021 Ian Burgwin
# This file is licensed under The MIT License (MIT).
# You can find the full license text in LICENSE.md in the root of this project.
import logging
import time
from argparse import ArgumentParser, SUPPRESS
from errno import EROFS
from functools im... | ninfs/mount/_common.py | 11,196 | Handler for easier IO access with raw devices by aligning reads and writes to the sector size.
Wrapper for a FUSE Operations class for things that need a file-like object.
Load keys from a custom ARM9 bootROM path.
This file is a part of ninfs. Copyright (c) 2017-2021 Ian Burgwin This file is licensed under The MIT L... | 1,213 | en | 0.859862 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.