filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_106_21324 | import os.path
import sys
from libs.pascalVocIO import PascalVocWriter
from base64 import b64encode, b64decode
class LabelFileError(Exception):
pass
class LabelFile(object):
# It might be changed as window creates
suffix = '.lif'
def __init__(self, filename=None):
self.shapes = ()
s... |
the-stack_106_21325 | # Copyright 2017 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_106_21328 | # โโโ TASKS โโโ
# For Sharon:
# make sure all msgs you want are included (15 min intro for example)
# For Tami:
# make sure messages early in the day are sent in the morning (send one by one)
# send msgs with url as attachments with preview
international = {
# ''' DAY -5 ''' 5 dayื before the challenge
-5... |
the-stack_106_21330 | """
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_106_21331 | '''As an open source project, we collect usage statistics to inform development priorities.
For more information, check out the docs at https://docs.dagster.io/install/telemetry/'
To see the logs we send, inspect $DAGSTER_HOME/logs/ if $DAGSTER_HOME is set or ~/.dagster/logs/
See class TelemetryEntry for logged field... |
the-stack_106_21332 | from unittest import mock
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.translation import ugettext_lazy as _
from django_dynamic_fixture import get
from textclassifier.validators import ClassifierValidator
from readthedoc... |
the-stack_106_21333 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
the-stack_106_21334 | # Homework Assignment 06
# from Aishwarya Shirbhate 20005242
# Pseudocode #
# Define input_check function with check, answer, number of wins and history input
# In the function
# {
# Initialise variables maximum attempts and user inputs.
# Define symbol list which needs to be excluded from the user input.
# While max... |
the-stack_106_21335 | from typing import Dict, Any, NamedTuple, Type, Iterable, Tuple
from ..models import (
GraphTaskModel,
NodeMulticlassTask,
GraphRegressionTask,
GraphBinaryClassificationTask,
QM9RegressionTask,
)
from ..data import GraphDataset, JsonLGraphPropertyDataset, QM9Dataset, PPIDataset
class TaskInfo(Nam... |
the-stack_106_21336 | import os
from setuptools import find_packages, setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='ReVal',
version='v0... |
the-stack_106_21337 | import unittest
from healthvaultlib.tests import settings
from healthvaultlib.helpers.connection import Connection
from healthvaultlib.exceptions.healthserviceexception import HealthServiceException
from healthvaultlib.methods.newapplicationcreationinfo import NewApplicationCreationInfo
class TestNewApplicationCreati... |
the-stack_106_21338 | #!/usr/bin/env python
# pypreprocessor.py
__author__ = 'Evan Plaice'
__coauthor__ = 'Hendi O L, Epikem, num0005, tcumby'
__version__ = '0.7.9'
import sys
import os
import traceback
import imp
import io
class preprocessor:
def __init__(self, inFile=sys.argv[0], outFile='', defines=[], \
removeMeta=Fals... |
the-stack_106_21341 | # coding: utf-8
# http://www.matrix67.com/data/InvSqrt.pdf
import math
import struct
def change_format(ifmt, ofmt, a):
a = struct.pack(ifmt, a)
a = struct.unpack(ofmt, a)
return a[0]
def q_rsqrt(number):
threehalfs = 1.5
x2 = number * 0.5
y = number
i = change_format('f', 'l', y)
# ... |
the-stack_106_21343 | """Config flow for Ambiclimate."""
import logging
from aiohttp import web
import ambiclimate
from homeassistant import config_entries
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import CONF_CLIENT_ID, CONF_CLIENT_SECRET
from homeassistant.core import callback
from homeassistan... |
the-stack_106_21347 | from __future__ import annotations
import re
from io import BytesIO
from typing import Any, Dict, List, Optional, Tuple
import structlog
from attr import attrs
from devtools import debug
from flask_sqlalchemy import SQLAlchemy
from ldif import LDIFParser
from tqdm import tqdm
from labster.di import injector
from lab... |
the-stack_106_21349 | #!/usr/bin/env python
# XDSIndexerSum.py
# Copyright (C) 2013 Diamond Light Source, Graeme Winter & Richard Gildea
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
# 20th June 2013
#
# An reimplementation of the XDS indexer to work by first... |
the-stack_106_21351 | # -*- coding: utf-8 -*-
import numpy as np
import welltestpy as wtp
import seaborn as sns
import pandas as pd
from anaflow import thiem
from ogs5py import specialrange
from matplotlib import pyplot as plt
#from gstools import SRF, Gaussian
from project import get_srf, ogs_2d, priors
from scipy.optimize import curve_fi... |
the-stack_106_21357 | """
Work with references in the database
Schema:
- _id (str) the instance-unique reference ID
- cloned_from (Object) describes the reference this one was cloned from (can be null)
- id (str) the ID of the source reference
- name (str) the name of the source reference at the time of cloning
- created_at (datetime) ... |
the-stack_106_21360 | """
License: MIT <http://brianmhunt.mit-license.org/>
"""
import sys
#sys.path.append('/home/tobias/data/git/wodore-gae/main/')
#sys.path.append('./')
sys.path.append('./model')
import logging
import unittest
from google.appengine.ext import ndb#, testbed
from counter import CountableLazy
class TestCountLazyModel... |
the-stack_106_21362 | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
the-stack_106_21363 | # -*- coding: utf-8 -*-
# @copyright: MIT License
# Copyright (c) 2018 syntactic (Pastรจque Ho)
# 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 l... |
the-stack_106_21366 | #!/usr/bin/env python3
# vim: set fileencoding=utf-8 :
"""Functions that should be in scipy."""
import numpy as np
from scipy.sparse import issparse
def dot(a, b):
"""A dot product that also works on sparse matrices."""
if issparse(a):
return a.dot(b)
elif issparse(b):
return b.T.dot(a.T... |
the-stack_106_21367 | '''
Return the number of times that the string "hi"
appears anywhere in the given string.
'''
def count_hi(str):
count = 0
for i in range(len(str)-1):
if str[i] == "h" and str[i+1] == "i":
count += 1
return count
# count_hi('abc hi ho') โ 1
# count_hi('ABChi hi') โ 2
# count_hi('hihi'... |
the-stack_106_21368 | import logging
import zmq
import os
import json
from taboo.util import *
logger = logging.getLogger(__name__)
class TabooAttacker:
def __init__(self, host="127.0.0.1", port=10086, name="Attacker"):
self.name = name
self.context = zmq.Context()
self.connection = self.context.socket(zmq.R... |
the-stack_106_21369 | #!/usr/bin/env python
"""Simple tools to query github.com and gather repo information.
Taken from ipython
"""
# ----------------------------------------------------------------------------
# Imports
# ----------------------------------------------------------------------------
from packaging.version import parse
imp... |
the-stack_106_21370 | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -------------------------------------------------------------------------... |
the-stack_106_21371 | """NodeCHUP.
Usage:
nodechup install --base-directory-path=<base-directory-path> --version=<version> [--update-default-version]
Options:
-h --help Show this screen.
--base-directory-path=<base-directory-path> Path to base directory
--version=<version> ... |
the-stack_106_21374 | # -*- coding: utf-8 -*-
import app_automatico
import sys
from layout import *
from PyQt4 import *
from layout_2 import *
class resultadoValidacao(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_resultadoValidacao()
self.ui.setupUi(sel... |
the-stack_106_21375 | # Copyright 2019-2020 The Lux Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... |
the-stack_106_21376 | # import xml.etree.ElementTree as ET
from lxml import etree as ET
import Helper
inertiaKey = ['ixx', 'ixy', 'ixz', 'iyy', 'iyz', 'izz']
# add a material
def addMaterial(parent, name, rgba):
material = ET.SubElement(parent, 'material')
material.set('name', name)
color = ET.SubElement(material, 'color')
... |
the-stack_106_21379 | # This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from itertools import count
from flask import flash, jsonify, re... |
the-stack_106_21381 | #!/usr/bin/env python
################################################################################
# MIT License
#
# Copyright (c) 2021 Yoshifumi Asakura
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... |
the-stack_106_21383 | # -*- coding: utf-8 -*-
# Copyright 2014 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for the process_util.py module."""
from __future__ import print_function
import os
import signal
from chromite.lib... |
the-stack_106_21385 | from pathlib import Path
import os
import sys
import click
from ploomber.spec import DAGSpec
from ploomber import __version__
from ploomber import cli as cli_module
from ploomber import scaffold as _scaffold
from ploomber_scaffold import scaffold as scaffold_project
from ploomber.telemetry import telemetry
@click.g... |
the-stack_106_21386 | # Copyright 2013 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.
import json
import logging
import socket
import time
import traceback
from telemetry import decorators
from telemetry.internal.backends.chrome_inspector imp... |
the-stack_106_21387 | #!/usr/bin/env python
# coding: utf-8
# # [Memanggil Library Pandas](https://academy.dqlab.id/main/livecode/178/346/1682)
# In[1]:
import pandas as pd
import numpy as np
# # [DataFrame & Series](https://academy.dqlab.id/main/livecode/178/346/1683)
# In[2]:
import pandas as pd
# Series
number_list = pd.Series([... |
the-stack_106_21388 |
n=int(input('Enter the no of fibonacci series : '))
l1=[0,1]
a=0
b=1
for x in range(n-1):
c=a+b
a=b
b=c
l1.append(c)
print(l1)
|
the-stack_106_21392 | from __future__ import absolute_import
from collections import OrderedDict
from .layers import *
from .roi import *
def profiling(net, input=None):
# input is either a Blob with the shape of (batch,h,w,c) or a dict of them
layers=[]
if isinstance(input,dict):
blob_dict = OrderedDict(input)
... |
the-stack_106_21394 | # Copyright (c) 2020, NVIDIA CORPORATION. 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_106_21396 | from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
class PublishedManager(models.Manager):
def get_queryset(self):
return super(PublishedManager, self).get_queryset().filter(status='published')
class Customer(models.Model):
STATUS_CHOICES ... |
the-stack_106_21397 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 25 12:16:36 2020
@author: 11627
"""
from torch import nn
import torch
def initialize_weights(*models):
for model in models:
for module in model.modules():
if isinstance(module, nn.Conv2d) or isinstance(module, nn.Linear):
... |
the-stack_106_21402 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import torch
import torch.nn.functional as F
from ml.rl import types as rlt
from ml.rl.models.base import ModelBase
from ml.rl.models.fully_connected_network import FullyConnectedNetwork
class CategoricalDQN(ModelBase):
... |
the-stack_106_21403 | import sys
import os
sys.path.append(os.path.abspath("../"))
from unittest import TestCase
from komand_sentinelone.connection.connection import Connection
from komand_sentinelone.actions.apps_by_agent_ids import AppsByAgentIds
import json
import logging
class TestAppsByAgentIds(TestCase):
def test_integration_a... |
the-stack_106_21404 | import socket
class TcpServer():
def __init__(self):
pass
def start(self, port):
# initialzie main socket
main_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
main_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
main_addr = ("", port)
... |
the-stack_106_21407 | from typing import TYPE_CHECKING, Hashable, List, Tuple, Union
import numpy as np
from pandas._config.config import option_context
from pandas._libs.indexing import _NDFrameIndexerBase
from pandas._libs.lib import item_from_zerodim
from pandas.errors import AbstractMethodError, InvalidIndexError
from pandas.util._de... |
the-stack_106_21409 | """
Custom TFX component for Firebase upload.
Author: Chansung Park
"""
from tfx import types
from tfx.dsl.component.experimental.decorators import component
from tfx.dsl.component.experimental.annotations import Parameter
from tfx import v1 as tfx
from absl import logging
import firebase_admin
from firebase_admin im... |
the-stack_106_21410 | #!/usr/bin/env python3
# Copyright (c) 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.
"""Class for bitcoind node under test"""
import decimal
import errno
from enum import Enum
import http.client
... |
the-stack_106_21412 | import os
import logging
import unittest
from unittest import mock
from unittest.mock import patch
from unittest.mock import mock_open
from myredditdl.config_handler import ConfigHandler
from tests.mock_utils import get_new_client
from tests.mock_utils import get_dir_path
from tests.mock_utils import get_valid_options
... |
the-stack_106_21413 | import torch as t
import torch.nn as nn
import torch.nn.functional as F
#################################
# ## TOY NETWORK FOR 2D DATA ## #
#################################
class ToyNet(nn.Module):
def __init__(self, dim=2, n_f=32, leak=0.05):
super(ToyNet, self).__init__()
self.f = nn.Sequentia... |
the-stack_106_21417 | from __future__ import print_function, division
import os
import time
import pwd
import datetime
import collections
import pprint
import math
import array
import json
import copy
import argparse
import uuid
import pdb
import numpy as np
import ROOT
ROOT.PyConfig.IgnoreCommandLineOptions = True
ROOT.gROOT.SetBatch(True... |
the-stack_106_21420 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Yahoo! Finance market data downloader (+fix for Pandas Datareader)
# https://github.com/ranaroussi/yfinance
#
# Copyright 2017-2019 Ran Aroussi
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... |
the-stack_106_21423 | """
functions to be imported into the presidents Flask app
"""
import csv
def raiseError(e):
error_text = "<p>The error:<br>" + str(e) + "</p>"
hed = '<h1>Something is broken.</h1>'
return hed + error_text
def convert_to_dict(filename):
"""
Convert a CSV file to a list of Python dictionaries
... |
the-stack_106_21424 | import numpy as np
from pycompss.api.api import compss_wait_on
from pycompss.api.parameter import COLLECTION_IN, COLLECTION_OUT, \
Type, Depth
from pycompss.api.task import task
from scipy.sparse import issparse
from scipy.sparse import vstack as vstack_sparse
from sklearn.base import BaseEstimator
from sklearn.uti... |
the-stack_106_21425 | #!/usr/bin/env python3
# Copyright (c) 2014 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.
import logging
import os
import sys
def main(argv):
logging.basicConfig(level=logging.INFO)
if len(argv) == 0:
bootstrap... |
the-stack_106_21426 | # -*- coding: utf-8 -*-
# Copyright (2017-2018) Hewlett Packard Enterprise Development LP
#
# 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
#
# U... |
the-stack_106_21427 | import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import re
import xlrd
import csv
import tldextract
import traceback
def csv_file_to_indicator_list(file_path, col_num, starting_row, auto_detect, default_type, type_col, limit, offset):
indicator_list = []
# ... |
the-stack_106_21428 | from __future__ import annotations
import asyncio
import email.utils
import functools
import http
import inspect
import logging
import socket
import warnings
from types import TracebackType
from typing import (
Any,
Awaitable,
Callable,
Generator,
Iterable,
List,
Optional,... |
the-stack_106_21430 | class Solution:
def restoreString(self, s: str, indices: List[int]) -> str:
pair_list = []
output = ""
for x in range(0, len(s)):
pair_list.append([s[x], indices[x]])
for x in sorted(pair_list, key=lambda x: x[1]):
output += x[0]
... |
the-stack_106_21432 | """Common framework for loading yaml files."""
import yaml
import os
import os.path
from typing import Optional
from jinja2.sandbox import SandboxedEnvironment
class YamlFileObject:
"""Common class for a yaml file object."""
default_file_name = "default.yaml"
templated = True
@clas... |
the-stack_106_21433 | #!/usr/bin/env python
# coding: utf-8
#loading modules/libraries
import numpy
import matplotlib
import decimal
#loading .csv from GIS
numpy.loadtxt(fname= "simplecoast.csv", delimiter = ",")
#importing the csv that I created from a GIS shapefile trace & transforming into a re-useable variable
coastline = (numpy.loadtx... |
the-stack_106_21434 | import argparse
import os
import sys
from sem_seg.model import *
import sem_seg.indoor3d_util as indoor3d_util
parser = argparse.ArgumentParser()
parser.add_argument('--gpu', type=int, default=0, help='GPU to use [default: GPU 0]')
parser.add_argument('--batch_size', type=int, default=1, help='Batch Size during train... |
the-stack_106_21437 | from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth import logout, login, authenticate
from django.contrib.auth.forms import UserCreationForm
# Create your views here.
def logout_view(request):
"""Log the user out""... |
the-stack_106_21438 | """Imports unittest as a replacement for testing.pybase.googletest."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import inspect
import itertools
import os
import tempfile
# pylint: disable=wildcard-import
from unittest import *
unittest_main = main
... |
the-stack_106_21439 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# --------------------------------------------------------------------------
from .debug_options import DebugOptions, LogLevel
from . import (_utils,... |
the-stack_106_21441 | # 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... |
the-stack_106_21444 | import hashlib
import logging
import os
import shutil
from django.apps import apps
from django.db import models, transaction
from django.urls import reverse
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from may... |
the-stack_106_21446 | """ Main Window """
import cv2
import time
import os
import copy
import locale
import threading
import funscript_editor.utils.logging as logging
import shutil
import webbrowser
import platform
import numpy as np
from PyQt5 import QtGui, QtCore ,QtWidgets
from datetime import datetime
from funscript_editor.ui.funsc... |
the-stack_106_21447 | import fnmatch
import os
import argparse
import sys
import math
import svgwrite #conda install svgwrite
import random
import cairo
import cairosvg
import re
from datetime import date, datetime, timedelta
# WIDTH = 1500
# HEIGHT = 1000
# LEGENDWIDTH = 220
# MARGIN = 60
# LABELSHIFT = 15
# FONTSIZE = 26
class Clade:
d... |
the-stack_106_21449 | class Solution:
def threeSumClosest(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: int
"""
nums = sorted(nums)
res = 2**32-1
res_list = []
for i in range(len(nums)):
new_target = target-nums[i]
... |
the-stack_106_21451 | import cv2
import numpy as np
import pandas as pd
image = 'Assets\style-4.png'
face_cascade = cv2.CascadeClassifier("./Dataset/haarcascade_frontalface_alt.xml")
eyecascade = cv2.CascadeClassifier("./Dataset/frontalEyes35x16.xml")
nosecascade = cv2.CascadeClassifier("./Dataset/Nose18x15.xml")
glasses = cv2.imread('... |
the-stack_106_21452 | """
A controller implementing a (too) simple coordinated voltage control algorithm.
"""
import collections
import mosaik_api
from itertools import count
import fmipp
import xml.etree.ElementTree as ETree
import os.path
META = {
'models': {
'TC3Controller': {
'public': True,
'p... |
the-stack_106_21453 | #!/usr/bin/env python
DESCRIPTION = '''
order_columns - Takes an ORDERED list of column names (one per line) to return from input file.
Columns not in input list will not be in output.
First column name in input list will be the first column, seconds column name in input list will be th... |
the-stack_106_21454 | # -*- coding: utf-8 -*-
from typing import Union, List
from zvdata import IntervalLevel
from zvdata.api import get_entities, decode_entity_id, get_data
from zvdata.domain import get_db_session
from zvt.accounts.ccxt_account import CCXTAccount
from zvt.api.common import get_kdata_schema
from zvt.domain import StockCate... |
the-stack_106_21458 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
the-stack_106_21459 | from sortedcontainers import SortedDict
from .orderlist import OrderList
from .order import Order
class OrderTree(object):
'''A red-black tree used to store OrderLists in price order
The exchange will be using the OrderTree to hold bid and ask data (one OrderTree for each side).
Keeping the information in... |
the-stack_106_21462 | from data_utils import FEATURES, label_to_classs_name, collapse_clusters
import matplotlib.pyplot as plt
import numpy as np
import scipy
import seaborn as sns
import re
sns.set()
def to_feature_name(feature):
return re.sub(r'^calls_to_(.+)$', r'\1()', feature)
def plot_class_stats(call_data, labels, ordering, ax... |
the-stack_106_21463 | # Copyright 2019 Amazon.com, Inc. or its affiliates. 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... |
the-stack_106_21464 | # S/E/I/R : 4 bars in each group
# each group is one week; 3 weeks
# age cat 1 to 5; 5 categories vertically in each bar
# csv format input
# each row has three keys which together identify the row uniquely (age; week; SEIR)
# some hardcoded color maps
# This product includes color
# specifications and designs d... |
the-stack_106_21466 | # Copyright 2018 The Cirq Developers
#
# 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 ... |
the-stack_106_21468 | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
#
# 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, ... |
the-stack_106_21473 |
from PyQt5.QtWidgets import QWidget, QGridLayout, QLabel, QTreeView, QDialog, QLineEdit
from PyQt5.QtCore import QSortFilterProxyModel
from PyQt5.QtCore import pyqtSignal, Qt
from AlertsParameters.Categories.CategoryTreeItem import CategoryTreeItem
from TreeModel import TreeModel
from Alerts.Alert import Alert
class... |
the-stack_106_21474 | """Support for RFXtrx devices."""
import asyncio
import binascii
from collections import OrderedDict
import logging
import RFXtrx as rfxtrxmod
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.binary_sensor import DEVICE_CLASSES_SCHEMA
from homeassistant.const import (
... |
the-stack_106_21475 | def menu():
option = str(input("Choose a option, use the numbers\n1) Register a client\n2) See the client list\n3) Exit\n"))
while option != "1" and option != "2" and option != "3":
option = str(input("Choose a option, use ONLY this numbers\n1) Register a client\n2) See the client list\n3) Exit\n"))
... |
the-stack_106_21476 | #! /usr/bin/env python3
import pathlib
import typing
import sys
"""
List all of the machines available under the listed sub-layers of meta-arm.
"""
def list_machines(layers: typing.Sequence[str]) -> typing.Set[str]:
machines = set()
# We know we're in meta-arm/scripts, so find the top-level directory
met... |
the-stack_106_21477 | """
The file name should contain the representitive class/struct name.
If the file contains class/struct decls or defs, the file name should be
one of classes.
If the class/struct name starts with "C", "C" can be ommited in the file name.
== Vilolation ==
= a.h = <== Violation. It should contain class name 'Test... |
the-stack_106_21478 | """
predict trades for one specific day
"""
import functools
import logging
from datetime import datetime, timedelta
import pandas as pd
import tensorflow as tf
from absl import app
from absl import logging as absl_logging
from tf_agents.system import system_multiprocessing as multiprocessing
from config import setti... |
the-stack_106_21482 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.words.protocols.irc}.
"""
import time
from twisted.trial import unittest
from twisted.trial.unittest import TestCase
from twisted.words.protocols import irc
from twisted.words.protocols.irc import IRCClient
from twisted.i... |
the-stack_106_21483 | import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
"""ไธไธชๅฏน้ฃ่นๆๅค็ไฝ็ฝฎๅๅปบไธไธชๅญๅผนๅฏน่ฑก"""
def __init__(self, ai_settings, screen, ship):
"""ๅจ้ฃ่นๆๅค็ไฝ็ฝฎๅๅปบไธไธชๅญๅผนๅฏน่ฑก"""
super().__init__()
self.screen = screen
# ๅจ๏ผ0๏ผ0๏ผๅบๅๅปบไธไธช่กจ็คบๅญๅผน็็ฉๅฝข๏ผๅจ่ฎพ็ฝฎๆญฃ็กฎ็ไฝ็ฝฎ
self.rect = pygame.Rect(0, 0, ai_... |
the-stack_106_21484 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 6 21:51:31 2019
@author: Medeea
"""
#Simple Linear Regression
#Importing the libraries
#3 libraries
#mathematic tools
import numpy as np
#plot nice charts
import matplotlib.pyplot as plt
#import datasets
import pandas as pd
#importing... |
the-stack_106_21485 | import threading
from contextlib import contextmanager
import os
from os.path import abspath, join as pjoin
import shutil
from subprocess import check_call, check_output, STDOUT
import sys
from tempfile import mkdtemp
from . import compat
from .in_process import _in_proc_script_path
__all__ = [
'Back... |
the-stack_106_21486 | import os
import sys
import numpy as np
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import imagelib.filter as filt
import imagelib.utility as util
if __name__ == '__main__':
LOAD_IMG_PATH = '/home/uros/Desktop/workspace/grid.jpg'
MAIN_EDGES_PATH = '/home/uros/Desktop/workspac... |
the-stack_106_21487 | # Copyright (C) 2020 GreenWaves Technologies, SAS
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This progr... |
the-stack_106_21488 | from utils import *
class Smoothing():
def __init__(self):
pass
# add min max to the image
def scale(self,img):
studyArea = img.geometry().bounds()
maxs = img.reduceRegion(reducer=ee.Reducer.percentile([99.99]),geometry=studyArea,scale=300,maxPixels=1e13)
mins = img.reduceRegion(reducer=ee.Reducer.per... |
the-stack_106_21489 | # -*- coding: utf-8 -*-
"""The ants module provides basic functions for interfacing with ants functions.
"""
from __future__ import (print_function, division, unicode_literals,
absolute_import)
from builtins import range, str
import os
from ...external.due import BibTeX
from ...utils.filemanip ... |
the-stack_106_21490 | #!/usr/bin/python
"""
Train LogisticRegression on mnist (sample) as baseline
"""
import sys,os
sys.path.append(os.getcwd())
import argparse
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import LabelBinarizer
from sklearn.model_selection import train_test_split
from sklearn.metrics impor... |
the-stack_106_21491 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkcenterlinesmoothing.py,v $
## Language: Python
## Date: $Date: 2006/07/17 09:52:56 $
## Version: $Revision: 1.1 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENCE file for details.
## This software ... |
the-stack_106_21492 | # -*- coding: utf-8 -*-
"""Cross-platform tools for GitHub workflows.
To extract package version and run pip installations.
"""
import glob
import inspect
import os
import re
import sys
from typing import Optional
from typing import Pattern
from typing import Sequence
if re != sys: # need to protect the #nosec comme... |
the-stack_106_21493 | from enum import Enum
from typing import Union
class LanguageCode(Enum):
ENGLISH = 'en'
ENGLISH_US = 'en_US'
ENGLISH_UK = 'en_UK'
ITALIAN = 'it'
SPANISH = 'es'
SPANISH_SPAIN = 'es_ES'
SPANISH_LATIN_AMERICA = 'es_LA'
GERMAN = 'de'
FRENCH = 'fr'
DUTCH = 'nl'
CHINESE = 'zh'
... |
the-stack_106_21496 | from __future__ import annotations
__all__ = ["Board"]
from endplay.types.deal import Deal
from endplay.types.contract import Contract
from endplay.types.vul import Vul
from endplay.types.player import Player
from endplay.types.bid import Bid
from endplay.types.card import Card
from typing import Optional, Any
from c... |
the-stack_106_21498 | import sys
import tweepy
import numpy as np
from textblob import TextBlob
def tweet_analysis(query):
# get tweets
tweets = tweepy.Cursor(api.search, q = query + " -filter:retweets").items(20)
for tweet in tweets:
phrase = TextBlob(tweet.text)
polarities = []
subjectivities = []
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.