filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_11908 | #import math
import numpy as np
import scipy.optimize
from . import factor
from .material import char_mat_strength
__all__ = [
"pipe_ovality",
"pipe_char_elastic_pressure",
"pipe_char_plastic_pressure",
"char_collapse_pressure_num",
"char_collapse_pressure",
"pipe_collapse_unity",
"pipe_c... |
the-stack_0_11911 | from __future__ import division
import math
import torch
from torch.jit.annotations import List, Tuple
from torch import Tensor
import torchvision
# TODO: https://github.com/pytorch/pytorch/issues/26727
def zeros_like(tensor, dtype):
# type: (Tensor, int) -> Tensor
return torch.zeros_like(tensor, dtype=dtyp... |
the-stack_0_11914 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# author: Tang Zhuangkun
import time
import sys
sys.path.append("..")
import database.db_operator as db_operator
import log.custom_logger as custom_logger
class DataMinerCommonDBOperation:
# 通用,常用的(非基金或股票信息)数据库操作
def __init__(self):
pass
def get_th... |
the-stack_0_11915 | #%%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import phd.viz
import phd.thermo
import phd.stats
colors, palette = phd.viz.phd_style()
# %%
# Load the data sets and restrict to the carbon sources
data = pd.read_csv('../../data/ch4_growth/analyzed_foldchange.csv')
stats = p... |
the-stack_0_11916 | """Locale support module.
The module provides low-level access to the C lib's locale APIs and adds high
level number formatting APIs as well as a locale aliasing engine to complement
these.
The aliasing engine includes support for many commonly used locale names and
maps them to values suitable for passing to the C l... |
the-stack_0_11917 | """
Augmenter that apply operation (word level) to textual input based on contextual word embeddings.
"""
import string
import os
import re
import logging
from nlpaug.augmenter.word import WordAugmenter
import nlpaug.model.lang_models as nml
from nlpaug.util import Action, Doc
CONTEXT_WORD_EMBS_MODELS = {}
def... |
the-stack_0_11919 | #!/usr/bin/env python2
import rospy
from std_msgs.msg import Bool
from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport
from geometry_msgs.msg import TwistStamped
from twist_controller import Controller
'''
You can build this node only after you have built (or partially built) the `waypoint... |
the-stack_0_11922 | from tensorflow.keras.models import load_model
from tensorflow import get_logger
import logging
import pickle
import numpy as np
logger = get_logger()
logger.setLevel(logging.CRITICAL)
CATEGORIES = ['Abyssian', 'American_bulldog', 'American_pit_bull', 'Basset_hound', 'Beagle', 'Bengal', 'Birdman', 'Bombay', 'Boxer',... |
the-stack_0_11923 | import re
import requests
import subprocess
import time
from time import sleep
from log import log, log_add, now, RED, WHT, GRN, YEL
# Named Constants
# A local host that should always be up (ideally, the gateway router)
Local_Host = "192.168.1.1"
# An internet host that should always be up (Google DNS,for example)
... |
the-stack_0_11925 | # befor eimporting anything!
import sys
import os
sys.path.insert(1, os.path.realpath('/work/dev-box/blender-2.79-linux-glibc219-x86_64/2.79/python/lib/python3.5/site-packages/'))
from enum import Enum
class LogColor:
INFO = '\033[94m'
WARNING = '\033[93m'
ERROR = '\033[91m\033[1m'
ENDC = '\033[0m'
c... |
the-stack_0_11926 | # Authors: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
from .externals.six import string_types
import os
import copy
from math import ceil
import numpy as np
from scipy import ... |
the-stack_0_11927 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
TridentNet Training Script.
This script is a simplified version of the training script in detectron2/tools.
"""
import os
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.engine imp... |
the-stack_0_11931 | #!/usr/bin/env python3
import argparse
import configparser
import logging
import logging.handlers
import os.path
import subprocess
import sys
import threading
import time
import traceback
from collections import Counter, defaultdict
from io import StringIO
# Global variables
config = None
email_log = None
def tee_lo... |
the-stack_0_11935 | #
# Copyright 2017 Quantopian, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... |
the-stack_0_11936 | # Adapted from ZJULearning/resa
# Better to use a decoupled implementation,
# costs more codes, but clear.
# Diff from RESA official code:
# 1. we use BN+ReLU in channel reducer
# 2. we always use the BUSD decoder in the paper (official code does not use BUSD in CULane)
# 3. we always use 5 RESA iterations (4 in offici... |
the-stack_0_11937 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
the-stack_0_11939 | import requests
import re
import lxml.html
import MySQLdb
conn = MySQLdb.connect(db='Crawler', user='cloud', passwd='1111', charset='utf8mb4')
c=conn.cursor()
delete_sql = 'DELETE FROM re_info WHERE site_name = "인크루트"'
c.execute(delete_sql)
def crawling(page_count):
front_url="http://job.incruit.com/entry/searc... |
the-stack_0_11941 | # -*- coding: utf-8 -*-
#
# Copyright 2020-2021 BigML
#
# 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 ... |
the-stack_0_11942 | from datetime import datetime
from typing import Union
from dateutil import tz
def format_iso_string(iso_string: str) -> str:
utc_time = datetime.fromisoformat(iso_string)
local_time = utc_time.astimezone(tz.tzlocal())
return local_time.strftime("%Y-%m-%d %H:%M:%S")
def auto_unit(number: Union[int, flo... |
the-stack_0_11944 | # -*- 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 o... |
the-stack_0_11946 | from restfly.iterator import APIIterator
from box import BoxList
from copy import copy
class OTIterator(APIIterator):
_path = None
limit = 500
offset = 0
def __init__(self, api, **kwargs):
self._path = kwargs.pop('path')
self._payload = kwargs.pop('payload', {})
self.limit = k... |
the-stack_0_11948 | #
# Metrix++, Copyright 2009-2013, Metrix++ Project
# Link: http://metrixplusplus.sourceforge.net
#
# This file is a part of Metrix++ Tool.
#
# Metrix++ is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... |
the-stack_0_11949 | # -*- coding: utf-8 -*-
import datapackage
import os
# filenames
FD_DIR = "../data/2020-02-21_fd/"
RAW_DIR = "../data/2020-02-21/"
files = os.listdir(FD_DIR)
fd_files = [os.path.join(FD_DIR, f) for f in files]
raw_files = []
for file in files:
base = os.path.splitext(file)[0]
path = os.path.join(RAW_DIR, base... |
the-stack_0_11950 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# TopicDB documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 24 10:06:55 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# au... |
the-stack_0_11952 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserve.
#
# 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 appl... |
the-stack_0_11953 | import copy
import gym
import os
import sys
import random
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from gym import wrappers
from datetime import datetime
from scipy.misc import imresize
##### testing only
MAX_EXPERIENCES = 10000
MIN_EXPERIENCES = 1000
#MAX_EXPERIENCES = 500000
#... |
the-stack_0_11957 | # The actual simulation goes here
# This is the main application framework for the Race Simulation which contains the MainWindow,
# based on PyQt, and spawns a Qthread SimulationThread thread. Qt signals/slots are used to
# communicate in both directions between them to control (start/pause/stop) and report results
# ... |
the-stack_0_11958 | """
Plot a geodesic of SO(3) equipped
with its left-invariant canonical METRIC.
"""
import matplotlib.pyplot as plt
import numpy as np
import os
import geomstats.visualization as visualization
from geomstats.special_orthogonal_group import SpecialOrthogonalGroup
SO3_GROUP = SpecialOrthogonalGroup(n=3)
METRIC = SO3_... |
the-stack_0_11959 | from __future__ import division
import random
import pprint
import sys
import time
import numpy as np
import cv2
from optparse import OptionParser
import pickle
import os
import traceback
from keras import backend as K
from keras.optimizers import Adam, SGD, RMSprop
from keras.layers import Input
from keras.models imp... |
the-stack_0_11960 | # This file contains various useful constants for py3status
GENERAL_DEFAULTS = {
"color_bad": "#FF0000",
"color_degraded": "#FFFF00",
"color_good": "#00FF00",
"color_separator": "#333333",
"colors": False,
"interval": 5,
"output_format": "i3bar",
}
MAX_NESTING_LEVELS = 4
TIME_FORMAT = "%Y... |
the-stack_0_11963 | import os
import numpy as np
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'utils'))
import data_prep_util
import indoor3d_util
# Constants
data_dir = os.path.join(ROOT_DIR, 'data')
indoor3d_data_d... |
the-stack_0_11964 | import base64
import pytest
from h.models.auth_client import GrantType
class TestUpdateGroup:
def test_it_returns_http_200_with_valid_payload_and_user_token(
self, app, token_auth_header, first_party_group
):
group = {"name": "Rename My Group"}
res = app.patch_json(
"/api... |
the-stack_0_11966 | from typing import Optional
from typing import Union
import pytest
from _pytest.config import Config
from _pytest.config import ExitCode
from _pytest.config.argparsing import Parser
from _pytest.fixtures import FixtureDef
from _pytest.fixtures import SubRequest
def pytest_addoption(parser: Parser) -> None:
group... |
the-stack_0_11967 | """HTML slide show Exporter class"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#--------... |
the-stack_0_11970 | import os
from collections import OrderedDict
from itertools import chain
import torch
from torch import nn as nn
from models.alexnet import Id
from models.model_utils import ReverseLayerF
from torch.autograd import Variable
import numpy.random as npr
import numpy as np
import torch.nn.functional as F
import random
... |
the-stack_0_11972 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Chris Caron <lead2gold@gmail.com>
# All rights reserved.
#
# This code is licensed under the MIT License.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files(the "Software"), to deal
# in th... |
the-stack_0_11975 | """
Given two binary strings, return their sum (also a binary string).
The input strings are both non-empty and contains only characters 1 or 0.
Example 1:
Input: a = "11", b = "1"
Output: "100"
Example 2:
Input: a = "1010", b = "1011"
Output: "10101"
"""
# 2018-6-23
# Add Binary
class Solution:
def addBinary(s... |
the-stack_0_11977 | # Copyright (C) 2002, Thomas Hamelryck (thamelry@binf.ku.dk)
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""Map residues of t... |
the-stack_0_11980 | # Copyright 2019 The Dreamer Authors. Copyright 2020 Plan2Explore 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... |
the-stack_0_11981 | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import absolute_import, division, print_function, unicode_literals
import hashlib
import json
import os
from os.path import abspath, basename, dirname, isdir, isfile, islink, join
import re
import tarfile... |
the-stack_0_11983 | """
Created by: Rob Mulla
Sep 24
IEEE Fraud Detection Model
- FE013
- Yang's Features
- Raddars Features
"""
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
import os
import sys
import matplotlib.pylab as plt
from sklearn.model_selection import KFold
from ... |
the-stack_0_11985 | import torch
import torch.nn as nn
import torch.nn.functional as F
use_cuda = torch.cuda.is_available()
device = torch.device("cuda" if use_cuda else "cpu")
class AugmentedConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size, dk, dv, Nh, relative):
super(AugmentedConv, self).__init_... |
the-stack_0_11986 | # Copyright 2020 - 2021 MONAI Consortium
# 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 wri... |
the-stack_0_11989 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
the-stack_0_11992 | import copy
from django.conf import settings
from olympia.constants.promoted import RECOMMENDED
import olympia.core.logger
from olympia import amo
from olympia.amo.utils import attach_trans_dict
from olympia.amo.celery import create_chunked_tasks_signatures
from olympia.amo.utils import to_language
from olympia.const... |
the-stack_0_11995 | #Michael Astwood 2018 with help from https://apmonitor.com/wiki/index.php/Main/GekkoPythonOptimization
#This program is built to control light
#levels based on data taken during experiments.
from gekko import GEKKO
import numpy as np
import matplotlib.pyplot as plt
m = GEKKO()
m.time = np.linspace(0,20,41)
# Paramet... |
the-stack_0_11997 | from django.urls import include, path
from event import views
from rest_framework.routers import SimpleRouter
from rest_framework_nested import routers
router = SimpleRouter()
router.register(r"event", views.EventViewSet)
event_router = routers.NestedSimpleRouter(router, r"event", lookup="event")
event_router.regis... |
the-stack_0_11998 | #!/usr/bin/python2.7
"""Public interface to top-level pytype functions."""
from __future__ import print_function
import contextlib
import logging
import os
import sys
import tokenize
import traceback
from pytype import __version__
from pytype import analyze
from pytype import directors
from pytype import errors
from... |
the-stack_0_12002 | import sys
import warnings
if not sys.warnoptions:
warnings.simplefilter('ignore')
import numpy as np
from fuzzywuzzy import fuzz
import json
import tensorflow as tf
from collections import Counter
from ._utils._utils import load_graph, check_file
from .num2word import to_cardinal
from .texts._text_functions impo... |
the-stack_0_12004 | # -*- coding: utf-8 -*- #
# Copyright 2015 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 requir... |
the-stack_0_12006 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Matching functions'''
import numpy as np
import numba
from .exceptions import ParameterError
from .utils import valid_intervals
__all__ = ['match_intervals', 'match_events']
@numba.jit(nopython=True, cache=True)
def __jaccard(int_a, int_b): # pragma: no cover
'... |
the-stack_0_12008 | """
The multigrid module provides a framework for solving elliptic
problems. A multigrid object is just a list of grids, from the finest
mesh down (by factors of two) to a single interior zone (each grid has
the same number of guardcells).
The main multigrid class is setup to solve a constant-coefficient
Helmholtz eq... |
the-stack_0_12011 | #===============================================================================
# Copyright 2017-2019 Intel Corporation
# All Rights Reserved.
#
# If this software was obtained under the Intel Simplified Software License,
# the following terms apply:
#
# The source code, information and material ("Material") co... |
the-stack_0_12012 | """Tests for certbot_dns_joker.dns_joker."""
import unittest
try:
import mock
except ImportError: # pragma: no cover
from unittest import mock # type: ignore
from requests.exceptions import HTTPError
import urllib.parse
import requests
import requests_mock
from certbot.compat import os
from certbot.errors im... |
the-stack_0_12015 | from stix2 import MemoryStore, Filter
import json
from itertools import chain
def query_all(srcs, filters):
"""return the union of a query across multiple memorystores"""
return list(chain.from_iterable(
src.query(filters) for src in srcs
))
def get_related(srcs, src_type, rel_type, target_ty... |
the-stack_0_12017 | # resources/srx/addrbook_finder.py
import netaddr
#from .zone import Zone
#from .addrbook import ZoneAddrBook
class AddrBookFinderResults(object):
"""
Helper-class to hold the results of a :ZoneAddrFind.find(): invocation
"""
def __init__(self, ab, find, results):
self._ab = ab
self... |
the-stack_0_12018 | # dataset settings
dataset_type = "PascalContextDataset"
data_root = "data/VOCdevkit/VOC2010/"
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True
)
img_scale = (512, 512)
crop_size = (512, 512)
max_ratio = 8
train_pipeline = [
dict(type="LoadImageFromFile"),
dict(... |
the-stack_0_12019 | # encoding: utf8
from __future__ import unicode_literals
from django.db import models, migrations
import autoslug.fields
import cities_light.models
class Migration(migrations.Migration):
dependencies = [
('cities_light', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
the-stack_0_12022 | #############################################################
## ##
## Copyright (c) 2003-2017 by The University of Queensland ##
## Centre for Geoscience Computing ##
## http://earth.uq.edu.au/centre-geoscience-computing ##
## ... |
the-stack_0_12023 | from InquirerPy.utils import color_print
import sys, psutil, time, cursor, valclient, ctypes, traceback, os, subprocess
from .utilities.killable_thread import Thread
from .utilities.config.app_config import Config
from .utilities.config.modify_config import Config_Editor
from .utilities.processes import Processes
from... |
the-stack_0_12024 | # Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and ... |
the-stack_0_12025 | from backend.blockchain.block import Block
from backend.wallet.transactions import Transaction
from backend.wallet.wallet import Wallet
from backend.config import MINING_REWARD_INPUT
class Blockchain:
def __init__(self):
self.chain = [Block.genesis()]
def add_block(self, data):
... |
the-stack_0_12026 | # coding: utf8
# !/usr/bin/env python
import hunspell
import pandas as pd
from math import log
import matplotlib.pyplot as plt
import seaborn as sns
import codecs
import pickle
import re
import unicodedata
from ast import literal_eval
def getScriptPath():
return "/home/alexis/Documents/EPFL/MS3/Project/python"
def... |
the-stack_0_12027 | #!/usr/bin/env python3
#
# This file is part of GreatFET
from __future__ import print_function
import ast
import argparse
from greatfet.utils import GreatFETArgumentParser, log_silent, log_verbose
def int_auto_base(s):
"""
Allows the user to pass an integer argument on the command line e.g. in decimal, or ... |
the-stack_0_12028 | # Copyright 2019 Open Source Robotics Foundation, 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... |
the-stack_0_12030 | import torch
import torch.nn as nn
import torch.nn.functional as F
class ContrastiveLoss(nn.Module):
"""
Contrastive loss function.
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
"""
def __init__(self, margin: float = 2.0):
super(ContrastiveLoss, self).__init__... |
the-stack_0_12031 | # 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_12033 | # -*- coding: utf-8 -*-
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import defaultdict
from logging import DEBUG, getLogger
from ._vendor.auxlib.decorators import memoize
from ._vendor.to... |
the-stack_0_12034 | #!/usr/bin/env python3
# Copyright (c) 2014-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Base class for RPC testing."""
from enum import Enum
import logging
import optparse
import os
import p... |
the-stack_0_12036 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
def fft_wavenumbers(x, y, shape_dat, shape_pdat):
"""
Compute the wavenumbers.
Parameters
----------
x : 1D array
Coordinates along x direction.
y : 1D array
Coordinates along y directio... |
the-stack_0_12041 | from pid import PID
from lowpass import LowPassFilter
from yaw_controller import YawController
import rospy
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, vehicle_mass,
fuel_capacity,
brake_deadband,
decel... |
the-stack_0_12042 | import base64
import unittest
import zlib
from os.path import abspath, basename, dirname, join
from robot.utils.asserts import assert_equal, assert_true
from robot.utils.platform import PY2
from robot.result import Keyword, Message, TestCase, TestSuite
from robot.result.executionerrors import ExecutionErrors
from robo... |
the-stack_0_12043 | # Copyright (c) 2020 original 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 in wri... |
the-stack_0_12044 | """
Renderer Module
This module defines the PlotlyRenderer class and a single function,
fig_to_plotly, which is intended to be the main way that user's will interact
with the matplotlylib package.
"""
from __future__ import absolute_import
import six
import warnings
import plotly.graph_objs as go
from plotly.matplo... |
the-stack_0_12046 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
"""
gh_lists.py MILESTONE
Functions for Github API requests.
"""
from __future__ import print_function, division, absolute_import
import os
import re
import sys
import json
import collections
import argparse
from urllib2 import urlopen
Issue = collections.namedtuple('... |
the-stack_0_12049 | import os
import numpy as np
import music21
import math
# Parameter n_pitch: Pitch-Range reicht von 0 bis 127
MAX_PITCH = 128
# Parameter d_[duration]_[dots]:
SIGN_DUR = "d"
# Parameter v_[velocity]: Lautstärke der folgenden Noten, reicht von 4, 8, 12, ... bis 128 (in 4er-Schritten)
SIGN_VELO = "v"
MIN_VELO = 0
MAX... |
the-stack_0_12051 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
the-stack_0_12053 | #@+leo-ver=5-thin
#@+node:tbrown.20091029123555.5319: * @file ../plugins/attrib_edit.py
#@+<< docstring >>
#@+node:tbrown.20091009210724.10972: ** << docstring >>
r""" Edits user attributes in a Qt frame.
This plugin creates a frame for editing attributes similar to::
Name: Fred Blogs
Home: 555-555-5555
... |
the-stack_0_12057 | """
This file offers the methods to automatically retrieve the graph Listeria monocytogenes Scott.
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--p... |
the-stack_0_12060 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Compute (upsampled) Nifti label image from bundle and centroid.
Each voxel will have the label of its nearest centroid point.
"""
import argparse
import logging
import nibabel as nib
import numpy as np
from scilpy.io.streamlines import load_tractogram_with_reference... |
the-stack_0_12061 | """
Import as:
import im.airflow.devops.dags.im_infra as imaddimin
"""
import os
import airflow
from airflow import DAG
from airflow.operators.bash import BashOperator
P1_AIRFLOW_WORKER_DB_LOADER_QUEUE = os.environ[
"P1_AIRFLOW_WORKER_DB_LOADER_QUEUE"
]
STAGE = os.environ["STAGE"]
SEND_EMAIL = STAGE not in ["LO... |
the-stack_0_12067 | from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
from tensorflow.contrib.layers.python import layers as tf_layers
from rsa import *
from cka import *
import matplotlib.pyplot as plt
# heiner activation maximization filters early layers
# based on https://github.com/zonghua94/mnist/... |
the-stack_0_12069 | # -*- coding: utf-8 -*-
# Copyright 2022 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_12072 | from typing import List
from matplotlib import pyplot as plt
import numpy as np
from scipy import stats
from scipy.optimize import curve_fit
def nice_string_output(
names: List[str], values: List[str], extra_spacing: int = 0,
):
max_values = len(max(values, key=len))
max_names = len(max(names, key=len))
... |
the-stack_0_12073 | # -*- coding: utf-8 -*-
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
# -- General configuration ------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extens... |
the-stack_0_12074 | # coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2016-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... |
the-stack_0_12076 | # Copyright 2014-present MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
the-stack_0_12078 | from flask import url_for
def test_ping(client):
resp = client.get(url_for('main.ping'))
assert resp.status_code == 200
resp = resp.json
assert resp == {
'addition': {'msg': "it's alive!"},
'description': {},
'result': True,
'status': 200,
}
|
the-stack_0_12079 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ardour2fxp.py
#
"""Convert one or more Ardour VST presets XML file to VST2 FXP preset files."""
import argparse
import os
import sys
from base64 import b64decode
from collections import namedtuple
from os.path import exists, isdir, join
from struct import calcsize, pa... |
the-stack_0_12081 | try:
import _thread
except ModuleNotFoundError:
_thread = None
class Producer:
"""
Uses a list instead of a set to ensure correct ordering of subscriptions.
Does not allow lambda functions to be used.
:params name: name of producer
:params validation: a function which will accept argument... |
the-stack_0_12082 | # From https://github.com/taki0112/ResNet-Tensorflow.
import tensorflow as tf
import tensorflow.contrib as tf_contrib
weight_init = tf_contrib.layers.variance_scaling_initializer()
weight_regularizer = tf_contrib.layers.l2_regularizer(0.0001)
def conv(x, channels, kernel=4, stride=2, padding='SAME', use_bias=True, ... |
the-stack_0_12083 | import copy
import numpy
import logging
from six.moves import xrange
import theano
from theano import tensor, scalar, gof
from theano.compile import optdb
from theano.compile.ops import shape_i
from theano.gof import (local_optimizer, EquilibriumDB,
SequenceDB, Optimizer, toolbox)
from theano.g... |
the-stack_0_12086 | import requests
from lxml import html
url = 'https://info.urfu.ru/ru/departures/kafedry/'
# Получение исходного кода страницы
response = requests.get(url)
# Преобразование тела документа в дерево элементов
parsed_body = html.fromstring(response.text)
# Получение всех элементов класса 'course-box'
course_boxes = par... |
the-stack_0_12088 | #!/usr/bin/env python
import os
import requests
import json
import datetime
import shutil
from bs4 import BeautifulSoup
here = os.path.dirname(os.path.abspath(__file__))
hospital_id = os.path.basename(here)
url ='https://www.huntsvillehospital.org/price-transparency'
today = datetime.datetime.today().strftime('%Y-%... |
the-stack_0_12089 | """Integration tests for :mod:`esmvalcore._recipe_checks`."""
from typing import Any, List
from unittest import mock
import pytest
import esmvalcore._recipe_checks as check
ERR_ALL = 'Looked for files matching%s'
ERR_D = ('Looked for files in %s, but did not find any file pattern to match '
'against')
ERR_F... |
the-stack_0_12090 | # 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_12091 | """main module
"""
import argparse
import importlib.util
import os
import shutil
import tempfile
import threading
import uuid
import docker
import yaml
from . import preprocess
def __import_configurator(path):
conf_path = os.path.join(path, "configurator.py")
spec = importlib.util.spec_from_file_location("c... |
the-stack_0_12093 | # Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
# Matti Hamalainen <msh@nmr.mgh.harvard.edu>
# Denis Engemann <denis.engemann@gmail.com>
# Teon Brooks <teon.brooks@gmail.com>
#
# License: BSD (3-clause)
from copy import deepcopy
from itertools import count
from math i... |
the-stack_0_12094 | from django.shortcuts import render, get_object_or_404, render_to_response
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
from .models import Report, UploadedFile, Folder
from .forms import ReportForm, FolderForm
from django.template import RequestContext
from web.models ... |
the-stack_0_12097 | import urllib3
import json
from api.src.postgre import Postgres
class DataCrawler:
def getData(self):
jsonOndeFoiRoubado = self.getJsonFromOndeFoiRoubado()
jsonOndeTemTiro = self.getJsonFromOnteTemTiro()
postgre = Postgres()
postgre.open()
postgre.insertOndeFoiRoubado(jsonOndeFoiRoubado)
po... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.