src stringlengths 721 1.04M |
|---|
import pygame
from pygame.locals import *
from constants import *
from generate_images import *
import time
import pandas as pd
from pylsl import StreamInfo, StreamOutlet
import random
pygame.init()
#pygame.mouse.set_visible(False)
from screen import screen
from drawstuff import *
study_time = int(time.time())
print... |
"""Module grouping tests for the pydov.types.boring module."""
from pydov.types.grondwatervergunning import GrondwaterVergunning
from tests.abstract import AbstractTestTypes
location_wfs_getfeature = \
'tests/data/types/grondwatervergunning/wfsgetfeature.xml'
location_wfs_feature = 'tests/data/types/grondwaterver... |
from binder.exceptions import BinderValidationError
from binder.router import Router
from binder.views import ModelView
from .testapp.views import AnimalView
from .testapp.models import Animal, Caretaker
from django.test import TestCase
class TestSetNullableRelations(TestCase):
def test_standard_filling_in_relati... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Metaswitch Networks
# 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/LIC... |
import numpy as np
import os
import os.path
class csvbuilder:
def __init__(self, cs):
self.cs = cs
if not os.path.isdir('csv'):
os.mkdir('csv')
def month_type_csv(self, site = None):
label = 'all' if site == None else site
values, percentages = self.cs.month... |
import requests
from bs4 import BeautifulSoup
from lxml import etree
import pandas as pd
from io import StringIO, BytesIO
university_list = []
class University():
def __init__(self, name='', is_985=False, is_211=False, has_institute=False, location='', orgnization='',
education_level='', educat... |
#!/usr/bin/env python3
import os
import sys
import socket
import numpy as np
words = []
ifile = 'touslesmots.txt'
try:
fd = open(ifile, mode='rt')
except FileNotFoundError:
fd = open('listes.txt', mode='rt')
url = fd.readline()
fd.close()
cmd = 'curl ' + url.strip() + ' | gzip -d >' + ifile
os.system(cmd... |
import pigui.pyqt5.widgets.list.view
import pigui.pyqt5.widgets.miller.view
import about.editor
import about.delegate
DefaultList = pigui.pyqt5.widgets.list.view.DefaultList
def create_delegate(self, index):
typ = self.model.data(index, 'type')
if typ == 'editor':
suffix = self.model.data(index, '... |
# coding: utf-8
"""
bins.py
Copyright (c) 2011 Nicholas Devenish <n.e.devenish@sussex.ac.uk>
Contains the logic for creating and inspecting sequences of bins
"""
__license__ = """Copyright (c) 2011 Nicholas Devenish <n.e.devenish@sussex.ac.uk>
MIT License <http://www.opensource.org/licenses/mit-license.php>
"""
im... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspa... |
"""Individual methods for assessing ERPAC."""
import numpy as np
from scipy.stats import chi2
from joblib import Parallel, delayed
from tensorpac.gcmi import nd_mi_gg
from tensorpac.config import CONFIG
def pearson(x, y, st='i...j, k...j->ik...'):
"""Pearson correlation for multi-dimensional arrays.
Parame... |
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext as _build_ext
import sys
# bootstrap numpy
# https://stackoverflow.com/questions/19919905/how-to-bootstrap-numpy-installation-in-setup-py
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import SocketServer
import struct
import os
# Format: name_len --- one byte
# name --- name_len bytes
# data --- variable length
# Save data to name into current directory
# Refer to: http://blog.csdn.net/g__gle/article/details/8144... |
#!/usr/bin/python3
import sys
import random
import math
import os
import getopt
import pygame
import shelve
import time
from pygame.locals import *
if not pygame.font:
print('Warning, fonts disabled')
if not pygame.mixer:
print('Warning, sound disabled')
# setting up constants
WINDOW_WIDTH = 640
WINDOW_HEIGH... |
"""
Tests for dataset creation
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "GPL"
import unittest
import tempfile
import os
import shutil
import num... |
from typing import List, Union
from mediawords.db import DatabaseHandler
from mediawords.key_value_store import KeyValueStore, McKeyValueStoreException
from mediawords.util.perl import decode_object_from_bytes_if_needed
class McMultipleStoresStoreException(McKeyValueStoreException):
"""Multiple stores exception.... |
class Solution:
"""
@param n: Given the range of numbers
@param k: Given the numbers of combinations
@return: All the combinations of k numbers out of 1..n
"""
def combine(self, n, k):
# write your code here
if n is None or k is None:
return []
self.result = ... |
# -*- coding: utf-8 -*-
# Copyright (c) 2006 - 2015 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the Editor Autocompletion configuration page.
"""
from __future__ import unicode_literals
from .ConfigurationPageBase import ConfigurationPageBase
from .Ui_EditorAutocompletionPage import Ui_Edi... |
# coding=utf-8
import datetime
from autosubliminal.core.item import WantedItem
wanted_item = WantedItem()
wanted_item.timestamp = '2018-01-01 12:30:01'
def test_compare_wanted_items():
wanted_item_1 = WantedItem(type='episode', title='testequal', season=1, episode=1)
wanted_item_2 = WantedItem(type='episod... |
from cam import OpenCV_Cam
import cv2
import os.path
import time
cam = OpenCV_Cam(0)
cam.size = (1920, 1080)
KEY_ESC = 27
KEY_SPACE = ord(' ')
PAGE_DOWN = 2228224 # This make the stop motion to be controllable by presenter.
prevFrame = None
i = 0
#Make a directory on current working directory with date and time a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# CAVEAT UTILITOR
#
# This file was automatically generated by Grako.
#
# https://pypi.python.org/pypi/grako/
#
# Any changes you make to it will be overwritten the next time
# the file is generated.
from __future__ import print_function, division, absolute_import, un... |
#!/usr/bin/env python
#
# Copyright (c) 2010, Ryan Marquardt
# 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 notice,
# th... |
from uuid import uuid4
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.functional import cached_property
from django.utils.translation import gettext_lazy as _
from .mixins import MPAwareModel
treebeard = True
try:
from treebeard.mp_tree import MP_Node
e... |
#! /usr/bin/env python
"""
Read supplementary table and extract pathogens.
sys.argv[1]: data/DataTable5-metaphlan-metadata_v19.txt
Extract the sample id and the columns which pertain to yersinia and
anthracis.
"""
def split_header(header):
"""
Some headers are really long, return only the last portion.
... |
#!/usr/local/bin/python2.7
from sys import exit, stdout, argv
from os import environ, system
environ['KERAS_BACKEND'] = 'tensorflow'
import numpy as np
import utils
import signal
from keras.layers import Input, Dense, Dropout, concatenate, LSTM, BatchNormalization, Conv1D, concatenate
from keras.models import Model ... |
# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
class TestResLang(TransactionCase):
def setUp(self):
super(TestResLang, self).setUp()
se... |
'''
PortScanner.py (c) 2017 Luca Conterio
This file is part of PortScanner.py.
PortScanner.py 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... |
import sqlite3
class Model():
# Constructor
def __init__(self):
self.setHomeScreenOp(-1)
self.setViewPointer(None)
# Setters
def setViewPointer(self,pointer):
self.viewPointer = pointer
def setHomeScreenOp(self,option):
self.homeScreenOp = option
if(self.getHomeScreenOp() != -1):
if(self.getHomeS... |
from django.conf.urls import url, patterns, include
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import cache_page
from common.views import APIRoot, root_redirect_view
from rest_auth.views import (
Login, Logout, UserDetails, PasswordChange,
PasswordReset, Passwo... |
"""
A new approach to spectral clustering based on iterative eigen decomposition.
"""
import sys
import logging
import time
import scipy.sparse
import scipy.sparse.linalg
import numpy
import scipy.cluster.vq as vq
from sandbox.misc.EigenUpdater import EigenUpdater
from sandbox.misc.Nystrom import Nystrom
from sandbox... |
""" Abstract interface for multiple file storage services"""
from tempfile import TemporaryFile
def loader(backend, *args, **kwargs):
""" Main entry point for all backends
:param backend: File storage class that will be used for this instance """
return backend(*args, **kwargs)
def detector():
""" Finds all su... |
# Copyright (c) 2020, DjaoDjin inc.
# 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 notice,
# this list of conditions and t... |
#!/usr/bin/python
#
# This source file is part of appleseed.
# Visit http://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2015-2016 Hans Hoogenboom, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any ... |
#!/usr/bin/python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import argparse
import re
import datetime
import operator
import pprint
import glob
import gzip
slow_threshold = 10 #seconds
# Nothing to change past here
verbose = None
re_slow = re.compile(r'^(\d+-\d+-\d+\s+\d+:\d+:\d+\.\d+)\s+\w+\s+0.*slow.... |
# -*- coding: UTF-8 -*-
from distutils.command.install import INSTALL_SCHEMES
from distutils.core import setup
from setuptools import find_packages
import os
import re
import time
_version = "0.1.%sdev0" % int(time.time())
_packages = find_packages('butler', exclude=["*.tests", "*.tests.*", "tests.*", "tests"])
# m... |
import datetime
import json
from pupa.scrape import Scraper, Event
import pytz
from .utils import open_csv
class CTEventScraper(Scraper):
_tz = pytz.timezone("US/Eastern")
def __init__(self, *args, **kwargs):
super(CTEventScraper, self).__init__(*args, **kwargs)
def scrape(self):
for... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
from Framework.BancoDeDados import BancoDeDados
from Database.Models.Ass_turma_sala_horario import Ass_turma_sala_horario as ModelAss_turma_sala_horario
class Ass_turma_sala_horario(object):
def pegarAss_turma_sala_horarios(self, condicao, valores):
associacoes = []
for associacao in BancoDeDados().consultarM... |
# -*- coding: utf-8 -*-
##############################################################################
#
# Partner Credit Control module for Odoo
# Copyright (C) 2017 Rosen Vladimirov (vladimirov.rosen@gmail.com)
# @author Rosen Vladimirov <vladimirov.rosen@gmail.com>
#
# This program is free software: you ... |
# -*- coding: utf-8 -*-
# Author: Leonardo Pistone
# Copyright 2014 Camptocamp SA
#
# This program 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... |
from rpython.rtyper.lltypesystem import lltype, llmemory, llarena, llgroup
from rpython.rtyper import rclass
from rpython.rtyper.lltypesystem.lloperation import llop
from rpython.rlib.debug import ll_assert
from rpython.rlib.rarithmetic import intmask
from rpython.tool.identity_dict import identity_dict
class GCData(... |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import binascii
import itertools
import math
import os
import pytest
fr... |
import os
from flask import abort, flash, redirect, render_template, url_for, request, jsonify, make_response, send_file
from flask_login import login_required
from flask_sqlalchemy import SQLAlchemy
import csv
import logging
import requests
import operator
import re
import nltk
from nltk.corpus import stopwords
from c... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""This module contains classes for analyzing the texts of a corpus to accumulate
statistical information about word occurrences."""
im... |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... |
# Copyright Collab 2015-2019
# See LICENSE for details.
from setuptools import setup
from require_i18n import version
test_deps = [
"tox",
"coverage",
"flake8",
"translate-toolkit"
]
setup(
name="django-require-i18n",
version=version,
license="MIT",
description="Django management com... |
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import numpy as np
from trans import undo_transforms
np.random.seed(123)
import tensorflow as tf
tf.set_random_seed(123)
import deepchem as dc
# Load Tox21 dataset
tasks, datasets, transformers = dc.molnet... |
# Parsec Cloud (https://parsec.cloud) Copyright (c) AGPLv3 2016-2021 Scille SAS
from typing import List, Tuple, Dict, Optional
from uuid import UUID
import pendulum
from parsec.utils import timestamps_in_the_ballpark
from parsec.api.protocol import (
DeviceID,
OrganizationID,
vlob_create_serializer,
v... |
#!/usr/bin/env python
# ./generate-load-test-urls.py --number-of-urls=100 --atlas-url=stage.atlas.metabroadcast.com --target-host=host-to-test --api-key=api-key --source=pressassociation.com --num-channels-source=100 --num-channels=10 --platform=hkyn --start-date=2015-02-01 --end-date=2015-02-10
import argparse
impor... |
#pylint: disable=I0011,W0613,W0201,W0212,E1101,E1103
from distutils.version import LooseVersion # pylint:disable=W0611
import pytest
from mock import patch
from ..scatter_widget import ScatterWidget
from ..mpl_widget import MplCanvas
from .... import core
from . import simple_session
from matplotlib import __versio... |
# -*- coding: utf-8 -*-
import warnings
from datetime import datetime
from functools import wraps
from nereid import render_template, request, url_for, flash, redirect, \
current_app, current_user, route, login_required, current_website
from nereid.signals import failed_login
from nereid.globals import session
fro... |
import bpy
import math
from bpy.props import FloatProperty
class SmoothShading(bpy.types.Operator):
"""Activate the Auto Smooth with an 45° angle"""
bl_idname = "object.smooth_shading"
bl_label = "Advanced Smooth Shading"
bl_options = {'REGISTER', 'UNDO'}
angle = FloatProperty(name="Angle Value"... |
# -*- coding: utf-8 -*-
#Attention! RoundInstanceFactory is in fact a python script where defines uniquely a python class
#If we want to instantiate this class, use its method
#Using syntax like "from RoundInstanceFactory import *" instead of "import RoundInstanceFactory"
# Inspired from this post : http://pymotw.com... |
import smtplib, logging, datetime, imaplib
import email
AUTH_EMAIL_SENDER = 'choeminjun@naver.com'
class MailSenderAPP(object):
def __init__(self, my_email, my_password):
self.myEmail = my_email
self.myPassword = my_password
self.mailSever = smtplib.SMTP("smtp.gmail.com", 587)
# Em... |
#!/usr/local/bin/python3
# Filename: ExecuteFileDirectory.py
# Version 1.0 04/09/13 JS MiloCreek
# Version 3.0 04.04.2016 IzK (Python3.4+)
import Config
import glob
import os
import xml.etree.ElementTree as ET
import BuildResponse
import time
def Execute_File_Directory(root):
# find the interface object type
... |
import re
import os
import tempfile
from datetime import datetime, timedelta
import glob
import subprocess
import numpy as np
import scipy.ndimage as ndimage
import src.data.readers.load_hrit as load_hrit
import src.config.filepaths as fp
class BatchSystem:
"""Container for syntax to call a batch queuing syste... |
#!/usr/bin/env python
# This file is part of nexdatas - Tango Server for NeXus data writer
#
# Copyright (C) 2012-2014 DESY, Jan Kotanski <jkotan@mail.desy.de>
#
# nexdatas is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the ... |
# <CustomTools>
# <Menu>
# <Item name="pIceImarisConnector: Test PyramidalCell" icon="Python3" tooltip="Test function for pIceImarisConnector using the PyramidalCell demo dataset.">
# <Command>Python3XT::TestPIcePyramidalCellXT(%i)</Command>
# </Item>
# </Menu>
# </CustomTools>
import os
import numpy as... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
# Copyright 2016 IBM 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 agreed t... |
# -*- coding: utf-8 -*-
from sympy import (Symbol, symbols, oo, limit, Rational, Integral, Derivative,
log, exp, sqrt, pi, Function, sin, Eq, Ge, Le, Gt, Lt, Ne, Abs)
from sympy.printing.python import python
from sympy.utilities.pytest import raises, XFAIL
x, y = symbols('x,y')
th = Symbol('theta')
ph = Symbo... |
#!/usr/bin/env python
# coding: utf-8
"""Unicode tests."""
# pkg
from hebphonics import tokens as T
def test_normalize():
"""normalize unicode symbols"""
want = T.LETTER_ALEF + T.POINT_DAGESH_OR_MAPIQ
test = T.normalize(T.LETTER_ALEF_WITH_MAPIQ)
assert test == want
want = T.LETTER_AYIN
test ... |
"""
This module is imported from the pandas package __init__.py file
in order to ensure that the core.config options registered here will
be available as soon as the user loads the package. if register_option
is invoked inside specific modules, they will not be registered until that
module is imported, which may or may... |
#!/usr/bin/env python
# Setup project environment in the parent directory.
import os
import sys
sys.path[0] = os.path.dirname(sys.path[0])
from common.appenginepatch.aecmd import setup_env
setup_env()
import datetime
from google.appengine.ext import db
from google.appengine.ext.remote_api import remote_api_stub
from... |
import json
import os
import socket
import threading
import traceback
import urlparse
import uuid
from .base import (CallbackHandler,
RefTestExecutor,
RefTestImplementation,
TestharnessExecutor,
extra_timeout,
strip_server)
... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 7 12:32:36 2016
@author: user
"""
import sys
sys.path.insert(0, '/Users/user/Desktop/repo_for_pyseries/pyseries/')
import pyseries.LoadingData as loading
import pyseries.Preprocessing as prep
import pyseries.Analysis as analysis
def plot_rest():
# paths = [ '/Use... |
# -*- Mode: Python -*-
# GDBus - GLib D-Bus Library
#
# Copyright (C) 2008-2011 Red Hat, Inc.
#
# This library 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 of the License, or (at ... |
# -*- coding: utf8 -*-
# This trivial HMI is decoupled from ModBus server
import gevent
from flask import Flask, render_template
from flask_sockets import Sockets
from pymodbus.client.sync import ModbusTcpClient
from time import sleep
import sys
app = Flask(__name__)
sockets = Sockets(app)
try:
myip = sys.argv[1... |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 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 render_template
from indico.core.notifications import email_sender, make_email
@email... |
#!/usr/bin/env python
'''
test follow-me options in ArduPilot
Andrew Tridgell
September 2016
'''
import sys, os, time, math
from MAVProxy.modules.lib import mp_module
from MAVProxy.modules.lib import mp_util
from MAVProxy.modules.lib import mp_settings
from MAVProxy.modules.mavproxy_map import mp_slipmap
from pymav... |
# -*- coding: utf-8 -*-
"""
"""
# Copyright (C) 2015 ZetaOps Inc.
#
# This file is licensed under the GNU General Public License v3
# (GPLv3). See LICENSE.txt for details.
from io import BytesIO
from zengine.lib.translation import gettext as _, gettext_lazy
import six
from zengine.forms import JsonForm
from zengine.... |
# Portions Copyright (C) 2015 Intel Corporation
''' Powerflow results for one Gridlab instance. '''
import sys
import shutil
import os
import datetime
import multiprocessing
import pprint
import json
import math
import traceback
import __metaModel__
import logging
from os.path import join as pJoin
from os.path import ... |
"""Test show pools."""
from mpf.tests.MpfTestCase import MpfTestCase, patch
class TestShowPools(MpfTestCase):
def get_config_file(self):
return 'test_show_pools.yaml'
def get_machine_path(self):
return 'tests/machine_files/shows/'
def test_pool_random(self):
with patch("mpf.core... |
#!/usr/bin/python
from pssh import SSHClient, ParallelSSHClient, utils
import datetime
import time
import random
import sys
output = []
hosts = ['client0', 'client1', 'client2','client3', 'client4']
client = ParallelSSHClient(hosts)
values = ["bear","cake","fork","pipe","gun"]
def open_movies(my_values, delay):
c... |
from .core import COLOR_SPACES, Color, Scale
from ._version import __version__
def lab(L, a, b):
"""
Create a spectra.Color object in the CIELAB color space.
:param float L: L coordinate.
:param float a: a coordinate.
:param float b: b coordinate.
:rtype: Color
:returns: A spectra.Color o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# async - A tool to manage and sync different machines
# Copyright 2012,2013 Abdó Roig-Maranges <abdo.roig@gmail.com>
#
# 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
# th... |
# -*- coding: utf-8 -*-
from .yadisk_object import YaDiskObject
__all__ = ["DiskInfoObject", "SystemFoldersObject", "UserObject", "UserPublicInfoObject"]
class DiskInfoObject(YaDiskObject):
"""
Disk information object.
:param disk_info: `dict` or `None`
:ivar max_file_size: `int`, maxim... |
from . import kernels as FKN
import numpy
def lpt1(dlin_k, q, resampler='cic'):
""" Run first order LPT on linear density field, returns displacements of particles
reading out at q. The result has the same dtype as q.
"""
basepm = dlin_k.pm
ndim = len(basepm.Nmesh)
delta_k = basepm.create(... |
from functools import singledispatch
from itertools import chain
import FIAT
from FIAT.polynomial_set import mis
import finat
from finat.fiat_elements import FiatElement
from finat.physically_mapped import PhysicallyMappedElement
# Sentinel for when restricted element is empty
null_element = object()
@singledispa... |
#!/usr/bin/env python
"""
diff_controller.py - controller for a differential drive
Copyright (c) 2010-2011 Vanadium Labs LLC. All right reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributi... |
from django.db import models
from djangotoolbox.fields import ListField
from copy import deepcopy
import re
regex = type(re.compile(''))
class LookupDoesNotExist(Exception):
pass
class LookupBase(type):
def __new__(cls, name, bases, attrs):
new_cls = type.__new__(cls, name, bases, attrs)
if ... |
# Copyright 2014-2015 Ivan Kravets <me@ikravets.com>
#
# 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... |
# ===============================================================================
# Copyright 2014 Jake Ross
#
# 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... |
from iblt import IBLT
t = IBLT( 30, 4, 10, 10 )
assert t.is_empty()
# Test if inserting and deleting the same pair in an empty table
# results in an empty table again
t.insert( "testkey", "testvalue" )
t.insert( "key", "value" )
assert not t.is_empty()
t.delete( "testkey", "testvalue" )
t.delete( "key", "value" )
... |
from __future__ import division, print_function, absolute_import
import math
import tensorflow as tf
try:
from tensorflow.contrib.layers.python.layers.initializers import \
xavier_initializer
except Exception:
xavier_initializer = None
try:
from tensorflow.contrib.layers.python.layers.initializers ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
Directory structure
TRAIN_DIR:
label0:
img0001.png
img0002.png
img0003.png
label1:
img0001.png
img0002.png
.
.
.
label9:
img0001.png
'''
import cv2, os, gzip, random
import numpy as np
from itertools import chain
class MakeMn... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import datetime
from xml.sax.saxutils import unescape
from user import make_anonymous_user
from exeptions import HttpStatusError, RegexError
class Comment:
__tag_expressions = re.compile(r"<.+?>")
__date_id_expressions = re.compile(r" ID:")
__trip_e... |
from PyQt5 import QtSql, QtCore
from enum import Enum
from personal import calendario
from personal import personal
from personal import trabajador
def transaccion(func):
def func_wrapper(*args):
QtSql.QSqlDatabase.database().transaction()
func(*args)
QtSql.QSqlDatabase.database().commit(... |
#!/usr/bin/env python
import requests, json, re
class Hero(object):
try:
r = requests.get("https://api.opendota.com/api/heroes", timeout=30)
except requests.exceptions.ReadTimeout:
print("Request timed out!")
exit(1)
__data = json.loads(r.text)
def __init__(self, hero_id):
self.hero_id = hero_id
for ... |
#!/usr/bin/python
"""
Copyright 2014 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Test compare_rendered_pictures.py
TODO(epoger): Create a command to update the expected results (in
self._output_dir_expected) when appropriate. For now, you should:
1.... |
#!/usr/bin/python2 -u
from hashlib import sha256
from Crypto import Random
from Crypto.Random import random
from Crypto.Cipher import AES
from subprocess import check_output, STDOUT, CalledProcessError
#Get password from getPassword.py
# Now we communicate with server here to get flag
BLOCK_SIZE = 16
R = Random.new()... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import pyowm.commons.exceptions
from pyowm.alertapi30.condition import Condition
from pyowm.alertapi30.enums import WeatherParametersEnum, OperatorsEnum
class TestCondition(unittest.TestCase):
def test_condition_fails_with_wrong_parameters(self):
... |
from unittest import skip
from gaiatest import GaiaTestCase
class TestApp(GaiaTestCase):
"""Test standard app functionality like menu bar and tab-switching."""
popular_tab = ('css selector', '#popular-tab-container')
popular_tab_link = ('css selector', '#popular-tab a')
search_input = ('id', 'podcas... |
#
# Copyright (c) 2015-2018 LabKey Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from common.chrome_proxy_shared_page_state import ChromeProxySharedPageState
from telemetry.page import page as page_module
from telemetry import story
cla... |
# Copyright 2011 Piston Cloud Computing, 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
#
# Unle... |
import struct
import binascii
import binwalk.core.plugin
class JFFS2ValidPlugin(binwalk.core.plugin.Plugin):
'''
Helps validate JFFS2 signature results.
The JFFS2 signature rules catch obvious cases, but inadvertently
mark some valid JFFS2 nodes as invalid due to padding (0xFF's or
0x00's) in b... |
"""Implements Subscriptions/Manifest handling for the UI"""
import os
from robottelo.decorators import bz_bug_is_open
from robottelo.ui.base import Base
from robottelo.ui.locators import common_locators, locators
from robottelo.ui.navigator import Navigator
class Subscriptions(Base):
"""Manipulates Subscriptions... |
# Copyright (c) 2013 Matthieu Huguet
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, dist... |
# gets all the asso posts and puts it in a single .txt file
import json
import os
txt_250 = list()
txt_500 = list()
txt_1000 = list()
txt_1500 = list()
txt_plus = list()
stats_250 = list()
stats_500 = list()
stats_1000 = list()
stats_1500 = list()
stats_plus = list()
varrad = u'txt_'
varrad2 = u'stats_'
for i in r... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.