src stringlengths 721 1.04M |
|---|
# 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 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import glob
import os
import click
CWD_DIR = os.path.abspath(os.getcwd())
NO_ROOT_DIR_ERROR =... |
#! /usr/bin/env python3
# coding: utf8
import sys
import os
import argparse
from helpers.utils import debug,set_debug
from helpers.utils import show_size
from helpers.url_generater import generate_urls, get_url_index
from helpers import downloaders
from helpers import bilibili_info_extractor
from helpers import video_... |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
import hashlib
import os
from paramgrid import batchjob_args, jobqueue
Opts = batchjob_args.batchArgs('Submit jobs to run chains or importance sample', notExist=True, notall=True,
converge... |
# -*- coding: utf-8 -*-
# This code scrap the data from NYT API via the API keys and stored in vocab_comments table
# Frequency of each word is calculated from stored data and output in a JSON
# Count the number of comments and store in a text file
__author__ = 'simranjitsingh'
import urllib
import time
import datet... |
# This file is part of Py6S.
#
# Copyright 2012 Robin Wilson and contributors listed in the CONTRIBUTORS file.
#
# Py6S is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, o... |
# -*- coding: utf-8 -*-
from kay.ext.testutils.gae_test_base import GAETestBase
from api.shorturls import URLShorten
from core.models import ShortURL, ShortURLUser
class URLShortenTest(GAETestBase):
CLEANUP_USED_KIND = True
USE_PRODUCTION_STUBS = True
def test_get(self):
user = ShortURLUser(key_... |
import numpy
from pyparsing import CaselessLiteral, Combine, Forward, Literal, Optional, Word, ZeroOrMore, alphas, nums
from django.contrib.gis.gdal import GDALRaster
from .const import ALGEBRA_PIXEL_TYPE_GDAL, ALGEBRA_PIXEL_TYPE_NUMPY
class FormulaParser(object):
"""
Deconstruct mathematical algebra expres... |
#! python
# COPYRIGHT: BALTHASAR SCHLOTMANN 2017
# LICENSED UNDER THE GNU GENERAL PUBLIC LICENSE VERSION 3
import sys
import notedict as nd
filename = sys.argv[1]
# from here: https://github.com/bspaans/python-mingus/blob/master/mingus/midi/midi_file_in.py
def parse_varbyte_as_int( array, i):
"""Read a variable l... |
# -*- coding: utf-8 -*-
import sys
#sys.path.append("..")
from bottle import *
from bottle import __version__ as bottleVer
from bottle import jinja2_template as template
from config import JINJA2TPL_PATH
TEMPLATE_PATH.insert(0, JINJA2TPL_PATH)
from config import CFG
#debug(True)
APP = Bottle()
#APP.mount('/up'... |
#!/usr/bin/env python
#
# Answer Box class
#
# object representation of abox, used in Tutor2, now generalized to latex and word input formats.
# 13-Aug-12 ichaung: merge in sari's changes
# 13-Aug-12 ichuang: cleaned up, does more error checking, includes stub for shortanswer
# note that shortanswer ... |
"""
Module responsible for accessing the Metrics data in MongoDB.
Issue: https://github.com/chovanecm/sacredboard/issues/60
"""
from bson import ObjectId
from bson.errors import InvalidId
from sacredboard.app.data import NotFoundError
from .genericdao import GenericDAO
from ..metricsdao import MetricsDAO
class Mon... |
import sys
import pytest
from flask import current_app,url_for
from flask_wtf import Form
from wtforms import TextField
from faker import Faker
import arrow
import uuid
from unifispot.core.models import Wifisite,Device,Guesttrack,Guest,Loginauth,\
Guestsession
from unifispot.core.g... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
LrsError
A QGIS plugin
Linear reference system builder and editor
-------------------
begin : 2013-10-02
copyright ... |
"""
Account constants
"""
from __future__ import absolute_import
from django.utils.text import format_lazy
from django.utils.translation import ugettext_lazy as _
# The maximum length for the bio ("about me") account field
BIO_MAX_LENGTH = 300
# The minimum and maximum length for the name ("full name") account fiel... |
from mock import patch
from django.conf import settings
from django.contrib.auth.models import Group
from django.test import TestCase
from tests.models import TestModel, ShardedTestModelIDs
from django_sharding_library.exceptions import InvalidMigrationException
from django_sharding_library.router import ShardedRoute... |
from sklearn.cross_validation import LabelKFold
import common
import glob
import itertools
import keras_related
import numpy as np
import os
import pandas as pd
import prepare_data
import pyprind
import solution_basic
import time
METRIC_LIST_DICT = {
"_open_face.csv": ["correlation", "l1", "euclidean", "braycurtis... |
"""
Test conversion from integer to Roman numeral
"""
from typing import Any
import pytest
from roman_numerals import LOWERCASE, convert_to_numeral
from .parameters import LOWERCASE_PARAMETERS, STANDARD_PARAMETERS
@pytest.mark.parametrize(
"decimal_integer, expected_numeral",
STANDARD_PARAMETERS)
def test_... |
# -*- coding: utf-8 -*-
import hashlib
import json
import time
from ..base.multi_account import MultiAccount
class SmoozedCom(MultiAccount):
__name__ = "SmoozedCom"
__type__ = "account"
__version__ = "0.13"
__status__ = "testing"
__config__ = [
("mh_mode", "all;listed;unlisted", "Filter... |
import json
import operator
class ComparisonEngine:
"""
Queries the performance tools' APIs and determines if the build passes
the target requirements.
"""
def check_health_severity(self, violation):
"""
Fails the build if the defined severity is found in the health rule
vi... |
from unittest import TestCase
from tools.template_handler import TemplateHandler
test_title = "vorlage"
test_title_sperr = "Sperrsatz"
test_title_test = "testtitle"
test_string_argument_1 = "1=test1"
test_string_argument_1_no_key = "test1"
test_string_argument_2 = "2=test2"
test_string_argument_3 = "test3"
test_stri... |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impor... |
"""Global variables associated to the test suite."""
#: List of CPP variables that should be defined in config.h in order to enable this suite.
need_cpp_vars = [
]
#: List of keywords that are automatically added to all the tests of this suite.
keywords = [
]
#: List of input files
inp_files = [
"t01.in",
"t02.in",... |
from abc import ABCMeta, abstractmethod
from Lexer import RELATIONAL_OPERATOR
class OPERATOR:
PLUS = "+"
MINUS = "-"
DIV = "/"
MUL = "*"
class TYPE_INFO:
TYPE_ILLEGAL = -1
TYPE_NUMERIC = 0
TYPE_BOOL = 1
TYPE_STRING = 2
class SYMBOL_INFO:
def __init__(self, symbol_name=None... |
# _*_ coding:utf-8 _*_
#qpy:webapp:babyrecord
#qpy:fullscreen
#qpy://localhost:8800
"""
Babyrecordapp
@Author Picklecai
"""
import os
from os.path import exists
from bottle import Bottle, ServerAdapter, request, template
import sqlite3
import time
import datetime
from email.header import Header
ROOT = os.path.dirnam... |
# -*- coding: utf-8 -*-
#
# numconv documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 13 01:06:14 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... |
# Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
import os
from os import environ
from os.path import abspath, dirname
import sys
sys.path.append(abspath(dirname(dirname(__file__))))
os.environ['DJANGO_SETTINGS_MODULE']... |
#
# Copyright (c) ,2010 Matteo Boscolo
#
# This file is part of PythonCAD.
#
# PythonCAD 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 2 of the License, or
# (at your option) any later version... |
"""
Copyright (c) German Cancer Research Center,
Computer Assisted Interventions.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE for details
"""
'''
Created on Aug 19, 2016
@author: avemu... |
import pytest
from marshmallow import ValidationError
from puzzle_app.schemas.hitori import (
HitoriGameBoardCellSchema,
HitoriGameBoardSchema,
HitoriSolveSchema
)
def _new_dict_without_keys(dictionary, keys):
new_dict = dict(dictionary)
for key in keys:
del new_dict[key]
return ne... |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Mercurial Contributors.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
# isort:skip_file
from __future__ import absolute_import
import da... |
__author__ = 'yinjun'
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
this.val = val
this.left, this.right = None, None
"""
class Solution:
'''
@param root: An object of TreeNode, denote the root of the binary tree.
This method will be invoked first, you should des... |
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# --------------------------------------------... |
import OpenPNM
import scipy as sp
import matplotlib.pyplot as plt
import OpenPNM.Utilities.vertexops as vo
class VertexOpsTest:
def setup_class(self):
bp = sp.array([[0.2, 0.2, 0.2], [0.2, 0.8, 0.2], [0.8, 0.2, 0.2],
[0.8, 0.8, 0.2], [0.2, 0.2, 0.8], [0.2, 0.8, 0.8],
... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.api import Environment
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
from datetime import date, timedelta
import odoo.tests
class TestUi(odoo.tests.HttpCase):
def test_01_pos_basic_order(self):
... |
# -*- coding: utf-8 -*-
import unittest
from noseachievements.achievements.base import Achievement
from noseachievements.compat import unicode
from helpers import (PASS, TestPlugin, NeverUnlockedAchievement,
AlwaysUnlockedAchievement)
class TestAchievement(TestPlugin):
achievement = NeverUnlockedAchievement... |
'''
How to run:
$ source ~/Documents/tensorflow/bin/activate
$ cd Documents/DeskBot-Zero/neural-net/keras
$ python neuralNet.py
Heavily based on:
https://github.com/keras-team/keras/blob/master/examples/cifar10_cnn.py
'''
import os
import keras
from keras.preprocessing.image import ImageDataGenerator
from keras.model... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import unittest
from dashboard import email_te... |
# -*- coding: utf-8 -*-
'''
Queries for experiments with preference operators
'''
# =============================================================================
# Queries with preference operators
# =============================================================================
# Moves
Q_MOVE_BESTSEQ = '''
SELECT SEQUE... |
# encoding: utf-8
from __future__ import print_function, unicode_literals
from datetime import datetime, timedelta, date
from django.core.files import File
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.utils.timezone import now
from wagtail.wagtailco... |
import planckStyle as s
from paramgrid import batchjob
from pylab import *
from getdist.densities import Density2D
roots = ['base_' + s.defdata + '_lensing']
g = s.getSinglePlotter(ratio=1)
pars = g.get_param_array(roots[0], ['FAP057', 'fsigma8z057'])
def RSDdensity(FAPbar, f8bar, covfile):
incov = loadtxt(cov... |
# -*- coding: UTF-8 -*-
from django.db import models
from apps.seguridad.models import Credencial, TipoAmbito
class Rol(models.Model):
ROL_ADMIN_NACIONAL = 'AdminNacional'
ROL_ADMIN_SEGURIDAD = 'AdminSeguridad'
ROL_REFERENTE_JURISDICCIONAL = 'ReferenteJurisdiccional'
ROL_REFERENTE_INSTITUCIONAL ... |
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=no-init,invalid-name
from __... |
# Copyright (C) 2013 ABRT Team
# Copyright (C) 2013 Red Hat, Inc.
#
# This file is part of faf.
#
# faf 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) ... |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# setuidsnoop Trace uid changes issued by the setuid() syscall.
# For Linux, uses BCC, eBPF. Embedded C.
#
# USAGE: setuidsnoop [-h] [-p PID]
#
# Copyright (c) 2016 Brendan Gregg, Sasha Goldshtein.
# Licensed under the Apache License, Version ... |
import json
from django.urls import reverse
from grants.models import Grant, GrantCategory, GrantType
from grants.views import basic_grant_categories
from test_plus.test import TestCase
class GrantsViewResponsesTests(TestCase):
# def test_not_authorized(self):
# response = self.client.post(reverse('gran... |
# Samuel DeLaughter
# 5/8/15
from SimpleXMLRPCServer import SimpleXMLRPCServer
from threading import Thread
import xmlrpclib
import logging
import socket
import random
import time
import iot
class door(iot.device):
#The class defining the door sensor object
#Can be set to open (1) or closed (0), or queried for its ... |
### Copyright (C) 2002-2006 Stephen Kennedy <stevek@gnome.org>
### Copyright (C) 2009 Vincent Legoll <vincent.legoll@gmail.com>
### Copyright (C) 2012 Kai Willadsen <kai.willadsen@gmail.com>
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public Licens... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Prepare data for diffuse all-sky analysis
"""
from __future__ import absolute_import, division, print_function
import os
import math
import yaml
from fermipy.jobs.utils import is_null
from fermipy.jobs.link import Link
from fermipy.jobs.chain import... |
import os
import time
import bsddb3 as bsddb
'''
Retrieve records with a given key
- Modified and simplified based on the old version
- Has the same format and assumption as ret_DATA()
Tested under DB_SIZE = 10
'''
DB_FILE = "/tmp/yishuo_db/sample_db"
SDB_FILE = "/tmp/yishuo_db/IndexFile"
def ret_KEY(filetype):
... |
from selvbetjening.core.events.models.options import AutoSelectChoiceOption, DiscountOption
from selvbetjening.core.events.options.widgets import BooleanWidget, TextWidget, ChoiceWidget, AutoSelectBooleanWidget, AutoSelectChoiceWidget, DiscountWidget
from selvbetjening.core.events.options.scope import SCOPE
from selvb... |
#!/usr/bin/python
# this script will update the versions in plist and installer files to match that in resource.h
import plistlib, os, datetime, fileinput, glob, sys, string
scriptpath = os.path.dirname(os.path.realpath(__file__))
def replacestrs(filename, s, r):
files = glob.glob(filename)
for line in filein... |
#!/usr/bin/python3
# vim: set fileencoding=utf-8 :
#
# (C) 2017 Guido Günther <agx@sigxcpu.org>
# 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 2 of the License, or
# ... |
import os
import re
from setuptools import setup as setup
def read(path):
global os
with open(os.path.join(os.path.dirname(__file__), path), 'r') as f:
data = f.read()
return data.strip()
def get_version():
global os, re, read
_version_re = re.compile(r'\s*__version__\s*=\s*\'(.*)\'\s*')... |
from leetcode import ListNode
class Solution:
# @param head, a ListNode
# @param k, an integer
# @return a ListNode
def reverseKGroup(self, head, k):
if not head or not head.next or k==1:
return head
newhead = None
head = head
tail = head
prev = Non... |
import pandas as pd
import numpy as np
# from memory_profiler import profile
# from memprof import *
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
#get_ipython().magic('matplotlib inline')
# @memprof
def test_ozone_debug_perf():
b1 = tsds.load_ozone()
df = b1.mPastData
# df... |
#!/usr/bin/env python
from __future__ import print_function, unicode_literals
import datetime
import os
import sys
from subprocess import check_call
import requests
from apscheduler.schedulers.blocking import BlockingScheduler
from decouple import config
from pathlib2 import Path
schedule = BlockingScheduler()
DEA... |
##############################################################################
#
# Copyright (c) 2004 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Member.member_number'
db.add_column(u'stexchange_member', 'member_number',
... |
<?py
import os
from datetime import datetime
path = postvars['path']
dir = postvars['dir']
def fsize(num, suffix='B'):
for unit in ['','K','M','G','T','P','E','Z']:
if abs(num) < 1024.0:
return "%3.0f %s%s" % (num, unit, suffix)
num /= 1024.0
return "%.1f%s%s" % (num, 'Y', suffix)
?... |
from django import forms
from oscar.core.loading import get_model
from django.utils.translation import ugettext_lazy as _
Voucher = get_model('voucher', 'Voucher')
Benefit = get_model('offer', 'Benefit')
Range = get_model('offer', 'Range')
class VoucherForm(forms.Form):
"""
A specialised form for creating a ... |
# -*- coding: utf-8 -*-
# IDD3 - Propositional Idea Density from Dependency Trees
# Copyright (C) 2014-2015 Andre Luiz Verucci da Cunha
#
# 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 ... |
"""
Solution to HW 2 by Breno Gomes
"""
import hashlib
def join_and_hash(str1, str2):
return hashlib.sha256(str1.encode("utf-8") + str2.encode("utf-8")).hexdigest()
class MerkleTree:
def __init__(self, content):
# SORTING SO SAME SUBSETS GENERATE SAME MERKEL TREE
self.content = sorted(conte... |
from highton.models import HightonModel
from highton.highton_constants import HightonConstants
from highton import fields
from highton import call_mixins
class Comment(
HightonModel,
call_mixins.DetailCallMixin,
call_mixins.CreateCallMixin,
call_mixins.UpdateCallMixin,
call_mixins.DeleteCallMixin,... |
#!/usr/bin/env python3
from copy import copy
import pyglet
from pyglet import gl
import settings
from sprites import Bird, Background, Floor, Pipe
from utils import get_sprite, check_collision
def main(callback=None):
#global score set to -1 because on first pipe score is increased
global score
score = ... |
POLONIEX_REPAIRS = {
"1cr": "1CR",
"aby": "ABY",
"adn": "ADN",
"amp": "AMP",
"arch": "ARCH",
"bbr": "BBR",
"bcn": "BCN",
"bcy": "BCY",
"bela": "BELA",
"bitcny": "BITCNY",
"bits": "BITS",
"bitusd": "BITUSD",
"blk": "BLK",
"block": "BLOCK",
"btcd": "BTCD",
"... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import codecs
import time
import json
import logging
import os
from datetime import datetime
from lib.cuckoo.core.database import Database
from lib.cu... |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.9.7.
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
# ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-07 21:45
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... |
# S3Boto storage settings for photologue example project.
import os
DEFAULT_FILE_STORAGE = 'plog.storages.s3utils.MediaS3BotoStorage'
STATICFILES_STORAGE = 'plog.storages.s3utils.StaticS3BotoStorage'
try:
# If you want to test the example_project with S3, you'll have to configure the
# environment variables ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
import math
use_gpu = torch.cuda.is_available()
# class SimpleNet(nn.Module):
# def __init__(self, num_classes=1, n_dim=3):
# sup... |
#!/usr/bin/env python
# Trains a CIFAR10 model based on Nervana Neon sample code
# Then, tries to recognize an image, sanity-checks recognition
#
# (c) oomwoo.com 2016
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3.0
# as ... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Set up a browser environment before running a test.
"""
import os
import re
import tempfile
import mozfile
from moz... |
# -*- coding: utf-8 -*-
# Copyright 2013 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... |
"""
Test of get_diff function
"""
from pydeepdiff.diff import get_diff
def test_empty_diff():
diff = []
obj_a = {
'id': 'cabinetinfirmière',
'blocs_reponses': [
{
'activites_affichage_immediat': [
{
'suggestion_edito... |
#!/usr/bin/env python3
# This code can run in both Python 2.7+ and 3.3+
import cgi
from flask import Flask, Markup
import flask
import json
import requests
import six
import six.moves.urllib as urllib # use six for python 2.x compatibility
import traceback
DEBUGMODE=False
try:
from config_local import * #use to ... |
import json
from os import linesep
from urllib2 import Request, urlopen
from string import capwords
from django.conf import settings
from django.core.mail import send_mail
from django.contrib.auth.decorators import login_required
from django.contrib.messages.views import SuccessMessageMixin
from django.utils import ti... |
# Copyright (C) 2015 University of Nebraska at Omaha
#
# This file is part of dosocs2.
#
# dosocs2 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 2 of the License, or
# (at your option) any lat... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [('ws', '0019_2020_ws_application')]
operations = [
migrations.AlterField(
model_name='climbingleaderapplication',
name='familiarity_spotting',
field=models.CharField(
... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
import markupfield.fields
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
... |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2016 Bastian Kleineidam
#
# 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 later version.
#... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# seriesly - XBMC Plugin
# http://blog.tvalacarta.info/plugin-xbmc/seriesly/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os
import sys
import xbmc,time
from core im... |
class Expression:
"""
Class representing a expression node in the AST of a MLP
"""
def __init__(self):
self.indice = -1
self.identifier = None
self.identifierName = None
self.identifierList = None
self.isInSet = False
self.isSet = None
self.isVar ... |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
n_classes = 10
batch_size = 128
x = tf.placeholder('float', [None, 784])
y = tf.placeholder('float')
keep_rate = 0.8
keep_prob = tf.placeholder(tf.float32)
def conv2d(x,... |
# Copyright 2019 the wasserstein_fairness 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from collections import namedtuple
PUPPETDB_HOST = 'localhost'
PUPPETDB_PORT = 49205
OPERATORS = [
'=',
'~',
'>',
'<'
]
#
RE_OPERATOR = r'(?P<fact>.+)(\s+|)(?P<operator>[%s])(\s+|)(?P<value>.*)' \
% "".join(OPERATORS)
def unique_... |
import os
from setuptools import setup
setup(
name = "SimpleS3Backup",
version = "0.2",
author = "Dewey Sasser",
author_email = "dewey@sasser.com",
description = ("A simple backup script that saves artbitrary command output to s3 in a rotating series of files"),
license = "Artistic License",
... |
try:
from collections.abc import MutableMapping
except ImportError:
from collections import MutableMapping
import logging
import threading
import struct
try:
import can
from can import Listener
from can import CanError
except ImportError:
# Do not fail if python-can is not installed
can = N... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
ZetCode PyQt4 tutorial
In the example, we draw randomly 1000 red points
on the window.
author: Jan Bodnar
website: zetcode.com
last edited: September 2011
"""
import sys, random
from PyQt4 import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self... |
import re
import html
from ralybot import hook
from ralybot.util import http
twitch_re = re.compile(r'(.*:)//(twitch.tv|www.twitch.tv)(:[0-9]+)?(.*)', re.I)
multitwitch_re = re.compile(r'(.*:)//(www.multitwitch.tv|multitwitch.tv)/(.*)', re.I)
def test_name(s):
valid = set('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijk... |
"""Defines the database models for datasets"""
from __future__ import absolute_import, unicode_literals
import copy
import logging
from collections import namedtuple
import django.contrib.postgres.fields
from django.db import models, transaction
from django.db.models import Q, Count
from data.data import data_util
f... |
import random
from math import ceil
import simpy #for simulating battle
#Program written by Charlie Staich
# staichcs@mail.uc.edu
# in fulfillment of Katas excercise for Roto
# To use, simply run in a console. You will be prompted with an easy menu.
#Purpose: an RPG item generator and battle simulator
# Bat... |
# Made by mtrix - v0.2 by DrLecter
import sys
from net.sf.l2j.gameserver.model.quest import State
from net.sf.l2j.gameserver.model.quest import QuestState
from net.sf.l2j.gameserver.model.quest.jython import QuestJython as JQuest
ORB = 4364
ECTOPLASM = 4365
ADENA = 57
CHANCE = 65
RANDOM_REWARDS=[[951,1], #Enchant We... |
from itertools import imap
import time
import sys
import os
import pwd
import platform
import random
from math import log
def neighborhood(coordPivot = [0, 1, 0, 1, 0, 1, 0]):
thisCmd = "B.coord.neighborhood"
ABOUT = """
Procedure {} takes a binary coordinate such as 0101010 (here of
size L = 7) and returns a... |
#!/usr/bin/python
# author: greyshell
"""
[+] problem description
=======================
find the factorial of a number
1) recursive two_sum
2) tail recursive two_sum
[+] reference
=============
TBD
"""
def tail_recursion_driver(n):
"""
tail recursive two_sum
:param n: int
:return: int
"""
... |
import math
import numpy as np
import matplotlib
matplotlib.use('SVG')
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
x1 = 2.
x = np.linspace(0, x1, 100)
ax.plot(x, np.exp(-5. * x), linewidth=2, label = '$x(t)$')
N = 4
h = x1 / N
sx = np.linspace(0, x1, N + 1)
sy = [(1 - 5. * h)**n for n in range(N + 1)... |
from __future__ import absolute_import, unicode_literals
import functools
import logging
import os
import socket
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.websocket
import mopidy
from mopidy import core, models
from mopidy.internal import encoding, jsonrpc
logger = logging.getLo... |
"""switch ksp_version to game_version
Revision ID: 6ffd5dd5efab
Revises: 4e0500347ce7
Create Date: 2016-04-08 22:58:14.178434
"""
# revision identifiers, used by Alembic.
revision = '6ffd5dd5efab'
down_revision = '4e0500347ce7'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('modve... |
"""Helper base class for testing scanners."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from datetime import datetime
from datetime import timedelta
import os
import unittest.mock as mock
from sqlalchemy.orm import sessionmaker
from google.cloud.fors... |
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import pandas as pd
from transfer_features import *
# process training data
biz2label = pd.read_csv("rawdata/train.csv", index_col=0)
photo2biz = pd.read_csv("rawdata/train_photo_to_biz_ids.csv", index_col=0)
biz2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.