filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_10549 | #!/usr/bin/env python
# Copyright (c) 2012-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Extract _("...") strings for translation and convert to Qt stringdefs so that
they can be picked up by ... |
the-stack_0_10550 | """
Syntax difference of two functions - using diff utility and filtering the
result.
"""
from subprocess import check_output, CalledProcessError
from tempfile import mkdtemp
import os
def syntax_diff(first_file, second_file, name, kind, first_line, second_line):
"""Get diff of a C function or type between firs... |
the-stack_0_10551 | import copy
import datetime
import errno
import hashlib
import os
import time
from collections import defaultdict, deque, OrderedDict
import torch
import torch.distributed as dist
class SmoothedValue(object):
"""Track a series of values and provide access to smoothed values over a
window or the global series... |
the-stack_0_10554 | """Plotting and visualization tools."""
# stdlib
import logging
from datetime import datetime
from pathlib import Path
# external
import plotly.express as px
import plotly.graph_objects as go
LOG = logging.getLogger(__name__)
output_path = Path("output/images")
def line(x, y):
"""Plots line plot. Supports up t... |
the-stack_0_10555 | import pprint
from time import strftime, gmtime
import pandas as pd
import boto3
import sagemaker
from sagemaker import get_execution_role
from sagemaker.model import Model
from sagemaker.xgboost.model import XGBoostModel
from sagemaker.model_monitor import DataCaptureConfig, DatasetFormat, DefaultModelMonitor
sess =... |
the-stack_0_10558 | #
# Pyserini: Reproducible IR research with sparse and dense representations
#
# 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... |
the-stack_0_10559 | import math
import json
import random
class Vector:
def __init__(self, x=0, y=0):
self.x = x
self.y = y
def __str__(self):
return "(%d,%d)" % (self.x, self.y)
def add(self,p):
return Vector(self.x+p.x,self.y+p.y)
def subtract(self,p):
return Vector(self.x-... |
the-stack_0_10560 | # coding: utf-8
import sys
from python_environment_check import check_packages
import pandas as pd
import matplotlib.pyplot as plt
from mlxtend.plotting import scatterplotmatrix
import numpy as np
from mlxtend.plotting import heatmap
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import Li... |
the-stack_0_10562 | # Copyright (c) 2022 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 app... |
the-stack_0_10563 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libunwind(AutotoolsPackage):
"""A portable and efficient C programming interface (API) to ... |
the-stack_0_10564 | # -*- coding: utf-8 -*-
# Max-Planck-Gesellschaft zur Förderung der Wissenschaften e.V. (MPG) is
# holder of all proprietary rights on this computer program.
# You can only use this computer program if you have closed
# a license agreement with MPG or you get the right to use the computer
# program from someone who is... |
the-stack_0_10567 | """Console adapted from Python's console found in code.py.
An earlier version of this code was subclassing code.InteractiveConsole.
However, as more and more changes were introduced, dealing with
code transformation and especially customized error handling,
it seemed to make sense to "rewrite" every relevant part in
t... |
the-stack_0_10569 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 11 19:05:26 2014
Module for linking with the Allen brain atlas
@author: tim
"""
import csv
from os import path, rename, remove
from glob import glob
import numpy as np
from scipy import stats
from matplotlib import pyplot as plt
from maybrain import brain
# from maybrain... |
the-stack_0_10570 | import pytest # type: ignore
from openstates.cli.update import override_settings
class _Settings:
pass
@pytest.fixture
def settings():
ret = _Settings()
ret.foo = "bar"
ret.baz = "bob"
return ret
def test_override_settings(settings):
with override_settings(settings, {"baz": "fez"}):
... |
the-stack_0_10573 | import os
from saleor.account import models
import secrets
from itertools import chain
from typing import Iterable, Tuple, Union
import graphene
from django.core.exceptions import (
NON_FIELD_ERRORS,
ImproperlyConfigured,
ValidationError,
)
from django.core.files.storage import default_storage
from django.... |
the-stack_0_10574 | import librosa
import numpy as np
from .utils import Util
from sklearn.preprocessing import StandardScaler
import pandas as pd
from numpy.linalg import det
from multiprocessing.dummy import Pool as ThreadPool
#from multiprocessing import Pool
from concurrent.futures import ThreadPoolExecutor
class FeatureAggregator(ob... |
the-stack_0_10575 | ##################################################################################
# name: classifier
# file: sort.py
# date: 11-05-2021
# author: @nilspinnau, Nils Pinnau
# description: file to split the data into training + validating and testing set
################... |
the-stack_0_10577 | from minqlx import Plugin, thread, next_frame
import time
import random
import threading
class thirtysecwarn(Plugin):
"""Created by Thomas Jones on 01/09/2016 - thomas@tomtecsolutions.com
thirtysecwarn.py - a minqlx plugin to play unused VO when a CA game is nearing the round time limit.
This plugin is released... |
the-stack_0_10578 | from appdirs import user_config_dir, site_config_dir, user_cache_dir
import os
import platform
APP_NAME = "xicam"
APP_AUTHOR = "CAMERA"
user_cache_dir = user_cache_dir(appname=APP_NAME, appauthor=APP_AUTHOR)
site_config_dir = site_config_dir(appname=APP_NAME, appauthor=APP_AUTHOR)
user_config_dir = user_config_dir(a... |
the-stack_0_10579 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
the-stack_0_10580 | import numpy as np
import EggNet
def _read_np_tensor(weight_file: str):
if weight_file.endswith('.npy'):
is_binary = True
elif weight_file.endswith('.txt'):
is_binary = False
else:
raise NotImplementedError()
if is_binary:
return np.load(weight_file)
else:
... |
the-stack_0_10582 | # -*- coding: utf-8 -*-
# Adapted from nlxio written by Bernard Willards <https://github.com/bwillers/nlxio>
import numpy as np
import nept
def load_events(filename, labels):
"""Loads neuralynx events
Parameters
----------
filename: str
labels: dict
With event name as the key and Neuraly... |
the-stack_0_10585 | from pyscf import gto, dft
from automr import guess
#mf=guess.from_fch_simp("v2.fchk", xc='pbe0')
#mf2.verbose=9
#mf2.stability()
mol = gto.Mole(atom='''Cr 0.0 0.0 0.0; Cr 0.0 0.0 1.6''', basis='def2-tzvp', verbose=5).build()
mf = dft.RKS(mol)
mf.xc = 'pbe0'
mf.kernel()
mf2 = guess.check_stab(mf, newton=True, res=T... |
the-stack_0_10586 | #!/usr/bin/env python3
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import os
import sys
import platform
import subprocess
lib_env_key = "PATH" if platform.system() == "Windows" else "LD_LIBRARY_PATH"
if lib_env_key not in os.environ:
os.environ[lib_env_key] = ""
python_path... |
the-stack_0_10587 | #!/usr/bin/env python
#
# Copyright 2007 Google 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 o... |
the-stack_0_10590 | #!/usr/bin/env python
from glob import glob
import sipprcommon.runMetadata as runMetadata
from sipprcommon.offhours import Offhours
from sipprcommon.accessoryfunctions.accessoryFunctions import *
# Import ElementTree - try first to import the faster C version, if that doesn't
# work, try to import the regular version
t... |
the-stack_0_10591 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Font(_BaseTraceHierarchyType):
# color
# -----
@property
def color(self):
"""
The 'color' property is a color and may be specified as:
- A hex string (e.g. '#ff0000'... |
the-stack_0_10592 | import socket
import os
import cv2
import pickle
import threading
import struct
def sendImage():
os.system('python sender.py')
t1 = threading.Thread(target=sendImage)
t1.start()
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host_ip = '192.168.43.6'
port = 9900
client_socket.connect((host_ip... |
the-stack_0_10593 | import sys
from setuptools import setup, find_packages
import versioneer
with open("README.md", "r") as fh:
long_description = fh.read()
# from https://github.com/pytest-dev/pytest-runner#conditional-requirement
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] ... |
the-stack_0_10594 | # Copyright (c) 2006-2007, 2009-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2013-2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2015 Florian Bruhin <me@the-compiler.org>
# Copyright (c) 2015-2016 Cara Vinson <ceridwenv@gmail.com>
# Licensed under ... |
the-stack_0_10595 | """Module implementing a wrapper for the Prod2Vec model"""
import logging
from functools import partial
from multiprocessing import cpu_count
from multiprocessing.pool import ThreadPool
import pandas as pd
from gensim.models import Word2Vec
from tqdm import tqdm
from ..data.initializer import DataLoaderSaver
from .b... |
the-stack_0_10596 | '''
Support for reading source files, including unpacking from cat/dat files.
Includes File_Missing_Exception for when a file is not found.
Import as:
from Source_Reader import *
'''
import os
from pathlib import Path # TODO: convert all from os to pathlib.
from ..Common.Settings import Settings
from .Logs import *... |
the-stack_0_10599 | """
Pytest fixtures: High level Resource Management and base setup fixtures
"""
import datetime
import random
import string
import sys
import os
import time
import allure
import re
import logging
from _pytest.fixtures import SubRequest
from pyparsing import Optional
ALLURE_ENVIRONMENT_PROPERTIES_FILE = 'environm... |
the-stack_0_10600 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 24 22:53:59 2018
@authors: a.pakbin, T.J. Ashby
"""
from sklearn.model_selection import StratifiedKFold
from auxiliary import grid_search,ICD9_categorizer, save_fold_data, convert_numbers_to_names, min_max_mean_auc_for_labels, train_test_one_hot_encoder, possible_values_f... |
the-stack_0_10601 | from acmacs_py import *
from .. import utils
from .log import Log
import acmacs
# ----------------------------------------------------------------------
class MapMaker:
def __init__(self, chain_setup, minimum_column_basis, log :Log):
self.chain_setup = chain_setup
self.minimum_column_basis = mini... |
the-stack_0_10602 | import json
import os
from flask import Flask, render_template, redirect, request
import tv
import logging
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
app = Flask(__name__)
BUTTONS = {}
@app.route('/')
def index():
return render_template('index.html',
tv_state=tv.g... |
the-stack_0_10604 | import numpy as np
import random
import copy
from collections import namedtuple, deque
from ddpg_models import Actor, Critic
from ou_noise import OUNoise
from replay_buffer import ReplayBuffer
import torch
import torch.nn.functional as F
import torch.optim as optim
BUFFER_SIZE = int(1e6) # replay buffer size
BATCH_... |
the-stack_0_10606 | import warnings
import rdflib
from rdflib import OWL, RDF, RDFS, BNode
from ..exceptions import NeuroLangNotImplementedError
from ..expressions import Constant, Symbol
from ..logic import Conjunction, Implication, Union
from .constraints_representation import RightImplication
class OntologyParser:
"""
This ... |
the-stack_0_10608 | import os
import json
import numpy as np
from pychemia.crystal import KPoints
from ...tasks import Task
from ..abinit import AbinitJob
__author__ = 'Guillermo Avendano-Franco'
class StaticCalculation(Task):
def __init__(self, structure, workdir='.', binary='abinit', ecut=50, kpoints=None, kp_density=1E4):
... |
the-stack_0_10609 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
the-stack_0_10610 | """
Copyright (c) 2015 SONATA-NFV, 2017 5GTANGO
ALL RIGHTS RESERVED.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable la... |
the-stack_0_10613 | from django.test.testcases import TestCase
from mock import patch
from robber import expect
from data import cache_managers
class CacheManagersTestCase(TestCase):
@patch('data.cache_managers.allegation_cache_manager.cache_data')
@patch('data.cache_managers.officer_cache_manager.cache_data')
@patch('data... |
the-stack_0_10614 | #!/usr/bin/python3
import argparse
import itertools
import os
import pprint
import sys
import yaml
from PIL import Image, ImageDraw
import bs4
THUMB_MARGIN = 10
def get_polys(html):
with open(html) as f:
soup = bs4.BeautifulSoup(f.read(), features="html5lib")
out = {}
for a in soup.find_all("area"):
... |
the-stack_0_10615 | """
Frequency-split parameters
==========================
Split spectra and plot parameters
"""
import matplotlib.pyplot as plt
from wavespectra import read_ww3
dset = read_ww3("../_static/ww3file.nc")
fcut = 1 / 8
sea = dset.spec.split(fmin=fcut)
swell = dset.spec.split(fmax=fcut)
plt.figure(figsize=(8, 4.5))
p1 ... |
the-stack_0_10616 | # coded by: salism3
# 23 - 05 - 2020 23:18 (Malam Takbir)
from .checker import check_login
from .output import Output, People, Group
from . import parsing
import re
@check_login
def msgUrl(ses, next = None):
html = ses.session.get("https://mbasic.facebook.com/messages" if not next else next).text
data = ... |
the-stack_0_10620 | from django.db import connection
from django.urls import resolve
class QueryCountDebugMiddleware:
"""
This middleware will log the number of queries run
and the total time taken for each request (with a
status code of 200). It does not currently support
multi-db setups.
"""
def __init__(s... |
the-stack_0_10622 | #!/usr/bin/python
import sys
import usb.core
import usb.util
import uinput
import time
from array import array
try:
# hexadecimal vendor and product values
dev = usb.core.find(idVendor=0x084f, idProduct=0xee05)
if dev == None:
print("Could not detect Brigthsign Tochboard")
raise SystemExit
# first endpoint
i... |
the-stack_0_10623 | # Задача: От A до Z
''' Напишите функцию, которая будет принимать строку — диапазон букв английского алфавита. Функция должна возвращать строку из всех букв этого диапазона. Если в диапазоне заданы заглавные буквы, в результирующей строке тоже должны быть заглавные.
Примечания
Диапазон будет задаваться двумя буква... |
the-stack_0_10624 | """
``fish_http_status`` 包含最通用的一些网络状态码
https://github.com/openstack/swift/blob/master/swift/common/http.py
"""
def is_informational(status):
"""
检查状态码是否信息提示
:param:
* status: http 状态码
:return:
* result: True or False
"""
return 100 <= status <= 199
def is_success(status):... |
the-stack_0_10625 | # Copyright 2020 Huawei Technologies Co., Ltd
#
# 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_10626 | """write log to file."""
import logging
import os
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def get_logger(filename, logger_name=None, on_screen=False, level=None):
"""Return logger."""
if not logger_name:
logger_name = filename
logger = logging.getLogger(logger_na... |
the-stack_0_10627 | #
# This file made available under CC0 1.0 Universal (https://creativecommons.org/publicdomain/zero/1.0/legalcode)
#
# Created with the Rule Development Kit: https://github.com/awslabs/aws-config-rdk
# Can be used stand-alone or with the Rule Compliance Engine: https://github.com/awslabs/aws-config-engine-for-complianc... |
the-stack_0_10630 | # -*- coding: utf-8 -*-
# (c) 2009-2018 Martin Wendt and contributors; see WsgiDAV https://github.com/mar10/wsgidav
# Original PyFileServer (c) 2005 Ho Chun Wei.
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
"""
WSGI middleware used for debugging (optional).
This module dumps r... |
the-stack_0_10631 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
the-stack_0_10632 | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
def delete(start,root,sec_node,k):
if(root==None):
return start.next
if(k==0 and sec_node==None):
sec_node=root
return delete(start.next,root,sec_node.next,k)
if(k==0 a... |
the-stack_0_10633 | import numpy as np
import random
import milk.supervised.svm
import milk.supervised.multi
from milk.supervised.classifier import ctransforms
from .fast_classifier import fast_classifier
import milksets.wine
features,labels = milksets.wine.load()
A = np.arange(len(features))
random.seed(9876543210)
random.shuffle(A)
fea... |
the-stack_0_10634 | #!/usr/bin/env python
import math
import os
import sys
from PIL import Image
from escpos.printer import Serial
STRIP_WIDTH = 8
MAX_WIDTH = 540
if len(sys.argv) != 2:
print("\033[1;31;40musage: {} imagefile.png\033[0m".format(sys.argv[0]), file=sys.stderr)
sys.exit(1)
image = Image.open(sys.argv[1])
print(... |
the-stack_0_10635 | import json
from flask import render_template, url_for, redirect, request, send_from_directory, g, flash
from flask_login import current_user, login_user, logout_user, login_required
from flask_babel import _, get_locale
from flask_babel import lazy_gettext as _l
from wtforms import RadioField, TextAreaField
from... |
the-stack_0_10636 | from dagster import Field, RepositoryDefinition, Shape, composite_solid, pipeline, seven, solid
@solid(
config={
'cluster_cfg': Shape(
{
'num_mappers': Field(int),
'num_reducers': Field(int),
'master_heap_size_mb': Field(int),
'wo... |
the-stack_0_10638 | import glob
import importlib
import itertools
import json
import logging
from io import StringIO
from os import path
from pprint import pprint
import click
import conllu
import mlflow
import pandas as pd
import spacy
from gensim.models.keyedvectors import KeyedVectors
from lemmy import Lemmatizer
from sklearn.model_se... |
the-stack_0_10639 | import psyco; psyco.full()
from fltk import *
import copy
import numpy as np
import sys
#if '../PyCommon/modules' not in sys.path:
# sys.path.append('../PyCommon/modules')
if './modules' not in sys.path:
sys.path.append('./modules')
import Math.mmMath as mm
import Resource.ysMotionLoader as yf
import Rende... |
the-stack_0_10640 | # SPDX-License-Identifier: BSD-3-Clause
#
# Copyright (c) 2021 Vít Labuda. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
# following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice... |
the-stack_0_10641 | import unittest
from django.contrib.gis.gdal import HAS_GDAL
from django.contrib.gis.tests.utils import (
SpatialRefSys, oracle, postgis, spatialite,
)
from django.db import connection
from django.test import skipUnlessDBFeature
from django.utils import six
test_srs = ({
'srid': 4326,
'auth_name': ('EPSG'... |
the-stack_0_10642 | from typing import Any, Type
def subclasses_of(klass: Type[Any]):
subclasses = []
stack = [klass]
while stack:
parent = stack.pop()
for subclass in parent.__subclasses__():
if subclass not in subclasses:
stack.append(subclass)
subclasses.app... |
the-stack_0_10643 | # Copyright 2018 Google. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
the-stack_0_10644 | # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.contrib.python.checks.checker.pyflakes import PyflakesChecker
from pants.contrib.python.checks.tasks.checkstyle.plugin_subsystem_base import PluginSubsystemBase
class FlakeChe... |
the-stack_0_10647 | from cereal import car
from opendbc.can.parser import CANParser
from opendbc.can.can_define import CANDefine
from selfdrive.config import Conversions as CV
from selfdrive.car.interfaces import CarStateBase
from selfdrive.car.chrysler.values import DBC, STEER_THRESHOLD
class CarState(CarStateBase):
def __init__(self... |
the-stack_0_10648 | from random import randint
from typing import Dict
from uuid import uuid4
import pytest
from pydantic import BaseModel, ValidationError
from geojson_pydantic.features import Feature, FeatureCollection
from geojson_pydantic.geometries import Geometry, MultiPolygon, Polygon
class GenericProperties(BaseModel):
id:... |
the-stack_0_10649 | import torch
import torch.nn as nn
import torch.nn.functional as F
def kl_loss(x, mu, logsigma, beta):
kl = -0.5 * torch.sum(1 + logsigma - mu.pow(2) - logsigma.exp())
return beta * (kl / torch.numel(x))
def vae_loss(x, mu, logsigma, recon_x, beta=1):
recon_loss = F.mse_loss(x, recon_x, reduction='mean'... |
the-stack_0_10650 | from collections import namedtuple, deque
import difflib
import pygments.formatters
import pygments.lexers
import pygments.token
import re
from typing import List, Tuple, Optional, Iterator, Iterable
from literate.annot import Span, Annot, SpanMerger, \
cut_annot, merge_annot, sub_annot, fill_annot
from litera... |
the-stack_0_10652 | # -*- coding: utf-8 -*-
############################ Copyrights and license ############################
# #
# Copyright 2012 Steve English <steve.english@navetas.com> #
# Copyright 2012 Vincent Jacques <vincent@vincent-ja... |
the-stack_0_10655 | import unittest
from ultrasonic.driver import UltrasonicDriver
class UltrasonicSensorTest(unittest.TestCase):
def test_parse_data(self):
test_data = "SensorA: 34\nSensorB: 0\nSensorC: 0\nSensorA: 40\nSensorD: 0"
parsed_data = []
for line in test_data.split("\n"):
parsed_data... |
the-stack_0_10656 | import os
import re
from poetry.semver import Version
from poetry.version.requirements import Requirement
from .dependency import Dependency
from .dependency_package import DependencyPackage
from .directory_dependency import DirectoryDependency
from .file_dependency import FileDependency
from .locker import Locker
fr... |
the-stack_0_10658 | """
Message delivery
Various interfaces to messaging services. Currently:
- ``pushover`` - a platform for sending and receiving push notifications
is supported.
AUTHORS:
- Martin Albrecht (2012) - initial implementation
"""
import http.client as httplib
from urllib.parse import urlencode
from ssl import SSLContex... |
the-stack_0_10660 | """
@file
@brief Helpers to run examples created with function
@see fn export2tf2onnx.
"""
import collections
import inspect
import numpy
from onnx.numpy_helper import from_array
from onnx.helper import (
make_node, make_graph, make_model, set_model_props, make_tensor)
from onnx import AttributeProto
from ..onnx2py... |
the-stack_0_10661 | from lbry.testcase import CommandTestCase
class AddressManagement(CommandTestCase):
async def test_address_list(self):
addresses = await self.out(self.daemon.jsonrpc_address_list())
self.assertEqual(27, len(addresses))
single = await self.out(self.daemon.jsonrpc_address_list(addresses[11... |
the-stack_0_10662 | #!/usr/bin/env python
"""
ZetCode wxPython tutorial
In this example, we create a wx.ListBox widget.
author: Jan Bodnar
website: www.zetcode.com
last modified: July 2020
"""
import wx
class Example(wx.Frame):
def __init__(self, *args, **kw):
super(Example, self).__init__(*args, **kw)
... |
the-stack_0_10664 | from abc import (
ABC,
abstractmethod
)
from argparse import (
ArgumentParser,
Namespace,
_SubParsersAction,
)
import asyncio
from enum import (
auto,
Enum,
)
import logging
from multiprocessing import (
Process
)
from typing import (
Any,
Dict,
NamedTuple,
)
from lahja impo... |
the-stack_0_10665 | from datetime import datetime as dt
from common.logger import get_logger
from orchestrator.config import ORDER_EXPIRATION_THRESHOLD_IN_MINUTES
from orchestrator.order_status import OrderStatus
logger = get_logger(__name__)
class TransactionHistoryDAO:
def __init__(self, repo):
self.__repo = repo
de... |
the-stack_0_10666 | """
This file offers the methods to automatically retrieve the graph Marinobacter salinus.
The graph is automatically retrieved from the STRING repository.
References
---------------------
Please cite the following if you use the data:
```bib
@article{szklarczyk2019string,
title={STRING v11: protein--protein a... |
the-stack_0_10667 | import abc
import numpy as np
import math
import random
import itertools as it
from hklearn_genetic.board_conflicts import conflict
from deap import tools, gp
class ProblemInterface(metaclass=abc.ABCMeta):
@classmethod
def __subclasshook__(cls, subclass):
return (hasattr(subclass, 'evaluate') and
... |
the-stack_0_10668 | import re
import subprocess
import pygit2
tag_ref = re.compile('^refs/tags/')
committer = pygit2.Signature('Git Worker', 'git@openneuro.org')
def git_show(path, commitish, obj):
repo = pygit2.Repository(path)
commit, _ = repo.resolve_refish(commitish)
data = (commit.tree / obj).read_raw().decode()
... |
the-stack_0_10669 | import pdb
import pickle
import pandas as pd
import os
import numpy as np
import sys
sys.path.insert(1,"../")
sys.path.insert(1,"../../")
sys.path.insert(1,"../../../")
from config_u import base
project_base_path = base
current_path = "scripts/cpmg/automated_metabolite_quantification/"
sys.path.insert(1, o... |
the-stack_0_10670 | import os
from pywps import Process
from pywps import LiteralInput
from pywps import ComplexOutput
from pywps import FORMATS, Format
from pywps import configuration
from pywps.app.Common import Metadata
# from c4cds.regridder import Regridder, REGIONAL
from c4cds.subsetter import Subsetter
from c4cds.plotter import P... |
the-stack_0_10671 | import argparse
import logging
import time
import ast
from tf_pose import common
import cv2
import numpy as np
from tf_pose.estimator import TfPoseEstimator
from tf_pose.networks import get_graph_path, model_wh
from tf_pose.lifting.prob_model import Prob3dPose
from tf_pose.lifting.draw import plot_pose
logger = logg... |
the-stack_0_10672 | # Copyright 2015 OpenStack LLC.
# 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 b... |
the-stack_0_10673 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... |
the-stack_0_10674 | import torch
import torch.nn as nn
import sys
sys.path.insert(0, '../../../../..')
import libs_layers
class Model(torch.nn.Module):
def __init__(self, input_shape, outputs_count, hidden_count = 512):
super(Model, self).__init__()
self.device = "cpu"
self.layers = [
... |
the-stack_0_10675 | from labels import LabelsPlugin
from electrum.plugins import hook
class Plugin(LabelsPlugin):
@hook
def load_wallet(self, wallet, window):
self.window = window
self.start_wallet(wallet)
def on_pulled(self, wallet):
self.print_error('on pulled')
self.window._trigger_update_... |
the-stack_0_10676 | # -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guidata/__init__.py for details)
"""
All guidata DataItem objects demo
A DataSet object is a set of parameters of various types (integer, float,
boolean, string, etc.) which may be edited in ... |
the-stack_0_10678 | import logging
import os
from quasimodo.parts_of_facts import PartsOfFacts
from quasimodo.data_structures.submodule_interface import SubmoduleInterface
from quasimodo.assertion_fusion.trainer import Trainer
from quasimodo.parameters_reader import ParametersReader
save_weights = True
parameters_reader = ParametersR... |
the-stack_0_10679 | import sys, os
import numpy as np
import time
import gym
import tensorflow as tf
from spinup.utils.logx import EpochLogger
from common_utils import *
from core import *
# configure gpu use and supress tensorflow warnings
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.6)
tf_config = tf.compat.v1.ConfigP... |
the-stack_0_10680 | #!/usr/bin/env python
"""
_Template_
Template class for all Step Template implementations to inherit and implement
the API
"""
import os
from WMCore.WMSpec.WMStep import WMStepHelper
from WMCore.WMSpec.ConfigSectionTree import nodeName
class CoreHelper(WMStepHelper):
"""
_CoreHelper_
Helper API for cor... |
the-stack_0_10684 | import enum
from ipaddress import IPv4Address
import yaml
from CybORG import CybORG
from CybORG.Emulator.AWS import AWSConfig
def enum_representer(dumper, data):
return dumper.represent_scalar(u'tag:yaml.org,2002:str', f'{str(data.name)}')
def ipv4_representer(dumper, data):
return dumper.represent_scalar... |
the-stack_0_10686 | import hashlib
import requests
from datetime import datetime, timedelta
from .filter import McDailyFilter
class McDailyAccount:
def __init__(self):
""" User info """
self.username = '' # Username
self.password = '' ... |
the-stack_0_10690 | #!/usr/bin/python3
import binascii
import json
import logging
import re
import sys
from collections import defaultdict
MASK_MAGIC_REGEX = re.compile(r'[*?!@$]')
def to_unixnano(timestamp):
return int(timestamp) * (10**9)
# include/atheme/channels.h
CMODE_FLAG_TO_MODE = {
0x001: 'i', # CMODE_INVITE
0x010... |
the-stack_0_10691 | #
# Python Macro Language for Dragon NaturallySpeaking
# (c) Copyright 1999 by Joel Gould
# Portions (c) Copyright 1999 by Dragon Systems, Inc.
#
# _mouse.py
# Sample macro file which implements mouse and keyboard movement modes
# similar to DragonDictate for Windows
#
# April 1, 2000
# Updates from Jonathan ... |
the-stack_0_10692 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2016 Twitter. 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... |
the-stack_0_10694 | from django.db import models
from django.utils import timezone
# Create your models here.
class Feedback(models.Model):
data = models.DateTimeField(blank = True)
result = models.CharField(max_length = 3, null=True)
def store(self):
self.data = timezone.now()
self.save()
class Document(mo... |
the-stack_0_10696 | import argparse
import logging
import numpy as np
import os
import random
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import f1_score
import sys
from baselines.vectorizers import build_vectorizer_from_df, load_vectorized_data
from baselines.avg_fasttext import build_avg_fasttext_from_df, l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.