src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-01-15 08:34
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
... |
#
# This file is part of Gruvi. Gruvi is free software available under the
# terms of the MIT license. See the file "LICENSE" that was provided
# together with this source file for the licensing terms.
#
# Copyright (c) 2012-2017 the Gruvi authors. See the file "AUTHORS" for a
# complete list.
from __future__ import a... |
"""
This is an example for vpython
you need to install vpython to run this code.
"""
from vpython import *
# Bruce Sherwood
N = 3 # N by N by N array of atoms
# Surrounding the N**3 atoms is another layer of invisible fixed-position atoms
# that provide stability to the lattice.
k = 1
m = 1
spacing = 1
atom_radius = ... |
import csv, json, re
from collections import defaultdict, Counter
from unidecode import unidecode
from util import *
def extract_domain(url):
# extract domains
domain = url.lower().split('/')[2]
domain_parts = domain.split('.')
# e.g. co.uk
if domain_parts[-2] not in ['com', 'co']:
retur... |
# -*- 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 or... |
# Author: Yang Long <longyang_123@yeah.net>
#
# License: LGPL-2.1
import numpy as np
def Laplacian(parents,rank,distance,LB,UB,IntCon,args):
'''
Laplacian Crossover Operator (Two parents, Two childs: Son & Girl)
'''
a = 0
breal = 0.5
bint = 0.75
if args.has_key('a'):
a = args['a']
... |
# urllib3/request.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
try:
from urllib.parse import urlencode
except ImportError:
from urllib import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/5/28 20:50
# @Author : BlackMatrix
# @Sit :
# @File : config.py
# @Software : PyCharm
import os
__author__ = 'blackmatrix'
class BaseConfig:
DEBUG = True
TESTING = False
HOST = '0.0.0.0'
PORT = 8080
WORKS = 5
SITE_NAME = 'ApiZen'... |
#!/usr/bin/env python
#
# Copyright 2010 Facebook
#
# 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 a... |
#!/usr/bin/env python
# coding: utf-8
import unittest
import nose
import traitlets
import cesiumpy
class TestPinBuilder(unittest.TestCase):
def test_pinbuilder_default(self):
p = cesiumpy.Pin()
exp = """new Cesium.PinBuilder().fromColor(Cesium.Color.ROYALBLUE, 48.0)"""
self.assertEqual... |
# Copyright (c) 2010-2012 ARM Limited
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation of the functiona... |
#!/usr/bin/env python
"""Wordnik.com's Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger
templates."""
from __future__ import print_function
import sys
import... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Based on AboutNil in the Ruby Koans
#
from runner.koan import *
class AboutNone(Koan):
def test_none_is_an_object(self):
"Unlike NULL in a lot of languages"
self.assertEqual(True, isinstance(None, object)) # so isinstance(1, 2) checks whether 1 ... |
import unittest
from .test_credentials import TEST_API_KEY, TEST_COLLECTION_ID, TEST_ENDPOINT_URL, TEST_ITEM_ID
from yomeka.classic.no_such_omeka_classic_collection_exception import NoSuchOmekaClassicCollectionException
from yomeka.classic.no_such_omeka_classic_item_exception import NoSuchOmekaClassicItemException
fro... |
# -*- coding: utf-8 -*-
# (c) 2011-2018 Andreas Motl <andreas.motl@ip-tools.org>
import os
import where
import logging
import datetime
import StringIO
import subprocess
from six import BytesIO
from tempfile import NamedTemporaryFile
from cornice.util import to_list
from patzilla.util.python.decorators import memoize
fr... |
from setuptools import setup, find_packages
import os
version = '0.1'
setup(name='collective.pfg.skiplogic',
version=version,
description="Adds skip logic capabilities to ploneformgen forms",
long_description=open("README.txt").read() + "\n" +
open(os.path.join("docs", "HISTOR... |
# force floating point division. Can still use integer with //
from __future__ import division
# other good compatibility recquirements for python3
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
# This file is used for importing the common utilities ... |
# Copyright 2017 Workonline Communications (Pty) Ltd. All rights reserved.
#
# The contents of this file are 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/LIC... |
from java import awt
from math import *
from jarray import array
class Graph(awt.Canvas):
def __init__(self):
self.function = None
def paint(self, g):
if self.function is None:
return self.error(g)
sz = se... |
from optparse import make_option
import os
import zipfile
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""
Addon upload process.
Usage:
example:
python manage.py uplo... |
import sys
import json
import time
import hmac
import urllib
import base64
import random
import hashlib
import urlparse
import tornado.web
import tornado.gen
import tornado.log
import tornado.ioloop
import tornado.httputil
import tornado.httpclient
from g import g
from config import config as c
GET = 'GET'
POST = 'POS... |
"""Offer template automation rules."""
import logging
import voluptuous as vol
from homeassistant import exceptions
from homeassistant.const import CONF_FOR, CONF_PLATFORM, CONF_VALUE_TEMPLATE
from homeassistant.core import callback
from homeassistant.helpers import config_validation as cv, template
from homeassistan... |
"""Tests for the EcoData Retriever"""
import os
from StringIO import StringIO
from retriever.lib.engine import Engine
from retriever.lib.table import Table
from retriever.lib.templates import BasicTextTemplate
from retriever.lib.tools import getmd5
from retriever import DATA_WRITE_PATH
from nose.tools import with_setu... |
'''
New Integration Test for creating KVM VM with ISO, the Root Disk Size is not a multiple of 512.
@author: Legion
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.operations.image_operations as i... |
#!/usr/bin/env python
import re, os, signal, time, filecmp, stat, fileinput
import yaml
from gppylib.commands.gp import GpStart, chk_local_db_running
from gppylib.commands.base import Command, ExecutionError, REMOTE
from gppylib.db import dbconn
from gppylib.gparray import GpArray, MODE_SYNCHRONIZED
from gppylib.operat... |
# -*- coding: utf8 -*-
# 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, softwar... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2010-2011 University of California, Berkeley, 2005-2009 University of Washington
# See opus_core/LICENSE
# Functions to work around numpy/scipy bug -- need to fix the char and num attributes of arrays with dtype==int32
# to get them to work with ndimage.sum ... |
# Copyright (C) 2012 Red Hat, Inc.
#
# 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
# (at your option) any later version.
#
# This program is distributed in... |
#!/usr/bin/python
from __future__ import print_function
import sys
import os
import glob
import itertools
import argparse
from flask import Flask
import openpyxl
import requests
from server.app import app
from server.models import *
from server.api import get_categories
# Expected spreadsheet headers
HEADERS = [('... |
"""
pdf2image custom buffer parsers
"""
from io import BytesIO
from PIL import Image
def parse_buffer_to_ppm(data):
"""Parse PPM file bytes to Pillow Image"""
images = []
index = 0
while index < len(data):
code, size, rgb = tuple(data[index : index + 40].split(b"\n")[0:3])
siz... |
# -*- coding: UTF-8 -*-
import scarlett
import pygst
pygst.require('0.10')
import gobject
gobject.threads_init()
import dbus
import dbus.service
# TODO: Figure out if we need this or not, re dbus threading
# from dbus.mainloop.glib import DBusGMainLoop
# dbus_loop = DBusGMainLoop(set_as_default=True)
# dsession = Se... |
import os
from xml.etree.ElementTree import parse
import re
import sys
if len(sys.argv) == 2:
tree = parse(sys.argv[1])
else:
sys.exit(0)
target = ""
domre = re.compile('HOST')
secre = re.compile('[Ss][Ee][Cc][Uu][Rr][Ee];?')
htore = re.compile('[Hh][Tt]{2}[Pp]-[Oo][Nn][Ll][Yy];?')
class Hea... |
#!/usr/bin/python3
# rnglib/setup.py
""" Setuptools project configuration for rnglib. """
from os.path import exists
from setuptools import setup
long_desc = None
if exists('README.md'):
with open('README.md', 'r') as file:
long_desc = file.read()
setup(name='rnglib',
version='1.3.10',
autho... |
# Used to add words to the stoplist
from nltk.corpus import stopwords
stop = stopwords.words(u'english')
# Add Stopwords
stop.append(u"of")
stop.append(u"the")
stop.append(u"not")
stop.append(u"to")
stop.append(u"or")
stop.append(u"this")
stop.append(u"all")
stop.append(u"on")
stop.append(u"with")
stop.append(u"we")
... |
# -*- coding: utf-8 -*-
__author__ = 'Garrett Pennington'
__date__ = '02/07/14'
from .core import MarvelObject, DataWrapper, DataContainer, Summary, List
class EventDataWrapper(DataWrapper):
@property
def data(self):
return EventDataContainer(self.marvel, self.dict['data'])
class EventDataContainer(... |
#! /usr/bin/env python
import os
import sys
try:
from ovirtsdk.api import API
from ovirtsdk.xml import params
except:
print "Please re-run after you have installed 'ovirt-engine-sdk-python'"
print "Example: easy_install ovirt-engine-sdk-python"
sys.exit()
ENV_IP = "OVIRT_IP"
ENV_USERNAME = "OVIRT... |
import pygame,os
pygame.mixer.init()
class Sounds:
levelOnePath = "assets"+ os.sep + "levelonemusic.ogg"
levelTwoPath = "assets"+os.sep + "leveltwomusic.ogg"
levelThreePath = "assets"+ os.sep + "levelthreemusic.ogg"
bossPath = "assets"+ os.sep + "bossmusic.ogg"
levelOnePathExists = os.path.exists(levelOnePath)... |
"""Test the colorlog.escape_codes module."""
from colorlog.escape_codes import escape_codes, esc, parse_colors
import pytest
def test_esc():
assert esc(1, 2, 3) == "\033[1;2;3m"
def test_reset():
assert escape_codes["reset"] == "\033[0m"
def test_bold_color():
assert escape_codes["bold_red"] == "\03... |
# -*- coding: utf-8 -*-
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from ui_frmVisual import Ui_Dialog
import ftools_utils
import math
class VisualDialog( QDialog, Ui_Dialog ):
def __init__( self, iface, function ):
QDialog.__init__( self )
self.iface = iface
self.setupUi... |
from datetime import datetime, timedelta
from django.db import models
from django.db.models import F
from django.core import signing
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.contrib.auth.models import User
from theme.models import UserProfile
from .utils imp... |
import os, platform, re, shutil
def get_tree_size(path = '.'):
"""
get_tree_size will return the total size of a directory tree
"""
if not os.path.exists(path):
raise OSError("Path " + str(path) + " does not exist!")
total_size = 0
for dirpath, dirnames, filenames in os.walk(str(path))... |
# -*- coding: utf-8 -*-
"""SQLite parser plugin for Google Chrome cookies database files."""
from dfdatetime import webkit_time as dfdatetime_webkit_time
from plaso.containers import events
from plaso.containers import time_events
from plaso.lib import definitions
# Register the cookie plugins.
from plaso.parsers imp... |
from django.conf import settings
from django.core.mail import send_mail
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from contact.models import ContactForm
from recaptcha.client import captcha
def index(request):
msg = ''
if request.method == 'POST': # If... |
# Copyright © 2016 Lars Peter Søndergaard <lps@chireiden.net>
# Copyright © 2016 FichteFoll <fichtefoll2@googlemail.com>
#
# This file is part of Shanghai, an asynchronous multi-server IRC bot.
#
# Shanghai is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... |
import hashlib
from unipath import Path
class ListKeys(list):
def __init__(self, user, *args, **kwargs):
super(ListKeys, self).__init__(*args, **kwargs)
self.user = user
def append(self, key):
key_path = Path(str(key))
if key_path.isfile():
with open(str(key_path... |
'''Attach generally useful information, not specific to any package.
Copyright (C) 2009 Canonical Ltd.
Authors: Matt Zimmerman <mdz@canonical.com>,
Brian Murray <brian@ubuntu.com>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as publ... |
from insights.parsers.journal_since_boot import JournalSinceBoot
from insights.tests import context_wrap
MSGINFO = """
-- Logs begin at Wed 2017-02-08 15:18:00 CET, end at Tue 2017-09-19 09:12:59 CEST. --
May 18 15:13:34 lxc-rhel68-sat56 jabberd/sm[11057]: session started: jid=rhn-dispatcher-sat@lxc-rhel6-sat56.redhat... |
# 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 +
""" The SANSConfigurations class holds instru... |
#!usr/bin/env/python
import numpy as np
import pylab as pl
from matplotlib.colors import ListedColormap
from sklearn import neighbors
def kNNGen(trainfile, testfile):
features = np.genfromtxt(trainfile, delimiter=' ', usecols=(0, 1, 2))
labels = np.genfromtxt(trainfile, delimiter=' ', usecols=(-1))
tests = np.genf... |
import pytest
from configmanager import Item, ItemAttribute, Config
from configmanager.utils import not_set
def test_custom_item_class_as_item_factory():
class CustomItem(Item):
is_custom = ItemAttribute(name='is_custom', default=True)
config = Config({
'a': {
'b': 1,
... |
__source__ = 'https://leetcode.com/problems/permutation-sequence/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/permutation-sequence.py
# Time: O(n)
# Space: O(1)
# Math
#
# Description: Leetcode # 60. Permutation Sequence
#
# The set [1,2,3,...,n] contains a total of n! unique permutations.
#
# By listin... |
# Copyright 2020 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
# coding=utf-8
# 2-dimensional ising model with visualization
# Written by Kyrre Ness Sjoebaek
from __future__ import division
import matplotlib.pyplot as plt
from numba import jit
import numpy
import numpy as np
import sys
import math
import pygame
from timeit import default_timer as timer
from scipy import integrate
... |
'''This module holds the code that allows to analyze the alignment search
result analysis.
It can deal with blasts, iprscan or ssaha2 results.
This results can be parsed, filtered and analyzed.
This module revolves around a memory structure that represents a blast or
an iprscan result. The schema of this structure is... |
# test_serialization.py - unit tests for serializing resources
#
# Copyright 2011 Lincoln de Sousa <lincoln@comum.org>.
# Copyright 2012, 2013, 2014, 2015, 2016 Jeffrey Finkelstein
# <jeffrey.finkelstein@gmail.com> and contributors.
#
# This file is part of Flask-Restless.
#
# Flask-Restless is distributed un... |
from __future__ import unicode_literals
import os
from mopidy import config, ext
__version__ = '0.1.0'
class Extension(ext.Extension):
dist_name = 'Mopidy-IRControl'
ext_name = 'IRControl'
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file_... |
#!/usr/bin/env python
#
# Copyright (C) 2008 Rico Schiekel (fire at downgra dot de)
#
# 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 (at your option) any l... |
# Copyright 2008-2015 Nokia Solutions and 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 applicable l... |
# 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, software
# distributed under the Li... |
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Invokes git bisect to find culprit commit inside Chromium repository."""
from __future__ import print_function
import json
im... |
__author__ = 'Arpit'
import find
import time
import sys
import gmailer
#initialize datastructures
courses = []
semester = []
email = []
flag = 0
#parse changeme
with open('CHANGEME.txt') as fp:
for line in fp:
if(line[0] == "\n" or line[0] == "#"):
continue
line = line.rstrip()
... |
# -*- coding: UTF-8 -*-
#! python3 # noqa E265
"""
Isogeo API v1 - Model of Thesaurus entity
See: http://help.isogeo.com/api/complete/index.html#definition-thesaurus
"""
# #############################################################################
# ########## Libraries #############
# ###################... |
from contextlib import contextmanager
from functools import wraps
import logging
import os
from google.appengine.datastore import datastore_stub_util
from google.appengine.ext import testbed
import mock
import webapp2
import webapp2_extras
import webtest
from library import csrf
import main
from main import app
from ... |
# Copyright (c) 2015, Robert Escriva
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditi... |
talks = [
"Bren Brown - The power of vulnerability",
"Isabel Behncke - Evolutions gift of play from bonobo apes to humans",
"Josette Sheeran - Ending hunger now",
"Iain Hutchison - Saving faces A facial surgeons craft",
"Fred Jansen - How to land on a comet",
"Clayton Cameron - A-rhythm-etic. Th... |
# -*- coding: utf8 -*-
# Grammalecte - Lexicographe
# by Olivier R. License: MPL 2
import uno
import unohelper
import traceback
from com.sun.star.task import XJob
from com.sun.star.ui import XContextMenuInterceptor
from com.sun.star.ui.ContextMenuInterceptorAction import IGNORED
from com.sun.star.ui.ContextMenuInterc... |
"""
.. autosummary::
:nosignatures:
adjacency2graph
generate_random_graph
generate_pagerank_graph
generate_transition_matrix
graph2dict
minimal_random_graph
set_types_rank
set_types_random
QueueNetworkDiGraph
~queueing_tool.network.QueueingToolError
"""
from queueing_tool.g... |
# Copyright 2015 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... |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DsgTools
A QGIS plugin
Brazilian Army Cartographic Production Tools
-------------------
begin : 2019-01-04
git sha ... |
from functools import update_wrapper, wraps
from unittest import TestCase
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import (
login_required, permission_required, user_passes_test,
)
from django.http import HttpRequest, HttpResponse, HttpResponseNotA... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2017 Bruno S <bruno@oac.unc.edu.ar>
#
# This file is part of ProperImage (https://github.com/toros-astro/ProperImage)
# License: BSD-3-Clause
# Full Text: https://github.com/toros-astro/ProperImage/blob/master/LICENSE.txt
#
"""
simtools module from ProperImag... |
#!/usr/bin/python
import os
import re
import sys
import getopt
def run_checkstyle(file_name, checkstyle, project_dir):
output = os.popen("(cd " + project_dir + "; \
java -jar checkstyle.jar \
-c " + checkstyle + " \
" + file_name + ")").read()
output = output.split("\n")
length =... |
"""HappyXueTang URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cla... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import datasets, linear_model
def plot_line(x, y, y_hat,line_color='blue'):
# Plot outputs
plt.scatter(x, y, color='black')
plt.plot(x, y_hat, color=line_color,
linewidth=3)
plt.xticks(())
plt.yticks(())
plt.show()
... |
#!/usr/bin/env python
import os, sys, config_variable_processor
class GetSettingsInvalidTierOption( Exception ): pass
DEFAULT_CONFIG_DIR = "%s/.." % os.path.dirname( os.path.abspath( __file__ ) )
def list_tier( tier, config_dir = DEFAULT_CONFIG_DIR ):
tier_dir = '%s/variables/%s' % ( config_dir, tier )
ret... |
import unittest
from tempfile import NamedTemporaryFile
from lunch.session import Session, SessionFinished, Config, User
class TestConfig(unittest.TestCase):
def test_add_place(self):
config = Config()
config.add_place('Sisaket')
self.assertAlmostEqual(1, len(config))
config.add_... |
import urlparse
import os.path
import urllib
import urllib2
import httplib
import logging
import re
import datetime
import lasso
from django.template import RequestContext
from django.conf import settings
from django.http import HttpResponseRedirect, Http404, HttpResponse
from django.shortcuts import render_to_respons... |
# -*- coding: utf-8 -*-
import sys
import pwd
import grp
def check_ownerandgroup(parser, section, oorg, debug):
if oorg == 'owner':
switch = "User"
else:
switch = "Group"
if not parser.has_option(section, oorg):
if debug:
print >> sys.stderr, ("[debug] '%s' in section... |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django import forms
f... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import _errorhandler
import pywikibot
from pywikibot import catlib, config, pagegenerators
import codecs, re, _mysql
def projectsort(item):
return item[1]
def capitalizefirst(string):
return string[0:1].capitalize()+string[1:]
def checkproject(project):
#pywiki... |
import ops.cmd
import ops
import ops.env
import ops.cmd.safetychecks
from ops.cmd import getBoolOption, setBoolOption, getValueOption, setListOption, setStringOption
OpsCommandException = ops.cmd.OpsCommandException
VALID_OPTIONS = ['minimal', 'load', 'unload', 'list', 'minimal', 'nosignature', 'noversion']
class Dri... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# -*- coding: utf-8 -*-
import logging
from xml.dom import minidom
import scrapy
from scrapy.utils.iterators import xmliter
from scrapy.utils.spider import iterate_spider_output
from crawler.utils.xml import get_xmlnode
logger = logging.getLogger("DianpingtuanSpider")
import sys
reload(sys)
sys.setdefaultencoding('... |
#!/usr/bin/env python3
from typing import List, Tuple
import os
from common import error_exit
MusicDir = Tuple[str, List[str]] # A tuple of dir name and all of its files
MusicMap = List[MusicDir] # List of dirs containing music
def find_music(roots: List[str]) -> MusicMap:
music_dirs = []
for ... |
#! /usr/bin/env python
import os, sys, imp
from waflib import Context, Options, Configure, Utils, Logs, TaskGen, Task
import waflib.Tools.c
"""
Compile main.c and dependent object files into a single target (program/shlib/stlib or just object files)
- no build directory and no script files
- just a c4che directory f... |
import logging
from awxkit.api.resources import resources
from . import base
from . import page
log = logging.getLogger(__name__)
class Role(base.Base):
NATURAL_KEY = ('name',)
def get_natural_key(self, cache=None):
if cache is None:
cache = page.PageCache()
natural_key = su... |
'''
Window Pygame: windowing provider based on Pygame
'''
__all__ = ('WindowPygame', )
# fail early if possible
import pygame
from kivy.compat import PY2
from kivy.core.window import WindowBase
from kivy.core import CoreCriticalException
from os import environ
from os.path import exists, join
from kivy.config import... |
# -*- coding: utf-8 -*-
"""
Barten (1999) Contrast Sensitivity Function
===========================================
Defines the *Barten (1999)* contrast sensitivity function:
- :func:`colour.contrast.contrast_sensitivity_function_Barten1999`
References
----------
- :cite:`Barten1999` : Barten, P. G. (1999). Cont... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: ga4gh/references.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection ... |
from ttt import *
from tttGameSpec import TicTacToeGameSpec
def play_game(agent1, agent2, name1, name2):
"""Plays a game of tic tac toe with two agents and returns the winner."""
game_spec = TicTacToeGameSpec()
return game_spec.play_game(agent1, agent2)
"""board = make_board()
names = [name1, name2... |
import csv
import re
import parseH
import parseL
import outputAdapterTable
import outputAdapterODMax
from os import listdir
from os.path import isfile, join
indexFolder = "../tolScreenCleanerData/INDEX"
platesFolder = "../tolScreenCleanerData/PLATES"
outputFolder = "../tolScreenCleanerData/OUTPUT"
# Get available ind... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2019 Bitergia
#
# 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.
#
# This ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('rocketapp', '0006_auto_20150429_1227'),
]
operations = [
migrations.CreateModel(
name='PayloadFa... |
# -*- coding: utf-8 -*-
# Copyright 2014-2016 OpenMarket 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 applicab... |
from myhdl import *
def adapter(o_err, i_err, o_spec, i_spec):
nomatch = Signal(bool(0))
other = Signal(bool(0))
o_err_bits = []
for s in o_spec:
if s == 'other':
o_err_bits.append(other)
elif s == 'nomatch':
o_err_bits.append(nomatch)
else:
... |
#!/usr/bin/env python3
import os
import sys
import subprocess
######## GLOBALS #########
MAINPREFIX = "u"
PREFIX = "uksf_"
##########################
def tryHemttBuild(projectpath):
hemttExe = os.path.join(projectpath, "hemtt.exe")
if os.path.isfile(hemttExe):
os.chdir(projectpath)
ret = subp... |
# Copyright 2020, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.