filename stringlengths 13 19 | text stringlengths 134 1.04M |
|---|---|
the-stack_0_484 |
#%% load the background
from __future__ import print_function, division
import torch
from torchvision import datasets, transforms
import os
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
import pandas as pd
import numpy as np
import torch.nn as nn
#%% define the datasets
list_datasets = ['/home/cw9/... |
the-stack_0_486 | """
Limits
======
Implemented according to the PhD thesis
http://www.cybertester.com/data/gruntz.pdf, which contains very thorough
descriptions of the algorithm including many examples. We summarize here
the gist of it.
All functions are sorted according to how rapidly varying they are at
infinity using the followin... |
the-stack_0_488 | from unicodedata import name
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Ingredient,Recipe
from recipe.serializers import IngredientSerializer
INGRED... |
the-stack_0_490 |
import random
from tqdm import tqdm
import glob
import numpy as np
import torch
from sparse_ct.reconstructor_2d.n2self import (
N2SelfReconstructor)
from sparse_ct.reconstructor_2d.dataset import (
DeepLesionDataset, EllipsesDataset)
if __name__ == "__main__":
params= {'batch_si... |
the-stack_0_493 | """
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... |
the-stack_0_496 | """
Ethereum Virtual Machine (EVM) Interpreter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. contents:: Table of Contents
:backlinks: none
:local:
Introduction
------------
A straightforward interpreter that executes EVM code.
"""
from dataclasses import dataclass
from typing import Iterable, Set, Tuple, Uni... |
the-stack_0_497 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="simplevae", # Replace with your own username
version="1.0.0",
author="Chenxi Wu, Yizi Zhang",
author_email="chenxi.wu@duke.edu, yizi.zhang@duke.edu",
description="Final project of STA 663:... |
the-stack_0_499 | from lstm import BilstmAttention
from config import LSTMConfig
import torch
import pandas as pd
import numpy as np
from tqdm import tqdm
import os
import directory
def load_model(weight_path):
print(weight_path)
model = BilstmAttention(embed_num=859)
model.load_state_dict(torch.load(weight_pa... |
the-stack_0_500 | # Copyright 2016 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 agree... |
the-stack_0_501 | import csv
import random
from functools import partial
from typing import Callable, Optional
from pdb import set_trace as st
import os
import random
import pandas as pd
from typing import Any, Callable, Dict, Iterable, List, Tuple, Union
import numpy as np
import tensorflow as tf
from foolbox.attacks import (
FGSM... |
the-stack_0_504 | # -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
import json
import urllib.parse
import aiohttp
from aiohttp import web
from foglamp.common import utils
from foglamp.common import logger
from foglamp.common.service_record import ServiceRecord
from foglamp.common.storage_cli... |
the-stack_0_506 | # dataset settings
ann_type = 'bast_eval' # * change accordingly
num_classes = 9 if ann_type == 'bast_base' else 42
# model settings
model = dict(
type='Recognizer3D',
backbone=dict(
type='ResNet3dSlowOnly',
depth=50,
pretrained=None,
in_channels=17,
base_channels=32,
... |
the-stack_0_508 | import numpy as np
import pandas as pd
from napari.qt.threading import thread_worker
from skimage.measure import regionprops_table
from imlib.pandas.misc import initialise_df
from imlib.general.list import unique_elements_lists
from brainreg_segment.atlas.utils import lateralise_atlas_image
@thread_worker
def reg... |
the-stack_0_509 | import psycopg2
class Conn:
def __init__(self, connstr):
self.conn = psycopg2.connect(connstr)
self.setversion()
self.nexttmp = 0
def setversion(self):
cur = self.conn.cursor()
cur.execute("select version()")
verstr = cur.fetchone()
if "Greenplum Dat... |
the-stack_0_512 | from typing import Optional
import logging
import boto3
from botocore.exceptions import ClientError
from kermes_infra.models import User
class UserAdapter:
def __init__(self, endpoint_url: str, table_name: str, logger: logging.Logger) -> None:
self.dynamodb = boto3.resource("dynamodb", endpoint_url=endpo... |
the-stack_0_513 | # 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 ... |
the-stack_0_514 | ##
## File: utils.py
##
## Author: Schuyler Martin <sam8050@rit.edu>
##
## Description: Python file that contains basic utility functions
##
from utils.macros import *
import sys
#### GLOBALS ####
#### FUNCTIONS ####
def printd(msg):
'''
Prints debugging messages if debugging is enabled
:param: ... |
the-stack_0_517 | import argparse
import sys
import time
from typing import Optional, Union
from moonstreamdb.db import yield_db_session_ctx
from moonstreamdb.models import ESDEventSignature, ESDFunctionSignature
from sqlalchemy.orm import Session
import requests
CRAWL_URLS = {
"functions": "https://www.4byte.directory/api/v1/sign... |
the-stack_0_518 | import mock
import pytest
from os.path import abspath, dirname, join
import sys
from praw.models import (Button, ButtonWidget, Calendar, CommunityList,
CustomWidget, Menu, MenuLink, IDCard, Image,
ImageData, ImageWidget, ModeratorsWidget,
PostF... |
the-stack_0_519 | #!/usr/bin/env python
#
# Script inspired in bud:
# https://github.com/indutny/bud
#
import platform
import os
import subprocess
import sys
CC = os.environ.get('CC', 'cc')
script_dir = os.path.dirname(__file__)
root = os.path.normpath(os.path.join(script_dir, '..'))
output_dir = os.path.join(os.path.abspath(root),... |
the-stack_0_520 | '''
Created on 2020-08-11
@author: wf
'''
import unittest
import time
from lodstorage.sparql import SPARQL
from lodstorage.lod import LOD
from ptp.location import CountryManager, ProvinceManager, CityManager
import datetime
from collections import Counter
import getpass
class TestLocations(unittest.TestCase):
'''... |
the-stack_0_523 | from argparse import ArgumentParser
from ._version import __version__
def build_args_parser(
prog: str,
description: str = '',
epilog: str = ''
) -> ArgumentParser:
parser = ArgumentParser(
prog = prog,
description = description,
epilog = epilog
)
# Build Parser
p... |
the-stack_0_524 | from Instrucciones.Declaracion import Declaracion
from Instrucciones.Sql_create.Tipo_Constraint import Tipo_Constraint, Tipo_Dato_Constraint
from Instrucciones.TablaSimbolos.Tipo import Tipo
from Instrucciones.TablaSimbolos.Instruccion import Instruccion
from Instrucciones.TablaSimbolos.Tabla import Tabla
from Instrucc... |
the-stack_0_525 | import logging
import sys
from requests import HTTPError
from .readwritelock import ReadWriteLock
from .interfaces import CachePolicy
log = logging.getLogger(sys.modules[__name__].__name__)
class ManualPollingCachePolicy(CachePolicy):
def __init__(self, config_fetcher, config_cache):
self._config_fetche... |
the-stack_0_527 | from .util import Configurable, Openable, pretty_str
@pretty_str
class Hook(Configurable, Openable):
"""
Base of all hook classes, performs any form of processing on messages from all connected
plugs, via the provided host instance.
Instantiation may raise :class:`.ConfigError` if the provided config... |
the-stack_0_528 | import enum
import platform
import typing
import math
from functools import lru_cache
from publicsuffix2 import get_sld, get_tld
import urwid
import urwid.util
from mitmproxy import flow
from mitmproxy.http import HTTPFlow
from mitmproxy.utils import human, emoji
from mitmproxy.tcp import TCPFlow
from mitmproxy impor... |
the-stack_0_529 | """
anime.py contains the base classes required for other anime classes.
"""
import os
import logging
import copy
import importlib
from anime_downloader.sites.exceptions import AnimeDLError, NotFoundError
from anime_downloader import util
from anime_downloader.config import Config
from anime_downloader.extractors impo... |
the-stack_0_532 | # -*- coding: utf-8 -*-
"""
Fuel inventory library (UOX)
Script to run computations. It will produce a set of folders and outputfiles
and a csv file storing linking the output file paths to the BU, CT, IE values.
zsolt elter 2019
"""
import numpy as np
import os
import math
#import pandas as pd
#from PDfunctions impo... |
the-stack_0_534 | from tensorflow.keras import layers, models, datasets, optimizers
import numpy as np
def neural_network_spatial():
input_ = layers.Input(shape=(32,32,3))
cnn = layers.Conv2D(16, (3,3), activation="relu") (input_)
cnn = layers.SpatialDropout2D(0.2) (cnn)
cnn = layers.MaxPooling2D() (cnn)
cnn = ... |
the-stack_0_535 | import coloredlogs
import logging
import os
logging.basicConfig(
filename="plex_doctor.log",
level=logging.DEBUG,
format='%(levelname)s: "%(asctime)s - %(message)s',
)
log = logging.getLogger("PLEX-DOCTOR")
log.setLevel(logging.DEBUG)
LOGLEVEL = os.environ.get("LOGLEVEL", "INFO").upper()
stream_handler =... |
the-stack_0_537 | from arm.logicnode.arm_nodes import *
class OnContactArrayNode(ArmLogicTreeNode):
"""Activates the output when the given rigid body make contact with other given rigid bodies."""
bl_idname = 'LNOnContactArrayNode'
bl_label = 'On Contact Array'
arm_section = 'contact'
arm_version = 1
property0:... |
the-stack_0_538 | #!/usr/bin/env python
from load import ROOT as R
from gna.unittest import *
from gna.env import env
import gna.constructors as C
import numpy as N
from gna import context
import gna.bindings.arrayview
@floatcopy(globals(), True)
def test_vararray_preallocated_v01(function_name):
ns = env.globalns(function_name)
... |
the-stack_0_541 | ##############################################################################
#
# Copyright (c) 2019 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... |
the-stack_0_543 |
IGNORED = None
ACTION_PENDING = 1
# Bigger than necessary
_MAX_VK_KEY = 0x200
_VK_KEY_MASK = 0x1ff
_CURRENT_KEY_STATE = [False] * _MAX_VK_KEY
_MODIFIERS = set()
def on_key_hook(vk_code, is_down, special_modifier_state = None):
"""
Module-wide storage for the current key state.
:param vk_code:
:para... |
the-stack_0_547 | from data.cifar import Cifar
from utility.step_lr import StepLR
from utility.initialize import initialize
from utility.log import Log
from utility.lognolr import LogNoLR
from model import *
import time
from model.preact_resnet import *
from model.smooth_cross_entropy import smooth_crossentropy
from model.wideresnet imp... |
the-stack_0_550 | # https://www.kaggle.com/c/amazon-employee-access-challenge/forums/t/4838/python-code-to-achieve-0-90-auc-with-logistic-regression
__author__ = 'Miroslaw Horbal'
__email__ = 'miroslaw@gmail.com'
__date__ = '14-06-2013'
import json
import pymongo as pymongo
from numpy import array
from sklearn import metrics, linear_... |
the-stack_0_551 | import json
import logging
from datetime import date, datetime
from gzip import GzipFile
from io import BytesIO
from typing import Any, Optional, Union
import requests
from dateutil.tz import tzutc
from posthog.utils import remove_trailing_slash
from posthog.version import VERSION
_session = requests.sessions.Sessio... |
the-stack_0_555 | from threading import Thread
import pyrealtime as prt
class SubprocessLayer(prt.TransformMixin, prt.ThreadLayer):
def __init__(self, port_in, cmd, *args, encoder=None, decoder=None, **kwargs):
super().__init__(port_in, *args, **kwargs)
self.cmd = cmd
self.proc = None
self.read_thr... |
the-stack_0_557 | """
Code originally developed for pyEcholab
(https://github.com/CI-CMG/pyEcholab)
by Rick Towler <rick.towler@noaa.gov> at NOAA AFSC.
The code has been modified to handle split-beam data and
channel-transducer structure from different EK80 setups.
"""
import logging
import re
import struct
import sys
import xml.etree... |
the-stack_0_558 | import os
import tkinter as tk
from tkinter import ttk
from tkinter import filedialog
from tkinter import PhotoImage
from tkinter import messagebox
import pafy
import youtube_dl
# if you get api limit exceeded error, get an api key and paste
# here as a string value
# pafy.set_api_key(key)
# sample video url
# https... |
the-stack_0_561 | #!/usr/bin/python
# -*- coding: utf8 -*-
import os
import logging
import sys
import argparse
sys.path.append("../core")
from qgis_project_substitute import substitute_project
from processor import Processor
def argparser_prepare():
class PrettyFormatter(argparse.ArgumentDefaultsHelpFormatter,
argparse... |
the-stack_0_562 | import numpy as np
from src.util import Util, Article
class Answer:
"""Answer questions based on the initialized article."""
def __init__(self, article):
"""
Create a new instance of the Answer class.
Args:
article: An instance of the Article class
"""
se... |
the-stack_0_563 | from math import ceil
from hashlib import md5
from pecan import expose, request, abort, response, redirect
from pecan.secure import secure
from pecan.ext.wtforms import with_form
from sqlalchemy import select, and_, or_, asc, desc, func, case, literal
from draughtcraft import model
from draughtcraft.lib.beerxml impor... |
the-stack_0_566 | from .probe import Probe
from .utils import most_frequent, process_dict_list, merge_dicts
"""
Analyses a group of clips.
"""
class Analysis:
def __init__(self, clips=[]):
self.clips = clips
def summary(self):
file_summary = []
for clip in self.clips:
summary = Probe(clip).r... |
the-stack_0_569 | import re
from os.path import *
import cv2
import numpy as np
import torch.nn.functional as F
from PIL import Image
cv2.setNumThreads(0)
cv2.ocl.setUseOpenCL(False)
TAG_CHAR = np.array([202021.25], np.float32)
def read_flow_middlebury(fn):
"""
Read .flo file in Middlebury format
Parameters
-------... |
the-stack_0_570 | """Norwegian-specific Form helpers."""
from __future__ import unicode_literals
import datetime
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import CharField, Field, RegexField, Select
from django.utils.translation import ugettext_lazy as ... |
the-stack_0_571 | from __future__ import division, print_function
import numpy as np
from librmm_cffi import librmm as rmm
import cudf._lib as libcudf
from cudf.core import Series
from cudf.core.column import column
def test_gather_single_col():
col = column.as_column(np.arange(100), dtype=np.int32)
gather_map = np.array([0... |
the-stack_0_574 | from .Function_Module import Function_Module
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
import selenium
from geopy.geocoders import Nominatim
import time
import os
import pathlib
class get_gps_location(Function_... |
the-stack_0_575 | # -*- coding: utf-8 -*-
# =============================================================================
# Copyright (c) 2012, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
# Written by Joel Bernier <bernier2@llnl.gov> and others.
# LLNL-CODE-529294.
# All rights re... |
the-stack_0_576 | #!/usr/bin/env python3
import pathlib
import fileinput
from ci.util import (
check_env,
existing_file,
)
repo_dir = check_env('REPO_DIR')
effective_version = check_env('EFFECTIVE_VERSION')
template_file = existing_file(pathlib.Path(repo_dir, 'concourse', 'resources', 'defaults.mako'))
lines_replaced = 0
st... |
the-stack_0_578 | # Copyright 2019 Huawei Technologies 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/LICENSE-2.0
#
# Unl... |
the-stack_0_580 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
from django.conf import settings
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODE... |
the-stack_0_582 | """ Setup remote debugger with Python Tools for Visual Studio (PTVSD)
"""
import os
from .celery_log_setup import get_task_logger
REMOTE_DEBUG_PORT = 3000
log = get_task_logger(__name__)
def setup_remote_debugging(force_enabled: bool = False, *, boot_mode=None) -> None:
""" Programaticaly enables remote debug... |
the-stack_0_583 | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from slack_g_cal.parse import JSON, Datetime
class WitDatetimeContainer(JSON):
""" Container wrapping datetime values from the Wit API """
def __init__(self, **dt_json):
self.is_interval = dt_json['type'] == 'interval'
# Get r... |
the-stack_0_584 | # -*- coding: utf-8 -*-
"""IPython Test Suite Runner.
This module provides a main entry point to a user script to test IPython
itself from the command line. There are two ways of running this script:
1. With the syntax `iptest all`. This runs our entire test suite by
calling this script (with different arguments)... |
the-stack_0_586 | import os
from io import StringIO
from django.contrib.gis.geos import Point
from django.test import TestCase
from uk_geo_utils.models import Onspd
from uk_geo_utils.management.commands.import_onspd import Command
class OnsudImportTest(TestCase):
def test_import_onspd(self):
# check table is empty before ... |
the-stack_0_587 | #!/usr/bin/env python
# Copyright 2019 Xilinx 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 ... |
the-stack_0_588 | #!/usr/bin/env python
"""
models for the mailroom program.
This is where the program logic is.
This version has been made Object Oriented.
"""
# handy utility to make pretty printing easier
from textwrap import dedent
from pathlib import Path
import json_save.json_save_dec as js
import json
from . import data_dir
... |
the-stack_0_589 | from toga import Key
from toga_cocoa.libs import (
NSEventModifierFlagCapsLock,
NSEventModifierFlagShift,
NSEventModifierFlagControl,
NSEventModifierFlagOption,
NSEventModifierFlagCommand,
)
######################################################################
# Utilities to convert Cocoa constan... |
the-stack_0_590 | # 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 agreed to in... |
the-stack_0_593 | # Copyright 2014 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 ... |
the-stack_0_594 | # Copyright (C) 2010 Google Inc. All rights reserved.
# Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Szeged
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of so... |
the-stack_0_596 | from students import views as students_views
from django.urls import path
from django.contrib.auth import views as auth_views
urlpatterns = [
path('login/', auth_views.LoginView.as_view(template_name='students/student/login.html'), name = 'login'),
path('logout/', auth_views.LogoutView.as_view(template_name='s... |
the-stack_0_597 | import os
import unittest
from pathlib import Path
import paramak
import pytest
class test_object_properties(unittest.TestCase):
def test_shape_default_properties(self):
"""Creates a Shape object and checks that the points attribute has
a default of None."""
test_shape = paramak.Shape()
... |
the-stack_0_599 | """This file is part of Splitter which is released under MIT License.
agg.py defines aggregation functions
"""
from splitter.dataflow.validation import check_metrics_and_filters, countable
from splitter.struct import IteratorVideoStream
from splitter.dataflow.xform import Null
import logging
import time
import itert... |
the-stack_0_601 | import os
import sys
import subprocess
import tempfile
from time import sleep
from os.path import exists, join, abspath
from shutil import rmtree, copytree
from tempfile import mkdtemp
import six
from twisted.trial import unittest
from twisted.internet import defer
import scrapy
from scrapy.utils.python import to_nat... |
the-stack_0_603 | # -*- coding: utf-8 -*-
# Copyright (C) 2006 Joe Wreschnig
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Read and write MPEG-4 audio files with iTunes metadata.
This module ... |
the-stack_0_605 | # python3.7
"""Collects all available models together."""
from .model_zoo import MODEL_ZOO
from .pggan_generator import PGGANGenerator
from .pggan_discriminator import PGGANDiscriminator
from .stylegan_generator import StyleGANGenerator
from .stylegan_discriminator import StyleGANDiscriminator
from .stylegan2_generato... |
the-stack_0_609 | # This file is part of the Blockchain Data Trading Simulator
# https://gitlab.com/MatthiasLohr/bdtsim
#
# Copyright 2021 Matthias Lohr <mail@mlohr.com>
#
# 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... |
the-stack_0_612 | import torch
import torch.nn as nn
class ACM(nn.Module):
# def __init__(self, in_channels, num_heads=32, orthogonal_loss=True):
def __init__(self, in_channels, num_heads=8, orthogonal_loss=True):
super(ACM, self).__init__()
assert in_channels % num_heads == 0
self.in_channels = in_ch... |
the-stack_0_613 | import subprocess
import time
import os
localtime = time.asctime( time.localtime(time.time()))
data = subprocess.check_output(['netsh','wlan','show','profiles']).decode('utf-8').split('\n')
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
file = open("result.txt", "a")
print("\n[+] Wifi Grab... |
the-stack_0_614 | ###########################################################################
# Created by: Hang Zhang
# Email: zhang.hang@rutgers.edu
# Copyright (c) 2017
###########################################################################
import os, sys
BASE_DIR = os.path.dirname(os.path.dirname(os.getcwd()))
sys.path.append(B... |
the-stack_0_616 | # -*- coding: utf-8 -*-
'''
Namecheap domains management
.. versionadded:: 2017.7.0
General Notes
-------------
Use this module to manage domains through the namecheap
api. The Namecheap settings will be set in grains.
Installation Prerequisites
--------------------------
- This module uses the following ... |
the-stack_0_617 | import pytest
import gevent
import logging
import time
from volttron.platform import get_services_core
from master_driver.interfaces.modbus_tk.server import Server
from master_driver.interfaces.modbus_tk.maps import Map, Catalog
logger = logging.getLogger(__name__)
# modbus_tk driver config
DRIVER_CONFIG_STRING = ""... |
the-stack_0_619 | #!/usr/bin/env python
"""
_Harvest_
"""
from future.utils import viewitems
import threading
import logging
from WMCore.JobSplitting.JobFactory import JobFactory
from WMCore.Services.UUIDLib import makeUUID
from WMCore.DAOFactory import DAOFactory
from WMCore.JobSplitting.LumiBased import isGoodRun, isGoodLumi
from W... |
the-stack_0_622 | from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
setup(
name='Workbench',
version='0.1.1',
description='Timesaver for psd2html (markup)',
long_description=readme,
author='Bohdan Khorolets',
author_email='b@khorolets.com',
url='https://github.c... |
the-stack_0_624 | import urllib3.request
import json
import datetime as dt
from urllib3 import exceptions as urlex
from Game.periodictasks.search_alarms import AlarmSearch
import pandas as pn
import numpy as np
DATE_FORMAT = '%Y-%m-%d'
def str_to_date(strdate):
"""
parses given string to date using global date format
:par... |
the-stack_0_625 | """
Sphinx is hardcoded to interpret links to downloadable files relative to the root of the docs
source tree. However, the downloadable files we want to use (tarballs of our examples directories)
are themselves generated at build time, and we would therefore like them to be separate from the
source. This module is a S... |
the-stack_0_626 | # Analytics Collector
def truncate(n, decimals=0):
multiplier = 10 ** decimals
return int(n * multiplier) / multiplier
def startCam():
import cv2
from gaze_tracking import GazeTracking
import time
gaze = GazeTracking()
webcam = cv2.VideoCapture(0)
startTime = time.time()
totalFram... |
the-stack_0_628 | #!/usr/bin/env python3
from tpp.tppflush import *
import sys
from math import fabs
try:
import pygame
except ImportError:
exit("Pygame required. Exiting.")
try:
from lib.controller import *
except ImportError:
joystick_name="??"
j_axis=[ ]
#buttons.py adds the following:
#joystick_name="Microsoft X-Box 360 pa... |
the-stack_0_631 | from imbox import Imbox
import html2text
import requests
import json
import time
with open('config.json') as config_file:
data = json.load(config_file)
API_KEY = data['API_KEY']
OAUTH_TOKEN = data['OAUTH_TOKEN']
trello_list_id = data['trello_list_id']
# SSL Context docs https://docs.python.org/3/library/ssl.html... |
the-stack_0_634 | import pylab
class Animal:
def __init__(self, name, egg_laying, scales, poisonous, cold_blood, legs, reptile):
self.name = name
self.egg_laying = egg_laying
self.scales = scales
self.poisonous = poisonous
self.legs = legs
self.cold_blood = cold_blood
self.re... |
the-stack_0_635 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pipenv install twine --dev
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
# Package meta-data.
NAME = 'mypackage'
DESCRIPTION = 'My sho... |
the-stack_0_637 | #!/usr/bin/env python3
import pytest # type: ignore
import os
import time
import random
import pathlib
import numpy as np # type: ignore
import numpy
from glob import iglob
from pathlib import Path
import rtCommon.utils as utils # type: ignore
import rtCommon.projectUtils as putils # type: ignore
import rtCommon.v... |
the-stack_0_638 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... |
the-stack_0_639 | import argparse
import os
from util import util
import torch
import models
import data
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options.
It also gathers additional opti... |
the-stack_0_640 | # Copyright 2017 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_645 | """ Contact serializers. """
# Django REST Framework
from ast import Num
from statistics import mode
from rest_framework import serializers
# Models
from coeadmin.record.models.person import Person
from coeadmin.record.models.contact import Contact
# Serializers
from coeadmin.record.serializers.person import Person... |
the-stack_0_647 | ''' Tests for netcdf '''
from __future__ import division, print_function, absolute_import
import os
from os.path import join as pjoin, dirname
import shutil
import tempfile
import warnings
from io import BytesIO
from glob import glob
from contextlib import contextmanager
import numpy as np
from numpy.testing import (... |
the-stack_0_650 | '''
Created on Oct 6, 2013 (from DialogPluginManager.py)
@author: Mark V Systems Limited
(c) Copyright 2013 Mark V Systems Limited, All rights reserved.
'''
from tkinter import simpledialog, Toplevel, font, messagebox, VERTICAL, HORIZONTAL, N, S, E, W
from tkinter.constants import DISABLED, ACTIVE
try:
from tkinte... |
the-stack_0_651 | #!/usr/bin/env python
# from galaxy import eggs
import sys
import rpy2.rinterface as ri
import rpy2.rlike.container as rlc
# from rpy import *
import rpy2.robjects as robjects
r = robjects.r
def stop_err(msg):
sys.stderr.write(msg)
sys.exit()
infile = sys.argv[1]
y_col = int(sys.argv[2]) - 1
x_cols = sys... |
the-stack_0_653 | # 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 ... |
the-stack_0_654 | #!/usr/bin/python3
"""
Copyright 2018-2019 Firmin.Sun (fmsunyh@gmail.com)
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 applic... |
the-stack_0_655 | import os
import unittest
import pytest
from nose.plugins.attrib import attr
from conans.test.assets.multi_config import multi_config_files
from conans.test.utils.tools import TestClient
@attr("slow")
@pytest.mark.slow
@pytest.mark.tool_cmake
class CMakeConfigsTest(unittest.TestCase):
def test_test_package_con... |
the-stack_0_656 | """
Defines CPU Options for use in the CPU target
"""
class FastMathOptions(object):
"""
Options for controlling fast math optimization.
"""
def __init__(self, value):
# https://releases.llvm.org/7.0.0/docs/LangRef.html#fast-math-flags
valid_flags = {
'fast',
'... |
the-stack_0_657 | import math
import numpy as np
import torch
from scipy.spatial import cKDTree
def setup_seed(seed):
torch.backends.cudnn.deterministic = True
torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
def square_dists(points1, points2):
'''
Calculate square dists between t... |
the-stack_0_659 | import os
import glob
# Our numerical workhorses
import numpy as np
import pandas as pd
import scipy.special
# Import the project utils
import sys
sys.path.insert(0, '../')
import image_analysis_utils as im_utils
# Useful plotting libraries
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib... |
the-stack_0_660 | #!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 2008-2016 California Institute of Technology.
# Copyright (c) 2016-2019 The Uncertainty Quantification Foundation.
# License: 3-clause BSD. The full license text is available at:
# - https://github.com/uqfoundation/di... |
the-stack_0_661 | from __future__ import division
from .atmospheric_model import AtmosphericLayer, phase_covariance_von_karman, fried_parameter_from_Cn_squared
from ..statistics import SpectralNoiseFactoryMultiscale
from ..field import Field, RegularCoords, UnstructuredCoords, CartesianGrid
from .finite_atmospheric_layer import FiniteA... |
the-stack_0_662 | #!/bin/env python
import os
import sys
import random
import subprocess as sub
import getopt
import time
def identity(x):
return x
def cygpath(x):
command = ["cygpath", "-wp", x]
p = sub.Popen(command,stdout=sub.PIPE)
output, errors = p.communicate()
lines = output.split("\n")
return lines[0]... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.