code stringlengths 1 199k |
|---|
import subprocess
import logging
import os, sys, traceback
import urllib
from fluxclient import check_platform
from .misc import BinaryUploadHelper, BinaryHelperMixin, OnTextMessageMixin
logger = logging.getLogger("API.SLICING")
StlSlicer = None
StlSlicerCura = None
def get_default_cura():
return os.environ["cura"]... |
from . import purchase |
import time
import RPi.GPIO as GPIO
GPIO.VERSION
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11,GPIO.OUT)
GPIO.setup(12,GPIO.OUT)
from smbus import SMBus
bus = SMBus(1)
def read_ain(i):
global bus
#bus.write_byte_data(0x48, 0x40 | ((i) & 0x03), 0)
bus.write_byte(0x48, i)
bus.read_byte(0x48)#first 2 are last sta... |
"""
This module provide Resultmodulation and Resultmodulations classes used to describe
the modulation of a check command. Modulation occurs on a modulation period (Timeperiod)
"""
import time
from alignak.objects.item import Item, Items
from alignak.property import StringProp, IntegerProp, IntListProp
class Resultmodu... |
import pytest
from shoop.notify import Context
from shoop_tests.notify.fixtures import get_initialized_test_event
@pytest.mark.django_db
def test_log_entries():
event = get_initialized_test_event()
ctx = Context.from_event(event)
order = ctx.get("order")
n_log_entries = ctx.log_entry_queryset.count()
... |
import logging
import time
from django.conf import settings
from django.core.mail import get_connection as dj_get_connection
logger = logging.getLogger(__name__)
class BackendWrapper(object):
"""A wrapper around Django's Email Backend, providing hooks
for instrumentation and testing.
"""
def __init__(se... |
from pkg_resources import resource_filename
import marv_node.testing
from marv_node.testing import make_dataset, run_nodes, temporary_directory
from marv_robotics.detail import connections_section as node
from marv_store import Store
class TestCase(marv_node.testing.TestCase):
# TODO: Generate bags instead, but wit... |
import base64
from openerp.addons.report_aeroo import report_aeroo
from openerp.addons.at_base import util
from openerp.osv import fields, osv
from openerp.tools.translate import _
class inovice_attachment_wizard(osv.TransientModel):
_name = "account.invoice.attachment.wizard"
_description = "Invoice Attachment... |
"""StoreServer provides a number of plugins which can provide a store
service on a server.
There are currently 2 plugins available: ``webserver`` and ``gitdaemon``.
These can be used to simplify provision of a store, e.g using the
``webserver`` StoreServer instead of installing a 3rd party webserver
such as Apache.
""... |
from __future__ import division
import datetime
import re
import itertools
import random
from django.conf import settings
from django.core import exceptions
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models... |
import requests
LRS = "http://cygnus.ic.uva.nl:8000/XAPI/statements"
u = raw_input("LRS username: ")
p = raw_input("LRS password: ")
r = requests.get(LRS,headers={"X-Experience-API-Version":"1.0"},auth=(u,p));
if r.status_code == 200:
print "Success"
else:
print "Server returns",r.status_code |
from config import cloudplatform
storage_adapter = None
if cloudplatform == "google":
import googlestorage
storage_adapter = googlestorage
elif cloudplatform == "aws":
import awsstorage
storage_adapter = awsstorage
elif cloudplatform == "azure":
from FlaskWebProject import azurestorage
storage_a... |
from . import account_companyweb_report_wizard
from . import partner_update_companyweb |
from item import Item, Items
from shinken.util import strip_and_uniq
from shinken.property import BoolProp, IntegerProp, StringProp
from shinken.log import logger, naglog_result
_special_properties = ('service_notification_commands', 'host_notification_commands',
'service_notification_period', '... |
import urllib2
import time, os
import sys, fileinput
from bs4 import BeautifulSoup
class Grabber(object):
def use(self):
print ""
print "* This just Fucking whatever for grabbing."
print "* For license just fucking to change this. ^Summon Agus Created."
print "-----------------------... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('meinberlin_organisations', '0006_update_orga_type_string'),
]
operations = [
migrations.RemoveField(
model_name='organisation',
name='typ... |
"""
Forms and validation code for user registration.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from registration.models import RegistrationProfile
attrs_dict = { 'class': 'required' }
class RegistrationForm(forms.Form):
"""
F... |
"""
flask.ext.restless.views
~~~~~~~~~~~~~~~~~~~~~~~~
Provides the following view classes, subclasses of
:class:`flask.MethodView` which provide generic endpoints for interacting
with an entity of the database:
:class:`flask.ext.restless.views.API`
Provides the endpoints for each of the ba... |
{
"name": "Kpi Dashboard",
"summary": """
Create Dashboards using kpis""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Creu Blanca,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine",
"depends": ["bus", "board", "base_sparse_field"],
... |
import pytest
from postix.core.models import Ping
from ..factories import cashdesk_factory, ping_factory
@pytest.mark.django_db
def test_troubleshooter_ping_view(troubleshooter_client):
[ping_factory(ponged=(index % 3 != 0)) for index in range(10)]
desk = cashdesk_factory()
assert Ping.objects.count() == 10... |
{
'name': 'Product Pack POS َfor IngAdhoc',
'summary': 'Product packs on POS',
'description': """
This module is extension َfor INGADHOC's module product_pack that will
Process product_pack pickings َfrom POS sales.
Note: this module works with Fixed price packs only.
""",
'version': '10.0.0.2',
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Poll.detailed_chart'
db.add_column('polls_poll', 'detailed_chart', self.gf('django.db.models.fields.BooleanField')(defa... |
from kotori.version import __VERSION__
from pyramid.config import Configurator
def main(global_config, **settings):
"""This function returns a Pyramid WSGI application."""
settings['SOFTWARE_VERSION'] = __VERSION__
config = Configurator(settings=settings)
# Addons
config.include('pyramid_jinja2')
... |
{
'name': 'Medical Medicament',
'version': '8.0.1.0.0',
'author': 'ACSONE SA/NV, Odoo Community Association (OCA)',
'maintainer': 'ACSONE SA/NV, Odoo Community Association (OCA)',
'website': 'http://www.acsone.eu',
'license': 'AGPL-3',
'category': 'Medical',
'depends': [
'medical... |
'''
Created on Mar 25, 2013
@author: dmitchell
'''
import datetime
import subprocess
import unittest
import uuid
from importlib import import_module
from xblock.fields import Scope
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.exceptions import InsufficientSpecificationError, ItemNotFoundE... |
from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from oauth_access.access import OAuthAccess
from oauth_access.exceptions import MissingToken
def oauth_login(request, service,
redirect_field_name="next", redirect_to_session_k... |
{
"name": "Tax Group Types",
"category": "Financial",
"version": "10.0.1.0.0",
"author": "EXA Auto Parts Github@exaap, "
"Joan Marín Github@JoanMarin",
"website": "https://github.com/odooloco/l10n-colombia",
"license": "AGPL-3",
"summary": "Types for Tax Groups",
"depends":... |
from flask import request
from superdesk import get_resource_service, Service
from superdesk.metadata.item import EMBARGO
from superdesk.resource import Resource, build_custom_hateoas
from apps.packages import TakesPackageService
from apps.archive.common import CUSTOM_HATEOAS
from superdesk.metadata.utils import item_u... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from base.forms.search.search_form import BaseSearchForm
from base.models import tutor
class TutorSearchForm(BaseSearchForm):
name = forms.CharField(max_length=40,
label=_("name"))
def search(self):
... |
from copy import deepcopy
from superdesk.publish.formatters import Formatter
from .aap_formatter_common import map_priority, get_service_level
import superdesk
from superdesk.errors import FormatterError
import datetime
from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, BYLINE, FORMAT, FORMATS
from .field_map... |
import logging
from datetime import datetime, timedelta
from openerp.osv import fields, orm
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
from openerp.tools.translate import _
from openerp.addons.connector.session import ConnectorSession
from openerp.addons.connector.connector import ConnectorUnit
from opene... |
""" Course page """
import web
from inginious.frontend.pages.utils import INGIniousPage
class CoursePage(INGIniousPage):
""" Course page """
def get_course(self, courseid):
""" Return the course """
try:
course = self.course_factory.get_course(courseid)
except:
ra... |
from edx_ace import MessageType
class ProgramCreditRequest(MessageType):
def __init__(self, site, user_email=None, *args, **kwargs): # pylint: disable=keyword-arg-before-vararg
super().__init__(*args, **kwargs)
if site.siteconfiguration.partner_from_address:
from_address = site.siteconf... |
import datetime
from judge.utils.timedelta import nice_repr
from . import registry
@registry.filter
def timedelta(value, display='long'):
if value is None:
return value
return nice_repr(value, display)
@registry.filter
def timestampdelta(value, display='long'):
value = datetime.timedelta(seconds=val... |
from __future__ import absolute_import, print_function, unicode_literals, division
import urllib
from .check_utils import journey_basic_query
from .tests_mechanism import dataset, AbstractTestFixture
from .check_utils import *
@dataset({"main_ptref_test": {}})
class TestPtRef(AbstractTestFixture):
"""
Test the ... |
import addons
import base64
import ir
import locale
import logging
import netsvc
import os
import platform
import pooler
import release
import security
import sql_db
import sys
import threading
import time
import tools
from tools.translate import _
from cStringIO import StringIO
""" This python module defines the RPC m... |
from django.db import models
from django.contrib.auth.models import User
from users.models import Hijo
class Post(models.Model):
title = models.TextField(null=True, blank=True) #Título
content = models.TextField(null=True, blank=True) #Contenido de la entrada
url = models.URLField(max_length=200, null=True,... |
"""
This is the common settings file, intended to set sane defaults. If you have a
piece of configuration that's dependent on a set of feature flags being set,
then create a function that returns the calculated value based on the value of
FEATURES[...]. Modules that extend this one can change the feature
configuration ... |
import base64
import time
import simplejson as json
from eventlet.green import urllib2
import urllib
from kral import config
def stream(queries, queue, kral_start_time):
url = 'https://stream.twitter.com/1/statuses/filter.json'
queries = [q.lower() for q in queries]
quoted_queries = [urllib.quote(q) for q i... |
from setuptools import setup, find_packages
import os
import glob
import sys
VERSION="2.6dev5"
package_directory = os.path.realpath(os.path.dirname(__file__))
def get_file_contents(file_path):
"""Get the context of the file using full path name."""
content = ""
try:
full_path = os.path.join(package_... |
from __future__ import absolute_import
from django.conf.urls import include, url
from tastypie.api import Api
from locations.api import v1, v2
from locations.api.sword import views
v1_api = Api(api_name="v1")
v1_api.register(v1.SpaceResource())
v1_api.register(v1.LocationResource())
v1_api.register(v1.PackageResource()... |
from django.db import transaction
from booki.editor import models
from booki.utils import security
def remote_get_status_messages(request, message, groupid):
from booki.statusnet.models import searchMessages
group = models.BookiGroup.objects.get(url_name=groupid)
mess = searchMessages('%%23%s' % group.url_n... |
from django.core.urlresolvers import resolve
class URLNameMiddleware:
def process_view(self, request, *args):
request.url_name = resolve(request.path).url_name
return None |
from collections import defaultdict
def cleanup(what):
return what.strip().lower().replace("'", "")
def issubset(superstr, substr):
superstr = list(superstr)
for ch in substr:
if ch not in superstr:
return False
superstr.remove(ch)
return True
def strsub(superstr, substr):
... |
from erukar.system.engine import Enemy, BasicAI
from ..templates.Undead import Undead
from erukar.content.inventory import Shortsword, Buckler
from erukar.content.modifiers import Steel, Oak
class Skeleton(Undead):
ClassName = 'Skeleton'
ClassLevel = 1
BaseMitigations = {
'bludgeoning': (-0.25, 0),
... |
from .environment import *
from .django import *
from .postgresql import *
from .dbengine import *
from .development import *
from .docs import *
setup_virtualenv() |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('stock', '0006_auto_20200904_2343'),
]
operations = [
migrations.RemoveField(
model_name='paymenttransaction',
name='method',
),
migrations.AddField(
... |
"""
Build an ansible inventory based on autoscaling group instance lifecycle state.
Outputs JSON to stdout with keys for each state and combination of autoscaling
group and state.
{
"InService": [
"10.0.47.127",
"10.0.46.174"
],
"Terminating:Wait": [
"10.0.48.104"
],
"e-d-CommonClusterServerAsGrou... |
import logging
_logger = logging.getLogger(__name__)
class AbstractClassError(Exception):
def __str__(self):
return 'Abstract Class'
def __repr__(self):
return 'Abstract Class'
class AbstractMethodError(Exception):
def __str__(self):
return 'Abstract Method'
def __repr__(self):
... |
{
'name': 'Jimo Pricelist Report',
'version': '0.1',
'category': 'Product',
'description': """
Jimo Pricelist Report
""",
'author': 'MicroEra srl',
'website': 'http://www.microera.it',
'depends': ['base', 'product'],
'data': [
'pricelist_report_view.xml',
'security/ir... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crowdsource', '0025_auto_20191209_1647'),
]
operations = [
migrations.AddField(
model_name='crowdsource',
name='ask_public',
field=models.BooleanField(
... |
import os
from django.utils.translation import ugettext_lazy as _
DEBUG = True
USE_DAEMON = True
if os.environ.get("USE_DEV_PATHS", None):
DEV_PATHS = True
else:
DEV_PATHS = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' ... |
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class ResLang(models.Model):
_inherit = 'res.lang'
default_uom_ids = fields.Many2many(
string='Default Units',
comodel_name='product.uom',
)
@api.multi
@api.constrains('default_uom_ids')
def _chec... |
from __future__ import absolute_import, unicode_literals
import django.utils.timezone
import model_utils.fields
from django.db import migrations, models
from opaque_keys.edx.django.models import CourseKeyField, UsageKeyField
from lms.djangoapps.courseware.fields import UnsignedBigIntAutoField
class Migration(migrations... |
import logging
from openerp import models, fields, api
_logger = logging.getLogger(__name__)
class GithubRepository(models.Model):
_name = 'github.repository'
_inherit = ['github.connector']
_order = 'organization_id, name'
# Column Section
organization_id = fields.Many2one(
comodel_name='gi... |
import os
import os.path
import msgpack
import json
from base64 import b64encode, b64decode
from binascii import hexlify
from time import time
import compression
import crypto
from transports.metatransport import MetaTransport
from transports.transport import NotRedundant
from flexceptions import BlockCorruptionError
c... |
from . import mass_mailing_stats |
"""
Tests for contentstore.views.preview.py
"""
import re
from unittest import mock
import ddt
from django.test.client import Client, RequestFactory
from web_fragments.fragment import Fragment
from xblock.core import XBlock, XBlockAside
from cms.djangoapps.contentstore.utils import reverse_usage_url
from cms.djangoapps... |
{
'name': 'Ineco Purchase Sequence',
'version': '0.1',
'category': 'Extended',
'description': """
""",
'author': 'Mr.Tititab Srisookco',
'website': 'http://www.ineco.co.th',
'depends': ['base','purchase','stock'],
'data': [],
'demo': [],
'test':[],
'update_xml': [
... |
import io
import zipfile
from odoo.tests import common
class TestPrototypeModuleExport(common.TransactionCase):
def setUp(self):
super(TestPrototypeModuleExport, self).setUp()
self.main_model = self.env["module_prototyper.module.export"]
self.prototype_model = self.env["module_prototyper"]
... |
from ckan.common import c, _
import pylons.config as config
import ckan.lib.base as base
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from routes.mapper import SubMapper
from ckanext.bcgov.util.util import (get_edc_tags,
edc_type_label,
... |
from cornflake.exceptions import ValidationError
from flask import Response
from radar.api.serializers.auth import ForgotUsernameSerializer
from radar.api.views.generics import ApiView, request_json
from radar.auth.exceptions import UserNotFound
from radar.auth.forgot_username import forgot_username
class ForgotUsernam... |
__doc__ = ""
__version__ = "1.0.0"
__author__ = "Fabien Marteau <fabien.marteau@armadeus.com>"
import cmd,os
from periphondemand.bin.define import *
from periphondemand.bin.utils import wrapperxml, settings, error, basecli
from periphondemand.bin.utils import wrappersystem as sy
from periphondemand.bin.utils.disp... |
from abc import ABCMeta
from recommenders.similarity.weights_similarity_matrix_builder import \
WeightsSimilarityMatrixBuilder
from tripadvisor.fourcity import extractor
from recommenders.base_recommender import BaseRecommender
from utils import dictionary_utils
__author__ = 'fpena'
class MultiCriteriaBaseRecommend... |
"""
Checks that a merge request doesn’t add any instances of the string ‘todo’
(in uppercase), or similar keywords. It may remove instances of that keyword,
or move them around, according to the logic of `git log -S`.
"""
import argparse
import re
import subprocess
import sys
BANNED_KEYWORDS = [
'TO' + 'DO',
'X... |
import numpy as np
from .base import Env
from rllab.spaces import Discrete
from rllab.envs.base import Step
from rllab.core.serializable import Serializable
MAPS = {
"chain": [
"GFFFFFFFFFFFFFSFFFFFFFFFFFFFG"
],
"4x4_safe": [
"SFFF",
"FWFW",
"FFFW",
"WFFG"
],
... |
"""Referencia Catastral (Spanish real estate property id)
The cadastral reference code is an identifier for real estate in Spain. It is
issued by Dirección General del Catastro (General Directorate of Land
Registry) of the Ministerio de Hacienda (Tresury Ministry).
It has 20 digits and contains numbers and letters incl... |
import itchat
itchat.login()
friends = itchat.get_friends(update = True)[0:]
info = {}
for i in friends:
info[i['NickName']] = i.Signature
print(info) |
"""
L{Transport} handles the core SSH2 protocol.
"""
import os
import socket
import string
import struct
import sys
import threading
import time
import weakref
import ssh
from ssh import util
from ssh.auth_handler import AuthHandler
from ssh.channel import Channel
from ssh.common import *
from ssh.compress import ZlibC... |
"""
Implemented using the 'pytest' testing framework.
"""
if __name__ == "__main__":
import __init__
__init__.runUsingPyTest(globals())
from suds.wsse import UsernameToken
class TestUsernameToken:
username_token = None
def setup(self):
self.username_token = UsernameToken(
username=b"... |
import numpy as _np
from pyemma._base.estimator import Estimator as _Estimator
from pyemma._base.progress import ProgressReporter as _ProgressReporter
from pyemma.thermo import MEMM as _MEMM
from pyemma.thermo.estimators._base import ThermoBase
from pyemma.thermo.models.memm import ThermoMSM as _ThermoMSM
from pyemma.u... |
__docformat__ = 'plaintext'
__date__ = '04/10/2013'
'''
pyText2Pdf - Python script to convert plain text files into Adobe
Acrobat PDF files.
Version 1.2
Author: Anand B Pillai <abpillai at lycos dot com>
Keywords: python, tools, converter, pdf, text2pdf, adobe, acrobat,
processing.
Copyright (C) 2... |
import itertools
class ListCreator():
current_list = None
def fcstDiracGammasInAlldimsAllIndicesContracted(self):
self.current_list = set(
list(itertools.permutations(['dirac_gamma<1>', 'dirac_gamma<1>'])) +
list(itertools.permutations(['dirac_gamma<1>', 'dirac_gamma<1>', 'dirac_gamma<2>... |
import os
import time
import logging
import unittest
import threading
import functools
from odoo.tests import tagged
from odoo.tools.profiler import profile
from odoo.tools import config, convert_file
from odoo.modules.module import get_resource_path
from odoo.modules.module import get_module_resource
from odoo.addons.... |
"""
Usefull method and classes not belonging anywhere and depending on opcua library
"""
from dateutil import parser
from datetime import datetime
from enum import Enum, IntEnum
import uuid
from opcua import ua
from opcua.ua.uaerrors import UaError
def val_to_string(val):
"""
convert a python object or python-o... |
"""@brief Interpret various computer languages using installed interpreters.
@file code_interpreter.py
@package pybooster.code_interpreter
@version 2019.07.14
@author Devyn Collier Johnson <DevynCJohnson@Gmail.com>
@copyright LGPLv3
@section LICENSE
GNU Lesser General Public License v3
Copyright (c) Devyn Collier Johns... |
def isPandigital(strN):
Ln = [c for c in strN]
Ln.sort()
if Ln == ['1', '2', '3', '4', '5', '6', '7', '8', '9']:
return True
return False
listPans=[]
listMultiplier=[]
i=9
while i<9999:
n=2
while n<999:
j=1
strProd=''
while j<n:
prod=j*i
st... |
from django.core.cache import cache
from django.shortcuts import *
from django.views.generic import TemplateView, FormView
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse_lazy
from django.core.urlresolvers ... |
from openturns import *
from math import *
TESTPREAMBLE()
try :
# TEST NUMBER ZERO : DEFAULT CONSTRUCTOR AND STRING CONVERTER
print "test number zero : default constructor and string converter"
# Default constructor
symmetricMatrix0 =SymmetricMatrix()
# String converter
print "symmetricMatrix0... |
from django.db.models.sql import compiler
from datetime import datetime
import re
from django.db.models.base import Model
REV_ODIR = {
'ASC': 'DESC',
'DESC': 'ASC'
}
SQL_SERVER_8_LIMIT_QUERY = \
"""SELECT *
FROM (
SELECT TOP %(limit)s *
FROM (
%(orig_sql)s
ORDER BY %(ord)s
) AS %(table)s
ORDER B... |
class Symbol():
def __init__(self, name, isterm):
self.name = name
self.isterm = isterm
def __str__(self):
if self.isterm:
if self.name == "":
return "&"
return "'{}'".format(self.name)
return "<{}>".format(self.name) |
'''
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
'''
nums = range(999, 99, -1)
allProducts = [x * y for x in nums for y in nums]
palindromeProducts = [p for ... |
from __future__ import unicode_literals
from .abc import ABCIE
from .abc7news import Abc7NewsIE
from .academicearth import AcademicEarthCourseIE
from .addanime import AddAnimeIE
from .adobetv import AdobeTVIE
from .adultswim import AdultSwimIE
from .aftonbladet import AftonbladetIE
from .aljazeera import AlJazeeraIE
fr... |
"""
books.py
reads a list of books from an input file and returns them filtered and sorted
features
- iterates through records without holding the entire dataset in memory, allowing for large datasets
- uses SQLite for storage and retrieval
"""
import os
import argparse
import sqlite3
from book_list.book_list_f... |
import glob
import sys
import string
import Bio.PDB
def parse_noe(filename):
f = open(filename, 'r')
noe_pairs = []
for line in f.readlines():
res_a = int(string.split(line)[2])
res_b = int(string.split(line)[7])
noe_pair = [res_a, res_b]
if noe_pair not in no... |
from bottle import route, run
@route("/")
def access():
return "OK!"
run(host="192.168.0.10", port=8080, debug=True, reloader=True) |
import math
class DataHeap:
"""Min-Heap with additionnal data field"""
def __init__(self):
self.list = [(0, None)]
self.size = 0
def insert(self, value, data = None):
self.list.append((value, data))
self.size += 1
self.percolateUp(self.size)
def percolateUp(self, i):
half_i = i // 2
... |
from . import about_blueprint
from flask import render_template
@about_blueprint.route("/")
def about_index():
return render_template("about.html") |
from zeroos.core0.client import Client
import sys
import time
"""
This script expect you know the IP of the core0 and you can access it from the machine running this script.
an easy way to do it is to build the initramfs with a customr zerotier network id (https://github.com/g8os/initramfs/tree/0.10.0#customize-build)
... |
"""
Test of basic math operations on the Tensors and compare with numpy results
The Tensor types includes GPU and CPU Tensors
"""
import numpy as np
import itertools as itt
from neon.backends.nervanagpu import NervanaGPU
from neon.backends.nervanacpu import NervanaCPU
from neon.backends.tests.utils import assert_tensor... |
from setuptools import find_packages, setup
setup(
name = "acos-client",
version = "1.4.6",
packages = find_packages(),
author = "A10 Networks",
author_email = "mdurrant@a10networks.com",
description = "A10 Networks ACOS API Client",
license = "Apache",
keywords = "a10 axapi acos adc slb... |
import urllib2
import zipfile
import re
url = "http://www.pythonchallenge.com/pc/def/channel.zip"
data = urllib2.urlopen(url).read()
file1='ttt.zip'
with open(file1,'wb+') as fzip:
fzip.write(data)
dd = re.compile(r'(?<=[from|is] )(\d+)')
zf = zipfile.ZipFile(file1,'r')
text=zf.read('readme.txt')
cc = dd.search(tex... |
'''
Check Yahoo finance currency data helper.
Update log: (date / version / author : comments)
2017-12-10 / 1.0.0 / Du Jiang : Creation
2017-12-13 / 2.0.0 / Du Jiang : Use new API
'''
from com.djs.learn.financeapi import CheckFinanceDataRequests
__data_type = 1
__inventory_info_file_path = "../../../../etc/CurrencyInfo... |
from oslo_config import cfg
time_trigger_opts = [
cfg.IntOpt('min_interval',
default=60 * 60,
help='The minimum interval of two adjacent time points. '
'min_interval >= (max_window_time * 2)'),
cfg.IntOpt('min_window_time',
default=900,
... |
"""
Provided code for Application portion of Module 1
Imports physics citation graph
"""
CITATION_URL = "phys-cite_graph.txt"
def load_graph(graph_url):
"""
Function that loads a graph given the URL
for a text representation of the graph
Returns a dictionary that models a graph
"""
graph_file = ... |
import os
import sys
import logging
import threading
from flask import Flask
app = Flask(__name__)
app.config.from_envvar("PEGASUS_METRICS_CONFIG")
app.secret_key = os.urandom(24)
import pegasus.metrics.views
import pegasus.metrics.filters |
from toontown.building.DistributedElevatorInt import DistributedElevatorInt
class DistributedCogdoElevatorInt(DistributedElevatorInt):
def _getDoorsClosedInfo(self):
return ('cogdoInterior', 'cogdoInterior') |
from subprocess import call
import sys
import os
from socket import *
cs = socket(AF_INET, SOCK_DGRAM)
cs.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
cs.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
file = "group_port.txt" #Name of file containing Groups
a = open(file,'r')
file_contents = a.read()
print(file_contents)
a.cl... |
"""Per-repository configuration options."""
from __future__ import absolute_import
import copy
import json
import phlgit_show
import phlgit_showref
class Data(object):
def __init__(self):
super(Data, self).__init__()
self.description = None
self.branch_url_format = None
self.review_u... |
"""Support for MyQ gateways."""
from pymyq.const import (
DEVICE_STATE as MYQ_DEVICE_STATE,
DEVICE_STATE_ONLINE as MYQ_DEVICE_STATE_ONLINE,
KNOWN_MODELS,
MANUFACTURER,
)
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_CONNECTIVITY,
BinarySensorEntity,
)
from homeassistant.helpe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.