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 |
|---|---|---|---|---|---|---|
#!/usr/bin/python
# Copyright (c) 2020, 2021 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for d... | plugins/modules/oci_optimizer_recommendation_actions.py | 14,148 | Supported actions:
bulk_apply
!/usr/bin/python Copyright (c) 2020, 2021 Oracle and/or its affiliates. This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license. GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) Apache License v2... | 417 | en | 0.741496 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
from django_secrets.startup import check
check()
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_secrets.settings'
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above... | manage.py | 869 | !/usr/bin/env python The above import may fail for some other reason. Ensure that the issue is really that Django is missing to avoid masking other exceptions on Python 2. noqa | 176 | en | 0.862894 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/7/31 上午10:21
# @Author : Matrix
# @Github : https://github.com/blackmatrix7/
# @Blog : http://www.cnblogs.com/blackmatrix/
# @File : __init__.py.py
# @Software: PyCharm
from .huawei import SMSCenter
__author__ = 'blackmatrix'
if __name__ == '__main__':
... | sms/__init__.py | 329 | !/usr/bin/env python -*- coding: utf-8 -*- @Time : 2017/7/31 上午10:21 @Author : Matrix @Github : https://github.com/blackmatrix7/ @Blog : http://www.cnblogs.com/blackmatrix/ @File : __init__.py.py @Software: PyCharm | 214 | zh | 0.184227 |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
#########################################################################
## Customize your APP title, subtitle and menus here
#########################################################################
response.logo... | applications/javelin/models/menu.py | 6,153 | -*- coding: utf-8 -*- this file is released under public domain and you can use without limitations Customize your APP title, subtitle and menus here read more at http://dev.w3.org/html5/markup/meta.name.html your http://google.com/analytics id this is the main application menu add/remove items as required provide shor... | 421 | en | 0.779725 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/videointelligence_v1/proto/video_intelligence.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.pro... | google/cloud/videointelligence_v1/proto/video_intelligence_pb2.py | 197,079 | Generated protocol buffer code.
-*- coding: utf-8 -*- Generated by the protocol buffer compiler. DO NOT EDIT! source: google/cloud/videointelligence_v1/proto/video_intelligence.proto @@protoc_insertion_point(imports) @@protoc_insertion_point(class_scope:google.cloud.videointelligence.v1.AnnotateVideoRequest) @@proto... | 4,161 | en | 0.305723 |
# Copyright 2019, A10 Networks
#
# 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... | a10_octavia/controller/worker/tasks/a10_vthunder_db.py | 3,027 | Copyright 2019, A10 Networks 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, ... | 578 | en | 0.869296 |
from __future__ import unicode_literals
from nose.tools import assert_raises
import datetime
import boto
import boto3
import sure # noqa
from boto.exception import JSONResponseError
from moto import mock_ec2
from moto.backends import get_model
from moto.core.utils import iso_8601_datetime_with_milliseconds
@mock_e... | tests/test_ec2/test_spot_instances.py | 8,198 | Test that moto correctly filters spot instance requests
Test that moto set the correct default arguments
Test that moto correctly fullfills a spot instance request
Test that moto correctly tags a spot instance request
noqa | 224 | en | 0.497336 |
# 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 ... | sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py | 35,215 | ContainerRegistryManagementClient.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profi... | 13,043 | en | 0.395959 |
import os
import json
import numpy as np
import itertools
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.art3d import Line3DCollection
from mpl_toolkits import mplot3d
def liver_dump_init(env, name = None):
liver = {'x':[],'Fes':[],'Fis':[],'Ficp':[],'volume':[],'col_p_n':[],'crash':[]}
l... | env_pyrep/utils.py | 19,453 | Set 3D plot axes to equal scale.
Make axes of 3D plot have equal scale so that spheres appear as
spheres and cubes as cubes. Required since `ax.axis('equal')`
and `ax.set_aspect('equal')` don't work on 3D.
check bc_co for all surface tri_element add dn to decide p_n x3 compute ray and normal vector, d= ray,n=normal... | 2,464 | en | 0.535975 |
from django.db import models
# Create your models here.
class Message(models.Model):
tab_name = models.TextField(max_length=50)
text = models.TextField(max_length=300) | Robocol/testapp/Interfaz/models.py | 176 | Create your models here. | 24 | en | 0.920486 |
from a10sdk.common.A10BaseClass import A10BaseClass
class AuthSamlIdp(A10BaseClass):
""" :param remote_file: {"optional": true, "type": "string", "description": "Profile name for remote url", "format": "url"}
:param use_mgmt_port: {"default": 0, "optional": true, "type": "number", "description": "Use ... | a10sdk/core/A10_import/import_auth_saml_idp.py | 1,704 | :param remote_file: {"optional": true, "type": "string", "description": "Profile name for remote url", "format": "url"}
:param use_mgmt_port: {"default": 0, "optional": true, "type": "number", "description": "Use management port as source port", "format": "flag"}
:param verify_xml_signature: {"default": 0, "opt... | 1,127 | en | 0.431725 |
# coding: utf-8
"""
Intersight REST API
This is Intersight REST API
OpenAPI spec version: 1.0.9-255
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class EquipmentChassis(object):
"""
NOTE: This clas... | intersight/models/equipment_chassis.py | 21,365 | 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
EquipmentChassis - a model defined in Swagger
Returns true if both objects are not equal
For `print` and `pprint`
Gets the account_moid of this EquipmentChassis.
The Account I... | 7,968 | en | 0.724457 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'button_editor.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObj... | storm_control/hal4000/illumination/button_editor_ui.py | 1,687 | -*- coding: utf-8 -*- Form implementation generated from reading ui file 'button_editor.ui' Created by: PyQt5 UI code generator 5.7 WARNING! All changes made in this file will be lost! | 184 | en | 0.853711 |
#!/usr/bin/env python
# Copyright (c) 2005 Gavin E. Crooks <gec@threeplusone.com>
#
# This software is distributed under the MIT Open Source License.
# <http://www.opensource.org/licenses/mit-license.html>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and ass... | test_corebio/test_table_io.py | 2,178 | !/usr/bin/env python Copyright (c) 2005 Gavin E. Crooks <gec@threeplusone.com> This software is distributed under the MIT Open Source License. <http://www.opensource.org/licenses/mit-license.html> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated document... | 1,255 | en | 0.840866 |
#!/usr/bin/env python
# Copyright 2015 Rackspace, 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
#... | onmetal_scripts/decom_port.py | 1,467 | !/usr/bin/env python Copyright 2015 Rackspace, 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 ... | 621 | en | 0.854865 |
"""
File: weather_master.py
Name: Claire Lin
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is shown in the sample
run in the Assignment 2 Handout.
"""
EXIT = ... | stanCode_Projects/weather_master/weather_master.py | 3,222 | To find the highest and lowest temperature, cold days and the average.
File: weather_master.py
Name: Claire Lin
-----------------------
This program should implement a console program
that asks weather data from user to compute the
average, highest, lowest, cold days among the inputs.
Output format should match what is... | 1,442 | en | 0.7887 |
"""Module of sample legends for some commonly used geospatial datasets.
"""
import os
import pkg_resources
# Land Cover datasets in Earth Engine https://developers.google.com/earth-engine/datasets/tags/landcover
builtin_legends = {
# National Land Cover Database 2016 (NLCD2016) Legend https://www.mrlc.gov/data/leg... | geemap/legends.py | 24,929 | Converts an Earth Engine color table to a dictionary
Args:
in_table (str): The input file path (*.txt) to the Earth Engine color table.
out_file (str): The output file path (*.txt) to the legend dictionary.
Module of sample legends for some commonly used geospatial datasets.
Land Cover datasets in Earth Eng... | 1,835 | en | 0.63013 |
"""
naivefit.py
A NaiveFit follows the approach described in Crundall et al. (2019).
NaiveFit begins with an initial guess provided by user of an N component fit.
If no guess is provided, all provided stars are assumed to be members of one
component.
NaiveFit will perform an Expectation Maximisation on this N compo... | chronostar/naivefit-bak.py | 29,289 | Many arguments can be taken straight from the fit_pars dictionary,
so no point explicitly looking for them.
Description of parameters can be found in README.md along with their
default values and whether they are required.
Parameters
----------
fit_pars : str -or- dictionary
If a string, `fit_pars` should be a pat... | 9,355 | en | 0.776102 |
"""The token kinds currently recognized."""
from shivyc.tokens import TokenKind
keyword_kinds = []
symbol_kinds = []
# Until function definition is ready, we define `main` as a hardcoded keyword
main = TokenKind("main", keyword_kinds)
bool_kw = TokenKind("_Bool", keyword_kinds)
char_kw = TokenKind("char", keyword_k... | shivyc/token_kinds.py | 2,676 | The token kinds currently recognized.
Until function definition is ready, we define `main` as a hardcoded keyword | 115 | en | 0.90259 |
# coding: utf-8
def get_dict_output_dir_to_parameters_ini_dump_filename():
import os
dir_ = '.'
output_dir_list = sorted([output_dir for output_dir in os.listdir(dir_) if output_dir.startswith('output')])
ret = {}
for output_dir in output_dir_list:
with open(os.path.join(output_dir, 'para... | apps/2d/mhd/rotated_alfven/convergence/convergence_study.py | 8,465 | coding: utf-8 q(:, :, i - 1): * i = 1: mass * i = 2: momentum-1 * i = 3: momentum-2 * i = 4: momentum-3 * i = 5: energy * i = 6: B1 * i = 7: B2 * i = 8: B3 print "u_perp error: ", L1_error_u_perp / L1_u_perp_exact print "u3 error: ", L1_error_u3 / L1_u3_exact pri... | 1,384 | en | 0.239498 |
from __future__ import print_function
import click
from openelex.base.cache import StateCache
from .utils import default_state_options, print_files
@click.command(name="cache.files", help="List files in state cache diretory")
@default_state_options
def files(state, datefilter=''):
"""List files in state cache di... | openelex/tasks/cache.py | 1,091 | Delete files in state cache diretory
State is required. Optionally provide a date
filter to limit results.
List files in state cache diretory
State is required. Optionally provide a date
filter to limit results.
NOTE: Cache must be populated in order to load data. | 268 | en | 0.870812 |
import os
import sys
# os.system('bash ./set_env.sh')
PARALLEL = 1 # assuming a quad-core machine
ATTRIBUTE = "organic_figure"
os.environ['FONDUERHOME'] = '/home/xiuyuan/private/839/fonduer_new/839_fonduer/'
os.environ['FONDUERDBNAME'] = ATTRIBUTE
os.environ['SNORKELDB'] = 'postgres://postgres:112233@localhost:5432/' ... | tutorials/organic_synthesis_figures/parse_organic_figures_xiuyuan.py | 10,592 | os.system('bash ./set_env.sh') assuming a quad-core machine flatten=['sup', 'sub', 'small'], ignore=['italic', 'bold'], divide train/dev/test print("enter filter 1") enter_time = time.time() print('Filtered by f1!') print("{} has passed filter 1 in {} seconds!".forma... | 1,357 | en | 0.520572 |
"""Support for local control of entities by emulating a Philips Hue bridge."""
import logging
from aiohttp import web
import voluptuous as vol
from homeassistant import util
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
from homeassistant.exceptions import HomeAssistantError
from... | homeassistant/components/emulated_hue/__init__.py | 10,598 | Hold configuration variables for the emulated hue bridge.
Initialize the instance.
Wrapper, because we actually want to handle invalid json.
Get a unique number for the entity id.
Get the name of an entity.
Determine if an entity should be exposed on the emulated bridge.
Async friendly.
Convert unique number to entity... | 1,413 | en | 0.890011 |
# coding: utf-8
"""
ESMInterfaceTypeData.py
The Clear BSD License
Copyright (c) – 2016, NetApp, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are ... | netapp/santricity/models/symbol/esm_interface_type_data.py | 6,086 | 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
ESMInterfaceTypeData - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict a... | 3,285 | en | 0.781725 |
#!/usr/bin/python3
#
# Copyright (C) 2011 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list o... | test/py/lockperf.py | 4,213 | Parses the command line options.
In case of command line errors, it will show the usage and exit the
program.
@return: the options in a tuple
Thread function for acquiring locks.
Initializes this class.
Script for testing lock performance
!/usr/bin/python3 Copyright (C) 2011 Google Inc. All rights reserved... | 1,686 | en | 0.864929 |
# 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 t... | ecl/compute/v2/image.py | 2,496 | 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 di... | 1,098 | en | 0.873695 |
# -*- coding: utf-8 -*-
"""
Adjustment from the 2D version from Machine Learning & Simulation code and video:
https://www.youtube.com/watch?v=ZUXmO4hu-20&list=LL&index=1&ab_channel=MachineLearning%26Simulation
https://github.com/Ceyron/machine-learning-and-simulation/blob/main/english/simulation_scripts/lattice... | english/simulation_scripts/D3Q19_lattice_boltzmann_method_python_jax.py | 8,953 | Adjustment from the 2D version from Machine Learning & Simulation code and video:
https://www.youtube.com/watch?v=ZUXmO4hu-20&list=LL&index=1&ab_channel=MachineLearning%26Simulation
https://github.com/Ceyron/machine-learning-and-simulation/blob/main/english/simulation_scripts/lattice_boltzmann_method_python_jax... | 1,505 | en | 0.716374 |
__author__ = 'ialbert'
from django.views.generic import DetailView, ListView, TemplateView, RedirectView, View
from haystack.views import SearchView
from haystack.forms import SearchForm
from haystack.query import SearchQuerySet, AutoQuery
from haystack.utils import Highlighter
from django.conf import settings
from bi... | biostar/server/search.py | 3,312 | [:10]@ajax_error_wrapper Why can this happen? | 45 | en | 0.299277 |
# 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 u... | chart/tests/test_pod_template_file.py | 16,578 | Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file... | 752 | en | 0.883564 |
# 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 u... | tutorials/autotvm/tune_relay_mobile_gpu.py | 16,292 | Get the symbol definition and random weight of a network
Auto-tuning a Convolutional Network for Mobile GPU
==================================================
**Author**: `Lianmin Zheng <https://github.com/merrymercy>`_, `Eddie Yan <https://github.com/eqy>`_
Auto-tuning for a specific device is critical for getting th... | 9,533 | en | 0.800315 |
from __future__ import absolute_import
import abc
class Database(object):
__metaclass__ = abc.ABCMeta
FIELD_FILE_SHA1 = 'file_sha1'
FIELD_SONG_ID = 'song_id'
FIELD_SONGNAME = 'song_name'
FIELD_OFFSET = 'offset'
FIELD_HASH = 'hash'
# Name of your Database subclass, this is used in configu... | dejavu/database.py | 4,403 | Called after the database instance has been given to the new process
This will be called in the new process.
Called before the database instance is given to the new process
Called to remove any song entries that do not have any fingerprints
associated with them.
Called when the database should be cleared of all data.
... | 1,953 | en | 0.836437 |
import pytest
from unittest.mock import patch
from collections import Counter
from bigchaindb.core import Bigchain
from bigchaindb.exceptions import CriticalDuplicateVote
from bigchaindb.voting import Voting, INVALID, VALID, UNDECIDED
################################################################################
#... | tests/test_voting.py | 7,709 | * Legal transitions are UNDECIDED -> [VALID|INVALID] only
* Block is never left UNDECIDED after voting
* Accomodates rogues on previous block / invalid schema
Tests for checking vote eligibility Test vote counting Incorrect previous block subtracts from n_valid and adds to n_invalid 9 kosher votes 1 invalid, 1 malfor... | 709 | en | 0.888163 |
#!/usr/bin/env python
# ref: Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun"Deep Residual Learning for Image Recognition"
# https://arxiv.org/pdf/1512.03385v1.pdf
#
ResNetConfig={
"16":[ "16", "small", 1, 1, 1, 1],
"18":[ "18", "small", 2, 2, 2, 2],
"34":[ "34", "small", 3, 4, 6, 3],
"50":[ "50", ... | models/resnet18/ResNet_Generator.py | 16,416 | !/usr/bin/env python ref: Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun"Deep Residual Learning for Image Recognition" https://arxiv.org/pdf/1512.03385v1.pdf def genScaleLayer(train_val, name, bottom): layer_str = ''' layer {{ name: "{name}" type: "Scale" top: "{top}" bottom: "{bottom}" scale_param... | 765 | en | 0.351827 |
import gym
import rlkit.torch.pytorch_util as ptu
from rlkit.data_management.obs_dict_replay_buffer import ObsDictRelabelingBuffer
from rlkit.exploration_strategies.base import \
PolicyWrappedWithExplorationStrategy
from rlkit.exploration_strategies.gaussian_and_epislon import \
GaussianAndEpislonStrategy
from... | experiments/ashvin/rfeatures/sawyer/door/bc3.py | 3,715 | from rlkit.torch.td3.td3 import TD3 from multiworld.envs.mujoco.sawyer_xyz.sawyer_push_multiobj_subset import SawyerMultiobjectEnv from multiworld.envs.mujoco.sawyer_xyz.sawyer_reach import SawyerReachXYZEnv from sawyer_control.envs.sawyer_reaching import SawyerReachXYZEnv from rlkit.launchers.experiments.ashvin.rfeatu... | 642 | en | 0.498585 |
import os
import platform
import re
import sys
from contextlib import suppress
from pathlib import Path
from loguru import logger
from sc2 import wsl
BASEDIR = {
"Windows": "C:/Program Files (x86)/StarCraft II",
"WSL1": "/mnt/c/Program Files (x86)/StarCraft II",
"WSL2": "/mnt/c/Program Files (x86)/StarCr... | sc2/paths.py | 4,699 | Paths for SC2 folders, lazily loaded using the above metaclass.
"Lazily loads paths to allow importing the library even if SC2 isn't installed.
Get home directory of user, using Windows home directory for WSL.
Attempts to find a user's SC2 install if their OS has ExecuteInfo.txt
TODO: Linux env conf from: https://git... | 451 | en | 0.799239 |
# http://www.pythonchallenge.com/pc/def/peak.html
import requests, pickle
input_url = "http://www.pythonchallenge.com/pc/def/banner.p"
obj = requests.get(input_url)
text = obj.text
banner = pickle.loads(text)
final = []
for index, value in enumerate(banner):
for j in value:
final.append("".join(j[0] * j... | 5.py | 372 | http://www.pythonchallenge.com/pc/def/peak.html | 47 | en | 0.414613 |
import argparse
import os
import os.path as osp
import shutil
import tempfile
import json
import pdb
import numpy as np
import pickle
import pandas as pd
import mmcv
import torch
import torch.distributed as dist
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import get_dist_info, l... | tools/test_lvis.py | 15,707 | Get the logits as a tuple of softmax logits ,bounding boxes and labels.
Output: to matrices:
logits_mat in size (dataset, 300, 1231) - top 300 logits for each image.
bboxes_mat in size (dataset, 300, 4) - top 300 bboxes for each image.
labels_mat in size (dataset, 300, 1) - corresponding labels. 300 for each image.
... | 4,643 | en | 0.57095 |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any, Iterable
from optparse import make_option
import logging
import sys
from django.core.management.base import BaseCommand, CommandParser
from zerver.lib import utils
from zerver.models import UserMessage, get_user_pro... | zerver/management/commands/set_message_flags.py | 3,224 | type: (CommandParser) -> None type: (*Any, **Any) -> None type: (Iterable[int]) -> None | 87 | en | 0.410488 |
# coding: utf-8
import errno
import os
import random
import re
from contextlib import contextmanager
import h5py
import numpy as np
import time
import yaml
from datetime import datetime
def write_yaml_file(yaml_dict, file_yaml):
path_yaml = os.path.dirname(file_yaml)
if not os.path.isdir(path_yaml):
... | lib/pb_io.py | 14,837 | test
将一个 HDF5 attr 类转为 Dict 类
:return:
复制 file、dataset 或者 group 的属性
:param pre_object: 被复制属性的 dataset 或者 group
:param out_object: 复制属性的 dataset 或者 group
:return:
path: 要遍历的目录
reg: 符合条件的文件
:param dir_path: 文件夹
:param time_start: 开始时间
:param time_end: 结束时间
:param ext: 后缀名, '.hdf5'
:param pattern: 匹配时间的模式
:return: list
:p... | 2,654 | zh | 0.342058 |
#!/usr/bin/env python3
# purpose: Mimics a simple telnet daemon login prompts and records output
# starts a tcp listener on port and address with variables defined below
# author: Raresteak
# date: 6 October 2021
# version: 3
import datetime
import socket
HOST = '127.0.0.1'
PORT = 2323
FILE = "stn-results.json"
fh = o... | simple-telnet-deception.py | 2,061 | !/usr/bin/env python3 purpose: Mimics a simple telnet daemon login prompts and records output starts a tcp listener on port and address with variables defined below author: Raresteak date: 6 October 2021 version: 3 | 214 | en | 0.617931 |
import unittest
import filecmp
import datetime
from utils import in_tst_dir, in_tst_output_dir
import xlwt as xlwt
ezxf = xlwt.easyxf
def write_xls(file_name, sheet_name, headings, data, heading_xf, data_xfs):
book = xlwt.Workbook()
sheet = book.add_sheet(sheet_name)
rowx = 0
for colx, value in enume... | desktop/core/ext-py/xlwt-1.3.0/tests/test_easyxf.py | 2,253 | frozen headings instead of split panes in general, freeze after last heading row if user does unfreeze, don't leave a split there | 129 | en | 0.862805 |
#!c:\users\jerem\dev\ipp-core\venv\scripts\python.exe
# See http://cens.ioc.ee/projects/f2py2e/
from __future__ import division, print_function
import os
import sys
for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
try:
i = sys.argv.index("--" + mode)
del sys.argv[i]
break
... | venv/Scripts/f2py.py | 793 | !c:\users\jerem\dev\ipp-core\venv\scripts\python.exe See http://cens.ioc.ee/projects/f2py2e/ | 92 | en | 0.394205 |
import sys
sys.path.append('..')
from utilities import jamfconfig
from utilities import apirequests
from computergroups import computergroups
import xml.etree.ElementTree as etree
jss_api_base_url = jamfconfig.getJSS_API_URL()
#print("JSS API Base URL: {}".format(jss_api_base_url))
def cleanupOutput(inputString):
#... | policies/policies_core.py | 9,694 | print("JSS API Base URL: {}".format(jss_api_base_url))print str(inputString)print(username) General Policy Information Policy Scope Information Add Header Row for output for info categories headerRow = "Computer Name, JSS ID" members += [ headerRow ] compID = computer.find('id').textprint computerInfo.encode('ascii', '... | 556 | en | 0.407345 |
from __future__ import annotations
from typing import List, Tuple, Optional
from network_simulator.BloodType import BloodType
from network_simulator.compatibility_markers import OrganType
path_structure = Optional[List[Optional[int]]]
shortest_path_structure = Tuple[path_structure, float]
class Organ:
"""
... | network_simulator/Organ.py | 3,283 | A class representing a given organ which is available for transplant.
Each organ has a name, a unique ID, lifetime (a maximum out of body duration),
type matching, and a location.
Builds an easily readable string representing an organ
:return: str
Gets viability rating for each organ individually
Viability is repres... | 913 | en | 0.858828 |
"""
Example how setup service
"""
from typing import Optional, Any
from orchestrator_service import Message
from orchestrator_service.service import CommandHandlerPostStrategy
from orchestrator_service.service import CommandHandlerStrategy
from orchestrator_service.service import ServiceBlock, ServiceBuilder, ... | examples/example_service.py | 3,623 | Example first command
Custom service
second use case
Example first post process handler
Example second post process handler
Example second command
Example third command
Example how setup service
set to global scope get value from scope example call another command in current type: CommandHandlerStrategy example build... | 765 | en | 0.766457 |
"""
Expose top-level symbols that are safe for import *
"""
from __future__ import print_function, division, absolute_import
import re
from . import testing, decorators
from ._version import get_versions
from . import special, types, config
# Re-export typeof
from .special import *
from .pycc.decorators import export,... | numba/__init__.py | 1,689 | Make sure we meet min llvmpy version
Expose top-level symbols that are safe for import *
Re-export typeof Version Re-export all type names Re export decorators Re export vectorize decorators Re export from_dtype Re-export test entrypoint Try initialize cuda Only look at the the major, minor and bugfix version numbers... | 355 | en | 0.832402 |
from string import ascii_lowercase
import numpy as np
import pandas as pd
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from plotly.colors import hex_to_rgb
from src.timeit import timeit
@timeit
def plotOverTime(FSCPData: pd.DataFrame, FSCPDataSteel: pd.DataFrame, config: dict):
#... | src/plotting/plots/plotOverTime.py | 19,861 | select which lines to plot based on function argument produce figure styling figure year_x == year_y, so we only need one of them from now on return FSCPs for scatter plots return costs and GHGIs for line plots interpolation of plotLines plot add FSCP traces for heating add FSCP traces for steel compute and plot carbon... | 1,103 | en | 0.619502 |
suite = {
"mxversion": "5.156.0",
"name": "truffleruby",
"imports": {
"suites": [
{ # Import only the tools suite which depends on truffle, to avoid duplicating import versions.
# We want tools to be reliably available with TruffleRuby, even with "mx build", so this is a s... | mx.truffleruby/suite.py | 18,164 | Import only the tools suite which depends on truffle, to avoid duplicating import versions. We want tools to be reliably available with TruffleRuby, even with "mx build", so this is a static import. version must always be equal to the version of the "sulong" import below version must always be equal to the version of t... | 2,478 | en | 0.783031 |
import torch
import time
from math import pi
import numpy as np
from ..utils.tensorboard import Tensorboard
from ..utils.output import progress
from .convergence import Convergence
from ..model.deepmod import DeepMoD
from typing import Optional
def train(model: DeepMoD,
data: torch.Tensor,
target... | src/multitaskpinn/training/.ipynb_checkpoints/training-checkpoint.py | 20,082 | [summary]
Args:
model (DeepMoD): [description]
data (torch.Tensor): [description]
target (torch.Tensor): [description]
optimizer ([type]): [description]
sparsity_scheduler ([type]): [description]
log_dir (Optional[str], optional): [description]. Defaults to None.
max_iterations (int, option... | 4,749 | en | 0.619211 |
#!/usr/bin/env python
import paho.mqtt.client as mqtt
import random
from logger import error, info
from message import Message
from pubsub import publish
MQTT_ERR_SUCCESS = 0
# MQTT client wrapper for use with Mainflux.
class MQTT:
# Initialize the class with topics that will be used
# during publish and po... | gateway/kit/mqtt.py | 4,256 | !/usr/bin/env python MQTT client wrapper for use with Mainflux. Initialize the class with topics that will be used during publish and possibly subscribe. Handle topics string or slice. Add randomness to client_id. Connect to the MQTT adapter endpoint and start the internal paho-mqtt loop. Disconnect the client. The cal... | 787 | en | 0.850782 |
from .results import Result
class K4AException(Exception):
pass
class K4ATimeoutException(K4AException):
pass
def _verify_error(res: int):
"""
Validate k4a_module result
"""
res = Result(res)
if res == Result.Failed:
raise K4AException()
elif res == Result.Timeout:
... | deepclaw/driver/sensors/camera/pyk4a_cfg/errors.py | 348 | Validate k4a_module result | 26 | en | 0.076032 |
#!/usr/bin/env python
# Copyright (c) 2014, OpenCog Foundation
# 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/ros_blender_plugin/urdf_exporter.py | 8,421 | !/usr/bin/env python Copyright (c) 2014, OpenCog Foundation All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditio... | 1,951 | en | 0.819433 |
# -*- coding: utf-8 -*-
"""Cisco Identity Services Engine SXPConnections API wrapper.
Copyright (c) 2021 Cisco and/or its affiliates.
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 restr... | ciscoisesdk/api/v3_0_0/sxp_connections.py | 44,100 | Identity Services Engine SXPConnections API (version: 3.0.0).
Wraps the Identity Services Engine SXPConnections
API and exposes the API as native Python
methods that return native Python objects.
Initialize a new SxpConnections
object with the provided RestSession.
Args:
session(RestSession): The RESTful session ... | 16,052 | en | 0.70265 |
# Copyright 2015, 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, s... | bigquery/tests/test_streaming.py | 1,305 | Tests for export_table_to_gcs.
Copyright 2015, 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... | 582 | en | 0.847621 |
import RPi.GPIO as gpio
import time
class Tank:
def __init__(self, name):
self.name = name
def init(self):
gpio.setmode(gpio.BCM)
gpio.setup(17, gpio.OUT)
gpio.setup(22, gpio.OUT)
gpio.setup(23, gpio.OUT)
gpio.setup(24, gpio.OUT)
def forward(self):
... | tank_standalone.py | 1,669 | M1 FWDM1 REVM2 FWDM2 REVtime.sleep(sec)gpio.cleanup() | 53 | en | 0.138989 |
import unittest
from ebird.api.validation import is_subnational1
class IsSubnational1Tests(unittest.TestCase):
"""Tests for the is_subnational1 validation function."""
def test_is_subnational1(self):
self.assertTrue(is_subnational1("US-NV"))
def test_invalid_code_is_not_subnational1(self):
... | tests/validation/test_is_subnational1.py | 721 | Tests for the is_subnational1 validation function. | 50 | en | 0.475348 |
# Copyright (c) 2021 - present / Neuralmagic, 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 b... | tests/sparseml/pytorch/optim/test_modifier_quantization.py | 7,851 | Copyright (c) 2021 - present / Neuralmagic, 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 o... | 972 | en | 0.834052 |
# =============================================================================
# periscope-ps (blipp)
#
# Copyright (c) 2013-2016, Trustees of Indiana University,
# All rights reserved.
#
# This software may be modified and distributed under the terms of the BSD
# license. See the COPYING file for details.
#
# ... | blipp/conf.py | 6,602 | ServiceConfigure is meant to be a generic class for any service
which registers itself to, and gets configuration from UNIS. It
was originally developed for BLiPP, but BLiPP specific features
should be in the BlippConfigure class which extends
ServiceConfigure.
This allows an object which is an instance of this class t... | 1,030 | en | 0.863869 |
# ---
# jupyter:
# jupytext:
# formats: ipynb,py
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.10.3
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
import pandas as pd
from pyrfu... | snitz_2013/main.py | 1,668 | --- jupyter: jupytext: formats: ipynb,py text_representation: extension: .py format_name: light format_version: '1.5' jupytext_version: 1.10.3 kernelspec: display_name: Python 3 language: python name: python3 --- | 260 | en | 0.461704 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Deals with K-mers and K-mer distribution from reads or genome
"""
from __future__ import print_function
import os.path as op
import sys
import logging
import math
import numpy as np
from collections import defaultdict
from jcvi.graphics.base import (
plt,
as... | jcvi/assembly/kmer.py | 27,844 | Analyze Kmer spectrum, calculations derived from
allpathslg/src/kmers/KmerSpectra.cc
%prog bed fastafile kmer.dump.txt
Map kmers on FASTA.
%prog bin filename filename.bin
Serialize counts to bitarrays.
%prog bincount fastafile binfile
Count K-mers in the bin.
%prog count fastafile jf.db
Run dump - jellyfish - bin -... | 3,102 | en | 0.744633 |
import serial
import time
import datetime
import logging
from recordtype import recordtype
from enum import IntEnum, unique
from datetime import timedelta
import _thread
import readchar
import os
import sys
import threading
from collections import deque
import shutil
import binascii
START_CHAR = '02'
... | gateway/dev/sink_integration/main.py | 52,507 | START_BUF = '2a2a2a' this is not really a buffer921600 1000000"/dev/ttyACM0" "/dev/ttyS0"must be the same as in common/inc/contraints.hmust be the same as in common/inc/contraints.h Timeout variables Loggerswith n.lock:self.addPrint("Node "+ n.name + "lastTrickleCount: " + str(n.lastTrickleCount))todo: it seems that ... | 9,930 | en | 0.454368 |
# MIT License
#
# Copyright (C) IBM Corporation 2018
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | art/attacks/elastic_net.py | 17,754 | The elastic net attack of Pin-Yu Chen et al. (2018). Paper link: https://arxiv.org/abs/1709.04114.
Create an ElasticNet attack instance.
:param classifier: A trained model.
:type classifier: :class:`.Classifier`
:param confidence: Confidence of adversarial examples: a higher value produces examples that are farther
... | 7,690 | en | 0.748118 |
# 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/v2019_02_01/operations/_service_endpoint_policy_definitions_operations.py | 24,183 | ServiceEndpointPolicyDefinitionsOperations 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.v2019_0... | 6,678 | en | 0.50671 |
from typing import List, Optional
from .result import Result, Ok, Err
res1 = Ok('hello') # type: Result[str, int]
if isinstance(res1, Ok):
ok = res1 # type: Ok[str]
okValue = res1.ok() # type: str
mapped_to_float = res1.map_or(1.0, lambda s: len(s) * 1.5) # type: float
else:
err = res1 # type: E... | result/typetests.py | 520 | type: Result[str, int] type: Ok[str] type: str type: float type: Err[int] type: int type: Optional[List[int]] Test constructor functions | 136 | en | 0.195438 |
"""PyTorch optimizer builders."""
import argparse
import torch
from espnet.optimizer.factory import OptimizerFactoryInterface
from espnet.optimizer.parser import adadelta
from espnet.optimizer.parser import adam
from espnet.optimizer.parser import sgd
class AdamFactory(OptimizerFactoryInterface):
"""Adam factor... | espnet/optimizer/pytorch.py | 2,469 | Adadelta factory.
Adam factory.
SGD factory.
Register args.
Register args.
Register args.
Initialize optimizer from argparse Namespace.
Args:
target: for pytorch `model.parameters()`,
for chainer `model`
args (argparse.Namespace): parsed command-line args
Initialize optimizer from argparse Namespace.
... | 666 | en | 0.22775 |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from salmonella.admin import SalmonellaMixin
from edw.models.postal_zone import PostZoneModel
# ===========================================================================================
# PostalZoneAdmin
# ============... | backend/edw/admin/postal_zone.py | 712 | -*- coding: utf-8 -*- =========================================================================================== PostalZoneAdmin =========================================================================================== | 221 | en | 0.372749 |
"""The Admin module for the Bower Cache registry."""
import logging
from django import forms
from django.core.exceptions import ValidationError
from django.conf import settings
from django.conf.urls import patterns, url
from django.contrib import admin, messages
from django.contrib.admin.views.main import ChangeList
f... | registry/admin.py | 6,519 | A special form for creating cloned repositories.
A custom add_view, to catch exceptions from 'save_model'.
Just to be clear, this is very filthy.
Validate the new repo form.
Might perform a request to upstream Bower.
Hide the origin field from editing, but not creation.
Perform a git pull and redirect back to the rep... | 654 | en | 0.844478 |
import re
from typing import Pattern
from unittest import mock
import pytest
from faker import Faker, providers
from faker.providers.address.cs_CZ import Provider as CsCzAddressProvider
from faker.providers.address.da_DK import Provider as DaDkAddressProvider
from faker.providers.address.de_AT import Provider as DeA... | tests/providers/test_address.py | 68,001 | Test address provider methods
Test cs_CZ address provider methods
Test dk_DK address provider methods
Test de_AT address provider methods
Test de_CH address provider methods
Test de_DE address provider methods
Test el_GR address provider methods
Test en_AU address provider methods
Test en_CA address provider methods
Te... | 2,310 | en | 0.807301 |
from map.models import *
import requests
# initialize geo_info table, used to show choropleth map
def run():
try:
response = requests.get('http://www.ourd3js.com/map/china_provinces/beijing.json')
json_result = response.json()
for area in json_result.get('features'):
properties... | scripts/geoinfo.py | 586 | initialize geo_info table, used to show choropleth map | 54 | en | 0.328543 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# type: ignore
import copy
import os
import platform
from dataclasses import dataclass
from pathlib import Path
from typing import List
import nox
from nox.logger import logger
BASE = os.path.abspath(os.path.dirname(__file__))
DEFAULT_PYTHON_VERS... | noxfile.py | 15,088 | Select all plugins that should be tested in this session.
Considers the current Python version and operating systems against the supported ones,
as well as the user plugins selection (via the PLUGINS environment variable).
Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved type: ignore Allow limitin... | 1,377 | en | 0.899005 |
#vim: set encoding=utf-8
from django.core.urlresolvers import reverse
from django.http import Http404
from django.views.generic.base import TemplateView
from regulations.generator import generator
from regulations.generator.html_builder import HTMLBuilder
from regulations.generator.node_types import EMPTYPART, REGTEXT... | regulations/views/partial.py | 4,836 | Single paragraph of a regtext formatted for display
as an inline interpretation
Single paragraph of a regtext
Entire regulation without chrome
Single section of reg text
Base class of various partial markup views. sectional_links indicates
whether this view should use section links (url to a path) or just hash
link... | 634 | en | 0.800392 |
# -*- coding: utf-8 -*-
import unittest
from pathlib import Path
from knipse.db import KnipseDB
from knipse.scan import scan_images
from knipse.lists import image_id_from_string
from .test_walk import EXPECTED_IMAGES
class TestKnipseDatabase(unittest.TestCase):
def setUp(self) -> None:
self.src = Path(... | tests/test_lists.py | 998 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
import user
import db
if __name__ == "__main__":
# Initializes the database if it doesn't already exist
engine = db.open_db('maintenance.db')
db.create_tables(engine)
# TODO: Make this selectable with arrow keys
while True:
print('\nSelect an option:\n1. View Service History\n2. Add a Car\n3. Add a Serv... | src/main.py | 566 | Initializes the database if it doesn't already exist TODO: Make this selectable with arrow keys | 95 | en | 0.804921 |
#!/usr/bin/env python
import logging
from typing import (
Optional,
Dict,
List, Any)
from hummingbot.core.data_type.order_book import OrderBook
from sqlalchemy.engine import RowProxy
import hummingbot.connector.exchange.binarz.binarz_constants as constants
from hummingbot.connector.exchange.binarz.binarz... | hummingbot/connector/exchange/binarz/binarz_order_book.py | 4,716 | *used for backtesting
Convert a row of diff data into standard OrderBookMessage format
:param record: a row of diff data from the database
:return: BinarzBookMessage
Convert json diff data into standard OrderBookMessage format
:param msg: json diff data from live web socket stream
:param timestamp: timestamp attached t... | 1,005 | en | 0.623199 |
import pygame
class TextSprite(pygame.sprite.Sprite):
"""Subclass of sprite to draw text to the screen"""
def __init__(self, position, text_lines, font, fg=(0, 0, 0), bg=None,
border_width=0, border_color=(0, 0, 0),
bold=False, italic=False, underline=False,
... | text_sprite.py | 2,344 | Subclass of sprite to draw text to the screen
Render all lines of text Find the largest width line of text Produce an image to hold all of the text strings Store the last rect so if the new one is smaller we can update those bits of the screen too | 249 | en | 0.834724 |
#!/usr/bin/env python
u"""
combine_kernels.py
by Yara Mohajerani
Combine the sensitivity kernels of the sum of the 'fixed points'
and produce netcdf and png outputs
Last Update 12/2020
"""
#-- load required modules
import os
import sys
import numpy as np
import geopandas as gpd
import matplotlib.pyplot as plt
from mp... | combine_kernels.py | 4,209 | combine_kernels.py
by Yara Mohajerani
Combine the sensitivity kernels of the sum of the 'fixed points'
and produce netcdf and png outputs
Last Update 12/2020
!/usr/bin/env python-- load required modules-- also import gravity toolkit modules-----------------------------------------------------------------------------... | 1,786 | en | 0.311202 |
# coding: utf8
"""
Delphi Decision Maker - Controllers
"""
module = request.controller
resourcename = request.function
if not settings.has_module(module):
raise HTTP(404, body="Module disabled: %s" % module)
# =============================================================================
def index():
"""... | controllers/delphi.py | 45,285 | Utility function used by Scale of Results
Looks up the Unit Normal Deviation based on the Z-Score (Proportion/Probability)
http://en.wikipedia.org/wiki/Standard_normal_table
@ToDo: Move to S3Statistics module
Parse a Comment
@param: comment - a gluon.sql.Row: the current comment
@param: comments - a gluon.sql.Rows: ... | 6,274 | en | 0.6501 |
#Copyright (c) 2013 Marion Zepf
#Copyright (c) 2014 Walter Bender
#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, mod... | TurtleArt/tatype.py | 15,843 | TypeError with the types from the hierarchy, not with Python types
A type in the type hierarchy.
Disjunction of two or more Types (from the type hierarchy)
Like a Call AST, but with a return type
Like a Name AST, but with a type
Like a Subscript AST, but with a type
constant_name -- the name of the constant that ... | 4,396 | en | 0.809966 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Cisco Systems
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r"""
---
module: anc_endpoint_apply
short_description: Resource module for Anc Endpoint Apply
description:
- Manage operation updat... | venv/lib/python3.8/site-packages/ansible_collections/cisco/ise/plugins/modules/anc_endpoint_apply.py | 1,583 | !/usr/bin/python -*- coding: utf-8 -*- Copyright (c) 2021, Cisco Systems GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt) | 163 | en | 0.65351 |
# -*- coding:utf-8 -*-
# =========================================================================== #
# Project : MLStudio #
# File : \test_preprocessing.py #
# Python : 3.8.3 ... | tests/test_data_services/test_preprocessing.py | 7,863 | Tests data preprocessing pipeline.
-*- coding:utf-8 -*- =========================================================================== Project : MLStudio File : \test_preprocessing.py Python : 3.8.3 ... | 1,443 | en | 0.37802 |
# -*- coding: utf-8 -*-
# TheQube profile dialog
# A part of TheQube accessible social networking client
# Copyright © Andre Polykanine A.K.A. Menelion Elensúlë, 2014 — 2015
from logger import logger
logging = logger.getChild("sessions.twitter.gui.profile")
import config
import sessions
import wx
from ... | src/session/twitter/gui/profile.py | 6,565 | -*- coding: utf-8 -*- TheQube profile dialog A part of TheQube accessible social networking client Copyright © Andre Polykanine A.K.A. Menelion Elensúlë, 2014 — 2015 | 165 | en | 0.701812 |
#
# 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... | airflow/sensors/base_sensor_operator.py | 9,231 | Sensor operators are derived from this class and inherit these attributes.
Sensor operators keep executing at a time interval and succeed when
a criteria is met and fail if and when they time out.
:param soft_fail: Set to true to mark the task as SKIPPED on failure
:type soft_fail: bool
:param poke_interval: Time in ... | 3,185 | en | 0.884103 |
import numpy as np
import matplotlib.pyplot as plt
import bisect
from lmfit import Parameters
import astropy.constants as cst
from edibles.models import ContinuumModel, VoigtModel
from edibles.utils.edibles_spectrum import EdiblesSpectrum
class Sightline:
'''A model of the sightline between the telescope and the... | edibles/sightline.py | 15,433 | A model of the sightline between the telescope and the target star.
Args:
Spectrum (EdiblesSpectrum): The input spectrum object
n_anchors (int): Optional, The number of anchors in the ContinuumSpline
Adds a new line to a given absorption source.
If no source is given, a new one will be created.
Args:
name... | 2,561 | en | 0.579832 |
# _tmp_
import datetime
from copy import deepcopy
# _tmp_
from pymongo import MongoClient
import pymongo
import pandas as pd
import numpy as np
import sys
pd.options.mode.chained_assignment = None
class AnalyzerDatabaseManager(object):
def __init__(self, db_config, config):
self._db_config = db_config
... | analysis_module/analyzer/AnalyzerDatabaseManager_tmp.py | 29,763 | _tmp_ _tmp_ create connection nested fields need to be projected (select field from client if, exists, else from producer) conditions to filter the data before processing set up elements to group by (service call fields and temporal aggregation window) _tmp_ print(datetime.datetime.now().strftime('%H:%M:%s') + " aggre... | 3,126 | en | 0.691746 |
import asyncio
from typing import List
import pytest
from hddcoin.consensus.block_rewards import calculate_base_farmer_reward, calculate_pool_reward
from hddcoin.full_node.mempool_manager import MempoolManager
from hddcoin.simulator.simulator_protocol import FarmNewBlockProtocol
from hddcoin.types.blockchain_format.c... | tests/wallet/cc_wallet/test_cc_wallet.py | 23,822 | 1) Generate transaction that is under the limit 2) Generate transaction that is equal to limit 3) Generate transaction that is greater than limit | 145 | en | 0.878675 |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 6 11:37:06 2018
@author: dkorff
"""
import numpy as np
import cantera as ct
from assimulo.problem import Implicit_Problem
from li_ion_battery_p2d_init import anode as an
from li_ion_battery_p2d_init import cathode as cat
from li_ion_battery_p2d_init import separator as... | li_ion_battery_p2d_functions.py | 22,680 | =================================================================
Created on Thu Dec 6 11:37:06 2018
@author: dkorff
-*- coding: utf-8 -*-sigma_eff_an = an.params['sigma_eff_ed']; dyInv = an.geom['dyInv']u_Li_elyte = an.params['u_Li_elyte']; D_Li_an = an.params['D_Li_ed']dr = an.dr %% -----------------------------... | 9,839 | en | 0.233797 |
import asyncio
import discord
from discord.ext.commands import Bot
from discord.ext import commands
from discord import Color, Embed
import backend.commands as db
from backend import strikechannel
# This command allows players to change their name.
#
# !name [new_name]
#
# This replaces the default nickname changin... | commands/name.py | 1,711 | This command allows players to change their name. !name [new_name] This replaces the default nickname changing that Discord provides so that their name will also be replaced in the spreadsheet. This changes their name in the "strikes" channel | 242 | en | 0.936308 |
# (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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/LI... | cinder/tests/fake_hp_lefthand_client.py | 969 | Fake HP client for testing LeftHand without installing the client.
(c) Copyright 2014 Hewlett-Packard Development Company, L.P. 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... | 703 | en | 0.861639 |
FROM = 'vie-qs'
TO = 'fee-qs'
from_layer = Font.glyphs[FROM].layers[0]
XHEIGHT = Font.masters[0].xHeight
WIDTH = Font.masters[0].widthValue
to_layer = Font.glyphs[TO].layers[0] = from_layer.copyDecomposedLayer()
for path in to_layer.paths:
for node in path.nodes:
# mess with node.x and node.y
... | glyph-generation scripts/vie2fee.py | 476 | mess with node.x and node.y doesn't seem to work get rid of tail | 64 | en | 0.988851 |
import torch
import numpy as np
class ScheduledOptim:
""" A simple wrapper class for learning rate scheduling """
def __init__(self, model, train_config, model_config, current_step):
self._optimizer = torch.optim.Adam(
model.parameters(),
betas=train_config["optimi... | FastSpeech2/model/optimizer.py | 1,728 | A simple wrapper class for learning rate scheduling
Learning rate scheduling per step
print(self.init_lr) | 109 | en | 0.519714 |
#!/usr/bin/env python
"""
Analyze docstrings to detect errors.
If no argument is provided, it does a quick check of docstrings and returns
a csv with all API functions and results of basic checks.
If a function or method is provided in the form "pandas.function",
"pandas.module.class.method", etc. a list of all error... | scripts/validate_docstrings.py | 18,846 | Validate the docstring for the given func_name
Parameters
----------
func_name : function
Function whose docstring will be evaluated
Returns
-------
int
The number of errors found in the `func_name` docstring
Analyze docstrings to detect errors.
If no argument is provided, it does a quick check of docstrings... | 1,034 | en | 0.578978 |
import subprocess
import math
import os
from pipes import quote
import platform
class Sorolla:
"""
Main class which will launch ImageMagick commands to apply selected
transformations to the given images.
It needs ImageMagick & GhostScript installed in the system and in PATH
to work properly
""... | sorolla/sorolla.py | 11,751 | Default base density in dpi, set by Imagemagick Not a resource identified as nine-patch Scales a vector resource to the desired density Resource defined as nine-patch Attributes used in Imagemagick command The following ImageMagick command works as follows (each step generates a temporary image) 0. Tell convert the ima... | 1,982 | en | 0.754653 |
#%%
# Our numerical workhorses
import numpy as np
import pandas as pd
import itertools
# Import libraries to parallelize processes
from joblib import Parallel, delayed
# Import matplotlib stuff for plotting
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib as mpl
# Seaborn, useful for grap... | src/theory/scripts/channcap_protein_multi_prom_iptg_range.py | 2,701 | %% Our numerical workhorses Import libraries to parallelize processes Import matplotlib stuff for plotting Seaborn, useful for graphics Pickle is useful for saving outputs that are computationally expensive to obtain every time Import the project utils%% Find home directory for repo Read MaxEnt distributions Define dic... | 842 | en | 0.735934 |
from settings import settings
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.caml_query import CamlQuery
from office365.sharepoint.client_context import ClientContext
list_title = "Survey"
view_title = "All Responses"
def print_list_views(ctx):
"""Read l... | examples/sharepoint/view_operations.py | 1,946 | Read list view by title example
Example demonstrates how to retrieve View items
print "View title: {0}".format(view.Properties["Title"]) 1.get View query 2.get View fields 3.get items for View query print_list_views(ctx) | 222 | en | 0.544039 |
from transform import Transform
import tensorflow as tf
class StyleTransferTester:
def __init__(self, session, content_image, model_path):
# session
self.sess = session
# input images
self.x0 = content_image
# input model
self.model_path = model_path
# ... | style_transfer_tester.py | 1,240 | session input images input model image transform network build graph for style transfer graph input add one dim for batch result image from transform-net remove one dim for batch initialize parameters load pre-trained model get transformed image | 245 | en | 0.60208 |
from django.db import models
from .validators import validate_resume_ext
class Resume(models.Model):
name = models.CharField(max_length = 20)
phone = models.IntegerField()
email = models.EmailField()
resume = models.FileField(upload_to='resume/%Y/%m/%d/', validators=[validate_resume_ext])
uploaded_... | rapidez/resumeAnalysis/models.py | 406 | Add name, phone number and email fields | 39 | en | 0.516668 |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | docs/source/conf.py | 1,906 | Configuration file for the Sphinx documentation builder. This file only contains a selection of the most common options. For a full list see the documentation: https://www.sphinx-doc.org/en/master/usage/configuration.html -- Path setup -------------------------------------------------------------- If extensions (or mod... | 1,578 | en | 0.665531 |
# -*- coding: utf-8 -*-
if __name__ == "__main__":
raise Exception("Test files can't be run directly. Use `python -m pytest greenery`")
import pytest
from greenery.fsm import fsm, null, epsilon, anything_else
def test_addbug():
# Odd bug with fsm.__add__(), exposed by "[bc]*c"
int5A = fsm(
alphabet = {"a", "b",... | greenery/fsm_test.py | 18,126 | You may now omit a transition, or even an entire state, from the map. This
affects every usage of `fsm.map`.
-*- coding: utf-8 -*- Odd bug with fsm.__add__(), exposed by "[bc]*c" assert int5C.initial == 0 accepts "ab" accepts "(ab)? accepts "(ab)?(ab)?" this is "0*1" in heavy disguise. crawl should resolve this dupli... | 2,264 | en | 0.90102 |
"""Tools for constructing domains for expressions. """
from sympy.core import sympify
from sympy.core.evalf import pure_complex
from sympy.polys.domains import ZZ, QQ, ZZ_I, QQ_I, EX
from sympy.polys.domains.complexfield import ComplexField
from sympy.polys.domains.realfield import RealField
from sympy.polys.polyopti... | sympy/polys/constructor.py | 8,617 | We know that coefficients are algebraic so construct the extension.
Handle composite domains, e.g.: ZZ[X], QQ[X], ZZ(X), QQ(X).
The last resort case, i.e. use the expression domain.
Handle simple domains, e.g.: ZZ, QQ, RR and algebraic domains.
Construct a minimal domain for the list of coefficients.
Tools for con... | 673 | en | 0.805541 |
import keras
import os
from keras import losses
from keras.models import Model
from keras.layers import Input,merge, concatenate, Conv2D, MaxPooling2D, Activation, UpSampling2D,Dropout,Conv2DTranspose,add,multiply,Flatten,Dense
from keras.layers.normalization import BatchNormalization as bn
from keras.callbacks import ... | src/models/final_model.py | 14,199 | thie function initializes the network class
:param images_dir:
:param clustering_dir:
:param classfication_dir:
this function loads model from file
this function runs the prediction over the sets
:return:
this function trains the final network
:return:
branch 2xmerge1=concatenate([flatten_block,inputtwo])branch 3... | 424 | en | 0.603707 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.