text stringlengths 2 999k |
|---|
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext
from setuptools import find_packages
from setuptools import setup
def read(*names, **kwargs):
with io.open(join... |
# EG11-02 Stock Item class failed
class StockItem(object):
'''
Stock item for the fashion shop
'''
def __init__(self, stock_ref, price, color):
self.stock_ref = stock_ref
self.__price = price
self.__stock_level = 0
self.color = color
@property
def price(self)... |
'''
even_odd_vending.py
Print whether the input is even or odd. If even, print the next 9 even numbers
If odd, print the next 9 odd numbers.
'''
def even_odd_vending(num):
if (num % 2) == 0:
print('Even')
else:
print('Odd')
count = 1
print(num)
while count <= 9:
num += 2
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-23 01:32
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('matches', '0003_auto_20170423_0226'),
]
operations =... |
# Copyright 2016-2020 The GPflow Contributors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
from __future__ import unicode_literals
from django.conf import settings
_trailing_slash = '/?' if getattr(settings, 'TASTYPIE_ALLOW_MISSING_SLASH', False) else '/'
# for backwards compatibility where 3rd parties still call this like a function.
class CallableUnicode(str):
def __call__(self):
return se... |
from collections import OrderedDict
from datetime import timedelta
import numpy as np
import pytest
from pandas.core.dtypes.dtypes import CategoricalDtype, DatetimeTZDtype
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Series,
Timedelta,
Timestamp,
_np_version_under1p14,
... |
from array import array
import os
from math import floor, sqrt
from random import choice, randint
from kivy.app import App
from kivy.atlas import Atlas
from kivy.clock import Clock
from kivy.core.image import Image as CoreImage
from kivy.core.window import Window
from kivy.lang import Builder
from kivy.gr... |
# -*- coding: utf-8 -*-
from datetime import datetime
from .channel import Channel
import json, time, base64
def loggedIn(func):
def checkLogin(*args, **kwargs):
if args[0].isLogin:
return func(*args, **kwargs)
else:
args[0].callback.other("You want to call the function, yo... |
# coding=UTF-8
from operators.op import op
from camera.TCPCamera import TCPCamera
from camera.socket.SocketCamera import SocketCamera
from SocketCamerasHandler import SocketCamerasHandler
class TCPSocketCamera(SocketCamera, TCPCamera):
'''
# TCP Socket Camera
inherits from ```BaseSocketCamera``` and ```... |
import time
import cv2
import math
import numpy as np
import matplotlib.pyplot as plt
from Modules.foregroundExtraction import readyFrame, frameDifferencing, morphologicalOperations, natural_sort, convert480p
from Modules.ballDetectionRes import findContours, sizeDetection, playerProximityDetection, regionDetection, co... |
import os
import gc
import time
import torch
import random
import argparse
import numpy as np
import pandas as pd
from glob import glob
from tqdm import tqdm
from trains import *
from config import *
from utils.log import *
from utils.metricsTop import *
from utils.functions import *
from models.AMIO import AMIO
from ... |
#!/usr/bin/env python3
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
# Perform beam-search decoding with word-level LM
# this is test with dumped acoustic model scores
import math
... |
'''
@Author : sean cheng
@Email : aya234@163.com
@CreateTime : 2018/7/14
@Program : 游戏的title界面功能
'''
import pygame
from pygame.locals import *
def game_title(SURFACE,globalVar):
title_text = '大脑 很囧'
bt_start_text = '开 始 游 戏'
bt_about_text = '关 于 游 戏'
title_bg = pygame.image.load('i... |
import csv
from contextlib import closing
import datetime
import re
from etl import base
from utils.metadata_helper import MetadataHelper
def format_location_submitter_id(in_json):
"""summary_location_<country>_<province>_<county>"""
country = in_json["country_region"]
submitter_id = "summary_location_cc... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... |
import argparse
import logging
import os
from ceph_deploy import hosts
from ceph_deploy.cliutil import priority
from ceph_deploy.lib import remoto
from ceph_deploy.util.constants import default_components
from ceph_deploy.util.paths import gpg
LOG = logging.getLogger(__name__)
def sanitize_args(args):
"""
a... |
# -*- coding: utf-8 -*-
from datetime import date, datetime, timedelta
from unittest import TestCase
import ttcal
import pytest
from ttcal import Day
@pytest.fixture
def week():
return [
ttcal.Week.weeknum(4, 2012),
ttcal.Week.weeknum(1),
ttcal.Week.weeknum(52, 2012),
ttcal.Week.we... |
"""
Create the tfrecord files for a dataset.
A lot of this code comes from the tensorflow inception example, so here is their license:
# 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... |
from .base import WiktionaryParserBase
class EnWiktionaryParser(WiktionaryParserBase):
"""English Wiktionary Parser class
This class is used to parse english wiktionary.
"""
def __init__(self):
url = "https://en.wiktionary.org/wiki/{}?printable=yes"
super().__init__(url)
|
# -*- 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 o... |
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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 lnbits.db import open_ext_db
def m001_initial(db):
"""
Initial tposs table.
"""
db.execute(
"""
CREATE TABLE IF NOT EXISTS tposs (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
name TEXT NOT NULL,
currency TEXT NOT NULL
);
"... |
from acados_template import AcadosModel, AcadosOcp, AcadosOcpSolver
from drone_model import drone_model
import scipy.linalg
import numpy as np
def acados_settings(Tf, N):
# create OCP object to formulate the optimization
ocp = AcadosOcp()
# export model
model = drone_model()
# define acados ODE ... |
''' These define the standard error codes and messages for Bokeh
validation checks.
1001 *(BAD_COLUMN_NAME)*
A glyph has a property set to a field name that does not correspond to any
column in the |GlyphRenderer|'s data source.
1002 *(MISSING_GLYPH)*
A |GlyphRenderer| has no glyph configured.
1003 *(NO_... |
#! /usr/bin/env python3
"""
proxyget -- setup.py
author - fmitchell
created - 2019-Jan-25
"""
from setuptools import setup, find_packages
setup(
name='proxyget',
version='0.3.0',
description='Tools for downloading past corporate proxies',
author='FHT Mitchell',
author_email='... |
from collections import OrderedDict
from contextlib import contextmanager
import gc
import os
from pathlib import Path
import shutil
from tempfile import TemporaryDirectory
import warnings
import pytest
import matplotlib as mpl
from matplotlib import pyplot as plt, style
from matplotlib.style.core import USER_LIBRARY... |
import os
import re
from twisted.internet import reactor, defer
from scrapy.selector import Selector
from spider.items import StudentItem
from scrapy.http import Request
from scrapy.http import FormRequest
from spider.spiders.basic import StudentSpider
from scrapy.xlib.pydispatch import dispatcher
from scrapy import s... |
import random
import GenericDummy
class Gas(GenericDummy.GenericDummy):
def __init__(self):
super(Gas, self).__init__()
self.version = '01000000000001010000000000000000'
self.id = 'gassnszeus'
self.name = 'gas'
self.port = 5002
def update_state(self):
i = rando... |
# -*- coding: utf-8 -*-
'''Tests for natto.option_parse.'''
import re
import sys
import unittest
import natto.environment as env
from natto.option_parse import OptionParse
from StringIO import StringIO
from tests import Test23Support
class TestOptionParse(unittest.TestCase, Test23Support):
'''Tests the ... |
import json
import requests
from btclib_node import Node
from btclib_node.config import Config
from tests.helpers import get_random_port, wait_until
def test_no_method(tmp_path):
node = Node(
config=Config(
chain="regtest",
data_dir=tmp_path,
allow_p2p=False,
... |
from django.contrib.admin.util import NestedObjects
from django.contrib.auth.models import Group
from django.utils.text import capfirst
from django.utils.encoding import force_text
from guardian.shortcuts import remove_perm
from pbs.admin import get_permission_codename
from django.core.mail import EmailMessage
from d... |
#
from stockzie import demo
from stockzie import plot
from stockzie import data
from stockzie import strategy
from stockzie.stock import Stocks |
from django.db import migrations
from fan_tools.django.contrib.postgres.operations import LTreeExtension
class Migration(migrations.Migration):
dependencies = [
('sampleapp', '0001_initial'),
]
operations = [
LTreeExtension(),
]
|
import sys
from .pcap_util import PcapParser, load_pcap
def default_arg(argsj, k, default):
val = argsj.get(k)
if val is None:
return default
else:
return val
class PcapGen(object):
def __init__(self, argsj):
self.verbose = default_arg(argsj, "verbose", False)
# JSON ... |
from .sandbox_document_authenticity_check import ( # noqa: F401
SandboxDocumentAuthenticityCheckBuilder,
)
from .sandbox_document_face_match_check import ( # noqa: F401
SandboxDocumentFaceMatchCheckBuilder,
)
from .sandbox_document_text_data_check import ( # noqa: F401
SandboxDocumentTextDataCheckBuilder... |
# utils.py
import os
import csv
import math
import numpy as np
import argparse
from inspect import getframeinfo, stack
import json
import sys
import psutil
import signal
import torch
import torchvision
from PIL import Image
from scipy.io import loadmat
from plyfile import PlyData, PlyElement
import pdb
def setup_gr... |
from utils import CanadianJurisdiction
from pupa.scrape import Organization
class RichmondHill(CanadianJurisdiction):
classification = 'legislature'
division_id = 'ocd-division/country:ca/csd:3519038'
division_name = 'Richmond Hill'
name = 'Richmond Hill Town Council'
url = 'http://www.town.richmo... |
from datetime import datetime
from pathlib import Path, PurePath
import argparse
import json
import sys, os
import logging
### CONSTANTS
# Tensorboard Logs path slice
TB_LOGS_PATH = "tb_logs"
# Best Model save path slice
BEST_MODELS_PATH = "val_info"
# Env info save path
ENV_INFO_PATH = "env_info"
# Consts for use in... |
#coding :utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2017 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... |
# sshrepo.py - ssh repository proxy class for mercurial
#
# Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from node import bin, hex
from i18n import _
import repo, util, error,... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
# -*- coding: utf-8 -*-
"""Provides a base ``ACLContainer`` class that wraps any context in a
generic API key aware ``ACLWrapper`` and a
"""
__all__ = [
'APIKeyAuthenticationPolicy',
'APIKeyAuthorizationPolicy',
]
import logging
logger = logging.getLogger(__name__)
import re
import zope.interface as zi
f... |
import unittest, sys
from eosfactory.eosf import *
verbosity([Verbosity.INFO, Verbosity.OUT])
CONTRACT_WORKSPACE = sys.path[0] + "/../"
# Actors of the test:
MASTER = MasterAccount()
HOST = Account()
ALICE = Account()
BOB = Account()
CAROL = Account()
class Test(unittest.TestCase):
def run(self, result=None):
... |
"""Icy air Gibbs energy and related properties.
This module provides the Gibbs function for ice-saturated (icy) air and
related thermodynamic properties. The primary variables are the total
dry air fraction, temperature, and pressure. The 'total' fraction here
is the mass fraction of dry air in the total parcel (inclu... |
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... |
'''
app: filehandarticles_mgr
'''
from django.conf.urls import patterns, url
urlpatterns = patterns('filehand.views',
url(r'^$', 'index', name='index'),
url(r'^newArticle/$', 'newArticle', name='newArticle'),
url(r'^articlesMgr_1/(.*)/(.*)$', 'articlesMgr_1', name='articlesMgr_1'),
url(r'^art... |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
"""
Django settings for homesite project.
Generated by 'django-admin startproject' using Django 1.9.11.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... |
import unittest
from replaceme.util.setproctitle import setproctitle
class TestSetProcTitle(unittest.TestCase):
def test_does_not_crash(self):
setproctitle("replaceme test title")
|
#!/bin/env python3.1
# Bradley N. Miller, David L. Ranum
# Introduction to Data Structures and Algorithms in Python
# Copyright 2005, 2010
#
import unittest
class BinarySearchTree:
'''
Author: Brad Miller
Date: 1/15/2005
Description: Imlement a binary search tree with the following interface
... |
# Copyright (c) 2016 Mirantis, 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 requir... |
import copy
import datetime
from decimal import Decimal
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import connection
from django.db.models import fields
from django.db.models.query_utils import Q
from django.utils.deconstruct import deconstructible
from django.utils.functional import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for `psrsigsim.signal` module."""
import pytest
import numpy as np
from psrsigsim.signal.fb_signal import FilterBankSignal
from psrsigsim.signal.bb_signal import BasebandSignal
from psrsigsim.signal.rf_signal import RFSignal
from psrsigsim.signal.signal import ... |
from alphaVantageAPI.alphavantage import AlphaVantage
from unittest import TestCase
from unittest.mock import patch
from pandas import DataFrame, read_csv
from .utils import Path
from .utils import Constant as C
from .utils import load_json, _mock_response
## Python 3.7 + Pandas DeprecationWarning
# /alphaVantageAPI... |
'''OpenGL extension MESA.agp_offset
This module customises the behaviour of the
OpenGL.raw.GLX.MESA.agp_offset to provide a more
Python-friendly API
The official definition of this extension is available here:
http://www.opengl.org/registry/specs/MESA/agp_offset.txt
'''
from OpenGL import platform, constan... |
"""
Django settings for blogproject project.
Generated by 'django-admin startproject' using Django 2.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import o... |
a = int(input())
b = int(input())
c = int(input())
n = int(input())
q = max((a+1)//2*2, 2*b, 2*c) # новая зарплата Алексая после "минимального уравнивания"
m = q - a + q // 2 - b + q // 2 - c # минимальный премиальный фонд, которого хватит уравнять
if m > n:
print(0)
else:
print(q - a + (n - m) // 4 * 2)
p... |
import warnings
import numpy as np
import pytest
from pandas.errors import PerformanceWarning
import pandas as pd
from pandas import Index, MultiIndex
import pandas._testing as tm
def test_drop(idx):
dropped = idx.drop([("foo", "two"), ("qux", "one")])
index = MultiIndex.from_tuples([("foo", "two"), ("qux... |
import numpy
def weighted_mean_and_std(x, w):
"""Return the mean and standard deviation of the data points x, weighted by
the weights in w (which do not need to sum to 1)."""
w = numpy.array(w, dtype=float)
w /= w.sum()
x = numpy.asarray(x)
weighted_mean = (w*x).sum()
squared_diff = (x - we... |
import torch
from models.deep_mix_net import DeepSeqNet
from torch import nn
class FastText(DeepSeqNet):
def __init__(self, vocab_size, embeddings, embedding_size, hidden_layer_size,
tab_input_dim, linear_layers_dim, output_dim, dropout_rate, optimizer="adam", learning_rate=0.01):
sup... |
from datetime import datetime
CDN_BASE_URL = "https://pod-cdn.timbrook.tech"
def populate_episode(doc, data):
item = doc.new_tag("item")
bare_tags = {
"title": data["name"],
"itunes:duration": data["duration"],
"description": data["description"],
"itunes:subtitle": data["descr... |
import bcrypt
from user import User
import admin
import db_access
import getpass
if __name__ == "__main__":
user = None
print "##########################"
print ""
print "Available Commands:"
print "login"
print "logout"
print "print"
print "update"
print "delete"
print "cr... |
"""prensa URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based ... |
# -*- coding: utf-8 -*-
"""
Created on 2021/3/18 7:05 下午
---------
@summary:
---------
@author: Boris
@email: boris_liu@foxmail.com
"""
from feapder.utils.webdriver import WebDriverPool, WebDriver
import threading
def test_webdirver_pool():
webdriver_pool = WebDriverPool(
pool_size=2, load_images=False, ... |
# Author: Trevor Sherrard
# Course: Directed Research
# Since: Febuary 14, 2021
# Description: This file contains the class definition for the 1D
# windowed average data stream smoother.
class MovingWindowAverage:
def __init__(self, windowSize):
self.windowSize = windowSize
self.windo... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
import ncadquery as cq
# Create a lofted section between a rectangle and a circular section.
# 1. Establishes a workplane that an object can be built on.
# 1a. Uses the named plane orientation "front" to define the workplane, meaning
# that the positive Z direction is "up", and the negative Z direction
# is "... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
import sys
from hashlib import new
if sys.version_info[0] >= 3:
xrange = range
buffer = memoryview
try:
# OpenSSL's PKCS5_PBKDF2_HMAC requires OpenSSL 1.0+ with HMAC and SHA
fro... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Weighttp(AutotoolsPackage):
"""A lightweight and simple webserver benchmarking tool"""
... |
import logging
from enum import Enum
from boolexer import LexState, HandleState
class ParseState(Enum):
INIT = 1
ASSIGN = 2
RANGE = 3
OPERATE = 4
class BooParser:
def __init__(self, tokens):
self.tokens = tokens
self.ast = []
self.state = ParseState.INIT... |
# coding: utf-8
from django.conf.urls import url
from drfwebapp.api.views import messages_view
from drfwebapp.api.views import users_view
urlpatterns = [
url(r'^api/register/$', users_view.CreateUserView.as_view(), name='user-create'),
url(r'^api/messages/$', messages_view.MessageList.as_view(), name='message... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Set of functions that can be useful
Daniel Wolfensberger
MeteoSwiss/EPFL
daniel.wolfensberger@epfl.ch
December 2019
"""
# Global imports
import datetime
import io
import os
from collections import OrderedDict
import numpy as np
from scipy.stats import energy_distance... |
from __future__ import absolute_import
from __future__ import unicode_literals
from corehq.apps.es.cases import CaseES
from corehq.util.python_compatibility import soft_assert_type_text
import six
def scroll_case_ids_by_domain_and_case_type(domain, case_type, chunk_size=100):
"""
Retrieves the case ids in chu... |
from PyQt5.QtWidgets import QApplication
from src.ui import Window
if __name__ == '__main__':
app = QApplication([])
window = Window()
window.show()
app.exec_()
|
import tensorflow as tf
hello = tf.constant('Hello, TensoFlow!')
sess = tf.Session()
print sess.run(hello) |
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
# This is our neural networks class that inherits from nn.Module
class ResidualBlock(nn.Module):
# Here we define our block structure
def __init__(self, num_in, num_out, stride = 1):
super(ResidualBlock,self).__init__()
... |
import os
import numpy as np
import matplotlib.pyplot as plt
import cv2
def load_images_and_labels(path):
""" scan the data folder in and return a list of paths for images and labels """
folders = os.listdir(path)
slices = []
gt = []
for f in folders:
current_folder = os.path.j... |
"""
SmartAPI Tornado Handler Tests
Setup:
mygene_minimum
mychem_full
CRUD Testcases:
read mygene
read mychem
read all
add lincs
refresh mychem (with live content change)
refresh mygene (simulate url broken)
update mygene slug
... |
"""Logging feature to add information about a socket"""
from __future__ import absolute_import
import socket as _socket
# XXX these need robustification for non-TCP sockets, etc.
def socket(self, s):
"""Adds the following fields:
:ip_addr: numeric IP address
:port: port number
:host: pee... |
from flask import render_template
from . import user
# from .forms import ProfileForm, PostForm, CommentForm, ReplyForm, SearchForm, EditpostForm
# from ..models import User, Post, Comment, Like, Permission, Admin
# from ..decorators import permission_required
# # 用户最后一次访问时间,全文搜索
# @user.before_request
# def befor... |
"""empty message
Revision ID: 1bef3c3fc7a5
Revises: 11550468b927
Create Date: 2019-11-30 19:49:08.083542
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1bef3c3fc7a5'
down_revision = '11550468b927'
branch_labels = None
depends_on = None
def upgrade():
# ... |
#!/usr/bin/env python
# -*- coding: utf-8
import os
def has_utility(cmd):
path = os.environ['PATH']
return any(os.access(os.path.join(p, cmd), os.X_OK) for p in path.split(os.pathsep))
def is_macos():
return os.uname()[0] == 'Darwin'
class Driver(object):
arch = "amd64"
@property
def nam... |
import re
import bpy
from tests import utils
class TestAnmExport(utils.XRayTestCase):
def test_yxz(self):
# Arrange
obj = self._create_active_object()
act = bpy.data.actions.new('tact')
obj.animation_data_create().action = act
# Act
bpy.ops.xray_export.anm(filepa... |
#!/usr/bin/env python3
import os
import sys
from os.path import join as path_join
from options import *
from os_utils import *
# TODO: OSXCROSS
target_values = ['llvm32', 'llvm64', 'llvmwin32', 'llvmwin64']
mxe_targets = {
'llvmwin32': {'arch': 'i686', 'mxe': 'mxe-Win32'},
'llvmwin64': {'arch': 'x86_64', ... |
import inspect
def arg_list(fn):
return list(inspect.signature(fn).parameters.keys())
def calling_module():
frm = inspect.stack()[1]
mod = inspect.getmodule(frm[0])
return mod
def calling_module_name():
mod = calling_module()
return mod.__name__
|
# https://www.quandl.com/data/LBMA/GOLD-Gold-Price-London-Fixing
import quandl
import conf
# Setting Quandl's API KEY (Use your own API KEY)
quandl.ApiConfig.api_key = conf.API_KEY;
data = quandl.get("LBMA/GOLD", authtoken="2Evs3E8J_LduFKbNF6Gw", start_date='01-01-2014', end_date="01-01-2017");
print data; |
import tempfile
from bika.lims import bikaMessageFactory as _
from bika.lims import logger
from bika.lims.utils import t, formatDecimalMark
from bika.lims.utils.analysis import format_uncertainty, format_numeric_result
from bika.lims.browser import BrowserView
from bika.lims.permissions import *
from bika.lims.utils im... |
from django.apps import AppConfig
class AccountConfig(AppConfig):
name = 'account'
|
from typing import Optional, Tuple
import cv2
import numpy as np
from pyk4a import ImageFormat
def convert_to_bgra_if_required(color_format: ImageFormat, color_image):
# examples for all possible pyk4a.ColorFormats
if color_format == ImageFormat.COLOR_MJPG:
color_image = cv2.imdecode(color_image, cv... |
import random
from flask import (Flask, jsonify, # From module flask import class Flask
request)
from TrainedModel import predict
# from DataPrepation import delayTime, arrivalTimeCategory
app = Flask(__name__) # Construct an instance of Flask class for our webapp
@app.route('/', methods=['GE... |
from functools import partial
from typing import Dict, List, Optional, Tuple
from qtpy import QtCore, QtGui, QtWidgets
from .signal import Signal
from .utils import is_concrete_schema, iter_layout_widgets, state_property
from ...._qt.widgets.qt_plugin_sorter import QtPluginSorter
class SchemaWidgetMixin:
on_ch... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, PT DAS and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class GSTAccountsSetting(Document):
pass
|
from typing import Tuple, FrozenSet
from collections import Iterable
from mathsat import msat_term, msat_env
from mathsat import msat_make_constant, msat_declare_function
from mathsat import msat_get_integer_type, msat_get_rational_type, msat_get_bool_type
from mathsat import msat_make_and, msat_make_not, msat_mak... |
import inflect
import re
_inflect = inflect.engine()
_comma_number_re = re.compile(r'([0-9][0-9\,]+[0-9])')
_decimal_number_re = re.compile(r'([0-9]+\.[0-9]+)')
_pounds_re = re.compile(r'£([0-9\,]*[0-9]+)')
_dollars_re = re.compile(r'\$([0-9\.\,]*[0-9]+)')
_ordinal_re = re.compile(r'[0-9]+(st|nd|rd|th)')
_number_re =... |
#!/usr/bin/env python
from distutils.core import setup
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name='pyanxdns',
version='0.2',
license='MIT',
description='Python client to communicate with ANX DNS API',
author='Marky Egebäck',
author_e... |
import os
from calendar import monthrange
from datetime import date
from matplotlib import rcParams, pyplot as plt
from pandas import read_csv, concat
import numpy as np
from hydrograph import hydrograph
from county_list import included_counties
from state_county_names_codes import state_fips_code, state_county_code
... |
# /*
# * Copyright 2018 IBM Corporation
# *
# * Licensed under the Apache License, Version 2.0 (the "License");
# * you may not use this file except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.apache.org/licenses/LICENSE-2.0
# *
# * Unless required by applicab... |
from model_mommy import mommy
from projects.models import DOCUMENT_CLASSIFICATION, SEQUENCE_LABELING, SEQ2SEQ, SPEECH2TEXT
def make_annotation(task, doc, user, **kwargs):
annotation_model = {
DOCUMENT_CLASSIFICATION: "Category",
SEQUENCE_LABELING: "Span",
SEQ2SEQ: "TextLabel",
SPE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.