src stringlengths 721 1.04M |
|---|
#
# Copyright (C) 2012, 2013 Satoru SATOH <ssato @ redhat.com>
# License: MIT
#
from trifle.anyconfig.compat import StringIO
from trifle.anyconfig.globals import LOGGER as logging
import trifle.anyconfig.mergeabledict as D
import trifle.anyconfig.utils as U
import os.path
import os
SUPPORTED = False
def mk_opt_args... |
#!/usr/bin/env python
# encoding: utf-8
import os, sys
from setuptools import setup
setup(
# metadata
name='pfp',
description='An 010 template interpreter for Python',
long_description="""
pfp is an 010 template interpreter for Python. It accepts an
input data stream and an 010 template and return... |
# file ddisearch/ddi/tests.py
#
# Copyright 2014 Emory University
#
# 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 appl... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to show the output of the hg annotate command.
"""
from __future__ import unicode_literals
try:
str = unicode
except NameError:
pass
import os
import re
from PyQt5.QtCore impor... |
## @file GMus0.py
# @brief Application support class for the Unofficial Google Music API.
# @author weaves
#
# @details
# This class uses @c gmusicapi.
#
# @note
# An application support class is one that uses a set of driver classes
# to provide a set of higher-level application specific methods.
#
# @see
# https://g... |
import sys, os
import pandas as pd
import numpy as np
file_path = os.path.dirname(os.path.realpath(__file__))
ps_calcs_lib_path = os.path.abspath(os.path.join(file_path, "../../../lib/ps_calcs"))
sys.path.insert(0, ps_calcs_lib_path)
import ps_calcs
def calc_rca(ypw):
ubiquity_required = 20
diversity_require... |
"""MissingInteger (https://codility.com/demo/take-sample-test/missing_integer/)
Analysis:
- Pigeonhole Principle
- Radix sort
Comment:
- The problem description did not provide the default case, which puzzled me at first.
After referencing solutions by others, I found some of them just create the de... |
# -*- coding: utf-8 -*-
import logging
import os
import re
from os.path import join as path_join
from pathlib import Path
from pkg_resources import parse_version, working_set
import pytest
from pyscaffold import __version__, structure, update
from pyscaffold.utils import chdir
from .helpers import uniqstr
EDITABLE... |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Mayo Clinic
# 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
# ... |
def sanitize(time_string):
if "-" in time_string:
splitter = "-"
elif ":" in time_string:
splitter = ":"
else:
return time_string
(mins, secs) = time_string.split(splitter)
return mins + "." + secs
class Athlete:
def __init__(self, a_name, a_dob=None, a_times=[]):
... |
# Copyright 2013 Mario Graff Guerrero
# 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 wri... |
# Copyright 2016 128 Technology, Inc.
"""Unit tests for the yinsolidated pyang plugin"""
from __future__ import unicode_literals
import json
import os
import subprocess
import pyang
import pytest
from yinsolidated.plugin import plugin
YINSOLIDATED_PLUGIN_DIRECTORY = os.path.dirname(plugin.__file__)
YIN_NAMESPAC... |
import pkg_resources
import socket, threading
import wx
from wx import xrc
RESFILE = pkg_resources.resource_filename(__name__,"trax_udp_sender.xrc") # trigger extraction
RES = xrc.EmptyXmlResource()
RES.LoadFromString(open(RESFILE).read())
class UDPSender(object):
"""A base class for keeping track of a list of ... |
# 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 -*-
"""sdist tests"""
import contextlib
import os
import shutil
import sys
import tempfile
import itertools
import io
from distutils import log
from distutils.errors import DistutilsTemplateError
from setuptools.command.egg_info import FileList, egg_info, translate_pattern
from setuptools.dist imp... |
# (c) 2012-2014, 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) an... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import sys
import io
import zipfile
import logging
import datetime
from pyomni import util
from pyomni.webdav.WebdavClient import CollectionStorer
from pyomni.webdav.WebdavClient import ResourceStorer
from pyomni.webdav.WebdavClient import parseDigestAuthI... |
"""
STARBURST ACC/FEANTA Middle Server
Author: Lokbondo Kung
Email: lkkung@caltech.edu
"""
import datetime
import socket
import sys
import time
import threading
import gen_fem_sf
import traceback
# Logging information.
TIMESTAMP_FMT = '%Y-%m-%d %H:%M:%S'
LOG_FILE = 'bridge_server.log'
# Define all consta... |
from flask import render_template, request, redirect, url_for
from wtforms import Form, TextField
from app.search.api import YummlyClient
from app.search.api import SearchResults
from flask_bootstrap import Bootstrap
from flask import Flask
import random
app = Flask(__name__)
Bootstrap(app)
app.config['DEBUG'] = True
... |
import os
import tempfile
import unittest
from unittest import mock
from dbt import compilation
try:
from queue import Empty
except ImportError:
from Queue import Empty
from dbt.graph.selector import NodeSelector
from dbt.graph.cli import parse_difference
def _mock_manifest(nodes):
config = mock.MagicMo... |
#Copyright 2016 Tim Wentlau.
#Distributed under the MIT License. See LICENSE in root of project.
"""
Module that holds log functionality.
In general you dont need to include this in your kervi code as the spine class holds a reference
to a fully configured log.
"""
import logging
import logging.handlers
import os
VE... |
@command("topic")
def topic(nick, user, channel, message):
try:
import os
file = open("topic.txt", "r+")
topic = file.read()
tempfile = file.read()
topic = topic.split("\n")
if message.split()[0] == "add":
add = str.join(' ', (message.split()[1:]))
... |
import pytest
import os
import urllib.request
import tarfile
from tempfile import NamedTemporaryFile
from sklearn.metrics import v_measure_score
from fluff.parse import parse_cmds
from fluff.commands.profile import profile
from fluff.commands.heatmap import heatmap
from fluff.commands.bandplot import bandplot
@pytest... |
#
# constants.py: anaconda constants
#
# Copyright (C) 2001 Red Hat, Inc. All rights reserved.
#
# 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 ... |
import logging
import tornado.web
from httplib import INTERNAL_SERVER_ERROR
from zoom.common.decorators import TimeThis
class ReloadCacheHandler(tornado.web.RequestHandler):
@property
def data_store(self):
"""
:rtype: zoom.www.cache.data_store.DataStore
"""
return self.applica... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from crequest.middleware import CrequestMiddleware
from django.core.mail import send_mail
from django.template.loader import get_template
from django.conf import settings
from django.urls import reverse
def send_password_request_link(password_request, u... |
# Authors : Denis A. Engemann <denis.engemann@gmail.com>
# Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#
# License : BSD 3-clause
from copy import deepcopy
import math
import numpy as np
from scipy import fftpack
# XXX explore cuda optimazation at some point.
from ..io.pick import pick_type... |
#!/usr/bin/env python3
###############################################################
# Urwish lib by Joep Bos-Coenraad (github.com/JoepBC)
# An easy wrapper for making linear console forms using \
# the Urwid library, www.urwid.org
###############################################################
import urwid
impor... |
import pandas as pd
import pytest
from asian_word_analyzer.korean.word import KoreanWord
from asian_word_analyzer.block import Block
import asian_word_analyzer.ui as ui
class TestUi:
@staticmethod
def korean_word():
return KoreanWord(u'남대문', u'南大門',
u'(건축물) Namdaemun, the (G... |
#!/usr/bin/env python
# encoding: utf-8
"""
digestfetch.py
Fetch bitesize content from the world of the web for use in a daily digest pocketmod
"""
import sitecustomize
# Builtin modules
from copy import copy
from operator import itemgetter
import re
import time, datetime
import urllib, urllib2, httplib
# 3rd party ... |
#!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
#
# This script is used to load the proper datasets for the specified workloads. It loads
# all data via Hive except for parquet data which needs to be loaded via Impala.
# Most ddl commands are executed by Impala.
import collections
import ... |
"""
Test VAR Model
"""
from __future__ import print_function
# pylint: disable=W0612,W0231
from statsmodels.compat.python import (iteritems, StringIO, lrange, BytesIO,
range)
from nose.tools import assert_raises
import nose
import os
import sys
import numpy as np
import statsmod... |
#! /usr/bin/env python
# Goal: Merge and run coverage analysis on the two Samples generated.
# Output: A mered bam file, and coverage analysis on the merged bam file.
from optparse import OptionParser
import os
import os.path
import sys
import re
import datetime
import json
from QC_Run import QC_Run
from tools impo... |
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
# 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
... |
def example_BackgroundCall():
import urllib,time
def work():
return urllib.urlopen('http://www.python.org/').read()
bkcall=BackgroundCall(work)
print 'work() executing in background ...'
while not bkcall.is_done():
print '.',
time.sleep(0.010)
print 'done.'
print bkca... |
# Copyright (C) 2015 SignalFx, Inc. All rights reserved.
#
# Docker container orchestration utility.
import jinja2
import os
import sys
import yaml
from . import exceptions
class MaestroYamlConstructor(yaml.constructor.Constructor):
"""A PyYAML object constructor that errors on duplicate keys in YAML
mappin... |
from typing import Any, Dict
EMOJI_NAME_MAPS: Dict[str, Dict[str, Any]] = {
# seems like best emoji for happy
'1f600': {'canonical_name': 'grinning', 'aliases': ['happy']},
'1f603': {'canonical_name': 'smiley', 'aliases': []},
# the google emoji for this is not great, so made People/9 'smile' and
#... |
#!/usr/bin/env python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tool for manipulating naclports packages in python.
This tool can be used to for working with naclports packages.
It can al... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'dialog_create_deck.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_DialogCreateDeck(object):
def setupUi(self, DialogCreateDec... |
import xgboost as xgb
from sklearn.datasets import make_classification
n = 2 ** 15
X, y = make_classification(n_samples=n+1, n_features=10, n_informative=5, n_redundant=5,
shuffle=True, random_state=123)
param = {'objective':'binary:logistic','tree_method':'approx',
'eval_metric':'... |
#-------------------------------------------------------------------------------
# ServiceManager.py
#
# Purpose: Creates, updates, deletes services in ArcGIS Online
#
#
# Prerequisites/Inputs:
# TokenManager: authentication token for NPS ArcGIS Online
# ServiceConfiguration: service configuration st... |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... |
#!/usr/bin/env python3
# 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, so... |
import platform
import click
import pkg_resources
from panoptes_cli.scripts.panoptes import cli
@cli.command()
@click.pass_context
def info(ctx):
"""Displays version and environment information for debugging."""
info = {
'Panoptes CLI version': (
pkg_resources.require("panoptescli")[0].... |
# -*- coding: utf-8 -*-
#
# diffoscope: in-depth comparison of files, archives, and directories
#
# Copyright © 2014-2015 Jérémy Bobbio <lunar@debian.org>
# © 2015 Helmut Grohne <helmut@subdivi.de>
#
# diffoscope is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gen... |
""" Test script for the Unicode implementation.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""#"
import sys
import struct
import codecs
import unittest
from test import test_support, string_tests
# decorator to skip tests on narrow builds
requires_wide_bui... |
#!/usr/bin/env python
# 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... |
from __future__ import print_function
import io
import logging
from peyutil import shorter_fp_form
from taxalotl.resource_wrapper import TaxonomyWrapper
from taxalotl.parsing.darwin_core import normalize_darwin_core_taxonomy
_LOG = logging.getLogger(__name__)
COL_PARTMAP = {
'Archaea': frozenset([52435722]),
... |
#
# Copyright 2015 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 th... |
#
# File: capa/capa_problem.py
#
# Nomenclature:
#
# A capa Problem is a collection of text and capa Response questions.
# Each Response may have one or more Input entry fields.
# The capa problem may include a solution.
#
"""
Main module which shows problems (of "capa" type).
This is used by capa_module.
"""
from ... |
# coding=utf-8
# Copyright 2018 The DisentanglementLib 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
#
# Un... |
from os import environ, path
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
#import pyaudio
MODELDIR = "model"
DATADIR = "data"
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', path.join(MODELDIR, 'en-us'))
config.set_string('-lm', path.... |
# Contour Copyright (C) 2013-2014 Hiroyuki Sakai
#
# This file is part of Contour.
#
# Contour 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 optio... |
import numpy, h5py, pylab, copy
from PnSC_h5io import *
from PnSC_math import *
from matplotlib.ticker import FuncFormatter
def myexpformat(x, pos):
for ndigs in range(5):
lab=(('%.'+'%d' %ndigs+'e') %x).replace('e+0','e').replace('e+','e').replace('e0','').replace('e-0','e-')
if eval(lab)==x:
... |
#coding=utf-8
from bs4 import BeautifulSoup
from time import sleep as wait
import re
import requests
try:
from html.parser import HTMLParser
except ImportError:
from HTMLParser import HTMLParser
##################################################
# Copied code
#################################################... |
from subprocess import CalledProcessError
import os
import re
from vee import log
from vee.cli import style_note, style_warning, style_error, style
from vee.environment import Environment
from vee.exceptions import CliMixin
from vee.git import GitRepo
from vee.packageset import PackageSet
from vee.requirements import ... |
import socket, _thread, tkinter as tk, tkinter.ttk as ttk
from time import strftime, sleep
from tkinter import messagebox, simpledialog
#===========================================================================#
class BasicInputDialog:
def __init__(self,question,title=None,hideWindow=True):
if title == ... |
# -*- coding: utf-8 -*-
# Copyright (C) Duncan Macleod (2013)
#
# This file is part of GWpy.
#
# GWpy 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 ... |
from PyGMO.problem import base as base_problem
from PyKEP.core import epoch, DAY2SEC, MU_SUN, lambert_problem, propagate_lagrangian, fb_prop, fb_vel, AU
from PyKEP.planet import jpl_lp,spice
from math import sqrt, pi, cos, sin, acos, atan2, log
from scipy.linalg import norm
from numpy import *
excludes = []
class tra... |
#!/usr/bin/env python
import logging
import logging.handlers
from Singleton import Singleton
import os
LOGPATH = '/tmp'
class LoggerManager(Singleton):
def __init__(self):
self.loggers = {}
formatter = logging.Formatter('%(asctime)s:%(levelname)-8s:%(name)-10s:%(lineno)4s: %(mes... |
"""
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com>
# Fabian Pedregosa <fabian@fseoane.net>
# Michael Eickenberg <michael.eickenberg@nsup.org>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
impor... |
# -*- coding: utf-8 -*-
import humanize
from datetime import datetime
from mimiron.core.commands import Command as _Command
from mimiron.core import io
from mimiron.core.util.time import pretty_print_datetime
from mimiron.exceptions.vendor import NoChangesEmptyCommit
from mimiron.exceptions.commands import InvalidOpe... |
import _io
import collections
import unittest
from mock import patch, Mock, call, MagicMock, sentinel
import low_level
def mock_open(mock=None, read_data='', lines=None):
"""
A helper function to create a mock to replace the use of `open`. It works
for `open` called directly or used as a context manager.
... |
from django.db.models.fields.files import ImageField, ImageFieldFile
from PIL import Image
import os
def _add_thumb(s):
"""
Modifies a string (filename, URL) containing an image filename, to insert
'.thumb'
"""
parts = s.split(".")
parts.insert(-1, "thumb")
if parts[-1].lower() not in ['jpe... |
# Copyright 2020 kubeflow.org.
#
# 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,... |
# -*- coding: utf-8 -*-
__license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
from PyQt5.Qt import QListWidgetItem, Qt
from calibre.gui2.convert.txt_input_ui import Ui_Form
from calibre.gui2.convert import Widget
from calibre.ebooks.conversion.plugin... |
import unittest
import testlib
import os
import mock
import errno
import refcounter
class TestRefCounter(unittest.TestCase):
@testlib.with_context
def test_get_whencalled_creates_namespace(self, context):
os.makedirs(refcounter.RefCounter.BASE_DIR)
refcounter.RefCounter.get('not-important', ... |
"""
Facility methods for pyFTS partitioners module
"""
import numpy as np
import pandas as pd
import matplotlib as plt
import matplotlib.colors as pltcolors
import matplotlib.pyplot as plt
#from mpl_toolkits.mplot3d import Axes3D
from pyFTS.benchmarks import Measures
from pyFTS.common import Membership, Util
from pyF... |
#!/usr/bin/env python
import rospy
from ArmStates import *
from MoveStates import *
from ObjectDetectState import *
from DecisionStates import *
from std_srvs.srv import Empty, EmptyResponse
from std_msgs.msg import Bool
## TODO after Eindhoven: Add failsafe if hole not detected
## add states if object too far or too... |
""" tests/test_utils
"""
import os
from smashlib.testing import TestCase, hijack_ipython_module, main
from smashlib.plugins.smash_completer import SmashCompleter, smash_env_complete
from smashlib.overrides import SmashTerminalInteractiveShell
from mock import Mock
hijack_ipython_module()
from IPython.testing.tools impo... |
# Twisted Imports
from twisted.internet import reactor, protocol, defer
from twisted.web.client import Agent
from twisted.web.http_headers import Headers
from twisted.internet.ssl import ClientContextFactory
from twisted.python import log
# System Imports
try:
from urllib.parse import urlencode
except ImportError:
f... |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
import sys
import random
comparisons = 0
def main():
global comparisons
with open(sys.argv[1], 'r') as f:
arr = [int(x) for x in f.read().split()]
quicksort(arr, 0, len(arr)-1)
# print(arr)
print(comparisons)
def getPivot(arr, l, r):
first = arr[l]
mid = arr[(l+r)//2]
last = a... |
#!/usr/bin/env python
"""Import permissions, roles, and their relations from a JSON file.
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import json
import click
from byceps.services.authorization import service as authz_service
from byceps.util.system import get_co... |
# 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 agreed to in writing, ... |
# 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... |
#!/usr/bin/python
from optparse import OptionParser
import sys
import os
def isLineLogStart(curLine):
if len(curLine) < 20:
return False
if (curLine[4] == '-' and curLine[7] == '-' and curLine[10] == ' ' and
curLine[13] == ':' and curLine[16] == ':'):
return True
return False
d... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.http import request
import werkzeug
import datetime
import time
from openerp.tools.translate import _
from openerp.addons.webs... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
import os
kwds = {}
if int(os.getenv('USE_DISTUTILS', 0)) != 0:
from distutils.core import setup
def find_packages():
packages = []
basedir = os.getcwd()
for root, dirnames, filenames in os.walk(basedir):
for dirname in dirnames:
initfile = os.path.join(root... |
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
import numpy as np
from nextgisweb.spatial_ref_sys.models import SRS, BOUNDS_EPSG_3857
from nextgisweb.tmsclient import Layer
def image_compare(im1, im2):
arr1 = np.asarray(im1, np.float32)
arr2 = np.a... |
import wx
import sys
from capture import *
import netifaces
import wx.lib.buttons
from sniffer_socket import *
from help_window import *
from scanner import *
class ListCtrlLeft(wx.Frame):
def __init__(self, parent, id):
wx.Frame.__init__(self, None, wx.ID_ANY, 'wxBitmapButton', size=(300, 350))
sel... |
# -*- coding: utf-8 -*-
"""
protocols.application.tcp
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL3, see LICENSE for more details.
"""
import logging
from protocols.application.application import Server
fro... |
#!/usr/bin/env python3
""" A usage example for lecs. """
from lecs import ECS, Entity, Component, System
__author__ = 'Mads H. Jakobsen (ragerin)'
__email__ = 'ragerin@gmail.com'
__version__ = '2.0.0'
__status__ = 'beta'
__license__ = 'MIT'
# Create a simple component
class MooComponent(Component):
"""Data ... |
# -*- coding: utf-8 -*-
from icalendar.tests import unittest
import datetime
import icalendar
import os
import pytz
class TestEncoding(unittest.TestCase):
def test_create_from_ical(self):
directory = os.path.dirname(__file__)
data = open(os.path.join(directory, 'encoding.ics'), 'rb').read()
... |
import sys
from os import listdir
from os.path import isfile, join, isdir, exists
from multiprocessing import Pool
import support
import const
def wordFrequency(fname):
"""
Analysis of word usage for the file
@param fname: file name
@return: word frequency dict
"""
counter = {}
content = su... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 SUNET
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# noti... |
import os
from base64 import b64encode
from common_helper_files.fail_safe_file_operations import get_dir_of_file
from flask import render_template_string
from flask_restx import Resource, Namespace
from helperFunctions.database import ConnectTo
from objects.file import FileObject
from web_interface.components.compone... |
# -*- coding: utf-8 -*-
#
# django-admin-tools-stats documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 7 13:28:47 2011.
#
# 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
# autogenera... |
"""
Python script to generate a zero-offset synthetic from a 3-layer wedge model.
Created by: Wes Hamlyn
Create Date: 19-Aug-2014
Last Mod: 5-Feb-2015
-addition of bandpass wavelet
This script is provided without warranty of any kind.
"""
import numpy as np
imp... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-10-29 18:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import image_cropping.fields
class Migration(migrations.Migration):
dependencies = [
('team', '0004_teammember_job'),
... |
# 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 ... |
import copy
from opcua import ua
import opcua
from opcua.ua.uaerrors import UaError
from opcua.common import ua_utils
class Event(object):
"""
OPC UA Event object.
This is class in inherited by the common event objects such as BaseEvent,
other auto standard events and custom events
Events are use... |
#!/usr/bin/env python
import argparse, os, sys, time
SRC = os.path.split(os.path.realpath(__file__))[0]
def cmd(s):
t0 = time.time()
os.chdir(SRC)
s = "umask 022; " + s
print s
if os.system(s):
sys.exit(1)
print "TOTAL TIME: %.1f seconds"%(time.time() - t0)
def pull():
cmd("git pu... |
from django.urls import reverse
from django.db import models
from meadery.models import Product
from django.core.exceptions import ValidationError
class Warehouse(models.Model):
number = models.IntegerField()
slug = models.SlugField(max_length=50, unique=True, help_text="Unique value for warehouse page URL, c... |
from bitarray import *
class Permutation:
def __init__(self, l):
# if sorted(l) != range(1, len(l)+1):
# raise ValueError("List is not valid!")
self.__bare = [i - 1 for i in l]
def Get(self):
return self.__bare
def Reverse(self):
rev = [0] * len(self.__bare)
... |
#!/usr/bin/env python
def test(memory, noun, verb):
pc = 0
m = memory[:]
if noun is not None:
m[1] = noun
if verb is not None:
m[2] = verb
while pc < len(m):
opcode = m[pc]
if opcode == 1:
augend = m[m[pc + 1]]
addend = m[m[pc + 2]]
... |
# Zeobuilder is an extensible GUI-toolkit for molecular model construction.
# Copyright (C) 2007 - 2009 Toon Verstraelen <Toon.Verstraelen@UGent.be>, Center
# for Molecular Modeling (CMM), Ghent University, Ghent, Belgium; all rights
# reserved unless otherwise stated.
#
# This file is part of Zeobuilder.
#
# Zeobuilde... |
"""
``PluginManager`` unit and public API testing.
"""
import pytest
import types
import sys
from pluggy import (
PluginManager,
PluginValidationError,
HookCallError,
HookimplMarker,
HookspecMarker,
)
hookspec = HookspecMarker("example")
hookimpl = HookimplMarker("example")
def test_plugin_doubl... |
from setuptools import setup, Extension
from Cython.Build import cythonize
import subprocess
import sys
srilm_option = ""
copy_args = sys.argv[1:]
if "--srilm-option" in copy_args:
ind = copy_args.index("--srilm-option")
copy_args.pop(ind)
val = copy_args.pop(ind)
srilm_option = "" if val == "null" els... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.