filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_2988 | """Summary
"""
from PyQt5.QtWidgets import QGraphicsRectItem
from . import slicestyles as styles
from .sliceextras import PreXoverItemGroup, WEDGE_RECT
_RADIUS = styles.SLICE_HELIX_RADIUS
class PreXoverManager(QGraphicsRectItem):
"""Summary
Attributes:
active_group (TYPE): Description
active... |
the-stack_0_2989 | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
# file: main.py
from .sequiturpython.grammar import Grammar, Symbol
from .sequiturpython.symbol import RuleIndex, RULE_INDEX_STR
# Few constants for presentation logics
#RULE_INDEX_STR = "^%s"
SEQUENCE_KEY = "S"
ARROW = "→"
NEWLINE_REPLACEMENT = "↵"
SPACE_REPLACEMENT = ... |
the-stack_0_2992 | #!/usr/bin/env python
"""
Perform cleanup actions
"""
import time
import random
import threading
from Utils.Timers import timeFunction
from WMCore.WorkerThreads.BaseWorkerThread import BaseWorkerThread
from WMCore.Services.ReqMgr.ReqMgr import ReqMgr
from WMCore.DAOFactory import DAOFactory
class WorkQueueManagerCle... |
the-stack_0_2993 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import copy
import logging
import os
import subprocess
import threading
import time
from .constants import PIPE, STDOUT, DEVNULL
from .exceptions import TimeoutExpired
logger = logging.getLogger(__name__)
class Popen:
'''
... |
the-stack_0_2995 | # Copyright 2021 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
the-stack_0_2996 | # -*- coding: utf-8 -*-
# Copyright (c) The python-semanticversion project
# This code is distributed under the two-clause BSD License.
from __future__ import unicode_literals
import functools
import re
from .compat import base_cmp
def _to_int(value):
try:
return int(value), True
except ValueError... |
the-stack_0_2998 | """Fully connected layer."""
import numpy as np
import theano
import theano.tensor as T
from athenet.layers import WeightedLayer
class FullyConnectedLayer(WeightedLayer):
"""Fully connected layer."""
def __init__(self, n_out, n_in=None, input_layer_name=None, name='fc'):
"""Create fully connected l... |
the-stack_0_2999 | #!/usr/bin/env python3
"""
TODO
USAGE:
yb_create_log_query_history.py [options]
PURPOSE:
Build/update long term history db table/views sourced from the sys.log_query view.
OPTIONS:
See the command line help message for all options.
(yb_create_log_query_history.py --help)
Output:
Action... |
the-stack_0_3000 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
"""RAMSES RF - a RAMSES-II protocol decoder & analyser."""
import logging
from inspect import getmembers, isclass
from sys import modules
from typing import List
from .const import Discover, __dev_mode__
from .protocol import I_, RP, RQ, W_ # noqa: F401, isort: skip
... |
the-stack_0_3003 | #!/usr/bin/env python
#
# 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 writing, software
# ... |
the-stack_0_3004 | from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def open_contacts_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("index.php") and len(wd.find_elements_by_link_text("Last name")) > 0
and len(wd.find... |
the-stack_0_3007 | #-*-coding:utf-8-*-
import torch.utils.data
from data.base_data_loader import BaseDataLoader
def CreateDataset(opt):
dataset = None
if opt.dataset_mode == 'aligned':
from data.aligned_dataset import AlignedDataset
dataset = AlignedDataset()
elif opt.dataset_mode == 'single':
from da... |
the-stack_0_3008 | import math
import os
import random
import time
import albumentations as A
import cv2
import numpy as np
import pandas as pd
import tifffile
import torch
from torch.utils.data import Dataset
# VV mean: -15.830463789539426
# VV std: 6.510123043441801
# VH mean: -24.66130160959856
# VH std: 6.684547156770566
def n... |
the-stack_0_3009 | # -*- coding: utf-8 -*-
# Copyright(C) 2017 Phyks (Lucas Verney)
#
# This file is part of a woob module.
#
# This woob module 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 th... |
the-stack_0_3012 | from nose.tools import eq_, ok_
import wtforms
from flask import Flask
from flask_superadmin import Admin
from flask_superadmin.model import base
import flask_wtf as wtf
class Model(object):
def __init__(self, id=None, c1=1, c2=2, c3=3):
self.id = id
self.col1 = c1
self.col2 = c2
... |
the-stack_0_3015 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple, extendable nlp engine that can extract data based on provided conditions.
"""
__version__ = "0.0.7"
import os
import os.path
import sys
import re
import collections
from .model import *
from .normalizer import *
# -------------
# Stemmer
# -------------
class... |
the-stack_0_3017 | # Copyright 2015 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_3019 | """
Sets the config parameters for the flask app object.
These are accessible in a dictionary, with each line defining a key.
"""
import os
from tempfile import TemporaryDirectory
import torch
_TEMP_FOLDER_OBJECT = TemporaryDirectory()
DEFAULT_USER_ID = 1
ROOT_FOLDER = os.path.dirname(os.path.realpath(__file__))
DA... |
the-stack_0_3020 | from __future__ import absolute_import
from django.core.urlresolvers import reverse
from exam import fixture
from sentry.models import Organization
from sentry.testutils import APITestCase
class OrganizationsListTest(APITestCase):
@fixture
def path(self):
return reverse('sentry-api-0-organizations')... |
the-stack_0_3023 | from flask import Flask, render_template, g
from flask_socketio import SocketIO, emit
from flask_cors import CORS
from models import Database
import settings
app = Flask(__name__, template_folder="./templates",
static_folder="./assets/", static_url_path="")
with app.app_context():
DB = Database()
app.... |
the-stack_0_3025 | """user
Revision ID: ba4c10cd1c2e
Revises:
Create Date: 2021-02-14 17:14:42.063643
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ba4c10cd1c2e'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by ... |
the-stack_0_3027 | #!/usr/bin/env python3.7
# Copyright: Ismael Narvaez Berenjeno
import asyncio
import json
from typing import Union, List
from nats.aio.client import Client as NatsClient
from async_nats_connection.data_model.async_nats_params import AsyncNatsParams
from async_nats_connection.util.time import get_time_isoformat
class ... |
the-stack_0_3029 | import copy
import json
import furl
from waterbutler.core import streams
from waterbutler.core import provider
from waterbutler.core import exceptions
from waterbutler.providers.github import settings
from waterbutler.providers.github.path import GitHubPath
from waterbutler.providers.github.metadata import GitHubRev... |
the-stack_0_3030 | # Copyright 2022 The Matrix.org Foundation C.I.C.
#
# 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_3031 | import sys
import matplotlib.pyplot as plt
import numpy as np
# define a function reading the data from file
# File format: arbitrary number of pairs of lines
# 1st line: <key> = <float value> pairs, comma separated
# 2nd line: comma separated float values
# Here special keys: 'a','b','T'
def readdat(fname):
param... |
the-stack_0_3032 | """
*******
GraphML
*******
Read and write graphs in GraphML format.
This implementation does not support mixed graphs (directed and unidirected
edges together), hyperedges, nested graphs, or ports.
"GraphML is a comprehensive and easy-to-use file format for graphs. It
consists of a language core to describe the st... |
the-stack_0_3033 | import uvicorn
import os
from diskcache import Cache
from fastapi import FastAPI, File, UploadFile
from starlette.middleware.cors import CORSMiddleware
from starlette.responses import FileResponse
from starlette.requests import Request
from src.helpers.milvus_helpers import MilvusHelper
from src.helpers.mysql_helpers i... |
the-stack_0_3034 | #!/usr/bin/env python3
"""
How to Run
-s keepItSimple -a 1 -a 2 -c -A -B
"""
__author__ = "Your Name"
__version__ = "0.1.0"
__license__ = "MIT"
import argparse
from logzero import logger
def main(args):
""" Main entry point of the app """
# logger.info("hello world")
# logger.info(args)
print( 'simple_value ... |
the-stack_0_3035 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2019.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... |
the-stack_0_3036 | import torch
import torch.nn as nn
from torch.nn.utils.rnn import pad_sequence
from .kmeans import MultiKMeans
from .kmeans import KMeans
from .kernels import PQDecodeCUDA
from .PQ import PQ
from .CustomModule import CustomModule
class MPQ(CustomModule):
def __init__(
self,
d_vector,
n_subvectors=8,
... |
the-stack_0_3037 | import torch
import unittest
from super_gradients.training.datasets.data_augmentation import RandomErase
class RandomEraseTest(unittest.TestCase):
def test_random_erase(self):
dummy_input = torch.randn(1, 3, 32, 32)
one_erase = RandomErase(probability=0, value='1.')
self.assertEqual(one_er... |
the-stack_0_3039 | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Create a geodesic polygon.
polygon = ee.Geometry.Polygon([
[[-5, 40], [65, 40], [65, 60], [-5, 60], [-5, 60]]
])
# Compute a buffer of the polygon.
buffer = polygon.buffer(0.1)
# Compute the centroid of t... |
the-stack_0_3041 | """Benchmark from Laurent Vaucher.
Source: https://github.com/slowfrog/hexiom : hexiom2.py, level36.txt
(Main function tweaked by Armin Rigo.)
"""
from __future__ import division, print_function
import time
from io import StringIO
import cython
##################################
class Dir(object):
def __init_... |
the-stack_0_3042 | # Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd.
# 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/LI... |
the-stack_0_3045 | # -*- coding: utf-8 -*-
import cv2
import os
import numpy as np
import sys
print("python version : {version}".format(version=sys.version))
'''
요구 사항
1. Image Load & Search in directory
- 현재 폴더 출력 : done
- 현재 폴더의 이미지 출력 (확장자는 확장성 있게) : done
- 현재 폴더의 이미지 개수 출력 : done
- 현재 폴더의 이미지에서 숫자를 입력하면, 해당 파일이 open되도... |
the-stack_0_3046 | # Copyright 1999-2018 Alibaba Group Holding 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 a... |
the-stack_0_3047 | #!/usr/bin/env python3
# coding:utf-8
"""
__title__ = ''
__author__ = 'David Ao'
__mtime__ = '2018/6/26'
#
"""
import json
import os
import pandas as pd
import numpy as np
from tensorflow.contrib import learn
from sklearn.metrics import classification_report, f1_score
from tools.utility import Utility
from works.tes... |
the-stack_0_3048 |
#!/usr/bin/env python3
import time
import os
import sqlite3
from sqlite3 import Connection
from typing import List
V100_DB_PATH = "../SQLiteDBs/A4v100.db"
V1K_DB_PATH = "../SQLiteDBs/A4v1k.db"
V10K_DB_PATH = "../SQLiteDBs/A4v10k.db"
V100K_DB_PATH = "../SQLiteDBs/A4v100k.db"
V1M_DB_PATH = "../SQLiteDBs/A4v1M.db"
# Q... |
the-stack_0_3049 | #!/bin/python2.7
# -*- coding: utf-8 -*-
"""
Lucas Ou-Yang 2014 -- http://codelucas.com
"""
import sys
import os
import codecs
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
packages = [
'newspaper',
]
if sys.argv[-1] == 'publish':
os.system('python3 setup.... |
the-stack_0_3051 | try:
# Try to use setuptools so as to enable support of the special
# "Microsoft Visual C++ Compiler for Python 2.7" (http://aka.ms/vcpython27)
# for building under Windows.
# Note setuptools >= 6.0 is required for this.
from setuptools import setup, Extension
except ImportError:
from distutils.... |
the-stack_0_3053 | """Base class to manage comms"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import sys
from traitlets.config import LoggingConfigurable
from IPython.core.prompts import LazyEvaluate
from IPython.core.getipython import get_ipython
from ipython_genutils.import... |
the-stack_0_3054 | # Copyright (C) 2012-2016 Ben Kurtovic <ben.kurtovic@gmail.com>
# Copyright (C) 2019-2020 Yuri Astrakhan <YuriAstrakhan@gmail.com>
#
# 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 re... |
the-stack_0_3057 | # Copyright 2018 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_3059 | import logging
import sh
from cached_property import cached_property
from kubeyard.base_command import CommandException
from kubeyard.commands.devel import BaseDevelCommand
logger = logging.getLogger(__name__)
class ShellCommand(BaseDevelCommand):
"""
Command allows you to exec into container.
"""
... |
the-stack_0_3063 | '''
Gramex {__version__} Copyright (c) 2017 by Gramener
Start the Gramex server on port 9988 at the current directory.
If no gramex.yaml exists, show the guide (https://learn.gramener.com/guide/)
Options
--listen.port=9090 Starts Gramex at port 9090
--browser Open the browser after ... |
the-stack_0_3064 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Niccolò Bonacchi
# @Date: 2018-02-02 12:31:13
import logging
import numpy as np
from pybpodapi.protocol import Bpod, StateMachine
import task_settings
import user_settings
from iblrig.bpod_helper import BpodMessageCreator
from session_params impor... |
the-stack_0_3066 | # qubit number=4
# total number=35
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... |
the-stack_0_3068 | import os
import sys
import mxnet as mx
import logging
def patch_path(path):
return os.path.join(os.path.dirname(__file__), path)
def main():
sys.path.append(patch_path('..'))
logging.basicConfig(level=logging.DEBUG)
data_dir_path = patch_path('data/flowers')
output_dir_path = patch_path('mode... |
the-stack_0_3071 | import sys
import tkinter as tk
import myNotebook as nb
from config import config
import utils
import overlay
this = sys.modules[__name__]
def plugin_start3(plugin_dir):
return plugin_start()
def plugin_start():
"""
Load EliteHIS plugin
"""
#Initialize target coordinates and planet radius
thi... |
the-stack_0_3072 | from unittest.mock import Mock, patch
from django.test import TestCase
from data_refinery_common import utils
from data_refinery_common.models import Pipeline
class UtilsTestCase(TestCase):
@patch('data_refinery_common.utils.requests.get')
def test_get_instance_id_cloud(self, mock_get):
"""Test that ... |
the-stack_0_3074 | # -*- coding: utf-8 -*-
"""Global configuration objects.
This module contains boilerplate configuration objects for storing and loading
configuration state.
"""
from __future__ import division
import os
import numpy as np
import pytoml as toml
import six
class BaseConfig(object):
"""Base class for configurat... |
the-stack_0_3077 | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import ... |
the-stack_0_3080 | # Copyright 2019 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 or agreed to in wr... |
the-stack_0_3083 | from bs4 import BeautifulSoup
import requests, TTS, time, sys
from TTS import *
# test game url hawks v bucks https://www.espn.com/nba/playbyplay/_/gameId/401337344
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'}
def get... |
the-stack_0_3089 | """Tests for the Wemo light entity via the bridge."""
import pytest
import pywemo
from homeassistant.components.homeassistant import (
DOMAIN as HA_DOMAIN,
SERVICE_UPDATE_ENTITY,
)
from homeassistant.components.wemo.light import MIN_TIME_BETWEEN_SCANS
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, ... |
the-stack_0_3093 | # 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_3096 | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2019, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... |
the-stack_0_3097 | # MetaPrint.py
# Copyright (c) 2008-2017 Chris Gonnerman
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# Redistributions of source code must retain the above copyright
# notice, this list... |
the-stack_0_3100 | import datetime
from base64 import b64decode, b64encode
from collections import deque
from decimal import Decimal
from enum import Enum
from functools import singledispatch, wraps
from inspect import isfunction
from json import JSONDecoder, JSONEncoder
from modulefinder import Module
from types import FunctionType, Met... |
the-stack_0_3101 | import CLARK_Automator
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-f", "--force", action="store_true",
help="Don't ask to update redmine api key")
args = parser.parse_args()
automator = CLARK_Automator.Automate(args.f... |
the-stack_0_3102 | import chances
from ..utils.exceptions import TalosDataError
def sample_reducer(self, length, max_value):
'''Sample Reducer (Helper)
NOTE: The Scan() object is in self.main_self because
the object being passed here is ParamGrid() object where
the Scan() object is attached as self.main_self.
... |
the-stack_0_3105 | def get_prs_chan_count(family_name=""):
"""
Returns the number of available PRS channels for the given family
:param family_name: string representation of the family name
:return: integer representing the number of available PRS channels
"""
return 12
def get_prs_ch... |
the-stack_0_3106 | # Zulip's main markdown implementation. See docs/subsystems/markdown.md for
# detailed documentation on our markdown syntax.
import functools
import html
import logging
import os
import re
import time
import urllib
import urllib.parse
from collections import defaultdict, deque
from dataclasses import dataclass
from da... |
the-stack_0_3107 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import math
import networkx as nx
from collections import defaultdict
from typing import Any, Dict
def _modularity_component(
intra_community_degree: float,
total_community_degree: float,
network_degree_sum: float,
resolution: f... |
the-stack_0_3108 | import os
import logging
from datetime import datetime
from discord import (
Intents,
Activity,
ActivityType
)
from discord.ext import commands
from discord.ext.commands import (
ExtensionNotFound,
ExtensionAlreadyLoaded,
NoEntryPointError,
ExtensionFailed,
ExtensionNotLoaded
)
from... |
the-stack_0_3109 | """
Example use of the pyjsgf parse_grammar_string function.
The parse_grammar_file, parse_rule_string and parse_expansion_string functions
are also available and work in a similar way.
"""
from jsgf import parse_grammar_string
# Parse a grammar string with parse_grammar_string and get a Grammar object back.
grammar... |
the-stack_0_3110 | # coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... |
the-stack_0_3112 | import log
from machine import I2C
'''
I2C使用示例
'''
# 设置日志输出级别
log.basicConfig(level=log.INFO)
i2c_log = log.getLogger("I2C")
I2C_SLAVE_ADDR = 0x1B # i2c 设备地址
WHO_AM_I= bytearray({0x02, 0}) # i2c 寄存器地址,以buff的方式传入,取第一个值,计算一个值的长度
data = bytearray({0x12, 0}) # 输入对应指令
i2c_obj = I2C(I2C.I2C0, I2C.STANDARD_MODE) ... |
the-stack_0_3114 | ## Cash Machine ##
# Objective: the cash machine will give you the value desired in dollar banknotes
# Input: value you want to withdraw from the cash machine
# Output: banknotes from the cash machine
# 1) Input
# 1.1) Definition of the currency and banknotes
bank_notes = [100, 50, 20, 10, 5, 2, 1]
# 1.2) ... |
the-stack_0_3115 | #
# Copyright (C) Foundry 2020
#
import base64
import binascii
import hashlib
import hmac
import json
import time
import requests
from collections import OrderedDict
from datetime import datetime, timedelta
from typing import Callable, Dict, List, Tuple, Optional
class flix:
"""Flix will handle the login and ex... |
the-stack_0_3116 | from mindsdb.api.mongo.classes import Responder
import mindsdb.api.mongo.functions as helpers
class Responce(Responder):
when = {'ismaster': helpers.is_true}
result = {
"ismaster": True,
"minWireVersion": 0,
"maxWireVersion": 9,
"ok": 1
}
responder = Responce()
|
the-stack_0_3117 | # coding: utf-8
from __future__ import unicode_literals
import base64
import hashlib
import json
import random
import re
from .common import InfoExtractor
from ..compat import (
compat_HTTPError,
compat_str,
)
from ..utils import (
ExtractorError,
float_or_none,
int_or_none,
orderedSet,
st... |
the-stack_0_3118 | # %%
from cProfile import label
import imp
from turtle import shape
import numpy as np
import pandas as pd
import tensorflow.keras as keras
from matplotlib import pyplot as plt, units
pd.options.display.max_rows = 10
pd.options.display.float_format = "{:.1f}".format
# %% Load datasets from Internet
train_df: pd.Data... |
the-stack_0_3119 | import glob
import os
from torch.utils.data import Dataset, DataLoader
from natsort import natsorted
import numpy as np
import cv2
import torch
import re
from src.utils.io import path_leaf, load_image
fileExtensions = ["jpg", "jpeg", "png", "tiff"]
class ImagesDataset(Dataset):
"""
Ce dataset renvoie une im... |
the-stack_0_3120 | """Model-Agnostic Meta-Learning (MAML) algorithm implementation for RL."""
# yapf: disable
import collections
import copy
from dowel import tabular
import numpy as np
import torch
from garage import (_Default, EpisodeBatch, log_multitask_performance,
make_optimizer)
from garage.np import discount_... |
the-stack_0_3122 | import sendgrid
import json
import os
sg = sendgrid.SendGridAPIClient(apikey=os.environ.get('SENDGRID_API_KEY'))
##################################################
# Retrieve email statistics by client type. #
# GET /clients/stats #
params = {'aggregated_by': 'day',
'start_date': '2016-01-01',
'... |
the-stack_0_3124 | import copy
import pytest
from multidict._compat import USE_CYTHON
from multidict._multidict_py import CIMultiDict as PyCIMultiDict
from multidict._multidict_py import CIMultiDictProxy as PyCIMultiDictProxy
from multidict._multidict_py import MultiDict as PyMultiDict # noqa: E402
from multidict._multidict_py import ... |
the-stack_0_3125 | #!/usr/bin/env python3
################################################################################
# lev2 sample which renders an instanced model, optionally in VR mode
# Copyright 1996-2020, Michael T. Mayers.
# Distributed under the Boost Software License - Version 1.0 - August 17, 2003
# see http://www.boost.or... |
the-stack_0_3126 | import unittest
import warnings
import tempfile
from tests.core import TestCore
from tests.core import ASSET_DIR
from pyrep.objects.object import Object
from pyrep.objects.shape import Shape
from pyrep.objects.dummy import Dummy
from pyrep.objects.joint import Joint
from pyrep.objects.proximity_sensor import ProximityS... |
the-stack_0_3128 | # Copyright (c) 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... |
the-stack_0_3129 | # See also the methods already implemented we have in cm for ssh management
# I think you reimplemented things that already exists.
# see and inspect cloudmesh.common
import os
from os.path import expanduser
# see content of path_expand it does expanduser as far as I know
from cloudmesh.common.util import path_expand
... |
the-stack_0_3130 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.j... |
the-stack_0_3131 | # Author: Steven J. Bethard <steven.bethard@gmail.com>.
"""Command-line parsing library. Implements argparse for Python 2.6 and below.
This module is an optparse-inspired command-line parsing library that:
- handles both optional and positional arguments
- produces highly informative usage messages
- sup... |
the-stack_0_3132 | # Copyright (c) 2010-2012 OpenStack Foundation
#
# 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_3135 | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import json
import logging
import os
import sys
from abc import ABCMeta
from importlib import import_module
from django.utils.module_loading import module_has_submodule
from six import with_metaclass
... |
the-stack_0_3137 | import learner
import recognizer
import dbconn
print("Sign up enter 1")
print("Sign in enter 2\n")
print("Select action from above two.")
print("Press 'q' for exit from camera view.\n")
action = raw_input('Select action : ')
email = raw_input('Enter email : ')
try:
if int(action) == 1:
name = raw_input('En... |
the-stack_0_3138 | """
Virtual environment (venv) package for Python. Based on PEP 405.
Copyright (C) 2011-2014 Vinay Sajip.
Licensed to the PSF under a contributor agreement.
"""
import logging
import os
import shutil
import subprocess
import sys
import sysconfig
import types
logger = logging.getLogger(__name__)
class EnvBuilder:
... |
the-stack_0_3140 | import pandas as pd
def to_reise(data):
"""Format data for REISE.
:param pandas.DataFrame data: data frame as returned by
:func:`prereise.gather.solardata.nsrdb.naive.retrieve_data`,
:func:`prereise.gather.solardata.nsrdb.sam.retrieve_data` or
:func:`prereise.gather.solardata.ga_wind.... |
the-stack_0_3141 | """
Support for Alexa skill service end point.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/alexa/
"""
import asyncio
import copy
import enum
import logging
import uuid
from datetime import datetime
import voluptuous as vol
from homeassistant.core i... |
the-stack_0_3147 | from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from matplotlib import cm
import numpy as np
from scipy import linalg
import matplotlib.pyplot as plt
import time
# Variance
def var(f_model):
n = np.size(f_model)
f_model_mean = np.sum(f_model)/n... |
the-stack_0_3148 | import spacy
from spacy.tokenizer import Tokenizer
from spacy.lang.char_classes import ALPHA, ALPHA_LOWER, ALPHA_UPPER
from spacy.lang.char_classes import CONCAT_QUOTES, LIST_ELLIPSES, LIST_ICONS
from spacy.language import Language
from spacy.pipe_analysis import Doc
from spacy.util import compile_infix_regex
from gens... |
the-stack_0_3150 | #
# General Electricity sector Decarbonization Model (GEDM)
# Copyright (C) 2020 Cheng-Ta Chu.
# Licensed under the MIT License (see LICENSE file).
#
# Module note:
# Define commodity, time slice and transmission classes
#
#------------ commodity -------------
class Commodity:
""" Commodity class """
def __... |
the-stack_0_3151 | # 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_3153 | '''
Examples of using binary_threshold mask
Modification History:
'''
## import packages
import numpy as np
import matplotlib.pyplot as plt
import gzip
import pickle
from pyechoplot.plotting import plot_Sv, plot_mask, save_png_plot
## import pyechomask modules
from pyechomask.masks import binary_pulse, binary_thre... |
the-stack_0_3154 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from os import environ
from _internal_utils import exec_bash, pf, lines
from fabric.api import cd, settings, sudo
if not environ.get("PY2"):
environ["PY2"] = "2.7.15"
if not environ.get("PY3"):
environ["PY3"] = "3.6.8"
@exec_bash
def depend_redhat():
"""
... |
the-stack_0_3155 | import noise
import numpy as np
from PIL import Image
import math
import io
import json
from scipy.misc import toimage
shape = (1024, 1024)
scale = 150
octaves = 4
persistence = 0.5
lacunarity = 2.0
threshold = 0.05
seed = np.random.randint(0, 500)
black = [0, 0, 0]
blue = [65,105,225]
green = [34,1... |
the-stack_0_3156 | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
#
# Astropy documentation build configuration file.
#
# 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 file.
#
# All configurati... |
the-stack_0_3158 | """This program unit tests the command-line processing capabilities of the
drake_cc_googletest bazel macro, by running
`bazel-bin/drake/common/drake_cc_googletest_main_test`
with a variety of command-line flags.
"""
import re
import subprocess
import os
import sys
import unittest
class TestGtestMain(unittest.TestCas... |
the-stack_0_3160 | # coding: utf-8
from __future__ import unicode_literals
from six import PY2
class BoxException(Exception):
"""
Base class exception for all errors raised from the SDK.
"""
def __str__(self):
# pylint:disable=no-member
# <https://github.com/box/box-python-sdk/issues/117>
return... |
the-stack_0_3161 | import os
import time
import cv2
import imageio
from tensorboardX import SummaryWriter
from NeRF import *
from load_llff import load_llff_data
from run_nerf_helpers import *
from metrics import compute_img_metric
# np.random.seed(0)
DEBUG = False
def config_parser():
import configargparse
parser = configar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.