filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_13274 | import copy
import json
import os
import platform
from datetime import datetime
from pathlib import Path
from subprocess import (run, CalledProcessError)
TERMINAL = {
'Linux': 'gnome-terminal',
'Windows': 'start powershell -WorkingDirectory',
'Darwin': 'open -n /Applications/Utilities/Terminal.app'
}
de... |
the-stack_0_13275 | """
ART Attack Runner
Version: 1.0
Author: Olivier Lemelin
Script that was built in order to automate the execution of ART.
"""
import os
import os.path
import fnmatch
import platform
import re
import subprocess
import sys
import hashlib
import json
import argparse
import yaml
import unidecode
# pylint: disable=lin... |
the-stack_0_13276 | from collections import defaultdict
class UnionFind:
def __init__(self, n):
self.size = n
self.parents = [-1] * n
def union(self, x, y):
x = self.find(x)
y = self.find(y)
if x == y: return
if self.parents[x] > self.parents[y]: x, y = y, x
self.parents[x] +... |
the-stack_0_13277 | """Add contents_hash
Revision ID: 515f518eff57
Revises: 218fd78e07e8
Create Date: 2017-07-25 15:21:18.613141
"""
# revision identifiers, used by Alembic.
revision = '515f518eff57'
down_revision = '218fd78e07e8'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
... |
the-stack_0_13279 | # model settings
model = dict(
type='CenterNet',
pretrained='./pretrain/darknet53.pth',
backbone=dict(
type='DarknetV3',
layers=[1, 2, 8, 8, 4],
inplanes=[3, 32, 64, 128, 256, 512],
planes=[32, 64, 128, 256, 512, 1024],
norm_cfg=dict(type='BN'),
out_indices=(1... |
the-stack_0_13280 | #!/usr/bin/env python
from multiprocessing import Pool
import numpy as np
import os
import matplotlib.pyplot as plt
from functools import partial
import time
import copy
from scipy.stats import multivariate_normal
from scipy import stats
# from scipy.optimize import root
from scipy.optimize import bisect
from sklearn... |
the-stack_0_13283 | # Copyright (c) 2019, NVIDIA 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... |
the-stack_0_13284 | paramwise_cfg = dict(
norm_decay_mult=0.0,
bias_decay_mult=0.0,
custom_keys={
'.absolute_pos_embed': dict(decay_mult=0.0),
'.relative_position_bias_table': dict(decay_mult=0.0)
})
# for batch in each gpu is 128, 8 gpu
# lr = 5e-4 * 128 * 8 / 512 = 0.001
optimizer = dict(
type='AdamW... |
the-stack_0_13286 | from .store import FixityDocument as Doc
from .store import JSONSchemaCollection
from pprint import pprint
def get_schemas():
"""Get JSON schemas for FixityDocument
Returns:
JSONSchemaCollection: Object and document JSON schema that define the store
"""
schemas = JSONSchemaCollection(dict())
... |
the-stack_0_13287 | """
Visualize the notes network of a Zettelkasten.
Each arrow represents a link from one zettel to another. The script assumes
that zettels have filenames of the form "YYYYMMDDHHMM This is a title" and that
links have the form [[YYYYMMDDHHMM]]
"""
import glob
import os.path
import re
from textwrap import fill
PAT_... |
the-stack_0_13289 | #!/usr/bin/python3
"""Test textlib module."""
#
# (C) Pywikibot team, 2011-2022
#
# Distributed under the terms of the MIT license.
#
import codecs
import functools
import os
import re
import unittest
from collections import OrderedDict
from contextlib import suppress
from unittest import mock
import pywikibot
from py... |
the-stack_0_13293 | # 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)
from spack import *
class Gromacs(CMakePackage):
"""GROMACS (GROningen MAchine for Chemical Simulations) is a molecu... |
the-stack_0_13294 | from typing import Optional, Union, Tuple
from torch_geometric.typing import OptTensor, Adj
import torch
from torch import Tensor
import torch.nn.functional as F
from torch.nn import Parameter as Param
from torch.nn import Parameter
from torch_scatter import scatter
from torch_sparse import SparseTensor, matmul, maske... |
the-stack_0_13295 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
the-stack_0_13296 | from discord.ext import commands
import discord, io
class Core(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.update = {
"allowUpdate": True,
"url": "https://raw.github.com/Akumatic/Akuma-Matata/master/extensions/core.py",
"private": False
}
... |
the-stack_0_13297 | # encoding: utf-8
from opendatatools.common import RestAgent
from opendatatools.common import date_convert, remove_non_numerical
from bs4 import BeautifulSoup
import datetime
import json
import pandas as pd
import io
from opendatatools.futures.futures_agent import _concat_df
import zipfile
def time_map(x):
if x =... |
the-stack_0_13298 | from tqdm.auto import tqdm
import numpy as np
import glob
import os
from torchvision import models
from torchvision import transforms
import torch
import torch.nn as nn
from PIL import Image
import gc
import argparse
import h5py
import json
from augs import (
GaussianBlur,
Cutout,
CutoutColor,
CenterCro... |
the-stack_0_13299 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from collections import namedtuple
from corehq.apps.userreports.models import AsyncIndicator, get_datasource_config
from corehq.apps.userreports.util ... |
the-stack_0_13300 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name: PyAnime4K utils
Author: TianZerL
Editor: TianZerL
"""
from pyanime4k import ffmpeg_handler
import contextlib
import os
def migrate_audio_streams(
upscaled_video: str, original_video: str, output_path: str
) -> None:
""" migrate audio streams
Args:... |
the-stack_0_13305 | from os.path import (
realpath,
join,
)
from typing import List
from hummingbot.core.utils.symbol_fetcher import SymbolFetcher
# Global variables
required_exchanges: List[str] = []
symbol_fetcher = SymbolFetcher.get_instance()
# Global static values
KEYFILE_PREFIX = "key_file_"
KEYFILE_POSTFIX = ".json"
GLOB... |
the-stack_0_13306 | from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
import tensorflow as tf
from dltk.core.modules.base import AbstractModule
class TransposedConvolution(AbstractModule):
"""Tranposed convolution module
This build a 2D or 3D transposed convolution ba... |
the-stack_0_13308 | """
Name : c14_13_average_price_call.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : Yuxing Yan
Date : 6/6/2017
email : yany@canisius.edu
paulyxy@hotmail.com
"""
import scipy as sp
s0=40. # today stock price
x=40. ... |
the-stack_0_13309 | """MIT License
Copyright (c) 2021 Jacopo Schiavon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish... |
the-stack_0_13310 | import cv2
from flask import Flask
from scipy.spatial import distance
from extract_car import extract_car
from extract_parking import extract_parking
from extract_rectangle import extract_rectangle
app = Flask(__name__)
def find_parking(show_output):
cap = cv2.VideoCapture("http://10.200.9.248:8080/video/mjpeg"... |
the-stack_0_13312 | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "93183a41b962ce21ea168357172aaf00cdca5bd9"
LLVM_SHA256 = "9f212bca2050e2cffa15aa72aa07d89e108b400d15ca541327a829e3d4108fb9"
tf_http_archive(
... |
the-stack_0_13313 | from six import BytesIO, StringIO, text_type, string_types
from django.http import HttpResponse
from django.contrib.contenttypes.models import ContentType
try:
from django.db.models.fields.related_descriptors import ManyToManyDescriptor
except ImportError:
# Django 1.8 compat hack.
from django.db.models.fi... |
the-stack_0_13315 | import torch
import torch.nn as nn
from .bap import BAP
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zoo import load_url as load_state_dict_from_url
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d'... |
the-stack_0_13323 | import pickle
import torch
from model import RNN
def read_metadata(metadata_path):
with open(metadata_path, 'rb') as f:
metadata = pickle.load(f)
input_stoi = metadata['input_stoi']
label_itos = metadata['label_itos']
return input_stoi, label_itos
def load_model(model_... |
the-stack_0_13326 | import json
import os
from botocore.exceptions import ClientError
from typing import Dict, Any, List
from pprint import pprint
from datetime import datetime, timedelta
import uuid
from collections import namedtuple
from .create_processes_metric_image_util import generate_processes_metrics_image
AlarmStateChangeData =... |
the-stack_0_13329 | from pandac.PandaModules import *
from direct.interval.IntervalGlobal import *
from direct.particles import ParticleEffect
from direct.particles import Particles
from PooledEffect import PooledEffect
from EffectController import EffectController
import os
class HealSparks(PooledEffect, EffectController):
cardScale... |
the-stack_0_13331 | #!/usr/bin/python
"""
Script to upload images to wikipedia.
The following parameters are supported:
-keep Keep the filename as is
-filename: Target filename without the namespace prefix
-prefix: Add specified prefix to every filename.
-noverify Do not ask for verification of the upload des... |
the-stack_0_13334 | # -*- coding: utf-8 -*-
"""
Module containing utilities to create/manipulate grids.
"""
import logging
import math
from typing import List, Tuple, Union
import geopandas as gpd
import pyproj
import shapely.ops as sh_ops
import shapely.geometry as sh_geom
#-------------------------------------------------------------... |
the-stack_0_13336 | import numpy as np
import pytest
import pandas as pd
import pandas.testing as tm
@pytest.mark.parametrize(
"dropna, tuples, outputs",
[
(
True,
[["A", "B"], ["B", "A"]],
{"c": [13.0, 123.23], "d": [13.0, 123.0], "e": [13.0, 1.0]},
),
(
F... |
the-stack_0_13337 | import argparse
import json
import torch
from scripts.default_config import (get_default_config, imagedata_kwargs,
model_kwargs, merge_from_files_with_base)
import torchreid
from torchreid.utils import collect_env_info, set_random_seed
from ptflops import get_model_complexity_info
... |
the-stack_0_13340 | import torch
from torch.ao.quantization.observer import ObserverBase
class ModelReportObserver(ObserverBase):
r"""This observer is used to record additional information regarding keeping track
of S = average_batch_activation_range/epoch_activation_range.
The purpose of this information is to prepare a re... |
the-stack_0_13341 | import difflib
import email.parser
import inspect
import json
import os
import re
import sys
import pytest
from .env import H2Conf
class TestPost:
@pytest.fixture(autouse=True, scope='class')
def _class_scope(self, env):
TestPost._local_dir = os.path.dirname(inspect.getfile(TestPost))
H2Con... |
the-stack_0_13343 | """
PyQt App that leverages completed model for image inpainting
"""
import sys
import os
import random
import torch
import argparse
from PIL import Image
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from torchvision.utils import make_grid
from torchvision.utils import save_imag... |
the-stack_0_13345 | import ctypes
import os
from casual.xatmi.xatmi import tpalloc, tpfree, tperrno, tperrnostring, \
X_OCTET, CASUAL_BUFFER_BINARY_TYPE, CASUAL_BUFFER_BINARY_SUBTYPE, \
CASUAL_BUFFER_JSON_TYPE, CASUAL_BUFFER_JSON_SUBTYPE, \
CASUAL_BUFFER_YAML_TYPE, CASUAL_BUFFER_YAML_SUBTYPE, \
CASUAL_BUFFER_XML_TYPE, CASU... |
the-stack_0_13348 | #
# Copyright (c) [2021] Huawei Technologies Co.,Ltd.All rights reserved.
#
# OpenArkCompiler is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
#
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WA... |
the-stack_0_13350 | # -*- coding: utf-8 -*-
import sys
import gc
from hypothesis import given
from hypothesis.extra import numpy as hynp
import pytest
import numpy as np
from numpy.testing import (
assert_, assert_equal, assert_raises, assert_warns, HAS_REFCOUNT,
assert_raises_regex,
)
import textwrap
class Tes... |
the-stack_0_13352 | #!/usr/bin/env python
# Copyright 2012-2018 CERN for the benefit of the ATLAS collaboration.
#
# 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
... |
the-stack_0_13354 | import os
import pickle
import copy
import json
from collections import defaultdict
import numpy as np
import random
import torch
from torch_geometric.data import Data, Dataset, Batch
from torch_geometric.utils import to_networkx
from torch_scatter import scatter
#from torch.utils.data import Dataset
import rdkit
f... |
the-stack_0_13358 |
import logging
log = logging.getLogger(__name__)
import numpy
import westpa
from oldtools.aframe import AnalysisMixin, ArgumentError
class IterRangeMixin(AnalysisMixin):
'''A mixin for limiting the range of data considered for a given analysis. This should go after
DataManagerMixin'''
def __init__(sel... |
the-stack_0_13361 | # this is the script that i used to create output videos and gifs
# simply put all the animations, one per each folder
import os
import subprocess
import logging
first_frame_duration = 1
last_frame_duration = 5
fps = 60
source = "frames"
videos_dir = "videos"
h264_videos_dir = "h264"
gifs_dir = "gifs"
completed = 0
... |
the-stack_0_13362 | # -*- coding: utf-8 -*-
# Copyright 2020 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... |
the-stack_0_13363 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from detectron2.structures import ImageList
from .build import SSHEAD_REGISTRY
from .ss_layers import Flatten
class CycleEnergyHead(nn.Module):
def __init__(self, cfg, cin):
super(CycleEnergyHead, self).__init__()
... |
the-stack_0_13364 | import argparse
import speakeasy
class DbgView(speakeasy.Speakeasy):
"""
Print debug port prints to the console
"""
def __init__(self, debug=False):
super(DbgView, self).__init__(debug=debug)
def debug_print_hook(self, emu, api_name, func, params):
# Call the DbgPrint* function ... |
the-stack_0_13365 | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
the-stack_0_13366 | # Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the LICENSE file in
# the root directory of this source tree. An additional grant of patent rights
# can be found in the PATENTS file in the same directory.
import math
from fairseq import u... |
the-stack_0_13368 | import math
import random
from collections import namedtuple, deque
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.optim as optim
from rllite.common import ReplayBuffer2
USE_CUDA = torch.cuda.is_available()
class StochasticMDP:
def __init__(self):
se... |
the-stack_0_13369 | import numpy
try:
import cupy
xpy_default=cupy
junk_to_check_installed = cupy.array(5) # this will fail if GPU not installed correctly
except:
xpy_default=numpy
def TimeDelayFromEarthCenter(
detector_earthfixed_xyz_metres,
source_right_ascension_radians,
source_declination_ra... |
the-stack_0_13373 | # -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
('hs_core', '0020_baseresource_collections'),
]
operations = [
migrations.CreateModel(
name='F... |
the-stack_0_13374 | import requests
import json
from lxml import html
from lxml import etree
from bs4 import BeautifulSoup
import time
import numpy
import getpass
import os
clear = lambda: os.system('cls')
import json
"""
Most of these functions work through REST APIs, but due to lack of documentation about some features,
this script ... |
the-stack_0_13375 | #!/usr/bin/env python3
"""This example demonstrates using the file token manager for refresh tokens.
In order to run this program, you will first need to obtain a valid refresh token. You
can use the `obtain_refresh_token.py` example to help.
In this example, refresh tokens will be saved into a file `refresh_token.tx... |
the-stack_0_13376 | import time
from rdfframes.knowledge_graph import KnowledgeGraph
from rdfframes.utils.constants import JoinType
from rdfframes.client.http_client import HttpClientDataFormat, HttpClient
def movies_with_american_actors_cache():
graph = KnowledgeGraph(graph_name='dbpedia')
dataset = graph.feature_domain_range('... |
the-stack_0_13378 | ### Noisy DQN Procgen Config ###
env = {
# "name": it should be defined in the command. ex) python main.py --config config.AGENT.procgen --env.name coinrun
"render": False,
"gray_img": True,
"stack_frame": 4,
"no_op": False,
"reward_clip": True,
}
agent = {
"name": "noisy",
"network": ... |
the-stack_0_13380 | #!/usr/bin/env python3
""" Make satellite test data """
import os
from pathlib import Path
import numcodecs
import pandas as pd
import xarray as xr
import nowcasting_dataset
START = pd.Timestamp("2020-04-01T12:00")
END = pd.Timestamp("2020-04-01T14:00")
OUTPUT_PATH = Path(os.path.dirname(nowcasting_dataset.__file__... |
the-stack_0_13382 | from primitiv import Device
from primitiv import tensor_functions as tF
from primitiv.devices import Naive
import numpy as np
import unittest
class TensorFunctionsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def setUp... |
the-stack_0_13384 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# https://www.bggofurther.com/2015/01/create-an-interactive-command-line-menu-using-python/
# This tool won't work in Visual Studio Code (as an example).
# I don't know why this is the case but just run it in cmd.exe
import sys
import os
import collections
import ctypes
fr... |
the-stack_0_13386 | # -*- coding: utf-8 -*-
# This is for introducing **syntactic** local bindings, i.e. simple code splicing
# at macro expansion time. If you're looking for regular run-time let et al. macros,
# see letdo.py.
# TODO: Coverage of code using `with block` and `with expr` is not reported correctly.
#
# TODO: As this is a t... |
the-stack_0_13387 | from __future__ import unicode_literals
import json
from django import forms
from django.utils.safestring import mark_safe
from .conf import settings
class MediumEditorTextarea(forms.Textarea):
def render(self, name, value, attrs=None, renderer=None):
if attrs is None:
attrs = {}
at... |
the-stack_0_13388 | import os
import tensorflow as tf
from configparser import ConfigParser
from utilities.set_dirs import get_conf_dir
conf_dir = get_conf_dir(debug=False)
parser = ConfigParser(os.environ)
parser.read(os.path.join(conf_dir, 'neural_network.ini'))
# AdamOptimizer
beta1 = parser.getfloat('optimizer', 'beta1')
beta2 = pa... |
the-stack_0_13389 |
from .expression import Params, ParamsExpression
class Function(ParamsExpression):
__visit_name__ = 'function'
def __init__(self, filter=None, weight=None, **kwargs):
self.filter = filter
self.weight = weight
super(Function, self).__init__(**kwargs)
class Weight(Function):
__fu... |
the-stack_0_13390 | import functools
import requests
import pyvo
import pyvo.auth.authsession
import warnings
from rubin_jupyter_utils.helpers import get_access_token
from rubin_jupyter_utils.config import RubinConfig
def deprecated(new_name=''):
def deprecated(func):
"""This is a decorator which can be used to mark function... |
the-stack_0_13392 | from collections import defaultdict, Sized
import numpy as np
import pandas as pd
from pandas._libs.lib import fast_zip
from pandas._libs.parsers import union_categoricals
from pandas.core.dtypes.common import is_numeric_dtype
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph._traversal import connected_co... |
the-stack_0_13393 | '''
Function:
千千音乐下载: http://music.taihe.com/
Author:
Charles
微信公众号:
Charles的皮卡丘
声明:
代码仅供学习交流, 不得用于商业/非法使用.
'''
import os
import click
import requests
from contextlib import closing
'''
Input:
-mode: search(搜索模式)/download(下载模式)
--search模式:
----songname: 搜索的歌名
--download模式:
----need_down_list: 需要下载的歌曲名列... |
the-stack_0_13395 | # Written by Dr Daniel Buscombe, Marda Science LLC
#
# MIT License
#
# Copyright (c) 2020, Marda Science LLC
#
# 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 w... |
the-stack_0_13396 | ############################################################
# log
############################################################
# Contains the custom logger object to be used.
import logging
import sys
import os
def setup_custom_logger():
"""Setups the custom logger to be used globally.
The logger object... |
the-stack_0_13398 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from read_excel_MIK import read_excel_MIK
from read_excel_Seichitech import read_excel_Seichitech
from openpyxl import load_workbook
import pandas
class read_write_excel:
"""
For read/write and parse excel file
"""
def __init__(self, filename):
... |
the-stack_0_13399 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
the-stack_0_13400 | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import List
from fairseq import utils
from fairseq.models.roberta import (
RobertaModel,
RobertaLMHead,
roberta_base_architecture,... |
the-stack_0_13401 |
# Unicode and Emoji
# importing necessary library
from tkinter import * # from tkinter we import everything
import tkinter as tk
from tkinter import ttk
from PIL import Image, ImageTk
import tkinter.messagebox as mbox
import emoji
import pandas as pd
data = pd.read_csv('emoji_df.csv')
emoji1 = data['emoji'].tolist(... |
the-stack_0_13403 | import zmq
import unittest
from http import client as http
from .simple import Base, TimeoutError
CONFIG='test/wlimit.yaml'
CHAT_FW = "ipc:///tmp/zerogw-test-chatfw"
class Wlimit(Base):
timeout = 2 # in zmq.select units (seconds)
config = CONFIG
def setUp(self):
self.zmq = zmq.Context(1)
... |
the-stack_0_13407 | # Copyright 2016 - Nokia 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 ... |
the-stack_0_13408 | from __future__ import unicode_literals
import os
import sys
import urllib.request
import shutil
from contextlib import closing
#import gzip
import datetime
from dateutil import parser
import logging
#import subprocess
from netCDF4 import Dataset
import rasterio as rio
import eeUtil
import numpy as np
LOG_LEVEL = log... |
the-stack_0_13409 | """Test the cloud.iot module."""
import asyncio
from unittest.mock import patch, MagicMock, PropertyMock
from aiohttp import WSMsgType, client_exceptions, web
import pytest
from homeassistant.setup import async_setup_component
from homeassistant.components.cloud import (
Cloud, iot, auth_api, MODE_DEV)
from homea... |
the-stack_0_13411 | import sys
sys.path.append("..")
import pickle
import json, gzip
import datetime
import numpy as np
import config as cfg
from utils import log
##################### GLOBAL VARS #######################
GRID = []
CODES = []
STEP = 0.25
###################### LOAD DATA ########################
def load():
global... |
the-stack_0_13412 | from __future__ import annotations
from collections import defaultdict
from typing import TYPE_CHECKING
from typing import DefaultDict
from poetry.console.commands.command import Command
if TYPE_CHECKING:
from poetry.core.packages.package import Package
class PluginShowCommand(Command):
name = "plugin sh... |
the-stack_0_13413 | # pylint: disable=W0611
'''
Android Joystick Input Provider
===============================
This module is based on the PyGame JoyStick Input Provider. For more
information, please refer to
`<http://www.pygame.org/docs/ref/joystick.html>`_
'''
__all__ = ('AndroidMotionEventProvider', )
import os
try:
import an... |
the-stack_0_13414 | # Software License Agreement (BSD License)
#
# Copyright (c) 2009, Willow Garage, 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:
#
# * Redistributions of source code must retain the above... |
the-stack_0_13415 | #!/usr/bin/env python3
"""
MSFT Bonsai SDK3 Template for Simulator Integration using Python
Copyright 2020 Microsoft
Usage:
For registering simulator with the Bonsai service for training:
python __main__.py \
--workspace <workspace_id> \
--accesskey="<access_key> \
Then connect your regi... |
the-stack_0_13416 | #
# Copyright (c) 2017, Massachusetts Institute of Technology 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 code must retain the above copyright notice, this
# list o... |
the-stack_0_13417 | ############################################################################
#
# Copyright (c) Mamba Developers. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
############################################################################
""" Mamba ... |
the-stack_0_13421 | import statistics
import time
import pytest
import streamz
from metrix import MElement, MStream, MSinkPrinter
from metrix import MCoordinator as MC
@pytest.fixture(scope="module")
def test_elements():
return [
{"name": "m1", "value": 1, "tags": None},
{"name": "m2", "value": 2, "tags": {"foo": "... |
the-stack_0_13423 | from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Type, Union
from vkbottle import ABCView, BaseReturnManager
from vkbottle.dispatch.handlers import FromFuncHandler
from vkbottle.framework.bot import BotLabeler
from vkbottle.modules import logger
from vkbottle_types.events import MessageEvent as _... |
the-stack_0_13424 | import os
import sys
import pandas as pd
import numpy as np
from sklearn.datasets import make_classification
from keras import backend as K
from keras import initializers, layers
from keras.utils import to_categorical
from keras.constraints import non_neg, max_norm
from keras.initializers import Zeros
from keras.const... |
the-stack_0_13425 | """
MonteCarlo rejection of Models
==========================
The created geological models with gempy were exported as SHEMAT-Suite input files. `SHEMAT-Suite <https://git.rwth-aachen.de/SHEMAT-Suite/SHEMAT-Suite-open>`_ [1] is a code for
solving coupled heat transport in porous media. It is written in fortran and ... |
the-stack_0_13426 | """Low-level api to work with relationships"""
import functools
import itertools
class BaseFilter:
"Base filter that accepts one argument"
def __init__(self, **query):
assert len(query) == 1
for key, value in query.items():
self.key = key
self.value = value
@staticm... |
the-stack_0_13427 | """A POP3 client class.
Based on the J. Myers POP3 draft, Jan. 96
"""
# Author: David Ascher <david_ascher@brown.edu>
# [heavily stealing from nntplib.py]
# Updated: Piers Lauder <piers@cs.su.oz.au> [Jul '97]
# String method conversion and test jig improvements by ESR, February 2001.
# Added the POP3_SSL clas... |
the-stack_0_13429 | import pygame
import ctypes
import os
import queue
import sys
import random
import Main
import Functions
import Screens
pygame.init()
# getting the size of user's screen
user32 = ctypes.windll.user32
screensize = user32.GetSystemMetrics(78), user32.GetSystemMetrics(79)
scaled_screen_height = int(screensize[1] * .9... |
the-stack_0_13432 | # Dual Annealing implementation.
# Copyright (c) 2018 Sylvain Gubian <sylvain.gubian@pmi.com>,
# Yang Xiang <yang.xiang@pmi.com>
# Author: Sylvain Gubian, Yang Xiang, PMP S.A.
"""
A Dual Annealing global optimization algorithm
"""
from __future__ import division, print_function, absolute_import
import numpy as np
fr... |
the-stack_0_13433 | from __future__ import absolute_import, division, print_function
import numpy as np
import scipy.io as io
import tensorflow as tf
import align.detect_face
#ref = io.loadmat('pnet_dbg.mat')
with tf.Graph().as_default():
sess = tf.compat.v1.Session()
with sess.as_default():
with tf.compat.v1.variable_s... |
the-stack_0_13436 | """This module contains the meta information of OrgResolveLogicalParents ExternalMethod."""
from ..ucscentralcoremeta import MethodMeta, MethodPropertyMeta
method_meta = MethodMeta("OrgResolveLogicalParents", "orgResolveLogicalParents", "Version142b")
prop_meta = {
"cookie": MethodPropertyMeta("Cookie", "cookie"... |
the-stack_0_13437 | """Parent class for every Overkiz device."""
from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from pyoverkiz.enums import OverkizAttribute, OverkizState
from pyoverkiz.models import Device
from homeassistant.components.sensor import SensorEntityDescription
fro... |
the-stack_0_13439 | import torch
import os
import numpy as np
from tqdm import tqdm
from data_package.smoke_dataset import SmokeDataset
from model_package.mlp_mixer import MLPMixer
from model_package.resnet import resnet18, resnet34,resnext50_32x4d
from torch.utils.data import DataLoader
from data_package.data_transform import VideoTransf... |
the-stack_0_13440 | # Copyright 2017 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.
class _Info(object):
def __init__(self, name, _type=None, entry_type=None):
self._name = name
self._type = _type
if entry_type is not None and... |
the-stack_0_13442 | # Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
the-stack_0_13443 | import numpy as np
from PuzzleLib.Backend import gpuarray
from PuzzleLib.Modules.Module import ModuleError, Module
class Glue(Module):
def __init__(self, modules=None, fwdGlue=None, bwdGlue=None, fwdShapeGlue=None, bwdShapeGlue=None, name=None):
super().__init__(name)
if modules is not None and not isinstance(... |
the-stack_0_13445 | import os
import re
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
RECEIVED_FILE_CHAR_LIMIT = 50 * 1000
# The limit in number of characters of files to accept
def new_file(basename, content):
"""
The method creates a new File object or derived object from File based on the... |
the-stack_0_13448 | import unittest
from conans.client import tools
from conans.client.build.visual_environment import VisualStudioBuildEnvironment
from conans.test.utils.mocks import MockSettings, MockConanfile
from conans.test.utils.tools import TestClient
class VisualStudioBuildEnvironmentTest(unittest.TestCase):
def test_visua... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.