content stringlengths 5 1.05M |
|---|
import setuptools
# Package meta-data.
NAME = 'MondayClient'
DESCRIPTION = 'A client to query Monday.com v2 API'
URL = 'https://github.com/lalondesteve/MondayClient/'
EMAIL = 'lalondesteve@gmail.com'
AUTHOR = 'Steve Lalonde'
REQUIRES_PYTHON = '>=3.6.0'
VERSION = '0.1.0'
REQUIRED = [
'requests', 'wheel', 'python-do... |
from .bip39gen import words, reverse_dict, random_as_string, random_as_seq
|
import numpy as np
import os.path
from functools import partial
from typing import List, Tuple, Optional, Dict
import torch
import copy
import random
from abc import ABC
class Bert4RecDataset(torch.utils.data.dataset.Dataset, ABC):
def __init__(self,
data: List[dict],
max_len: O... |
import unittest
from lightnovel import LightNovelApi
from webot import Firefox
class ApiFactoryTest(unittest.TestCase):
def test_no_match(self):
with self.assertRaises(LookupError):
LightNovelApi.get_api('www.google.com', Firefox())
def test_wuxiaworld(self):
api = LightNovelApi.... |
""" Fill NaN values using an interpolation method..
Parameters
~~~~~~~~~~
input_array : (Panda Obj)
The Panda dataframe.
Note
~~~~
See: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.interpolate.html
"""
def interpolation(input_array,args={'limit':int(),'met... |
from __future__ import absolute_import, division, print_function
import binascii
import copy
from code import InteractiveConsole
import json
import os
import time
from decimal import Decimal
from os.path import exists, join
import pkgutil
import unittest
import threading
from electrum.bitcoin import base_decode, is_ad... |
#!/usr/bin/python
#
# Copyright (c)2011-2012 the Boeing Company.
#
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
#
# HIP automated testing script, for use as a 'make check' target.
# This script requires that CORE be installed, see:
# http://code.google.com/p/coreemu/
#
HIP_CFG_CACHE="~/.hiptest"
HIP_... |
"""
Django settings for suorganizer project.
Generated by 'django-admin startproject' using Django 2.2.2.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from pelican import signals
from pelican.utils import truncate_html_words
from pelican.generators import ArticlesGenerator
def truncate(generator):
read_more = generator.settings.get('READ_MORE_RE',
r'<!--\s*?mo... |
# Copyright 2019 ducandu GmbH. 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... |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import json
import pickle
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
def save_pickle(obj, fn):
with open(fn, 'wb') as f:
pickle.dump(obj, f)
def save_json(obj, fn):
w... |
create_parcel_kb = {
# "DefaultHeight": True,
# "CustomDefaultHeight": 70,
# "BgColor": "#4d79ff",
"Type": "keyboard",
# "InputFieldState": "minimized",
"Buttons": [
{
"Columns": 1,
"Rows": 1,
"BgColor": "#e6f5ff",
# "BgLoop": True,
... |
from PyQt5 import QtWidgets, QtGui, QtCore
class FadeLabel(QtWidgets.QLabel):
finished = QtCore.pyqtSignal()
def __init__(self, *args, **kwargs):
super(FadeLabel, self).__init__(*args, **kwargs)
self.opacity_effect = QtWidgets.QGraphicsOpacityEffect(self, opacity=1.0)
self.setGraphi... |
from dataclasses import dataclass, field
from typing import List
from .diagram_element import DiagramElement
from .point import Point
__NAMESPACE__ = "http://www.omg.org/spec/DD/20100524/DI"
@dataclass
class Edge(DiagramElement):
class Meta:
namespace = "http://www.omg.org/spec/DD/20100524/DI"
waypo... |
"""
Forbid implicitly concatenated string literals on one line such as those
introduced by Black
"""
from __future__ import generator_stop
import itertools
import tokenize
from typing import Iterable, List, Tuple, TypeVar
import attr
__all__ = ["__version__", "Checker"]
__version__ = "0.0.0.post0"
_ERROR = Tuple[i... |
import urllib
import urllib2
urlToRequest = "https://raw.githubusercontent.com/scotasaurus/Mouse-Squad-Module-5/master/sample.html"
request = urllib2.Request(urlToRequest)
response = urllib2.urlopen(request)
data = response.read()
print data
|
import pytest
from gilded_rose import GildedRose
def test_normal_item_before_sell_date() -> None:
item = GildedRose("normal", 10, 5)
item.tick()
assert item.quality == 9
assert item.days_remaining == 4
def test_normal_item_on_sell_date() -> None:
item = GildedRose("normal", 10, 0)
item.tic... |
import pytest
from random import choice
from pystratis.core.types import *
def test_uint160(generate_uint160):
hex_int = generate_uint160
uint160(hex_int)
def test_uint160_invalid_hexstring():
letters = 'qwerty0'
badvalue = ''.join(choice(letters) for _ in range(64))
with pytest.raises(ValueErro... |
# Copyright (c) Metakernel Development Team.
# Distributed under the terms of the Modified BSD License.
from metakernel import Magic
from IPython.display import HTML
class DotMagic(Magic):
def line_dot(self, code):
"""
%dot CODE - render code as Graphviz image
This line magic will rende... |
import numpy as np
class RingBuffer(object):
def __init__(self, size_max, default_value=0.0, dtype=float):
"""initialization"""
self.size_max = size_max
self._data = np.empty(size_max, dtype=dtype)
self._data.fill(default_value)
self.size = 0
def append(self, value):... |
"""Helper file for functions used in `minify_json` and `prettify_json`"""
from typing import Any
from pre_commit_hooks import constants
_ERROR_CODE_JSON_FILES_WRITTEN = 1
def output_file(filename: str, data: Any, fixed_json: Any, return_code: int):
"""Output to file"""
if data != fixed_json:
return... |
from boa3.builtin import public
from boa3.builtin.type import UInt256
@public
def uint256(arg: int) -> UInt256:
return UInt256(arg)
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 24 01:49:15 2020
@author: smith
"""
from __future__ import unicode_literals, print_function
import pandas as pd
import os
from config.SpaCySettings import *
def info(title):
print(title, "processID:", os.getpid())
def getArgs():
from co... |
from typing import Dict, Any
import torch
from transformers import AutoTokenizer
def aggregate_batch(batch: Dict[str, Any]) -> Dict[str, Any]:
"""Aggregate all the values of each column into a list of values.
This step should be done during data-loading.
"""
return {
column_name: [example[co... |
import json
import os
import onnx
import numpy as np
from onnx import numpy_helper
from mqbench.utils.logger import logger
from mqbench.deploy.common import (
update_inp2node_out2node,
prepare_initializer,
prepare_data,
OnnxPreprocess,
get_constant_inputs
)
class NNIE_process(object):
def g... |
# Copyright 2021 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, ... |
# Algorithms > Search > Missing Numbers
# Find the numbers missing from a sequence given a permutation of the original sequence
#
# https://www.hackerrank.com/challenges/missing-numbers/problem
#
# définit un tableau pour compter les nombres
# 200 comme ça pas la peine de chercher le min: on centre sur la première val... |
"""This module implements pluggable content rendering.
###############################################################################
# #
#
See user docs here:
... |
# coding: utf-8
# pylint: skip-file
import unittest
import lightgbm as lgb
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
try:
import matplotlib
matplotlib.use('Agg')
matplotlib_installed = True
except ImportError:
matplotlib_installed = False
cl... |
#!/usr/bin/env python
from pyaudio import PyAudio, paFloat32, paContinue, paComplete
import numpy as np
import time
import matplotlib.pyplot as plt
pa = PyAudio()
def callback(in_data, frame_count, time_info, flag):
# print len(in_data), frame_count, time_info, flag
# new_data = [ x**2 for x in in_data ]
... |
import eigenpy
eigenpy.switchToNumpyArray()
import numpy as np
import numpy.linalg as la
dim = 100
A = np.random.rand(dim,dim)
A = (A + A.T)*0.5 + np.diag(10. + np.random.rand(dim))
llt = eigenpy.LLT(A)
L = llt.matrixL()
assert eigenpy.is_approx(L.dot(np.transpose(L)),A)
|
import csv
from django.http import HttpResponse
from django.shortcuts import render
from rest_framework.permissions import AllowAny
from rest_framework.viewsets import ModelViewSet
from .models import User
from .serializers import UserSerializer
from .templatetags.manage_user import bizz_fuzz, allowed
class UsersVi... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: meta.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_data... |
'''
----------------------------------------
Given an heatmap, give out the bbox.
0. Get the DT-ed images
1. detect all contour in the bboxes
2. merge based on some rules.
3. output the bbox
----------------------------------------
'''
import os, sys
import numpy as np
import math
import cv2
def get_bbox(img, g_ths)... |
# coding: utf-8
"""
This tool inspects the FTP directories that will receive the apache log files
from the SciELO Network.
"""
import logging
import argparse
import re
import datetime
import time
import os
import sys
import shutil
from watchdog.observers.polling import PollingObserverVFS
from watchdog.events import Fi... |
# Refazer o desafio 009 mostrando a tabuada de um número que o usr escolher, utilizando um laço FOR.
print('Tabuadinha do amor, de 1 a 10!')
t = int(input('Digite o número desejado: '))
for n in range(0, 10):
print(f'{t} x {n + 1} = {t * (n + 1)}')
|
# django-webs - high level web layer for django
# Copyright (C) 2008-2011 Brian May
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any l... |
#
# given a fasta file, mutate it into another fasta file
#
import bio
import sys
if len(sys.argv) < 3:
print "Usage: %s reference.fasta output.vcf mutation_profile.cfg" % sys.argv[0]
sys.exit(0)
# read configuration
if len(sys.argv) > 3:
cfg = bio.Config().read_config_file( open( sys.argv[3] ) )
else:
bio.Co... |
# -*- coding: utf-8 -*-
from collections import deque
from typing import Union, NamedTuple, TypeVar
import attr
import funcy as fn
from lenses import bind
from mtl import sugar
Node = TypeVar("Node")
def flatten_binary(phi, op, dropT, shortT):
def f(x):
return x.args if isinstance(x, op) else [x]
... |
#!python
# coding : utf-8
import sys
"cc", {}
def f1(a, b= None, c=[]):
x = ""
print(
a,
b,
"""arg1""",
"""arg2""",
c )
'foo' > sys.stderr
sys.stdout;lambda: "justastring"
1j
def f2():
pass
class c:
f='justastring'
@f1
class c2(object):
def __init__(self):
def inner(): pass
d = {'a'... |
import contextlib
import os
import shlex
import shutil
import sys
import tempfile
from . import formatting
from . import termui
from . import utils
from ._compat import iteritems
from ._compat import PY2
from ._compat import string_types
if PY2:
from cStringIO import StringIO
else:
import io
from ._compa... |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of t... |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from ionyweb.page.models import AbstractPageApp
class PageApp_DevCss(AbstractPageApp):
def __unicode__(self):
return u'DevCss #%d' % (self.pk)
class Meta:
verbose_name = _(u"Dev C... |
# -*- coding: utf-8 -*-
# Time: 2021-10-20 16:35
# Copyright (c) 2021
# author: Euraxluo
from unittest import TestCase
from .envs2.models import Config as Config2
from .envs.models import *
class Test(TestCase):
def get_config_class(self, config):
d = config
print(d.env)
print(d.applica... |
"""
(c) Copyright 2016 Hewlett-Packard Enterprise Development Company, L.P.
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... |
import os
from abc import ABC, abstractmethod
from contextlib import closing
import recordio
class AbstractDataReader(ABC):
def __init__(self, **kwargs):
pass
@abstractmethod
def read_records(self, task):
"""This method will be used in `TaskDataService` to read the records
based ... |
# -*- coding: utf-8 -*-
import csv
import os
from attrs_mate import attr
from constant2 import Constant
class ConstantMixIn(Constant):
@classmethod
def validate(cls, value, param_name):
if value not in cls.Values():
msg = (
"'{value}' is not value for parameter '{param_na... |
""" Add an owner to a resource or resources
Usage: add_owner {username} {resource list}
"""
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from hs_core.models import BaseResource
from hs_core.hydroshare.utils import get_resource_by_shortkey
from hs_access_control.model... |
import random
import requests
import json
import configparser
import glob
import sys
import os
import logging
from pathlib import Path
from winservice import SMWinservice
from time import sleep
from msvcrt import kbhit
import pywinusb.hid as hid
class PythonCornerExample(SMWinservice):
_svc_name_ = "JabraHomeAs... |
'''
file habitualmachine.py
author Keith Helsabeck
________________________________________________________________________
This calculates whether a defendant is eligible for habitual felon
status in NC (see also UML in docs).
Habitual Felony in NC:
Habitual status is an OPTIONAL status in NC sentencing and can... |
# coding: utf-8
from caty.core.command import Builtin
import caty.jsontools as json
class Diff(Builtin):
def execute(self, input):
return list(set(input[0]).difference(set(input[1])))
class Union(Builtin):
def execute(self, input):
ss = input
r = set([])
while len(ss) != 0:
... |
import sys
import sly
from markblocks.lex.lexer import Lexer
import markblocks.ast.node as yy
class Parser(sly.Parser):
tokens = Lexer.tokens
def __init__(self):
super().__init__()
def error(self, token):
'''
Default error handling function. This may be subclass... |
import shlex
from multiprocessing import current_process
import setuptools.command.test as orig
OPTION_MAP = {
'io': 'event_loop'
}
def extend(values, extra):
extra.extend(values)
return extra
class Test(orig.test):
test_suite = True
start_coverage = False
list_options = set([
'lo... |
import tensorflow as tf
from neural_deprojection.graph_net_utils import AbstractModule, get_shape
import tensorflow_probability as tfp
from neural_deprojection.models.openai_dvae_modules.modules import Encoder2D, Decoder2D
class DiscreteImageVAE(AbstractModule):
def __init__(self,
hidden_size: int... |
class Solution:
def numWays(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
if n == 0:
return 0
elif n == 1:
return k
# for the first 2 posts
sameColor = k
diffColor = k * (k - 1)
for i in ra... |
# -*- coding: utf-8 -*-
from django.contrib import admin
from userprofile.models import About, Accomodation, Status
class AboutAdmin(admin.ModelAdmin):
list_display = ('__unicode__', 'email', 'phone', 'vegetarian', 'country', 'other_special_needs')
list_filter = ['vegetarian']
search_fields = ['first_name'... |
#!/usr/bin/env python
# -*- coding: ISO-8859-1 -*-
#
# generated by wxGlade 88adbe54429d+ on Sat Feb 6 22:56:43 2016
#
import wx
# begin wxGlade: dependencies
import gettext
# end wxGlade
# begin wxGlade: extracode
try:
ID_EDIT = wx.ID_EDIT
except AttributeError:
ID_EDIT = wx.NewId()
# end wxGlade
class T... |
# -*- coding: utf-8 -*-
"""
First singular person pronoun analysis
.. _Google Python Style Guide
https://github.com/google/styleguide/blob/gh-pages/pyguide.md
"""
__copyright__ = 'Copyright 2019, University of Messina'
__author__ = 'Lorenzo Carnevale <lorenzocarnevale@gmail.com>'
__credits__ = ''
__description__... |
from django import forms
from .models import Product
class ProductForm(forms.ModelForm):
name = forms.CharField(
widget=forms.TextInput(
attrs={
'id': 'name',
'class': 'form-control form-control-lg',
'placeholder': 'Enter name'
}
)
)
price = forms.DecimalField(
widget=forms.NumberInput(
... |
import boto3
import json
def lambda_handler(event, context):
dynamodb = boto3.resource('dynamodb', region_name='us-east-1', endpoint_url="https://dynamodb.us-east-1.amazonaws.com")
table = dynamodb.Table('GameVersions')
game = "Minecraft"
version = "1.15.2"
try:
response = t... |
from output.models.nist_data.list_pkg.float_pkg.schema_instance.nistschema_sv_iv_list_float_min_length_1_xsd.nistschema_sv_iv_list_float_min_length_1 import NistschemaSvIvListFloatMinLength1
__all__ = [
"NistschemaSvIvListFloatMinLength1",
]
|
from gan_training.models import (dcgan_deep, dcgan_shallow, resnet2, biggan) #
generator_dict = {
'resnet2': resnet2.Generator,
'dcgan_deep': dcgan_deep.Generator,
'dcgan_shallow': dcgan_shallow.Generator,
'biggan': biggan.Generator
}
discriminator_dict = {
'resnet2': resnet2.Discriminator,
'd... |
"""Unit-tests for `py2c.tree.node_gen`
"""
from textwrap import dedent
from py2c.tree import node_gen
from py2c.tests import Test, data_driven_test
from nose.tools import assert_equal, assert_raises
# -----------------------------------------------------------------------------
# Tests
# --------------------------... |
import time
from decimal import Decimal
from re import sub
import pandas as pd
from bs4 import BeautifulSoup
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import csv
from sqlalchemy import create_engine, types
driver = webdriver.Chrome(ChromeDriverManager().install())
# enter... |
from devices.logicdevice import LogicDevice
class Wire(LogicDevice):
def do(self, *args) -> tuple:
return args |
# Author: Josh Grunzweig, Unit 42
# Description: Attempts to extract macros and decode embedded strings. These
# macros make use of a UAC bypass technique. Script relies on the accompanying
# olevba.py script included.
# Reference: https://github.com/pan-unit42/public_tools/blob/master/macro_loader/macro_decode.py
im... |
import argparse
import os
import shutil
import time
from tqdm import tqdm
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
im... |
import random
import string
N = 1000000
letters = 'ACGT'
random_letters = ''.join(random.choice(letters) for _ in range(N))
print(N)
print(random_letters)
|
import pytest
from datetime import datetime
from uuid import uuid4
from atst.domain.users import Users
from atst.domain.exceptions import NotFoundError, AlreadyExistsError, UnauthorizedError
from atst.utils import pick
from tests.factories import UserFactory
DOD_ID = "my_dod_id"
REQUIRED_KWARGS = {"first_name": "Luk... |
# Generated by Django 3.0.7 on 2020-07-01 16:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('portfolio', '0011_auto_20200701_1623'),
]
operations = [
migrations.AddField(
model_name='messa... |
"""doc."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import os
import tensorflow as tf
import modeling
import xlnet
def get_ner_loss(FLAGS,features, is_training, num_labels):
inp = tf.transpose(features["input_ids"], [1, 0])
... |
#*********************************************************
#
# Copyright (c) Microsoft. All rights reserved.
# This code is licensed under the MIT License (MIT).
# THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
# ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
# IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
# PU... |
# Copyright 2021 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... |
# Copyright 2013-2015 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 agreed to in w... |
from django.db import models
class Account(models.Model):
name = models.CharField(max_length=42, default="None")
email = models.CharField(max_length=42, default="NEED TO FORMAT EMAIL")
wallet_address = models.CharField(max_length=42, primary_key=True)
profits = models.CharField(max_length=42, default="0.00")
coun... |
import numpy as np
import pandas as pd
def CovDist(A, method, power=1.0):
"""
Compute Pairwise Distance for Symmetric Positive-Definite Matrices
For a given 3-dimensional array where Symmetric Positive Definite (SPD)
matrices are stacked slice by slive, it computes pairwise distance using
various ... |
import unittest
import os
import pyopenms
def general_setup(self):
self.eightplex = pyopenms.ItraqEightPlexQuantitationMethod()
self.fourplex = pyopenms.ItraqFourPlexQuantitationMethod()
self.tmt = pyopenms.TMTSixPlexQuantitationMethod()
class TestIsobaricQuantitationMethod(unittest.TestCase):
def s... |
"""Miscellaneous helper methods."""
def validate_type(iterator, type_):
"""Validate all the elements of the iterable are of a particular type."""
for item in iterator:
if not isinstance(item, type_):
raise TypeError(
f"Expected {item} to be of type {type_.__name__} but got ... |
import sqlite3
conn = sqlite3.connect("test.db")
cursor = conn.cursor()
cursor.execute("""CREATE TABLE images
(name text)
""")
|
#!/usr/bin/env python
# encoding: utf-8
"""
Created by www on 12:58 am, May 31, 2017
"""
from __future__ import print_function
import sys
import os
complement_dict = { 'A' : 'T',
'C' : 'G',
'G' : 'C',
'T' : 'A',
'N' : 'N',
... |
from enums import *
import random, csv, copy
import tensorflow as tf
import numpy as np
from simulate_action import transit
NUM_KC = 5
NUM_PLEVEL = 5
NUM_ACTIONS = 40
ACTIONS = ['0', '1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20',
'21', '22', '23', '24', '3', '4', '5', '6', '7', '8', '9', '... |
from django.conf.urls.defaults import *
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^', include('blogserver.blog.urls')),
(r'^api/', include('blogserver.api.urls')),
(r'^admin/(.*)', admin.site.root),
)
|
from django.apps import AppConfig
class CosmicappConfig(AppConfig):
name = 'cosmicapp'
runAlready = False
def ready(self):
#TODO: Add a file lock to prevent this method from running twice in a development environment.
print('Config "ready" method called.')
import cosmicapp.hooks
|
from __future__ import absolute_import
import pyuwsgi
from django.conf import settings
from ...base_command import WebserverCommand
from ...utils import wsgi_app_name
def get_default_args():
"""Load pyuwsgi args from settings or use our defaults"""
try:
return settings.PYUWSGI_ARGS
except Attrib... |
# 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... |
# imports start
import os
import jinja2
import webapp2
import re
import bb_blogdb as bdb
import logging
# end imports
# create jinja2 environment
TEMPLATE_DIR = os.path.join(os.path.dirname(__file__), 'templates')
JINJA_ENV = jinja2.Environment(loader=jinja2.FileSystemLoader(TEMPLATE_DIR),
... |
from despinassy.db import db
from despinassy.Part import Part
from despinassy.Inventory import Inventory, InventorySession
from despinassy.Printer import Printer
from despinassy.Scanner import Scanner
|
#!/usr/bin/env python2
# --------------------------------------------------------------------
#
# Copyright (C) 2013 Marminator <cody_y@shaw.ca>
# Copyright (C) 2013 pao <patrick.oleary@gmail.com>
# Copyright (C) 2013 Daniel Triendl <daniel@pew.cc>
#
# This program is free software. It comes without any warranty, to
# ... |
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.shortcuts import render
from django.urls import reverse
from django.ut... |
from sqlalchemy import (
MetaData,
Table,
Column,
Integer,
ForeignKey,
NVARCHAR,
UnicodeText,
)
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
e = Table("ecrf_source", meta, autoload=True)
t = Table(
"custom_ecrf_source",
meta,
... |
import sys
def cd_env(folder='ds_Projects',project=None, mod=None, env=None, envname=None):
"""
Function to get a project's working directory and associated virtul environmentself.
:folder: use if there's a folder between the root and project directory
default = 'ds_Projects'
:project: na... |
import time
import random
import pygame
from syslogic import CGGPYG
from cggframe import cggframe
class linetest(cggframe):
def __init__(self):
self.cgg=CGGPYG("")
self.gamestate="play"
"""x1,y1:startpoint x2,y2:endpoint of line"""
self.x1=100
self.x2=400... |
#!/usr/bin/env python
import logging
from flatten_dict import flatten
from tqdm import tqdm
import numpy as np
import pandas as pd
import rosbag
from rospy_message_converter.message_converter import convert_ros_message_to_dictionary
class RosbagPandaException(Exception):
pass
def topics_from_keys(keys):
"... |
"""
"""
__aliases__ = {}
def alias(key, value):
__aliases__[key] = value
def _get_aliases():
return __aliases__
|
import os
from typing import Optional
from PIL import Image, ImageDraw, ImageFont
def get_final_image_url(
user_id: int,
text: Optional[str] = None,
font: Optional[str] = None,
font_size: Optional[int] = None,
private: Optional[bool] = None,
) -> str:
"""
Gets the url of the final images ... |
"""
########################################################################
The cotton2018.py module contains a function to setup and run pyfao56
for the 100%-100% and the 60-60% irrigation treatments in a 2018 cotton
field study at Maricopa, Arizona.
The cotton2018.py module contains the following:
run - functio... |
import io
import json
import logging
from datetime import datetime, timedelta, timezone
import pytest
import structlog
import eiq_logging
def parse_iso8601(value):
datetime_format = "%Y-%m-%dT%H:%M:%S.%fZ"
if not value.endswith('Z'):
datetime_format += '%z'
dt = datetime.strptime(value, datetime... |
from django.urls import reverse
from django.core.cache import cache
from django_webtest import WebTest
from apps.shop.models import Manufacturer, Product
from .. import utils
class ManufacturerWebTests(WebTest):
fixtures = ['.././load_data.json']
def test_manufacturer_creating_by_regular_user(self):
... |
import json
class TinApiBase(object):
_obj_path = None
def __init__(self):
pass
def __repr__(self):
"""Represents self as a string"""
return self._obj_path if self._obj_path else type(self).__name__
def basename(self):
return self._obj_path.split(".")[-1] if self._o... |
'''
Preprocessing Tranformers Based on sci-kit's API
By Omid Alemi
Created on June 12, 2017
'''
import copy
import pandas as pd
import numpy as np
import transforms3d as t3d
import scipy.ndimage.filters as filters
from sklearn.base import BaseEstimator, TransformerMixin
from analysis.pymo.rotation_tools import Rotat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.