content
stringlengths
4
20k
# coding: utf-8 from __future__ import absolute_import from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from tapi_server.models.base_model_ import Model from tapi_server.models.tapi_common_forwarding_direction import TapiCommonForwardingDirection # noqa: F401,E501 from t...
# -*- coding: utf-8 -*- from unidecode import unidecode from django import forms from django.template.defaultfilters import slugify from django.utils.safestring import mark_safe from django.utils.translation import ugettext, get_language from hvad.forms import TranslatableModelForm from app_data.forms import multifo...
"""Tests for colorectal_histology dataset module.""" from tensorflow_datasets import testing from tensorflow_datasets.image_classification import colorectal_histology # testing/colorectal_histology.py generates fake input data num_classes = len(colorectal_histology._CLASS_NAMES) # pylint: disable=protected-access ...
from datetime import datetime import sys import numpy as np import pytest from pandas.compat import PYPY import pandas as pd from pandas import DataFrame, Index, Series import pandas._testing as tm from pandas.core.accessor import PandasDelegate from pandas.core.base import NoNewAttributesMixin, PandasObject class...
"""Indexer objects for computing start/end window bounds for rolling operations""" from datetime import timedelta from typing import Dict, Optional, Tuple, Type import numpy as np from pandas._libs.window.indexers import calculate_variable_window_bounds from pandas.util._decorators import Appender from pandas.core.d...
############### Sage Server Configurations ############### # This class encapsulates a list of Sage servers which can provide us with Sage processes. # The class is static--it is never meant to be instantiated. # The list is populated in MainWindow.restoreSettings(). # A "Sage server" can be a path to a local Sage ins...
from pipenv.patched.notpip._vendor.six.moves.urllib import parse as urllib_parse class PackageIndex(object): """Represents a Package Index and provides easier access to endpoints """ def __init__(self, url, file_storage_domain): # type: (str, str) -> None super(PackageIndex, self).__init_...
from datetime import date import pytest from hijri_converter import convert @pytest.fixture(scope="module") def hijri(): return convert.Hijri(1410, 8, 13) @pytest.fixture(scope="module") def gregorian(): return convert.Gregorian(1990, 3, 10) def test_hijri_representation(hijri): assert hijri.__repr_...
"""Abstract model to show each relation from two sides.""" from psycopg2.extensions import AsIs from openerp import _, api, fields, models from openerp.tools import drop_view_if_exists PADDING = 10 _RECORD_TYPES = [ ('a', 'Left partner to right partner'), ('b', 'Right partner to left partner'), ] class Res...
from esengine.bases.py3 import * # noqa from esengine.fields import StringField from esengine.exceptions import ValidationError import warnings from six import iteritems class BaseDocument(object): _strict = False _validators = None _query_fields = None def _initialize_defaults_fields(self, ignore=...
import ctypes, errno, msvcrt, os, subprocess, random _kernel32 = ctypes.windll.kernel32 _advapi32 = ctypes.windll.advapi32 _user32 = ctypes.windll.user32 _BOOL = ctypes.c_long _WORD = ctypes.c_ushort _DWORD = ctypes.c_ulong _UINT = ctypes.c_uint _LONG = ctypes.c_long _LPCSTR = _LPSTR = ctypes.c_char_p _HANDLE = ctype...
""" Terminal progressbars. """ import sys import math import time import datetime import collections # Represents probablistic progress # Example: tossing an unfair coin until we see heads # `n` number of tosses so far # `n5` number of tosses required such that on average 5% is done # `n50` number of tosses requir...
import pygtk import gtk try: import gtkhtml2 # needed to render the news GTKHTML2_IS_AVAILABLE = True except ImportError: GTKHTML2_IS_AVAILABLE = False from TitleText import TitleText class NewsView(gtk.VBox): def __init__(self, main): super(NewsView, self).__init__(False, 6) ...
import attr from cached_property import cached_property from navmazing import NavigateToAttribute from navmazing import NavigateToSibling from widgetastic.utils import Fillable from widgetastic.widget import Text from . import AddDialogView from . import AutomateCustomizationView from . import EditDialogView from .dia...
# -*- coding: utf-8 -*- """ Patient Tracking """ module = request.controller if not settings.has_module(module): raise HTTP(404, body="Module disabled: %s" % module) # ----------------------------------------------------------------------------- def index(): "Module's Home Page" module_name = setti...
""" UID modules provides handful functions for managing the uids. """ import cti, ctr import alias def is_valid_uid(s): """ Returns true if UID is valid. Args: s: the UID Returns: true if UID is valid """ return cti.cti_plugin_is_UID(str(s)) #---------------------...
# if this is running from the scripts folder, move up a folder. import os, sys if not 'server.py' in os.listdir('.') and 'scripts' in os.listdir('..'): os.chdir('..') sys.path.append('.') import urllib, zipfile, sys, os, ip2country # url = 'http://public.zjt3.com/uberserver/deps.zip' # site down url = 'ht...
# -*- coding: utf-8 -*- ''' Exodus Add-on Copyright (C) 2016 Exodus 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 l...
#!/usr/bin/env python # Everything is always in millimeters, not stupid imperial! # Jog machine to desired location then run the output generated by this script. from gcode_base import * from gcode_profile_polygon import * from math_base import * def cherrymx_keycross_points( height=4.0, ...
""" Utilities This API is considered private to static.py and is therefore subject to change. """ __all__ = [ "allDataFromStream", "davXMLFromStream", "noDataFromStream", "normalizeURL", "joinURL", "parentForURL", "unimplemented", "bindMethods", ] from urlparse import urlsplit, urluns...
#!/usr/bin/python # -*- coding: UTF-8 -*- from __future__ import absolute_import from __future__ import with_statement from __future__ import division from __future__ import nested_scopes from __future__ import generators from __future__ import unicode_literals from __future__ import print_function from neurotools.syst...
""" PyRakLib networking library. This software is not affiliated with RakNet or Jenkins Software LLC. This software is a port of PocketMine/RakLib <https://github.com/PocketMine/RakLib>. All credit goes to the PocketMine Project (http://pocketmine.net) Copyright (C) 2015 PyRakLib Project This progra...
from guizero import App, Waffle from threading import Event from unittest.mock import MagicMock from common_test import ( schedule_after_test, schedule_repeat_test, destroy_test, enable_test, display_test, color_test, events_test, cascaded_properties_test, inherited_properties_test, ...
import sys import copy import itertools import json from logbook import Logger import threading from codecs import open from xml.etree import ElementTree from xml.dom import minidom import gzip # noinspection PyPackageRequirements import wx import config import eos.db from service.esi import Esi from eos.saveddata....
"""Client support for switch related api calls.""" import json from hil.client.base import check_reserved_chars from hil.client.base import ClientBase class Switch(ClientBase): """Consists of calls to query and manipulate node related objects and relations. """ def list(self): """List all no...
from __future__ import annotations import re from collections import defaultdict from dataclasses import dataclass from typing import DefaultDict from pants.backend.codegen.protobuf.protoc import Protoc from pants.backend.codegen.protobuf.target_types import ProtobufSources from pants.base.specs import AddressSpecs, ...
#!/usr/bin/env python import sys, tty, termios import getopt import time import pigpio sonar_pulse_start = 0 sonar_pulse_finish = 0 sonar_state = 0 # Waiting for trigger def getchar(): fd = sys.stdin.fileno() old_settings = termios.tcgetattr(fd) try: tty.setraw(sys.stdin.fileno()) ch = sys...
{ 'name': 'Purchase Order Report', 'version': '1.0', 'url': 'http://launchpad.net/openerp-ccorp-addons', 'author': 'ClearCorp S.A.', 'website': 'http://clearcorp.co.cr', 'category': 'Purchase Management', 'complexity': 'normal', 'description': """This module modifies the purchase order R...
from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential class FarmBeatsC...
import sys import time import espressopp import mpi4py.MPI as MPI import unittest class TestPythonTools(unittest.TestCase): def setUp(self): system = espressopp.System() box = (10, 10, 10) system.bc = espressopp.bc.OrthorhombicBC(system.rng, box) system.skin = 0.3 system.c...
import nest import nest.voltage_trace nest.ResetKernel() #Parameter set for depression dep_params={"U":0.67, "u":0.67, 'x':1.0, "tau_rec":450.0, "tau_fac":0.0, "weight":250.} # parameter set for facilitation fac_params={"U":0.1, "u":0.1, 'x':1.0, "tau_fac":1000.,"tau_rec":100.,"weight":250.} # Here we assign the pa...
from pywingui.windows import * from pywingui.wtl import * from pywingui import gdi from pywingui.winuser import MAKEINTRESOURCE HORIZONTAL = 1 VERTICAL = 2 class Splitter(Window): _window_style_ = WS_CHILD | WS_VISIBLE _window_style_ex_ = 0 _window_background_ = gdi.GetSysColorBrush(COLOR_BTNFACE) ...
""" Data migration script related to Alembic revision 51637c12cbd9, which creates the installation table. The Alembic migration back-populates the installation table based on existing recipe_resource rows, however for system_resource (recipes run on systems) the migration leaves kernel_options empty. This online mi...
from odoo.tests.common import TransactionCase class TestPackingNeg(TransactionCase): def test_packing_neg(self): # Create a new "negative" stockable product product_neg = self.env['product.product'].create({ 'name': 'Negative product', 'type': 'product', 'cat...
# -*- coding : utf-8 -*- import urllib.request import urllib.parse import requests import json import time import multiprocessing import os from args_http import args base_url = "http://10.33.2.231:8008" # single post request def requests_post( **arg ): interface = arg['interface'] text = arg['text'] it...
import urlparse,sys,re import urllib, urllib2 from urlparse import parse_qsl import requests import xml.etree.ElementTree as ET import xbmcaddon, os params = dict(urlparse.parse_qsl(sys.argv[2].replace('?',''))) action = params.get('action') content = params.get('content') name = params.get('name') url = params....
#!/usr/bin/env python # -*- coding: utf-8 -*- """Resuleve el ejercicio 13 de la guia 8.""" from __future__ import division from __future__ import unicode_literals import argparse from matplotlib import pyplot as plt import numpy as np import pandas as pd import seaborn as sns from scipy import optimize from scipy.sta...
import collections.abc import errno import socket import sys import unittest from test import support import xmlrpc.client as xmlrpclib class CurrentTimeTest(unittest.TestCase): def test_current_time(self): # Get the current time from xmlrpc.com. This code exercises # the minimal HTTP functional...
""" ******************************************************************************* * Ledger Blue * (c) 2016 Ledger * * 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....
import os, unittest, socket, sys, threading from passfd import sendfd, recvfd import _passfd class TestPassfd(unittest.TestCase): def readfd_test(self, fd): s = os.read(fd, 512) self.assertEquals(s, "\0" * 512) def vrfy_recv(self, tuple, msg): self.readfd_test(tuple[0]) self.as...
""" A module that provides convenience functions for sending alerts. Currently this includes sending text (SMS) messages or emails. This is accomplished through two mechanisms: Google Voice B{or} SMTP. Using Google Voice ================== To use Google Voice, this module requires a Google Voice account and depends o...
import json import os import resource import signal import socket import struct import cffi import prctl _ffi = cffi.FFI() _ffi.cdef('void _exit(int);') _libc = _ffi.dlopen(None) def _exit(n=1): """Invoke _exit(2) system call.""" _libc._exit(n) def read_exact(fp, n): buf = '' while len(buf) < n: ...
from scipy import interpolate import numpy as np from math import pow, sqrt from ..core.status import Status class BaseInterpolator(object): def write_summary(self, x, y): for i in range(len(x)): Status.add("{0} {1}".format(x[i], y[i]), verbosity=3) def removeNans(self, x, y): ...
from Reversi.Game import Game from Reversi.Game import Move from Players.HumanPlayer import HumanPlayer from Players.AIPlayer import AIPlayer from Players.Monkey import Monkey from Board.BoardControl import BoardControl size = 8 g = Game(size) players={'B': HumanPlayer(), 'W': AIPlayer(6)} c = BoardControl(size,s...
# -*- coding: utf-8; -*- """ Copyright (C) 2007-2013 Guake authors 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 progra...
from . import common import os class test_status(common.basetest): def test_empty(self): self.assertEquals(self.client.status(), []) def test_one_of_each(self): self.append('.hgignore', 'ignored') self.append('ignored', 'a') self.append('clean', 'a') self.append('modifi...
# coding: utf-8 # In[125]: # This program detects faces in picture, rotates the pictures automatically according to the exif tag (jhead must be installed) # asks for the Names of the people and adds the names as in the Note field of the Exif info. # It uses the face_recognition library to detect automatically faces. ...
import socket import subprocess import time from util import hook, http socket.setdefaulttimeout(10) # global setting def get_version(): try: stdout = subprocess.check_output(['git', 'log', '--format=%h']) except: revnumber = 0 shorthash = '????' else: revs = stdout.spli...
# -*- coding: utf-8 -*- ''' Module for managing block devices .. versionadded:: 2014.7.0 .. deprecated:: Carbon Merged to `disk` module ''' from __future__ import absolute_import # Import python libs import logging # Import salt libs import salt.utils import salt.utils.decorators as decorators log = logging.get...
import threading import multiprocessing import logging LOG = logging.getLogger(__name__) def schedule_work(func): return func def regex_work(matcher, message, matchq): def processor(): LOG.debug('Trying match with regex {}'.format(matcher.pattern)) # We defer the condition matching to the w...
from math import * import numpy as np import matplotlib.pyplot as plt def divide(a,b): if b == 0: return 1 return a/b def makeOnePreRecCurve(Y, P, doHold=True, color='b-'): N = Y.shape[0] a = np.array([(P[i], Y[i]) for i in range(N)], dtype=[('p',np.float),('y',np.float)]) S = 0.0 T = ...
from odoo import api, models class CompassionHold(models.Model): _inherit = 'compassion.child' @api.multi def get_sms_sponsor_child_data(self): """ Returns JSON data of the child for the mobile sponsor page :return: JSON data """ self.ensure_one() result = ...
from __future__ import print_function import json import os import platform import re import signal import subprocess import sys import tempfile import textwrap import time from timing import monotonic_time_nanos from tracing import Tracing from subprocutils import check_output, CalledProcessError MAX_BUCKD_RUN_COUNT...
#!/usr/bin/env python import os import asyncio import random import time import datetime import signal @asyncio.coroutine def check_incoming_files(): print("Enter the check_incoming_files") while True: delay = random.random()*5+2 delay = 1 print("+++ Running check_incoming_files wil...
# -*- coding: utf-8 -*- """ Nearest Centroid Classification """ # Olivier Grisel <<EMAIL>> # # License: BSD Style. import numpy as np from scipy import sparse as sp from ..base import BaseEstimator, ClassifierMixin from ..externals.six.moves import xrange from ..metrics.pairwise import pairwise_distances fro...
""" Other testing examples """ from ..test_registrar import good, fail # dummy good(['*'], [0]) good(['*', '*'], [0, 1]) good(['=0', '=1'], [0, 1]) fail(['=0', '=1'], [0, 2]) # Lists of equal length good(['list[N]', 'list[N]'], [[4], [3]]) good(['list[N]', 'list[N]'], [[], []]) fail(['list[N]', 'list[N]'], [[], [1]]...
# coding:utf-8 from datetime import datetime, timedelta from threading import Thread from time import sleep from database import DataBaseHandler, time_step from api import get_api from after_retrievers import after_timedelta from date_time_retrievers import retrieve_datetime from text_retrievers import retrie...
from io import BytesIO import csv import ete3 import json import os import pymongo import requests import zipfile from datanator.util import mongo_util import datanator.config.core class CorumNoSQL(mongo_util.MongoUtil): def __init__(self, MongoDB, db, replicaSet=None, verbose=False, max_entries=float('in...
from direct.directnotify import DirectNotifyGlobal from direct.showbase.PythonUtil import invertDictLossless from toontown.coghq import CountryClubRoomSpecs from toontown.toonbase import ToontownGlobals from direct.showbase.PythonUtil import normalDistrib, lerp import random def printAllBossbotInfo(): print 'roomI...
#!/usr/bin/env python2.7 # script to compute local GC content with sliding windows __author__ = "Ludovic Duvaux" __maintainer__ = "Ludovic Duvaux" __license__ = "GPL_v3" import sys, argparse from Bio import SeqIO from Bio.SeqUtils import GC # 0.1) get options from commands lines parser = argparse.ArgumentParser(desc...
import os import shutil import subprocess import tempfile from mozprocess import ProcessHandler from serve.serve import make_hosts_file from .base import Browser, require_arg, get_free_port, browser_command, ExecutorBrowser from ..executors import executor_kwargs as base_executor_kwargs from ..executors.executorserv...
"""Lazy loading for Python 3.6 and above. This uses the new importlib finder/loader functionality available in Python 3.5 and up. The code reuses most of the mechanics implemented inside importlib.util, but with a few additions: * Allow excluding certain modules from lazy imports. * Expose an interface that's substan...
from distutils.core import setup import py2exe import sys sys.argv.append('py2exe') setup( name='Mangle', windows=[{'script': 'mangle.pyw'}], data_files=[('', ['LICENSE']), ('mangle/ui', ['mangle/ui/book.ui', 'mangle/ui/about.ui', ...
from PyQt4.QtCore import SIGNAL from weboob.tools.application.qt import QtMainWindow from weboob.tools.application.qt.backendcfg import BackendCfg from weboob.capabilities.messages import ICapMessages from .ui.main_window_ui import Ui_MainWindow from .messages_manager import MessagesManager class MainWindow(QtMainW...
dicInt_Type={} import AddAccount dicInt_Type[AddAccount.CAddAccount.command_id]=AddAccount.CAddAccount import AddApartment dicInt_Type[AddApartment.CAddApartment.command_id]=AddApartment.CAddApartment import AddDevice dicInt_Type[AddDevice.CAddDevice.command_id]=AddDevice.CAddDevice import AddSuperbox dic...
import base64 from operator import itemgetter import psycopg2 import werkzeug from werkzeug import url_encode import openerp from openerp import SUPERUSER_ID from openerp import http from openerp.exceptions import AccessError from openerp.http import request from openerp.addons.web.controllers.main import binary_cont...
from django.db.models import Q from tastypie.authentication import ApiKeyAuthentication from tastypie.authorization import DjangoAuthorization from tastypie.exceptions import Unauthorized from tastypie.compat import get_user_model, get_username_field from guardian.shortcuts import get_objects_for_user from tastypie.ht...
# -count_words.py *- coding: utf-8 -*- import sys filename = sys.argv[1] # print("\n",filename,"\n") # You can check that the filename is correct text_file = open(filename) # open the file for reading # Set up an empty dictionary to start a standard design pattern loop words_dic = {} # This loop...
from pprint import pformat import os import re import sys #stif.bx0012sb.309113.wkd.closed #stif.q_0031__.509084.sat stif_filename_re = re.compile("stif\\.(?P<borough>m|b|bx|q|s)_?(?P<route_no>\d{4})(?P<unknown_flags>x_|c_|o_|sb|__)\\.(?P<unknown_2>\w{6})\\.(?P<day_of_week>sat|sun|wkd\\.open|wkd.\\closed)") #rtif.gs...
from __future__ import absolute_import from __future__ import unicode_literals import tempfile import dnf.comps import dnf.persistor import dnf.pycomp import tests.support IDS = set(['one', 'two', 'three']) class RepoPersistorTest(tests.support.TestCase): def setUp(self): self.persistdir = tempfile.m...
""" Watch user likers stories! This script could be very useful to attract someone's audience to your account. If you will not specify the user_id, the script will use your likers as targets. Dependencies: pip install -U instabot Notes: You can change file and add there yo...
#!/usr/bin/env python __version__ = "2.6" import threading import socket import Queue import time import paramiko #import custom modules import util_uploader as uploader import util_ip_operations as ipop import module_linux as ml import module_solaris as ms import module_mac as mc import module_freeb...
# coding=utf-8 import unittest """809. Expressive Words https://leetcode.com/problems/expressive-words/description/ Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii". Here, we have groups, of adjacent letters that are all the same character, and adjacent char...
'''A (PHP) Docblock generator plugin for Coda''' import cp_actions as cp from Docblock import Docblock def act(controller, bundle, options): ''' Required action method Supplying a lang option will override the automatic language guessing (which might not be such a bad thing...) ''' c...
"""qutebrowser has the concept of functions, exposed to the user as commands. Creating a new command is straightforward:: from qutebrowser.api import cmdutils @cmdutils.register(...) def foo(): ... The commands arguments are automatically deduced by inspecting your function. The types of the function a...
from __future__ import absolute_import from __future__ import print_function from django.core.management.base import BaseCommand from zerver.lib.actions import do_rename_stream from zerver.models import Realm, get_realm import sys class Command(BaseCommand): help = """Change the stream name for a realm.""" ...
# encoding: utf-8 import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): # set local fields from ows_url from geonode import settings for maplayer in orm.MapLayer.objects.all(): ...
from configuration import glob_init as glob from modules import api_calls as api import sys import os import time import datetime import requests.packages.urllib3 import argparse if __name__ == '__main__': #disabling InsecureRequestWarning from ssl request requests.packages.urllib3.disable_warnings() #ini...
from tempfile import NamedTemporaryFile, SpooledTemporaryFile, TemporaryFile,\ TemporaryDirectory import unittest from pathlib import Path from cylc.flow.subprocctx import SubProcContext from cylc.flow.subprocpool import SubProcPool, _XTRIG_FUNCS, get_func class TestSubProcPool(unittest.TestCase): def test...
from django import template register = template.Library() @register.tag(name="session_strategy") def do_stockrecord(parse, token): """ Template tag for fetching the appropriate stockrecord for a product and returning it to the context """ tokens = token.split_contents() if len(tokens) < 3 or...
from django.template import Library from webline_notifications.models import Notification from django.template.defaultfilters import stringfilter register = Library() @register.inclusion_tag('notification/nav_link.html') def notifications_link(user, limit=None): all_count = Notification.objects.count() not_s...
# -*- coding: utf-8 -*- import re import time from base64 import urlsafe_b64encode from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class DlProtectCom(SimpleCrypter): __name__ = "DlProtectCom" __type__ = "crypter" __version__ = "0.04" __pattern__ = r'https?://(...
from app.schema_validation.definitions import uuid get_inbound_sms_request = { "$schema": "http://json-schema.org/draft-04/schema#", "description": "schema for query parameters allowed when getting list of received text messages", "type": "object", "properties": { "older_than": uuid, }, ...
"""SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python and does not require any external libraries, except optionally for ...
#!/usr/bin/env python3 """Download flags of countries (with error handling). Sequential version Sample run:: $ python3 flags2_sequential.py -s DELAY b DELAY site: http://localhost:8002/flags Searching for 26 flags: from BA to BZ 1 concurrent connection will be used. -------------------- 17 f...
# downscale the prepped cmip5 data downloaded using SYNDA for TEM if __name__ == '__main__': import glob, os, rasterio, itertools from functools import partial import downscale from downscale import preprocess import numpy as np import argparse # # parse the commandline arguments parser = argparse.ArgumentPars...
# -*- coding: utf-8 -*- """ Tests use of IsoCurve item displayed with image """ import initExample ## Add path to library (just for examples; you do not need this) from pyqtgraph.Qt import QtGui, QtCore import numpy as np import pyqtgraph as pg import scipy.ndimage as ndi app = QtGui.QApplication([]) ## make pret...
# encoding: utf-8 # module PyQt4.QtGui # from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so # by generator 1.135 # no doc # imports import PyQt4.QtCore as __PyQt4_QtCore from .QFrame import QFrame class QLabel(QFrame): """ QLabel(QWidget parent=None, Qt.WindowFlags flags=0) ...
#!/usr/bin/env python # coding: utf-8 import urllib2 import ConfigParser import json import time import random import pymongo import fake_useragent def get_json(url): print 'Fetching:', url while True: time.sleep(1) try: request = urllib2.Request(url) page = urllib2.urlopen(request) except Exception as ...
import hashlib import logging from binascii import hexlify, unhexlify from struct import pack, unpack logger = logging.getLogger(__name__) ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" def encodeBase58(num, alphabet=ALPHABET): """Encode a number in Base X `num`: The number to enco...
""" OpenStack Client interface. Handles the REST calls and responses. """ import httplib2 import logging import os import urlparse try: import json except ImportError: import simplejson as json # Python 2.5 compat fix if not hasattr(urlparse, 'parse_qsl'): import cgi urlparse.parse_qsl = cgi.parse_qs...
# -*- coding: utf-8 -*- """ *************************************************************************** Parameters.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com ****************************...
''' Created on Aug 23, 2013 @author: Brad ''' import unittest from utils.config import Config class Test(unittest.TestCase): conf = None def setUp(self): self.conf = Config() def tearDown(self): self.conf = None def test_get_picture_vals_VISUALLY(self): ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import applications.utils.mediafile.models import compat.ImageWithThumbs.models class Migration(migrations.Migration): dependencies = [ ('contenttypes', '0001_initial'), ] operations = [ ...
""" Custom scales for matplotlib. :copyright: 2016 Joe Kington Note: For the two scales, I've set the bounds such that you can never go beyond a set range. This gives "stretchy" panning when you reach the ends of a well. Sometimes you'll want it, sometimes you won't. In a lot of cases (e.g. multiple wells or flatte...
from tempest import config from tempest.openstack.common import log from tempest.scenario import manager from tempest import test CONF = config.CONF LOG = log.getLogger(__name__) class TestSnapshotPattern(manager.OfficialClientTest): """ This test is for snapshotting an instance and booting with it. The...
import discord from discord.ext import commands import json import requests import urllib.parse class Translate: def __init__(self, bot): self.bot = bot # https://www.youtube.com/watch?v=T3EIEOSN3EA self.codes = json.load(open("lang.json")) def sneakpastgooglesecurity(...
from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render, redirect from django.views.generic import View from .util import NotificationListMixin, SelectContestMixin, get_relative_time_info from core.forms import SubmitForm from core.models import ProblemInCon...
import simuvex from simuvex.s_type import SimTypeString, SimTypeInt, SimTypeChar import logging l = logging.getLogger("simuvex.procedures.libc.strchr") class strchr(simuvex.SimProcedure): #pylint:disable=arguments-differ def run(self, s_addr, c_int, s_strlen=None): c = c_int[7:0] self.argume...
from twisted.internet import defer, base, main from twisted.internet.interfaces import IReactorTCP, IReactorUDP, IReactorMulticast, IReactorArbitrary, IReactorProcess from twisted.python import threadable, log, reflect from zope.interface import implements, implementsOnly import tcp, udp, process, process_waiter from ...