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 2020 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/async_greeter_server.py | 1,745 | The Python AsyncIO implementation of the GRPC helloworld.Greeter server.
Copyright 2020 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 ... | 805 | en | 0.85179 |
import scipy.sparse as sp
import numpy as np
import torch
import time
import os
from configparser import ConfigParser
import sys
sys.path.append('/home/shiyan/project/gcn_for_prediction_of_protein_interactions/')
from src.util.load_data import load_data, sparse_to_tuple, mask_test_edges, preprocess_graph
from src.uti... | src/graph_nheads_att_gan/train.py | 9,490 | load config file data catalog path train file path model save/load path model param config 加载相关数据 去除对角线元素 下边的右部分为:返回adj_orig的对角元素(一维),并增加一维,抽出adj_orig的对角元素并构建只有这些对角元素的对角矩阵 返回D^{-0.5}SD^{-0.5}的coords, data, shape,其中S=A+I adj_label = sparse_to_tuple(adj_label) create model define optimizer 稀疏张量被表示为一对致密张量:一维张量和二维张量的索引。可以通... | 448 | zh | 0.654981 |
# Copyright 2019 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... | tensorboard/plugins/hparams/backend_context_test.py | 14,082 | Sorts the repeated fields of an Experiment message.
Tests for backend_context.
Copyright 2019 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:/... | 942 | en | 0.76985 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
# Creat... | qa/rpc-tests/fundrawtransaction.py | 24,465 | !/usr/bin/env python2 Copyright (c) 2014-2015 The Bitcoin Core developers Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php. Create one-input, one-output, no-fee transaction: This test is not meant to test fee estimation and we'd like to ... | 2,671 | en | 0.800652 |
# Copyright (c) 2017, John Skinner
import unittest
import numpy as np
import arvet.database.tests.database_connection as dbconn
from arvet.config.path_manager import PathManager
import arvet.batch_analysis.task as task
class MockTask(task.Task):
def run_task(self, path_manager: PathManager):
pass
def... | arvet/batch_analysis/tests/test_task.py | 10,096 | Copyright (c) 2017, John Skinner Remove the collection as the start of the test, so that we're sure it's empty Clean up after ourselves by dropping the collection for this model Load all the entities Load all the entities Make sure that the node id and job id match the state | 275 | en | 0.922688 |
# coding: utf-8
"""
vautoscaling
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from ncloud_vautoscaling.model.process import Process # noqa: F401,E501
class ResumeProcessesResponse(object):
"""NOTE: This class is auto gene... | lib/services/vautoscaling/ncloud_vautoscaling/model/resume_processes_response.py | 6,146 | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Returns true if both objects are equal
ResumeProcessesResponse - a model defined in Swagger
Returns true if both objects are not equal
For `print` and `pprint`
Gets the process_list of this ResumeProcessesResponse... | 2,047 | en | 0.548821 |
#!/usr/bin/env python3
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from . import css_checker
from os import path as os_path
import re
from sys import path as sys_path
import unittest
_HERE = os_path.d... | tools/web_dev_style/css_checker_test.py | 18,203 | !/usr/bin/env python3 Copyright 2015 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. | 177 | en | 0.867449 |
from typing import Dict, List, Optional
from db.sql.dal.general import sanitize
from db.sql.utils import query_to_dicts
class Region:
admin: str
admin_id: str
region_type: str
country: str
country_id: str
admin1: Optional[str]
admin1_id: Optional[str]
admin2: Optional[str]
admin2_i... | db/sql/dal/regions.py | 14,135 | Returns a list of admin1s. If country or country_id is specified, return the admin1s only of that country.
If admin1s or admin1_ids are provided, only those admins are returned.
If all arguments are empty, all admin1s in the system are returned.
Returns a list of admin2s. If admin1 or admin1_id is specified, return the... | 1,409 | en | 0.821192 |
# -*- coding: utf-8 -*-
import json
import csv
import scrapy
import re
from locations.items import GeojsonPointItem
COOKIES = {
"bm_sz": "04B124C1C96D68082A9F61BAAAF0B6D5~YAAQdjsvF22E8Xl6AQAACr1VfAxPEt+enarZyrOZrBaNvyuX71lK5QPuDR/FgDEWBZVMRhjiIf000W7Z1PiAjxobrz2Y5LcYMH3CvUNvpdS3MjVLUMGwMEBCf9L5nD5Gs9ho2YL8T7Tz7lY... | locations/spiders/aldi_uk.py | 3,783 | -*- coding: utf-8 -*- | 21 | en | 0.767281 |
#!/usr/bin/env python
# vim: set sts=4 sw=4 et:
import time
import xmlrpc.client
from . import players
from . import rpc
from .common import GameState, CardSet, GameError, RuleError, ProtocolError, simple_decorator
from .events import EventList, CardPlayedEvent, MessageEvent, TrickPlayedEvent, TurnEvent, StateChangedE... | tupelo/xmlrpc.py | 4,427 | XML-RPC command line interface human player.
Client-side proxy object for the server/GameController.
Catch known exceptions and translate them to
XML-RPC faults.
Catch known XML-RPC faults and translate them to
custom exceptions.
Wait for this player's turn.
!/usr/bin/env python vim: set sts=4 sw=4 et: | 304 | en | 0.737045 |
import time
import numpy as np
import tensorflow as tf
import layers as L
import vat
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string('device', '/gpu:0', "device")
tf.app.flags.DEFINE_string('dataset', 'cifar10', "{cifar10, svhn}")
tf.app.flags.DEFINE_string('log_dir', "", "log_dir")
tf.app.flags.DEFINE_inte... | train_semisup.py | 12,518 | at_loss = vat.adversarial_loss(x, y, nll_loss, is_training=False) losses['AT_loss'] = at_loss ul_u = random_sphere(ul_images.shape) ul_u_eval_train = random_sphere(ul_images_eval_train.shape) ul_u_eval_test = random_sphere(images_eval_test.shape) Build training graph Build eval graph np.random.choice(len(ul_images_np),... | 549 | en | 0.370548 |
"""
File: Milestone1.py
Name: 黃科諺
-----------------------
This file tests the milestone 1 for
our babyname.py project
"""
import sys
def add_data_for_name(name_data, year, rank, name):
name_info = {year: rank}
if name in name_data:
if year in name_data[name]:
exist_rank = int(name_data[na... | stanCode_projects/name_searching_system/milestone1.py | 2,448 | File: Milestone1.py
Name: 黃科諺
-----------------------
This file tests the milestone 1 for
our babyname.py project
------------- DO NOT EDIT THE CODE BELOW THIS LINE ---------------- | 183 | en | 0.511303 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.utilities import await_callback
from compas_fab.backends.interfaces import AddCollisionMesh
from compas_fab.backends.ros.messages import ApplyPlanningSceneRequest
from compas_fab.backends.ros.messa... | src/compas_fab/backends/ros/backend_features/move_it_add_collision_mesh.py | 2,225 | Callable to add a collision mesh to the planning scene.
Add a collision mesh to the planning scene.
Parameters
----------
collision_mesh : :class:`compas_fab.robots.CollisionMesh`
Object containing the collision mesh to be added.
options : dict, optional
Unused parameter.
Returns
-------
``None`` | 307 | en | 0.356548 |
"""
libquantum example 3: 03_sweep_linear.py
Construct classic linear chirp and illustrate CWT and STFT TRFs.
"""
import os
from pathlib import Path
import numpy as np
import scipy.io.wavfile
import matplotlib.pyplot as plt
from libquantum import atoms, entropy, scales, spectra, utils, synthetics
import libquantum.plo... | examples/03_sweep_linear.py | 6,664 | libquantum example 3: 03_sweep_linear.py
Construct classic linear chirp and illustrate CWT and STFT TRFs.
Do you want to export a wav file? True or False If True, saves to home directory Or can specify a preferred wav file directory home_dir: str = "/Users/mgarces/Documents/DATA_API_M/synthetics" Chirp type sig_wf_sa... | 817 | en | 0.679039 |
# -*- coding: utf-8 -*-
from app.libs.utils import data_decode
import socket, socketserver, threading
import traceback
class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
ip = ""
port = 0
timeOut = 100
def __init__(self, request, client_address, server):
from app.service.device i... | app/service/socketservice.py | 3,147 | -*- coding: utf-8 -*- time.sleep(1) server_thread.join() | 56 | en | 0.592302 |
from django.conf.urls import patterns, url
from django.contrib.contenttypes.models import ContentType
from kitsune.questions.feeds import (
QuestionsFeed, AnswersFeed, TaggedQuestionsFeed)
from kitsune.questions.models import Question, Answer
from kitsune.flagit import views as flagit_views
urlpatterns = pattern... | kitsune/questions/urls.py | 5,173 | AAQ AAQ flow for Marketplace TODO: Factor out `/(?P<question_id>\d+)` below Feeds Note: this needs to be above questions.list because "feed" matches the product slug regex. Mark as spam Question lists Flag content ("Report this post") Subcribe by email | 252 | en | 0.861757 |
# -*- coding: utf-8 -*-
# -*- coding: utf8 -*-
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import (
CommandLine,
CommandLineInputSpec,
SEMLikeCommandLine,
TraitedSpec,
File,
Directory,
... | nipype/interfaces/slicer/filtering/extractskeleton.py | 2,515 | title: Extract Skeleton
category: Filtering
description: Extract the skeleton of a binary object. The skeleton can be limited to being a 1D curve or allowed to be a full 2D manifold. The branches of the skeleton can be pruned so that only the maximal center skeleton is returned.
version: 0.1.0.$Revision: 2104 $(al... | 1,006 | en | 0.777514 |
class Solution:
def coinChange(self, coins, amount):
"""
:type coins: List[int]
:type amount: int
:rtype: int
"""
# max value taken as amount+1 because in worst case, it can be amount - when denoms of only 1
res = [amount+1]*(amount+1)
res[0] = 0
... | Session1_2018/coinChange.py | 572 | :type coins: List[int]
:type amount: int
:rtype: int
max value taken as amount+1 because in worst case, it can be amount - when denoms of only 1 | 154 | en | 0.789975 |
from interpolate import interpolate_doc
foo = """
hello
world
"""
bar = "foo bar\nbaz"
class Foo:
# cf matplotlib's kwdoc.
__kw__ = "the kw of foo"
@interpolate_doc
def func():
"""
this is a docstring
{interpolate_example.foo}
{bar}
{Foo!K}
"""
try:
@interpolat... | interpolate_example.py | 472 | fields {must} be preceded by whitespace
this is a docstring
{interpolate_example.foo}
{bar}
{Foo!K}
cf matplotlib's kwdoc. | 131 | en | 0.337323 |
import discord
from discord.ext import commands
# Set slash commands=True when constructing your bot to enable all slash commands
# if your bot is only for a couple of servers, you can use the parameter
# `slash_command_guilds=[list, of, guild, ids]` to specify this,
# then the commands will be much faster to upload.
... | examples/slash_commands.py | 1,343 | Set slash commands=True when constructing your bot to enable all slash commands if your bot is only for a couple of servers, you can use the parameter `slash_command_guilds=[list, of, guild, ids]` to specify this, then the commands will be much faster to upload. You can use commands.Option to define descriptions for yo... | 528 | en | 0.75143 |
#Python program to get the size of an object in bytes
import sys
Object = input("Enter any object: ")
print(f'The size of the object {Object} is {sys.getsizeof(Object)} bytes')
| GodwillOnyewuchi/Phase 1/Python Basic 2/day 9 task/task 9.py | 178 | Python program to get the size of an object in bytes | 52 | en | 0.871528 |
from importlib import import_module, reload
import pytest
import sys
from unittest.mock import patch
from rest_framework import status
from django.contrib.auth.models import Permission, Group
from django.conf import settings
from django.urls import clear_url_caches
from django.urls import reverse
from .factories imp... | tests/users/test_views.py | 15,847 | Test that URLs and redirects are in place.
We'll add the user to a group, as well as changing their details The user's details should have changed to reflect the posted values And they should have been added to a group Set this flag to True and repeat previous test Post changes to the view The users details should re... | 2,082 | en | 0.937307 |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
"""
-------------------------------------------------
File Name: DbClient.py
Description : DB工厂类
Author : JHao
date: 2016/12/2
-------------------------------------------------
Change Activity:
2016/12/02: DB工厂类
... | db/dbClient.py | 3,708 | DbClient DB工厂类 提供get/put/update/pop/delete/exists/getAll/clean/getCount/changeTable方法
抽象方法定义:
get(): 随机返回一个proxy;
put(proxy): 存入一个proxy;
pop(): 顺序返回并删除一个proxy;
update(proxy): 更新指定proxy信息;
delete(proxy): 删除指定proxy;
exists(proxy): 判断指定proxy是否存在;
getAll(): 返回所有代理;
clean(): 清除所有proxy信息;
... | 933 | zh | 0.281846 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | kubernetes/test/test_v1alpha1_priority_class.py | 1,002 | V1alpha1PriorityClass unit test stubs
Test V1alpha1PriorityClass
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
coding: utf-8 FIXME: construct object wit... | 442 | en | 0.550875 |
"""Forms related to import operations."""
from __future__ import unicode_literals
from django import forms
from django.utils.translation import ugettext_lazy
class ImportDataForm(forms.Form):
"""Base form to import objects."""
sourcefile = forms.FileField(label=ugettext_lazy("Select a file"))
sepchar ... | modoboa/admin/forms/import_.py | 1,358 | Base form to import objects.
A form to import identities.
Forms related to import operations. | 93 | en | 0.863236 |
End of preview. Expand in Data Studio
No dataset card yet
- Downloads last month
- 3