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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from .amount import Amount
from .instance import BlockchainInstance
from graphenecommon.account import (
Account as GrapheneAccount,
AccountUpdate as GrapheneAccountUpdate,
)
from bitsharesbase import operations
@BlockchainInstance.inject
class Account(GrapheneAccount):
"""
Thi... | bitshares/account.py | 2,854 | This class allows to easily access Account data.
:param str account_name: Name of the account
:param bitshares.bitshares.BitShares blockchain_instance: BitShares
instance
:param bool full: Obtain all account data including orders, positions, etc.
:param bool lazy: Use lazy loading
:param bool full: Obtain all a... | 1,590 | en | 0.720109 |
"""BGEN reader implementation (using bgen_reader)"""
import logging
import tempfile
import time
from pathlib import Path
from typing import (
Any,
Dict,
Hashable,
List,
Mapping,
MutableMapping,
Optional,
Tuple,
Union,
)
import dask
import dask.array as da
import dask.dataframe as dd... | sgkit/io/bgen/bgen_reader.py | 22,582 | Fetch or generate sample ids
Calculate the dosage from genotype likelihoods (probabilities)
Convert a BGEN file to a Zarr on-disk store.
This function is a convenience for calling :func:`read_bgen` followed by
:func:`rechunk_bgen`.
Parameters
----------
input
Path to local BGEN dataset.
output
Zarr store or p... | 7,902 | en | 0.7659 |
import inspect
import os
import pyperclip
import requests
import time
from urllib.parse import quote
# a list of the request error classes
request_errors = [obj for name, obj in inspect.getmembers(requests.exceptions)
if inspect.isclass(obj) and issubclass(obj, Exception)]
# main daemon loop
while Tr... | autoshort.py | 1,294 | a list of the request error classes main daemon loop get clipboard value percent encode the clipboard value bitly API access token URL that will make the API call get the json return from the API call if everything went as planned if something went wrong with the request, i.e. not a link wait until the clipboard change... | 321 | en | 0.800042 |
# source ./venv/bin/activate
# ===============================================================
# =============================COOL==============================
# ===============================================================
import sys
from general import errors
# import os
# basedir = os.path.abspath(os... | src/coolc.py | 5,198 | source ./venv/bin/activate =============================================================== =============================COOL============================== =============================================================== import os basedir = os.path.abspath(os.path.dirname(__file__)) ======================================... | 1,901 | en | 0.389898 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | google/cloud/compute_v1/services/target_instances/pagers.py | 5,740 | A pager for iterating through ``aggregated_list`` requests.
This class thinly wraps an initial
:class:`google.cloud.compute_v1.types.TargetInstanceAggregatedList` object, and
provides an ``__iter__`` method to iterate through its
``items`` field.
If there are more pages, the ``__iter__`` method will make additional
`... | 2,796 | en | 0.829502 |
import os
import subprocess
from tempfile import NamedTemporaryFile
from torch.distributed import get_rank
from torch.distributed import get_world_size
from torch.utils.data.sampler import Sampler
import librosa
import numpy as np
import scipy.signal
import torch
from scipy.io.wavfile import read
import math
from tor... | data/data_loader.py | 14,446 | Adds noise to an input signal with specific SNR. Higher the noise level, the more noise added.
Modified code from https://github.com/willfrey/audio/blob/master/torchaudio/transforms.py
Parses audio file into spectrogram with optional normalization and various augmentations
:param audio_conf: Dictionary containing the s... | 2,970 | en | 0.705064 |
# -*- coding: utf8 -*-
def filter_event(event, happening_before):
"""Check if the following keys are present. These
keys only show up when using the API. If fetching
from the iCal, JSON, or RSS feeds it will just compare
the dates
"""
status = True
visibility = True
actions = True
... | app/Meetup/Filter.py | 651 | Check if the following keys are present. These
keys only show up when using the API. If fetching
from the iCal, JSON, or RSS feeds it will just compare
the dates
-*- coding: utf8 -*- | 184 | en | 0.75818 |
import csv
from pathlib import Path
import torch
import pandas
import numpy as np
from utils import peek, load_json, dump_json
from .module import ContrastiveModule
from mps import distributed as du
from save import format_rows
def get_penultimates(keys):
penultimates = {}
for key in keys:
view = ke... | subset_selection/code/measures/contrastive/contrastive.py | 10,201 | get dataset+model name sizes = self.get_sizes(train) video (slowfast) : 2304, audio (VGGish) : 128 | 98 | en | 0.505707 |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test pricecoind with different proxy configuration.
Test plan:
- Start pricecoind's with different pro... | test/functional/feature_proxy.py | 8,356 | Test pricecoind with different proxy configuration.
Test plan:
- Start pricecoind's with different proxy configurations
- Use addnode to initiate connections
- Verify that proxies are connected to, and the right connection command is given
- Proxy configurations to test on pricecoind side:
- `-proxy` (proxy everyt... | 1,997 | en | 0.755281 |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2021 Showa Denko Materials co., Ltd. All rights reserved.
This software is for non-profit use only.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PU... | Samples/codes/matopt_review/add_objective.py | 2,232 | Class to handle problems with multiple objective functions.
param func: objective function.
param n_obj: number of objective functions
param num_cores: number of cores to use in the process of evaluating the objective (default, 1).
param objective_name: name of the objective function.
param batch_type: Type of batch u... | 1,196 | en | 0.842729 |
"""
Given a rod of length n inches and an array of prices
that includes prices of all pieces of size smaller than n.
Determine the maximum value obtainable by cutting up the rod and
selling the pieces. For example, if the length of the rod is 8
and the values of different pieces are given as the following,
then the... | DynamicProgramming/UnBoundedKnapSack/RodCutting.py | 1,126 | Given a rod of length n inches and an array of prices
that includes prices of all pieces of size smaller than n.
Determine the maximum value obtainable by cutting up the rod and
selling the pieces. For example, if the length of the rod is 8
and the values of different pieces are given as the following,
then the max... | 677 | en | 0.852099 |
"""Classes for validating data passed to the annotations API."""
import copy
import colander
from dateutil.parser import parse
from pyramid import i18n
from h.schemas.base import JSONSchema, ValidationError
from h.search.query import LIMIT_DEFAULT, LIMIT_MAX, OFFSET_MAX
from h.search.util import wildcard_uri_is_valid... | h/schemas/annotation.py | 16,107 | Validate an annotation object.
Validate the POSTed data of a create annotation request.
Validate the POSTed data of an update annotation request.
Return True if date is parsable and False otherwise.
Return document meta and document URI data from the given document dict.
Transforms the "document" dict that the client ... | 2,010 | en | 0.853505 |
import tensorflow as tf
import tensorflow_zero_out
import numpy as np
import os
# Create a model using low-level tf.* APIs
class ZeroOut(tf.Module):
@tf.function(input_signature=[tf.TensorSpec(shape=[None], dtype=tf.int32)])
def __call__(self, x):
return tensorflow_zero_out.zero_out(x)
model = ZeroOut()
# (ro... | tensorflow_zero_out/python/ops/convert_to_tflite.py | 1,026 | Create a model using low-level tf.* APIs (ro run your model) result = Squared(5.0) This prints "25.0" (to generate a SavedModel) tf.saved_model.save(model, "saved_model_tf_dir") Convert the model. Notes that for the versions earlier than TensorFlow 2.7, the from_concrete_functions API is able to work when there is onl... | 442 | en | 0.612686 |
# -*- coding: utf-8 -*-
#
# Author: oldj
# Email: oldj.wu@gmail.com
# Blog: http://oldj.net
#
import os
import re
import StringIO
from PIL import Image
from PIL import ImageDraw
import pygame
g_script_folder = os.path.dirname(os.path.abspath(__file__))
g_fonts_folder = os.path.join(g_script_folder, "fonts")
g_re_fir... | hard-gists/9c4d012d6fff059ccea7/snippet.py | 8,249 | 绘制边框
绘制版权信息
将一行文本转为单词列表
将一个长行分成多个可显示的短行
-*- coding: utf-8 -*- Author: oldj Email: oldj.wu@gmail.com Blog: http://oldj.net 标点 单词 标点 百分数 pxpxpx px px "font-family": "msyh.ttf", 字体是否反锯齿 版权信息居中显示,如为 False 则居左显示 txt = u"测试汉字abc123" txt = txt.decode("utf-8") 处理一个长单词或长数字 去掉长行的第二行开始的行首的空白字符 dr.text((... | 482 | zh | 0.539499 |
###
# (C) Copyright [2019-2020] Hewlett Packard Enterprise Development LP
#
# 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 ... | examples/policies.py | 4,181 | (C) Copyright [2019-2020] Hewlett Packard Enterprise Development LP 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... | 587 | en | 0.852934 |
# Copyright 2014-2016 MongoDB, 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 writin... | motor/frameworks/tornado/__init__.py | 3,854 | Compatible way to return a value in all Pythons.
PEP 479, raise StopIteration(value) from a coroutine won't work forever,
but "return value" doesn't work in Python 2. Instead, Motor methods that
return values resolve a Future with it, and are implemented with callbacks
rather than a coroutine internally.
Executes the ... | 1,219 | en | 0.848029 |
# -*- coding: utf-8 -*-
"""Collection of useful http error for the Api"""
class JsonApiException(Exception):
"""Base exception class for unknown errors"""
title = "Unknown error"
status = "500"
source = None
def __init__(
self,
detail,
source=None,
title=None,
... | flapison/exceptions.py | 3,516 | Throw this error when requested resource owner doesn't match the user of the ticket
BadRequest error
When the request expects a content type that the API doesn't support
When the request uses a content type the API doesn't understand
Error to warn that a field specified in fields querystring is not in the requested res... | 1,144 | en | 0.766823 |
import argparse
import logging
import json
import os
import tempfile
import sys
import re
import flywheel
from .supporting_files import bidsify_flywheel, utils, templates
from .supporting_files.project_tree import get_project_tree
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('curate-bids')
def... | flywheel_bids/curate_bids.py | 9,721 | fw: Flywheel client
project_id: project id of project to curate
session_id: The optional session id to curate
reset: Whether or not to reset bids info before curation
template_file: The template file to use
session_only: If true, then only curate the provided session
Update file information
Validate meta informat... | 1,934 | en | 0.546357 |
class PlayerResourceHand:
def __init__(self):
self.brick = 0
self.grain = 0
self.lumber = 0
self.ore = 0
self.wool = 0
self.totalResources = 0
def update(self):
self.totalResources = self.brick + self.grain + self.lumber + self.ore + self.wool
class Pla... | src/Player.py | 2,781 | toSend = EnemyPlayer(self.turnOrder, self.name, self.color, self.numRoads, self.numSettlements, self.numCities, self.longestRoad, self.largestArmy) | 189 | en | 0.412251 |
from typing import Optional
import pandas as pd
import pytest
from evidently.analyzers.regression_performance_analyzer import RegressionPerformanceAnalyzer
from evidently.model.widget import BaseWidgetInfo
from evidently.options import OptionsProvider
from evidently.pipeline.column_mapping import ColumnMapping
from ... | tests/dashboard/widgets/test_reg_error_normality_widget.py | 2,465 | we have some widget for visualization no widget data, show nothing | 66 | en | 0.780228 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/faction_perk/hq/shared_hq_s05.iff"
result.attribute_template_i... | data/scripts/templates/object/tangible/deed/faction_perk/hq/shared_hq_s05.py | 441 | NOTICE: THIS FILE IS AUTOGENERATED MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES BEGIN MODIFICATIONS END MODIFICATIONS | 168 | en | 0.698026 |
# -*- coding: utf-8 -*-
import unittest.mock
import pytest
import pycamunda.incident
from tests.mock import raise_requests_exception_mock, not_ok_response_mock
def test_get_params(engine_url):
get_incident = pycamunda.incident.Get(url=engine_url, id_='anId')
assert get_incident.url == engine_url + '/incid... | tests/incident/test_get.py | 1,879 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
import uuid
from datetime import datetime, timedelta
import pytest
import simplejson as json
from django.db.models import Q
from mock import Mock, patch
from treeherder.config.settings import IS_WINDOWS
from treeherder.perf.auto_perf_sheriffing.secretary_tool import SecretaryTool
from treeherder.model.models import P... | tests/perfalert/test_auto_perf_sheriffing/test_secretary_tool.py | 10,199 | we're testing against this (automatically provided by fixtures) get middle index to make sure the push is in range create new report with records create mature report with records TODO: retarget this test to BackfillRecord.get_pushes_in_range() change repository for the first 2 pushes in range TODO: remove job type moc... | 345 | en | 0.843468 |
#!/usr/bin/env python3
# This scripts attempts to generate massive design of experiment runscripts.
# and save it into a "runMassive.sh" and "doe.log".
#-------------------------------------------------------------------------------
import os, sys
import os.path
import re
import itertools
import glob
PUBLIC = ['... | genMassive.py | 14,774 | !/usr/bin/env python3 This scripts attempts to generate massive design of experiment runscripts. and save it into a "runMassive.sh" and "doe.log". ------------------------------------------------------------------------------- The number of generated config files into designs/{platform}/{design}/chunks/chuck{number} d... | 3,595 | en | 0.56749 |
from integration.helpers.base_test import BaseTest
class TestBasicLayerVersion(BaseTest):
"""
Basic AWS::Serverless::StateMachine tests
"""
def test_basic_state_machine_inline_definition(self):
"""
Creates a State Machine from inline definition
"""
self.create_and_veri... | integration/single/test_basic_state_machine.py | 1,305 | Basic AWS::Serverless::StateMachine tests
Verifies the presence of a tag and its value
Parameters
----------
tags : List of dict
List of tag objects
key : string
Tag key
value : string
Tag value
Creates a State Machine from inline definition
Creates a State Machine with tags | 288 | en | 0.417277 |
from __future__ import absolute_import
from .context import *
from .base_verbs import *
from .model import OpenShiftPythonException
from .model import Model, Missing
from .selector import *
from .apiobject import *
from . import naming
from . import status
from . import config
from .ansible import ansible
# Single so... | packages/openshift/__init__.py | 653 | Single source for module version Allow scripts to specify null in object definitions Allows modules to trigger errors Convenience method for accessing the module version | 169 | en | 0.372833 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test attention
"""
import unittest
import torch
from torch import tensor
from torch import nn
from function_GAT_attention import SpGraphAttentionLayer, ODEFuncAtt
from torch_geometric.utils import softmax, to_dense_adj
from data import get_dataset
class AttentionTests... | test/test_attention.py | 4,344 | Test attention
!/usr/bin/env python -*- coding: utf-8 -*- should be n_edges x n_heads should be n_edges x n_heads should be n_edges x n_heads | 142 | en | 0.761891 |
"""Platform for Husqvarna Automower device tracker integration."""
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.helpers.entity import DeviceInfo
from .const import DOMAIN
async def async_s... | custom_components/husqvarna_automower/device_tracker.py | 2,238 | Defining the Device Tracker Entity.
Return latitude value of the device.
Return longitude value of the device.
Return the name of the entity.
Return the source type, eg gps or router, of the device.
Return a unique identifier for this entity.
Platform for Husqvarna Automower device tracker integration. | 303 | en | 0.557116 |
# _*_ coding: utf-8 _*_
__author__ = 'Di Meng'
__date__ = '1/3/2018 10:16 PM'
# _*_ coding: utf-8 _*_
__author__ = 'Di Meng'
__date__ = '1/3/2018 9:26 PM'
from tutorial.feature_functions import *
import pandas as pd
import plotly as py
import json
from plotly import tools
import plotly.graph_objs as go
#loading our... | finance/tutorial/tester.py | 1,507 | _*_ coding: utf-8 _*_ _*_ coding: utf-8 _*_loading our datamoving average detrended = detrend(df, method='difference') f = fourier(df, [10, 15],method='difference')HA HAresults = candles(df, [1]) HA = HAresults.candles[1]wad draw grarphs linear detrand plot trace2 = go.Scatter(x=df.index, y=detrended) difference detran... | 371 | en | 0.490989 |
#!/usr/bin/env python3
"""Run AFL repeatedly with externally supplied generated packet from STDIN."""
import logging
import sys
from ryu.controller import dpset
from faucet import faucet
from faucet import faucet_experimental_api
import afl
import fake_packet
ROUNDS = 1
logging.disable(logging.CRITICAL)
def main()... | tests/fuzzer/fuzz_packet.py | 1,477 | Run AFL repeatedly with externally supplied generated packet from STDIN.
Run AFL repeatedly with externally supplied generated packet from STDIN.
!/usr/bin/env python3 make sure dps are running receive input from afl pytype: disable=missing-parameter create fake packet send fake packet to faucet | 297 | en | 0.864777 |
import logging
import warnings
lcb_min_version_baseline = (2, 9, 0)
def get_lcb_min_version():
result = lcb_min_version_baseline
try:
# check the version listed in README.rst isn't greater than lcb_min_version
# bump it up to the specified version if it is
import docutils.parsers.rst
... | lcb_version.py | 1,231 | check the version listed in README.rst isn't greater than lcb_min_version bump it up to the specified version if it is | 118 | en | 0.849062 |
# Generated by Django 2.2.5 on 2019-11-10 02:46
from django.db import migrations
import django.db.models.deletion
import smart_selects.db_fields
class Migration(migrations.Migration):
dependencies = [
('main_site', '0014_auto_20191109_2038'),
]
operations = [
migrations.AlterField(
... | plants_api/main_site/migrations/0015_auto_20191109_2046.py | 944 | Generated by Django 2.2.5 on 2019-11-10 02:46 | 45 | en | 0.569301 |
import requests
import json
from datetime import datetime, timezone
from . utils import _extract_videos_necessary_details, _save_video_detils_in_db
from .models import ApiKeys
from . import config
def _get_api_key(): #getting different key w.r.t last used every time cron job starts.(load balanced)
new_key = ApiKe... | youtubeDataApi/searchApi/cron.py | 1,093 | getting different key w.r.t last used every time cron job starts.(load balanced) | 80 | en | 0.791013 |
"""
Structured information on a coordinate point.
"""
# this file was auto-generated
from datetime import date, datetime
from fairgraph.base_v3 import EmbeddedMetadata, IRI
from fairgraph.fields import Field
class CoordinatePoint(EmbeddedMetadata):
"""
Structured information on a coordinate point.
"""... | fairgraph/openminds/sands/miscellaneous/coordinate_point.py | 1,163 | Structured information on a coordinate point.
Structured information on a coordinate point.
this file was auto-generated | 122 | en | 0.88305 |
# coding=utf-8
from pyecharts.chart import Chart
def kline_tooltip_formatter(params):
text = (
params[0].seriesName
+ "<br/>"
+ "- open:"
+ params[0].data[1]
+ "<br/>"
+ "- close:"
+ params[0].data[2]
+ "<br/>"
+ "- lowest:"
... | venv/lib/python3.7/site-packages/pyecharts/charts/kline.py | 2,347 | <<< K 线图 >>>
红涨蓝跌
:param name:
系列名称,用于 tooltip 的显示,legend 的图例筛选。
:param x_axis:
x 坐标轴数据。
:param y_axis:
y 坐标轴数据。数据中,每一行是一个『数据项』,每一列属于一个『维度』。
数据项具体为 [open, close, lowest, highest] (即:[开盘值, 收盘值,
最低值, 最高值])。
:param kwargs:
coding=utf-8 | 256 | zh | 0.96005 |
class FabricSheetType(ElementType,IDisposable):
""" Represents a fabric sheet type,used in the generation of fabric wires. """
@staticmethod
def CreateDefaultFabricSheetType(ADoc):
"""
CreateDefaultFabricSheetType(ADoc: Document) -> ElementId
Creates a new FabricSheetType object with a default n... | release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/FabricSheetType.py | 14,378 | Represents a fabric sheet type,used in the generation of fabric wires.
CreateDefaultFabricSheetType(ADoc: Document) -> ElementId
Creates a new FabricSheetType object with a default name.
ADoc: The document.
Returns: The newly created type id.
Dispose(self: Element,A_0: bool)
GetReinforcementRoundingManager(... | 6,656 | en | 0.621795 |
from __future__ import unicode_literals
from xml.dom import minidom
from django.contrib.syndication import views
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
from django.utils import tzinfo
from django.utils.feedgenerator import rfc2822_date, rfc3339_date
from .models impo... | tests/syndication/tests.py | 17,283 | Tests for the high-level syndication feed framework.
Test add_domain() prefixes domains onto the correct URLs.
Test the structure and content of feeds generated by Atom1Feed.
Test that the published and updated elements are not
the same and now adhere to RFC 4287.
Test that datetimes with timezones don't get trodden on... | 2,128 | en | 0.881353 |
# Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
# reserved. Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from cef_parser import *
def make_function_body_block(cls):
impl = ' // ' + cls.get_name() + ' methods.\n'
funcs = cls.get_vir... | tools/make_ctocpp_header.py | 4,505 | Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. build the function body include standard headers include the headers for this class include headers for any forward declared classes that are... | 543 | en | 0.8557 |
# The MIT License (MIT)
#
# Copyright (c) 2015, Nicolas Sebrecht & contributors
#
# 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
... | imapfw/testing/libcore.py | 1,284 | The MIT License (MIT) Copyright (c) 2015, Nicolas Sebrecht & contributors 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, ... | 1,094 | en | 0.851754 |
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 07 14:08:31 2016
@author: Mic
"""
from __future__ import division
from wiselib2.must import *
import numpy as np
import wiselib2.Rayman as rm
Gauss1d = lambda x ,y : None
from scipy import interpolate as interpolate
from matplotlib import pyplot as plt
class PsdFuns:
... | wiselib2/Noise.py | 15,783 | Ensemble of possible Psd Functions.
Each element is a callable Psd.
Most used are
PsdFuns.PowerLaw(x,a,b)
PsdFuns.Interp(x, xData, yData)
Fits the input data in the form
y = a*x^b
returns a,b
PSD(f) = np.exp(-0.5^f/Sigma^2)
Parameters
N: # of output samples
dx: step of the x axis... | 7,592 | en | 0.437735 |
#!/Users/yaroten/Library/Mobile Documents/com~apple~CloudDocs/git/crawling_scraping/crawling_scraping/bin/python3
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generat... | crawling_scraping/bin/rst2odt_prepstyles.py | 1,793 | Fix a word-processor-generated styles.odt for odtwriter use: Drop page size
specifications from styles.xml in STYLE_FILE.odt.
!/Users/yaroten/Library/Mobile Documents/com~apple~CloudDocs/git/crawling_scraping/crawling_scraping/bin/python3 $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $ Author: Dave Kuh... | 470 | en | 0.488051 |
# -*- coding: utf-8 -*-
__author__ = """Adam Geitgey"""
__email__ = 'ageitgey@gmail.com'
__version__ = '0.1.0'
from .api import load_image_file, face_locations, face_landmarks, face_encodings, compare_faces, face_distance
| face_recognition/face_recognition/__init__.py | 224 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
import json
import pytest
from great_expectations.core import ExpectationConfiguration, ExpectationSuite
from .test_expectation_suite import baseline_suite, exp1, exp2, exp3, exp4
@pytest.fixture
def empty_suite():
return ExpectationSuite(
expectation_suite_name="warning",
expectations=[],
... | tests/core/test_expectation_suite_crud_methods.py | 7,766 | Adding the same expectation again *does* add duplicates. Turn this on once we're ready to enforce strict typing. with pytest.raises(TypeError): empty_suite.append_expectation("not an expectation") Turn this on once we're ready to enforce strict typing. with pytest.raises(TypeError): empty_suite.append_expectati... | 1,322 | en | 0.643928 |
from collections import defaultdict
from typing import DefaultDict
from .. import utils
from .. import data
'''
A collection of functions o index faculty data.
No function in this class reads data from the data files, just works logic
on them. This helps keep the program modular, by separating the data sources
from t... | firebase/firestore-py/lib/faculty/logic.py | 3,015 | Teaches a class but doesn't have basic faculty data The schedule for each teacher Sections IDs which are taught but never meet. Faculty missing a homerooms. This will be logged at the debug level. Loop over teacher sections and get their periods. Still couldn'y find any homeroom Some logging Compiles a list of periods ... | 340 | en | 0.969562 |
"""
* GTDynamics Copyright 2021, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* See LICENSE for the license information
*
* @file test_print.py
* @brief Test printing with DynamicsSymbol.
* @author Gerry Chen
"""
import unittest
from io import StringIO
from unittest.m... | python/tests/test_print.py | 2,047 | Test printing of keys.
Tests print method with various key formatters
Checks that printing NonlinearFactorGraph uses the GTDKeyFormatter
Checks that printing Values uses the GTDKeyFormatter instead of gtsam's default
* GTDynamics Copyright 2021, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rig... | 464 | en | 0.632565 |
from typing import Optional, Union, Tuple, Mapping, List
from torch import Tensor
from torch_geometric.data.storage import recursive_apply
from torch_geometric.typing import Adj
from torch_sparse import SparseTensor
from tsl.ops.connectivity import convert_torch_connectivity
from tsl.typing import DataArray, SparseTe... | tsl/data/mixin.py | 5,576 | format in [sparse, edge_index, None], where None means keep as input Convert to torch from np.ndarray, pd.DataFrame or torch.Tensor from scipy sparse matrix name cannot be an attribute of self, nor a key in get | 210 | en | 0.728147 |
"""
Write a function that takes in an array of integers and returns a sorted version of that array. Use the QuickSort algorithm to sort the array.
"""
def quick_sort(array):
if len(array) <= 1:
return array
_rec_helper(array, 0, len(array) - 1)
return array
def _rec_helper(array, start, end):
... | solutions/quick_sort.py | 1,134 | Write a function that takes in an array of integers and returns a sorted version of that array. Use the QuickSort algorithm to sort the array.
base casetest | 158 | en | 0.776222 |
# -*- coding: utf-8 -*-
"""Example for a list question type.
Run example by typing `python -m examples.list` in your console."""
from pprint import pprint
import questionary
from examples import custom_style_dope
from questionary import Separator, Choice, prompt
def ask_pystyle(**kwargs):
# create the question ... | examples/select.py | 1,463 | Example for a list question type.
Run example by typing `python -m examples.list` in your console.
-*- coding: utf-8 -*- create the question object prompt the user for an answer | 180 | en | 0.76063 |
# -*- coding: utf-8 -*-
from zappa_boilerplate.database import db_session
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, EqualTo, Length
from .models import User
class RegisterForm(Form):
username = StringField('Username',
... | zappa_boilerplate/user/forms.py | 1,443 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
# An old version of OpenAI Gym's multi_discrete.py. (Was getting affected by Gym updates)
# (https://github.com/openai/gym/blob/1fb81d4e3fb780ccf77fec731287ba07da35eb84/gym/spaces/multi_discrete.py)
import numpy as np
import gym
class MultiDiscrete(gym.Space):
"""
- The multi-discrete action space consists o... | multiagent/multi_discrete.py | 2,355 | - The multi-discrete action space consists of a series of discrete action spaces with different parameters
- It can be adapted to both a Discrete action space or a continuous (Box) action space
- It is useful to represent game controllers or keyboards where each key can be represented as a discrete action space
- It is... | 1,293 | en | 0.773221 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
class VmallPipeline(object):
def process_item(self, item, spider):
return item
| vmall/pipelines.py | 286 | -*- coding: utf-8 -*- Define your item pipelines here Don't forget to add your pipeline to the ITEM_PIPELINES setting See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html | 181 | en | 0.714533 |
"""
app.py - Flask-based server.
@author Thomas J. Daley, J.D.
@version: 0.0.1
Copyright (c) 2019 by Thomas J. Daley, J.D.
"""
import argparse
import random
from flask import Flask, render_template, request, flash, redirect, url_for, session, jsonify
from wtforms import Form, StringField, TextAreaField, PasswordField,... | app/app.py | 2,992 | app.py - Flask-based server.
@author Thomas J. Daley, J.D.
@version: 0.0.1
Copyright (c) 2019 by Thomas J. Daley, J.D.
Helper to create Public Data credentials from session variables NOQA | 190 | en | 0.685337 |
"""
A NumPy sub-namespace that conforms to the Python array API standard.
This submodule accompanies NEP 47, which proposes its inclusion in NumPy. It
is still considered experimental, and will issue a warning when imported.
This is a proof-of-concept namespace that wraps the corresponding NumPy
functions to give a c... | numpy/array_api/__init__.py | 9,976 | A NumPy sub-namespace that conforms to the Python array API standard.
This submodule accompanies NEP 47, which proposes its inclusion in NumPy. It
is still considered experimental, and will issue a warning when imported.
This is a proof-of-concept namespace that wraps the corresponding NumPy
functions to give a confo... | 6,317 | en | 0.908609 |
# Copyright 2013 IBM Corp.
#
# 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 agree... | nova/objects/service.py | 26,827 | Enforce that we are not older that the minimum version.
This is a loose check to avoid creating or updating our service
record if we would do so with a version that is older that the current
minimum of all services. This could happen if we were started with
older code by accident, either due to a rollback or an old an... | 10,242 | en | 0.874712 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | test/test_art.py | 17,735 | Tests that fetchart.art_for_album respects the size
configuration (e.g., minwidth, enforce_ratio)
Execute the fetch_art coroutine for the task and return the
album's resulting artpath. ``should_exist`` specifies whether to
assert that art path was set (to the correct value) or or that
the path was not set.
Skip the tes... | 1,542 | en | 0.868647 |
#
# 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/io/avroio_test.py | 18,450 | 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 ... | 2,360 | en | 0.823692 |
import os
from hisim import hisim_main
from hisim.simulationparameters import SimulationParameters
import shutil
import random
from hisim import log
from hisim.utils import PostProcessingOptions
import matplotlib.pyplot as plt
from hisim import utils
@utils.measure_execution_time
def test_basic_household():
# if o... | tests/test_examples.py | 4,725 | if os.path.isdir("../hisim/inputs/cache"): shutil.rmtree("../hisim/inputs/cache") if os.path.isdir("../hisim/inputs/cache"): shutil.rmtree("../hisim/inputs/cache") if os.path.isdir("../hisim/inputs/cache"): shutil.rmtree("../hisim/inputs/cache") def test_basic_household_with_all_resultfiles_full_year(): ... | 1,836 | en | 0.456785 |
'''
RenameBot
This file is a part of mrvishal2k2 rename repo
Dont kang !!!
© Mrvishal2k2
'''
import pyrogram
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(nam... | root/plugins/main_filter.py | 1,757 | RenameBot
This file is a part of mrvishal2k2 rename repo
Dont kang !!!
© Mrvishal2k2
couldn't add photo bcoz i want all photos to use as thumb.. some files dont gib name .. Thanks to albert for mime_type suggestion how the f the other formats can be uploaded as video | 271 | en | 0.911089 |
"""
builtin_bracket.py
"""
from __future__ import print_function
from _devbuild.gen.id_kind_asdl import Id
from _devbuild.gen.runtime_asdl import value
from _devbuild.gen.syntax_asdl import (
word, word_e, word_t, word__String, bool_expr,
)
from _devbuild.gen.types_asdl import lex_mode_e
from asdl import runtime
... | osh/builtin_bracket.py | 8,388 | For test/[, we need a word parser that returns String.
The BoolParser calls word_.BoolId(w), and deals with Kind.BoolUnary,
Kind.BoolBinary, etc. This is instead of Compound/Token (as in the
[[ case.
For special cases.
Interface used for special cases below.
Interface for bool_parse.py.
TODO: This should probably be... | 2,495 | en | 0.841459 |
import glob
import shutil
import subprocess
import os
import sys
import argparse
# Read and save metadata from file
def exiftool_metadata(path):
metadata = {}
exifToolPath = 'exifTool.exe'
''' use Exif tool to get the metadata '''
process = subprocess.Popen(
[
exifToolPath,
... | app.py | 4,422 | Read and save metadata from file if value of metadata not exists - folder name File with the same name exists in dst. If source and dst have same size then determines 'copy_exists' Arguments from console Setup variable Number of log source_dir = 'C:/Users' dst_dir = 'C:/Users' copy_duplicate = False | 300 | en | 0.557558 |
# 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 ... | azure-mgmt-compute/azure/mgmt/compute/v2018_06_01/models/replication_status_py3.py | 1,667 | This is the replication status of the gallery Image Version.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar aggregated_state: This is the aggregated replication status based on
all the regional replication status flags. Possible values include:
'Unknown', 'InProgress',... | 1,060 | en | 0.70023 |
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import sys
import urllib
import logging
from optparse import OptionParser
class ResultsProvider(object):
'''Base class used to fetch data from server for forwarding'''
import requests
import socket
import time
def __init__(self, *... | helper_servers/http_forwarder.py | 8,010 | !/usr/bin/env python data, headers, params, json other params herereturn self.doRequest(url='http://site/whatever/' + str(calculated_value)).text print (self.protocol_version, code, message)self.send_header('Server', self.version_string())self.send_header('Date', self.date_time_string())self.print_debug('Header Sent', ... | 471 | en | 0.158466 |
import spacy
from spacy.tokens import Doc, Span, Token
import urllib
import xml.etree.ElementTree as ET
import re
from SpacyHu.BaseSpacyHuComponent import BaseSpacyHuComponent
class HuLemmaMorph(BaseSpacyHuComponent):
def __init__(self,
nlp,
label='Morph',
url='h... | SpacyHu/SpacyHu/LemmatizerMorphAnalyzer.py | 2,620 | debug_text = 'megszentségteleníthetetlenségeitekért meghalnak' | 62 | hu | 0.981844 |
__version__ = '0.3.3'
import os
import sys
import logging
import argparse
from .core import WebCrawler
from .helpers import color_logging
def main():
""" parse command line options and run commands.
"""
parser = argparse.ArgumentParser(
description='A web crawler for testing website links validati... | webcrawler/__init__.py | 4,038 | parse command line options and run commands.
set grey environment | 72 | en | 0.841679 |
#!/usr/bin/env python
import bottle
import os, json
from .utils import distance, neighbours, direction
from .defensive import find_my_tail, trouble, find_enemy_tail, eat_food, find_my_tail_emergency
from .snake import Snake
from .gameboard import GameBoard
SAFTEY = 0
SNAKE = 1
FOOD = 3
DANGER = 5
def move_response(... | app/main.py | 4,662 | Initialize grid and update cell values
@param data -> Json response from bottle
@return game_id -> Game id for debuggin purposes when displaying grid
@return grid -> Grid with updated cell values
@return food -> Sorted array of food by closest to charlie
@return charlie -> My snake
@return enemies -> Array of al... | 834 | en | 0.596676 |
#!/usr/bin/python3
# -*- coding: utf8 -*-
# Copyright (c) 2020 Baidu, 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... | QCompute/QuantumPlatform/ProcedureParams.py | 1,624 | The storage for procedure param
The procedure params dict
Get the procedure params according to the index.
Create the register when it does not exist.
:param index:
:return: ProcedureParamStorage
The constructor of the ProcedureParams class
The quantum param object needs to know its index.
:param index: the quantum r... | 1,005 | en | 0.809563 |
#!/usr/bin/env python
# coding=utf-8
class PyPIPackageProject:
pass
| asgi_webdav/core.py | 74 | !/usr/bin/env python coding=utf-8 | 33 | en | 0.221043 |
#!/usr/bin/env python
# encoding: utf-8
"""
@Author: yangwenhao
@Contact: 874681044@qq.com
@Software: PyCharm
@File: Cosine.py
@Time: 19-6-26 下午9:43
@Overview: Implement Cosine Score for speaker identification!
Enrollment set files will be in the 'Data/enroll_set.npy' and the classes-to-index file is 'Data/enroll_clas... | Score/Cosine_Score.py | 2,006 | @Author: yangwenhao
@Contact: 874681044@qq.com
@Software: PyCharm
@File: Cosine.py
@Time: 19-6-26 下午9:43
@Overview: Implement Cosine Score for speaker identification!
Enrollment set files will be in the 'Data/enroll_set.npy' and the classes-to-index file is 'Data/enroll_classes.npy'
Test set files are in the 'Data/test... | 517 | en | 0.520443 |
"""
Copyright 2013 The Trustees of Princeton University
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... | ms/storage/backends/google_appengine.py | 4,034 | Wait for all of a list of futures to finish.
Works with FutureWrapper.
Copyright 2013 The Trustees of Princeton University
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/... | 1,086 | en | 0.807119 |
import sys
import os
import math
import imageio
from moviepy.editor import *
import time
def read_video(video_name):
# Read video from file
video_name_input = 'testset/' + video_name
video = VideoFileClip(video_name_input)
return video
def video2frame(video_name):
video = read_video(video_name)... | video_pose_ed.py | 12,134 | Read video from file duration: second / fps: frame per second ex. 720 -> 3 Load and setup CNN part detector duration: second / fps: frame per second ex. 720 -> 3 Compute prediction with the CNN Add library to save image Save image with points of pose index of points radius of points If coordinates of point is (0, 0) ==... | 1,306 | en | 0.843226 |
# coding=utf-8
from pub.tables.resources import *
from pub.tables.user import *
import pub.client.login as login
from pub.permission.user import is_logged,is_owner
def is_valid_key(key, r_type):
try:
resource_type.objects.get(key=key)
return False
except:
pass
try:
resour... | pub/permission/resource.py | 3,773 | coding=utf-8 try: user = login.get_user_by_session(request,request.session.get(s.SESSION_LOGIN)) except: return False p = user_permission.objects.get(user_id=user, type=r_type).volume if p>0: return True return False | 228 | en | 0.177714 |
import urllib2
from zope.interface import implements
from plone.portlets.interfaces import IPortletDataProvider
from plone.app.portlets.portlets import base
from Products.CMFCore.utils import getToolByName
from zope import schema
from zope.formlib import form
from Products.Five.browser.pagetemplatefile import ViewPa... | src/wad.blog/wad/blog/portlets/categories.py | 3,956 | Portlet add form.
This is registered in configure.zcml. The form_fields variable tells
zope.formlib which fields to display. The create() method actually
constructs the assignment that is being added.
Portlet assignment.
This is what is actually managed through the portlets UI and associated
with columns.
Portlet edi... | 977 | en | 0.926877 |
from configparser import ConfigParser
import feedparser
import re
import requests
import tweepy
def get_id(xkcd_link: str) -> int:
"""
Exctract comic id from xkcd link
"""
match = re.search(r"\d+", xkcd_link)
if match:
return int(match.group())
else:
return 0
def get_xkcd_rss... | xkcd_feed/src/utils.py | 1,951 | Download latest image and store it in
current working directory
Exctract comic id from xkcd link
Extract latest entry from XKCD RSS feed and
parse the ID
Load latest XKCD RSS feed and extract latest entry
Do authentication and return read-to-use
twitter api object
Post tweet on twitter
get latest rss feed | 308 | en | 0.616991 |
"""api_gw_test"""
# Remove warnings when using pytest fixtures
# pylint: disable=redefined-outer-name
import json
from test.conftest import ENDPOINT_URL
# warning disabled, this is used as a pylint fixture
from test.elasticsearch_test import ( # pylint: disable=unused-import
es_client,
populate_es_test_case... | test/api_gw_test.py | 10,176 | Integrate lambda with api gw method and deploy api.
Return the invokation URL
api gw for testing
fixture finalizer
test_item_search_get
test_item_search_post
test_root_endpoint
Converts a API GW url to localstack
api_gw_test
Remove warnings when using pytest fixtures pylint: disable=redefined-outer-name warning disab... | 1,091 | en | 0.673344 |
_base_ = [
'../_base_/datasets/ffhq_flip.py',
'../_base_/models/stylegan/stylegan2_base.py',
'../_base_/default_runtime.py'
]
model = dict(
type='MSPIEStyleGAN2',
generator=dict(
type='MSStyleGANv2Generator',
head_pos_encoding=dict(type='CSG'),
deconv2conv=True,
up_a... | configs/positional_encoding_in_gans/mspie-stylegan2_c2_config-d_ffhq_256-512_b3x8_1100k.py | 1,683 | dict(type='TensorboardLoggerHook'), | 35 | en | 0.30399 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:25176")
else:
access = Se... | contrib/bitrpc/bitrpc.py | 7,836 | ===== BEGIN USER SETTINGS ===== if you do not set these you will be prompted for a password for every command ====== END USER SETTINGS ====== | 141 | en | 0.820638 |
#!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020 EntySec
#
# 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,... | Head/typer.py | 1,625 | !/usr/bin/env python3 MIT License Copyright (c) 2020 EntySec 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... | 1,081 | en | 0.851831 |
"""
DeepChEmbed (DCE) Models
"""
from dimreducer import DeepAutoEncoder
from cluster import KMeansLayer
from cluster import KMeans
from keras import Model
from keras import optimizers
from keras.utils import normalize
import numpy as np
class DCE():
"""
The class to build a deep chemical embedding model.
... | deepchembed/dce.py | 9,241 | The class to build a deep chemical embedding model.
Attributes:
autoencoder_dims: a list of dimensions for encoder, the first
element as input dimension, and the last one as
hidden layer dimension.
n_clusters: int, number of clusters for clustering layer.
alpha: ... | 2,500 | en | 0.662529 |
import datetime
from . import status
from .errors import InvalidAuthRequest, ProtocolVersionUnsupported, NoMutualAuthType
from .signing import Key
from .response import AuthResponse
class AuthPrincipal:
def __init__(self, userid, auth_methods, ptags=None, session_expiry=None):
self.userid = userid
... | ucam_wls/context.py | 8,756 | High-level interface to implement a web login service (WLS).
This class provides a convenient interface for implementing a WLS with any
authentication backend. It is intended to be instantiated with a single
private key, which is used to sign the responses it generates.
Mechanisms deemed useful for WLS implementatio... | 4,001 | en | 0.818075 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | sdk/python/pulumi_aws/timestreamwrite/outputs.py | 10,690 | :param bool enable_magnetic_store_writes: A flag to enable magnetic store writes.
:param 'TableMagneticStoreWritePropertiesMagneticStoreRejectedDataLocationArgs' magnetic_store_rejected_data_location: The location to write error reports for records rejected asynchronously during magnetic store writes. See Magnetic Stor... | 2,525 | en | 0.801816 |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-ExtensionsMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-ExtensionsMIB
# Produced by pysmi-0.3.4 at Wed May 1 14:29:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user ... | pysnmp-with-texts/Nortel-MsCarrier-MscPassport-ExtensionsMIB.py | 4,227 | PySNMP MIB module Nortel-MsCarrier-MscPassport-ExtensionsMIB (http://snmplabs.com/pysmi) ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-ExtensionsMIB Produced by pysmi-0.3.4 at Wed May 1 14:29:54 2019 On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 U... | 378 | en | 0.374487 |
# Copyright 2020 The HuggingFace Team. 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 applicabl... | setup.py | 11,408 | A custom distutils command that updates the dependency table.
usage: python setup.py deps_table_update
Simple check list from AllenNLP repo: https://github.com/allenai/allennlp/blob/master/setup.py
To create the package for pypi.
1. Change the version in __init__.py, setup.py as well as docs/source/conf.py. Remove th... | 4,691 | en | 0.798846 |
from django.db import models
# Create your models here.
class BaseView(models.Model):
title = models.CharField(max_length=256)
def __unicode__(self):
return self.title
class port1View(models.Model):
def __unicode__(self):
return self.title
class port2View(models.Model):
title = models.CharField(max_length=... | mainsite/models.py | 849 | Create your models here. | 24 | en | 0.920486 |
# import the necessary packages
import sys
import cv2
import numpy as np
import pandas as pd
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from sklearn.preprocessing import LabelBinarizer
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
from tenso... | CNN/CNNProcessData.py | 19,386 | import the necessary packagesrotation_range=20,width_shift_range=0.05,height_shift_range=0.05,horizontal_flip=True, vertical_flip=True,brightness_range=[0.8,1.2] testXflipped = [] for img in testX: horizontal_flip = cv2.flip( img, 0 ) testXflipped.append(horizontal_flip) testXflipped = np.array(testXflipped) te... | 2,751 | en | 0.473604 |
from numbers import Number
import yaml
from .color_tools import hex2rgb
def __default_grid__(ax):
"""This is a temporary function"""
ax.grid(b=True, which='major', color='#000000', alpha=0.2, linestyle='-', linewidth=0.5)
ax.grid(b=True, which='minor', color='#000000', alpha=0.1, linestyle='-', linewidth=0.25)
ax.... | nicenquickplotlib/config_types.py | 2,622 | This is a temporary function
Enables minor ticks without text, only the ticks. This is what actually initializes the values. | 126 | en | 0.766983 |
from machine import Pin, Map, PWM # include Pin, Map and PWM functions from machine module
import time # include time module
# create PWM on WIO BUZZER with 2000Hz frequency and 250 duty cycle
BUZZER = PWM(Pin(Map.WIO_BUZZER), freq=1000, duty=250)
| Classroom 4/Buzzer_PWM.py | 259 | include Pin, Map and PWM functions from machine module include time module create PWM on WIO BUZZER with 2000Hz frequency and 250 duty cycle | 142 | en | 0.812334 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '__first__'),
]
operations = [
migrations.CreateModel(
name='GoogleMap',
fields=[
... | env/lib/python2.7/site-packages/djangocms_googlemap/migrations_django/0001_initial.py | 3,264 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
import os.path
import IMLearn.learners.regressors.linear_regression
from IMLearn.learners.regressors import PolynomialFitting
from IMLearn.utils import split_train_test
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.io as pio
pio.templates.default = "simple_white"
from IMLearn.met... | exercises/city_temperature_prediction.py | 4,714 | Load city daily temperature dataset and preprocess data.
Parameters
----------
filename: str
Path to house prices dataset
Returns
-------
Design matrix and response vector (Temp)
Exploring data specifically in Israel
Exploring differences between countries
Fitting model for different values of `k`
Evaluating fit... | 649 | en | 0.777614 |
from tests.testmodels import Event, IntFields, MinRelation, Node, Reporter, Team, Tournament, Tree
from tortoise import Tortoise
from tortoise.contrib import test
from tortoise.exceptions import (
DoesNotExist,
FieldError,
IntegrityError,
MultipleObjectsReturned,
ParamsError,
)
from tortoise.express... | tests/test_queryset.py | 25,423 | TODO: Test the many exceptions in QuerySet TODO: .filter(intnum_null=None) does not work as expected Build large dataset Modify dataset Test distinct Test limit/offset/ordering values_list Test limit/offset/ordering values Test first Test get Test delete should select event 1 and event 2 should select only event 2 Some... | 451 | en | 0.839766 |
"""
Output demo
^^^^^^^^^^^^^^
Demonstrate various output usage supported by PyWebIO
:demo_host:`Demo </?pywebio_api=output_usage>` `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py>`_
"""
from pywebio import start_server
from pywebio.output import *
from pywebio.session import hold, ge... | demos/output_usage.py | 15,342 | return English or Chinese text according to the user's browser language
Output demo
^^^^^^^^^^^^^^
Demonstrate various output usage supported by PyWebIO
:demo_host:`Demo </?pywebio_api=output_usage>` `Source code <https://github.com/wang0618/PyWebIO/blob/dev/demos/output_usage.py>`_ | 285 | en | 0.414437 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-12-30 03:21
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
... | core/migrations/0002_auto_20161229_2221.py | 943 | -*- coding: utf-8 -*- Generated by Django 1.9.4 on 2016-12-30 03:21 | 67 | en | 0.742361 |
# 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... | flash_examples/object_detection.py | 1,737 | 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 in writing, softwar... | 760 | en | 0.809583 |
# Copyright 2020 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... | keras/initializers/initializers_v2.py | 26,877 | Initializer that generates tensors with constant values.
Also available via the shortcut function `tf.keras.initializers.constant`.
Only scalar values are allowed.
The constant value provided must be convertible to the dtype requested
when calling the initializer.
Examples:
>>> # Standalone usage:
>>> initializer =... | 19,817 | en | 0.567713 |
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/nos/v6_0_2f/interface/hundredgigabitethernet/switchport/access_mac_group_rspan_vlan_classification/access/__init__.py | 8,168 | This class was auto-generated by the PythonClass plugin for PYANG
from YANG module brocade-interface - based on the path /interface/hundredgigabitethernet/switchport/access-mac-group-rspan-vlan-classification/access. Each member element of
the container is represented as a class variable - with a specific
YANG type.
Y... | 921 | en | 0.685498 |
# Generated by Django 2.0.5 on 2018-06-07 10:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('it_purchase_app', '0030_auto_20180607_1020'),
]
operations = [
migrations.AlterField(
model_name='purchase',
name='m... | it_purchase_project/it_purchase_app/migrations/0031_auto_20180607_1031.py | 502 | Generated by Django 2.0.5 on 2018-06-07 10:31 | 45 | en | 0.564677 |
#!/usr/bin/env python
# encoding: utf-8
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _
from django_extensions.db.fields import AutoSlugField
from v1.recipe.models import Recipe
class GroceryList(models.Model):
"""
The GroceryL... | v1/list/models.py | 2,531 | The GroceryItem is an item on a GroceryList.
list = The GroceryList that owns the GroceryItem.
title = The name of the GroceryItem.
completed = Whether or not the GroceryItem has been purchased or
added to the users shopping cart in the supermarket.
order = The order of the item in the GroceryList.
The Groc... | 925 | en | 0.915098 |
from pandas import read_csv
from IPython.display import display
import numpy as np
import sys
import math
###############################
####Maria Eugenia Lopez #####
###############################
def fully_grown_depuration(number_to_remove=0.50):
return plants.loc[plants.height_m > number_to_remove]
def con... | Assignment/Environmental_Project/part_A.py | 1,650 | Maria Eugenia Lopez res= div*0.001to convert to Klmres = res*0.001----------------------------------------Part A Assembling a Data Set--------------------------------------------------------------------------------Input and Output: Data Framesdisplay(plants.head(n=50))----------------------------------------Functions-... | 445 | en | 0.285517 |
#
# PySNMP MIB module EdgeSwitch-IPV6-TUNNEL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EdgeSwitch-IPV6-TUNNEL-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:56:15 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | pysnmp/EdgeSwitch-IPV6-TUNNEL-MIB.py | 6,528 | PySNMP MIB module EdgeSwitch-IPV6-TUNNEL-MIB (http://snmplabs.com/pysmi) ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EdgeSwitch-IPV6-TUNNEL-MIB Produced by pysmi-0.3.4 at Mon Apr 29 18:56:15 2019 On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 Using Python version 3.7.3 (defau... | 346 | en | 0.360628 |
"""Test cases for the pypfilt.io module."""
import datetime
import numpy as np
import os
from pypfilt.io import read_table, date_column
def test_read_datetime():
# Test data: sequential dates with Fibonacci sequence.
content = """
date count
2020-01-01 1
2020-01-02 1
2020-01-03 2
2020-01... | local_pypfilt/tests/test_io.py | 1,326 | Test cases for the pypfilt.io module.
Test data: sequential dates with Fibonacci sequence. Save this data to a temporary data file. Read the data and then remove the data file. Check that we received the expected number of rows. Check that each row has the expected content. | 276 | en | 0.885202 |
#coding:utf8
#authors : yqq
import logging
import json
from utils import decimal_default,get_linenumber
from base_handler import BaseHandler
from .proxy import AuthServiceProxy
from cashaddress import convert
import traceback
#设置精度
from decimal import Decimal
from decimal import getcontext
getcontext().prec = 8
f... | Python3/Tornado/apps/ExchangeWalletApi/ExWallet/bsv/handler.py | 24,277 | coding:utf8authors : yqq设置精度 TODO:后期数据量大的时候, 使用redis进行缓存地址使用全局变量保存交易所用户BTC地址 2019-06-01要进行地址格式的转换 commands = [["estimatesmartfee", nConfTarget, strEstimateMode ]] commands = [["estimatefee", nConfTarget]] bsv 需要根据前面的区块来计算, 和 bch, btc , ltc 不一样 data = rpcconn.batch_(commands) nFeeRate = data[0] if len(data) > 0 els... | 1,905 | en | 0.32 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.