text
string
size
int64
token_count
int64
#!/usr/bin/env python # Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: ...
5,242
2,201
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Esse arquivo possui algumas modificações em relação ao arquivo apresentado no vídeo do YouTube # Não deixe de assistir o vídeo e estudar pela documentação ofical D...
5,384
1,816
import re import datetime from javaccflab.lexer import parse from javaccflab.java_token import TokenType, Token, update_token_value class Formatter: def __init__(self, files): self.__files = files self.__file = None self.__tokens = [] self.__to_fix = dict() def process(self): ...
26,616
7,892
""" .. module:: CAttackEvasionPGDExp :synopsis: Evasion attack using Projected Gradient Descent. .. moduleauthor:: Battista Biggio <battista.biggio@unica.it> """ from secml.adv.attacks.evasion import CAttackEvasionPGDLS class CAttackEvasionPGDExp(CAttackEvasionPGDLS): """Evasion attacks using Projected Gradi...
3,783
1,134
import sqlite3 class ManageData: def __init__(self, queue_tracker_db, email_tracker_db, delivery_tracker_db): self.queue_tracker_db = queue_tracker_db self.email_tracker_db = email_tracker_db self.delivery_tracker_db = delivery_tracker_db def manage_queue_tracker(self, fields): ...
3,172
984
import math def g_path_regularize(fake_img, latents, mean_path_length, decay=0.01): noise = torch.randn_like(fake_img) / math.sqrt( fake_img.shape[2] * fake_img.shape[3] ) grad, = autograd.grad( outputs=(fake_img * noise).sum(), inputs=latents, create_graph=True ) path_lengths = tor...
561
216
######################################################## FLASK SETTINGS ############################################################## #Variable used to securly sign cookies ##THIS IS SET IN DEV ENVIRONMENT FOR CONVENIENCE BUT SHOULD BE SET AS AN ENVIRONMENT VARIABLE IN PROD SECRET_KEY = "dev" ########################...
583
167
import numpy as np from typing import Tuple, Union, Optional from autoarray.structures.arrays.two_d import array_2d_util from autoarray.geometry import geometry_util from autoarray import numba_util from autoarray.mask import mask_2d_util @numba_util.jit() def grid_2d_centre_from(grid_2d_slim: np.ndarray) ...
37,122
13,405
# coding: utf-8 import requests, math import gevent from gevent.queue import Queue from gevent import monkey; monkey.patch_all() from pyquery import PyQuery class Proxies(): def __init__(self): self.domestic_gn_url = 'http://www.kuaidaili.com/free/inha/{0}/' self.domestic_pt_url = 'http://www.kuai...
2,689
979
# Copyright 2021 TUNiB inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
21,092
5,674
# coding: utf-8 """ Name: upper_air_humidity.py Make upper level weather chart. Usage: python3 upper_air_humidity.py --file <ncfile> Author: Ryosuke Tomita Date: 2022/01/07 """ import argparse from ncmagics import fetchtime, japanmap, meteotool def parse_args() -> dict: """parse_args. set file path. A...
3,042
1,098
# # Autogenerated by Thrift Compiler (0.13.0) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # # options string: py # from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException from thrift.protocol.TProtocol import TProtocolException from thrift.TRecursive impo...
22,976
7,910
#!/usr/bin/env python import unittest import sys import os import string import time import socket import fileinput import platform import re try: import subprocess32 as subprocess except: import subprocess import pg def get_port_from_conf(): file = os.environ.get('MASTER_DATA_DIRECTORY')+'/postgresql.con...
32,515
11,383
''' 请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。例如,字符串"+100"、"5e2"、"-123"、"3.1416"、"-1E-16"、"0123"都表示数值,但"12e"、"1a3.14"、"1.2.3"、"+-5"及"12e+5.4"都不是。 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/biao-shi-shu-zhi-de-zi-fu-chuan-lcof ''' class Solution: def isNumber(self, s: str) -> bool: states = [ { ' ...
1,406
618
""" Copyright 2013 Rackspace, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software...
13,211
4,795
def init(): global brightness global calibration_mode brightness = 500 calibration_mode = False
114
36
from datetime import date from django.core.cache import cache from django.db.models import Q, F from django.shortcuts import render from django.shortcuts import get_object_or_404 from django.views.generic import ListView, DetailView #from silk.profiling.profiler import silk_profile from config.models import SideBar f...
4,508
1,800
# -*- coding: utf-8 -*- """ Created on Sat May 7 11:38:18 2016 @author: thomasbarillot VMI control """ from ctypes import cdll #slib="VMIcrtl_ext.dll" #hlib=cdll('VMIcrtl.dll') import VMIcrtl_ext test=VMIcrtl_ext.VMIcrtl() #%% print test.GetFilename() #%% test.setFilename('20161115_1841.dat') print test.GetFilen...
618
303
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import llnl.util.tty as tty from spack import * import spack.architecture import os class Openssl(Package): # Uses F...
8,119
4,186
# -*- coding: utf-8 -*- # Copyright (c) 2014, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. # Adapted from PyQtGraph import sys from . import ptime from .. import config class Profiler(object): """Simple profiler allowing directed, hierarchical measurement of ti...
4,799
1,391
from django.contrib.auth import get_user_model from djangosaml2idp.processors import BaseProcessor User = get_user_model() class TestBaseProcessor: def test_extract_user_id_configure_by_user_class(self): user = User() user.USERNAME_FIELD = 'email' user.email = 'test_email' asse...
764
257
class Node: def __init__(self, data): self.data = data self.prev = None self.next = None class SingleLinkedList: def __init__(self): self.head = None def add(self, ele): new_node = Node(ele) if self.head is None: self.head = new_node ...
1,840
569
__all__ = ["data_setup", "chart_params", "base_params"]
55
20
from datetime import datetime from typing import Any, List, Optional, Union from pydantic import BaseModel, Field, HttpUrl, validator from pydantic.dataclasses import dataclass class Index(BaseModel): id: str name: str time_gate: HttpUrl = Field(alias="timegate") cdx_api: HttpUrl = Field(alias="cdx-a...
1,851
577
"""Tools for managing OS errors. """ from __future__ import print_function from __future__ import unicode_literals import errno from contextlib import contextmanager import sys import platform from . import errors from six import reraise _WINDOWS_PLATFORM = platform.system() == 'Windows' class _ConvertOSErrors(...
3,453
1,057
#!/usr/bin/python # Copyright (c) 2015, BROCADE COMMUNICATIONS SYSTEMS, INC # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # 1. Redistributions of source code must retain the above copyright n...
5,390
1,883
# @Author: Stijn Van Hulle <stijnvanhulle> # @Date: 2016-11-28T13:51:38+01:00 # @Email: me@stijnvanhulle.be # @Last modified by: stijnvanhulle # @Last modified time: 2016-12-20T12:51:07+01:00 # @License: stijnvanhulle.be #!/usr/bin/env python import time import datetime import math import sys import json impor...
3,829
1,608
def solution(A): total = sum(A) m = float('inf') left_sum = 0 for n in A[:-1]: left_sum += n v = abs(total - 2*left_sum) if v < m: m = v return m
204
81
import re import os from bs4 import BeautifulSoup from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.files import File from pages.models import Page, Image PEP_TEMPLATE = 'pages/pep-page.html' pep_url = lambda num: 'dev/peps/pep-{}/'.format(num) def check_pat...
8,184
2,824
from .core import EqualityHashKey, unzip from .parallel import fold
68
20
from flask import Flask app = Flask(__name__, static_folder='static') from app import routes
95
29
import os import pysatl from pysatl import CAPDU if __name__ == "__main__": def check(hexstr, expected): capdu = CAPDU.from_hexstr(hexstr) if capdu != expected: raise Exception("Mismatch for input '"+hexstr+"'\nActual: "+str(capdu)+"\nExpected: "+str(expected)) def gencase(* ...
2,421
1,099
#!/usr/bin/python from math import sin, cos, tan, atan, pi, acos, sqrt, exp, log10 import sys, os import copy import random import numpy as np import multiprocessing as mp import ConfigParser sys.path.append('./bin') import mGLS, mMGLS sys.path.append('./src') from EnvGlobals import Globals import mgls_io import mgls_m...
3,993
1,492
#! /usr/bin/env python3 """ constants.py - Contains all constants used by the device manager Author: - Pablo Caruana (pablo dot caruana at gmail dot com) Date: 12/3/2016 """ number_of_rows = 3 # total number rows of Index Servers number_of_links = 5 # number of links to be ...
495
155
import cv2 import numpy as np def DoG(image, size, sigma, k=1.6, gamma=1.): g1 = cv2.GaussianBlur(image, (size, size), sigma) g2 = cv2.GaussianBlur(image, (size, size), sigma*k) return g1 - gamma * g2 def XDoG(image, size, sigma, eps, phi, k=1.6, gamma=1.): eps /= 255 d = DoG(image, size, sigma, ...
1,015
455
# Original work Copyright 2018 The Google AI Language Team Authors. # Modified work Copyright 2019 Rowan Zellers # # 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/...
8,070
2,629
import logging import george import numpy as np from robo.priors.default_priors import DefaultPrior from robo.models.gaussian_process import GaussianProcess from robo.models.gaussian_process_mcmc import GaussianProcessMCMC from robo.maximizers.random_sampling import RandomSampling from robo.maximizers.scipy_optimizer ...
5,055
1,525
# Generated by Django 3.1.13 on 2021-10-29 11:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0095_bisericapage_utitle'), ] operations = [ migrations.AddField( model_name='bisericapage', name='datare_an...
402
143
from app.api.utils.models_mixins import Base from app.extensions import db class MMSSurfaceBulkSampleActivity(Base): __tablename__ = "surface_bulk_sample_activity" __table_args__ = {"schema": "mms_now_submissions"} id = db.Column(db.Integer, primary_key=True) messageid = db.Column(db.Integer, db.Forei...
664
238
from enum import Enum class RemoteControlLock(Enum): OFF = 0 ON = 1 def map_to_state(data: int): return RemoteControlLock(data) class RemoteControlLockCommands(object): _command = "km" def __init__(self, send_command): self._send_command = send_command async def get_state(self): ...
678
224
import sys from com.bridgelabz.utility.Utility import Utility class PowerOf2: def start(self): number=int(sys.argv[1]) print(number) for i in Utility().powerof2(number): print(i) return PowerOf2().start()
253
82
# This program scraps data from job postings on the website workinstartups.com and appends it to an excel worksheet. import os from datetime import datetime, timedelta from selenium import webdriver from app import web_scraper from app import excel job_list, last_date = [], None file_path = os.path.abspath("main.py")...
2,256
800
#!/usr/bin/python2 # # Copyright (c) 2012 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # """ Some common boilerplates and helper functions for source code generation in files dgen_test_output.py and dgen_decode_out...
2,723
904
""" Functions for loading input data. Author: Patrick Henriksen <patrick@henriksen.as> """ import os import numpy as np def load_img(path: str, img_nums: list, shape: tuple) -> np.array: """ Loads a image in the human-readable format. Args: path: The path to the to the folder with...
2,507
865
# -*- coding: utf-8 -*- ################################################################################ ## Form generated from reading UI file 'splash_screen.ui' ## ## Created by: Qt User Interface Compiler version 5.15.1 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! ############...
2,527
898
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: # @param {TreeNode} root # @param {integer} sum # @return {boolean} def hasPathSum(self, root, sum): if not root: ret...
634
192
""" Collection of query wrappers / abstractions to both facilitate data retrieval and to reduce dependency on DB-specific API. """ from __future__ import print_function, division from datetime import datetime, date, timedelta import warnings import traceback import itertools import re import numpy as np import pandas...
41,041
11,719
class Solution: def XXX(self, s): """ :type s: str :rtype: int """ cnt, tail = 0, len(s) - 1 while tail >= 0 and s[tail] == ' ': tail -= 1 while tail >= 0 and s[tail] != ' ': cnt += 1 tail -= 1 return cnt
311
109
"""Meta is a module contains objects that will customize the behavior of python.""" from abc import ABC from abc import ABCMeta from abc import abstractmethod from typing import Any from typing import Callable import Systerm # Metaclass class Metaclass(ABCMeta): """A metaclass to customize the behavior of all cla...
4,411
1,212
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the Apache 2.0 License. import infra.e2e_args import infra.ccf import infra.jsonrpc import logging from time import gmtime, strftime import csv import random from loguru import logger as LOG class AppUser: def __init__(self, network, n...
11,859
3,208
import os import re import glob import logging import textwrap import fileinput import numpy as np from finmag.energies import Zeeman from finmag.util.helpers import norm log = logging.getLogger(name="finmag") def hysteresis(sim, H_ext_list, fun=None, **kwargs): """ Set the applied field to the first value i...
4,925
1,420
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtGui, QtCore class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(577, 341) palette = QtGui.QPalette() brush = QtGui.QBrush(QtGui.QColor(255, 255...
39,691
16,403
# Generated by Django 3.0.2 on 2020-03-17 08:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('myApp', '0016_usergroup_buyer'), ] operations = [ migrations.CreateModel( name='Chat', fields=[ ('id...
791
247
# Copyright 2012 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 required by applicable law or ...
1,200
360
# Copyright (c) Microsoft Corporation # # All rights reserved. # # MIT License # # 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...
16,208
5,307
# -*- coding: utf-8 -*- from __future__ import division, print_function, absolute_import import os import tensorflow as tf ''' gluoncv backbone + multi_gpu ''' # ------------------------------------------------ VERSION = 'Cascade_FPN_Res50_COCO_1x_20190421_v3' NET_NAME = 'resnet50_v1d' ADD_BOX_IN_TENSORBOARD = True ...
4,080
2,038
# # Copyright (2020) The Delta Lake Project 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 ag...
3,055
846
def matrix_form(): r = int(input("Enter the no of rows")) c = int(input("Enter the no of columns")) matrix=[] print("Enter the enteries") for i in range(r): a = [] for j in range(c): a.append(int(input())) matrix.append(a) return(matrix) def check_matrix(fi...
629
208
#!/home/ubuntu/miniconda2/bin/python from __future__ import division import sys import glob, os, gc import uuid import os.path import csv import numpy as np from time import time from subprocess import (call, Popen, PIPE) from itertools import product import shutil import re import pickle from boto3.session import Ses...
2,884
1,096
import numpy as np from stumpff import C, S from CelestialBody import BODIES from numerical import newton, laguerre from lagrange import calc_f, calc_fd, calc_g, calc_gd def kepler_chi(chi, alpha, r0, vr0, mu, dt): ''' Kepler's Equation of the universal anomaly, modified for use in numerical solvers. ''' ...
5,284
2,098
description = 'PGAA setup with XYZOmega sample table' group = 'basic' sysconfig = dict( datasinks = ['mcasink', 'chnsink', 'csvsink', 'livesink'] ) includes = [ 'system', 'reactor', 'nl4b', 'pressure', 'sampletable', 'pilz', 'detector', 'collimation', ] devices = dict( mcasin...
952
337
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
54,720
21,499
# Copyright 2021 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...
6,859
2,472
from .form7_search import Form7Search from .parse_form7 import Form7Parsing
76
25
# Copyright 2020 Soil, Inc. from soil.openstack.base import DataBase from soil.openstack.base import SourceBase class SnapshotData(DataBase): """A class for openstack snapshot data""" def __init__(self, data): self.data = data['snapshot'] class Snapshot(SourceBase): """A class for openstac...
1,164
350
# -*- coding: utf-8 -*- # Thanks to @skelsec for his awesome tool Pypykatz # Checks his project here: https://github.com/skelsec/pypykatz import codecs import traceback from lazagne.config.module_info import ModuleInfo from lazagne.config.constant import constant from pypykatz.pypykatz import pypykatz ...
2,776
822
# -*- coding: utf-8 -*- # This file is part of beets. # Copyright 2016, Adrian Sampson. # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation t...
14,981
4,908
"""Queue represented by a pseudo stack (represented by a list with pop and append)""" class Queue: def __init__(self): self.stack = [] self.length = 0 def __str__(self): printed = "<" + str(self.stack)[1:-1] + ">" return printed """Enqueues {@code item} @param item ...
1,417
444
#! /usr/bin/env python # coding: utf-8 import configparser import numpy as np import re,sys,os from graph import MyGraph from collections import OrderedDict def unique_config_sections(config_file): """Convert all config sections to have unique names. Adds unique suffixes to config sections for compability wi...
17,018
4,820
from django.contrib.auth.models import Permission, User from django.db import models class Album(models.Model): user = models.ForeignKey(User, default=1,on_delete=models.CASCADE) artist = models.CharField(max_length=250) album_title = models.CharField(max_length=500) genre = models.CharField(max_lengt...
1,058
350
import datetime import calendar import requests import pandas as pd import json import os.path import time import MySQLdb as M from gdax_history import timestamp_to_utcstr def connect_to_db(): config = json.load(open('dbconn.json'))["mysql"] db = M.connect(host = config["host"], user = conf...
3,021
1,048
"""Configures a Kafka Connector for Postgres Station data""" import json import logging import requests from settings import Settings logger = logging.getLogger(__name__) KAFKA_CONNECT_URL = f"{Settings.URLs.KAFKA_CONNECT_URL}/connectors" CONNECTOR_NAME = "stations" def configure_connector(): """Starts and co...
2,154
667
import io import logging import json import numpy import torch import numpy as np from tqdm import tqdm from clie.inputters import constant from clie.objects import Sentence from torch.utils.data import Dataset from torch.utils.data.sampler import Sampler logger = logging.getLogger(__name__) def load_word_embeddings...
8,474
2,867
from distutils.extension import Extension cmdclass = {} try: # with Cython from Cython.Build import build_ext cmdclass["build_ext"] = build_ext module_src = "cgranges/python/cgranges.pyx" except ImportError: # without Cython module_src = "cgranges/python/cgranges.c" def build(setup_kwargs): ...
914
268
# -*- coding: utf-8 -*- from .compSpot import *
48
22
# pylint: disable=line-too-long,too-many-lines,missing-docstring """Kinetics400 action classification dataset.""" import os import random import numpy as np from mxnet import nd from mxnet.gluon.data import dataset __all__ = ['Kinetics400'] class Kinetics400(dataset.Dataset): """Load the Kinetics400 action recogn...
17,212
5,562
# Copyright 2016-present CERN – European Organization for Nuclear Research # # 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...
2,206
610
# -*- encoding: utf-8 -*- # Copyright 2013 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 re...
23,842
6,809
from flask import * albums = Blueprint('albums', __name__, template_folder='templates') @albums.route('/albums/edit') def albums_edit_route(): options = { "edit": True } return render_template("albums.html", **options) @albums.route('/albums') def albums_route(): options = { "edit": False } return render_...
354
125
from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import redirect, render from django.urls import reverse from django.views.generic import DetailView, ListView from django.views.generic.edit import CreateView, UpdateView from dfirtrack_main.forms import ...
3,113
916
# coding: UTF-8 import time import torch import numpy as np from train_eval import train, init_network from importlib import import_module import argparse parser = argparse.ArgumentParser(description='Chinese Text Classification') parser.add_argument('--model', type=str, required=True, help='choose a model: TextCNN') ...
1,613
577
import pytest from django.conf import settings from django.core import mail as djmail from django.core.files.uploadedfile import SimpleUploadedFile from django.urls import reverse from django_scopes import scope from rest_framework.authtoken.models import Token from pretalx.submission.models import SubmissionStates ...
22,315
6,855
# MIT License # Copyright (c) 2021 Vasily Denisenko, Sergey Kuznetsov # 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 # t...
5,954
2,759
import fix_path import json import datetime from google.appengine.ext import ndb # Taken from http://stackoverflow.com/questions/455580/json-datetime-between-python-and-javascript dthandler = lambda obj: ( obj.isoformat() if isinstance(obj, datetime.datetime) or isinstance(obj, datetime.date) else Non...
4,292
1,224
#!/usr/bin/python3 # -*- coding: UTF-8 -*- import time busyTime = 10 idleTime = busyTime while True: start = time.clock() while time.clock() - start < busyTime: pass time.sleep(busyTime / 1000)
218
88
""" Module for working with named and anonymous maps .. module:: carto.maps :platform: Unix, Windows :synopsis: Module for working with named and anonymous maps .. moduleauthor:: Daniel Carrion <daniel@carto.com> .. moduleauthor:: Alberto Romeu <alrocar@carto.com> """ try: from urllib.parse import urljoi...
8,390
2,276
from kv_client.kv_client import KVClient def main(): kvSlave = KVClient(1, "127.0.0.1", 3456) kvSlave.start() if __name__ == "__main__": main()
157
71
import operator_benchmark as op_bench import torch import numpy from . import configs """EmbeddingBag Operator Benchmark""" class EmbeddingBagBenchmark(op_bench.TorchBenchmarkBase): def init(self, embeddingbags, dim, mode, input_size, offset, sparse, include_last_offset, device): self.embedding = torch.nn...
1,208
400
"""Python interfaces to DGL farthest point sampler.""" from dgl._ffi.base import DGLError import numpy as np from .._ffi.function import _init_api from .. import backend as F from .. import ndarray as nd def _farthest_point_sampler(data, batch_size, sample_points, dist, start_idx, result): r"""Farthest Point Samp...
3,972
1,258
import shutil import hashlib from pathlib import Path from typing import TextIO, BinaryIO, IO, Union from datetime import datetime from os.path import getmtime from .low import ObservableDict class Data: def __init__(self, data_name: str, parent, bucket, protected_parent_methods: Union[None, dict...
6,478
1,834
# Copyright 2018 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...
39,932
11,726
import requests headers = { 'content-type': 'application/json', 'Authorization': 'Token 80ca9f249b80e7226cdc7fcaada8d7297352f0f9' } url_base_cursos = 'http://127.0.0.1:8000/api/v2/cursos' url_base_avaliacoes = 'http://127.0.0.1:8000/api/v2/avaliacoes' resultado = requests.get(url=url_base_cursos, headers=hea...
362
177
# Copyright 2021 VMware, Inc. import argparse import json import re import logging import os import sys from avi.sdk.avi_api import ApiSession API_VERSION = "18.2.13" SYSTEM_WAF_POLICY_VDI='System-WAF-Policy-VDI' logger = logging.getLogger(__name__) def add_allowlist_rule(waf_policy_obj): #add a allowlist rule...
6,455
2,244
# -*- coding: utf-8 -*- """ TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available. Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the Lic...
4,101
1,306
# from votesim.benchmarks.benchrunner import ( # run_benchmark, # get_benchmarks, # post_benchmark, # plot_benchmark, # ) from votesim.benchmarks import runtools, simple
190
66
import boto3 import src.app as app import csv import psycopg2 as ps import os from dotenv import load_dotenv load_dotenv() dbname = os.environ["db"] host = os.environ["host"] port = os.environ["port"] user = os.environ["user"] password = os.environ["pass"] connection = ps.connect(dbname=dbname, ...
1,948
656
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # (C) British Crown Copyright 2017-2021 Met Office. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions a...
3,753
1,234
from .db_conn import ModelSetup class ItemsModel(ModelSetup): '''Handles the data logic of the items section''' def __init__( self, name=None, price=None, quantity=None, category_id=None, reorder_point=None, auth=None): ...
5,149
1,425
from docutils.parsers.rst.roles import register_canonical_role, set_classes from docutils.parsers.rst import directives from docutils import nodes from sphinx.writers.html import HTMLTranslator from sphinx.errors import ExtensionError import os import re def api_role(role, rawtext, text, lineno, inliner, options={},...
4,215
1,377
# Copyright 2014 varnishapi authors. All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import time from feaas import storage class Base(object): def __init__(self, manager, interval, *locks): self.manager = manager self.st...
739
221