text stringlengths 2 999k |
|---|
#!/usr/bin/python
#
# Copyright 2018 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 ag... |
# Copyright Jamie Allsop 2015-2019
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
#-------------------------------------------------------------------------------
# Log
#-------------------... |
# Copyright 2013-2019 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 pytest
from spack.main import SpackCommand
mirror = SpackCommand('mirror')
@pytest.mark.disable_clean_stage_che... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
import re
import subprocess
import sys
from pathlib import Path
from typing import Any, List, Set
import pytest
from omegaconf import DictConfig, OmegaConf
from hydra import MissingConfigException
from hydra.test_utils.test_utils import ... |
from dataclasses import dataclass
from typing import List, Optional
from covid.types.blockchain_format.foliage import Foliage, FoliageTransactionBlock, TransactionsInfo
from covid.types.blockchain_format.reward_chain_block import RewardChainBlock
from covid.types.blockchain_format.vdf import VDFProof
from covid.types.... |
import pytest
from beschi.protocol import Protocol
def test_good_protocol():
p = Protocol("test/_protocols/example.toml")
def test_empty_protocol():
p = Protocol("test/_protocols/empty.toml")
def test_protocol_not_exist():
with pytest.raises(FileNotFoundError):
p = Protocol("test/_protocols/nope... |
import sys
import otsun
import os
import FreeCAD
from FreeCAD import Base
import Part
import numpy as np
np.random.seed(1)
import random
random.seed(1)
import logging
logger = otsun.logger
logger.setLevel(logging.ERROR)
# create console handler and set level to debug
ch = logging.StreamHandler()
ch... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "waypoint_loader"
PROJECT_SPACE_DIR = ... |
"""
Copyright (c) 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... |
# Public Domain SOCKS proxy protocol implementation
# Adapted from https://gist.github.com/bluec0re/cafd3764412967417fd3
from __future__ import unicode_literals
# References:
# SOCKS4 protocol http://www.openssh.com/txt/socks4.protocol
# SOCKS4A protocol http://www.openssh.com/txt/socks4a.protocol
# SOCKS5 protocol h... |
"""
-----------------------------------------------------------------------------------------------------------
Package: AequilibraE
Name: Traffic assignment
Purpose: Implement traffic assignment algorithms based on Cython's network loading procedures
Original Author: Pedro Camargo (c@margo.co)
Con... |
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2021 Beartype authors.
# See "LICENSE" for further details.
'''
Project-wide :pep:`484` and :pep:`585` **generic type hint utility unit
tests.**
This submodule unit tests the public API of the p... |
import time
import numpy as np
from tectosaur.farfield import farfield_pts_direct, get_gpu_module
from tectosaur.ops.sparse_farfield_op import TriToTriDirectFarfieldOp
from tectosaur.util.geometry import normalize
from tectosaur.mesh.mesh_gen import make_rect
from tectosaur.mesh.modify import concat
def make_meshes(n... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# Binary tree traversal
class Node():
def __init__(self, value):
self.value = value
self.right = None
self.left = None
class BinaryTree():
def __init__(self, root):
self.root = Node(root) # initialize tree with a root
def print_tree(self, traversal_type):
if trav... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: ptb.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import os
import numpy as np
from ...utils import logger, get_dataset_path
from ...utils.fs import download
from ...utils.argtools import memoized_ignoreargs
from ..base import RNGDataFlow
try:
import tensorflow
... |
"""
Test handling of alerts.
"""
from bok_choy.web_app_test import WebAppTest
from .pages import AlertPage
class AlertTest(WebAppTest):
"""
Test handling of alerts.
"""
def setUp(self):
super(AlertTest, self).setUp()
self.alert = AlertPage(self.browser)
self.alert.visit()
... |
# -----------------------------------------------------------------------------
# Copyright (c) 2018. ZHAW - SPLab
# 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 Lic... |
#
# Copyright (c) 2021 Czech Technical University in Prague.
#
# This file is part of Roadmaptools
# (see https://github.com/aicenter/roadmap-processing).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the... |
# Classe
class Pessoa:
# Atributo de Classe / default
olhos = 2
# Inicialização
def __init__(self, *filhos, nome=None, idade=29): # Atributo de objeto / instância
self.nome = nome
self.idade = idade
self.filhos = list(filhos)
def cumprimentar(self): # Método de instância ... |
from __future__ import print_function, division, absolute_import
try:
from .core import (
DataFrame,
Series,
Index,
_Frame,
map_partitions,
repartition,
to_datetime,
to_timedelta,
)
from .groupby import Aggregation
from .io import (
... |
from sklearn.feature_extraction.text import CountVectorizer
import pandas as pd
import os
os.system('clear')
# This program is to understand the concept of Topic modelling using
# Latent Dirichlet Allocation
file = open('shakesphere.txt','r')
cVector = CountVectorizer(max_df=0.95, min_df=2, stop_words='english')
#c... |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 4
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class AdsProviderControllersCont... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... |
t=0
tot=0
import random
c=random.randint(1,5)
print('-------JOGO DA ADIVINHAÇÃO--------')
print('vamos ver se vc adivinha o numero')
while t != c:
t=int(input('digite um numero:'))
tot+=1
if t == c:
print('parabens !!! o numero era {} e vc precisou de {} tentativas'.format(t,tot))
else:
print('ten... |
import sys
sys.path.insert(0,"/content/federated-learning/")
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import copy
import numpy as np
from torchvision import datasets, transforms
import torch
from utils.sampling import mnist_iid, mnist_noniid, cifar_iid
from utils.options import args_par... |
from datetime import datetime
from typing import Dict, List, Set
from collections import defaultdict
from copy import copy
from vnpy.event import Event, EventEngine
from vnpy.trader.engine import BaseEngine, MainEngine
from vnpy.trader.event import (
EVENT_TRADE, EVENT_ORDER, EVENT_TICK, EVENT_CONTRACT, EVENT_TIME... |
from gym_minigrid.minigrid import Ball
from gym_minigrid.minigrid import *
from gym_minigrid.roomgrid import RoomGrid
from gym_minigrid.register import register
from pdb import set_trace
class SmallUnlock(RoomGrid):
"""
Unlock a door
"""
def __init__(self, seed=None):
room_size = 8
su... |
# IDLSave - a python module to read IDL 'save' files
# Copyright (c) 2010 Thomas P. Robitaille
# Many thanks to Craig Markwardt for publishing the Unofficial Format
# Specification for IDL .sav files, without which this Python module would not
# exist (http://cow.physics.wisc.edu/~craigm/idl/savefmt).
# This code was... |
from Position import Position
from Organisms.Plant import Plant
class World(object):
def __init__(self, width, height, modifiers):
self._width = width
self._height = height
self._turn = 0
self._organisms = []
self._separator = ' '
self._log = []
self._modif... |
E = -1 # Empty
R = 0 # Red
G = 1 # Green
Y = 2 # Yellow
B = 3 # Blue
O = 4 # Orange
class flow_solver(object):
def __init__(self):
self.rows = 0
self.columns = 0
def load(self, tablero):
self.tablero = tablero
self.rows = len(tablero)
self.columns = len(t... |
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) 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 ... |
# Copyright 2020 The TensorFlow 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
from setuptools import setup
from setuptools import find_packages
version = '0.37.0.dev0'
# Remember to update local-oldest-requirements.txt when changing the minimum
# acme/certbot version.
install_requires = [
'acme>=0.29.0',
'certbot>=0.34.0',
'dnspython',
'mock',
'setuptools',
'zope.inter... |
#!/usr/bin/env python3
import pydensecrf.densecrf as dcrf
from pydensecrf.utils import unary_from_softmax
from scipy.ndimage import imread
from scipy.misc import imsave, imresize
import pickle
import numpy
import glob
import os
from joblib import Parallel, delayed
import sys
imgs_path = "/data/corpora/youtube-objects... |
from datetime import date
from rest_framework import mixins, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from django.db.models import Sum
from django.utils.decorators import method_decorator
from auditable.views import AuditableMixin
from api.decorators.permission... |
import types
from functools import wraps, partial
import numpy as np
import datetime
import collections
import warnings
import copy
from textwrap import dedent
from pandas.compat import (
zip, range, lzip,
callable, map
)
from pandas import compat
from pandas.compat.numpy import function as nv
from pandas.com... |
from typing import List
class Solution:
def findMin(self, nums: List[int]) -> int:
if not nums:
return None
N = len(nums)
l, r = 0, N - 1
if N == 1 or nums[r] > nums[0]:
return nums[0]
while l <= r:
mid = l + (r-l) // 2
if num... |
# =============================================================================
#
# Copyright (c) 2016, Cisco Systems
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source ... |
# skip-if: '-L' in EXTRA_JIT_ARGS or '-n' in EXTRA_JIT_ARGS
# statcheck: noninit_count('num_deopt') == 2
try:
import __pyston__
__pyston__.setOption("OSR_THRESHOLD_BASELINE", 50)
__pyston__.setOption("REOPT_THRESHOLD_BASELINE", 50)
__pyston__.setOption("SPECULATION_THRESHOLD", 10)
except ImportError:
... |
# coding: utf-8
"""
Base para desarrollo de modulos externos.
Para obtener el modulo/Funcion que se esta llamando:
GetParams("module")
Para obtener las variables enviadas desde formulario/comando Rocketbot:
var = GetParams(variable)
Las "variable" se define en forms del archivo package.json
Para modifica... |
# -*- coding: utf-8 -*-
from .response import Response
class Statement(object):
"""
A statement represents a single spoken entity, sentence or
phrase that someone can say.
"""
def __init__(self, text, **kwargs):
self.text = text
self.in_response_to = kwargs.get("in_response_to", [... |
from enum import Enum
from typing import Dict
from wetterdienst.dwd.metadata.datetime import DatetimeFormat
class DWDObservationResolution(Enum):
"""
enumeration for granularity/resolution of the weather
observations stored on dwd server
"""
MINUTE_1 = "1_minute"
MINUTE_10 = "10_minutes"
... |
import sys
def memoise(fn):
stuff = {}
def decorated(*args):
if args in stuff:
return stuff[args]
else:
out = fn(*args)
stuff[args] = out
return out
return decorated
@memoise
def fib(n):
return n if n < 2 else fib(n - 1) + fib(n - 2)
i... |
import os
def process_running(pid):
try:
os.kill(pid, 0)
return True
except OSError:
return False
|
# python3
from collections import namedtuple
from sys import stdin
from typing import List
from unittest import TestCase
test = namedtuple('test', 'seq_a seq_b seq_c expected')
def lcs3(seq_a: List[int], seq_b: List[int], seq_c: List[int]) -> int:
m, n, o = len(seq_a) + 1, len(seq_b) + 1, len(seq_c) + 1
tab... |
import logging
from argparse import ArgumentParser
from typing import Any, Dict, List, Optional
from django.contrib.auth.tokens import default_token_generator
from zerver.forms import generate_password_reset_url
from zerver.lib.management import CommandError, ZulipBaseCommand
from zerver.lib.send_email import FromAd... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: rastervision/protos/plugin.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 google.protobuf import r... |
from pygame import mixer
import math
def init_sound():
mixer.init(channels=2)
mixer.set_num_channels(11)
def playSfx(track, channel=1, volume=1, loops=0):
# failsafe
if channel == 0:
print("WARNING: Channel 0 is reserved for BGM!")
# don't just quit the program due to a sound playing... |
import numpy as np
from river import datasets
from river.utils.skmultiflow_utils import check_random_state
class STAGGER(datasets.base.SyntheticDataset):
"""STAGGER concepts stream generator.
This generator is an implementation of the dara stream with abrupt concept
drift, as described in [^1].
The... |
#!/usr/bin/env python
#
# Public Domain 2014-present MongoDB, Inc.
# Public Domain 2008-2014 WiredTiger, Inc.
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a com... |
from receiver.api_base import F1LapsAPIBase
class F1LapsAPI2021(F1LapsAPIBase):
pass |
import wiotp.sdk.device
def myCommandCallback(cmd):
print("Command received: %s" % cmd.data)
# Configure
myConfig = {
"identity": {
"orgId": "j4fntv",
"typeId": "Cambien",
"deviceId": "cambien001"
},
"auth": {
"token": "12345678"
},
"options": {
"domai... |
# Lint as: python3
# 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 ... |
# Generated by Django 3.0.6 on 2020-06-15 19:22
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Courses',
fields=[
('code', models.IntegerF... |
# -*- coding: utf-8 -*-
"""
Colour - Analysis
=================
*Colour - Analysis* is a *Python* colour science package dedicated to image
analysis.
"""
from __future__ import absolute_import
from .guerilla import *
__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2013-2021 - Colour Developers'
__li... |
# Copyright 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 ag... |
import threading
import time
import math
from Queue import Queue, Empty
class ControlThread(object):
def __init__(self, delay=0):
self.delay = delay
self.queue = Queue()
self.sleep = threading.Condition()
def start(self, sense, rules, robot):
self.sense = sense
self.ru... |
import os
# the secret configuration specific things
if bool(os.environ.get("ENV", False)):
from m3u8.sample_config import Config
else:
from m3u8.config import Config
# TODO: is there a better way?
TG_BOT_TOKEN = Config.TG_BOT_TOKEN
APP_ID = Config.APP_ID
API_HASH = Config.API_HASH
AUTH_USERS = Config.AUTH_U... |
# -*- coding: utf-8 -*-
"""Validation of an ISA model or single objects
Eventually, all format independent content- and specification-related validations which
don't interrupt model creation definitely (e.g. when parsing from ISA-tab) should go
here. Then, validations can be performed on whole models (e.g. after parsi... |
# coding=utf-8
__author__ = 'PyBeaner'
from bs4 import BeautifulSoup
def get_links(html):
soup = BeautifulSoup(html)
links = []
for link in soup.find_all("a"):
href = link["href"]
if href.startswith("http"):
links.append(href)
return links
if __name__ == '__main__':
i... |
# -*- coding: utf-8 -*-
# pylint: disable=C0111,C0103,R0205
import traceback
__author__ = 'guotengfei'
import logging
LOGGER = logging.getLogger(__name__)
class ConsumerFactory(object):
"""This is an example consumer that will handle unexpected interactions
with RabbitMQ such as channel and connection clos... |
import IPy, ipaddr, probstat, os, tempfile, subprocess, logging
class Router():
fqdn = ''
hostname = ''
domain = ''
interfaces = []
def __init__(self, name):
if '.' in name:
self.hostname = name.split('.')[0]
self.domain = '.'.join(name.split('.')[1:])
s... |
class CustomArgs(object):
pass
_args = CustomArgs()
def get_global_args():
global _args
return _args
def set_global_arg(arg, value):
global _args
setattr(_args, arg,value)
def set_global_args(args):
for k,v in args.items():
set_global_arg(k, v)
def set_dry_run():
set_global_arg(... |
# DRUNKWATER TEMPLATE(add description and prototypes)
# Question Title and Description on leetcode.com
# Function Declaration and Function Prototypes on leetcode.com
#385. Mini Parser
#Given a nested list of integers represented as a string, implement a parser to deserialize it.
#Each element is either an integer, or a... |
import sys
sys.path.append('../code')
import argparse
import GPUtil
import os
from pyhocon import ConfigFactory
import torch
import numpy as np
import cvxpy as cp
from PIL import Image
import math
import utils.general as utils
import utils.plots as plt
from utils import rend_util
from utils import vis_util
from model.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @File : redis_conn.py
# @Author: Fred Yangxiaofei
# @Date : 2019/8/23
# @Role : Redis连接信息
import redis
from settings import settings
from websdk.consts import const
def create_redis_pool():
redis_configs = settings[const.REDIS_CONFIG_ITEM][const.DEFAULT_RD_KEY... |
# coding: utf-8
"""
LogicMonitor REST API
LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account... |
# 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.0OA
#
# Authors:
# - Vincent Garonne, ... |
"""Create book model
Revision ID: dc9d9a0ac820
Revises: bbb00b216d89
Create Date: 2021-12-23 05:05:26.276613
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'dc9d9a0ac820'
down_revision = 'bbb00b216d89'
branch_labels = None
depends_on = None
def upgrade():
... |
import sys
import argparse
import socket
import re
import requests
import json
import collections
version = "2.0 on Kivy" #Prepared to use in Kivy
'''
Information about the author of this module:
Author: Darko Sancanin
Twitter: @darkosan
GitHub: https://github.com/darkosancanin
'''
'''
You can find original (not ... |
#!/usr/bin/env python
import rospy
from std_msgs.msg import Bool
from geometry_msgs.msg import Pose, Twist, TransformStamped
from gazebo_msgs.msg import ModelState
from scipy import signal, interpolate
import numpy as np
import copy
import os
import random
import tf, tf.msg
import json
move = False
class ObjectsCo... |
from flask import Blueprint
from flask_cors import CORS
api_v1 = Blueprint('api_v1', __name__)
CORS(api_v1)
from linktodapp.apis.v1 import resources
|
import numpy as np
import torch
from railrl.state_distance.policies import UniversalPolicy
from railrl.torch.networks import TanhMlpPolicy, FlattenMlp
from railrl.torch.sac.policies import TanhGaussianPolicy
class TdmQf(FlattenMlp):
def __init__(
self,
env,
vectorized,
... |
# qubit number=4
# total number=43
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import ... |
# -*- coding: utf-8 -*-
from .softmax import *
from .sigmoid import *
from .relu import *
from .conv2d import *
|
######################################
# Import and initialize the librarys #
######################################
import time
from code.algorithm.commonFunc import commonFunc
from code.pygame_objects import *
#################
# Setup logging #
#################
filename = os.path.basename(__file__).split('.')[0]
... |
from . import verb
from .. import entities
import textwrap
class Who(verb.Verb):
"""Show a list of connected players"""
command = _('who')
verbtype = verb.VERSATILE
def process(self, message):
out_message = self.get_player_list()
self.session.send_to_client(out_message)
self.f... |
"""
sentry.event_manager
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
import math
import six
from datetime import datetime, timedelta
from collect... |
import torch.nn as nn
import torch
import torch.cuda
from onmt.utils.logging import init_logger
class MatrixTree(nn.Module):
"""Implementation of the matrix-tree theorem for computing marginals
of non-projective dependency parsing. This attention layer is used
in the paper "Learning Structured Text Repres... |
# pylint: disable=missing-docstring
"""
Common functionality to be reused among tests.
"""
from __future__ import absolute_import, print_function
import glob
import os
import subprocess as sub
import conf
import util
import util.db_control as dbc
DB_START = os.path.join(util.ROOT, 'conf', '.db_start')
def alive(pid... |
import dsgrn_utilities.graphtranslation
import dsgrn_utilities.get_parameter_neighbors
import dsgrn_utilities.network_distance
import dsgrn_utilities.network2logicfile
import dsgrn_utilities.parameter_building
import dsgrn_utilities.select_boolean_params
__all__ = ["graphtranslation","get_parameter_neighbors","network... |
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('num_workers', type=int)
parser.add_argument('iterations', type=int)
args = parser.parse_args()
with open('horovod_experiment.sh', 'w') as f:
f.write('#!/bin/sh\n\njavac -cp \".:jar_files/*:\" HOWorker.java\n')
prefix = '\'java -cp \".:jar... |
#!/usr/bin/env python3
bot_secret_token = ''
admin_password = ''
data_dump_file = ''
|
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from global-recommendations.app import app
def test_my_list_success():
client = app.test_client()
reply = client.get("/")
assert reply.status_code == 200
assert reply.json == RESPONSE
RESPONSE = {
... |
from concurrent.futures import ThreadPoolExecutor
import asyncio
import sys
from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner
from autobahn.wamp.auth import compute_wcs
from autobahn.wamp.types import RegisterOptions
from autobahn.wamp.exception import ApplicationError
from prettyconf import conf... |
# coding = utf-8
import os
import struct
import platform
import subprocess
from os.path import isfile
from pathlib import Path
from ctypes import CDLL, c_char_p, c_long
from _ctypes import dlclose
import torch
import numpy as np
from torch.utils.data import Dataset
from util.conf import Configuration
class TSD... |
import pandas as pd
from autor import Author
from excel import ExcelFile
from individuos import Student, Egress
from verifica_autores import em_lista_autores, trata_exceçoes
from valores import ND, quadrennium
from PyscopusModified import ScopusModified
from pprint import pprint
from excecoes import excecoes_artigos_sc... |
# -*- coding: utf-8 -*-
from cms.tests.admin import *
from cms.tests.api import *
from cms.tests.apphooks import *
from cms.tests.docs import *
from cms.tests.forms import *
from cms.tests.i18n import *
from cms.tests.mail import *
from cms.tests.menu import *
from cms.tests.menu_utils import *
from cms.tests.multili... |
file = './text.txt'
openFile = open(file)
dictionary = dict()
for line in openFile :
words = line.split()
for word in words :
dictionary[word] = dictionary.get(word,0) + 1
temp = list()
for k,v in dictionary.items() :
newt = (v,k)
temp.append(newt)
temp =sorted(temp, reverse=True)
for v,k... |
import requests
def get_patient_data(patient_id):
res = requests.get(f'http://hapi.fhir.org/baseDstu3/Patient/{patient_id}/_history/1?_pretty=true&_format=json')
return res.json()
def get_data(id,
fhir_base='http://hapi.fhir.org/baseDstu3/',
fhir_resource='Patient/'):
res = requests.get(f'{fhir... |
def coinDistance():
coin = hero.findNearestItem()
if coin:
return hero.distanceTo(coin)
return 0
while True:
distance = coinDistance()
if distance > 0:
hero.say(distance)
|
# The following heavily commented pseudocode is not actually runnable: is an amalgam of syntax
# from multiple programming languages, references a number of functions that are not defined,
# and has not been debugged.
# It is only useful for educational purposes: in particular, to more precisely describe
# the closed l... |
import uuid
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.db.models import JSONField as JSONBField # type: ignore
# mypy does not have support for some Django 3.x features (e.g. JSONField)
# https://github.com/typeddjango/django-stubs/issues/439
class Cart(models.Mo... |
# Standard library imports
import json
import threading
import logging
# Third party imports
from kafka import KafkaConsumer
# Local application imports
from Config.config import KafkaTopicNames, KafkaConfig, KafkaGroupIds
from Module.kafkaProducer.elasticSendProducer import ElasticSendProducers
class NessusOutputCo... |
import sys
from django.contrib.contenttypes.generic import GenericForeignKey, GenericRelation
from django.core.management.color import color_style
from django.utils.itercompat import is_iterable
try:
any
except NameError:
from django.utils.itercompat import any
class ModelErrorCollection:
def __init__(se... |
import socket
from .base import *
# Webpack Loader by Owais Lane
# ------------------------------------------------------------------------------
# https://github.com/owais/django-webpack-loader
WEBPACK_LOADER = {
'DEFAULT': {
'BUNDLE_DIR_NAME': 'builds-dev/',
'STATS_FILE': os.path.join(BASE_DI... |
# coding: utf-8
"""
Copyright 2017 Square, 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 la... |
import os
from sqlalchemy import MetaData, Table, Integer, String, Column, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import opentracing
import sqlalchemy_opentracing
DB_LOCATION = '/tmp/simple.db'
# Your OpenTracing-compatible tracer here.
tracer = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.