content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
# Generated by Django 2.2.2 on 2019-06-30 13:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('favorites', '0003_auto_20190630_1317'),
]
operations = [
migrations.RenameField(
model_name='auditlog',
old_name='favourite_... | python |
# Generated by Django 2.2.7 on 2020-03-14 19:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("postcards", "0004_contact_language"),
]
operations = [
migrations.AlterField(
model_name="card",
name="sent_at",
... | python |
from projects.utils.multiprocessing import *
from projects.utils.sql import *
from projects.utils.data_table import *
| python |
from Constants import ALL_LEVELS, CAP_LEVELS, MISSION_LEVELS, BOWSER_STAGES, LVL_BOB, SPECIAL_LEVELS, LVL_MAIN_SCR, LVL_CASTLE_GROUNDS, BEHAVIOUR_NAMES
from randoutils import format_binary
import random
import sys
import numpy as np
from Entities.Object3D import Object3D
import logging
#from Parsers.LevelScript import ... | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: pyenv
short_description: Run pyenv command
options:
always_copy:
description:
- the "--always-c... | python |
#!/usr/bin/env python
#
# Copyright (C) 2016-2020 Wason Technology, 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 ... | python |
from uuid import uuid4
from sqlalchemy import Column, String, Boolean, ForeignKey
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import relationship, backref
from .db import Base
class User(Base):
__tablename__ = "user"
id = Column(UUID(as_uuid=True), primary_key=True, index=True, defau... | python |
# encoding: utf-8
"""
keepalive.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
from exabgp.bgp.message import Message
# =================================================================== KeepAlive
#
class KeepAlive (Message):
ID = Message.CODE.KEEPALIVE
... | python |
import pandas as pd
import os
from IGTD_Functions import min_max_transform, table_to_image
num_row = 30 # Number of pixel rows in image representation
num_col = 30 # Number of pixel columns in image representation
num = num_row * num_col # Number of features to be included for analysis, which is also the total... | python |
import json
import os
from typing import List, Dict, Any
from .._types import TEST_SCHEMA
class TestSchema:
_endpoint_url: str
_paths: Dict[str, List[Any]]
def __init__(self, endpoint_url: str) -> None:
self._endpoint_url = endpoint_url
self._paths = {}
def add_tests(self, path: st... | python |
# Copyright (c) 2019 ISciences, LLC.
# All rights reserved.
#
# WSIM is 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... | python |
import torch
import torch.nn as nn
import torch.functional as tf
from torch.nn.modules.activation import ReLU
from models.m1layers_warpgan.conv2d import CustomConv2d
class StyleController(nn.Module):
"""
Style Controller network.
"""
def __init__(self, args):
"""
... | python |
from multiprocessing import Process
import multiprocessing as mp
import time
class Worker(Process):
def __init__(self, worker_idx, task_queue, result_queue, debug_prints=False):
# call the Process constructor
Process.__init__(self)
self.worker_idx = worker_idx
# the queues for w... | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/3/25 1:39
# @Author : WieAngeal
# @File : ycyl_hander.py
# @Software: PyCharm
from flask import Blueprint, flash, render_template, session, redirect, request
from ..common import (ConsoleLogger, make_response, HttpError,
relative... | python |
from django.shortcuts import render, redirect
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
def index(request):
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWe... | python |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class CartItem(models.Model):
cart = models.ForeignKey('carts.Cart', verbose_name=_('cart'), relat... | python |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# 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... | python |
import json
import os
import pathlib
import re
import datetime
job_log_search_dict = {
'temp_dir1': r"Starting plotting progress into temporary dirs: (.+) and .+\n",
'temp_dir2': r"Starting plotting progress into temporary dirs: .+ and (.+)\n",
'final_dir': r"Final Directory is: (.+)\... | python |
from ddt import ddt, data
from rest_framework.test import APITestCase
@ddt
class TestCookieRequest(APITestCase):
@data('put', 'patch', 'post', 'delete')
def test_generate_csrf_token_for_each_not_safe_method_request(self, http_verb):
request_method = getattr(self.client, http_verb)
first_respon... | python |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'error.ui'
#
# Created by: PyQt5 UI code generator 5.12
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_errorwin(object):
def setupUi(self, errorwin):
errorwin.setObj... | python |
import ops
import iopc
TARBALL_FILE="clutter-1.26.0.tar.xz"
TARBALL_DIR="clutter-1.26.0"
INSTALL_DIR="clutter-bin"
pkg_path = ""
output_dir = ""
tarball_pkg = ""
tarball_dir = ""
install_dir = ""
install_tmp_dir = ""
cc_host = ""
tmp_include_dir = ""
dst_include_dir = ""
dst_lib_dir = ""
def set_global(args):
glo... | python |
import numpy as np
def normalize_features(features):
raise NotImplementedError()
| python |
"""
Produces Fig. 11 of Johnson & Weinberg (2019), a 2-column by 2-row plot
showing the slow burst models. Star formation histories are shown in the top
left, [O/Fe]-[Fe/H] tracks in the top right, [O/Fe] and [Fe/H] against time
in the bottom left, and [O/Fe] against time in the bottom right.
"""
import visuals ... | python |
# -*- coding: utf-8 -*-
import numpy as np
import cv2
img = cv2.imread('images/cameraman.tif',0)
cv2.imshow("Image read in Python", img)
k = cv2.waitKey(0) & 0xFF
if k == 27: # wait for ESC key to exit
cv2.destroyAllWindows()
| python |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module defines the base aperture classes.
"""
import abc
from copy import deepcopy
import numpy as np
from astropy.coordinates import SkyCoord
import astropy.units as u
from .bounding_box import BoundingBox
from ._photometry_utils import (_hand... | python |
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Many point of entry for pydicom read and write functions"""
from pydicom.filereader import (dcmread, read_file, read_dicomdir)
from pydicom.filewriter import dcmwrite, write_file
| python |
from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field
class RecordSearch(BaseModel):
"""
Dao search
Attributes:
-----------
query:
The elasticsearch search query portion
aggregations:
The elasticsearch search aggregations
"""
query: Opt... | python |
from typing import Tuple, Callable
from .template import Processor
from .concat import BatchConcat, BatchPool
from .denoise import Dada2SingleEnd, Dada2PairedEnd
from .importing import ImportSingleEndFastq, ImportPairedEndFastq
from .trimming import BatchTrimGalorePairedEnd, BatchTrimGaloreSingleEnd
class GenerateASV... | python |
import personalnames.titles as titles
import bisect
# noinspection PyTypeChecker
def gen_initials(lastname, firstname, formats, title=None, post_nominal=None, no_ws=False):
"""
Generate the name formats with initials.
:param lastname: person's lastname
:param firstname: person's firstname
:param ... | python |
from typing import List, Union
def is_valid(sides: List[Union[float,int]]) -> bool:
[x, y, z] = sides
return x > 0 and y > 0 and z > 0 and x + y > z
def equilateral(sides: List[Union[float,int]]) -> bool:
sides.sort()
return is_valid(sides) and sides.count(sides[0]) == 3
def isosceles(sides: List[... | python |
import numpy as np
import scipy.sparse as sparse
import scipy.sparse.linalg as linalg
from .mesh import UniformMesh
from .laminate_model import LaminateModel
from .laminate_dof import LaminateDOF
class LaminateFEM(object):
def __init__(self, material, cantilever):
self.cantilever = cantilever
... | python |
"""Falcon benchmarks"""
from bench import main # NOQA
| python |
import os
from pathlib import Path
import pyspark.sql.types as st
from pyspark.sql.types import Row
from pyspark.ml.regression import GBTRegressor
from pyspark.sql import DataFrame, SparkSession
spark = SparkSession.builder \
.appName("karl02") \
.getOrCreate()
datadir: str = os.getenv("DATADIR")
if datadir ... | python |
###############################################################################
# Imports
###############################################################################
from layer import Layer
import numpy as np
class HiddenLayer(Layer):
def setDownstreamSum(self, w, delta):
"""Sum the product o... | python |
# -*- coding: utf-8 -*-
'''
@Time : 2021/8/30
@Author : Yanyuxiang
@Email : yanyuxiangtoday@163.com
@FileName: send_message.py
@Software: PyCharm
'''
import itchat
def main():
itchat.auto_login()
friends = itchat.get_friends(update=True)
# itchat.send('这是来自python程序的一条消息', toUserName='filehelper')
... | python |
from . import scheduler
from app.utils.refresh_mat_views import refresh_all_mat_views
from app.utils.constants import COUNTRIES
# 5/9 = 5am, 2pm, and 11pm
# https://cron.help/#0_5/9_*_*_*
@scheduler.task("cron", minute="0", hour="5")
def run_task_ALL():
with scheduler.app.app_context():
from app.service.r... | python |
import torch
from torch.utils.data import DataLoader
from torch import optim
from torch.optim.lr_scheduler import StepLR
from snf.layers.flowsequential import FlowSequential
from snf.layers.selfnorm import SelfNormConv, SelfNormFC
from snf.train.losses import NegativeGaussianLoss
from snf.train.experiment import Exper... | python |
from VcfNormalize import VcfNormalize
import argparse
import os
#get command line arguments
parser = argparse.ArgumentParser(description='Script to run GATK VariantsToAllelicPrimitives in order to decompose MNPs into more basic/primitive alleles')
parser.add_argument('--gatk_folder', type=str, required=True, help='... | python |
# This file was automatically created by FeynRules 2.3.36
# Mathematica version: 11.3.0 for Linux x86 (64-bit) (March 7, 2018)
# Date: Wed 24 Feb 2021 15:52:48
from object_library import all_couplings, Coupling
from function_library import complexconjugate, re, im, csc, sec, acsc, asec, cot
GC_1 = Coupling(name =... | python |
import AnimatedProp
from direct.actor import Actor
from direct.interval.IntervalGlobal import *
class HQPeriscopeAnimatedProp(AnimatedProp.AnimatedProp):
def __init__(self, node):
AnimatedProp.AnimatedProp.__init__(self, node)
parent = node.getParent()
self.periscope = Actor.Actor(node, co... | python |
from threading import Lock, Thread
from time import sleep
class Ingresso:
def __init__(self, estoque):
self.estoque = estoque
self.lock = Lock()
def comprar(self, quantidade):
self.lock.acquire()
if self.estoque < quantidade:
print("-Não temos ingresso suficientes.... | python |
from functools import partial, wraps
from slm_lab import ROOT_DIR
from slm_lab.lib import logger, util
import os
import pydash as ps
import torch
import torch.nn as nn
logger = logger.get_logger(__name__)
class NoOpLRScheduler:
'''Symbolic LRScheduler class for API consistency'''
def __init__(self, optim):
... | python |
"""
Minimize the Himmelblau function.
http://en.wikipedia.org/wiki/Himmelblau%27s_function
"""
import numpy
import minhelper
def himmelblau(X):
"""
This R^2 -> R^1 function should be compatible with algopy.
http://en.wikipedia.org/wiki/Himmelblau%27s_function
This function has four local minima whe... | python |
import os
import tempfile
from unittest import TestCase
from pubmed_bpe_tokeniser import PubmedBPETokenisor
class TestPubmedBPETokenisor(TestCase):
def test_train(self):
# Arrange
data_file = os.path.join(os.path.dirname(__file__), "data", "sample_pubmed.json")
sut = PubmedBPETokenisor(v... | python |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2020 Intel 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 requ... | python |
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
def generate_launch_description():
# # launch 海龟节点<正常版>
# tur... | python |
from setuptools import setup,find_packages
import lixtools
setup(
name='lixtools',
description="""software tools for data collection/processing at LiX""",
version=lixtools.__version__,
author='Lin Yang',
author_email='lyang@bnl.gov',
license="BSD-3-Clause",
url="https://github.com/NSLS-II-L... | python |
'''
* 'show system status'
'''
import re
from genie.metaparser import MetaParser
from genie.metaparser.util.schemaengine import Optional
# ===========================================
# Schema for 'show system status'
# ===========================================
class ShowSystemStatusSchema(MetaParser):
""" Sc... | python |
from django.conf.urls import patterns, include, url
from tastypie.api import Api
from tastypie_evostream.api import StreamResource
tastypie_evostream_api = Api()
tastypie_evostream_api.register(StreamResource())
urlpatterns = patterns(
'',
url(r'', include(tastypie_evostream_api.urls)),
) | python |
# -*- coding: UTF-8 -*-
from django.db import models
from django.contrib.contenttypes import fields
from django.contrib.contenttypes.models import ContentType
# from south.modelsinspector import add_introspection_rules
# from tagging.models import Tag
# from tagging_autocomplete.models import TagAutocompleteField
from... | python |
# coding: utf-8
'''
------------------------------------------------------------------------------
Copyright 2015 - 2017 Esri
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... | python |
from flask_restful import Resource, reqparse, request
from flask_restful import fields, marshal_with, marshal
from sqlalchemy.exc import IntegrityError
from sqlalchemy import or_, and_, text
from flask_jwt_extended import jwt_required
from models.keyword import Keyword
from app import db
from utils.util import max_res
... | python |
# -*- coding: utf-8 -*-
import unittest
from iemlav.lib.log_monitor.server_log.parser.apache import ApacheParser
from iemlav.lib.log_monitor.server_log.server_logger import ServerLogger
try:
# if python 3.x.x
from unittest.mock import patch
except ImportError: # python 2.x.x
from mock import patch
class... | python |
# Copyright (c) 2019 fortiss GmbH
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
from bark.world.agent import *
from bark.models.behavior import *
from bark.world import *
from bark.world.map import *
from modules.runtime.commons.parameters import ParameterServer
from module... | python |
import os
import pytest
from h2_conf import HttpdConf
def setup_data(env):
s100 = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678\n"
with open(os.path.join(env.gen_dir, "data-1k"), 'w') as f:
for i in range(10):
f.write(s100)
# The tr... | python |
# -*- coding: utf-8 -*-
from mimetypes import MimeTypes
from hashlib import md5
def list_of(_list, _class):
"""
Chequea que la lista _list contenga elementos del mismo tipo, desciptos en _class.
Args:
- _list:
- list().
- Lista de elementos sobre la que se desea trabajar.
... | python |
import unittest
import random
from hypothesis import given, settings, assume, Verbosity, strategies as st
from src.poker.app.card import Deck, Card, Suit, Value
from src.poker.app.hand import Hand, Play, Result, calculate_play_hand
DeckStrategy = st.builds(Deck)
NaiveHandStrategy = st.builds(Hand, st.sets(
st.b... | python |
import numpy as np
# Reshaping arrays:
# Reshaping means changing the shape of an array.
# The shape of an array is the number of elements in each dimension.
# By reshaping we can add or remove dimensions or change number of elements in each dimension.
# **Note: The product of the number of elements inside the Resha... | python |
import re
j_format = {
"j": "000010",
}
i_format = {
'beq': "000100",
'bne': None,
'addi': "001000",
'addiu': None,
'andi': None,
'ori': None,
'slti': None,
'sltiu': None,
'lui': None,
'lw': "100011",
'sw': "101011",
}
r_format = {
'add': "100000",
'addu': None,... | python |
import random
from collections import defaultdict
import numpy as np
from maddpg.common.utils_common import zip_map
class ReplayBuffer(object):
def __init__(self, size):
"""Create Prioritized Replay buffer.
Parameters
----------
size: int
Max number of transitions t... | python |
from arbre_binaire_jeu import *
#-------------------------------------------------------------------------------
# DM MISSION
#
# Objectif : Construire un jeu à partir d'un texte préconstruit
#
# Contrainte : utiliser un arbre binaire
#---------------------------------------------------------... | python |
# coding: utf-8
from olo import funcs
from olo.funcs import COUNT, SUM, AVG, MAX, DISTINCT
from .base import TestCase, Foo, Bar, Dummy
from .fixture import is_pg
from .utils import (
patched_execute, no_pk
)
attrs = dict(
name='foo',
tags=['a', 'b', 'c'],
password='password',
payload={
'ab... | python |
from setuptools import setup
setup(
name='german_transliterate',
version='0.1.3',
author='repodiac',
author_email='spamornot@gmx.net',
packages=['german_transliterate'],
url='http://github.com/repodiac/german_transliterate',
license='CC-BY-4.0 License',
description='german_transliterate can cle... | python |
# This file is part of Sequana software
#
# Copyright (c) 2016-2021 - Sequana Development Team
#
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this software.
#
# website: https://github.com/sequana/sequana
# documentation: http://sequana.r... | python |
import planckStyle as s
g = s.getSubplotPlotter()
g.settings.legend_fontsize -= 3.5
g.settings.lineM = ['-g', '-r', '-b', '-k', '--r', '--b']
pol = ['TT', 'TE', 'EE', 'TTTEEE']
dataroots = [ getattr(s, 'defdata_' + p) for p in pol]
dataroots += [dataroots[1].replace('lowEB', 'lowTEB'), dataroots[2].replace('lowEB', ... | python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python KISS Module Test Constants."""
__author__ = 'Greg Albrecht W2GMD <oss@undef.net>' # NOQA pylint: disable=R0801
__copyright__ = 'Copyright 2017 Greg Albrecht and Contributors' # NOQA pylint: disable=R0801
__license__ = 'Apache License, Version 2.0' # NOQA pyli... | python |
from toolz import get
from functools import partial
pairs = [(1, 2) for i in range(100000)]
def test_get():
first = partial(get, 0)
for p in pairs:
first(p)
| python |
import torch
import torch.nn as nn
import torch.optim as optim
import pytorch_lightning as pl
from network.dla import MOC_DLA
from network.resnet import MOC_ResNet
from trainer.losses import MOCLoss
from MOC_utils.model import load_coco_pretrained_model
backbone = {
'dla': MOC_DLA,
'resnet': MOC_ResNet
}
def... | python |
import os
from django.http import HttpResponse
from django.template import Context, RequestContext, loader
def ajax_aware_render(request, template_list, context=None, **kwargs):
"""
Render a template, using a different one automatically for AJAX requests.
:param template_list: Either a template name... | python |
import logging
import collections
import time
import six
from six.moves import http_client
from flask import url_for, g, jsonify
from flask.views import MethodView
import marshmallow as ma
from flask_restx import reqparse
from flask_smorest import Blueprint, abort
from drift.core.extensions.urlregistry import Endpoin... | python |
#!/usr/bin/env python
"""
Recursively find and replace text in files under a specific folder with preview of changed data in dry-run mode
============
Example Usage
---------------
**See what is going to change (dry run):**
> flip all dates from 2017-12-31 to 31-12-2017
find_replace.py --dir project/myfolde... | python |
# ___________________________________________________________________________
#
# EGRET: Electrical Grid Research and Engineering Tools
# Copyright 2019 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain r... | python |
import os
import cv2
import numpy as np
import random
classnames = ["no weather degradation", "fog", "rain", "snow"]
modes = ["train", "val", "test"]
for classname in classnames:
input_path = "./jhucrowd+weather dataset/{}".format(classname)
images = os.listdir(input_path)
random.shuffle(images)
N = ... | python |
#!/usr/bin/env python
import sys
import time
import random
mn,mx,count = map(int,sys.argv[1:4])
seed = sys.argv[4] if len(sys.argv) > 4 else time.time()
random.seed(seed)
print 'x,y'
for i in xrange(count):
print ','.join(map(str,[random.randint(mn,mx),random.randint(mn,mx)]))
| python |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
# Create your models here.
@python_2_unicode_compatible
class SummaryNote(models.Model):
title = models.CharField(max_length=60)
content = models.TextField... | python |
# Generated by Django 3.0.8 on 2020-07-29 13:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailimages', '0022_uploadedimage'),
('events', '0003_auto_20200725_2158'),
]
operations = [
migr... | python |
"""A CLI utility that aggregates configuration sources into a JSON object."""
import json
import logging
import os
import typing
import cleo
import structlog
import toml
import pitstop
import pitstop.backends.base
import pitstop.strategies
import pitstop.strategies.base
import pitstop.types
__all__... | python |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect, JsonResponse
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.template import loader, Context
from pure_pagination import Paginator, EmptyPage, PageNotA... | python |
import os
import unittest
from bs4 import BeautifulSoup
from parser import Parser
class ParserTestCase(unittest.TestCase):
def setUp(self):
pass
def test_item_info_images(self):
base_url = "https://www.akusherstvo.ru"
page_url = "/catalog/50666-avtokreslo-rant-star/"
page_moc... | python |
from modules import engine
from modules import out
@engine.prepare_and_clean
def execute(key = None):
out.log('These are all configuration settings.')
config_vars = engine.get_config(key)
if key is None:
for k in config_vars:
out.log(k + ' = ' + str(config_vars[k]))
else:
ou... | python |
# 2D dataset loaders
import data.data_hcp as data_hcp
import data.data_abide as data_abide
import data.data_nci as data_nci
import data.data_promise as data_promise
import data.data_pirad_erc as data_pirad_erc
import data.data_mnms as data_mnms
import data.data_wmh as data_wmh
import data.data_scgm as data_scgm
# othe... | python |
# -*- coding: utf-8 -*-
from sqlalchemy.ext.hybrid import hybrid_property
from . import db, bcrypt
from datetime import datetime
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
username = db.Column(db.String(32), index=True, unique=True)
email = db... | python |
"""
Stingy OLX ad message forwarder: check for new message(s) and send them to your email
@author yohanes.gultom@gmail.com
"""
from stingy_olx import StingyOLX
import re
import argparse
import smtplib
email_tpl = '''From: {0}\r\nTo: {1}\r\nSubject: {2}\r\nMIME-Version: 1.0\r\nContent-Type: text/html\r\n\r\n
{3}
'''
... | python |
# encoding: utf-8
# module pandas._libs.reduction
# from C:\Python27\lib\site-packages\pandas\_libs\reduction.pyd
# by generator 1.147
# no doc
# imports
import __builtin__ as __builtins__ # <module '__builtin__' (built-in)>
import numpy as np # C:\Python27\lib\site-packages\numpy\__init__.pyc
from pandas._libs.lib im... | python |
"""
Base threading server class
"""
from threading import Thread
class ThreadServer:
def __init__(self):
self.server_thread = None
self.running = False
def start(self, *args, **kwargs):
if self.running:
return
self.running = True
self.server_thread = Threa... | python |
from dynaconf import FlaskDynaconf
flask_dynaconf = FlaskDynaconf()
def init_app(app, **config):
flask_dynaconf.init_app(app, **config)
app.config.load_extensions()
| python |
# Copyright 2019 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... | python |
from django import forms
from django.http import QueryDict
from django.utils.translation import ugettext_lazy as _
from panoptes.analysis import FilteredSessions
from panoptes.analysis.fields import LensChoiceField, WeekdayChoiceField
from panoptes.core.fields import LocationField
from panoptes.core.models import Ses... | python |
import os
from typing import Any
import torch.optim as optim
import yaml
from aim.sdk.utils import generate_run_hash
from deep_compression.losses import (
BatchChannelDecorrelationLoss,
RateDistortionLoss,
)
def create_criterion(conf):
if conf.name == "RateDistortionLoss":
return RateDistortionL... | python |
# -*- coding: utf-8 -*-
# maya
import pymel.core as pm
from maya.app.general.mayaMixin import MayaQDockWidget
from maya.app.general.mayaMixin import MayaQWidgetDockableMixin
# Built-in
from functools import partial
import os
import sys
import json
import shutil
import subprocess
# mbox
from . import naming_rules_ui ... | python |
from django.shortcuts import render
# Create your views here.
def main(request):
title = 'Travel Freely!'
content = {
'title': title,
}
return render(request, 'mainsite/index.html', context=content) | python |
from empire.python.typings import *
from empire.fs.file_system import FileSystem
from empire.archive.archive_types import ArchiveTypes
from empire.archive.abstract_compression import AbstractCompression
from empire.archive.abstract_archive import AbstractArchive
from empire.archive.zip_ar import Zip
from empire... | python |
"""API urls."""
from rest_framework import routers
from . import viewsets
router = routers.SimpleRouter()
router.register(r"email-providers", viewsets.EmailProviderViewSet)
router.register(r"migrations", viewsets.MigrationViewSet)
urlpatterns = router.urls
| python |
'''
Leia 3 valores de ponto flutuante A, B e C e ordene-os em ordem decrescente, de modo que o lado A representa o maior dos 3 lados. A seguir, determine o tipo de triângulo que estes três lados formam, com base nos seguintes casos, sempre escrevendo uma mensagem adequada:
- se A ≥ B+C, apresente a mensagem: NAO FORMA ... | python |
from esteira.pipeline.stage import Stage
from pathlib import Path
BASE_DIR = Path(__file__).parent.absolute()
def test_instance():
class TestShell(Stage):
script = [
'echo "hello world"'
]
test = TestShell(BASE_DIR)
test.run() | python |
from __future__ import division
import sys
import math
import random
import time
import webbrowser as wb
import keyboard as kb
import pyautogui
from collections import deque
from pyglet import image
from pyglet.gl import *
from pyglet.graphics import TextureGroup
from pyglet.window import key, mouse
from playsound i... | python |
from logging import getLogger
from hornet import models
from .common import ClientCommand
logger = getLogger(__name__)
class Command(ClientCommand):
def add_arguments(self, parser):
parser.add_argument("member_id", type=int)
def handle(self, member_id, *args, **kwargs):
try:
me... | python |
# Copyright DataStax, 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, softwa... | python |
import uuid
import hashlib
import prettytable
from keystoneclient import exceptions
# Decorator for cli-args
def arg(*args, **kwargs):
def _decorator(func):
# Because of the sematics of decorator composition if we just append
# to the options list positional options will appear to be backwards.
... | python |
import multiprocessing
print(multiprocessing.cpu_count(), "núcleos") # conta a quantidade de núcleos disponpives no sistema
# processamento senquancial
import threading # módulo para a a contrução de threads
import urllib.request # módulo para a requição da url
import time # módulo para tratar o tempo
# função criad... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.