src stringlengths 721 1.04M |
|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Khmer Unicode to Legacy fonts Conversion
# Copyright(c) 2006-2008 Khmer Software Initiative
# www.khmeros.info
#
# 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 ... |
# -*- coding: utf8 -*-
#
# Copyright 2011 Kyrre Ness Sjøbæk
# This file is part of AcdOpti.
#
# AcdOpti 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 you... |
'''Example model specification for a Skype-like system
@author: Joe Schaul <joe.schaul@gmail.com>
'''
import networkx as nx
from ComplexNetworkSim import NetworkSimulation, AnimationCreator, PlotCreator
from agent_skypeClient import DISABLED, ENABLED, ENABLED_S, DISABLED_S
from agent_skypeClient import Skype ... |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 lat... |
from __future__ import absolute_import
from __future__ import print_function
import json
import os
from PIL import Image
import shutil
import subprocess
import tempfile
import unittest
import uuid
import tensorflow as tf
from tensorflow.python.lib.io import file_io
import google.datalab as dl
import google.datalab.b... |
"""
PDF Document Page and Page Node elements
"""
import six
from .pdf_element import PdfElement
from ..exc import PdfParseError, PdfError
from ..pdf_types import PdfType, PdfRaw, PdfArray
from ..pdf_parser import PdfParser
from ..pdf_operation import PdfOperation
def parse_page(obj):
"""Parse... |
# Copyright (c) 2012 - 2015 EMC Corporation, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... |
import numpy as np
from keras.optimizers import SGD
from models.CNN_CIFAR import cnn_cifar_batchnormalisation, cnn_cifar_small, cnn_cifar_nodropout, \
cnn_cifar_small_batchnormalisation
from models.DataLoader import DataLoader
from scripts.progress_bar import printProgress
from time import time, localtime
# this is... |
import math
import numpy as np
from scipy.signal import get_window
from smst.utils.math import rmse
from smst.utils import audio
from smst.models import spr
from .common import sound_path
# TODO: the test needs fixing after the model is fixed
def test_reconstruct_sound():
fs, x = audio.read_wav(sound_path("sax-... |
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 28 16:14:22 2017
@author: ekrupczak on LaVision
Divide tiffs up into subfolders with maximum number of files per folder
This allows them to be imported into DaVis which seems unwilling to import more than about 10000 files at a time.
Or pull all tiffs from specified fol... |
from __future__ import absolute_import
import hypothesis
import hypothesis.searchstrategy
import hypothesis.testdecorators
import sure
from collections import namedtuple
from decimal import Decimal
from itertools import count
import sys
from .. import *
from ..util import zip
zero = Decimal('0')
@hypothesis.sear... |
# -*- coding=utf8 -*-
#******************************************************************************
# addon.py
#------------------------------------------------------------------------------
#
# Copyright (c) 2013 LivingOn <LivingOn@xmail.net>
#
# This program is free software; you can redistribute it and/or modify
#... |
import sys
import os
import time
import pexpect
import pytest
class Expect:
def __init__(self, expected, args=None, regex=False):
"""`expected` is either string or callable with optional `args`
Unless `regex` is enabled, the `expected` string is matched as-is (raw).
"""
self._e... |
#!/usr/bin/env python
from flexbe_core import EventState, Logger
import rospy
from dynamic_reconfigure.client import Client
"""
Created on 11/03/2014
@author: Philipp Schillinger
"""
class ReadDynamicParameterState(EventState):
"""
Reads a given trajectory controller parameter.
"""
LEFT_ARM_WRX = ['left_arm_t... |
#!/usr/bin/env python
# coding=utf-8
import unittest
from mock import Mock
from src.sequence import Sequence, overlap
class TestSequence(unittest.TestCase):
def setUp(self):
self.seq1 = Sequence("seq1", "GATTACA")
def add_mock_gene(self, name="foo_gene"):
mockgene = Mock()
mockgene... |
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# File: smiley.py
# Date: Thu Jun 18 00:02:43 2015 +0800
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import os
import re
import json
import struct
from common.textutil import get_file_b64
STATIC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static')
UNI... |
# 44. Wildcard Matching My Submissions QuestionEditorial Solution
# Total Accepted: 59032 Total Submissions: 333961 Difficulty: Hard
# Implement wildcard pattern matching with support for '?' and '*'.
#
# '?' Matches any single character.
# '*' Matches any sequence of characters (including the empty sequence).
#
# Th... |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
import numpy as np
import pyfits
import glob
import matplotlib.pyplot as plt
def real_footprint(t):
"""
# `real_footprint`
Takes real Kepler (BJD) time values for a certain target and returns
estimates of the starts, stops and centres
"""
dt = 0.02043359821692 # interval between observations ... |
import numpy as np
class Frame():
def __init__(self, configs_in, comm=None):
self._process_configs(configs_in)
def _process_configs(self, configs_in):
self.Args = configs_in
if 'Steps' not in self.Args:
self.Args['Steps'] = 1.
if 'Velocity' not in self.Args:
... |
"""
AshFlashtheOrig.net
~~~~~~~~~~~~~~~~~~~
AshFlash's website which serves as a hub to other interactive media hosted on
sites like YouTube, Soundcloud, Twitter and Facebook.
:copyright: (c) 2012 by Ash Courchene
"""
from flask import Flask
from media import Player
#App setup
app = Flask(__nam... |
# Copyright (C) 2017 Red Hat, Inc.
#
# fedmsg_meta_umb 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 2.1 of the License, or (at your option) any later version.
#
# fedmsg_meta_umb is ... |
import enum
import functools
import json
import io
import operator
from pyardrone.utils import repack_to_int
class Parameter:
'''
Base class of all at command parameters.
:param description: description of the parameter, stored in __doc__
:param default: default value of the parameter
'''
... |
import json
import posixpath
import string
import uuid
from copy import copy
from datetime import datetime
from django.apps import apps
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
import commonware.log
import jinja2
from tower import ugettext as _
import... |
#!/usr/bin/env vpython
#
# Copyright 2018 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.
import argparse
import collections
import json
import logging
import os
import pipes
import re
import signal
import socket
import sy... |
# Screen stack test classes.
#
# This file is part of Simpleline Text UI library.
#
# Copyright (C) 2020 Red Hat, Inc.
#
# Simpleline 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... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... |
"""
A modular decoder for the SLP image format as used in the Genie engine.
Thanks to http://alexander-jenkins.co.uk/blog/?p=9 and to
http://www.digitization.org/wiki/index.php/SLP for the great documentation!
"""
import struct
import construct as cons
class FrameAdapter(cons.Adapter):
def _decode(s... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
import sys
import os
import tempfile
from os import environ
from PyQt4 import QtGui
from PyQt4 import QtCore
rc_file_name = environ.get('HOME') + '/.kde/share/config/apt-notifierrc'
message_status = "not displayed"
# Check for updates, using subprocess.Pope... |
# -*- coding:utf-8 -*-
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
from nagare import security
from peak.rules import when
from nagare.securit... |
#!/bin/env python
# Ref: ZeroMQ, p. 60
# Parallel task sink with kill signaling
import sys
import time
import zmq
import pdb
class TaskSink(object):
def __init__(self, config):
self.config = config
self.context = zmq.Context()
# Socket to receive msgs
self.receiver = self.contex... |
#
# front-end for TortoiseHg dialogs
#
# Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>
#
import os
import sys
from tortoisegit.tgitutil import get_prog_root
# always use git exe installed with TortoiseHg
tgitdir = get_prog_root()
try:
os.environ['PATH'] = os.path.pathsep.join([tgitdir, os.environ['PATH']])
exce... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... |
##############################################################################
#
# Copyright (c) 2004 Zope Foundation 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 SOF... |
"""
sentry_graphite
~~~~~~~~
:copyright: (c) 2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from django import forms
from sentry.conf import settings
from sentry.plugins import Plugin
from pystatsd import Client
NOTSET = object()
class GraphiteConfigurationForm(forms.Form):
host ... |
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect
from django.utils import timezone
from django.views.generic import ListView, DetailView
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from difflib import get_close_matches
fr... |
###############################################################################
#cyn.in is an open source Collaborative Knowledge Management Appliance that
#enables teams to seamlessly work together on files, documents and content in
#a secure central environment.
#
#cyn.in v2 an open source appliance is distributed ... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class DeviceTestCase(Integratio... |
from py2js import convert_py2js
import inspect
class JavaScript(object):
"""
Decorator that you can use to convert methods to JavaScript.
For example this code::
@JavaScript
class TestClass(object):
def __init__(self):
alert('TestClass created')
... |
#-*-coding:utf8-*-
from threading import Thread
import tornado.ioloop
import tornado.web
import tornado.websocket
import json
import log
import config
try:
# py2
from urllib.parse import urlparse
except ImportError:
# py3
from urlparse import urlparse
class WebSocketMsgHandler():
def __init__(sel... |
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import today
def execute():
frappe.reload_doc('subscription', 'doctype', 'subscription')
frappe.reload_doc('selling', 'doctype', 'sales_orde... |
"""
MediaWiki translator, aimed at Wikipedia/WikiBooks type of web pages.
Syntax defined by http://en.wikipedia.org/wiki/Help:Wiki_markup
and http://en.wikipedia.org/wiki/Help:Displaying_a_formula.
The prefix m in the name mwiki distinguishes this translator from
gwiki (googlecode wiki).
Not yet implemented:
mwiki_ref... |
# Copyright 2017-present Adtran, 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 writ... |
# Q1 Technical Challenge
# Author: Sushil K Sharma
# -----------------------
"""
Problem Statement:
Create a text content analyzer. This is a tool used by writers to find statistics such as word and sentence count on essays or articles they are writing. Write a Python program that analyzes input from a file and co... |
databaseNode = {
"DateNow": "2017-01-05",
"TimeNow": "10:16:10",
"d": {
"dataNodeMaster01": {
"Device01": 0,
"Device02": 0,
"Device03": 0,
"Device04": 0,
"Device05": 0,
"Device06": 0,
"Device07": 0,
"Devi... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from flask import session
from indico.core import signals
from indico.core.db import db
from indico.modul... |
#!/usr/bin/env python
#===============================================================================
# Copyright (c) 2014 Geoscience Australia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#... |
from django.db import models
from django.contrib.auth.models import Group
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class LDAPGroup(models.Model):
"""
An LDAPGroup defines a mapping between an LDAP Organizational Unit (OU) and
a django.contrib.auth.models.... |
import socket
from datetime import datetime
from util import Error
from scapy.all import *
from scanner import Scanner
from zoption import Zoption
class net_map(Scanner):
def __init__(self):
super(net_map, self).__init__('NetMap')
self.available_hosts = {}
self.config.update({"net_mask":Zo... |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
# Databricks notebook source
# MAGIC %md
# MAGIC ScaDaMaLe Course [site](https://lamastex.github.io/scalable-data-science/sds/3/x/) and [book](https://lamastex.github.io/ScaDaMaLe/index.html)
# COMMAND ----------
# MAGIC %md
# MAGIC # Data Processing
# MAGIC Here we will load the data as it was given to us, as a ".np... |
# Copyright 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 applicable law or agreed to in writin... |
# -*- coding: utf-8 -*-
# dummy.py
# Copyright (C) 2016 LEAP Encryption Acess Project
#
# 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... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# These tests run only under Linux and Python 2.x +
# This is the Travis CI environment.
#
from pycompat import python as py
from pycompat import system
import sys
import unittest
class TestPyCompat(unittest.TestCase):
def test_python_is_64bits(self):
se... |
# Copyright 2012 OpenStack LLC.
# 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... |
# 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
# d... |
# Copyright 2014, Jeff Buttars, 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... |
import requests
import json
from datetime import datetime
def _json_serial(obj):
"""JSON serializer for objects not serializable by default json code"""
if isinstance(obj, datetime):
serial = obj.isoformat()
return serial
class SwisClient:
def __init__(self, hostname, username, password,... |
#!/usr/bin/env python2
#
# Name: hashbrowns
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Provides cryptographic hashes with a minimal UI
#
import os, sys
import pygtk, gtk
import hashlib
import pango
import re
class Hashbrowns:
def __init__(self, filename):
self.hash_algs = ['md5', 'sha1', 'sha256', 'sh... |
# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
"""Functional tests of API."""
import datetime
import json
import os
import sys
import re
import unittest
f... |
#!/usr/bin/python
import sys
from collections import defaultdict
def read_tsv_as_array(filename):
'''
Converts 2 column tsv to array.
First column is samplename.
Second column is location of file.
'''
tsv_array = []
with open(filename, 'rU') as handle:
for line in handle:
... |
from sentry_sdk.hub import Hub
from sentry_sdk.integrations import Integration
from spinach import signals
class SpinachIntegration(Integration):
"""Register the Sentry SDK integration.
Exceptions making jobs fail are sent to Sentry and performance
tracing of Spinach tasks is enabled.
:param send_r... |
"""Views for API management."""
import logging
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.core.urlresolvers import reverse_lazy, reverse
from django.http.response import JsonResponse
from django.shortcuts import redirect
from django.utils.translation import... |
"""
Test std::deque functionality with a decl from dbg info as content.
"""
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestDbgInfoContentDeque(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(["libc++"])
... |
#
# Copyright (c) 2016 The Ontario Institute for Cancer Research. All rights reserved.
#
# This program and the accompanying materials are made available under the terms of the GNU Public License v3.0.
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www... |
"""
Django settings for the interop server.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... |
import sys
from cStringIO import StringIO
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core import management
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
from django.contrib.gis.geos import Point, GEOSGeometry
from nodeshot.co... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 Softwa... |
# This file is part of the GOsa framework.
#
# http://gosa-project.org
#
# Copyright:
# (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.
import json
import logging
import re
from gosa.backend.objects.filter import ElementFilter
import dat... |
from __future__ import unicode_literals, division, absolute_import
import os
import logging
import urlparse
import xml.sax
import posixpath
import httplib
from datetime import datetime
import dateutil.parser
import feedparser
from requests import RequestException
from flexget import plugin
from flexget.config_schema... |
# -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. 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 requ... |
class Solution(object):
def combinationSum3(self, k, n):
"""
:type k: int
:type n: int
:rtype: List[List[int]]
"""
# Use recursion to resolve the problem
# The algorithm complexity is high due to it has to iterate from one
# for each call given k, n. ... |
"""
users.py
Created on: Aug 17 2013
Author: eli
"""
class UserPermission(object):
"""
Describes a permission for an operation for an user.
"""
PERMISSIONS = []
_curr_permission_bit = 1
def __init__(self, name, description, is_default):
"""
Construct a permissio... |
import logging
import abc_code.global_var as g
import numpy as np
import scipy as sp
import scipy.stats
from numpy.fft import fftfreq, fftn, ifftn
from time import time
from abc_code.sobol_seq import i4_sobol_generate
from fast_histogram import histogram1d
import abc_code.distance as dist
import itertools
def timer(... |
#!/usr/bin/env python
# Copyright (C) 2015,2016 MongoDB Inc.
# Copyright (C) 2018 Free Software Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3,
# as published by the Free Software Foundation.
#
# This program ... |
# Copyright: 2005 Gentoo Foundation
# Author(s): Brian Harring (ferringb@gentoo.org)
# License: GPL2
import sys
from portage.cache import template, cache_errors
from portage.cache.template import reconstruct_eclasses
class SQLDatabase(template.database):
"""template class for RDBM based caches
This class is desig... |
# -*- coding: utf-8 -*-
from celery.result import AsyncResult
from django.core.exceptions import ValidationError
from django.db import models, connection
from django.utils import timezone
def validate_even(value):
"""
Validate a number to be even
"""
if value % 2 != 0:
raise ValidationError('%... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Niagara AX operation implementations.
"""
import fysom
import re
from ....util import state
from ....util.asyncexc import AsynchronousException
from ...http.auth import BasicAuthenticationCredentials
from ...http.exceptions import HTTPStatusError
class NiagaraAXAuth... |
from __future__ import absolute_import
import redisext.counter
import redisext.key
import redisext.serializer
from . import fixture
class ExpireCounter(redisext.counter.Counter, redisext.key.Expire):
EXPIRE = 60
CONNECTION = fixture.Connection
SERIALIZER = redisext.serializer.Numeric
class ExpireCount... |
import collections
import os
import sys
import matplotlib.pyplot as plt
import numpy as np
from astromodels import Parameter
from cthreeML.pyModelInterfaceCache import pyToCppModelInterfaceCache
from hawc import liff_3ML
from matplotlib import gridspec
from threeML.io.file_utils import file_existing_and_readable, san... |
import os
import time
from slackclient import SlackClient
# starterbot's ID as an environment variable
BOT_ID = os.environ.get("BOT_ID")
# constants
AT_BOT = "<@" + BOT_ID + ">"
EXAMPLE_COMMAND = "gofish"
# instantiate Slack & Twilio clients
slack_client = SlackClient(os.environ.get('SLACK_BOT_TOKEN'))
def handle_c... |
import unittest
import time
from django.core.cache import cache
from wp_frontman.cache import get_key, get_object_key, get_object_value, set_object_value, cache_timestamps
class DummyObject(object):
def __init__(self, id):
self.id = id
def __eq__(self, other):
if isinstance(other, self... |
from distutils.core import setup
import os
# Stolen from django-registration
# Compile the list of packages available, because distutils doesn't have
# an easy way to do this.
packages, data_files = [], []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
for dirpath, dirnames, filenames in os.... |
import collections
import re
def namedtuple_with_defaults(typename, field_names, default_values=[]):
T = collections.namedtuple(typename, field_names)
T.__new__.__defaults__ = (None,) * len(T._fields)
if isinstance(default_values, collections.Mapping):
prototype = T(**default_values)
else:
... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-10-23 20:45
from __future__ import unicode_literals
from decimal import Decimal
import django.core.validators
from django.db import migrations
import django_measurement.models
class Migration(migrations.Migration):
dependencies = [
('inventory', ... |
#!/usr/bin/env python
# coding: utf-8
"""Generate meshes of cylinders and disks"""
# Copyright (C) 2017-2019 Matthieu Ancellin
# See LICENSE file at <https://github.com/mancellin/capytaine>
import logging
from itertools import product
import numpy as np
from capytaine.meshes.geometry import xOy_Plane, xOz_Plane, yOz... |
def pytest_configure():
from django.conf import settings
settings.configure(
DEBUG_PROPAGATE_EXCEPTIONS=True,
DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:'}},
SITE_ID=1,
SECRET_KEY='not very secret in tests',
... |
__author__ = 'JMartinez'
import numpy as np, pandas as pd, os
from synthicity.utils import misc
import pysal as py
class elasticity_model(object):
def __init__(self, dset):
self.zones = dset.zones
self.buildings_far = pd.merge(dset.buildings, dset.fars, left_on='far_id', right_index=True)
... |
from ctypes import *
from PIL import Image
# Handle definition for the st2205_* routines
class st2205_handle(Structure):
_fields_ = [("fd", c_int),
("width", c_uint),
("height", c_uint),
("bpp", c_int),
("proto", c_int),
("buff", POINT... |
import argparse
from functools import partial
import cv2
import color_tracker
# You can determine these values with the HSVColorRangeDetector()
HSV_LOWER_VALUE = [155, 103, 82]
HSV_UPPER_VALUE = [178, 255, 255]
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("-low", "--low", nargs=3,... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='MailServer',
fields=[
('id', models.AutoField(ve... |
# -*- coding: utf-8 -*-
# MinIO Python Library for Amazon S3 Compatible Cloud Storage,
# (C) 2015 MinIO, 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/lic... |
"""Tests for key.py."""
import base64
import pickle
import unittest
from .google_imports import datastore_errors
from .google_imports import datastore_types
from .google_imports import entity_pb
from . import eventloop
from . import key
from . import model
from . import tasklets
from . import test_utils
class KeyT... |
import os
from django.contrib import messages
from django.contrib.auth import logout as logout_user
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django import http
from django.shortcuts import get_object_or_404
from django.views.generic import TemplateView
... |
'''
searx is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
searx is distributed in the hope that it will be useful,
but WITHOUT ANY WA... |
#! /usr/bin/env python
import urllib2
import os
import json
from bing_search_api import BingSearchAPI
import string
import sys
def read_bing_key():
with open('bing_key.txt', 'r') as f:
bing_key = f.read()
bing_key = bing_key.replace('\n','')
return bing_key
def get_format(format):
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import functools
import json
import logging
import os
import platform
import subprocess
from functools import partial
from pathlib import Path
from typing import Optional, List
from PySide2 import QtCore, QtWidgets, QtGui
from PySide2.QtCore import QUrl, Signal, Qt
from qasync import asyncSlot
from randovania import ... |
__author__ = 'Sergey Tomin'
from copy import copy
from ocelot import *
from ocelot.gui import *
import numpy as np
C = 1000.
Ncells = 16
Nbends = 32
D = Drift(l=C/Ncells/4, eid="D")
Qf = Multipole(kn=[0., 0.021/2.], eid="Qf")
Qd = Multipole(kn=[0., -0.02], eid="Qd")
B = Multipole(kn=2.*pi/Nbends)
Sf = Multipole(kn=(0... |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2015] Michał Szczygieł, M4GiK Software
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.