text stringlengths 2 999k |
|---|
import json
from requests.exceptions import HTTPError
from twitterbot.twitter_base_command import TwitterBaseCommand
class Command(TwitterBaseCommand):
def add_arguments(self, parser):
super(Command, self).add_arguments(parser)
parser.add_argument(
'--url',
dest='url',
... |
# The MIT License (MIT)
#
# Copyright (c) 2014 Florian Neagu - michaelneagu@gmail.com - https://github.com/k3oni/
#
# 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, includ... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
import imghdr
from PIL import Image
def is_img(f):
'''
判断文件是否为图片
:param f: 图片路径
:param imgType_list: 图片格式
:return: bool
'''
imgType_list = {'jpg', 'bmp', 'png', 'jpeg', 'rgb', 'tif', 'gif', 'webp'} # 其他特殊格式课自行添加
if imghdr.what(f) in imgType_list:
return True
else:
... |
# -*- coding: utf-8 -*-
from dataclasses import dataclass
from typing import Any, List, Optional, Type
from rabbitai.models.reports import ReportRecipients, ReportRecipientType
@dataclass
class NotificationContent:
name: str
csv: Optional[bytes] = None # bytes for csv file
screenshot: Optional[bytes] = ... |
import numpy as np
import torch
from torch import nn
from torch.autograd import Variable
import torch.nn.functional as nf
#from .hsm import HSM
from layers.cu_hsm import HSM
#from layers.sentence_embedders import MeanWordVectorEmbedder as SentenceEmbedder
from layers.sentence_embedders import PresetRandomVectorEmbedde... |
import asyncio
import pathlib
import sys
import time
from datetime import datetime
from decimal import Decimal
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, Union
import aiohttp
from chia.cmds.cmds_util import transaction_status_msg, transaction_submitted_msg
from chia.cmds.show import pri... |
"""This module contains the general information for MgmtBackupPolicyFsm ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class MgmtBackupPolicyFsmConsts():
COMPLETION_TIME_ = ""
CURRENT_FSM_REP... |
import pygalfunc as pgf
import pygalview as pgv
def getLambda(pts):
pt = pgf.vec3Var([0., 0., 0.])
fpt = pgf.pointCloudFarthestPt(pts, pt)
dist = pgf.distance(pt, fpt)
lims = pgf.vec2Var([.5, 1.2])
scheme = pgf.listvec3([
[0., 0., 1.],
[0., 1., 0.],
[1., 1., 0.],
[1... |
# coding: utf-8
# ## 第8章 自然言語処理による感情分析(BERT)
#
# - 本ファイルでは、第8章で使用するフォルダの作成とファイルのダウンロードを行います。
# In[1]:
import os
import urllib.request
import zipfile
import tarfile
import glob
import io
# In[2]:
'''
# フォルダ「data」が存在しない場合は作成する
data_dir = "./data/"
if not os.path.exists(data_dir):
os.mkdir(data_dir)
'''
#... |
# encoding: utf-8
# ============================[ General settings ]============================
SUPPORTED_FORMATS = ['png', 'jpg', 'jpeg']
DEFAULT_QUALITY = 80
DEFAULT_BG_COLOR = (255, 255, 255)
MIN_BIG_IMG_SIZE = 80_000
MIN_BIG_IMG_AREA = 800 * 600
# ====================[ iOS/Pythonista specific settings ]=========... |
#!/usr/bin/python3
'''
--- Day 13: Shuttle Search ---
Your ferry can make it safely to a nearby port, but it won't get much further. When you call to book another ship, you discover that no ships embark from that port to your vacation island. You'll need to get from the port to the nearest airport.
Fortunately, a sh... |
# coding=utf-8
# Copyright 2022 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... |
#!/usr/bin/env python3
# Copyright (c) 2019-2019, Nejcraft
# Copyright (c) 2019, The Monero Project
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are
# permitted provided that the following conditions are met:
#
# 1. Redistributions of source code mus... |
import argparse
import logging
from collections import defaultdict
from overrides import overrides
from typing import Dict, List
from sacrerouge.commands import RootSubcommand
from sacrerouge.common import Params
from sacrerouge.common.logging import prepare_global_logging
from sacrerouge.common.util import import_mod... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
#! /usr/bin/env python
import os
import sys
import urllib2
import xml.etree.ElementTree as et
import math
# ------------------- PUT YOUR INFO HERE -------------------
API_KEY = ''
API_SECRET = ''
seedtag = 'social'
nimages = 500
perpage = 500
# ------------------- PUT YOUR INFO HERE -------------------
HOST = 'http... |
import difflib
import pwd
import string
import sys
import cracklib
import ocflib.misc.mail
RESERVED_USERNAMES = frozenset((
# Misc
'Debian-exim',
'Debian-gdm',
'_graphite',
'about',
'account',
'accounts',
'admin',
'administrator',
'apphost',
'applicationhost',
'approve... |
# Copyright (c) 2018 Red Hat, 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 require... |
"""
ZSNES Save State Parser (v143 only currently)
Author: Jason Gorski
Creation date: 2006-09-15
"""
from hachoir.parser import Parser
from hachoir.field import (FieldSet, StaticFieldSet,
UInt8, UInt16, UInt32,
String, PaddingBytes, Bytes, RawBytes)
from hachoir.c... |
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
import numpy as np
# To install and compile to your anaconda/python site-packages, simply run:
# $ pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
# Note that the original co... |
from gettext import gettext as _
import sys
from gi.repository import Gtk
import pygame
import sugar3.activity.activity
from sugar3.graphics.toolbarbox import ToolbarBox
from sugar3.activity.widgets import ActivityToolbarButton
from sugar3.graphics.toolbutton import ToolButton
from sugar3.activity.widgets import Stop... |
import random
from ..util import get_direction
class RandomLogic(object):
def __init__(self):
self.directions = [(1, 0), (0, 1), (-1, 0), (0, -1)]
self.goal_position = None
self.current_direction = 0
def next_move(self, board_bot, board):
props = board_bot["properties"]
... |
from django.shortcuts import render
from django.http import HttpResponse
from ALM.Views_Actions import *
from ALM.machine_learning import *
# Importing basic python packages
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime as dt
# Create your views here.
def index(r... |
"""empty message
Revision ID: 293c8607996c
Revises:
Create Date: 2018-11-08 22:30:44.102498
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '293c8607996c'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... |
def selection_5():
# Library import
import numpy
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
# Library version
matplotlib_version = matplotlib.__version__
numpy_version = numpy.__version__
# Histo binning
xBinning = numpy.lin... |
import contextlib
import collections
import cstnodes as E
from utils import ApeNotImplementedError, ApeSyntaxError, compose
class Parser:
"""A parser for the Beatle programming language"""
small_expr_tokens = ('del pass assert global nonlocal break continue '
'return raise import fro... |
# -*- coding: utf-8 -*-
#
# Dell EMC OpenManage Ansible Modules
# Version 4.4.0
# Copyright (C) 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
# 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)
_... |
class GitHubRepo:
"""
A class used to represent a single GitHub Repository.
"""
def __init__(self, name, language, num_stars):
self.name = name
self.language = language
self.num_stars = num_stars
def __str__(self):
return f"-> {self.name} is a {self.language} re... |
import unittest
from Binary_Search_Tree import Binary_Search_Tree
class BinarySearchTree_Tester(unittest.TestCase):
def setUp(self):
self.__tree = Binary_Search_Tree()
def test_on_empty(self):
self.assertEqual([], self.__tree.to_list())
## Insertion Tests
#Single Rotation: Rig... |
# 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... |
import logging
import re
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from typing import Dict, List
from cloudshell.email.email_config import EmailConfig
default_html = '''
<!DOCTYPE html>
<html lang="en">
<div>
<h2 style="text-align: center;"><span style="col... |
NEWS_API_KEY='0f91a1188bde4ec2a617cbda88fc63d1' |
'''
Takes file names from the output/ folder and parses the information into
readable values and produces a graph. Use this module as an executable to
process all length frequency information for a single problem, such as:
python freqplot.py output/neutral_100_*.frq
Do not mix problems or problem sizes in a single r... |
# Copyright 2020 Huawei Technologies Co., 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 agreed to... |
# mbed SDK
# Copyright (c) 2011-2013 ARM Limited
#
# 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 ag... |
import usocket as socket
import network
import machine
import time
import esp
esp.osdebug(None)
import gc
gc.collect()
ssid = 'ESP8266' # Name of your network
password = 'nodeesp8266' # password of your network
# Making NodeMCU Hotspot
ap = network.WLAN(network.AP_IF)
ap.active(True)
ap.config(essid=ssid, password=... |
###############################################################
# pytest -v --capture=no tests/test_00_sys.py
# pytest -v tests/test_00_sys.py
###############################################################
import pytest
from cloudmesh.common.Benchmark import Benchmark
from cloudmesh.common.Shell import Shell
from cl... |
import math
a = int(input())
b = int(input())
c = int(input())
a, b, c = sorted([a, b, c])
if a + b <= c:
print('impossible')
elif c == math.sqrt((a ** 2) + (b ** 2)):
print('rectangular')
elif ((a ** 2) + (b ** 2) - (c ** 2)) / (2 * a * b) > 0:
print('acute')
else:
print('obtuse')
|
"""Runtime library unit testing for configuration"""
from meg_runtime import Config
# Configuration load/save test
def test_config_load_save():
"""Configuration load/save test"""
# Load configuration to prevent removing anything already configured
assert Config.load()
# Set a test value and save the ... |
from django.contrib import admin
from donations.models import Donations, Donors
# from donations.forms import ExpensesForm
class DonationsAdmin(admin.ModelAdmin):
list_display = ['service_type', 'donor', 'item', 'description', 'quantity',
'created_at']
search_fields = ('service_type', 'don... |
# Copyright 2015, 2016 OpenMarket Ltd
# Copyright 2017 New Vector Ltd
# Copyright 2019 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.apac... |
# Copyright (c) 2021, TU Wien, Department of Geodesy and Geoinformation
# 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,... |
import functools
import hashlib
import os
from django import http
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import PermissionDenied
from django.db.models import Q
from django.db.transaction import non_atomic_requests
from django.shortcuts import get_object_or_404
... |
from os import makedirs
from os.path import exists
from os.path import join
from shutil import rmtree
from subprocess import check_output, call
from invoke import task
from tasks.compile import clean_dir
from tasks.util.codegen import find_codegen_shared_lib
from tasks.util.env import PROJ_ROOT, FAASM_TOOLCHAIN_FILE,... |
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from rlutils.np.functional import inverse_softplus
class EnsembleDense(nn.Module):
__constants__ = ['num_ensembles', 'in_features', 'out_features']
in_features: int
out_features: int
weight: torch.Tensor
def __init__(... |
# proxy module
from __future__ import absolute_import
from blockcanvas.class_tools.class_search import *
|
import maya.OpenMayaUI as omui
import maya.cmds as cmds
import os
import pymel.core as pm
import rsTools.utils.path as path
from Qt import QtCore
from Qt import QtGui
from Qt import QtWidgets
from rsTools.glob import *
from rsTools.utils import nurbs
from shiboken2 import wrapInstance
import logging
import rsTools.ui... |
from __future__ import print_function
from enum import IntEnum
import struct
import binascii
import uuid
import threading
from .notifications import GenericClearTileNotification
from .parser import MsftBandParser
from .commands import (
SERIAL_NUMBER_REQUEST, CARGO_NOTIFICATION,
GET_TILES_NO_IMAGES, CORE_WHO_A... |
import os
import pandas as pd
def load_banana():
print(os.curdir)
file_path = 'data/xgb_dataset/banana/banana.csv'
data = pd.read_csv(file_path, delimiter=',',converters={2: lambda x:int(int(x) == 1)}).values
return data[:, :2], data[:, 2] |
import torch.nn as nn
import torch
from torchvision import models
from misc.layer import convDU,convLR
import torch.nn.functional as F
from misc.utils import *
import pdb
# model_path = '../PyTorch_Pretrained/resnet101-5d3b4d8f.pth'
class Res101_SFCN(nn.Module):
def __init__(self, pretrained=True):
sup... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.models import BaseUserManager
class UserProfileManager(BaseUserManager):
"""Manager for User Profiles"""
def create_user(self, email,name,passwo... |
"""
This file is by Greg King, distributed under the MIT license.
MIT License
Copyright (c) Greg King 2022
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 ... |
#!/bin/env python3
#%%
#%% Code so the same scripts can be used as notebooks and as part of a pipeline
try:
if __IPYTHON__:
import sys
sys.path.insert(0,'./bin')
except:
pass
from pipeline_utils.ic_utils import get_IC, get_observed_variance, get_pb_variance
import pandas as pd
import numpy as n... |
import logging
logger = logging.getLogger(__name__)
import pyglet.gl
class Camera(object):
def __init__(self, world, x=0, y=0, rotation=0.0, scale=1.0):
self._x = x
self._y = y
self._rotation = rotation
self._scale = scale
self.world = world
@property
def x(self):... |
# -*- coding: utf-8 -*-
"""Inception-ResNet V2 model for Keras.
Model naming and structure follows TF-slim implementation (which has some additional
layers and different number of filters from the original arXiv paper):
https://github.com/tensorflow/models/blob/master/slim/nets/inception_resnet_v2.py
Pre-trained Imag... |
from django.urls import path , include
from rest_framework_simplejwt import views as jwt_views
from django.contrib import admin
urlpatterns = [
path('api/token/', jwt_views.TokenObtainPairView.as_view(), name='token_obtain_pair'),
path('api/token/refresh/', jwt_views.TokenRefreshView.as_view(), name='token_ref... |
import math
import matplotlib.pyplot as plt
def silnia(a, b):
res = 1
for i in range(a, b + 1):
res *= i
return res
def p(d, n):
return 1 - silnia(d-n+1, d) / d ** n
def p2(d, n):
return 1 - math.exp(-((n*(n-1))/(2*d)))
xs = list(range(1, 61))
ys = [p(365, n) for n in xs]
plt.pl... |
import numpy as np
import matplotlib.pyplot as plt
import astropy.io.fits as pft
import ats_image as atsi
import ats_helpers as atsh
from scipy.signal import convolve
import itertools
NUM_AMPS = 16
BIN_ROW = 1
BIN_COL = 1
ROI = [None, None, None, None]
#fnums = np.arange(348, 453, 1)
#fnums = np.arange(248,348,1)
... |
#!/usr/bin/python3
#
# Copyright (C) 2019 Oleg Shnaydman
#
# 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... |
# 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... |
# -*- coding: UTF-8 -*-
import cv2 as cv
import os
import sys
from pathlib import Path
from Pose.pose_visualizer import TfPoseVisualizer
file_path = Path.cwd()
out_file_path = Path(file_path / "test_out/")
# camera resolution setting
cam_width, cam_height = 1280, 720
# input size to the model
# VGG trained in 656*368;... |
# -*- coding: utf-8 -*-
import json
import logging
import werkzeug.utils
from odoo import http
from odoo.http import request
_logger = logging.getLogger(__name__)
class PosController(http.Controller):
@http.route('/pos/web', type='http', auth='user')
def pos_web(self, debug=False, **k):
# if user n... |
from __future__ import absolute_import
from time import time
class FunctionWrapper(object):
def __init__(self, collector):
self.collector = collector
def __call__(self, func, *args, **kwargs):
__traceback_hide__ = True # NOQA
start = time()
try:
return func(*arg... |
"""
kombu.pools
===========
Public resource pools.
"""
from __future__ import absolute_import
import os
from collections import Callable
from itertools import chain
from .connection import Resource
from .five import range, values
from .messaging import Producer
from .utils import EqualityDict
from .utils.functiona... |
#!/usr/bin/python2.4
#
# Copyright 2009, Google Inc.
# 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... |
# coding=utf-8
########################################################################################
### Do not forget to adjust the following variables to your own plugin.
# The plugin's identifier, has to be unique
plugin_identifier = "remote_timelapse"
# The plugin's python package, should be "octoprint_<plugi... |
#!/usr/bin/env python
# coding=utf-8
"""Defines the stock-commands that every sacred experiment ships with."""
from __future__ import division, print_function, unicode_literals
import pprint
import pydoc
import re
from collections import namedtuple, OrderedDict
from sacred.config import save_config_file
from sacred.s... |
from collections import Counter
list1 = ['x','y','z','x','x','x','y', 'z']
print(Counter(list1))
s = 'simon zhang'
Counter(s)
dict1 = {'x': 4, 'y': 2, 'z': 2, 'z': 2}
Counter(dict1)
tuple1 = ('x','y','z','x','x','x','y', 'z')
Counter(tuple1) # return dict
c = Counter()
c.update('sssssimonnnnn')
print(c)
for ch i... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""
Time Execution decorator
"""
import socket
import time
import warnings
import six
from fqn_decorators import Decorator
from pkgsettings import Settings
from .constants import PY_35_GT
from .deprecation import HookDeprecatedWarning
warnings.simplefilter('once', HookDeprecatedWarning)
SHORT_HOSTNAME = socket.geth... |
#from __future__ import print_function
import os
#os.environ["THEANO_FLAGS"] = "mode=FAST_RUN,device=gpu,floatX=float32"
from keras import backend as K
from keras.layers import concatenate
from keras import optimizers
import numpy as np
import scipy.io
#import sklearn
from sklearn.metrics import f1_score, accurac... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django_pgjson.fields
class Migration(migrations.Migration):
dependencies = [
('projects', '0015_auto_20141230_1212'),
]
operations = [
migrations.CreateModel(
name... |
"""
Generate device, sample position, task definitions from user defined files (task & device)
and write them to MongoDB, which will make it easier to query
"""
def setup_lab():
"""
Cleanup the db and then import all the definitions and set up the db
"""
from ..utils.module_ops import load_definition
... |
#!/usr/bin/python
import re
import getpass
# Filter out pids (CS110 assignment 4)
def filter_pids(str):
lines = str.split('\n')
for i in range(len(lines)):
m = re.match(r'\[\d+\] +([0-9]{3,5}).*', lines[i])
if m:
pids = re.findall(r' [0-9]{3,5}', lines[i])
for pid in pi... |
import json
import datetime
from django.conf import settings
from django.contrib.gis.geos import Point
from django.db import models
from django.utils.translation import gettext as _
from geotrek.common.parsers import (AttachmentParserMixin, Parser,
TourInSoftParser)
from geotrek.t... |
from flexmock import flexmock
from mock import PropertyMock
from sportsipy.constants import (AWAY,
HOME,
LOSS,
TIE,
NEUTRAL,
POST_SEASON,
... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket Ltd
# Copyright 2017-2018 New Vector Ltd
# Copyright 2019 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 Licens... |
from .compose import Compose
from .formating import (Collect, ImageToTensor, ToDataContainer, ToTensor,
Transpose, to_tensor)
from .instaboost import InstaBoost
from .loading import (LoadAnnotations, LoadImageFromFile,
LoadMultiChannelImageFromFiles, LoadProposals)
from .te... |
# Librerias Django
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect
from django.urls import reverse
from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, UpdateView
... |
import autofit as af
import autolens as al
from test_autolens.integration.tests.interferometer import runner
test_type = "lens__source_inversion"
test_name = "lens_mass__source_rectangular"
data_type = "lens_sie__source_smooth"
data_resolution = "sma"
def make_pipeline(
name,
phase_folders,
real_space_sh... |
from .htx import init_model_server
from .htx import _server as app
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read()
requirements = [
'pandas'
]
setup_requirements =... |
#!/usr/bin/env python
'''
Python-Tail - Unix tail follow implementation in Python.
python-tail can be used to monitor changes to a file.
Example:
import tail
# Create a tail instance
t = tail.Tail('file-to-be-followed')
# Register a callback function to be called when a new line is found in the fo... |
# Generated by Django 2.1.4 on 2018-12-16 05:36
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Color',
fields=[
('color_id', models.AutoFi... |
__author__ = 'reiners'
import serial
import time
import math
import os
import sys
import argparse
from PIL import Image, ImageFont, ImageDraw
effects = { "fix" : 4, "left" : 0, "right" : 1, "up" : 2, "down" : 3, "animation" : 5, "snow" : 6, "blink" : 7 }
class Message(object):
def __init__(self):
self._... |
import time
import numpy as np
import pandas as pd
from joblib import Parallel
from joblib import delayed
from matplotlib import pylab as plt
from sklearn.model_selection import cross_val_score
import pyunidoe as pydoe
EPS = 10**(-8)
class SeqUD(object):
"""
Implementation of sequential uniform design.
... |
from collections import OrderedDict
import pytz
from django.urls import reverse
from rest_framework import status
from parkings.factories.faker import fake
from ...utils import create_parkings_and_regions, intersects
list_url = reverse('monitoring:v1:regionstatistics-list')
def test_empty(monitoring_api_client):
... |
from ..interpreter.interpreter import PythonFunction, Number, String, List, Boolean, Null
from .conversions import to_int, to_string, to_bool, to_real
from .ps_random import rand_between
def populate_builtins(symbol_table):
builtins = {
"NULL": Null(),
"INT": PythonFunction("INT", to_int, ["value"]... |
from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.urls import include, re_path
from django.views.i18n import JavaScriptCatalog
from django.views.static import serve
from cms.utils.conf import get_cms_setting
admin.autodiscover()
urlpatterns ... |
import os
import sys
import hashlib
import json
import argparse
from copy import deepcopy
from time import monotonic, time_ns
import core.simulate
from conf import (
ROOT_DIR,
load_equip_json,
load_adv_json,
list_advs,
ELEMENTS,
WEAPON_TYPES,
DURATIONS,
ELE_AFFLICT,
)
from conf.equip imp... |
from app.models import WinningBundleStatistics
def calculate_from_association_rule(bundle_association_rule):
patch_statistics = bundle_association_rule.patch_statistics
pick_association = patch_statistics.pick_rules.filter(
hero_bundle=bundle_association_rule.hero_bundle
)
if len(pick_associ... |
from typing import List, Dict, Union, Iterable, Any, Optional, Callable
from typing import Tuple
import srsly
from pathlib import Path
from .pipe import Pipe
from ..errors import Errors
from ..training import validate_examples, Example
from ..language import Language
from ..matcher import Matcher
from ..scorer import ... |
# 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... |
from .client import Client
from .consts import *
from .exceptions import OkexParamsException
class AccountAPI(Client):
def __init__(self, api_key, api_seceret_key, passphrase, use_server_time=False):
Client.__init__(self, api_key, api_seceret_key, passphrase, use_server_time)
# get all currencies li... |
from ray.rllib.utils.annotations import PublicAPI
@PublicAPI
class UnsupportedSpaceException(Exception):
"""Error for an unsupported action or observation space."""
pass
@PublicAPI
class EnvError(Exception):
"""Error if we encounter an error during RL environment validation."""
pass
# -------
# Er... |
import os
import torch
import torchvision as tv
import pytorch_lightning as pl
import pl_bolts
import webdataset as wds
import torch.distributed as dist
from apex.parallel import DistributedDataParallel as DDP
from resnet_sagemaker.utils import mixup_data, mixup_criterion
from .utils import train_preproc, val_preproc
f... |
# -*- coding: utf-8 -*-
import boto3
import pytest
from flask import Flask
from moto import mock_s3
@pytest.yield_fixture(scope='session', autouse=True)
def app(request):
app = Flask('test')
app.config.update(AWS_UNVALIDATED_PREFIX='test-unvalidated-uploads/')
ctx = app.app_context()
ctx.push()
y... |
# 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... |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import setuptools, re
import os
class RunTestsCommand(setuptools.Command):
description = "Test command to run testr in virtualenv"
user_options = [
('coverage', 'c',
"Generate code coverage report"),
]
boolean_op... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.