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 -*- """ Copyright (c) 2012 University of Oxford 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, modif...
rdfdatabank/lib/data_sync.py
4,060
Copyright (c) 2012 University of Oxford 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, distribut...
1,544
en
0.866357
import mysql.connector import json import os import requests def getAllFindings(host, database, user, password, table, where): db = mysql.connector.connect(host=host, database=database, user=user, password=password) cursor = db.cursor() cursor.execute("SELECT distinct findingCode, specimenOrganCode FROM "...
Concordance/condordance_utils.py
4,611
iterate over the clinical and preclinical compounds and match them om inchiKey
78
en
0.818684
""" Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 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 ...
test/rules/outputs/test_name.py
1,601
Test template outputs Names Setup Test failure Test Positive Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. 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 restric...
1,015
en
0.86346
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # --------------------------------------------------------------------...
src/azure-cli/azure/cli/command_modules/iotcentral/commands.py
1,292
-------------------------------------------------------------------------------------------- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See License.txt in the project root for license information. ----------------------------------------------------------------------------...
366
en
0.409024
# 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 applica...
tensorflow/python/ops/rnn.py
44,670
Copy some tensors through via array_ops.where. Internal implementation of Dynamic RNN. Args: cell: An instance of RNNCell. inputs: A `Tensor` of shape [time, batch_size, input_size], or a nested tuple of such elements. initial_state: A `Tensor` of shape `[batch_size, state_size]`, or if `cell.state_size`...
24,642
en
0.780209
""" Module containing NetPyNE metadata """ from __future__ import unicode_literals from __future__ import print_function from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() metadata = { # ---------------------------------------...
netpyne/metadata/metadata.py
132,055
Module containing NetPyNE metadata --------------------------------------------------------------------------------------------------------------------- netParams --------------------------------------------------------------------------------------------------------------------- -------------------------------------...
2,346
en
0.117911
#!/usr/bin/env python3 # Copyright (c) 2014-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 mining RPCs - getmininginfo - getblocktemplate proposal mode - submitblock""" import copy from b...
test/functional/mining_basic.py
5,584
Test mining RPCs - getmininginfo - getblocktemplate proposal mode - submitblock !/usr/bin/env python3 Copyright (c) 2014-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. Mine a block to leave initial b...
475
en
0.715059
import tarfile import textwrap import pytoml from .app import App from .exceptions import TockLoaderException from .tbfh import TBFHeader class TAB: ''' Tock Application Bundle object. This class handles the TAB format. ''' def __init__ (self, tab_path): self.tab = tarfile.open(tab_path) def extract_app (sel...
tockloader/tab.py
3,297
Tock Application Bundle object. This class handles the TAB format. Return an `App` object from this TAB. You must specify the desired MCU architecture so the correct binary can be retrieved. Return a list of architectures that this TAB has compiled binaries for. Return a TBFHeader object with the TBF header from the ap...
909
en
0.821311
from __future__ import absolute_import from __future__ import unicode_literals import types import copy from django import forms from django.forms.forms import NON_FIELD_ERRORS from django.core.validators import EMPTY_VALUES from django.db import models from django.db.models.fields import FieldDoesNotExist from djang...
django_filters/filterset.py
17,044
Values of False & True chosen for backward compatability reasons. Originally, these were the only options. pragma: nocover Django < 1.5 fallback noqa pragma: nocover Django < 1.5 fallback noqa pragma: nocover Django >= 1.8 replaces RelatedObject with ForeignObjectRel There is a bug with deepcopy in 2.6, patch if we a...
1,272
en
0.7991
"""empty message Revision ID: 780c29109b25 Revises: 911cc5d772fc Create Date: 2020-08-30 15:22:15.026266 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "780c29109b25" down_revision = "911cc5d772fc" branch_labels = None depends_on = None def...
migrations/versions/780c29109b25_.py
831
empty message Revision ID: 780c29109b25 Revises: 911cc5d772fc Create Date: 2020-08-30 15:22:15.026266 revision identifiers, used by Alembic. commands auto generated by Alembic - please adjust! end Alembic commands commands auto generated by Alembic - please adjust! end Alembic commands
296
en
0.604746
import numpy as np import os import cv2 from PIL import Image import numpy as np import random import itertools import matplotlib.pyplot as plt # plt 用于显示图片 from tqdm import tqdm # 标注文件数据处理 def read_pslot(annt_file): # print(annt_file) with open(annt_file, "r") as f: annt = f.readlines() # print...
preprocessing/make_dataset_new.py
11,369
plt 用于显示图片 标注文件数据处理 print(annt_file) print("annt", annt) print(line_annt) continue if line_annt[-4] in ['1', '5']: l_ign.append(np.array([int(line_annt[i + 1]) for i in range(8)])) continue 标点 print(save_path) points_list = 384 * np.abs(np.array(outputs[0], dtype=np.float)) 可以为 0、4、8 print(save_path) 画线 single ...
1,794
zh
0.23805
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/vision_v1p1beta1/proto/image_annotator.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descript...
vision/google/cloud/vision_v1p1beta1/proto/image_annotator_pb2.py
89,814
The Beta API is deprecated for 0.15.0 and later. It is recommended to use the GA API (classes and functions in this file not marked beta) for all further purposes. This class was generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0. The Beta API is deprecated for 0.15.0 and later. It is recommended ...
3,817
en
0.629222
import logging # noinspection PyPackageRequirements from telegram.ext import CommandHandler, ConversationHandler # noinspection PyPackageRequirements from telegram import ChatAction, Update from bot import stickersbot from bot.utils import decorators from bot.utils import utils from bot.database.base import session_s...
bot/handlers/packs/list.py
1,403
noinspection PyPackageRequirements noinspection PyPackageRequirements packs = db.get_user_packs(update.effective_user.id, as_namedtuple=True) can't include more than 100 entities /list should end whatever conversation the user was having
237
en
0.807229
# -*- coding: utf-8 -*- ''' QSDsan: Quantitative Sustainable Design for sanitation and resource recovery systems This module is developed by: Joy Zhang <joycheung1994@gmail.com> This module is under the University of Illinois/NCSA Open Source License. Please refer to https://github.com/QSD-Group/QSDsan/blob/main/...
qsdsan/sanunits/_suspended_growth_bioreactor.py
21,130
A single continuous stirred tank reactor. Parameters ---------- ID : str ID for the reactor. ins : :class:`WasteStream` Influents to the reactor. Can be an array of up to 3 WasteStream objects by default, typically wastewater to be treated, recycled effluent, recycled activated sludge. outs : :class:`W...
5,488
en
0.693432
# vim: set et sw=4 sts=4 fileencoding=utf-8: # # Python camera library for the Rasperry-Pi camera module # Copyright (c) 2013-2017 Dave Jones <dave@waveform.org.uk> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # ...
picamera/camera.py
174,185
Provides a pure Python interface to the Raspberry Pi's camera module. Upon construction, this class initializes the camera. The *camera_num* parameter (which defaults to 0) selects the camera module that the instance will represent. Only the Raspberry Pi compute module currently supports more than one camera. The *se...
47,902
en
0.801599
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
mindspore/ops/composite/multitype_ops/logical_and_impl.py
1,590
Return logical and operation result of x and y. Args: x(Number): Number. y(Number): Number. Returns: bool, Return logical and operation result of x and y. Return logical and operation result of x and y. Args: x(Tensor): Tensor. y(Tensor): Tensor. Returns: Tensor, Return logical and operation resul...
1,106
en
0.799561
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:9332") else: access = Ser...
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
############################################################################### # # Tests for XlsxWriter. # # SPDX-License-Identifier: BSD-2-Clause # Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org # from ..excel_comparison_test import ExcelComparisonTest from ...workbook import Workbook class TestCompar...
xlsxwriter/test/comparison/test_chart_data_labels17.py
2,002
Test file created by XlsxWriter against a file created by Excel. Test the creation of a simple XlsxWriter file. Tests for XlsxWriter. SPDX-License-Identifier: BSD-2-Clause Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
233
en
0.847261
from datetime import timedelta from typing import NamedTuple, Optional class ErdAdvantiumKitchenTimerMinMax(NamedTuple): """Defines min/max kitchen timer settings""" min_time: timedelta max_time: timedelta raw_value: Optional[str]
gehomesdk/erd/values/advantium/erd_advantium_kitchen_timer_min_max.py
249
Defines min/max kitchen timer settings
38
en
0.536529
#!/usr/bin/env python3 # Copyright (c) 2018-2020 The Ludirium Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Useful util functions for testing the wallet""" from collections import namedtuple from test_framewor...
test/functional/test_framework/wallet_util.py
5,074
Generate a fresh key Returns a named tuple of privkey, pubkey and all address and scripts. Generate a fresh key on node Returns a named tuple of privkey, pubkey and all address and scripts. Generate a fresh 2-of-3 multisig on node Returns a named tuple of privkeys, pubkeys and all address and scripts. Get address in...
676
en
0.786577
import pymongo import sys # establish a connection to the database # note this uses the now deprecated Connection class, as we did in the lecture. # MongoClient is the preferred way of connecting. connection = pymongo.Connection("mongodb://localhost", safe=True) # get a handle to the school database db=conn...
src/m101p/week02/lesson_files/hemmerling_week2_01.py
508
establish a connection to the database note this uses the now deprecated Connection class, as we did in the lecture. MongoClient is the preferred way of connecting. get a handle to the school database
201
en
0.942386
from django.contrib import admin from .models import Arts, Comments, Tags, ArtworksTags, Stili, Umetnina, Umetnik # Register your models here. admin.site.register(Umetnik) admin.site.register(Umetnina) admin.site.register(Stili) admin.site.register(Arts) admin.site.register(Comments) admin.site.register(Tags) admin....
umetnine/artists/admin.py
384
Register your models here. admin.site.register(ArtworkLikes)
60
en
0.795785
# Copyright Istio 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, soft...
perf/benchmark/runner/runner.py
11,681
Copyright Istio Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed u...
606
en
0.853207
# Usage: testWordsInCorpus.py [language] {corpus file} # If no corpus file is named, the programme will try to load a corresponding cPickle file. # # German corpus: /mounts/data/proj/huiming/SIGMORPHON/dewiki-20151102-pages-articles-multistream.xml # # This script finds words that should belong to a paradigm in the cor...
MyAlgorithm/addWordsToParadigms_old.py
7,156
Usage: testWordsInCorpus.py [language] {corpus file} If no corpus file is named, the programme will try to load a corresponding cPickle file. German corpus: /mounts/data/proj/huiming/SIGMORPHON/dewiki-20151102-pages-articles-multistream.xml This script finds words that should belong to a paradigm in the corpus and adds...
1,586
en
0.755291
#!/usr/bin/env python2 from setuptools import setup from setuptools import find_packages setup( name="rover", version="0.1", description="Algorithm for risk and sensor quality aware sensor" + "coverage for quadrotors", author="Alex Wallar", author_email="wallarelvo@gmail.com", packages=fin...
setup.py
501
!/usr/bin/env python2
21
fr
0.26923
#!/usr/bin/python #coding:utf-8 import time import json import requests from selenium import webdriver filename = 'a.csv' url = 'http://www.icourse163.org/university/view/all.htm#/' headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0', 'Accept': 'text/html,applicat...
spider.py
2,236
!/usr/bin/pythoncoding:utf-8 with open(filename, 'w+') as file: file.write("大学,课程,课程时长,课程负载,内容类型,课程分类\n") 大学 课程 课程信息 with open(filename, 'a+') as file: file.write("%s,%s,%s,%s,%s,%s\n" % (university_name,course_name,k0,k1,k2,k3))
237
en
0.462415
#!/usr/bin/env python # This example uses Uvicorn package that must be installed. However, it can be # replaced with any other ASGI-compliant server. # # NOTE: Python 3.6 requires aiocontextvars package to be installed. # # Run: python app_global_request.py import rollbar import uvicorn from rollbar.contrib.starlett...
rollbar/examples/starlette/app_global_request.py
1,015
!/usr/bin/env python This example uses Uvicorn package that must be installed. However, it can be replaced with any other ASGI-compliant server. NOTE: Python 3.6 requires aiocontextvars package to be installed. Run: python app_global_request.py Integrate Rollbar with Starlette application should be added as the last mi...
404
en
0.773295
# Configuration file for jupyter-notebook. #------------------------------------------------------------------------------ # Configurable configuration #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ # Sing...
config/jupyter/jupyter_notebook_config.py
19,173
Configuration file for jupyter-notebook.------------------------------------------------------------------------------ Configurable configuration------------------------------------------------------------------------------------------------------------------------------------------------------------ SingletonConfigura...
17,935
en
0.622204
import asyncio import logging import os import shutil import warnings from types import TracebackType from typing import Any, Coroutine, Dict, List, Optional, Text, Type, TypeVar import rasa.core.utils import rasa.utils.io from rasa.constants import ( DEFAULT_LOG_LEVEL_LIBRARIES, ENV_LOG_LEVEL_LIBRARIES, ) fro...
rasa/utils/common.py
9,003
Filter repeated log records. Represents a path to an temporary directory. When used as a context manager, it erases the contents of the directory on exit. Returns a verbosity level according to the set log level. Read global Rasa configuration. Args: path: Path to the configuration Returns: The global configur...
2,258
en
0.826978
""" ECB没有偏移量 """ from Crypto.Cipher import AES from binascii import b2a_hex, a2b_hex from utils import DES_decrypt, DES_encrypt def add_to_16(text): if len(text.encode('utf-8')) % 16: add = 16 - (len(text.encode('utf-8')) % 16) else: add = 0 text = text + ('\0' * add) return text.encode...
try.py
1,024
ECB没有偏移量 加密函数 解密后,去掉补足的空格用strip() 去掉 加密 解密
44
zh
0.980871
"""This module contains the general information for ChassisPowerMonitor ManagedObject.""" from ...imcmo import ManagedObject from ...imccoremeta import MoPropertyMeta, MoMeta from ...imcmeta import VersionMeta class ChassisPowerMonitorConsts: pass class ChassisPowerMonitor(ManagedObject): """This is Chassi...
imcsdk/mometa/chassis/ChassisPowerMonitor.py
2,870
This is ChassisPowerMonitor class. This module contains the general information for ChassisPowerMonitor ManagedObject.
118
en
0.748867
""" FILE : BiLSTM.py FUNCTION : None """ import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence import random from DataUtils.Common import * from models.initialize import * from models.modelHelp import prepare_pack_padded_seq...
models/BiLSTM.py
3,155
BiLSTM : vocab_size: emb_size: hidden_size: out_size: :param word: :param sentence_length: :param desorted_indices: :return: FILE : BiLSTM.py FUNCTION : None (N,W,D) [B, L, emb_size] rnn_out:[B, L, hidden_size*2] [B, L, out_size] [B, L, out_size]
249
en
0.362757
''' @author: kris ''' # import modules; set up logging from gensim.models import Word2Vec from gensim.models import KeyedVectors from gensim.test.utils import datapath import numpy as np import logging, os, sys, gzip import datetime logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', filename='wor...
scripts/loadModelDoEntityEmbeddingsUnsorted.py
6,357
@author: kris import modules; set up logging Path to a file that contains lines with the locations of files containing the sentences we want for our Word2Vec model Also works with entities that are just stacked line by line Model to load'/home/faerberm/mag-training/MAG_sg1_size128_minCount5_window5_neg15_iter10_alph...
2,206
en
0.763448
"""inter-base steganography producing base32 and base64 decodable strings""" from base64 import b64encode, b64decode import string from itertools import product from argparse import ArgumentParser CHARSET = string.printable.encode() B32_CHARSET = (string.ascii_uppercase + '234567').encode() B64_CHARSET = ( string....
encode.py
7,222
Returns all leet variations of a triplet which result in a Base32 only charset words on base64 encoding Args: word: An english triplet Returns: list: of all valid variations Produce all single-character leet variations of a string Encodes a string to its leet equivalent (sans punctuation) which when base64 enc...
1,168
en
0.565786
#!/usr/bin/python3 import time import datetime from gpiozero import InputDevice, LED import subprocess import requests # RPI enumeration is: # pin 5 & 6 are used for the button (3 & ground) # pin 7 & 9 are used for the LED (4 & ground) button_pin = 3 led_pin = 4 button = InputDevice(button_pin, pull_up=True) last_ac...
pi/button/button.py
1,171
!/usr/bin/python3 RPI enumeration is: pin 5 & 6 are used for the button (3 & ground) pin 7 & 9 are used for the LED (4 & ground)
128
en
0.817168
import argparse import torch from tqdm import tqdm import vgg.data_loader.data_loaders as module_data import vgg.model.loss as module_loss import vgg.model.metric as module_metric import vgg.model.model as module_arch from vgg.parse_config import ConfigParser def main(config): logger = config.get_logger('test') ...
vgg/test.py
2,740
setup data_loader instances build model architecture get function handles of loss and metrics prepare model for testing save sample images, or do something with output here computing loss, metrics on test set
208
en
0.799659
import os import argparse from ops.os_operation import mkdir import time def write_slurm_sh_multi_H2(id,command_line, queue_name="learnfair",nodes=1, gpu_per_node=8,wall_time=3*24*60,username="wang3702",CPU_PER_GPU=8): import time import datetime today = datetime.date.today() formatt...
run_slurm.py
266,956
Args: id: running id command_line: command line outlog_path: saving path Returns: !/bin/bashfile.write("bash /private/home/wang3702/.bashrc\n")file.write("module load anaconda3\n") signal that job is finished!/bin/bash--mem : Specify the real memory required per node.file.write('SBATCH --constraint="volta"...
9,603
en
0.301468
# -*- coding: UTF-8 -*- # # Copyright 2018 Joachim Lusiardi # # 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...
homekit/crypto/srp.py
9,763
Implements all functions that are required to simulate an iOS HomeKit controller Implements all functions that are required to simulate an iOS HomeKit accessory Static function to generate a 16 byte random key. :return: the key as an integer Implements the Secure Remote Password (SRP) algorithm. More information can b...
1,524
en
0.77815
# Created by MechAviv # ID :: [140010000] # Snow Island : Dangerous Forest if not "o" in sm.getQuestEx(21019, "arr"): sm.avatarOriented("Effect/OnUserEff.img/guideEffect/aranTutorial/tutorialArrow3") sm.setQuestEx(21019, "arr", "o")
scripts/field/rienArrow.py
240
Created by MechAviv ID :: [140010000] Snow Island : Dangerous Forest
68
en
0.843514
import json import random import uuid import numpy as np import time import requests import traceback import pdb import math import ast import pandas as pd import pickle from qwikidata.linked_data_interface import get_entity_dict_from_api from qwikidata.sparql import return_sparql_query_results from urllib3.exceptions...
WikidataClaims/wikidata_utils.py
6,536
traceback.print_exc()traceback.print_exc()pdb.set_trace()
57
en
0.22115
# Generated by Django 3.2.3 on 2021-05-26 11:31 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('spa', '0003_alter_servic...
django_project/user_profile/migrations/0003_auto_20210526_1731.py
1,171
Generated by Django 3.2.3 on 2021-05-26 11:31
45
en
0.790673
#climber.py #Robot Code For BlueCrew 6153 import wpilib #Commands to make the robot climb. class Climber: climb_motor = wpilib.Talon #Set robot to climb when motor is on. def climb(self): self.climb_motor.set(1) #Stops the robot from climbing when motor is off. def stop_climb(self...
components/climber.py
461
climber.pyRobot Code For BlueCrew 6153Commands to make the robot climb.Set robot to climb when motor is on.Stops the robot from climbing when motor is off.Execute is a necessary method for robotpyDO NO DELETE
208
en
0.885724
# # 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...
python/pyspark/pandas/data_type_ops/base.py
16,753
The base class for binary operations of pandas-on-Spark objects (of different data types). Cast `index_ops` to BooleanType Spark type, given `dtype`. Cast `index_ops` to categorical dtype, given `dtype` and `spark_type`. Cast `index_ops` to a `dtype` (`spark_type`) that needs no pre-processing. Destination types that ...
1,716
en
0.735159
#! python from nose.tools import assert_true, assert_raises import random from networkx import random_reference, lattice_reference, sigma, omega import networkx as nx rng = random.Random(0) rng = 42 def test_random_reference(): G = nx.connected_watts_strogatz_graph(50, 6, 0.1, seed=rng) Gr = random_referenc...
SLpackage/private/thirdparty/pythonpkgs/networkx/networkx_2.2/lib/python2.7/site-packages/networkx/algorithms/tests/test_smallworld.py
2,081
! python fixture for nose tests
31
en
0.746336
# Copyright (c) 2015 Shotgun Software Inc. # # CONFIDENTIAL AND PROPRIETARY # # This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit # Source Code License included in this distribution package. See LICENSE. # By accessing, using, copying or modifying this work you indicate your # agreement to the S...
install/app_store/tk-multi-shotgunpanel/v1.4.8/python/app/work_area_button.py
10,492
UX for switching work area. This displays a "change work area" button which a user can interact with The button is designed to expand so that it is subtle until a user hovers over it. Derives from :class:`WorkAreaButton` and positions the widget relative to the bottom-right corner of the parent widget. :signal click...
3,869
en
0.836694
#!/usr/bin/env python """The setup script.""" from setuptools import find_packages, setup with open('requirements.txt') as f: INSTALL_REQUIREs = f.read().strip().split('\n') with open('README.md', encoding='utf8') as f: LONG_DESCRIPTION = f.read() CLASSIFIERS = [ 'Development Status :: 4 - Beta', 'Lic...
setup.py
1,533
The setup script. !/usr/bin/env python
39
en
0.349468
from functools import partial from itertools import product import numpy as np from tlz import curry from ..base import tokenize from ..utils import funcname from .blockwise import BlockwiseCreateArray from .core import Array, normalize_chunks from .utils import ( meta_from_array, empty_like_safe, full_l...
dask/array/wrap.py
6,472
Provide a decorator to wrap common numpy function with a broadcast trick. Dask arrays are currently immutable; thus when we know an array is uniform, we can replace the actual data by a single value and have all elements point to it, thus reducing the size. >>> x = np.broadcast_to(1, (100,100,100)) >>> x.base.nbytes ...
1,143
en
0.799889
""" Tests for lyrics_tagger """ from __future__ import unicode_literals from __future__ import print_function import unittest import mock import lyricstagger.misc as misc import test.fakers as fakers # pylint: disable=R0904 class MiscCheck(unittest.TestCase): """Test miscelanous functions""" def test_get_tags...
test/test_misc.py
3,385
Test miscelanous functions Test edit_lyrics with empty lyrics and errored edit Test edit_lyrics with empty lyrics and correct edit Test edit_lyrics with non-empty lyrics and errored edit Test edit_lyrics with non-empty lyrics and correct edit Test get_tags with broken tags Test get_tags with multi-tag file Test get_tag...
411
en
0.720331
import copy import torch import logging import numpy as np from sacred import Experiment from noge.data_loaders import get_datasets, get_test_loader, get_train_generator from noge.factory import make_env, make_memory from noge.network import make_network from noge.agent import Actor, main_loop, loop_ing from noge.trai...
scripts/train_dqn.py
6,004
data source for undirected graphs, consider both directions environment graph memory + graph preprocessing model evaluation experience collecting policy replay buffer actor: runs the simulation forward and stores to the replay buffer trainer fill up the replay buffer fit the preprocessor with buffer data
305
en
0.850947
from django.shortcuts import render # Create your views here. from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt from django.http import JsonResponse from Constants import * from Gifts.getRecommendations.RS import Users, Recommendations import json # Create your views here. def...
backend/Gifts/views.py
5,472
Create your views here. Create your views here.
47
en
0.930111
#!/usr/bin/env python # -*- coding: utf-8 -*- from runner.koan import * class AboutTuples(Koan): def test_creating_a_tuple(self): count_of_three = (1, 2, 5) self.assertEqual(5, count_of_three[2]) def test_tuples_are_immutable_so_item_assignment_is_not_possible(self): count_of_three =...
koans/koans/about_tuples.py
2,413
!/usr/bin/env python -*- coding: utf-8 -*- Note, assertMatch() uses regular expression pattern matching, so you don't have to copy the whole message. Tuples are less flexible than lists, but faster. Sometimes less confusing
223
en
0.870872
# NLP written by GAMS Convert at 04/21/18 13:51:47 # # Equation counts # Total E G L N X C B # 73 73 0 0 0 0 0 0 # # Variable counts # x b i s1s s2s sc ...
tests/examples/minlplib/ex8_3_13.py
14,087
NLP written by GAMS Convert at 04/21/18 13:51:47 Equation counts Total E G L N X C B 73 73 0 0 0 0 0 0 Variable counts x b i s1s s2s sc si Total ...
678
en
0.714293
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
stochastic_to_deterministic/hashing.py
3,742
Compute hash values for features using the hash function (A * x + c) mod 2. Args: features: NumPy float array of shape (n, d), the features to hash. hash_matrix: NumPy float array of shape (num_feature_bits, num_hash_bits), a random matrix A to construct the hash function. hash_vector: NumPy float array of s...
1,667
en
0.762199
# Copyright (C) 2018-2022 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import numpy as np from openvino.tools.mo.front.common.partial_infer.elemental import copy_shape_infer from openvino.tools.mo.graph.graph import Graph from openvino.tools.mo.ops.op import Op class PReLU(Op): op = 'PReLU' enabl...
tools/mo/openvino/tools/mo/ops/prelu.py
1,043
Copyright (C) 2018-2022 Intel Corporation SPDX-License-Identifier: Apache-2.0
77
en
0.237368
import assemblyline_client import mocks import mock from base64 import b64decode def test_bad_cert(): """Make sure that the client detects that the test cert is self signed.""" with mocks.Server() as server: try: assemblyline_client.get_client(server.address) assert False ...
test/test_v3_client.py
2,584
Make sure that the client detects that the test cert is self signed. Send an encryped apikey and decrypt it. Send an encryped password and decrypt it. The test server should let us login with no authentication. Submit a file and ensure that the same file is unpacked. Submit a file with contents Submit a file from a f...
323
en
0.954281
from datetime import datetime, timedelta from typing import List, Optional from sqlalchemy import or_ from dispatch.plugin import service as plugin_service from dispatch.event import service as event_service from dispatch.incident import flows as incident_flows from dispatch.incident.flows import incident_service fro...
src/dispatch/task/service.py
6,715
Create a new task. Delete an existing task. Get a single task by ID. Return all tasks. Get all tasks by incident id. Get all tasks by incident id and status. Get a single task by resource id. Returns all tasks that have not been resolved and are past due date. Update an existing task. TODO ensure that we don't send r...
1,099
en
0.938454
import logging import sentry_sdk from sentry_sdk.integrations.django import DjangoIntegration from sentry_sdk.integrations.logging import LoggingIntegration from sentry_sdk.integrations.celery import CeleryIntegration from .base import * # noqa from .base import env # GENERAL # -----------------------------------...
config/settings/production.py
8,558
noqa GENERAL ------------------------------------------------------------------------------ https://docs.djangoproject.com/en/dev/ref/settings/secret-key https://docs.djangoproject.com/en/dev/ref/settings/allowed-hosts DATABASES ------------------------------------------------------------------------------ noqa F405 no...
3,922
en
0.501514
#!/usr/bin/env python3 import boto3 s3_client = boto3.client('s3') raw_response = s3_client.list_buckets() for bucket in raw_response['Buckets']: print(bucket['Name'])
labs/lab2.py
172
!/usr/bin/env python3
21
fr
0.448822
# -*- coding: utf-8 -*- import os import sys import datetime from django.core.management.base import BaseCommand, CommandError from django.utils import timezone from django.conf import settings from app1.models import Thing class Command(BaseCommand): args = '<id name>' help = 'create or update thing model....
python-django/djmultidb/app1/management/commands/set_thing.py
1,803
finished when raise CommandError, exit code = 1. other exit code = 0 -*- coding: utf-8 -*- _r.id _r.create_at raise CommandError('ok')
136
en
0.536392
from django.db import models from django.contrib.auth.models import User from django.conf import settings from django.utils import timezone # Create your models here. class Article(models.Model): title=models.CharField(max_length=100) slug=models.SlugField(blank=True) body= models.TextField() ...
articles/models.py
668
Create your models here.Thumbnails
34
en
0.557331
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from botbuilder.dialogs.memory import scope_path from .memory_scope import MemoryScope class SettingsMemoryScope(MemoryScope): def __init__(self): super().__init__(scope_path.SETTINGS) self._empty_setti...
libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/settings_memory_scope.py
944
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License.
89
en
0.69103
# coding: utf-8 """ FlashArray REST API No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 2.11 Generated by: https://github.com/swagger-api/swagger-codegen.git """ import pprint import re import six import typing from ...
pypureclient/flasharray/FA_2_11/models/port_common.py
3,769
Attributes: swagger_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. Returns true if both objects are equal Keyword args: iqn (str): The iSCSI Qualifie...
1,023
en
0.652044
# Generated by Django 3.0.6 on 2020-06-22 13:39 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('src', '0010_temporaryuser'), ] operations = [ migrations.RemoveField( model_name='admin', name='username', )...
visitor_manage/src/migrations/0011_auto_20200622_1909.py
488
Generated by Django 3.0.6 on 2020-06-22 13:39
45
en
0.64577
# # Python Week-7 Day-42 # Python Classes and Objects 2 print(" -- Let us create a method in the Person class --") class Person: def __init__(self, name, age): self.name = name self.age = age def myfunc(self): print("Hello my name is " + self.name ) p1 = Person("John", "36") p1.myfunc(...
Week-7/Day-42.py
1,501
Python Week-7 Day-42 Python Classes and Objects 2
49
en
0.745573
""" @brief Pure python implementation of the Bayesian Blocks algorithm described by Jackson, Scargle et al. 2005, IEEE Signal Processing Letters, 12, 105. (http://arxiv.org/abs/math/0309285) @author J. Chiang <jchiang@slac.stanford.edu> """ # # $Id: BayesianBlocks_python.py,v 1.1.1.1 2011/09/03 00:55:59 jchiang Exp $ ...
python/BayesianBlocks_python.py
6,753
Unbinned mode: >>> bb = BayesianBlocks(arrival_times) Binned: >>> bb = BayesianBlocks(bin_content, bin_sizes, start_time) Point measurements: >>> bb = BayesianBlocks(time, flux, errors) Obtaining the piecewise constant light curve: >>> time, rate = bb.globalOpt(ncp_prior=1) @brief Pure python implementation of the B...
1,020
en
0.595403
#!/usr/bin/env python3 # PYTHON_ARGCOMPLETE_OK """Entry point for cwltool.""" import argparse import copy import functools import io import logging import os import signal import subprocess # nosec import sys import time import urllib import warnings from codecs import StreamWriter, getwriter from collections.abc imp...
cwltool/main.py
53,715
Enforce ISO8601 with both T and Z. Use the default formatter with our custom formatstring. Kill all spawned processes and exit. Note that it's possible for another thread to spawn a process after all processes have been killed, but before Python exits. Refer to the docstring for _terminate_processes() for other cavea...
3,041
en
0.831436
from scrapy import Spider from scrapy.spiders import CrawlSpider, Rule from scrapy.selector import Selector from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.linkextractors import LinkExtractor import scrapy from scrapy.spidermiddlewares.ht...
UW_Madison/UW_Madison/spiders/uw_madison_courses3.py
3,358
self.logger.info("Got successful response {}".format(response.url) )course = response.css('span.courseblockcode::text').extract_first()title = response.css('div.sc_sccoursedescs > div.courseblock > p.courseblocktitle > strong::text').extract_first()unit = response.css('.courseblockcredits::text').extract_first()descrip...
506
en
0.321796
import unittest import pandas as pd import numpy as np from resources.backend_scripts.is_data import DataEnsurer from resources.backend_scripts.load_data import LoaderCreator from resources.backend_scripts.split_data import SplitterReturner class MyTestCase(unittest.TestCase): _loader_creator = LoaderCreator() ...
AppVoor/tests/split_data_test.py
4,673
load diabetes.csv from disk true prediction and data len with shape method shape returns original column value. x doesn't have prediction column, so it must be original value - 1 use of splitterReturner with a NormalSplitter implementation do the values match in both x and y dataframes load diabetes.csv from disk use o...
1,130
en
0.701944
import sys import os import json import re import numpy as np import pandas as pd from ...
lib/MotifFindermfmd/Utils/obsolete/parser.py
5,677
keep in loop for multiple motifsprint(output)
45
en
0.638019
# coding=utf-8 # Copyright 2021 The TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
tensorflow_datasets/object_detection/open_images_challenge2019.py
8,015
BuilderConfig for OpenImages Challenge 2019 datasets. Dataset for the Detection Track. Base abstract class for Open Images Challenge 2019 datasets. Dictionary passed to the DownloadManager to download annotations. An example: {"test_annotations": "https://somewebpage.com/data/openimages/test.txt"} Returns: A dict...
1,857
en
0.831136
# -*- coding: utf-8 -*- # Generated by Django 1.11.28 on 2021-10-02 20:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('user', '0017_user_email_subscribed'), ] operations = [ migrations.CreateMo...
user/migrations/0018_loginrequest.py
707
-*- coding: utf-8 -*- Generated by Django 1.11.28 on 2021-10-02 20:31
69
en
0.715421
import logging from typing import Text, List, Optional, Dict, Any from rasa.nlu.config import RasaNLUModelConfig from rasa.nlu.training_data import TrainingData, Message from rasa.nlu.components import Component from rasa.nlu.constants import ( RESPONSE_ATTRIBUTE, TEXT_ATTRIBUTE, CLS_TOKEN, TOKENS_NAM...
rasa/nlu/tokenizers/tokenizer.py
4,367
Construct a new tokenizer using the WhitespaceTokenizer framework. Tokenize the incoming message. Tokenizes the text of the provided attribute of the incoming message. Tokenize all training data. flag to check whether to split intents split symbol for intents +1 to have a space between the last token and the __cls__ ...
325
en
0.668973
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-04 21:24 from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('registration', '0013_eventresult_scoresubmittedby'), ] ...
registration/migrations/0014_eventresult_timestamp.py
541
-*- coding: utf-8 -*- Generated by Django 1.10.5 on 2017-02-04 21:24
68
en
0.589463
# Copyright 2019, Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
utils/training_loop.py
11,381
Checks the compatibility of an iterative process with the training loop. Set up directories for experiment loops, write hyperparameters to disk. Atomic metrics writer which inlines logic from MetricsHook class. Runs federated training for a given `tff.templates.IterativeProcess`. We assume that the iterative process h...
3,397
en
0.84904
def setup_inp(inp): """Convert list of strings into list of lists, with glves/goblins replaced by tuples""" grid = [] for rowI,row in enumerate(inp.split("\n")): grid.append([x for x in row]) for colI,col in enumerate(row): if col in ["G","E"]: #Replace ene...
2018/15/helpme.py
13,744
Check for enemy in adjacent square Attack weakest adjacent enemy, if one is there If multiple weakest enemies, attack in reading order Return the modified board, and a boolean indicating whether anyone died Perform a breadth first search for each adjacent tile Although not the most efficient, the approach is still fast...
3,790
en
0.899012
#!/usr/bin/env python3 import math import csv import itertools from pprint import pprint import func INPUTFILE = './task04.input' def main(): accept = 0 with open(INPUTFILE, mode='r') as csvfile: reader = csv.reader(csvfile, delimiter=" ") lines = list(reader) for line in lines: ...
task04_a.py
738
!/usr/bin/env python3
21
fr
0.448822
# Date 3/10/2020 # __Author__ : AdityaLata # __Package__ : Python 3 # __GitHub__ : https://www.github.com/adityalata from Python.DataStructure.TreeDS.Node import Node # A utility function to check if 'c' is an operator def isOperator(c): if c == '+' or c == '-' or c == '*' or c == '/' or c == '^': ...
Python/DataStructure/TreeDS/ExpressionTree.py
2,147
Date 3/10/2020 __Author__ : AdityaLata __Package__ : Python 3 __GitHub__ : https://www.github.com/adityalata A utility function to check if 'c' is an operator Returns root of constructed tree for given postfix expression string Traverse through every character of input expression for space separated postfix...
673
en
0.720372
# Copyright (c) 2019 by LatentAI Inc. # All rights reserved. # This file is part of the LEIP(tm) SDK, # and is released under the "LatentAI Commercial Software License". # Please see the LICENSE file that should have been included as part of # this package. # # @file tf_inference.py # # @author Videet Parekh ...
inference/tf_inference.py
3,401
Copyright (c) 2019 by LatentAI Inc. All rights reserved. This file is part of the LEIP(tm) SDK, and is released under the "LatentAI Commercial Software License". Please see the LICENSE file that should have been included as part of this package. @file tf_inference.py @author Videet Parekh @date Wed 16 Dec 2...
865
en
0.818275
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 評価用のテストパターン作成ツール集 """ import os import cv2 import matplotlib.pyplot as plt import numpy as np from colour.colorimetry import CMFS, ILLUMINANTS from colour.models import XYZ_to_xy, xy_to_XYZ, XYZ_to_RGB, RGB_to_XYZ from colour.models import xy_to_xyY, xyY_to_XYZ, Lab...
ty_lib/test_pattern_generator2.py
54,415
以下のような、中心がGray、周りは CIELAB 空間の a*b*平面のカラーパッチの RGB値のリストを得る。 https://user-images.githubusercontent.com/3609012/75444470-d3bc5600-59a6-11ea-962b-c315648782a9.png 得られたデータは並べ替えが済んでいないため、calc_rad_patch_idx2() で 得られる変換テーブルを使った変換が必要。 xy色度図のプロットのための馬蹄形の外枠のxy値を求める。 Returns ------- array_like xy coordinate for chromaticity d...
18,232
ja
0.470357
__license__ = "MIT" __copyright__ = r""" MIT License Copyright (c) 2017 Gregor Engberding 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 ri...
WindowsTelemetryViewer/PyQtJsonModel.py
5,359
process the key/value pairs process the values in the list value is processed print("QJsonModel: error loading Json")
117
en
0.456805
""" #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Ontology Engineering Group http://www.oeg-upm.net/ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Copyright (C) 2016 Ontology Engineering Group. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
setup.py
1,939
#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Ontology Engineering Group http://www.oeg-upm.net/ #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=# Copyright (C) 2016 Ontology Engineering Group. #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-...
965
en
0.4306
""" The primary specified return wavefunction quantities. """ result_wavefunction = {} # Orbitals result_wavefunction["orbitals_a"] = { "type": "string", "description": "Alpha-spin orbitals in the AO basis of the primary return. " } result_wavefunction["orbitals_b"] = { "type": "string", "descripti...
qcschema/dev/wavefunction/result_wavefunction.py
1,572
The primary specified return wavefunction quantities. Orbitals Density Fock matrix Eigenvalues Occupations
109
en
0.487226
# Copyright 2017 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
kuryr_kubernetes/tests/unit/cni/test_binding.py
9,287
Copyright 2017 Red Hat, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
626
en
0.866552
# -*- coding: utf-8 -*- # # 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...
lib/surface/compute/instances/create_with_container.py
17,613
Command for creating VM instances running container images. Alpha version of compute instances create-with-container command. Command for creating VM instances running container images. Register parser args. Register parser args. Add flags shared by all release tracks. Command for creating VM instances running Docker i...
920
en
0.830743
"""Utility functions and classes """ import sys import inspect import warnings import importlib.util from enum import Enum from pathlib import Path from weakref import WeakSet from collections import namedtuple from functools import partial, wraps from types import ModuleType, MethodType from typing import Union, Calla...
scanpy/_utils.py
25,073
Convenience class for accessing neighbors graph representations. Allows to access neighbors distances, connectivities and settings dictionary in a uniform manner. Parameters ---------- adata AnnData object. key This defines where to look for neighbors dictionary, connectivities, distances. neigh = N...
6,588
en
0.713138
# -*- coding: utf-8 -*- import warnings from datetime import datetime, timedelta import operator import pytest import numpy as np import pandas as pd from pandas.compat.numpy import np_datetime64_compat import pandas.util.testing as tm from pandas.errors import PerformanceWarning, NullFrequencyError from pandas impo...
pandas/tests/indexes/datetimes/test_arithmetic.py
39,525
-*- coding: utf-8 -*- Several ways of representing two hours no tzaware version available GH19301 by convention datetime.date is not considered comparable to Timestamp or DatetimeIndex. This may change in the future. GH19301 GH19301 GH19301 Check pd.NaT is handles as the same as np.nan Check pd.NaT is handles as the s...
2,240
en
0.676531
def user_display_name(user): """ Returns the preferred display name for the given user object: the result of user.get_full_name() if implemented and non-empty, or user.get_username() otherwise. """ try: full_name = user.get_full_name().strip() if full_name: return full_na...
wagtail_review/text.py
644
Returns the preferred display name for the given user object: the result of user.get_full_name() if implemented and non-empty, or user.get_username() otherwise. we were passed None or something else that isn't a valid user object; return empty string to replicate the behaviour of {{ user.get_full_name|default:user.ge...
333
en
0.621357
# # Tencent is pleased to support the open source community by making Angel available. # # Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. # # Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in # compliance with the License. You may obtain a copy of ...
angel-ps/python/build/lib/pyangel/running_mode.py
991
Enum for running mode Tencent is pleased to support the open source community by making Angel available. Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the BSD 3-Clause License (the "License"); you may not use this file except in compliance with the License. You may obtain ...
793
en
0.857331
#!/usr/bin/env python2 # OpenPOWER Automated Test Project # # Contributors Listed Below - COPYRIGHT 2015,2017 # [+] International Business Machines 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 th...
testcases/FWTS.py
10,122
!/usr/bin/env python2 OpenPOWER Automated Test Project Contributors Listed Below - COPYRIGHT 2015,2017 [+] International Business Machines 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 ht...
1,863
en
0.894286
""" My Data My Consent - Developer API Unleashing the power of data consent by establishing trust. The Platform Core Developer API defines a set of capabilities that can be used to request, issue, manage and update data, documents and credentials by organizations. The API can be used to request, manage and upd...
test/test_data_protection_officer.py
1,250
DataProtectionOfficer unit test stubs Test DataProtectionOfficer My Data My Consent - Developer API Unleashing the power of data consent by establishing trust. The Platform Core Developer API defines a set of capabilities that can be used to request, issue, manage and update data, documents and credentials by organiza...
806
en
0.801492
from .encoder import CKKSEncoder # noqa: F401 from .encrypter import CKKSEncrypter # noqa: F401 from .plaintext import CKKSPlaintext # noqa: F401
src/aijack/defense/ckks/__init__.py
149
noqa: F401 noqa: F401 noqa: F401
32
uz
0.36552
"""Base classes for an Ambianic Edge device abstraction""" from pydantic import BaseModel, Field class DeviceInfo(BaseModel): version: str = Field(None, description="Ambianic Edge software version.") display_name: str = Field( None, description="User friendly display name for this device." ) n...
src/ambianic/device.py
443
Base classes for an Ambianic Edge device abstraction
52
en
0.491518
#!/usr/bin/env python ############################################################## # $Id$ # Project: MiSeq Metagenomic Assembly pipeline for Nephele project # Language: Python 2.7 # Author: Alex Levitsky # History: July 2015 Start of development ############################################################## ...
Pipes/pipeline-scripts/NGOPT/ngopt.py
6,502
!/usr/bin/env python $Id$ Project: MiSeq Metagenomic Assembly pipeline for Nephele project Language: Python 2.7 Author: Alex Levitsky History: July 2015 Start of development check for end of file ignore empty lines ignore comments clear list read_config send2log print >> sys.stderr, "Executing:",cmd exec_sys ...
659
en
0.519915
from django.shortcuts import render from django.http import HttpResponseRedirect # <HINT> Import any new Models here from .models import Course, Enrollment, Question, Choice, Submission , Lesson from django.contrib.auth.models import User from django.shortcuts import get_object_or_404, render, redirect from django.url...
onlinecourse/views.py
6,268
<HINT> Import any new Models here Get an instance of a logger Create your views here. Check if user exists Check if user enrolled CourseListView Create an enrollment <HINT> Create a submit view to create an exam submission record for a course enrollment, you may implement it based on following logic: Get user and cours...
1,090
en
0.905071
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. ''' In this file, we define the classes that live inside 'worker 0', the worker responsible for orchestration and aggregation. The main class is the OptimizationServer, which sends clients to the other workers to process and combines the resulting...
core/server.py
27,299
Implement Server's orchestration and aggregation. This is the main Server class, that actually implements orchestration and aggregation, inheriting from `federated.Server`, which deals with communication only. The `train` method is central in FLUTE, as it defines good part of what happens during training. Args: ...
4,159
en
0.784774
KEYBOARD_INTERRUPT = 1 ARGUMENT_ERROR = 2 # When playlists, albums, artists, users aren't found. URI_NOT_FOUND_ERROR = 5
spotdl/command_line/exitcodes.py
123
When playlists, albums, artists, users aren't found.
52
en
0.959479
import random import numpy as np def write_to_file(filename,no_locations,no_agents): info_dict={} #ID enumerates from 0 to n-1 header='Location Index:Agents:Time Interval' n=random.randint(10,20) f=open(filename,'w') f.write(str(n)+'\n') f.write(header+'\n') for i in range(n): line=str(random.randint(0,no...
examples/Basic_Disease_Models/Example_1/generate_events.py
839
ID enumerates from 0 to n-1
27
en
0.703547
# Generated by Django 2.2.2 on 2019-09-01 09:08 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('auth', '0011_update_proxy_permissions'), ] operations = [ migrations.CreateModel( name='User', f...
app/core/migrations/0001_initial.py
1,701
Generated by Django 2.2.2 on 2019-09-01 09:08
45
en
0.564323
""" Thank you Funkwhale for inspiration on the HTTP signatures parts <3 https://funkwhale.audio/ """ import datetime import logging from typing import Union import pytz from Crypto.PublicKey.RSA import RsaKey from requests_http_signature import HTTPSignatureHeaderAuth from federation.types import RequestType from fe...
federation/protocols/activitypub/signing.py
1,652
Get HTTP signature authentication for a request. Verify HTTP signature in request against a public key. Thank you Funkwhale for inspiration on the HTTP signatures parts <3 https://funkwhale.audio/
197
en
0.797497
# -*- coding=utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals from ctypes import c_uint64 import numpy as np from .utils import CxxPointer, _call_with_growing_buffer from .ffi import chfl_match class Selection(CxxPointer): """ Select atoms in a :py:class:`Frame` with a sele...
chemfiles/selection.py
2,992
Select atoms in a :py:class:`Frame` with a selection language. The selection language is built by combining basic operations. Each basic operation follows the ``<selector>[(<variable>)] <operator> <value>`` structure, where ``<operator>`` is a comparison operator in ``== != < <= > >=``. Refer to the `full documentatio...
1,072
en
0.804614