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 |
|---|---|---|---|---|---|---|
# Generic CNN classifier that uses a geojson file and gbdx imagery to classify chips
import numpy as np
import os, random
import json, geojson
from mltools import geojson_tools as gt
from mltools.data_extractors import get_data_from_polygon_list as get_chips
from keras.layers.core import Dense, Dropout, Activation, F... | examples/polygon_classify_cnn/pool_net.py | 23,321 | Generic CNN classifier that uses a geojson file and gbdx imagery to classify chipsload model Save architecture Save weights load geojson training polygons Determine size of chips to extract and resize dimension resize chips to match input shape Recompile model with retrain params Set aside validation data extract valid... | 988 | en | 0.80258 |
import six
from smqtk.representation import DescriptorIndex, get_data_element_impls
from smqtk.utils import merge_dict, plugin, SimpleTimer
try:
from six.moves import cPickle as pickle
except ImportError:
import pickle
class MemoryDescriptorIndex (DescriptorIndex):
"""
In-memory descriptor index wit... | python/smqtk/representation/descriptor_index/memory.py | 9,798 | In-memory descriptor index with file caching.
Stored descriptor elements are all held in memory in a uuid-to-element
dictionary (hash table).
If the path to a file cache is provided, it is loaded at construction if it
exists. When elements are added to the index, the in-memory table is dumped
to the cache.
Initialize... | 5,057 | en | 0.672337 |
def conv(T,taille):
# conv (list(list(bool)) * int -> list(list(int)))
# Convertis un tableau à 2 dimensions contenent des booléens en tableau à 2 dimensions contenant des entiers tel que True = 1 et False = 0
# T (list(list(bool))) : tableau à 2 dimensions contenant des booléens
# taille (int) : taille... | conv_tableau_2_dimensions_bool_int.py | 719 | conv (list(list(bool)) * int -> list(list(int))) Convertis un tableau à 2 dimensions contenent des booléens en tableau à 2 dimensions contenant des entiers tel que True = 1 et False = 0 T (list(list(bool))) : tableau à 2 dimensions contenant des booléens taille (int) : taille du tableau à 2 dimensions Initialisation et... | 524 | fr | 0.951247 |
"""Definitions for all core text instructions."""
from pyshgp.push.type_library import PushTypeLibrary
from pyshgp.push.instruction import SimpleInstruction, ProducesManyOfTypeInstruction
from pyshgp.push.types import Char
from pyshgp.utils import Token
def _concat(a, b):
return str(b) + str(a),
def _first_char... | pyshgp/push/instructions/text.py | 14,722 | Return all core text instructions.
Definitions for all core text instructions.
@TODO: Implement exec_string_iterate instruction. Getting Characters Checking string contents Splitting @TODO: srt_split_on_space instruction Replacements Removals Misc @TODO: Instructions for trim_left and trim_right @TODO: Instructions f... | 386 | en | 0.57542 |
#
# 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 us... | sdks/python/setup.py | 8,112 | Apache Beam SDK for Python setup file.
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 (t... | 1,561 | en | 0.827769 |
import os
import requests
# configurations to be adjusted
# 1. put here URL (see textfile)
base_url = "https://data-dataref.ifremer.fr/stereo/AA_2015/2015-03-05_10-35-00_12Hz/input/cam1/"
# 2. decide which (range of) images
start = 0
end = 149
# 3. name folder to save images to, best take from url (change "/" to "_")
... | dataset_preparation/downloading.py | 1,883 | configurations to be adjusted 1. put here URL (see textfile) 2. decide which (range of) images 3. name folder to save images to, best take from url (change "/" to "_") as the datasat is providing stereo, we only need mono, not to be changedcreate a download folder if not yet existing run through all url to download ima... | 947 | en | 0.773175 |
# :coding: utf-8
# :copyright: Copyright (c) 2015 ftrack
import os
import uuid
import tempfile
import pytest
import ftrack_api.cache
@pytest.fixture(params=['proxy', 'layered', 'memory', 'file', 'serialised'])
def cache(request):
'''Return cache.'''
if request.param == 'proxy':
cache = ftrack_api.c... | openpype/modules/ftrack/python2_vendor/ftrack-python-api/test/unit/test_cache.py | 10,847 | Class for testing.
Assert *function* call via *memoiser* was *memoised*.
Return cache.
Cleanup.
Function for testing.
Create a serialised file cache.
Method for testing.
Remove items from cache.
Clear missing key.
Remove items that match pattern from cache.
Test that references are expanded from serialized cache.
Retri... | 2,012 | en | 0.804073 |
import sys
import time
import math
import psutil
import pytest
import threading
from loky import TimeoutError
from loky import get_reusable_executor
from loky.backend import get_context
# Set a large timeout as it should only be reached in case of deadlocks
TIMEOUT = 40
_test_event = None
def initializer_event(ev... | tests/_executor_mixin.py | 8,129 | Helper to fetch cmdline from children process list
Initializer that set a global test event for test synchronization
Make sure the executor can be recovered after the tests
Set a large timeout as it should only be reached in case of deadlocks Under linux is_running() can return True even though the command line data ... | 1,391 | en | 0.946654 |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | app/window.py | 64,104 | An ActiveWindow may have focus and a controller.
This is the main content window.
Often the largest pane displayed.
A text label.
The label is inert, it will pass events to its parent.
A single line with a label.
This is akin to a line prompt or gui modal dialog. It's used for things like
'find' and 'goto line'.
Wor... | 6,463 | en | 0.855413 |
import functools
import typing
from aws_cdk import core
from cdk_resources.utils import (
app_context,
ALLOWED_ENVIRONMENTS,
get_environment,
)
__all__ = ["ResourceStack", "register_stacks"]
class ResourceStack(core.Stack):
""" """
EXISTING_RESOURCES = None
RESOURCES = None
def __ini... | cdk_resources/stacks.py | 2,511 | Update Context Existing resources Own Resources Create Stacks | 61 | en | 0.439315 |
# Generated by Django 3.1.1 on 2020-09-08 18:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('grocery', '0003_auto_202... | ExpenseTracker/grocery/migrations/0004_auto_20200908_1918.py | 838 | Generated by Django 3.1.1 on 2020-09-08 18:18 | 45 | en | 0.69757 |
import re
#
# Модуль 2 из домашнего задания для 4 вебинара.
#
# Пользователь вводит любые цифры через запятую.
# Сохранить цифры в список.
# Получить новый список в котором будут только уникальные элементы исходного.
# Вывести его на экран.
#
s_input = input("Введите элементы списка через разделитель [,:/]: ")
l_... | 2seq.py | 645 | Модуль 2 из домашнего задания для 4 вебинара. Пользователь вводит любые цифры через запятую. Сохранить цифры в список. Получить новый список в котором будут только уникальные элементы исходного. Вывести его на экран. | 220 | ru | 0.998518 |
#!/usr/bin/env python3
# Copyright (c) 2016-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Encode and decode BASE58, P2PKH and P2SH addresses."""
from .script import hash256, hash160, sha256, C... | test/functional/test_framework/address.py | 2,853 | Encode and decode BASE58, P2PKH and P2SH addresses.
!/usr/bin/env python3 Copyright (c) 2016-2018 The Bitcoin Core developers Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. TODO: def base58_decode Assuming this is hex string Assuming... | 339 | en | 0.632721 |
# Copyright (c) 2021 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/micro-ROS/system_modes.
#
# 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 o... | micro_ros_diagnostic_bridge/launch/diagnostic_bridge.launch.py | 1,543 | Copyright (c) 2021 - for information on the respective copyright owner see the NOTICE file and/or the repository https://github.com/micro-ROS/system_modes. 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 Licens... | 677 | en | 0.845681 |
"""
DriverFactory class
Note: Change this class as you add support for:
1. SauceLabs/BrowserStack
2. More browsers like Opera
"""
import dotenv,os,sys,requests,json
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabil... | QA/page_objects/DriverFactory.py | 4,018 | Constructor for the Driver factory
Return the Firefox driver
Return a firefox profile
Return the appropriate driver
Return the local driver
Setup firefox with the right preferences and return a profile
DriverFactory class
Note: Change this class as you add support for:
1. SauceLabs/BrowserStack
2. More browsers like Op... | 350 | en | 0.768656 |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Define a class for creating the jailed context."""
import os
import shutil
from subprocess import run, PIPE
from retry.api import retry_call
from framework.defs import API_USOCKET_NAME, FC_BINARY_NAME,... | tests/framework/jailer.py | 8,191 | Represents jailer configuration and contains jailer helper functions.
Each microvm will have a jailer configuration associated with it.
Cleanup this jailer context.
Set up jailer fields.
This plays the role of a default constructor as it populates
the jailer's fields with some default values. Each field can be
furthe... | 2,489 | en | 0.879739 |
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
import traceback
from myuw.dao.calendar import api_request
from myuw.views.api import ProtectedAPI
from myuw.views.error import handle_exception
from myuw.views import prefetch_resources
from myuw.logger.timer import ... | myuw/views/api/calendar.py | 933 | Copyright 2022 UW-IT, University of Washington SPDX-License-Identifier: Apache-2.0 | 82 | en | 0.305151 |
from django import forms
from django.forms import ModelForm
from .models import Review
class ReviewForm(ModelForm):
required_css_class = 'required'
def __init__(self, *args, **kwargs):
"""
user object is passed to the form in kwargs in the view
the user objected is removed from kwarg... | reviews/forms.py | 1,166 | user object is passed to the form in kwargs in the view
the user objected is removed from kwargs and then the
super class form object is instantiated. This is because
our form needs the user object not its super class.
This method checks if a user has already reviewed
the selected book. As per django docs exists() is
a... | 353 | en | 0.963058 |
import warnings
warnings.simplefilter("ignore", category=FutureWarning)
from pmaf.biome.essentials._metakit import EssentialFeatureMetabase
from pmaf.biome.essentials._base import EssentialBackboneBase
from pmaf.internal._constants import (
AVAIL_TAXONOMY_NOTATIONS,
jRegexGG,
jRegexQIIME,
BIOM_TAXONOMY... | pmaf/biome/essentials/_taxonomy.py | 30,666 | An `essential` class for handling taxonomy data.
Fix invalid taxon names.
Constructor for :class:`.RepTaxonomy`
Parameters
----------
taxonomy
Data containing feature taxonomy
taxonomy_columns
Column(s) containing taxonomy data
kwargs
Passed to :func:`~pandas.read_csv` or :mod:`biome` loader.
Main method ... | 5,444 | en | 0.493231 |
import pickle
import numpy as np
# pickle_file = 'experiment_pickle_12_0.15_5_0.075.p'
pickle_file = 'experiment_pickle_12_0.1_5_0.075.p'
content = pickle.load(open(pickle_file))
familys = content.keys()
for family in familys:
collected = []
measurements = content[family]
for measurement in measurements... | src/RQ4_exp/run_pickle.py | 503 | pickle_file = 'experiment_pickle_12_0.15_5_0.075.p' | 51 | en | 0.858046 |
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | qf_lib_tests/integration_tests/backtesting/alpha_model_strategy_testers/test_alpha_model_strategy_for_stop_losses_intraday.py | 5,979 | Copyright 2016-present CERN – European Organization for Nuclear Research 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 requ... | 764 | en | 0.860023 |
import json
import os
from djoser.conf import settings as djoser_settings
from djoser.compat import get_user_email
from django.utils.timezone import now
from django.http import HttpResponse
from rest_framework import status
from rest_framework.decorators import api_view, authentication_classes, permission_classes, act... | server/ahj_app/views_users.py | 5,932 | Endpoint for getting the active user
through the authtoken
Function view for getting a single user with the specified Username = username
View to revoke a user as a data maintainer of an AHJ
Expects a user's webpage token and a the primary key of an AHJ (AHJPK)
View to assign a user as a data maintainer of an AHJ
Expec... | 613 | en | 0.916582 |
# 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
fro... | sdk/python/pulumi_azure_native/databoxedge/v20201201/get_share.py | 9,175 | Represents a share on the Data Box Edge/Gateway device.
Access protocol to be used by the share.
Azure container mapping for the share.
List of IP addresses and corresponding access rights on the share(required for NFS protocol).
Data policy of the share.
Description for the share.
Represents a share on the Data Box ... | 1,029 | en | 0.810633 |
#!/usr/bin/env python
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
with open(
os.path.join(here, "requirements.txt"), encoding="utf-8"
) as requirements_file:
requirements = requirements_file.read().splitlines()
with open(
os.path.join(here, "requirements_dev.... | setup.py | 1,303 | !/usr/bin/env python split the developer requirements into setup and test requirements +1: skip empty line | 106 | en | 0.667979 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 15:13:33 2019
@author: ifenty
"""
from __future__ import division
import numpy as np
import matplotlib.pylab as plt
from .llc_array_conversion import llc_compact_to_tiles
from .llc_array_conversion import llc_compact_to_faces
from .llc_array_... | ecco_v4_py/test_llc_array_loading_and_conversion.py | 9,456 | Runs test on the read_bin_llc and llc_conversion routines
Parameters
----------
llc_grid_dir : string
A string with the directory of the binary file to open
llc_lons_fname : string
A string with the name of the XC grid file [XC.data]
llc_hfacc_fname : string
A string with the name of the hfacC grid fil... | 1,700 | en | 0.646932 |
import requests
import json
from pybliometrics.scopus import AbstractRetrieval
arr_authors = [
'55949131000', #EG
'56344636600', #MF
'6602888121', #MG
'7005314544' #SR
]
MY_API_KEY = 'afd5bb57359cd0e85670e92a9a282d48'
from pybliometrics.scopus.utils import config
#config['Authentication']['APIKey... | script/bib_script2_not_working.py | 1,645 | EGMFMGSRconfig['Authentication']['APIKey'] = 'afd5bb57359cd0e85670e92a9a282d48'print(results) some entries seem to have json parse errors, so we catch those | 156 | en | 0.712169 |
# MIT License
#
# Copyright (c) 2020 PANGAEA (https://www.pangaea.de/)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use,... | fuji_server/helper/metadata_collector_datacite.py | 4,107 | MIT License Copyright (c) 2020 PANGAEA (https://www.pangaea.de/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, m... | 1,205 | en | 0.84302 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# imageprocessor documentation build configuration file.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a ... | docs/conf.py | 4,809 | !/usr/bin/env python -*- coding: utf-8 -*- imageprocessor documentation build configuration file. This file is execfile()d with the current directory set to its containing dir. Note that not all possible configuration values are present in this autogenerated file. All configuration values have a default; values that ar... | 3,480 | en | 0.666229 |
# coding=utf-8
"""
PAT - the name of the current project.
main_portfolio_maker.py - the name of the new file which you specify in the New File
dialog box during the file creation.
Hossein - the login name of the current user.
8 / 8 / 18 - the current system date.
9: 14 AM - the current system time.
PyCharm - the name o... | portfolio_maker/main_portfolio_maker.py | 1,222 | PAT - the name of the current project.
main_portfolio_maker.py - the name of the new file which you specify in the New File
dialog box during the file creation.
Hossein - the login name of the current user.
8 / 8 / 18 - the current system date.
9: 14 AM - the current system time.
PyCharm - the name of the IDE in which ... | 401 | en | 0.804993 |
import discord
import json
import CloudDB
import nqrng
from cloudant.result import Result
global CONFIG
client = discord.Client()
token = ""
#import config file
with open('config.json', 'r') as f:
getFile = json.load(f)
global CONFIG
CONFIG = getFile["services"]["discord"][0]
token = CONFIG["token"]
#... | quantum-ugly-duckling-main/discord_bot.py | 1,287 | import config filedb connect bot start bot get message if get message for bot > return none | 91 | es | 0.077892 |
import tensorflow as tf
from tensorflow.contrib.seq2seq.python.ops.attention_wrapper import LuongAttention, \
AttentionWrapper, AttentionWrapperState
class AttentionMode:
"""
Enumerator for the Luong style local attention modes.
- See [1]: Effective Approaches to Attention-based Neural Machine Transl... | tacotron/attention.py | 24,646 | Wraps the standard AttentionWrapper class so that during decoding steps the decoding time
index is updated in the attention mechanism.
This is a hack to enable us using Luong style monotonic attention.
Enumerator for the Luong style local attention modes.
- See [1]: Effective Approaches to Attention-based Neural Mach... | 11,042 | en | 0.81814 |
import logging
import warnings
from rest_framework import serializers
from rest_framework.authtoken.models import Token
from django.contrib.auth import get_user_model
l = logging.getLogger(__name__)
class OAuth2InputSerializer(serializers.Serializer):
provider = serializers.CharField(required=False)
code =... | rest_social_auth/serializers.py | 2,030 | Define here, what data shall be encoded in JWT.
By default, entire object will be encoded. | 90 | en | 0.792898 |
# -*- coding: utf-8 -*-
"""Handle orders and pendingOrders endpoints."""
from .apirequest import APIRequest
from .decorators import dyndoc_insert, endpoint
from .responses.orders import responses
from abc import abstractmethod
class Orders(APIRequest):
"""Orders - abstract base class to handle the orders endpoint... | oandapyV20/endpoints/orders.py | 8,188 | Cancel a pending Order in an Account.
Update the Client Extensions for an Order in an Account.
.. warning::
Do not set, modify or delete clientExtensions if your account
is associated with MT4.
Create an Order for an Account.
Get details for a single Order in an Account.
Create an Order for an Account.
OrderRe... | 4,539 | en | 0.525004 |
"""
Copyright (c) 2019 Microsoft Corporation. All rights reserved.
MIT License ... | bin/train_se.py | 12,991 | Copyright (c) 2019 Microsoft Corporation. All rights reserved.
MIT License
... | 2,269 | en | 0.790014 |
# 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/compiler/tests/ftrl_test.py | 11,940 | Test the new FTRL op with support for l2 shrinkage.
The addition of this parameter which places a constant pressure on weights
towards the origin causes the gradient descent trajectory to differ. The
weights will tend to have smaller magnitudes with this parameter set.
Tests for Ftrl optimizer.
Copyright 2017 The Te... | 2,093 | en | 0.741843 |
# Copyright (c) 2014 Red Hat, 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 require... | neutron/tests/functional/agent/linux/test_keepalived.py | 2,376 | Copyright (c) 2014 Red Hat, 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 ... | 603 | en | 0.868476 |
from pyquilted.quilted.section import Section
class Work(Section):
"""The work section in a quilted resume
The work object is a complex section. It contains blocks of jobs
and optionally a list of slugs. As a section it mixes in the
sectionable functionality.
"""
def __init__(self, b... | pyquilted/quilted/work.py | 1,356 | The job block in the work section
The additional list of slugs in the work section
The work section in a quilted resume
The work object is a complex section. It contains blocks of jobs
and optionally a list of slugs. As a section it mixes in the
sectionable functionality. | 273 | en | 0.942622 |
# Generated by Django 2.2 on 2019-05-02 16:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openbook_communities', '0021_auto_20190502_1754'),
]
operations = [
migrations.AddIndex(
model_name='communitymembership',
... | openbook_communities/migrations/0022_auto_20190502_1804.py | 431 | Generated by Django 2.2 on 2019-05-02 16:04 | 43 | en | 0.616323 |
"""Collect and parse kobo forms."""
from datetime import datetime, timedelta, timezone
from os import getenv
from typing import Dict, List
from dateutil.parser import parse as dtparser
from flask import request
import requests
from werkzeug.exceptions import BadRequest, InternalServerError, NotFound
def get_kobo_... | api-flask/app/kobo.py | 6,008 | Get all form responses using Kobo api.
Collect and validate request parameters and environment variables.
Request kobo api to collect all the information related to a form.
Also, retrieve the form responses for parsing and filtering.
Transform into datetime objects used for filtering form responses.
Parse strings into... | 821 | en | 0.846691 |
import logging
import ldap
import six
from collections import Mapping, Iterable
from ldap import modlist
from nodeconductor.structure import ServiceBackend, ServiceBackendError
logger = logging.getLogger(__name__)
class LDAPBackendError(ServiceBackendError):
pass
class UnauthorizedError(LDAPBackendError):... | src/nodeconductor_ldap/backend.py | 2,599 | Interface to LDAP API.
https://www.python-ldap.org/doc/html/
python-ldap rises TypeError if unicode strings are used. XXX: Change to disabling user instead http://stackoverflow.com/a/1254499/4591416 | 200 | en | 0.509737 |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | pybind/slxos/v17r_1_01a/openflow_state/flow_id/__init__.py | 74,798 | This class was auto-generated by the PythonClass plugin for PYANG
from YANG module brocade-openflow-operational - based on the path /openflow-state/flow-id. Each member element of
the container is represented as a class variable - with a specific
YANG type.
Getter method for action_data, mapped from YANG variable /open... | 13,014 | en | 0.532737 |
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class WikiCommit(object):
"""NOTE: This class is auto... | gitea_api/models/wiki_commit.py | 4,851 | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Returns true if both objects are equal
WikiCommit - a model defined in Swagger
Returns true if both objects are not equal
For `print` and `pprint`
Gets the author of this WikiCommit. # noqa: E501
:return: The a... | 1,490 | en | 0.525979 |
# 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
from ... import _utilities, _tables
from... | sdk/python/pulumi_azure_native/insights/v20191101preview/data_collection_rule.py | 8,670 | Definition of ARM tracked top level resource.
:param str resource_name: The name of the resource.
:param pulumi.ResourceOptions opts: Options for the resource.
:param pulumi.Input[str] data_collection_rule_name: The name of the data collection rule. The name is case insensitive.
:param pulumi.Input[Sequence[pulumi.Inp... | 2,071 | en | 0.650173 |
#
# The Multiverse Platform is made available under the MIT License.
#
# Copyright (c) 2012 The Multiverse Foundation
#
# 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 restrict... | tools/Machinima/setupRenderHost.py | 4,745 | The Multiverse Platform is made available under the MIT License. Copyright (c) 2012 The Multiverse Foundation 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 ... | 1,614 | en | 0.837389 |
# INSTRUCTIONS
# Translate the text and write it between the "
# EXAMPLE: original -> "This text is in english: value {0}"
# translation -> "Aquest text està en anglès: valor {0}"
# If you see sth like {0}, {1}, maintain it on the translated sentence
# Meke special attention to elements like "... | elevenclock/lang/lang_nl.py | 7,982 | INSTRUCTIONS Translate the text and write it between the " EXAMPLE: original -> "This text is in english: value {0}" translation -> "Aquest text està en anglès: valor {0}" If you see sth like {0}, {1}, maintain it on the translated sentence Meke special attention to elements like ":", etc. Adde... | 615 | en | 0.738676 |
# Copyright The PyTorch Lightning 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 to i... | tests/regression/test_tweedie_deviance.py | 5,642 | Test that corner case for power=1.0 produce valid result.
Copyright The PyTorch Lightning 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... | 703 | en | 0.855461 |
# Copyright 2019 Google LLC. 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 a... | tfx_bsl/public/beam/run_inference.py | 3,800 | Run inference with a model.
There are two types of inference you can perform using this PTransform:
1. In-process inference from a SavedModel instance. Used when
`saved_model_spec` field is set in `inference_spec_type`.
2. Remote inference by using a service endpoint. Used when
`ai_platform_prediction_mode... | 2,867 | en | 0.771806 |
import warnings
from time import sleep
from pyspedas import time_double
from pytplot import get_data, store_data, options
import numpy as np
try:
from hapiclient import hapi as load_hapi
except:
print('hapiclient not found; install with: "pip install hapiclient"')
def hapi(trange=None, server=None, dataset=No... | pyspedas/hapi/hapi.py | 5,417 | Loads data from a HAPI server into pytplot variables
Parameters
-----------
trange: list of str or list of float
Time range to load the data for
server: str
HAPI server to load the data from
dataset: str
HAPI dataset to load
parameters: str or list of str
Parameters i... | 856 | en | 0.534505 |
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 25 21:37:26 2021
@author: brian
"""
import os
os.chdir('C:/Users/brian/Desktop/All/UWEC/DS785_Capstone/Project')
import brawl_data as bd
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from statsmodels.stats.proportion import proportion_confint
... | Capstone_Tables&Figures_Results_Graphs.py | 4,177 | Created on Sun Apr 25 21:37:26 2021
@author: brian
-*- coding: utf-8 -*-Calculate win rate confidence intervalsCompare population to individual history and inform recommendations | 181 | en | 0.770979 |
# -*- coding: utf-8 -*-
"""
hyper/tls
~~~~~~~~~
Contains the TLS/SSL logic for use in hyper.
"""
import os.path as path
import six
from .common.exceptions import MissingCertFile
from .compat import ignore_missing, ssl
NPN_PROTOCOL = 'h2'
H2_NPN_PROTOCOLS = [NPN_PROTOCOL, 'h2-16', 'h2-15', 'h2-14']
SUPPORTED_NPN_PROT... | hyper/tls.py | 5,066 | Create a new ``SSLContext`` that is correctly set up for an HTTP/2
connection. This SSL context object can be customized and passed as a
parameter to the :class:`HTTPConnection <hyper.HTTPConnection>` class.
Provide your own certificate file in case you don’t want to use hyper’s
default certificate. The path to the cer... | 2,495 | en | 0.84366 |
'''This module implements concrete agent controllers for the rollout worker'''
import numpy as np
import os
import random
import rospkg
import rospy
from gazebo_msgs.msg import ModelState
from gazebo_msgs.srv import SetModelState, SpawnModel
from markov.agent_ctrl.constants import ConfigParams, BOT_CAR_Z, OBSTACLE_Z
f... | reinforcement_learning/rl_deepracer_robomaker_coach_gazebo/src/markov/agent_ctrl/obstacles_agent_ctrl.py | 8,047 | configure domain randomizer
This module implements concrete agent controllers for the rollout worker
Read ros parameters OBJECT_POSITIONS will overwrite NUMBER_OF_OBSTACLES and RANDOMIZE_OBSTACLE_LOCATIONS track data Wait for ros services Load the obstacle sdf/urdf Set obstacle poses and spawn the obstacles ... | 748 | en | 0.81149 |
# Generated by Django 2.1.5 on 2019-03-16 16:41
from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
("people", "0012_auto_20190316_1641"),
("services", "0023_key_points_heading_not_required")... | tbx/services/migrations/0024_auto_20190316_1641.py | 897 | Generated by Django 2.1.5 on 2019-03-16 16:41 | 45 | en | 0.536466 |
#!/usr/bin/env python
#
# Copyright 2019 YugaByte, Inc. and Contributors
#
# Licensed under the Polyform Free Trial License 1.0.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://github.com/YugaByte/yugabyte-db/blob/master/licenses... | managed/devops/opscli/ybops/cloud/aws/utils.py | 40,257 | AWS specific exception handler.
Args:
e: the exception that was raised by the underlying API call that just failed.
Returns:
True if this exception can be retried, False otherwise.
A decorator for retrying an AWS operation after exceeding request limit. Does retries with
randomized jitter. Ideally, we should re... | 10,491 | en | 0.831352 |
# -*- coding: utf-8 -*-
"""An implementation of the extension to ERMLP."""
from typing import Optional, Type
import torch
from torch import nn
from ..base import EntityRelationEmbeddingModel
from ...losses import BCEAfterSigmoidLoss, Loss
from ...regularizers import Regularizer
from ...triples import TriplesFactory... | src/pykeen/models/unimodal/ermlpe.py | 6,725 | An extension of ERMLP proposed by [sharifzadeh2019]_.
This model uses a neural network-based approach similar to ERMLP and with slight modifications.
In ERMLP, the model is:
.. math::
f(h, r, t) = \textbf{w}^{T} g(\textbf{W} [\textbf{h}; \textbf{r}; \textbf{t}])
whereas in ERMPLE the model is:
.. math::
f... | 2,109 | en | 0.855343 |
import sqlite3
from abc import ABCMeta, abstractmethod
from model.dao.daoexception import DAOException
class AbstractDAO(object):
__metaclass__ = ABCMeta
def __init__(self, conn):
self._conn = conn
"""
base CRUD operation
"""
# GENERIC CREATE FUNCTION
def _insert(self, request, p... | model/dao/abstractdao.py | 1,854 | GENERIC CREATE FUNCTION GENERIC READ FUNCTION GENERIC UPDATE FUNCTION GENERIC DELETE FUNCTION | 93 | en | 0.373353 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/10/31 0031 18:55
# @Author : Hadrianl
# @File : realtime_data_server
# 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
#
# ... | rqalpha/examples/extend_api/HKMod/realtime_data_server.py | 9,854 | !/usr/bin/env python -*- coding: utf-8 -*- @Time : 2018/10/31 0031 18:55 @Author : Hadrianl @File : realtime_data_server 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.... | 809 | en | 0.517652 |
from pygments.style import Style
from pygments.token import (
Comment, Error, Keyword, Literal, Name, Number, Operator, String, Text
)
class BaseSixteenStyle(Style):
base00 = '#151515'
base01 = '#202020'
base02 = '#303030'
base03 = '#505050'
base04 = '#B0B0B0'
base05 = '#D0D0D0'
base06... | pygments_base16/base16-classic-dark.py | 1,875 | .err .c .cp .cpf .k .kt .na .nb .bp .nc .no .nd .nf .nn .nt .nv .vi .m .o .ow .l .s .si .sr .ss noqa: E402 | 106 | mn | 0.280091 |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | tests/common/test_run/abs_sum_run.py | 2,135 | Copyright 2019 Huawei Technologies Co., Ltd Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, softw... | 561 | en | 0.849356 |
import glob
import os
from distutils.dir_util import copy_tree
from shutil import copy
from alembic.command import init as _init
from metric.cli.conf import Conf
from metric.cli.template import Template
from metric.src import Base
from metric.src.package import Package
def init(name):
"""
## Init
[ID]
... | metric/cli/__init__.py | 2,595 | ## Init
[ID]
Init adalah perintah inisiasi oleh metric untuk membuat sebuah project dengan pondasi yang telah di setup, cara
penggunaan ini bisa dengan 2 cara, membuat project dari direktori saat ini (CWD) atau dengan direktori baru.
[EN]
Init is the command initiation by metric to create a project with th... | 777 | id | 0.631506 |
import cv2
import os
image = cv2.imread("/content/drive/My Drive/DIC_personal/data/face.jpg")
cascade = cv2.CascadeClassifier("/content/drive/My Drive/DIC_personal/haarcascades/haarcascade_upperbody.xml")
#image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
face_list = cascade.detectMultiScale(image)
#face_list = cascade.... | face_1.py | 703 | image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)face_list = cascade.detectMultiScale(image,scaleFactor=1.2, minNeighbors=2, minSize=(1,1)) | 137 | en | 0.274659 |
# coding: utf-8
"""
FlashBlade REST API
A lightweight client for FlashBlade REST API 2.3, developed by Pure Storage, Inc. (http://www.purestorage.com/).
OpenAPI spec version: 2.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re
import six
import typ... | pypureclient/flashblade/FB_2_3/models/replication_performance.py | 4,097 | Attributes:
swagger_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
Keyword args:
transmitted_bytes_per_sec (fl... | 851 | en | 0.734015 |
'''
Author: Guanghan Ning
E-mail: guanghan.ning@jd.com
October 22th, 2018
Unit test for graph.
'''
import os
import sys
sys.path.append(os.path.abspath("../utils/"))
from graph import *
def test_normalize_diagraph():
num_node = 15
self_link = [(i, i) for i in range(num_node)]
neighbor_l... | pose_trackers/lighttrack/graph/unit_test/test_graph.py | 1,172 | Author: Guanghan Ning
E-mail: guanghan.ning@jd.com
October 22th, 2018
Unit test for graph. | 91 | en | 0.639994 |
from django.shortcuts import render
def home(request):
"""
View function for simply rendering the Ionic Angular
index.html
"""
return render(request, 'www/index.html')
| practicality/frontend/views.py | 190 | View function for simply rendering the Ionic Angular
index.html | 63 | en | 0.464412 |
"""
Remove super classes from the train dataset and keep it only in the validation dataset.
Example command: python create_rcv1_heldout_split.py --train_fraction 0.75 --seed 42
"""
import argparse
import jsonlines
from collections import Counter
import numpy as np
import random
import copy
import os
import json
def... | run_rcv1/preprocessing/create_rcv1_superclass_split.py | 2,015 | Remove super classes from the train dataset and keep it only in the validation dataset.
Example command: python create_rcv1_heldout_split.py --train_fraction 0.75 --seed 42
Read the JSON file containing one JSON per line and store the dict Get a list of all the labels Ignore superclass labels during training Rem... | 432 | en | 0.698155 |
#!/usr/bin/env python
"""Convert *.json, *.csv and other text data files to js for local use and avoid ajax call.
"""
import optparse
from os import listdir
from os.path import abspath, isfile, isdir, join, splitext, basename
import json;
#curdir = os.path.abspath('.')
curdir = "."
filter_text_ext = [".json", ".csv"... | tools/jsfy.py | 2,580 | The entry point for this script.
Convert *.json, *.csv and other text data files to js for local use and avoid ajax call.
!/usr/bin/env pythoncurdir = os.path.abspath('.')print(path, basedir)print( extname )elif(extname in filter_binary_ext):print(path, basedir)print( path + ":" ) end of main() | 296 | en | 0.474594 |
try:
from heat.common.i18n import _
except ImportError:
pass
from heat.engine import attributes
from heat.engine import constraints
from heat.engine import clients
from heat.engine import properties
from vnc_api import vnc_api
from contrail_heat.resources import contrail
try:
from heat.openstack.common im... | contrail_heat/resources/network_policy.py | 12,283 | the user input is already an fq_name_string the user input is already an fq_name_string | 87 | en | 0.84272 |
"""
Serializer fields for django_hal
"""
from collections import OrderedDict
from django.utils.http import urlencode
from rest_framework import serializers
from .utils import reverse
class LinksField(serializers.DictField):
"""HAL-style _links field.
Parameters
----------
*args : tuple
A... | django_hal/fields.py | 6,360 | HAL-style _links field.
Parameters
----------
*args : tuple
A tuple representing the relation name, and arguments to
reverse the url. Example: `(name, urlpattern, {'pk', 'pk'})`.
name : str
The string used to identify the url in the final output.
urlpattern : str
A named urlpattern.
... | 2,968 | en | 0.58391 |
#
# 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 us... | sdks/python/apache_beam/transforms/stats.py | 8,149 | Hashes input elements and uses those to extrapolate the size of the entire
set of hash values by assuming the rest of the hash values are as densely
distributed as the sample space.
ApproximateUniqueCombineFn computes an estimate of the number of
unique values that were combined.
Approximate.Globally approximate number... | 2,894 | en | 0.834038 |
from meta_policy_search.utils import logger
from meta_policy_search.meta_algos.base import MAMLAlgo
from meta_policy_search.optimizers.conjugate_gradient_optimizer import ConjugateGradientOptimizer
import tensorflow as tf
from collections import OrderedDict
class TRPOMAML(MAMLAlgo):
"""
Algorithm for TRPO MAM... | meta_policy_search/meta_algos/trpo_maml.py | 8,751 | Algorithm for TRPO MAML
Args:
policy (Policy): policy object
name (str): tf variable scope
step_size (int): trust region size for the meta policy optimization through TPRO
inner_type (str): One of 'log_likelihood', 'likelihood_ratio', 'dice', choose which inner update to use
exploration (bool): whe... | 1,371 | en | 0.628064 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2011-2014, Nigel Small
#
# 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... | py2neo/error/__init__.py | 698 | !/usr/bin/env python -*- coding: utf-8 -*- Copyright 2011-2014, Nigel Small 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 applicabl... | 597 | en | 0.84117 |
import json
import os
import pandas as pd
import sys
sys.path.append('scripts/')
from polygon import Collection, Footprint
class Writer:
"""
Class that stores smart label values per instance
"""
def __init__(self, filename):
"""
Class initialization.
:param filename: name of the file to store the data, str... | scripts/writer.py | 3,535 | Class that saves results in json format.
Class that stores smart label values per instance
Class initialization.
:param filename: name of the file to store the data, str
Function that adds an instance with its smart labels to the collection
:param instance: name of instance, str
:param result: smart labels, dict {label... | 849 | en | 0.712835 |
# Author
# Angelica ACOSTA ARTETA
import unittest
from balance import summing, stringarray, need, weighting
class TestBalance(unittest.TestCase):
def test_summing(self):
self.assertEqual(summing([]), 0)
self.assertEqual(summing([3]), 3)
self.assertEqual(summing([1,1,1,1,1]), 5)
se... | test_balance.py | 1,219 | Author Angelica ACOSTA ARTETA | 29 | en | 0.423854 |
"""Python wrappers around TensorFlow ops.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
import six as _six
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
from tensorflow.python.eager import context as _context
from tensorflow.python.eager import ... | venv1/Lib/site-packages/tensorflow/python/debug/ops/gen_debug_ops.py | 33,055 | Copy Op.
Performs CPU-to-CPU or GPU-to-GPU deep-copying of tensor, depending on the
device on which the tensor is allocated.
N.B.: If the all downstream attached debug ops are disabled given the current
gRPC gating status, the output will simply forward the input tensor without
deep-copying. See the documentation of D... | 10,920 | en | 0.569576 |
from dagster import AssetKey, DagsterEventType, EventRecordsFilter, check, seven
from .utils import capture_error
def _normalize_asset_cursor_str(cursor_string):
# the cursor for assets is derived from a json serialized string of the path. Because there are
# json serialization differences between JS and Py... | python_modules/dagster-graphql/dagster_graphql/implementation/fetch_assets.py | 4,827 | the cursor for assets is derived from a json serialized string of the path. Because there are json serialization differences between JS and Python in its treatment of whitespace, we should take extra precaution here and do a deserialization/serialization pass | 260 | en | 0.930657 |
"""This uses the CLUE as a Bluetooth LE sensor node."""
# Adafruit Service demo for Adafruit CLUE board.
# Accessible via Adafruit Bluefruit Playground app and Web Bluetooth Dashboard.
import time
import board
from digitalio import DigitalInOut
import neopixel_write
from adafruit_ble import BLERadio
import ulab
f... | clue/temperature/code.py | 7,938 | This uses the CLUE as a Bluetooth LE sensor node.
Adafruit Service demo for Adafruit CLUE board. Accessible via Adafruit Bluefruit Playground app and Web Bluetooth Dashboard. CLUE has just one board pixel. 3 RGB bytes * 1 pixel. Take over NeoPixel control from clue. pylint: disable=protected-access Send 256 16-bit sa... | 2,816 | en | 0.722182 |
# Copyright (c) 2013-2014 Will Thames <will@thames.id.au>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify... | lib/ansiblelint/__init__.py | 1,341 | Main ansible-lint package.
Copyright (c) 2013-2014 Will Thames <will@thames.id.au> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to ... | 1,147 | en | 0.861929 |
"""
Quick Sort
----------
Uses partitioning to recursively divide and sort the list
Time Complexity: O(n**2) worst case
Space Complexity: O(n**2) this version
Stable: No
Psuedo Code: CLRS. Introduction to Algorithms. 3rd ed.
"""
count = 0
def sort(seq):
"""
Takes a list of inte... | algorithms/sorting/quick_sort.py | 930 | print sort([9,8,7,6,5,4,3,2,1,0]) | 33 | en | 0.402043 |
import logging
from datetime import datetime
from pprint import pprint as pp
import click
from flask.cli import with_appcontext
from scout.load import load_exons
from scout.server.extensions import store
from scout.utils.handle import get_file_handle
from scout.utils.scout_requests import fetch_ensembl_exons
LOG = l... | scout/commands/load/exons.py | 1,827 | Load exons into the scout database. If no file, fetch exons from ensembl biomart
Test if there are any exons loaded Load the exons LOG.info("Try to fetch one chromosome at the time") | 184 | en | 0.711816 |
import os
import sys as _sys
import platform
import re
PY2 = _sys.version_info < (3,)
PY3 = not PY2
RE_NUM = re.compile(r'(\d+).+')
if not PY2:
# these were moved around for Python 3
from urllib.parse import (quote as url_quote, unquote as url_unquote,
urlencode)
# Python 3... | pika/compat.py | 4,157 | A marker class that signifies that the integer value should be
serialized as `l` instead of `I`
This is the same as Python 2 `chr(n)` for bytes in Python 3
Returns a single byte `bytes` for the given int argument (we
optimize it a bit here by passing the positional argument tuple
directly to the bytes constructor.
Ret... | 1,669 | en | 0.81202 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_qc.configuration import Configuration
class... | telestream_cloud_qc_sdk/telestream_cloud_qc/models/extended_bool_value_test.py | 4,831 | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Returns true if both objects are equal
ExtendedBoolValueTest - a model defined in OpenAPI
Returns true if both objects are not equal
For `print` and `pprint`
Gets the checked of this ExtendedBoo... | 1,453 | en | 0.457719 |
# Everything we've seen to this point has been a problem known as regression in
# which we're trying to predict an actual numeric value for each observation of
# N input numeric values. A more common problem is that of classification -
# predicting a single binary occurance, class or label for each input. The
# example... | 07_classification.py | 8,658 | Everything we've seen to this point has been a problem known as regression in which we're trying to predict an actual numeric value for each observation of N input numeric values. A more common problem is that of classification - predicting a single binary occurance, class or label for each input. The example we'll exp... | 7,422 | en | 0.916011 |
from enum import Enum
from dataclasses import dataclass
class TokenType(Enum):
#TYPES
INT = 0
FLOAT = 1
#OPERATORS
PLUS = 2
MINUS = 3
DIVIDE = 4
MULTIPLY = 5
#PARENTHESES
LPAREN = 6
RPAREN = 7
#SQUARE BRACKETS
L_SQUAREBRACKET = 8
R_SQ... | tokens.py | 590 | TYPESOPERATORSPARENTHESESSQUARE BRACKETSANGLE BRACKETS | 54 | en | 0.357072 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Jan 29, 2021
@file: train_unmixing.py
@desc: Perform the training of the models for the unmixing problem.
@author: laugh12321
@contact: laugh12321@vip.qq.com
"""
import os
import numpy as np
import tensorflow as tf
from typing import Dict
import src.model.e... | src/model/train_unmixing.py | 4,094 | Function for running experiments on various unmixing models,
given a set of hyper parameters.
:param data: The data dictionary containing
the subsets for training and validation.
First dimension of the datasets should be the number of samples.
:param model_name: Name of the model, it serves as a key in the
... | 1,343 | en | 0.833456 |
"""Probability mass function for a beta binomial distribution
Functions
---------
betabinom_pmf
Probability mass function for a beta binomial distribution
"""
from bbpmf.betabinom_pmf import betabinom_pmf
| bbpmf/__init__.py | 211 | Probability mass function for a beta binomial distribution
Functions
---------
betabinom_pmf
Probability mass function for a beta binomial distribution | 156 | en | 0.405207 |
import random
random.sample(set([1, 2, 3, 4, 5, 6]), 2) # random select from set
| snippets/python-set-random.py | 81 | random select from set | 22 | en | 0.831725 |
"""Tests for stubs.
Verify that various things in stubs are consistent with how things behave at runtime.
"""
import argparse
import copy
import enum
import importlib
import inspect
import re
import sys
import types
import warnings
from functools import singledispatch
from pathlib import Path
from typing import Any,... | venv/Lib/site-packages/mypy/stubtest.py | 49,711 | Marker object for things that are missing (from a stub or the runtime).
Represents an error found by stubtest.
:param object_path: Location of the object with the error,
e.g. ``["module", "Class", "method"]``
:param message: Error message
:param stub_object: The mypy node representing the stub
:param runtime_objec... | 8,841 | en | 0.864723 |
from __future__ import annotations
from datetime import (
datetime,
timedelta,
)
from typing import Hashable
import warnings
import numpy as np
from pandas._libs import (
index as libindex,
lib,
)
from pandas._libs.tslibs import (
BaseOffset,
NaT,
Period,
Resolution,
Tick,
)
from ... | env/Lib/site-packages/pandas/core/indexes/period.py | 19,698 | Immutable ndarray holding ordinal values indicating regular periods in time.
Index keys are boxed to Period objects which carries the metadata (eg,
frequency information).
Parameters
----------
data : array-like (1d int np.ndarray or PeriodArray), optional
Optional period-like data to construct index with.
copy :... | 6,819 | en | 0.590012 |
from __future__ import annotations
import re
from typing import Callable, ClassVar, List, Optional, Pattern, Sequence, Tuple, Union, cast
import discord
from discord.ext import commands
_ID_RE = re.compile(r"([0-9]{15,21})$")
_USER_MENTION_RE = re.compile(r"<@!?([0-9]{15,21})>$")
_CHAN_MENTION_RE = re.compile(r"<#(... | bot/utils/messagepredicate.py | 16,371 | noinspection PyUnusedLocal noinspection PyProtectedMember | 57 | en | 0.16882 |
# pylint: disable=g-bad-file-header
# 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/LICENS... | tensorflow/contrib/tensor_forest/python/tensor_forest.py | 34,959 | A base class for holding hyperparameters and calculating good defaults.
A container for a forests training data, consisting of multiple trees.
Instantiates a TreeTrainingVariables object for each tree. We override the
__getitem__ and __setitem__ function so that usage looks like this:
forest_variables = ForestTrain... | 8,715 | en | 0.827136 |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class NeutronCreateFloatingIpRequestBody:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map... | huaweicloud-sdk-eip/huaweicloudsdkeip/v2/model/neutron_create_floating_ip_request_body.py | 3,115 | 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
NeutronCreateFloatingIpRequestBody - a model de... | 840 | en | 0.677838 |
#!/usr/bin/env python
# Copyright (c) 2020, Palo Alto Networks
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" A... | examples/log_forwarding_profile.py | 2,725 | log_forwarding_profile.py
==========================
Ensure that all security rules have the same log forwarding profile assigned.
This script checks if any rules are missing the specified log forwarding profile
and applies the profile if it is missing. This is done with as few API calls as
possible.
Environment var... | 1,792 | en | 0.888289 |
#!/usr/bin/env python
# coding: utf-8
# ## sircat
#
# Makes a catalog of solar wind stream interaction regions (SIRs) and high speed solar wind streams (HSS) for the Wind, STEREO and MAVEN spacecraft since 2007.
#
# Authors: [C. Möstl](https://www.iwf.oeaw.ac.at/en/user-site/christian-moestl/) (twitter @chrisoutofsp... | sircat.py | 39,800 | !/usr/bin/env python coding: utf-8 sircat Makes a catalog of solar wind stream interaction regions (SIRs) and high speed solar wind streams (HSS) for the Wind, STEREO and MAVEN spacecraft since 2007. Authors: [C. Möstl](https://www.iwf.oeaw.ac.at/en/user-site/christian-moestl/) (twitter @chrisoutofspace), A. J. Weis... | 13,256 | en | 0.65528 |
import pandas as pd
import numpy as np
from scipy import stats
def columns_views(player_1_df, player_2_df):
columns = list(player_1_df.columns)
if list(player_1_df.columns) == list(player_2_df.columns):
columns = list(player_1_df.columns)
player_1 = list(player_1_df.values[0])
playe... | playstyle_similar/playstyle_similar2.py | 11,887 | work_rateの削除処理 ユーグリッド距離を算出 https://qiita.com/shim0mura/items/64918dad83d162ef2ac2ユークリッド距離 どちらも同じ値を返す distance = np.linalg.norm(v1 - v2) 0から1までの値で似ていれば似ているほど1に近くなる、みたいな類似度として分かりやすい値が欲しい。 0での除算エラーを防ぐためにこのdに1を足して逆数をとるとそのような値を取ることが出来る。 1/(1+d) print('distance', distance) Scipyを使ってコサイン類似度を求める方法 import scipy.spatial.distance... | 1,853 | ja | 0.94026 |
import virtualbox, json, pprint, configparser, time, psutil, sys
from pypresence import Presence
class RichPresence:
def __init__(self):
# Initialize the VirtualBox instance, config, and assets.
self.virtualbox = virtualbox.VirtualBox()
self.config = configparser.ConfigParser()
... | main.py | 8,339 | Initialize the VirtualBox instance, config, and assets. Initialize the Rich Presence. Initialize format dictionary. Check if VirtualBox is running, and that the current OS is Windows. [TODO] Add support for other operating systems. Generate the list of machines. Set the previous format dictionary, and then update the c... | 2,464 | en | 0.85264 |
#!/usr/bin/env python3
from . import util
import json
from electrum_civx.network import filter_protocol
peers = filter_protocol(util.get_peers())
results = util.send_request(peers, 'blockchain.estimatefee', [2])
print(json.dumps(results, indent=4))
| electrum/scripts/estimate_fee.py | 249 | !/usr/bin/env python3 | 21 | fr | 0.448822 |
'''
实验名称:以太网MQTT通信
版本:v1.0
日期:2020.12
作者:01Studio
说明:通过Socket编程实现以太MQTT通信 订阅者(subscribe)。
'''
import network,usocket,time
from simple import MQTTClient
from tftlcd import LCD43M
#定义常用颜色
RED = (255,0,0)
GREEN = (0,255,0)
BLUE = (0,0,255)
BLACK = (0,0,0)
#4.3寸LCD初始化
d = LCD43M(portrait=1)
d.fill((255,255,255)) #填充白色
... | 哥伦布(STM32F407)/3.通讯实验/2.以太网/3.MQTT通信/2.订阅者(subscribe)/main.py | 1,599 | 实验名称:以太网MQTT通信
版本:v1.0
日期:2020.12
作者:01Studio
说明:通过Socket编程实现以太MQTT通信 订阅者(subscribe)。
定义常用颜色4.3寸LCD初始化填充白色socket数据接收中断标志位以太网初始化设置MQTT回调函数,有信息时候执行判断网络是否连接成功打印IP信息显示标题显示IP信息MQTT配置 客户端ID TOPIC名称配置回调函数订阅主题检测是否收到信息,收到则执行回调函数打印。接收间隔 | 228 | zh | 0.953738 |
from math import ceil
import pytest
from scipy.stats import norm, randint
import numpy as np
from sklearn.datasets import make_classification
from sklearn.dummy import DummyClassifier
from sklearn.experimental import enable_halving_search_cv # noqa
from sklearn.model_selection import StratifiedKFold
from sklearn.mod... | sklearn/model_selection/tests/test_successive_halving.py | 25,125 | Dummy classifier that accepts parameters a, b, ... z.
These parameter don't affect the predictions and are useful for fast
grid searching.
Check that we raise an error if the minimum resources is set to 0.
Check the selection strategy of the halving search.
noqa notice how it loops at the beginning also, the number ... | 4,973 | en | 0.913946 |
# -*- coding: utf-8 -*-
# Copyright 2018 Spanish National Research Council (CSIC)
#
# 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
#
# Unle... | wq_sat/satellites/sentinel_download.py | 6,229 | Given two dates and region, download N Sentinel Collections scenes from ESA
Sentinel dataHUB.
The downloaded Sentinel collection scenes are compatible with:
S2MSI1C: Top-of-atmosphere reflectances in cartographic geometry
or S2MSI2A: Bottom-of-atmosphere reflectance in cartographic geometry
Parameters
----------
inidat... | 1,728 | en | 0.71605 |
from autosar.writer.writer_base import ElementWriter
import autosar.constant
class XMLConstantWriter(ElementWriter):
def __init__(self,version, patch):
super().__init__(version, patch)
def getSupportedXML(self):
return ['Constant']
def getSupportedCode(self):
return []
def... | autosar/writer/constant_writer.py | 11,086 | use name onlyuse full referencejoin any inner record init valuesjoin any inner record init valuesline will be way too long | 122 | en | 0.323139 |
# INIT
data = []
numeric = []
normal = []
keyL = []
KeyL = []
key = input("Enter Key Value: ")
# File - Load Function
def load(file):
handle = open(file)
return handle.read()
# Text Format
def form(file):
format = load(file)
format = format.replace(' ', '')
format = format.replace(',', '')
f... | crypto/vigenere/crypto.py | 1,817 | INIT File - Load Function Text FormatADDS TO LISTREMOVE NUMMod InvCalc difKey CreatorCalc diff of Plain text print(len(normal))print(numbers)print(dif(len(getKey(key)),len(normal))) | 181 | en | 0.383185 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.