text stringlengths 1 927k |
|---|
from django.db import models
from polymorphic.models import PolymorphicModel
class Product(models.Model):
PAYER_TYPES = [
('all', 'All'),
('mem', 'Member'),
('org', 'Organization'),
('cus', 'Custom')
]
name = models.CharField(max_length=255)
#currency = models.CharFie... |
# Python module for getting git commits from the command line args
import datetime
import os
import subprocess
import sys
def parseISO8601Likedatetime(s):
return datetime.datetime.strptime(s, "%Y-%m-%d %H:%M:%S %z")
def get_git_hashes(args):
def shell_exec(cmd, verbose=args.verbose, check=False, stdout=None, stder... |
"""Tokenize and color text
"""
import json
import logging
import os
import re
import colorsys
import curses
import functools
from itertools import chain
from .curses_defs import CursesLine
from .curses_defs import CursesLinePart
from ..tm_tokenize.grammars import Grammars
from ..tm_tokenize.tokenize import tokeniz... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
# Standard imports
from future import standard_library
standard_library.install_aliases()
from builtins import *
import unittest
import datetime as pydt
import logging
imp... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
from ikomia import dataprocess
# --------------------
# - Interface class to integrate the process with Ikomia application
# - Inherits dataprocess.CPluginProcessInterface from Ikomia API
# --------------------
class IkomiaPlugin(dataprocess.CPluginProcessInterface):
def __init__(self):
dataprocess.CPlug... |
import settings
from . import model_params
from .task import Task
from pprint import pprint
from .adj_graph import draw_adj_graph
pprint(Task.all()[-1].predecessors)
arcs = [[1 if p in t.predecessors else 0 for p in range(len(Task.all()))]
for t in Task.all()]
draw_adj_graph(arcs,
filename='fi... |
import subprocess
import pytest
from .test_common import _assert_eq
def test_mpi_adam():
"""Test RunningMeanStd object for MPI"""
# Test will be run in CI before pytest is run
pytest.skip()
return_code = subprocess.call(['mpirun', '--allow-run-as-root', '-np', '2',
... |
"""
This package contains tests and test-support code.
""" |
#!/usr/bin/env python3
# LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this ... |
# Copyright 2013 OpenStack Foundation
# 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 requ... |
#
# 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... |
# 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... |
#
# PySNMP MIB module TIMETRA-SAS-IEEE8021-CFM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TIMETRA-SAS-IEEE8021-CFM-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:14:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python vers... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2016 Eric Jacob <erjac77@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
#... |
'''
High level of model for training and prediction
Created October, 2017
Author: xiaodl@microsoft.com
'''
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import logging
import math
from collections import defaultdict
from torch.optim.lr_scheduler imp... |
from pyaww import (
always_on_task,
console,
file,
sched_task,
static_header,
static_file,
user,
webapp
)
__version__ = '0.0.3' |
#This file is only available to the lab members in the internal Wiki |
#------------------------------------------------------------------------------------------
def getUniformityMetrics(depths):
# get total cumulative depth
depthTotal = sum(depths)
# if zero depth at all primers/sites, return zeros
if depthTotal == 0:
outvec = [0] * 5
return tuple(o... |
"""SCons.Node
The Node package for the SCons software construction utility.
This is, in many ways, the heart of SCons.
A Node is where we encapsulate all of the dependency information about
any thing that SCons can build, or about any thing which SCons can use
to build some other thing. The canonical "thing," of co... |
from sqlalchemy.testing import eq_, assert_raises, assert_raises_message
import operator
from sqlalchemy import *
from sqlalchemy import exc as sa_exc, util
from sqlalchemy.sql import compiler, table, column
from sqlalchemy.engine import default
from sqlalchemy.orm import *
from sqlalchemy.orm import attributes
from s... |
# Add mouse controls
# add half size paddle after hitting back wall
import math, pygame, sys, shutil, getpass
from pygame.locals import *
pygame.init()
fpsClock = pygame.time.Clock()
screen = pygame.display.set_mode((640, 480)) # create screen - 640 pix by 480 pix
pygame.display.set_caption('Breakout') # set title ... |
""" Closuers
Free variables and closures
Remember: Functions defined inside another function can access the outer (nonLocal) variables
"""
def outer():
x = 'python'
def inner():
print("{0} rocks!".format(x)) |
#!/usr/bin/env python
import rospy
import numpy as np
from sensor_msgs.msg import Image
from std_msgs.msg import String
import math
import tf
import sys
from localization.msg import Marker
from tf import transformations as t
class TF_marker_publisher():
def __init__(self):
rospy.init_node("TF_marker_publ... |
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# 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 limitati... |
from keras.engine.topology import Layer, InputSpec
import keras.utils.conv_utils as conv_utils
import tensorflow as tf
import keras.backend as K
def normalize_data_format(value):
if value is None:
value = K.image_data_format()
data_format = value.lower()
if data_format not in {'channels_first', 'ch... |
import numpy as np
import pandas as pd
from scipy.stats import chi2_contingency
# preset values
significance_threshold = 0.05
sample_size = 100
lift = .3
control_rate = .5
name_rate = (1 + lift) * control_rate
# initialize an empty list of results
results = []
# start the loop
for i in range(100):
# simulate data:... |
from collections import Counter
import numpy as np
import random
import math
import difflib
class TimelineFilter(object):
def __init__(self, characterizer, skip_fields=None, max_entropy_percentile=100.0, time_bucket_size=10,
start_strategy=None, pick_strategy=None, approve_tweet_fn=None,
... |
# 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... |
import time
from busio import I2C
from adafruit_seesaw.seesaw import Seesaw
from adafruit_seesaw.pwmout import PWMOut
from adafruit_motor import motor, servo
from digitalio import DigitalInOut, Direction, Pull
import board
print("Mag Neat-o!")
# Create seesaw object
i2c = I2C(board.SCL, board.SDA)
seesaw = Seesaw(i2c... |
import json
import threading
from django.http import HttpResponse
from django.shortcuts import render, get_object_or_404
from django.utils import timezone
from django.db.models import F
from application.app_constants import EVENT_CATEGORIES
from application.models import LikedEvent, User, Journey, Category, UserRank
... |
import base64
import json
import os
import time
from datetime import datetime, timedelta
from logging import getLogger
import gspread
from gspread import Client
from gspread.exceptions import APIError
from oauth2client.service_account import ServiceAccountCredentials
logger = getLogger(__name__)
DIRNAME = os.path.d... |
import socket
import logging
import time
import threading
import sys
class RDT:
CONGESTION_AVOIDANCE = -1
SLOW_START = 0
FAST_RECOVERY = 1
def __init__(self):
self.MSS = 2048
self.N = 100 # Window size.
self.RTO = 0.75 # Timeout (secs).
self.connection = False
... |
"""Integration tests configuration file."""
# pylint: disable=unused-import
from backtestd.py.tests.conftest import pytest_configure |
import os
import platform
import getpass
# from core import *
# import pyping
import subprocess
import time
def createNewConnection(name, SSID, key):
config = """<?xml version=\"1.0\"?>
<WLANProfile xmlns="http://www.microsoft.com/networking/WLAN/profile/v1">
<name>"""+name+"""</name>
<SSIDConfig>
... |
from __future__ import division, absolute_import, print_function
import sys
import warnings
import functools
import operator
import pytest
import numpy as np
from numpy.core._multiarray_tests import array_indexing
from itertools import product
from numpy.testing import (
assert_, assert_equal, assert_raises, asse... |
##############################################################################
# Parte do livro Introdução à Programação com Python
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2017
# Primeira edição - Novembro/2010 - ISBN 978-85-7522-250-8
# Primeira reimpressão - Outubro/2011
# Segunda reimpressão - ... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import pandas as pd
import os
os.chdir('Data')
# Bridges identified using http://stat.abs.gov.au/itt/r.jsp?ABSMaps
neighbours = [(117031337,121041417, 'Sydney - Haymarket - The Rocks', 'North Sydney - Lavender Bay'),
(121041415, 122011418, 'Mosman', 'Balgowlah - Clontarf - Seaforth'),
(12... |
import unittest
import numpy as np
from specc.analysis.analyzer import CircuitTester
from specc.aquisition.daq import DataAcquisitionInterface
from specc.data.results import SignalResponse
from tests.utils import ACCEPTABLE_ERROR, TEST_AMPLITUDE, TEST_DF, TEST_FREQUENCY, TEST_SAMPLES, TEST_SAMPLE_RATE
class TestDAQ... |
# -*- coding: utf-8 -*-
import inspect
from nseta.common.commons import *
from nseta.common.log import tracelog
@tracelog
def multithreaded_scan(**args):
frame = inspect.currentframe()
args, _, _, kwargs_main = inspect.getargvalues(frame)
del(kwargs_main['frame'])
kwargs = kwargs_main['args']
items_segment =... |
"""stomp.py provides connectivity to a message broker supporting the STOMP protocol.
Protocol versions 1.0, 1.1 and 1.2 are supported.
See the GITHUB project page for more information.
Author: Jason R Briggs
License: http://www.apache.org/licenses/LICENSE-2.0
Project Page: https://github.com/jasonrbriggs/stomp.py
""... |
#!/usr/bin/env python3
# author: github.com/olehermanse
# import libraries used for plotting and mathematical operations:
import numpy as np
import matplotlib.pyplot as plt
# Define a mathematical expression as a function:
def f(x):
return x**3
x = np.linspace(-3, 3, 100) # Make array of 100 values between -2 an... |
"""
Prepare transcriptiondata from the transcription sources.
"""
from uritemplate import URITemplate
from clldutils.clilib import ParserError
from csvw.dsv import UnicodeWriter
from pyclts.commands.make_dataset import process_transcription_data
try:
from lingpy.sequence.sound_classes import token2class
from l... |
from .word_mappings import WordMappings
__all__ = [
'WordMappings',
] |
import os
from setuptools import setup, find_packages
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
try:
file = open(path, encoding='utf-8')
except TypeError:
file = open(path)
return file.read()
def get_install_requires():
install_requires = [
't... |
from unicorn.arm_const import UC_ARM_REG_R0
from .. import native
def get_fuzz(uc, size):
"""
Gets at most 'size' bytes from the fuzz pool.
If we run out of fuzz, something will happen (e.g., exit)
:param size:
:return:
"""
return native.get_fuzz(uc, size)
def fuzz_remaining():
return... |
from match_result import MatchResult
from shared_functions import bye_dummy_player_name
import networkx as nx
import random
class MatchLog:
def __init__(self):
self._entries = []
self._explicit_players = []
self._player_active_map = {}
# Ensures we don't error if the user tries to l... |
import pkg_resources
import types
import pkg_resources
import types
import time
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from pandas_datareader import data as pdr
import yfinance as yf
yf.pdr_override()
company = input("Enter Company Name : ")
df_full = pd... |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email = 'admin@mail.com',
... |
#!/usr/bin/env python
# coding=utf-8
from distutils.core import setup
version = '0.3'
setup(
name='jefferson',
version=version,
description='JFFS2 filesystem extraction tool originally released by Stefan Viehböck. Python3 update by Jaan Klouman',
author='Stefan Viehböck & Jaan Klouman',
url='http... |
# -*- coding: utf-8 -*-
import click
import logging
from pathlib import Path
from dotenv import find_dotenv, load_dotenv
import os
import pandas as pd
from biopandas.pdb import PandasPdb
from copy import deepcopy
import src.utilities as utils
@click.command()
@click.argument('input_dir', type=click.Path(exists=True))... |
from typing import Dict
from overrides import overrides
import torch
from allennlp.common.checks import check_dimensions_match
from allennlp.data import TextFieldTensors, Vocabulary
from allennlp.models.model import Model
from allennlp.modules import Seq2SeqEncoder, TextFieldEmbedder
from allennlp.nn import util, Ini... |
from pathlib import Path
from pprint import pprint
import keyword
import builtins
import textwrap
from ursina import color, lerp, application
def indentation(line):
return len(line) - len(line.lstrip())
def get_module_attributes(str):
attrs = list()
for l in str.split('\n'):
if len(l) == 0:
... |
from contentbase.auditor import (
AuditFailure,
audit_checker,
)
term_mapping = {
"head": "UBERON:0000033",
"limb": "UBERON:0002101",
"salivary gland": "UBERON:0001044",
"male accessory sex gland": "UBERON:0010147",
"testis": "UBERON:0000473",
"female gonad": "UBERON:0000992",
"dig... |
import torch
import numpy as np
from torch.nn import Parameter
from gpytorch.optim import NGD
from torch.optim import Adam
from matplotlib import pyplot as plt
from gpytorch.constraints import Positive, Interval
from gpytorch.distributions import MultitaskMultivariateNormal, MultivariateNormal
from alfi.configuration... |
import scrapy
import pandas as pd
import time
import os
category_name = "LGBT"
category_num = 4
class QuotesSpider(scrapy.Spider):
name = category_name.lower() + str(category_num) + "spider"
def start_requests(self):
list_of_urls = []
parent_dir = "./reviewpages"
link_file = parent_di... |
"""
Run CGLE example using specified config file.
"""
import int.cgle as cint
import tests
import lpde
import os
import pickle
import shutil
import configparser
import numpy as np
import matplotlib.pyplot as plt
import tqdm
import torch
from torch.utils.tensorboard import SummaryWriter
import utils_cgle
from scipy.s... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-05-15 10:40
from __future__ import unicode_literals
from django.db import migrations, connection
from bluebottle.utils.utils import update_group_permissions
from bluebottle.clients import properties
from bluebottle.clients.models import Client
from bluebo... |
"""
"""
## python imports
from argparse import ArgumentParser
from datetime import datetime, timedelta
from enum import IntEnum
from os.path import abspath, dirname, join
## internal imports
from geodeconstructor.history.json import generate_location_history_json
from geodeconstructor.history.locations import iter... |
# This file is part of Neotest.
# See http://www.neotest.io for more information.
# This program is published under the MIT license.
import multiprocessing
import threading
import neotest
class ProcessBase(multiprocessing.Process, neotest.logging.LogClientBase):
def __init__(self, name=None):
multiproce... |
# Copyright (C) 2010-2013 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2009 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@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
#
# ... |
# Backward slicing
#-65432109876543210987654321
# 01234567890123456789012345
letters = "".join(sorted('qwertyuiopasdfghjklzxcvbnm')) # abcdefghijklmnopqrstuvwxyz
# print(letters)
# for i, a in enumerate(sorte... |
# Generated by Django 1.9.2 on 2016-05-22 14:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('evaluation', '0051_change_question_order_verbose'),
]
operations = [
migrations.AddField(
model_name='course',
name=... |
import os
from os.path import isfile
from lxml import etree
import torch
from PIL import Image
from torch.utils.data.dataset import Dataset
from utils.image import image_pillow_to_numpy
class IAMHandwritingWordDatabase(Dataset):
def __init__(self, path, height=32, loss=None):
self.height = height
... |
"""Prediction of Users based on Tweet embeddings."""
import numpy as np
from sklearn.linear_model import LogisticRegression
from .models import User
from .twitter import BASILICA
def predict_user(user1_name, user2_name, tweet_text, cache=None):
"""Determine and return which user is more likely to say a given Twee... |
class CCipher:
def decode(self, cipherText, shift):
decode_txt = ""
for char in cipherText:
new = chr(ord(char) - shift)
if(new < 'A'):
new = chr(ord(new) + ord('Z') - ord('A') + 1)
decode_txt = decode_txt + new
return decode_txt |
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class ModuleDocFragment(object):
# Standard F5 documentation fragment
DOCUMENTATION = r'''
options:
pro... |
#!/usr/bin/python
# Copyright 2012 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 applic... |
from trade_utilities.simulator import *
from kibot.kibot_downloader import *
from trade_utilities.order import Order
log_on()
df = request_history_as_data_frame('AAPL', 1, None, '2018-10-30', '2018-10-30')
# 2018-10-30 09:30:00 211.15 211.2 209.27 209.6824 771859 AAPL
df = df['2018-10-30 9:30:00':'2018-10-30 9:... |
"""
A throbber displays an animated image that can be
started, stopped, reversed, etc. Useful for showing
an ongoing process (like most web browsers use) or
simply for adding eye-candy to an application.
Throbbers utilize a wxTimer so that normal processing
can continue unencumbered.
"""
#
# throbber.py - Cliff Well... |
from rest_framework import generics
from django.db.models import Q
from rest_framework import permissions
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import authentication, permissions
from .serializers import TweetModelSerializer
from .pagination import St... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class Principal(object):
def __init__(self):
self._cert_no = None
self._cert_type = None
self._signer_type = None
self._user_name = None
self._verify_type = None... |
import multiprocessing as mp
from ._version import __version__
__all__ = ["__version__"]
mp.set_start_method("spawn", force=True) |
import logging
import re
import requests
from telegram.ext import Updater, Filters, CommandHandler, MessageHandler
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.NOTSET)
def get_url():
contents = requests.get('https://random.dog/woof.json').j... |
from absl import app, flags, logging
from absl.flags import FLAGS
import tensorflow as tf
import numpy as np
import cv2
from tensorflow.keras.callbacks import (
ReduceLROnPlateau,
EarlyStopping,
ModelCheckpoint,
TensorBoard
)
from yolov3_tf2.models import (
YoloV3, YoloV3Tiny, YoloLoss,
yolo_an... |
# Copyright 2020 MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, s... |
from typing import (Iterable,
Tuple,
Type)
from .hints import (Box,
Contour,
Point,
Polygon,
Scalar,
Segment)
def from_contour(contour: Contour, box_cls: Type[Box]) -> Box:
... |
"""Tests for the justatest2.my_module module.
"""
import pytest
from justatest2.my_module import hello
def test_hello():
assert hello('nlesc') == 'Hello nlesc!'
def test_hello_with_error():
with pytest.raises(ValueError) as excinfo:
hello('nobody')
assert 'Can not say hello to nobody' in str(ex... |
from .runnablechildpart import RunnableChildPart
# Expose all the classes
__all__ = sorted(k for k, v in globals().items() if type(v) == type) |
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from influxdb import InfluxDBClient
from pandas import DataFrame, Series
from pandas.io.json import json_normalize
from influxdb import InfluxDBClient
from datetime import datetime, timedelta
import plotly.graph_obj... |
'''
6. Faça um programa em Python utilizando a biblioteca fractions,
para determinar o resultado da multiplicação entre as frações:
1/2 x 3/2 x 6/7 x 9/3 = ?
- Resultado deve ser: 27/14
'''
import fractions
a = fractions.Fraction(1, 2)
b = fractions.Fraction(3, 2)
c = fractions.Fraction(6, 7)
d = fractions.Fraction(9,... |
# Copyright 2021 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 ... |
# Generated by Django 3.0.6 on 2020-05-30 12:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('posts', '0002_auto_20200529_1448'),
]
operations = [
migrations.AlterField(
model_name='image',
name='img_name',
... |
from abc import abstractmethod
from abc import ABCMeta
from pulzarutils.utils import Utils
from pulzarutils.utils import Constants
from pulzarutils.file_utils import FileUtils
from pulzarutils.constants import ReqType
from pulzarutils.stream import Config
from pulzarcore.core_rdb import RDB
from pulzarcore.core_request... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.Member import Member
class MybankCreditUserRoleQueryModel(object):
def __init__(self):
self._member = None
@property
def member(self):
... |
# -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... |
import logging
import requests
from multiprocessing import Process, Queue
import time
import sqlalchemy as s
import pandas as pd
import os
import zmq
logging.basicConfig(filename='housekeeper.log')
class Housekeeper:
def __init__(self, jobs, broker, broker_port, user, password, host, port, dbname):
self.... |
import pytest
import ray
import mars
import mars.dataframe as md
import pyarrow as pa
@pytest.fixture(scope="module")
def ray_start_regular(request): # pragma: no cover
try:
yield ray.init(num_cpus=16)
finally:
ray.shutdown()
def test_mars(ray_start_regular):
import pandas as pd
cl... |
#!/usr/bin/env python3
from __future__ import (unicode_literals, absolute_import,
print_function, division)
from functools import lru_cache
from itertools import count, islice
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
import argparse
import collections
import collec... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 8 16:35:35 2021
@author: abobashe
"""
import os
import datetime
import logging
import sys
#%%
def always_log_exceptions(exctype, value, tb):
#read last element in hope that this is the one we need
#TODO:refactor
logger=[logging.getLogger(name) for name... |
import os
from programy.config.file.factory import ConfigurationFactory
from programy.clients.events.console.config import ConsoleConfiguration
from programytest.config.file.base_file_tests import ConfigurationBaseFileTests
# Hint
# Created the appropriate yaml file, then convert to json and xml using the following ... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="torchsupport",
version="0.0.1",
author="Michael Jendrusch",
author_email="jendrusch@stud.uni-heidelberg.de",
description="Support for advanced pytorch usage.",
long_description=long_de... |
import quo
session = quo.Prompt()
class NumberValidator(quo.types.Validator):
def validate(self, document):
text = document.text
if text and not text.isdigit():
i = 0
# Get index of first non numeric character.
# We want to move the cursor here.
... |
import swagger_client
from swagger_client.rest import ApiException
import maya
import os
import json
import datetime
import pandas as pd
import glob
import datetime
from loguru import logger
import requests
import socket
import urllib
import webbrowser
from http.server import BaseHTTPRequestHandler, HTTPServer
class ... |
"""
# Copyright 2022 Red Hat
#
# 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 agr... |
import logging
from pathlib import Path
import numpy as np
import simulacra as si
import simulacra.units as u
import matplotlib.pyplot as plt
FILE_NAME = Path(__file__).stem
OUT_DIR = Path(__file__).parent / "out" / FILE_NAME
def w(z, w_0, z_0):
return w_0 * np.sqrt(1 + ((z / z_0) ** 2))
def R(z, z_0):
... |
#matplotlib inline
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from ... |
# Code for "AMC: AutoML for Model Compression and Acceleration on Mobile Devices"
# Yihui He*, Ji Lin*, Zhijian Liu, Hanrui Wang, Li-Jia Li, Song Han
# {jilin, songhan}@mit.edu
import time
import torch
import torch.nn as nn
from lib.utils import AverageMeter, accuracy, prGreen
from lib.data import get_split_dataset
fr... |
# TODO: change
import os
ope = os.path.exists
import numpy as np
import socket
import warnings
warnings.filterwarnings('ignore')
sk = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
hostname = socket.gethostname()
print('run on %s' % hostname)
RESULT_DIR = '../output/result'
DATA_DIR = '../input'
PRETRAINED_DIR = '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.