text
string
size
int64
token_count
int64
/home/runner/.cache/pip/pool/6e/30/4e/6df13ab33dd498623bcb8f860a029ad969938275a514553b6fe8b4b10b
96
73
# The MIT License # Copyright (c) 2021- Nordic Institute for Interoperability Solutions (NIIS) # Copyright (c) 2017-2020 Estonian Information System Authority (RIA) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software...
8,960
2,356
import math # Modify the parameters here UNROLL_FACTOR = 32 DATA_T = 'unsigned short' # Generate the code data_type = DATA_T level = int(math.log2(UNROLL_FACTOR)) for layer in range(level - 1, -1, -1): pair = int(math.pow(2, layer)) for i in range(pair): # data_t tmp_[layer]_[pair] = tmp_[layer+1]_[pa...
724
317
import os import psutil import subprocess import threading import sys from threading import Timer import select from player_abstract import AbstractPlayer class PlainPlayer(AbstractPlayer): def __init__(self, socket_file, working_dir, local_dir=None, player_key="", player_mem_limit=256, player_c...
4,451
1,295
from . import depth from . import outliers from . import stats from . import visualization
91
23
from django.shortcuts import render from django.contrib.auth.models import User, Group from rest_framework import viewsets from django.shortcuts import get_object_or_404 from rest_framework.response import Response from rest_framework import viewsets, status from .models import Post,Comment,Category,Tag from .serialize...
4,726
1,339
# Copyright 2018 ICON Foundation # # 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 writi...
15,479
4,707
# # Author: John Tran <jhtran@att.com> # Julien Danjou <julien@danjou.info> # # 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 # # Unl...
10,178
3,148
from collections import namedtuple import datetime import pprint import sys import copy import json def expandStatusValue(v): """ v : string | (string, datetime.date | None) が string だった場合 (string, None) に展開する. """ if isinstance(v, str): v = (v, None) return v def formatDate(d): if not d: return "????-??-?...
17,906
7,989
import datetime import ephem import os.path import os import numpy as np import pdb from pandas import DataFrame __version__ = '0.1.2' class Error(Exception): pass def _convert_datetime_to_pyephem_date_string(in_datetime): return in_datetime.strftime('%Y/%m/%d %H:%M:%S') def _find_cached_file(filename):...
18,643
6,288
import torch from torch_geometric.nn import FeaStConv from knn_cuda import KNN from torch_cluster import fps #from ....ops.roiaware_pool3d import roiaware_pool3d_utils import torch.nn as nn import torch.nn.functional as F from .vfe_template import VFETemplate import sys from lppproj import LocalityPreservingProjectio...
7,573
2,848
# -*- coding: utf-8 -*- from __future__ import unicode_literals import sys import os # Import the chess module. sys.path.insert(0, os.path.abspath('..')) import chess # Autodoc. extensions = ["sphinx.ext.autodoc"] autodoc_member_order = 'bysource' # The suffix of source filenames. source_suffix = ".rst" # The mas...
915
306
# min (1/2) x'Q'x - q'x from __future__ import print_function import numpy as np import aa dim = 1000 mems = [5, 10, 20, 50, 100] N = int(1e4) np.random.seed(1234) Q = np.random.randn(dim,dim) Q = Q.T.dot(Q) q = np.random.randn(dim) x_0 = np.random.randn(dim) x_star = np.linalg.solve(Q, q) step = 0.0005 def f(x):...
1,227
610
import FWCore.ParameterSet.Config as cms process = cms.Process("PAT") # initialize MessageLogger and output report process.load("FWCore.MessageLogger.MessageLogger_cfi") process.MessageLogger.cerr.threshold = 'INFO' process.MessageLogger.cerr.INFO = cms.untracked.PSet( default = cms.untracked.PSet( limit...
2,193
947
""" Hydropy ======= Provides functions to work with hydrological processes and equations """
95
29
""" Desafio Você recebeu o desafio de ler um valor e criar um programa que coloque o valor lido na primeira posição de um vetor N[10]. Em cada posição subsequente, coloque o dobro do valor da posição anterior. Por exemplo, se o valor lido for 1, os valores do vetor devem ser 1,2,4,8 e assim sucessivamente. Mostre o ...
915
349
# Яке з 3 чисел найбільш наближене до середнього print("Введіть перше число") var1 = float(input()) print("Введіть друге число") var2 = float(input()) print("Введіть третє число") var3 = float(input()) # Avg = (var1+var2+var3)/3 # Варіант розв'язку з порівнянням чисел із середнім арифметичним: if ((var1 > var...
1,267
554
from paper_1.data.data_loader import load_val_data, load_train_data, sequential_data_loader, random_data_loader from paper_1.utils import read_parameter_file, create_experiment_directory from paper_1.evaluation.eval_utils import init_metrics_object from paper_1.baseline.main import train as baseline_train from paper_1....
5,689
1,778
#!/usr/bin/env python # # Copyright (c) 2017 Ericsson AB and others. All rights reserved # # This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # # http://www.apache.org/licenses/LICENSE-2.0 # imp...
6,793
2,119
#!/usr/bin/env python import sys import os import subprocess import offshoot valid_commands = ["init", "install", "uninstall"] def execute(): if len(sys.argv) == 2: command = sys.argv[1] if command not in valid_commands: raise Exception("'%s' is not a valid Offshoot command." % com...
1,827
585
import heterocl as hcl from math import sqrt hcl.config.init_dtype = hcl.Float() input_image = hcl.placeholder((480, 640, 3), name = "input") output_image = hcl.placeholder((480, 640, 3), name = "output") def unsharp(input_image, output_image): """ Helper Functions """ def clamp(val, min_, max_): local ...
1,953
898
"""A collection of utility function, shared across modules.""" import collections import datetime import gzip as gz import logging import os import re import shutil import subprocess from argparse import ArgumentTypeError from copy import deepcopy from logging import Logger from typing import (Any, Callable, Dict, Gene...
14,391
4,392
import csv from typing import List from CombinedPopulation import CombinedPopulation from PopulationGroup import PopulationGroup, Democrats, Republicans, Independents class DistrictVotingRecord: def __init__(self, district: str, incumbent: str, expected_lean: flo...
2,556
931
from django.core.urlresolvers import Resolver404 class MiddlewareResolver404(Resolver404): pass
102
35
# coding=utf-8 from actrie.tests.test_matcher import test if __name__ == "__main__": test()
98
38
# 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 under the Li...
5,137
1,467
import torch __all__ = ["_load_pretrained_weights"] def _load_pretrained_weights(weights_dict, model_name: str, pretrained: str): state_dict = torch.hub.load_state_dict_from_url(weights_dict[model_name][pretrained], map_location="cpu") return state_dict
265
100
from typing import Optional, List from pathlib import Path from dataclasses import astuple import re from pydantic import BaseModel, Field, Extra, validator from pydantic.dataclasses import dataclass from woke.core.enums import EvmVersionEnum from woke.c_regex_parsing.solidity_version import SolidityVersion class W...
2,420
767
import tensorflow as tf import tensorflow.contrib.layers as tfl """Copied from the almighty Christian Hundt; CECAM/CSM/IRTG School 2018: Machine Learning in Scientific Computing https://github.com/CECAML/school_nierstein_2018/blob/master/Convnet%20TF.ipynb """ def prelu(net): alpha = tf.Variable(0.0, dtype=net....
1,399
542
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- mode: python -*- import tornado.web from app.views import HelloWorld from app.ws.communication import CommunicationSocketHandler class Application(tornado.web.Application): def __init__(self, db=None): self.db = db handlers = [ (r"/...
517
155
# # Copyright (c) 2018 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # """ Manages WrapperFormatter objects. WrapperFormatter objects can be used for wrapping CLI column celldata in order for the CLI table (using prettyTable) to fit the terminal screen The basic idea is: Once celldata is retri...
31,326
8,976
# Ref.: https://github.com/vaiorabbit/ruby-opengl/blob/master/sample/simple.rb from ctypes import * from OpenGL.GL import * import GLFW from GLFW import * def key_callback_fn(window_handle, key, scancode, action, mods): if key == GLFW_KEY_ESCAPE and action == GLFW_PRESS: glfwSetWindowShouldClose(window_han...
2,139
840
#!/usr/bin/python # -*- coding: utf-8 -*- """ Implement different methods to hedge positions and measure the risk of a Zero cupon bond portfolio REFERENCE: Nawalkha, S. K; Soto, G. M.; Beliaeva, N. A., "Interest Rate Risk Modeling, the fixed Income Valuation course". Wiley, 2005 @author: ucaiado Created on 12/22/20...
34,661
12,095
from django.contrib import admin from .models import * @admin.register(Job) class JobAdmin(admin.ModelAdmin): list_display = ['job_id', 'job_title', 'duties', 'min_salary', 'max_salary']
193
67
from collections import defaultdict from enum import Enum import json import pprint from typing import Dict, List, Union, Any, Set, DefaultDict from arche.tools import s3 import perfect_jsonschema EXTENDED_KEYWORDS = {"tag", "unique", "coverage_percentage"} SchemaObject = Dict[str, Union[str, bool, int, float, None,...
3,401
1,040
# Copyright 2018 The TensorFlow Probability 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 o...
5,620
2,063
""" This file is part of pyspex https://github.com/rmvanhees/pyspex.git Python implementation to read SPEXone DEM output Copyright (c) 2019-2021 SRON - Netherlands Institute for Space Research All Rights Reserved License: BSD-3-Clause """ from pathlib import Path import numpy as np from .lib.tmtc_def import t...
16,456
6,086
from dataclasses import dataclass, field from datetime import datetime, timezone from typing import Union, Type, List, Optional, Any, Tuple import pytest from signal_ocean.util import parsing_helpers @pytest.mark.parametrize("cap_words, snake_cased", [('VesselTypeId', 'vessel_type_id'), ...
7,827
2,457
import tensorflow as tf import pandas as pd import numpy as np import sys import time from cflow import ConditionalFlow from MoINN.modules.subnetworks import DenseSubNet from utils import train_density_estimation, plot_loss, plot_tau_ratio # import data tau1_gen = np.reshape(np.load("../data/tau1s_Pythia_gen.npy"), ...
2,931
1,191
#!/usr/bin/env python3 """ decoder file decoder class """ import tensorflow as tf class BahdanauAttention(tf.keras.layers.Layer): def __init__(self, units): """ attention layer from Bahdanau paper """ super().__init__() self.w1 = tf.keras.layers.Dense(units) self....
2,408
737
# -*- coding: utf-8 -*- # Created on Sat Jun 05 2021 # Last modified on Mon Jun 07 2021 # Copyright (c) CaMOS Development Team. All Rights Reserved. # Distributed under a MIT License. See LICENSE for more info. import numpy as np import camos.model.image as img from camos.utils.apptools import getGui class InputData...
2,203
616
from __future__ import absolute_import from .geometry_msgs import PoseStamped from .moveit_msgs import Constraints from .moveit_msgs import MoveItErrorCodes from .moveit_msgs import PlannerParams from .moveit_msgs import PlanningScene from .moveit_msgs import PlanningSceneComponents from .moveit_msgs import PositionIK...
10,462
3,498
# # module forward.py # # forward chaining inference engine # see holmes/forward.py and holmes.doc for more info; # # optimization: uses known fact and rule 'if' indexes to avoid: # a) exhaustive fact list search when matching an 'if' # b) exhaustive fact list scan when seeing if fact redundant # c) exhausti...
9,946
2,996
class Photo: def __init__(self, lid, tags_list, orientation): """ Constructor :param lid: Photo identifier :param tags_list: List of tags :param orientation: Orientation. "H" for horizontal or "V" for vertical """ self.id = lid self...
385
101
import tarfile import tempfile from . import Task, TaskVar class TaskReadFile(Task, name="read-file"): """ Read contents of a file in the image into a variable. """ class Schema: path = TaskVar(help="Container file path to read data from") var = TaskVar(help="Destination variable nam...
979
281
# Copyright (C) 2019 Nanyang Wang, Yinda Zhang, Zhuwen Li, Yanwei Fu, Wei Liu, Yu-Gang Jiang, Fudan University # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may no...
8,610
3,420
from abc import ABC, abstractmethod import numpy as np class SwarmAlgorithm(ABC): ''' A base abstract class for different swarm algorithms. Parameters ---------- D : int Search space dimension. N : int Population size. fit_func : callable Fitness (objective) functi...
6,477
1,766
from datetime import datetime # string to datetime object datetime_str = '09/19/18 13:55:26' datetime_object = datetime.strptime(datetime_str, '%m/%d/%y %H:%M:%S') print(type(datetime_object)) print(datetime_object) # printed in default format # string to date object date_str = '09-19-2018' date_object = datetime...
1,376
557
############################################################################### # Copyright (c) 2018, Lawrence Livermore National Security, LLC # Produced at the Lawrence Livermore National Laboratory # Written by Thomas Mendoza mendoza33@llnl.gov # LLNL-CODE-771750 # All rights reserved # # This file is part of SSHSpa...
484
138
from datetime import time from vnpy.app.cta_strategy import ( CtaTemplate, StopOrder, TickData, BarData, TradeData, OrderData, BarGenerator, ArrayManager ) from vnpy.app.cta_strategy.base import ( EngineType, STOPORDER_PREFIX, StopOrder, StopOrderStatus, ) from vnpy.app.c...
7,697
2,962
import sys import os import pathlib import logging import subprocess import datetime import apache_beam as beam from apache_beam.options.pipeline_options import PipelineOptions from apache_beam.options.pipeline_options import StandardOptions from apache_beam.options.pipeline_options import GoogleCloudOptions from apach...
4,249
1,314
# Slixmpp: The Slick XMPP Library # Copyright (C) 2020 Mathieu Pasquet <mathieui@mathieui.net> # This file is part of Slixmpp. # See the file LICENSE for copying permission. from typing import ( List, Optional, Set, Tuple, ) from slixmpp import JID, Iq from slixmpp.exceptions import IqError, IqTimeout ...
3,882
1,283
from control.controller_veiculos import ControllerVeiculos from control.controller_proprietario import ControllerProprietario from control.controller_area import ControllerAreaEstacionamento from model.constants import * controller_veiculo = ControllerVeiculos() controller_proprietario = ControllerProprietario() cont...
1,360
463
''' Test HTTP/2 with h2spec ''' # 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,811
965
import logging import itertools import asyncio import random import aiomsg import aiorun logging.basicConfig(level="DEBUG") async def main(): s = aiomsg.Søcket(send_mode=aiomsg.SendMode.ROUNDROBIN) await s.connect() async def receiver(): while True: msg = await s.recv_string() ...
576
206
# Dependency injection: # Technique where one object (or static method) supplies the dependencies of another object. # The objective is to decouple objects to the extent that no client code has to be changed # simply because an object it depends on needs to be changed to a different one. # Dependency injection is one f...
1,901
560
#!/usr/bin/env python3 # -*- coding:utf-8 -*- """ Author : Virink <virink@outlook.com> Date : 2019/04/18, 14:49 """ import string import re L = string.ascii_lowercase U = string.ascii_uppercase A = string.ascii_letters def func_atbash(*args): """埃特巴什码解码""" arg = args[0] arg = arg.lower().repla...
5,073
2,234
from .utils import (get_prescription, get_attributes, get_group) from .models import Disease, Result, Score, Question, SurveyResponse from .analysis import cardio_risk_group, diabetes_risk_group, stroke_risk_group from statistics import mean from celery import shared_task @shared_task def worker(session_id): df, ...
1,773
521
import importlib import os import glob from .user import create_user_routes from .repo import create_repo_routes from .broker import create_broker_routes def create_routes(server): create_user_routes(server) create_repo_routes(server) create_broker_routes(server) # for plugin_name in server._augur._lo...
419
128
import json import random import subprocess from stests.core.logging import log_event from stests.chain.utils import execute_cli from stests.chain.utils import DeployDispatchInfo from stests.core.types.chain import Account from stests.core.types.infra import Network from stests.core.types.infra import Node from stests...
2,117
681
""" 235. Lowest Common Ancestor of a Binary Search Tree """ # Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def lowestCommonAncestor(self, root, p, q): ...
1,143
397
from functools import wraps from collections import Iterable from django.conf import settings from django.shortcuts import render from django.core.exceptions import PermissionDenied from django.utils.decorators import available_attrs from django.utils.encoding import force_str from django.utils.six.moves.urllib.parse i...
3,494
1,031
def conv(s): if s[0] == 'a': v = '1' elif s[0] == 'b': v = '2' elif s[0] == 'c': v = '3' elif s[0] == 'd': v = '4' elif s[0] == 'e': v = '5' elif s[0] == 'f': v = '6' elif s[0] == 'g': v = '7' elif s[0] == 'h': v = '8' v += s[1] return v e = str(input()).split() a = conv(e[0]) b...
529
275
#!/usr/bin/env python import sys import os import glob import re from datetime import date import argparse import subprocess from pathlib import Path def main(): local_path = os.path.dirname(os.path.realpath(__file__)) #print(local_path) data_path = f"{local_path}" scaffold_helper = f"{local_pat...
4,095
1,395
import datetime from django.test import SimpleTestCase from django.urls import reverse from django.utils.html import strip_tags import responses from cashbook.tests import MTPBaseTestCase, api_url from disbursements.forms import SearchForm class DisbursementSearchViewTextCase(MTPBaseTestCase): user = {'username'...
8,887
2,821
''' Utility for extracting data from the graphite API ''' import os from urllib.parse import urlencode import pandas as pd class GraphiteExtractUtility: def __init__(self, default_url): url = os.environ.get('GRAPHITE_URL', default_url) self.render_url = url + '/render/?format=csv' def get_csv...
620
194
# Generated by Django 3.1.1 on 2020-09-01 17:58 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('streetsignup', '0001_initial'), ] operations = [ migrations.AlterField( model_name='segment', ...
712
233
""" Generate coulomb matrices for molecules. See Montavon et al., _New Journal of Physics_ __15__ (2013) 095003. """ import numpy as np from typing import Any, List, Optional from deepchem.utils.typing import RDKitMol from deepchem.utils.data_utils import pad_array from deepchem.feat.base_classes import MolecularFeat...
9,830
3,285
## @file # Module that encodes and decodes a FMP_PAYLOAD_HEADER with a payload. # The FMP_PAYLOAD_HEADER is processed by the FmpPayloadHeaderLib in the # FmpDevicePkg. # # Copyright (c) 2018, Intel Corporation. All rights reserved.<BR> # SPDX-License-Identifier: BSD-2-Clause-Patent # ''' FmpPayloadHeader ''' import s...
2,882
997
from Sender import Sender from Receiver import Receiver import scipy import numpy as np import scipy.io import scipy.io.wavfile import matplotlib.pyplot as plt from scipy import signal def readFromFile(path): file = open(path, "rb") data = file.read() file.close() return data def readWav(file_name) -...
1,580
660
"""A simple wrapper around contextlib.suppress""" import contextlib from functools import wraps __version__ = "0.1.1" def suppress(*exceptions): def wrap(func): @wraps(func) def inner(*args, **kwargs): with contextlib.suppress(exceptions): return func(*args, **kwargs...
615
176
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2016, Anaconda, Inc. All rights reserved. # # Licensed under the terms of the BSD 3-Clause License. # The full license is in the file LICENSE.txt, distributed with this software. # -------------------...
7,015
1,841
# Copyright 2020 Hieu Nguyen # # 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, ...
1,697
514
#!/usr/bin/env python domain_home = os.environ['DOMAIN_HOME'] node_manager_name = os.environ['NODE_MANAGER_NAME'] component_name = os.environ['COMPONENT_NAME'] component_admin_listen_address = os.environ['COMPONENT_ADMIN_LISTEN_ADDRESS'] component_admin_listen_port = os.environ['COMPONENT_ADMIN_LISTEN_PORT'] component...
1,055
346
# Copyright (c) 2015 Mirantis, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
1,965
547
# https://github.com/ArtemNikolaev/gb-hw/issues/18 seasons = [ 'ЗИМА', 'ВЕСНА', 'ЛЕТО', 'ОСЕНЬ' ] month = int(input('Введите номер месяца: ')) if month < 1 or month > 12: print('Месяцев всего 12. Поэтому минимальное значение - 1, а максимальное - 12') else: seasonInt = (month % 12) // 3 p...
380
175
"""Modoboa admin signals.""" import django.dispatch use_external_recipients = django.dispatch.Signal(providing_args=["recipients"]) extra_domain_actions = django.dispatch.Signal( providing_args=["user", "domain"]) extra_domain_dashboard_widgets = django.dispatch.Signal( providing_args=["user", "domain"]) extr...
414
129
from django.urls import reverse from rest_framework import status from .base import APITestCaseExtended from mock import patch from restapi import models class HealthCheckTest(APITestCaseExtended): """ Test for health check """ def test_put_healthcheckn(self): """ Tests PUT method o...
1,401
437
import asyncio import contextlib import glob import itertools import logging import os import pytest import uvloop try: import tracemalloc tracemalloc.start() except ImportError: # Not available in pypy pass # clear compiled cython tests for path in itertools.chain( glob.glob(os.path.join('...
1,217
401
from corm import Entity, Field, Storage, RelationType def test_add_by_primary_key(): class User(Entity): id: int = Field(pk=True) storage = Storage() john = User( data={'id': 1}, storage=storage, ) assert storage.get(User.id, 1) == john def test_make_relation(): cla...
3,297
1,096
from TestHelperSuperClass import testHelperAPIClient, env import unittest import json from appObj import appObj import pytz import datetime serverInfoWithoutAnyPictures = { 'Server': { 'Version': env['APIAPP_VERSION'] }, 'Pictures': [] } samplePictureIdentifier = 'ABC123' samplePictureContent...
2,268
762
#!/usr/bin/env python # coding: utf-8 # This script generates a zone plate pattern (based on partial filling) given the material, energy, grid size and number of zones as input # In[1]: import numpy as np import matplotlib.pyplot as plt from numba import njit from joblib import Parallel, delayed from tqdm import tq...
7,990
3,050
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed # under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Licens...
1,740
521
from pycoingecko import CoinGeckoAPI number = int(input('Enter the number of coins: ')) for i in range(length): print(i + 1, ':', listOfNames[i], listOfMarketCaps[i])
180
68
# pylint: disable=no-self-use,invalid-name from __future__ import division from __future__ import absolute_import import pytest from allennlp.data.dataset_readers import SnliReader from allennlp.common.util import ensure_list from allennlp.common.testing import AllenNlpTestCase class TestSnliReader(object): @py...
2,528
893
#!/usr/bin/env python # -*- coding: utf-8 -*- """ setup.py file for Libgexf """ from setuptools import Extension, setup #from distutils.core import Extension, setup libgexf_module = Extension( '_libgexf', # genere un _libgexf.so include_dirs=['/usr/include/libxml2'], sources=[ # 'libgexf.i', # genere u...
4,362
1,413
""" @generated cargo-raze generated Bazel file. DO NOT EDIT! Replaced on runs of cargo-raze """ load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository") # buildifier: disable=load load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # buildifier: disable=load load("@bazel_tools//too...
7,933
3,736
#!/usr/bin/python ## This program creates a thread, ## officially names it and ## tries to print the name import threading import time def ThreadFunction(): print(threading.currentThread().getName(), "Starting") time.sleep(2) print(threading.currentThread().getName(), "Exiting") def ServiceFunction(): prin...
747
255
import os.path import sys import h5py import numpy as np import matplotlib.pyplot as plt from keras.models import load_model from keras.losses import categorical_crossentropy import tensorflow as tf import heapq import re modelName = 'CW_validation.h5' successResultsNPY = [] ###########################################...
6,241
3,004
from django.contrib import admin from .models import AppropriatedHistory @admin.register(AppropriatedHistory) class AppropriatedHistoryAdmin(admin.ModelAdmin): list_display = [ 'fiscal_year', 'source', 'dollars_received' ] list_editable = [ 'dollars_received', ] or...
360
116
import collections import time import heapq from horovod_simulator_config import SimulatorConfig, SchedulingDisc from utils.logger import get_logger import typing from queue import PriorityQueue class Packet(): def __init__(self, iteration_idx, layer_idx, packet_idx, packet_size_MB): # global packet_size_M...
34,626
10,410
__author__ = 'alejandroaguado' from xml.etree import ElementTree class ABNOParameters: def __init__(self, filename): self.document = ElementTree.parse(filename) root = self.document.getroot() tag = self.document.find('abnoconfig') self.address=tag.attrib['address'] self.po...
675
208
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/bigtable/admin/table/v1/bigtable_table_service_messages.proto from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf impo...
15,533
5,683
#!flask/bin/python # Copyright 2021 Luis Blazquez Miñambres (@luisblazquezm) # See LICENSE for details. from flask_restx import Api api = Api(version='1.0', title='Influencer Detection Project', description="**PORBI Influencer Detection project's Flask RESTX API**")
277
107
''' Description: Author: Jiaqi Gu (jqgu@utexas.edu) Date: 2021-10-24 16:23:50 LastEditors: Jiaqi Gu (jqgu@utexas.edu) LastEditTime: 2021-10-24 16:23:50 ''' from collections import OrderedDict from typing import Callable, Dict, List, Optional, Tuple, Union import numpy as np import torch import torch.nn.functional as F...
7,543
2,580
# Copyright (c) 2019 PaddlePaddle 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 appli...
9,017
2,978
from discord.ext.commands import BadArgument class InvalidLength(BadArgument): """This exception is thrown whenever a invalid length was provided""" def __init__(self, my_name, _min=None, _max=None, *args: object) -> None: if _min is not None and _max is not None: err = "Length of '" + my_n...
2,218
635
from selenium import webdriver navegador = webdriver.Chrome() navegador.get("https://webstatic-sea.mihoyo.com/ys/event/signin-sea/index.html?act_id=e202102251931481&lang=pt-pt")
178
80
# Generated by the protocol buffer compiler. DO NOT EDIT! # source: envoy/config/filter/http/jwt_auth/v2alpha1/config.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from g...
18,177
7,254
#!/usr/bin/python # -*- coding: gb2312 -*- import fileinput import os class FileStream: def __init__(self, filename, cutsize=2048): self.filename = filename self.cutsize = cutsize # 2048 byte self.size = os.path.getsize(self.filename) self.file = fileinput.input(filename) ...
1,730
527