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 |
|---|---|---|---|---|---|---|
import sys
sys.path.append("./stqft")
sys.path.append("./qcnn")
import os
#Activate the cuda env
os.environ["LD_LIBRARY_PATH"] = "$LD_LIBRARY_PATH:/usr/local/cuda/lib64/:/usr/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda-11.2/lib64:/usr/local/cuda/targets/x86_64-linux/lib/"
import time
import multiprocess... | train.py | 5,793 | Activate the cuda envbe gentle.. PoolSize = 1 be gentle.. disable quanv and pix chan mal enable quanv pix chan map load from diskif quanv completely disabled and no pix channel map pass quanv data for training and validation pass quanv data for training and validation | 268 | en | 0.623057 |
# coding: utf-8
"""
ThingsBoard REST API
ThingsBoard Professional Edition IoT platform REST API documentation. # noqa: E501
OpenAPI spec version: 3.3.3PAAS-RC1
Contact: info@thingsboard.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_impo... | tb_rest_client/api/api_pe/entity_group_controller_api.py | 132,204 | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
Add entities to the group (addEntitiesToEntityGroup) # noqa: E501
Add entities to the specified entity group. Entity group allows you to group multiple entitie... | 61,861 | en | 0.706666 |
#==========================================================
#
# This prepare the hdf5 datasets of the DRIVE database
#
#============================================================
import os
import h5py
import numpy as np
from PIL import Image
#content/add2/E2/DRIVE_datasets_training_testing
def write_hdf5(arr,outf... | prepare_datasets_DRIVE.py | 4,135 | ========================================================== This prepare the hdf5 datasets of the DRIVE database============================================================content/add2/E2/DRIVE_datasets_training_testing------------Path of the images --------------------------------------------------------------traintes... | 603 | en | 0.415548 |
import cv2
cap = cv2.VideoCapture(1)
cap.set(3, 640) #WIDTH
cap.set(4, 480) #HEIGHT
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
while True:
# while True:
# ret, frame = cap.read()
#
# # Our operations on the frame come here
# gray = cv2.cvtColor(frame, ... | faces.py | 1,244 | WIDTHHEIGHT while True: ret, frame = cap.read() Our operations on the frame come here gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) try: number = len(faces) size = [faces[0][2], faces[0][3]] position = [faces[0][0], faces[... | 533 | en | 0.521876 |
#!/usr/bin/env python
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree.
from __future__ import print_function
from clang.cindex import Cursor, CursorKind, TokenKind
from utils i... | node_modules/nuclide/pkg/nuclide-clang-rpc/python/outline.py | 6,952 | !/usr/bin/env python Copyright (c) 2015-present, Facebook, Inc. All rights reserved. This source code is licensed under the license found in the LICENSE file in the root directory of this source tree. Function/method cursor kinds. Class-like cursors. (Possibly external) members of CLASS_KINDS. Variables and fields. Cap... | 1,418 | en | 0.864255 |
# -*- coding: utf-8 -*-
"""
@date Created on Fri May 22 2020
@author martin_g for Eomys
"""
# Third party imports
import numpy as np
from scipy import signal
# Local application imports
from mosqito.sq_metrics.loudness.loudness_zwtv._square_and_smooth import (
_square_and_smooth,
)
def _third_octave_levels(sig,... | mosqito/sq_metrics/loudness/loudness_zwtv/_third_octave_levels.py | 9,549 | 3rd octave filtering, squaring, smoothing, level calculation and
downsampling to temporal resolution: 0,5 ms, i.e. sampling rate: 2 kHz
See ISO 532-1 section 6.3
Parameters
----------
sig : numpy.ndarray
time signal sampled at 48 kHz[pa]
fs : int
time signal sampling frequency
Outputs
-------
third_octave_le... | 1,125 | en | 0.699869 |
# -*- coding: utf-8 -*-
import uuid
import pytz
from faker import Faker
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.gis.db.models import PointField
from django.contrib.postgres.indexes import BrinIndex
from django.contrib.postgres.fields import JSONField
from djan... | mikaponics/foundation/models/problem_data_sheet.py | 3,923 | Class model represents danger / destructive element to a production crop.
Special thanks:
(1) Preventing, Diagnosing, and Correcting Common Houseplant Problems via URL
https://extension.psu.edu/preventing-diagnosing-and-correcting-common-houseplant-problems
-*- coding: utf-8 -*- def seed(self, user, product, len... | 1,145 | en | 0.714441 |
# Copyright (c) 2015 - present Facebook, Inc.
# 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. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import logging
from . ... | infer/lib/python/inferlib/capture/ant.py | 2,881 | Copyright (c) 2015 - present Facebook, Inc. 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. An additional grant of patent rights can be found in the PATENTS file in the same directory. This creates an empty argparser for ... | 444 | en | 0.866611 |
#!/usr/bin/env python
# --coding:utf-8--
# Copyright (c) 2020 vesoft inc. All rights reserved.
#
# This source code is licensed under Apache 2.0 License,
# attached with Common Clause Condition 1.0, found in the LICENSES directory.
import logging
from nebula2.common.ttypes import ErrorCode
from nebula2.Exception im... | nebula2/gclient/net/__init__.py | 814 | !/usr/bin/env python --coding:utf-8-- Copyright (c) 2020 vesoft inc. All rights reserved. This source code is licensed under Apache 2.0 License, attached with Common Clause Condition 1.0, found in the LICENSES directory. | 220 | en | 0.862372 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
A family of functions used by CurvefittingAssessor
"""
import numpy as np
all_models = {}
model_para = {}
model_para_num = {}
curve_combination_models = ['vap', 'pow3', 'linear', 'logx_linear', 'dr_hill_zero_background', 'log_power', 'pow4... | src/sdk/pynni/nni/curvefitting_assessor/curvefunctions.py | 5,090 | dr hill zero background
Parameters
----------
x : int
theta : float
eta : float
kappa : float
Returns
-------
float
(theta* x**eta) / (kappa**eta + x**eta)
exp4
Parameters
----------
x : int
c : float
a : float
b : float
alpha : float
Returns
-------
float
c - np.exp(-a*(x**alpha)+b)
ilog2
Parameters
-----... | 1,959 | en | 0.075981 |
from ourstylePy import data
def our_colours(colours=[]):
'''
Extract hexcodes for our colours
If passed a sting, returns the matching hexcode.
If passed a list, returns a list of hexcodes.
Method from https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2.
- colours, list of... | ourstylePy/our_colours.py | 837 | Alias for our_colours()
Extract hexcodes for our colours
If passed a sting, returns the matching hexcode.
If passed a list, returns a list of hexcodes.
Method from https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2.
- colours, list of strings
Examples:
data.our_colours_raw
our_colours()
our_col... | 427 | en | 0.273035 |
from bayesianABTest import sampleSuccessRateForBinomial
from numpy import mean
def bestOfFive(A,B,C,D,E,F):
return mean( (A > B) & (A > C) & (A > D) & (A > E) & (A > F))
############# Example: Binomial Distribution #############
# Actual data for all cases
installs = [986,1013,959,968,1029,1014]
returns = [340,2... | code/examples/example_mikhail.py | 1,355 | Example: Binomial Distribution Actual data for all cases Get samples from the posterior | 88 | en | 0.239216 |
__version__ = "2.2.3"
# Work around to update TensorFlow's absl.logging threshold which alters the
# default Python logging output behavior when present.
# see: https://github.com/abseil/abseil-py/issues/99
# and: https://github.com/tensorflow/tensorflow/issues/26691#issuecomment-500369493
try:
import absl.logging... | transformers/__init__.py | 12,478 | Work around to update TensorFlow's absl.logging threshold which alters the default Python logging output behavior when present. see: https://github.com/abseil/abseil-py/issues/99 and: https://github.com/tensorflow/tensorflow/issues/26691issuecomment-500369493 pylint: disable=invalid-name Files and general utilities ETR... | 446 | en | 0.660837 |
from ..http import dump_header
from ..http import parse_set_header
from ..utils import environ_property
from ..utils import header_property
class CORSRequestMixin(object):
"""A mixin for :class:`~werkzeug.wrappers.BaseRequest` subclasses
that adds descriptors for Cross Origin Resource Sharing (CORS)
heade... | venv/Lib/site-packages/werkzeug/wrappers/cors.py | 3,512 | A mixin for :class:`~werkzeug.wrappers.BaseRequest` subclasses
that adds descriptors for Cross Origin Resource Sharing (CORS)
headers.
.. versionadded:: 1.0
A mixin for :class:`~werkzeug.wrappers.BaseResponse` subclasses
that adds descriptors for Cross Origin Resource Sharing (CORS)
headers.
.. versionadded:: 1.0
Whe... | 492 | en | 0.627484 |
import os
import RPi.GPIO as gpio
import time
import random
from mesafe import distance
motorhizi = 2.5
hiz = 100
aci2 = aci3 = aci4 = 6
aci = 5.5
in4 = 26
in3 = 4
in2 = 12
in1 = 8
solled = 9
sagled = 11
gpio.setwarnings(False)
def init():
gpio.setwarnings(False)
gpio.setmode(gpio.BCM)
gpio.setup(22,g... | Robotics/src/otonomgorev.py | 6,901 | sol sag sol sag sol sag sol sag sag sol | 39 | de | 0.211926 |
import argparse
parser = argparse.ArgumentParser(description="PyTorch implementation of action recognition models")
parser.add_argument('--dataset', type=str, choices=['somethingv1','somethingv2','diving48'],
default = 'somethingv1')
parser.add_argument('--root_path', type = str, default = '../',
... | opts.py | 4,708 | ========================= Model Configs ========================== ========================= Learning Configs =================================================== Optimizer Configs ========================== ========================= Monitor Configs ========================== ========================= Runtime Configs ==... | 413 | en | 0.466281 |
from typing import List, Tuple, Optional
import aiosqlite
from spare.types.blockchain_format.sized_bytes import bytes32
from spare.util.db_wrapper import DBWrapper
class WalletInterestedStore:
"""
Stores coin ids that we are interested in receiving
"""
db_connection: aiosqlite.Connection
db_wra... | spare/wallet/wallet_interested_store.py | 3,908 | Stores coin ids that we are interested in receiving | 51 | en | 0.986597 |
"""
Client for Yandex.Disk.
"""
__version__ = '0.0.1'
| project_backup/__init__.py | 54 | Client for Yandex.Disk. | 23 | en | 0.408967 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | sdk/python/pulumi_azure_native/operationalinsights/storage_insight_config.py | 14,960 | The set of arguments for constructing a StorageInsightConfig resource.
:param pulumi.Input[str] resource_group_name: The name of the resource group. The name is case insensitive.
:param pulumi.Input['StorageAccountArgs'] storage_account: The storage account connection details
:param pulumi.Input[str] workspace_name: Th... | 3,295 | en | 0.627615 |
# This file will consist of some wrapper for using MySQL
# It is mainly used for preparing and calling mysql cli
import logging
from mysql_autoxtrabackup.general_conf import path_config
from mysql_autoxtrabackup.general_conf.generalops import GeneralClass
from mysql_autoxtrabackup.process_runner.process_runner import ... | mysql_autoxtrabackup/utils/mysql_cli.py | 1,778 | This file will consist of some wrapper for using MySQL It is mainly used for preparing and calling mysql cli Using Composition instead of Inheritance here | 154 | en | 0.877482 |
# Copyright 2018 The Cirq Developers
#
# 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 ... | cirq/contrib/paulistring/optimize_test.py | 3,619 | Copyright 2018 The Cirq Developers 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 ... | 557 | en | 0.866863 |
# coding=utf-8
# Copyright 2019 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... | pioneer/robust_loss_pytorch/cubic_spline.py | 3,856 | Perform cubic hermite spline interpolation on a 1D spline.
The x coordinates of the spline knots are at [0 : 1 : len(values)-1].
Queries outside of the range of the spline are computed using linear
extrapolation. See https://en.wikipedia.org/wiki/Cubic_Hermite_spline
for details, where "x" corresponds to `x`, "p" corr... | 2,438 | en | 0.772752 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | samples/generated_samples/aiplatform_v1_generated_pipeline_service_delete_training_pipeline_sync.py | 1,607 | -*- coding: utf-8 -*- Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writin... | 1,133 | en | 0.833397 |
'''
file.readline() 사용해서 csv 파일 열기
'''
#
# def my_csv_reader(fn:str, header=True) -> list:
# '''
# csv 파일의 데이터 2차원 행렬 형태로 리턴
#
#
# :param fn: 읽을 파일 이름(예: data\\exam.csv)
# :param header: csv파일의 헤더 존재 여부
# :return: csv 파일에서 헤더는 제외한 데이터로 이루어진 2차원 리스트
# '''
#
#
# if __name__ == '__main__':
#
# ... | lec07_file/file07.py | 1,259 | 2차원 리스트의 내용을 출력
1 10 20 30 40
2 11 21 31 41
...
:param data: 2차원 행렬 형태의 리스트
:return: None
file.readline() 사용해서 csv 파일 열기
def my_csv_reader(fn:str, header=True) -> list: ''' csv 파일의 데이터 2차원 행렬 형태로 리턴 :param fn: 읽을 파일 이름(예: data\\exam.csv) :param header: csv파일의 헤더 존재 여부 :return: csv 파일에서 헤더는 제외한 데... | 630 | ko | 0.99924 |
from urllib.parse import urlparse
from django.conf import settings
from django.db import models
from django_extensions.db.fields import UUIDField
from pyrabbit.http import HTTPError
from django.contrib.sites.models import Site
from apps.queues import rabbit
class Queue(models.Model):
name = models.CharField(max... | codalab/apps/queues/models.py | 1,466 | Start with pyamqp://guest:guest@localhost:5672// Get localhost:5672 Vhost not found or something | 96 | en | 0.66541 |
#
# This example is again a graph coloring problem. In this case, however,
# a stronger object oriented approach is adopted to show how Coopy is
# indeed compatible with such practices.
#
import coopy
import random
class Node:
def __init__(self):
self._color = coopy.symbolic_int('c')
self._neighb... | examples/example-5.py | 1,799 | Constructs a k colored graph of n nodes in which a pair
of nodes shares an edge with probability 0 <= p <= 1.
Note: this code is for demonstrative purposes only; the
solution for such a problem will not necessarily exist,
in which case the concretization process will throw
an exception.
This example is again a graph... | 614 | en | 0.926247 |
# -*- coding: utf-8 -*-
#
# Electrum - lightweight Dogecoin client
# Copyright (C) 2018 The Electrum developers
#
# 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,
# includ... | electrum/constants.py | 5,885 | -*- coding: utf-8 -*- Electrum - lightweight Dogecoin client Copyright (C) 2018 The Electrum developers 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 limita... | 2,187 | en | 0.717102 |
# Copyright 2015 ETH Zurich
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | python/lib/socket.py | 11,246 | Wrapper around Unix socket with message framing functionality baked in
Base class for socket wrappers
:class:`Socket` manager.
Thin wrapper around BSD/POSIX UDP sockets.
Initialize a UDP socket, then call superclass init for socket options
and binding.
:param tuple bind:
Optional tuple of (`str`, `int`, `str`) des... | 3,250 | en | 0.690426 |
#!/bin/python
# -*- coding: utf-8 -*-
"""
| This file is part of the web2py Web Framework
| Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu>
| License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)
Auth, Mail, PluginManager and various utilities
------------------------------------------------
"""
import ... | gluon/tools.py | 250,936 | !/bin/python -*- coding: utf-8 -*- try stdlib (Python 2.6) try external module fallback to pure-Python module mind there are two loggers here (logger and crud.settings.logger)! seconds We don't want to use base64 encoding for unicode mail encoded or raw text Use multipart/mixed if there is attachments no encoding confi... | 8,611 | en | 0.860975 |
"""
WSGI config for car_selling_parts project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJ... | car_selling_parts/wsgi.py | 411 | WSGI config for car_selling_parts project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/ | 223 | en | 0.76024 |
'''
UnrealCV
========
Provides functions to interact with games built using Unreal Engine.
>>> import unrealcv
>>> (HOST, PORT) = ('localhost', 9000)
>>> client = unrealcv.Client((HOST, PORT))
'''
import sys, ctypes, struct, threading, socket, re, time, logging
try:
from Queue import Queue
except:
from queue i... | client/python/unrealcv/__init__.py | 13,121 | BaseClient send message out and receiving message in a seperate thread.
After calling the `send` function, only True or False will be returned
to indicate whether the operation was successful.
If you are trying to send a request and get a response, consider using `Client` instead.
This class adds message framing on top... | 4,145 | en | 0.799368 |
from setuptools import setup, find_packages
from codecs import open # To use a consistent encoding
from os import path
import templar
version = templar.__version__
dependencies = [
'jinja2==2.8',
]
setup(
name='templar',
version=version,
description='A static templating engine written in Python',
... | setup.py | 1,131 | To use a consistent encoding | 28 | en | 0.663774 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | sdk/python/pulumi_aws/elasticloadbalancingv2/get_listener.py | 8,599 | A collection of values returned by getListener.
> **Note:** `alb.Listener` is known as `lb.Listener`. The functionality is identical.
Provides information about a Load Balancer Listener.
This data source can prove useful when a module accepts an LB Listener as an input variable and needs to know the LB it is attached... | 2,154 | en | 0.664143 |
# modmerger framework
# by sphere
modmerger_version = 201
# Note: the following is from Warband 1.127 module system.
from modmerger_options import *
# list of current module components
# not in use atm
mod_components = [
"animations",
"constants",
"dialogs",
"factions",
"game_m... | src/modmerger_header.py | 5,886 | modmerger framework by sphere Note: the following is from Warband 1.127 module system. list of current module components not in use atm these are components that do not need to be branded These are the components requiring full import of symbols. Currently only "constants" these are components which passes in variable... | 703 | en | 0.887087 |
#!/usr/bin/env python3
import json
import argparse
import datetime
class TicketManager:
ticketfile = '/Users/ben/ticketing/tickets.json'
def __init__(self: object, ticketfile: str='/Users/ben/Google Drive/code/ticketing/tickets.json')->object:
self.ticketfille = ticketfile
self.read_tickets(... | worktickets.py | 3,242 | !/usr/bin/env python3 | 21 | fr | 0.448822 |
import torch
from torch import nn, Tensor
from typing import Union, Tuple, List, Iterable, Dict
from ..SentenceTransformer import SentenceTransformer
import logging
class TripleSoftmaxLoss(nn.Module):
def __init__(self,
model: SentenceTransformer,
sentence_embedding_dimension: int... | sentence_transformers/losses/TripleSoftmaxLoss.py | 2,702 | todo: MMI가 들어가면 좋긴하겠다. | 22 | ko | 0.958513 |
import socket
import random
import os
import requests
import re
import github
import minecraft
import string
import sys
HOST = "irc.libera.chat"
PORT = 6667
NICK = "DoveBot"
#PASSWORD = os.getenv("PASSWORD")
CHANNEL = "#dovegaming"
SERVER = ""
readbuffer = ""
def send(message):
s.send(message)
print(message)
s ... | runtime/bots/irc/main.py | 3,940 | PASSWORD = os.getenv("PASSWORD")s.send(bytes("PRIVMSG NickServ regain {} {}\r\n".format(NICK, PASSWORD), "UTF-8"))s.send(bytes("PRIVMSG NickServ identify {} {}\r\n".format(NICK, PASSWORD), "UTF-8"))s.send(bytes("PRIVMSG NickServ :identify {}\r\n".format(PASSWORD), "UTF-8"))if msg.startswith("$google "): send("PRIVMSG {... | 866 | en | 0.325257 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from . import _utilities... | sdk/python/pulumi_aws/get_ami_ids.py | 6,381 | A collection of values returned by getAmiIds.
Use this data source to get a list of AMI IDs matching the specified criteria.
## Example Usage
```python
import pulumi
import pulumi_aws as aws
ubuntu = aws.ec2.get_ami_ids(filters=[aws.ec2.GetAmiIdsFilterArgs(
name="name",
values=["ubuntu/images/ubuntu-... | 1,739 | en | 0.750143 |
# header files
import torch
import torch.nn as nn
import torchvision
import numpy as np
# define network (remember input size: (224 x 224 x 3))
class DenseNet_121(torch.nn.Module):
# define dense block
def dense_block(self, input_channels):
return torch.nn.Sequential(
torch.nn.Conv2d(... | models/densenet121.py | 9,997 | header files define network (remember input size: (224 x 224 x 3)) define dense block init function dense block 1 (56 x 56 x 64) transition block 1 dense block 2 (28 x 28 x 128) transition block 2 dense block 3 (14 x 14 x 240) transition block 3 dense block 4 (7 x 7 x 512) dense block 1 transition block 1 dense block 2... | 386 | en | 0.501133 |
"""Illustrates a method to intercept changes on objects, turning
an UPDATE statement on a single row into an INSERT statement, so that a new
row is inserted with the new data, keeping the old row intact.
This example adds a numerical version_id to the Versioned class as well
as the ability to see which row is the most... | examples/versioned_rows/versioned_rows_w_versionid.py | 4,659 | Illustrates a method to intercept changes on objects, turning
an UPDATE statement on a single row into an INSERT statement, so that a new
row is inserted with the new data, keeping the old row intact.
This example adds a numerical version_id to the Versioned class as well
as the ability to see which row is the most "c... | 906 | en | 0.798394 |
import numpy as np
from testbed.cluster_env import LraClusterEnv
from testbed.PolicyGradient_CPO import PolicyGradient
params = {
# 'path': "Dynamic_large_100",
# 'path': "Dynamic_large_100_limit10",
# 'number of containers': 81,
'learning rate': 0.015,
'nodes per group': 3,
... | testbed/SubScheduler.py | 11,316 | parameters set
'path': "Dynamic_large_100", 'path': "Dynamic_large_100_limit10", 'number of containers': 81, TODO: we could add more constraints here >8 bad node index_this_replace = good_index[np.random.randint(length)] self.NUM_CONTAINERS = params['number of containers'] self.sim = Simulator() self.number_of_node_g... | 1,290 | en | 0.430063 |
# Advent of Code 2021 - Day: 24
# Imports (Always imports data based on the folder and file name)
from aocd import data, submit
def solve(lines):
# We need to simply find all the pairs of numbers, i.e. the numbers on lines 6 and 16 and store them.
pairs = [(int(lines[i * 18 + 5][6:]), int(lines[i * 18 + 15][6:])) fo... | Solutions/2021/24.py | 1,514 | Advent of Code 2021 - Day: 24 Imports (Always imports data based on the folder and file name) We need to simply find all the pairs of numbers, i.e. the numbers on lines 6 and 16 and store them. Once getting the pairs we will need a stack and a map to store the pairs, as well constraints. Enumerate helps because we can ... | 700 | en | 0.916896 |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | test/python/transpiler/test_mappers.py | 10,583 | Utilities for meta testing.
Subclasses should redefine the ``pass_class`` argument, with a Swap Mapper
class.
Note: This class assumes that the subclass is also inheriting from
``QiskitTestCase``, and it uses ``QiskitTestCase`` methods directly.
Tests that are run in several mappers.
The tests here will be run in se... | 5,675 | en | 0.645541 |
from ..utils.core import concatenate
class StreamList(list):
"""Class to replace a basic list for streamed products
"""
def __init__(self, product):
if isinstance(product, list):
super(StreamList, self).__init__(product)
else:
super(StreamList, self).__init__([prod... | geeksw/framework/stream.py | 679 | Class to replace a basic list for streamed products | 51 | en | 0.834552 |
"""
Django settings for django_i18n_example project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
... | django_i18n_example/settings.py | 3,560 | Django settings for django_i18n_example project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
Build p... | 1,051 | en | 0.695444 |
#!/usr/bin/python
# coding:utf-8
'''
Created on 2017-04-06
Update on 2017-11-17
Author: Peter/ApacheCN-xy/片刻
GitHub: https://github.com/apachecn/MachineLearning
'''
import sys
from numpy import mat, mean, power
'''
这个mapper文件按行读取所有的输入并创建一组对应的浮点数,然后得到数组的长度并创建NumPy矩阵。
再对所有的值进行平方,最后将均值和平方后的均值发送出去。这些值将用来计算全局的均值... | ML-in-Action/MachineLearning-dev/src/py3.x/ML/15.BigData_MapReduce/mrMeanMapper.py | 1,737 | Created on 2017-04-06
Update on 2017-11-17
Author: Peter/ApacheCN-xy/片刻
GitHub: https://github.com/apachecn/MachineLearning
!/usr/bin/python coding:utf-8 返回一个 yield 迭代器,每次获取下一个值,节约内存。 创建一个输入的数据行的列表list 将得到的数据转化为 float 类型 获取数据的个数,即输入文件的数据的行数 将 List 转换为矩阵 将矩阵的数据分别求 平方,即 2次方 输出 数据的个数,n个数据的均值,n个数据平方之后的均值 第一行是标准输出,也就是redu... | 443 | zh | 0.954378 |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 4 17:07:18 2016
@author: sshank
"""
# Print out the required annotations at the moment... change to put into MySQL
from Bio.Seq import Seq
from Bio import AlignIO
from Bio.SeqRecord import SeqRecord
from argparse import ArgumentParser
parser = ArgumentParser()
rst_he... | create_pdb_annotations.py | 2,903 | Created on Tue Oct 4 17:07:18 2016
@author: sshank
-*- coding: utf-8 -*- Print out the required annotations at the moment... change to put into MySQL No change or missing information Synonymous change Nonsynonymous change There is a chance that something happened... append and increment both | 296 | en | 0.8674 |
# Copyright 2012-2021 The Meson development team
# 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... | mesonbuild/interpreter/interpreter.py | 152,734 | Checks for additional invalid values in a custom_target output.
This cannot be done with typed_kwargs because it requires the number of
inputs.
Adds one additional mapping to the `holder_map`.
The intended use for this function is in the `initialize` method of
modules to register custom object holders.
Build a mappin... | 9,602 | en | 0.874736 |
# -*- coding: utf-8 -*-
"""
.. _training-example:
Train Your Own Neural Network Potential
=======================================
This example shows how to use TorchANI to train a neural network potential
with the setup identical to NeuroChem. We will use the same configuration as
specified in `inputtrain.ipt`_
.. _... | examples/nnp_training.py | 13,227 | .. _training-example:
Train Your Own Neural Network Potential
=======================================
This example shows how to use TorchANI to train a neural network potential
with the setup identical to NeuroChem. We will use the same configuration as
specified in `inputtrain.ipt`_
.. _`inputtrain.ipt`:
https:... | 4,336 | en | 0.843918 |
""" A QuoteController Module """
from masonite.controllers import Controller
from masonite.request import Request
from app.Quote import Quote
class QuoteController(Controller):
def __init__(self, request: Request):
self.request = request
def show(self):
id = self.request.param("id")
r... | app/http/controllers/QuoteController.py | 910 | A QuoteController Module | 24 | en | 0.083958 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from .chromatic import *
| enterprise_extensions/chromatic/__init__.py | 159 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
"""
Component to interface with various locks that can be controlled remotely.
For more details about this component, please refer to the documentation
at https://home-assistant.io/components/lock/
"""
import asyncio
from datetime import timedelta
import functools as ft
import logging
import os
import voluptuous as v... | homeassistant/components/lock/__init__.py | 5,326 | Representation of a lock.
Handle calls to the lock services.
Lock the lock.
This method must be run in the event loop and returns a coroutine.
Track states and offer events for locks.
Unlock the lock.
This method must be run in the event loop and returns a coroutine.
Last change triggered by.
Regex for code format or... | 809 | en | 0.870836 |
"""
Created on Sun Feb 2 13:28:48 2020
@author: matias
"""
import numpy as np
from numpy.linalg import inv
from matplotlib import pyplot as plt
import time
import camb
from scipy.integrate import cumtrapz as cumtrapz
from scipy.integrate import simps as simps
from scipy.interpolate import interp1d
from scipy.constant... | Software/Funcionales/funciones_LambdaCDM_AGN.py | 2,971 | Created on Sun Feb 2 13:28:48 2020
@author: matias
metros/segundos%%metros/segundos%%Data AGNparams_to_chi2_AGN_nuisance(theta, _, data_agn)/(len(z_data)-4)El cuadrado de los erroressi_2 = eFx**2 + (gamma * eFuv)**2 + delta**2 El cuadrado de los errores menos en el paper | 274 | es | 0.432128 |
# mypy: allow-untyped-defs
import subprocess
from functools import partial
from typing import Callable
from mozlog import get_default_logger
from wptserve.utils import isomorphic_decode
logger = None
def vcs(bin_name: str) -> Callable[..., None]:
def inner(command, *args, **kwargs):
global logger
... | tools/wptrunner/wptrunner/vcs.py | 1,954 | mypy: allow-untyped-defs Make sure `cwd` is str type to work in different sub-versions of Python 3. Before 3.8, bytes were not accepted on Windows for `cwd`. | 157 | en | 0.947139 |
import socket
import struct
import os
PACKET_SIZE = 1024
TIME_OUT = 5
SUCCESS = b'File Has Been Transferred'
def getPayload(fileName):
try:
with open(file=fileName, mode="r+b") as readFile:
payload = readFile.read()
if len(payload) == 0:
print("That is a blank file... | Labs/Lab_4/Lab_4/client.py | 2,614 | fileName = "test.txt" serverIP = "127.0.0.1" serverPort = 5005 | 62 | en | 0.701525 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: david@reciprocitylabs.com
# Maintained By: david@reciprocitylabs.com
import re
from sqlalchemy.orm import validates
from ggrc import db
from ggrc ... | src/ggrc/models/person.py | 4,962 | For choosing the role string to show to the user; of all the roles in
the system-wide context, it shows the highest ranked one (if there are
multiple) or "No Access" if there are none.
Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file> Licensed under http://www.apache.org/licenses/LICENSE-2.... | 855 | en | 0.831161 |
# 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... | Plugins/UnrealEnginePython/Binaries/Win64/Lib/site-packages/tensorflow/contrib/boosted_trees/python/training/functions/gbdt_batch.py | 55,581 | A GBDT model function.
Returns the next ps task index for placement via per-Op round-robin order.
This strategy works slightly better for the GBDT graph because of using
custom resources which vary significantly in compute cost.
Choose a ps task index for the given `Operation`.
Args:
op: An `Operation` to be placed... | 11,309 | en | 0.788245 |
# coding: utf-8
import pprint
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
class UpdateIndirectPartnerAccountResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
att... | huaweicloud-sdk-bss/huaweicloudsdkbss/v2/model/update_indirect_partner_account_response.py | 3,109 | Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
Returns true if both objects are equal
UpdateIndirectPartnerAccountResponse - a model ... | 868 | en | 0.504552 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Northwestern University.
#
# invenio-subjects-mesh is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Version information for invenio-subjects-mesh.
This file is imported by ``invenio_s... | invenio_subjects_mesh/version.py | 404 | Version information for invenio-subjects-mesh.
This file is imported by ``invenio_subjects_mesh.__init__``,
and parsed by ``setup.py``.
-*- coding: utf-8 -*- Copyright (C) 2021 Northwestern University. invenio-subjects-mesh is free software; you can redistribute it and/or modify it under the terms of the MIT License... | 356 | en | 0.771087 |
# ---------------------------------------------------------------------
# Segment handlers
# ---------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------
# Python modules... | fm/handlers/alarm/segment.py | 1,865 | Reset lost_redundancy from segment when all redundant objects
are up
:param alarm:
:return:
Set lost_redundancy to segment when redundant object is down
:param alarm:
:return:
--------------------------------------------------------------------- Segment handlers -------------------------------------------------------... | 525 | en | 0.452214 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Spectrogram decomposition
=========================
.. autosummary::
:toctree: generated/
decompose
hpss
nn_filter
"""
import numpy as np
import scipy.sparse
from scipy.ndimage import median_filter
import sklearn.decomposition
from . import core
fro... | librosa/decompose.py | 18,417 | Nearest-neighbor filter helper function.
This is an internal function, not for use outside of the decompose module.
It applies the nearest-neighbor filter to S, assuming that the first index
corresponds to observations.
Parameters
----------
R_data, R_indices, R_ptr : np.ndarrays
The `data`, `indices`, and `indp... | 13,373 | en | 0.527832 |
# This Python file uses the following encoding: utf-8
"""autogenerated by genpy from gazebo_msgs/SetJointTrajectoryRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import trajectory_msgs.msg
import geometry_msgs.msg
import genpy
import std_msgs... | files/catkin_ws/devel/lib/python2.7/dist-packages/gazebo_msgs/srv/_SetJointTrajectory.py | 22,580 | Constructor. Any message fields that are implicitly/explicitly
set to None will be assigned a default value. The recommend
use is keyword arguments as this is more robust to future message
changes. You cannot mix in-order arguments and keyword arguments.
The available fields are:
model_name,joint_trajectory,model_... | 2,502 | en | 0.563727 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
__author__ = 'Tim Schneider <tim.schneider@northbridge-development.de>'
__copyright__ = "Copyright 2015, Northbridge Development Konrad & Schneider GbR"
__credits__ = ["Tim Schneider", ]
__maintainer__ = "Tim Schneider"
__email__ = "mail@northbridge-developm... | django_splitdate/tests/runtests.py | 2,603 | !/usr/bin/env python -*- coding: utf-8 -*- Import coverage if available Unfortunately, apps can not be installed via ``modify_settings`` decorator, because it would miss the database setup. Use a fast hasher to speed up tests. Current module (``tests``) and its submodules. Allow accessing test options from the command ... | 405 | en | 0.679608 |
#-------------------------------------------------------------------------------
#
# Base class for all door sensors
#
import iofun
import message
from device import Device
from querier import Querier
from querier import MsgHandler
from dbbuilder import GenericDBBuilder
from linkdb import LightDBRecordFormatter
from us... | python/hiddendoorsensor.py | 10,625 | ------------------------------------------------------------------------------- Base class for all door sensors class StatusMsgHandler(MsgHandler): label = None def __init__(self, l): self.label = l def processMsg(self, msg): if (msg.getByte("command2") == 0xFF): iofun.out("... | 701 | en | 0.294696 |
# Copyright (c) 2020. Yul HR Kang. hk2699 at caa dot columbia dot edu.
import torch
import matplotlib.pyplot as plt
from lib.pylabyk import numpytorch as npt
from lib.pylabyk.numpytorch import npy, npys
def print_demo(p, fun):
out = fun(p)
print('-----')
print('fun: %s' % fun.__name__)
print('p:')... | demo/demo_min_max_distrib.py | 1,205 | Copyright (c) 2020. Yul HR Kang. hk2699 at caa dot columbia dot edu. | 68 | en | 0.325436 |
def onehot_encode_seq(sequence, m=0, padding=False):
"""Converts a given IUPAC DNA sequence to a one-hot
encoded DNA sequence.
"""
import numpy as np
import torch
valid_keys = ['a','c','g','t','u','n','r','y','s','w','k','m']
nucs = {'a':0,'c':1,'g':2,'t':3,'u':3}
if pad... | bin/scover_utils.py | 4,864 | Aligns the convolutional filters of a given scover model back
to the given input sequences at the given indices.
Converts a given IUPAC DNA sequence to a one-hot
encoded DNA sequence.
Randomly permutes a set of DNA sequences.
Saves the found PPMs (given as dictionary) to a file that's
compatible with MEME suite... | 890 | en | 0.864923 |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | src/wi/utils/__init__.py | 2,483 | Checks status of response response and throws appropriate error.
Returns dictionary with key: @prm{key} equal to @prm{key_value} from a
list of dictionaries: @prm{list_of_dicts}.
Returns list of dictionaries with keys: @prm{key} equal to one from list
@prm{list_of_key_values} from a list of dictionaries: @prm{list_of_d... | 1,050 | en | 0.731386 |
# -*- coding: utf-8 -*-
# Copyright 2010-2020, 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... | src/build_tools/change_reference_mac.py | 4,145 | Parse command line options.
Change the reference to frameworks.
Typical usage:
% change_reference_mac.py --qtdir=/path/to/qtdir/ \
--target=/path/to/target.app/Contents/MacOS/target
-*- coding: utf-8 -*- Copyright 2010-2020, Google Inc. All rights reserved. Redistribution and use in source and binary forms,... | 2,258 | en | 0.829457 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: users.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf... | include/users_pb2.py | 29,770 | Generated protocol buffer code.
-*- coding: utf-8 -*- Generated by the protocol buffer compiler. DO NOT EDIT! source: users.proto @@protoc_insertion_point(imports) @@protoc_insertion_point(class_scope:tinkoff.public.invest.api.contract.v1.GetAccountsRequest) @@protoc_insertion_point(class_scope:tinkoff.public.invest... | 1,240 | en | 0.337214 |
from loris.compliance.format import FormatCompliance
from loris.compliance.helpers import ComparableMixin
from loris.compliance.helpers import st
from loris.compliance.http import HttpCompliance
from loris.compliance.quality import QualityCompliance
from loris.compliance.region import RegionCompliance
from loris.compli... | loris/compliance/__init__.py | 3,340 | make it possible to do int(self), and do comparisons Note that formats and qualities aren't 'features' and are always listed explicitly in the profile (other that jpg and default) Features supported above the calculated compliance level, i.e. the difference between all enabled features and the calculated compliance lev... | 364 | en | 0.918309 |
from typing import IO, Dict, Optional, Set
from rdflib.plugins.serializers.xmlwriter import XMLWriter
from rdflib.namespace import Namespace, RDF, RDFS # , split_uri
from rdflib.plugins.parsers.RDFVOC import RDFVOC
from rdflib.graph import Graph
from rdflib.term import Identifier, URIRef, Literal, BNode
from rdflib.... | rdflib/plugins/serializers/rdfxml.py | 12,931 | strip off _: from nodeIDs... as they are not valid NCNames
, split_uri if base is given here, use that, if not and a base is set for the graph use that startDocument startRDF If provided, write xml:base attribute for the RDF TODO: assert( namespaces["http://www.w3.org/1999/02/22-rdf-syntax-ns"]=='rdf') write out t... | 1,395 | en | 0.849283 |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import os
from os.path import abspath, dirname
from restclients_core.dao import DAO
class Sdbmyuw_DAO(DAO):
def service_name(self):
return 'sdbmyuw'
def service_mock_paths(self):
return [abspath(os.path.jo... | uw_sdbmyuw/dao.py | 357 | Copyright 2021 UW-IT, University of Washington SPDX-License-Identifier: Apache-2.0 | 82 | en | 0.31374 |
import pandas as pd
import read_mta_turnstile as t
# This function generally generates a schedule for all stations in the df_top.csv file in a pivot table format.
def find_schedule():
# Read the stations with highest Toucan scores and select columns relavant
# to our schedule algorithm
top_stations = pd.re... | 1-Benson_Project/find_schedule.py | 3,218 | This function generally generates a schedule for all stations in the df_top.csv file in a pivot table format. Read the stations with highest Toucan scores and select columns relavant to our schedule algorithm Read the turnstile data and select the columns relavant to schedule algorithm Merge the two DataFrames to have ... | 1,136 | en | 0.921402 |
import _continuation
import threading
__all__ = ['Fiber', 'error', 'current']
_tls = threading.local()
def current():
try:
return _tls.current_fiber
except AttributeError:
fiber = _tls.current_fiber = _tls.main_fiber = _create_main_fiber()
return fiber
class error(Exception):
... | fibers/_pyfibers.py | 3,459 | Fiber was not started yet, propagate to parent directly | 55 | en | 0.989674 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from cmsplugin_cascade.extra_fields.config import PluginExtraFieldsConfig
CASCADE_PLUGINS = getattr(settings, 'SHOP_CASCADE_PLUGINS',
('auth', 'breadcrumb', 'catalog', 'cart', 'checkout', 'extensions', 'order', 'proc... | shop/cascade/settings.py | 1,004 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
import sklearn.neighbors
from numpy import linalg as LA
from apexpy import Apex
import numpy as np
#Create an Apex conversion instance at the usual reference altitude
#no epoch is specified; we will set the epoch just-in-time when we are going to
#do an coordinate transformation
apex_reference_height = 110000. # Apex ... | LBH_to_eflux/helper_funcs.py | 8,218 | generic function to spatially interpolate with the SSJ data using nearest neighbors using some arbirtary distance tolerance
generic function to spatially interpolate with the SSJ data using nearest neighbors using some arbirtary distance tolerance
generic function to spatially interpolate with the SSJ data using neares... | 2,404 | en | 0.786136 |
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | python/src/cm_api/endpoints/host_templates.py | 5,832 | Apply a host template identified by name on the specified hosts and
optionally start them.
@param resource_root: The root Resource object.
@param name: Host template name.
@param cluster_name: Cluster name.
@param host_ids: List of host ids.
@param start_roles: Whether to start the created roles or not.
@return: An Api... | 2,707 | en | 0.653634 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/aio/operations/_network_interfaces_operations.py | 63,787 | NetworkInterfacesOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.network.v2018_07_01.mode... | 7,151 | en | 0.420845 |
# -*- coding: utf-8 -*-
# @Time : 2021/5/8 7:14
# @Author : 咸鱼型233
# @File : v1.1_py3_adjust.py
# @Software: PyCharm
# @Function: v1.0的py3适应性调整
# 修改记录 : 2021.5.8-20:34-改崩了,下一版用urllib3实现
import base64
import json
import urllib
import requests
import urllib3
from config import APPCODE, path_image
# 获取图片二进制数据的ba... | DailyLife/picOCR_toExcel/old_version/v1.1_py3_adjust.py | 2,654 | -*- coding: utf-8 -*- @Time : 2021/5/8 7:14 @Author : 咸鱼型233 @File : v1.1_py3_adjust.py @Software: PyCharm @Function: v1.0的py3适应性调整 修改记录 : 2021.5.8-20:34-改崩了,下一版用urllib3实现 获取图片二进制数据的base64编码(API请求参数需要) --- 构造请求参数(Body) param = json.dumps(param) 根据阿里云表格文字识别API的APPCODE构造Headers request = requests.post(url=url, hea... | 496 | zh | 0.275548 |
import cupy as np
def supersample(clip, d, n_frames):
"""Replaces each frame at time t by the mean of `n_frames` equally spaced frames
taken in the interval [t-d, t+d]. This results in motion blur.
"""
def filter(get_frame, t):
timings = np.linspace(t - d, t + d, n_frames)
frame_avera... | moviepy/video/fx/supersample.py | 510 | Replaces each frame at time t by the mean of `n_frames` equally spaced frames
taken in the interval [t-d, t+d]. This results in motion blur. | 140 | en | 0.816026 |
"""scrapli_cfg.platform.core.cisco_iosxe.sync_platform"""
from typing import Any, Callable, List, Optional
from scrapli.driver import NetworkDriver
from scrapli.response import MultiResponse, Response
from scrapli_cfg.diff import ScrapliCfgDiffResponse
from scrapli_cfg.exceptions import DiffConfigError, FailedToDeterm... | scrapli_cfg/platform/core/cisco_iosxe/sync_platform.py | 13,089 | Commit the configuration in merge mode
Args:
file_prompt_mode: optionally provide the file prompt mode, if its None we will fetch it
to decide if we need to use interactive mode or not
Returns:
Response: scrapli response object
Raises:
N/A
Delete candidate config from the filesystem
Args:
... | 2,256 | en | 0.779101 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | samples/generated_samples/vmmigration_v1_generated_vm_migration_get_datacenter_connector_sync.py | 1,515 | -*- coding: utf-8 -*- Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writin... | 1,129 | en | 0.813116 |
# 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 the... | umn/source/conf.py | 5,166 | 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 the License is dist... | 4,222 | en | 0.758736 |
import os
import json
import zipfile
import tempfile
from pathlib import Path
from copy import deepcopy
from .exception import FrictionlessException
from .metadata import Metadata
from .detector import Detector
from .resource import Resource
from .system import system
from . import helpers
from . import errors
from . i... | frictionless/package.py | 21,136 | Package representation
API | Usage
-------- | --------
Public | `from frictionless import Package`
This class is one of the cornerstones of of Frictionless framework.
It manages underlaying resource and provides an ability to describe a package.
```python
package = Package(resources=[Resource(path="data/table... | 7,033 | en | 0.694507 |
#
# PySNMP MIB module INT-SERV-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INT-SERV-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:18:45 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | pysnmp-with-texts/INT-SERV-MIB.py | 25,716 | PySNMP MIB module INT-SERV-MIB (http://snmplabs.com/pysmi) ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/INT-SERV-MIB Produced by pysmi-0.3.4 at Wed May 1 12:18:45 2019 On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) | 318 | en | 0.340998 |
# Licensed to Elasticsearch B.V. under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch B.V. licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use ... | elasticsearch_dsl/search.py | 25,381 | Combine multiple :class:`~elasticsearch_dsl.Search` objects into a single
request.
Simple descriptor to enable setting of queries and filters as:
s = Search()
s.query = Q(...)
Simple proxy around DSL objects (queries) that can be called
(to add query/post_filter) and also allows attribute access which is proxi... | 8,326 | en | 0.706335 |
"""Test the code generating time series with the order totals.
Unless otherwise noted, each `time_step` is 60 minutes long implying
12 time steps per day (i.e., we use `LONG_TIME_STEP` by default).
"""
import datetime
import pandas as pd
import pytest
from tests import config as test_config
from urban_meal_delivery... | tests/forecasts/timify/test_make_time_series.py | 14,257 | Test the `OrderHistory.make_horizontal_ts()` method.
Test the `OrderHistory.make_realtime_ts()` method.
Test the `OrderHistory.make_vertical_ts()` method.
A `predict_at` within `START`-`END` but ...
... not a long enough history so that both `SHORT_TRAIN_HORIZON`
and `LONG_TRAIN_HORIZON` do not work.
A `predict_at` wi... | 3,019 | en | 0.870829 |
"""
This file is part of the FJournal Project.
Copyright © 2019-2020, Daniele Penazzo. All Rights Reserved.
The use of this code is governed by the MIT license attached.
See the LICENSE file for the full license.
Created on: 2020-07-10
Author: Penaz
"""
from tkinter import ttk
import tkinter as tk
from models import ... | gui/addmealpopup.py | 1,448 | Defines a popup for adding meals
Constructor of the class
Opens the Add Meal popup
Creates the widgets for the popup
This file is part of the FJournal Project.
Copyright © 2019-2020, Daniele Penazzo. All Rights Reserved.
The use of this code is governed by the MIT license attached.
See the LICENSE file for the full lic... | 364 | en | 0.88297 |
# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
#
# SPDX-License-Identifier: MIT
#
# Adafruit PCF8523 RTC Library documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 11 21:37:36 2016.
#
# This file is execfile()d with the current directory set to its
... | docs/conf.py | 11,218 | -*- coding: utf-8 -*- SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries SPDX-License-Identifier: MIT Adafruit PCF8523 RTC Library documentation build configuration file, created by sphinx-quickstart on Fri Nov 11 21:37:36 2016. This file is execfile()d with the current directory set to its containing dir. No... | 8,841 | en | 0.662884 |
import unittest
import numpy
import pytest
import cupy
import cupy.core._accelerator as _acc
from cupy.core import _cub_reduction
from cupy import testing
@testing.gpu
class TestSearch(unittest.TestCase):
@testing.for_all_dtypes(no_complex=True)
@testing.numpy_cupy_allclose()
def test_argmax_all(self, ... | tests/cupy_tests/sorting_tests/test_search.py | 25,947 | This class compares CUB results against NumPy's TODO(leofang): test axis after support is added xp is cupy, first ensure we really use CUB Cython checks return type, need to fool it this is the only function we can mock; the rest is cdef'd one pass two passes ...then perform the actual computation xp is cupy, first ens... | 688 | en | 0.878948 |
import mock
import json
from collections import OrderedDict
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from apps.common.tests import GetResponseMixin
from apps.issue.models import Issue, IssueStatus, IssueE... | apps/issue/testcases/integration/tests.py | 61,964 | set app_owner_user as owner of app 6 remove duplication appId 1 appId 2 no priority field check result in backend from weiXin: with reportSource and score field and reportSource field equal '四大区运营' from weiXin: with reportSource field and no score filed and reportSource field equal '四大区运营' update 1 issue filter with sa... | 618 | en | 0.717407 |
# encoding = utf-8
"""
//
// AzureMonitorAddonForSplunk
//
// Copyright (c) Microsoft Corporation
//
// All rights reserved.
//
// MIT License
//
// 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 S... | bin/azure_monitor_metrics_main.py | 11,055 | unencrypted password in inputs.conf, encrypt it and store as storagePassword
get the encrypted app_id and app_key from storage_passwords
top level function
given subscription id and credentials, get metrics for all resources with the right tags
splunk sends an array of inputs, but only one element, hence the [0]
Either... | 2,027 | en | 0.730768 |
# Copyright 2019, OpenCensus 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 applicable law or agreed to in w... | contrib/opencensus-ext-datadog/setup.py | 2,047 | Copyright 2019, OpenCensus 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 applicable law or agreed to in writing, software d... | 572 | en | 0.857359 |
from itertools import tee
import numpy as np
import scipy.interpolate as intp
from scipy.signal import savgol_filter
def get_edge_bin(array):
"""Detect the edge indcies of a binary 1-D array.
Args:
array (:class:`numpy.ndarray`): A list or Numpy 1d array, with binary
(0/1) or boolean (True... | gamse/utils/onedarray.py | 8,513 | Get the first derivative of data arrays (*x*, *y*).
If **y** is not given, the first argument will be taken as **y**, and the
differential of the input array will be returned.
Args:
x (list or :class:`numpy.ndarray`): X-values of the input array (optional).
y (list or :class:`numpy.ndarray`): Y-values of the ... | 3,600 | en | 0.607269 |
#!/usr/bin/env python
import argparse
import bs4
import os
import re
# better indentation hack via https://stackoverflow.com/a/15513483/127114
orig_prettify = bs4.BeautifulSoup.prettify
r = re.compile(r'^(\s*)', re.MULTILINE)
def prettify(self, encoding=None, formatter="minimal", indent_width=3):
return r.sub(r'\... | scripts/deindexify.py | 2,583 | Walks directory stucutre starting at `webroot` and rewrites all folder links.
Rewrite links in `filepath` as follows: /some/path/index.html --> /some/path/
!/usr/bin/env python better indentation hack via https://stackoverflow.com/a/15513483/127114 print('processing', filepath) 1. read 2. rewrite links 3. hack to rewr... | 489 | en | 0.737923 |
"""
Based on REST Framework Parsers, optimized for csv
Parsers are used to parse the content of incoming HTTP requests.
They give us a generic way of being able to handle various media types
on the request, such as form content or json encoded data.
"""
import codecs
from urllib import parse
from django.conf import ... | mparser.py | 6,183 | All parsers should extend `BaseParser`, specifying a `media_type`
attribute, and overriding the `.parse()` method.
Parser for file upload data.
Handle encoded filenames per RFC6266. See also:
https://tools.ietf.org/html/rfc2231#section-4
Detects the uploaded file name. First searches a 'filename' url kwarg.
Then tries ... | 1,161 | en | 0.768776 |
class CurveByPoints(CurveElement,IDisposable):
""" A curve interpolating two or more points. """
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def getBoundingBox(self,*args):
""" getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """
pass
def GetPoints(self):
"""
Get... | release/stubs.min/Autodesk/Revit/DB/__init___parts/CurveByPoints.py | 3,530 | A curve interpolating two or more points.
Dispose(self: Element,A_0: bool)
GetPoints(self: CurveByPoints) -> ReferencePointArray
Get the sequence of points interpolated by this curve.
GetVisibility(self: CurveByPoints) -> FamilyElementVisibility
Gets the visibility.
Returns: A copy of visibility settings fo... | 1,506 | en | 0.671075 |
# -*- coding: UTF-8 -*-
"""Define transaction calendar"""
import calendar
import datetime
from collections import defaultdict
from utils import Exchange
class TransPeriod(object):
"""
The period of exchange transaction time, e.g. start_time, end_time of a day.
"""
def __init__(self, start_time, end_ti... | receivers/Calender.py | 2,863 | The Exchange Transaction Calendar.
Constructor parameters:
day_periods: list of instance of Period,start_time, end_time
first_week_day: the first day of a week, e.g. calendar.SUNDAY
The period of exchange transaction time, e.g. start_time, end_time of a day.
Define transaction calendar
-*- coding: UTF-8 -*- | 310 | en | 0.725078 |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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 appl... | tensorflow_datasets/image_classification/imagenet2012_real.py | 5,698 | ImageNet validation images with ReaL labels.
Returns labels for validation.
Args:
val_path: path to TAR file containing validation images. It is used to
retrieve the name of pictures and associate them to labels.
Returns:
dict, mapping from image name (str) to label (str).
Imagenet val. annotated by ReaL labels... | 1,043 | en | 0.820072 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Nicira, 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
#
#... | quantum/tests/unit/openvswitch/test_ovs_lib.py | 14,175 | A test suite to excercise the OVS libraries shared by Quantum agents.
Note: these tests do not actually execute ovs-* utilities, and thus
can run on any system. That does, however, limit their scope.
create and stringify vif port, confirm no exceptions
vim: tabstop=4 shiftwidth=4 softtabstop=4 Copyright 2012, Nicira... | 996 | en | 0.836857 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.