content stringlengths 4 20k |
|---|
import pprint, tarfile
pac_ext = ".mkp"
class PackageException(Exception):
def __init__(self, reason):
self.reason = reason
def __str__(self):
return self.reason
if omd_root:
pac_dir = omd_root + "/var/check_mk/packages/"
else:
pac_dir = var_dir + "/packages/"
try:
os.makedirs(pac... |
"""Utility methods for working with WSGI servers."""
import datetime
from xml.dom import minidom
from xml.parsers import expat
from savanna.openstack.common import exception
from savanna.openstack.common.gettextutils import _
from savanna.openstack.common import jsonutils
from savanna.openstack.common import log as l... |
#! /usr/bin/python3
# -*- coding: utf-8 -*-
import numpy as np
from matplotlib import pyplot as pl
from geo.jsonio import geojson_import
from geo.geometry import Polygon
# example geojson inputs
examples = ['examples/example1.json',
'examples/example2.json']
def run( examplelist ):
# number of exampl... |
""" Tape shield cable data.
"""
# <<< imports
# @generated
from cdpsm.iec61968.asset_models.cable_info import CableInfo
from cdpsm.iec61970.domain import Length
from cdpsm.iec61970.domain import PerCent
from google.appengine.ext import db
# >>> imports
class TapeShieldCableInfo(CableInfo):
""" Tape shield cab... |
from oslo_config import fixture as config
from oslotest import base
import webob
from oslo_middleware import ssl
class SSLMiddlewareTest(base.BaseTestCase):
def setUp(self):
super(SSLMiddlewareTest, self).setUp()
self.useFixture(config.Config())
def _test_scheme(self, expected, headers, con... |
#!/usr/bin/env python
# Greg Von Kuster
"""
usage: %prog score_file interval_file chrom start stop [out_file] [options]
-b, --binned: 'score_file' is actually a directory of binned array files
-m, --mask=FILE: bed file containing regions not to consider valid
-c, --chrom_buffer=INT: number of chromosomes (... |
from __future__ import print_function, division
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from lib import windowhandling
from lib import ets2window
from lib import ets2game
from lib import screenshot
from lib import speed as speedlib
from lib import replay_memory
from lib imp... |
# another stupid solution for small input
def Milkshakes():
N = int(raw_input())
M = int(raw_input())
F = []
for i in range(M):
s = map(int, raw_input().split())
T = s[0]
F.append([])
for j in range(T):
F[i].append((s[2 * j + 1] - 1, s[2 * j + 2]))... |
from pytest import fixture
from pytest import raises
from pytest import mark
import os
from adhocracy_frontend.tests.acceptance.shared import login_god
from mercator.tests.fixtures.fixturesMercatorProposals1 import create_proposals
from adhocracy_frontend.tests.acceptance.shared import wait
TITLE = 'title'
IMAGE = '%... |
"""All feets tests""" |
from django.http import request as django_request
import mock
from openstack_dashboard import api
from openstack_dashboard.api import base
from openstack_dashboard.api.rest import neutron
from openstack_dashboard.test import helpers as test
from openstack_dashboard.usage import quotas
class NeutronNetworksTestCase(t... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
from flexget.plugin import PluginError
log = logging.getLogger('list_accept')
LISTS_SCHEMA = {'type'... |
try:
import http.client as http_client
except ImportError:
import httplib as http_client
try:
basestring
except NameError: # Python 3.x
basestring = str
import shutil
import socket
import sys
from contextlib import contextmanager
from selenium.webdriver.common.desired_capabilities import DesiredCapa... |
#! /usr/bin/env python3
#from mule import *
from mule.postprocessing.JobsData import *
from mule.postprocessing.JobsDataConsolidate import *
from mule.plotting.Plotting import *
#sys.path.append('../')
#import pretty_plotting as pp
#sys.path.pop()
#
# Outputfile specified?
#
if len(sys.argv) >= 2:
outfile = sys.ar... |
"""This example creates a test network.
You do not need to have a DFP account to run this example, but you do need to
have a Google account (created at http://www.google.com/accounts/newaccount
if you currently don't have one) that is not associated with any other DFP test
networks. Once this network is created, you c... |
#!/usr/bin/env python
# pylint: disable=W0212
import codecs
from collections import OrderedDict
import json
import os
import six
def to_json(self, path, key=None, newline=False, indent=None, **kwargs):
"""
Write this table to a JSON file or file-like object.
:code:`kwargs` will be passed through to the... |
# coding=utf-8
from __future__ import unicode_literals
"""
We need extra translations for the following strings that aren't included on
translate.scratch.mit.edu:
- "turn left 10 degrees"
- "turn right 10 degrees"
- "when green flag clicked"
- "end" (written after a "C" block)
"""
extra_strings = {
"de": ... |
import numpy as np
from quadracheer.recursion import modified_moments
from quadracheer.rl135 import rl1, mu_5_0, mu_5_1, mu_3_0, mu_3_1,\
mu_2_0, mu_2_1, mu_4_0, mu_4_1,\
mu_6_0, mu_6_1
def test_initm10():
est = rl1[0](1.2, 1.2)
exact = 1.20... |
import unicodedata
from django import template
register = template.Library()
@register.filter
def normalize_unicode(text, form, ensure_ascii=False):
"""
Normalizes the given unicode string ``text`` using Unicode Normalization Form ``form``.
If ``ensure_ascii`` is given, then non-ascii-supported charact... |
from django.db import DEFAULT_DB_ALIAS, connections
from django.test.utils import CaptureQueriesContext
# Inspired by /django/test/testcases.py
# but copied over to work without the unit test module
class _AssertNumQueriesContext(CaptureQueriesContext):
def __init__(self, num, connection):
self.num = num... |
#!/usr/bin/env python
#%%
import numpy.testing as npt
import numpy as np
import os
import caiman as cm
from caiman.source_extraction import cnmf
from caiman.paths import caiman_datadir
def demo(parallel=False):
p = 2 # order of the AR model (in general 1 or 2)
if parallel:
c, dview, n_processes ... |
from __pyjamas__ import JS
# a dictionary of module override names (platform-specific)
overrides = None # to be updated by app, on compile
# the remote path for loading modules
loadpath = None
stacktrace = None
appname = None
def setloadpath(lp):
global loadpath
loadpath = lp
def setappname(an):
globa... |
from contextlib import contextmanager
from dogapi import dog_stats_api
import json
import logging
import requests
from django.conf import settings
from time import time
from uuid import uuid4
from django.utils.translation import get_language
log = logging.getLogger(__name__)
def strip_none(dic):
return dict([(k,... |
"""
Copyright 2013 Steven Diamond
This file is part of CVXPY.
CVXPY 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 later version.
CVXPY is distributed i... |
import random
from builtins import range
from .facecube import FaceCube
from .cubiecube import CubieCube
from .coordcube import CoordCube
from .color import colors
def verify(s):
"""
Check if the cube definition string s represents a solvable cube.
@param s is the cube definition string , see {@link Fac... |
#!/usr/bin/env python
# this script checks if any piRNA sequences BLAST to the TE sequences with varying percent identities
# first 8 bases of piRNA must match
# USE: piBLAST.py
import re
import sys
import os
from subprocess import Popen, PIPE
from collections import defaultdict
from collections import Counter
import... |
'''>>> class Bank(): # let's create a bank, building ATMs
... crisis = False
... def create_atm(self):
... while not self.crisis:
... yield "$100"
>>> hsbc = Bank() # when everything's ok the ATM gives you as much as you want
>>> corner_street_atm = hsbc.create_atm()
>>> print(corner_street_atm.... |
import os
from plugins.contracts import IHealthStatReaderPlugin
from modules.util.log import LogFactory
import multiprocessing
import psutil
class DefaultHealthStatisticsReader(IHealthStatReaderPlugin):
"""
Default implementation for the health statistics reader
"""
def __init__(self):
super... |
#!/usr/bin/python
import functools
import tornado.wsgi
import wsgiref.simple_server
import tornado.ioloop
import tornado.web
import tornado.auth
import tornado.gen
import os.path
import uuid
from tornado_settings import options,settings
from backend import photos, boards, users
from PIL import Image
def authorized(me... |
#!/usr/bin/env python
# pubsub/net.py
"""
A networking implementation of PubSub using Twisted.
=============
PubSub Server
=============
A PubSub server listens for subscription requests and publish commands, and,
when published to, sends data to subscribers. All incoming and outgoing
requests are encoded in JSON.
... |
"""
This integration tests will perform basic operations on a storage element, depending on which protocols are available.
It creates a local hierarchy, and then tries to upload, download, remove, get metadata etc
Potential problems:
* it might seem a good idea to simply add tests for the old srm in it. It is not :-)
... |
from netforce.model import Model,fields,get_model
from netforce.database import get_connection
from netforce import access
from datetime import *
import time
class Promotion(Model):
_name="sale.promotion"
_string="Promotion"
_fields={
"name": fields.Char("Promotion Title",required=True),
"c... |
#!/usr/bin/python3
from __future__ import unicode_literals, division
import numpy
import os
import binascii
import sys
if sys.version_info.major == 2:
str = unicode
def from_hex(x):
"""Convert hex string into a numpy.uint8 array"""
return numpy.fromstring(
binascii.a2b_hex(x),
dtype=numpy.uint8
)
def to_he... |
#!/usr/bin/env python
import os, sys, string, re
VERSION = re.search(r'^#\s*define\s+VERSION\s*"([^"]+)"',open('_renderPM.c','r').read(),re.MULTILINE)
VERSION = VERSION and VERSION.group(1) or 'unknown'
def libart_version():
K = ('LIBART_MAJOR_VERSION','LIBART_MINOR_VERSION','LIBART_MICRO_VERSION')
D = {}
for l in o... |
"""
GCode M400
Wait until all buffered paths are executed
Author: Mathieu Monney
email: zittix(at)xwaves(dot)net
Website: http://www.xwaves.net
License: CC BY-SA: http://creativecommons.org/licenses/by-sa/2.0/
"""
from GCodeCommand import GCodeCommand
import logging
class M400(GCodeCommand):
def execute(self, ... |
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import PyQt4.QtCore as QtCore
from electrum_vior.i18n import _
from electrum_vior import mnemonic
from qrcodewidget import QRCodeWidget
from util import close_button
class SeedDialog(QDialog):
def __init__(self, parent, seed, imported_keys):
QDialog.__in... |
# -*- coding: utf-8 -*-
"""
# Copyright
Copyright (C) 2012 by Victor
<EMAIL>
# License
This file is part of SoulCreator.
SoulCreator 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 versio... |
# -*- encoding:UTF-8 -*-
import sitecustomize
import saleList
import StSalaryZLT
import StSalaryDC
import os
def GoFunction():
print unicode('\n\n请根据需要的功能,选择对应的数字\n\n')
print unicode('1.自络筒工人工资汇总\n2.挡车工人工资汇总\n3.销售情况汇总')
sheet = {}
num = raw_input()
while num.isalpha() or int(num) < 1 or int(num) ... |
#!/usr/bin/env python
'''
OWASP ZSC | ZCR Shellcoder
ZeroDay Cyber Research
Z3r0D4y.Com
Ali Razmjoo
'''
def start(shellcode,job):
if 'chmod(' in job:
eax = str('0x0f')
eax_2 = '%x'%(int('0f',16) + int('01',16))
eax = 'push $%s'%(str(eax))
eax_dec = 'push $0x%s\npop %%eax\ndec %%eax\npush %%eax'%(eax_2)
s... |
"""
"""
# ============================================================================
# Imports
# ============================================================================
# Stdlib imports
# Third-party imports
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expe... |
"""
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as 1 and 0 respectively in the grid.
For example,
There is one obstacle in the middle of a 3x3 grid as illustrated below.
[
[0,0,0],
[0,1,0],
[0,... |
# -*- coding: utf-8 -*-
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 'OrderItem.sign'
db.add_column(u'checkout_orderitem', 'sign',
self.gf('... |
#!/usr/bin/pypy
# vim: set fileencoding=utf8
import os
import sys
from getpass import getpass
import requests
import urllib
import json
import re
import time
import argparse
import random
import sha
import select
############################################################
# wget exit status
wget_es = {
0: "No pr... |
r"""Creates and runs TF2 object detection models.
For local training/evaluation run:
PIPELINE_CONFIG_PATH=path/to/pipeline.config
MODEL_DIR=/tmp/model_outputs
NUM_TRAIN_STEPS=10000
SAMPLE_1_OF_N_EVAL_EXAMPLES=1
python model_main_tf2.py -- \
--model_dir=$MODEL_DIR --num_train_steps=$NUM_TRAIN_STEPS \
--sample_1_of_... |
project_name = 'xls2txtISA.NANO.archive'
run_tests_levels_below_top_dir = 1
this_test_levels_below_top_dir = 2
#########################
#************************
import sys,re,os,glob
cwd = os.getcwd()
for level in range(1,(run_tests_levels_below_top_dir+1)):
os.chdir('..')
#print os.getcwd()
del level
sys.path.appe... |
import copy
import registry as sr
from pysal.weights import W
try:
import patsy as p
except:
p = None
from numpy import array, ndarray, asarray
from six import iteritems as diter
#would like to just wrap this in the opt decorator...
def pandashandler(formula_like, data):
"""
process a pysal model signa... |
import threading
from oslo.config import cfg
from pecan import hooks
from ceilometer import pipeline
class ConfigHook(hooks.PecanHook):
"""Attach the configuration object to the request
so controllers can get to it.
"""
def before(self, state):
state.request.cfg = cfg.CONF
class DBHook(ho... |
from globals import *
from random import randint
class deck_card:
def __init__(self, max, cls, args):
self.cnt = max
self.max = max
self.cls = cls
self.args = args
class deck:
def __init__(self, name):
self.__name = name
self.__cards = []
def __str__(self):
return "deck(%s,%u)"%(self.__name, len(sel... |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Hoverlabel(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattermapbox"
_path_str = "scattermapbox.hoverlabel"
_valid_props = {
"align",
... |
import logging
from config import ADMIN_LIST, OPEN_LOBBY, DEFAULT_GAMEMODE, ENABLE_TRANSLATIONS
from datetime import datetime
from deck import Deck
import card as c
class Game(object):
""" This class represents a game of UNO """
current_player = None
reversed = False
choosing_color = False
started... |
"""Distributed Extension"""
import re
import os
import sys
try:
import drmaa
except:
pass
import itertools
import argparse
from cement.core import backend, handler, hook
from scilifelab.pm.core import command
LOG = backend.minimal_logger(__name__)
class DistributedCommandHandler(command.CommandHandler):
... |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.electric_load_center import GeneratorWindTurbine
log = logging.getLogger(__name__)
class TestGeneratorWindTurbine(unittest.TestCase):
def setUp(self):
self.fd, self... |
import logging
import weakref
from elemental_core import ElementalError
_LOG = logging.getLogger(__name__)
class TransactionError(ElementalError):
"""
Base class for Errors that occur during the processing of a `Transaction`.
"""
@property
def transaction(self):
"""
Transaction... |
"""
Contains stuff that didn't fit anywhere else
Created by Jan Wiberg on 2010-03-22.
Copyright (c) 2010 __MyCompanyName__. All rights reserved.
"""
import os, syslog, itertools
def flag2mode(flags):
"""
Takes a set of os.O_x flags and creates a python
'open'-compatible string
"""
md = {... |
import tool_utils as tu
from PyQt4.QtGui import *
from PyQt4.QtCore import *
import numpy as np
class Point3DTool(tu.ToolBase):
def __init__(self, rcommander):
tu.ToolBase.__init__(self, rcommander, 'point3d', 'Point 3D', Point3DState)
self.default_frame = 'base_link'
def fill_property_box(s... |
from __future__ import unicode_literals
import webnotes
import webnotes.db
import webnotes.utils
import webnotes.profile
from webnotes import conf
from webnotes.sessions import Session
class HTTPRequest:
def __init__(self):
# Get Environment variables
self.domain = webnotes.request.host
if self.domain and self... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from matplotlib.externals import six
import io
import os
import sys
import warnings
from cycler import cycler, Cycler
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.tests import ass... |
import json
import glob
import collections
import os
from os.path import join
import xml.etree.ElementTree as et
from collections import defaultdict
import argparse
# http://stackoverflow.com/questions/7684333/converting-xml-to-dictionary-using-elementtree
def etree_to_dict(t):
d = {t.tag: {} if t.attrib else Non... |
#! /usr/bin/env python3
# coding: utf-8 ---------------------------------------------------------------
# Linking script - <gsec> (2015)
#-------------------------------------------------------------------------------
import os
from pub import cd
def proc(files=None):
HOME = os.environ['HOME... |
#!/usr/bin/env python
from __future__ import print_function
from math import log, tan, pi
from itertools import product
from argparse import ArgumentParser
from os.path import join, splitext
import tempfile, shutil, urllib, io, sys, subprocess
import unittest
# four formats are available, let's use GeoTIFF
tile_url =... |
import logging
from collections import Iterable
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from yawf import serialize_utils as json
from yawf.handlers import SerializibleHandlerResult
logger = logging.getLogger(__name__)
... |
"""Models for the ``logger`` app."""
import decimal
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.timezone import datetime
from django.utils.translation import ugettext_lazy as _
class Action(models.Model):
... |
"""SCons.Tool.javah
Tool-specific initialization for javah.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a cop... |
from osv import osv, fields
from tools.translate import _
class crm_meeting_responsible_change(osv.osv_memory):
_name = 'crm.meeting.responsible.change'
_description = 'Provides to change responsible for many meetings.'
_columns = {
'next_responsible':fields.many2one('res.use... |
"""
Test SBValue API linked_list_iter which treats the SBValue as a linked list and
supports iteration till the end of list is reached.
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class Value... |
import random
import numpy
lane_num = 2
lane = [[], []]
max_car_num = 10000
road_len = 1000
h = 6
p_b = 0.94
p_0 = 0.5
p_d = 0.1
v_max = [6, 10]
gap = 7
p_car = 1
p_crash = 0
time_period = 200
class Car:
car_cnt = 0
def __init__(self, v = 1, lane = 1):
self.size = 1
if random.random() < ... |
"""
A parallel version of XOR using neat.parallel.
Since XOR is a simple experiment, a parallel version probably won't run any
faster than the single-process version, due to the overhead of
inter-process communication.
If your evaluation function is what's taking up most of your processing time
(and you should check ... |
# -*- coding: UTF-8 -*-
# Задача 8. Вариант 15.
#
# Доработайте игру "Анаграммы" (см. М.Доусон Программируем на Python. Гл.4) так, чтобы к каждому слову полагалась подсказка. Игрок должен получать право на подсказку в том случае, если у него нет никаких предположений. Разработайте систему начисления очков, по кото... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base... |
import logging
import sys
######################################################################
# U T I L I T Y F U N C T I O N S
######################################################################
def initialize_logging(log_level, flask_app):
""" Initialized the default logging to STDOUT """
if not fl... |
'''
Based on the specification at http://bittorrent.org/beps/bep_0015.html
'''
import random
import struct
import time
import socket
from collections import defaultdict
__version__ = '0.0.1'
CONNECT = 0
ANNOUNCE = 1
SCRAPE = 2
ERROR = 3
def norm_info_hash(info_hash):
if len(info_hash) == 40:
info_hash ... |
import numpy as np
import math
import os
import sys
import json
sys.path.append('./BCI_Framework')
import Main
import Single_Job_runner as SJR
import my_plotter
import os
import re
import Configuration_BCI
import matplotlib
def read_optimal_accuracies(dataset_name, CSPorALL):
bcic = Main.Main('BCI_Framework... |
r"""
Counts words in UTF8 encoded, '\n' delimited text received from the network every second.
Usage: network_wordcount.py <hostname> <port>
<hostname> and <port> describe the TCP server that Spark Streaming would connect to receive data.
To run this on your local machine, you need to first run a Netcat ser... |
"""This file contains default values for prompts.
Example
-------
For :dict:`dummy_users` the template looks like this:
``
name = {
'full_name': 'forename surname',
'user_name': 'forename', # at least six characters
'email': '<EMAIL>',
'telephone': '04387-238742'
}
``
But pull requests to add a new ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from django.contrib.auth.models import AnonymousUser
from django.template import Context
from django.template.base import Template
from django.test.client import RequestFactory
from machina.core.db.models import get_model
from machina.core... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Geo'
db.create_table(u'geo_geo', (
('geoid', ... |
from __future__ import print_function
import pydoc
import sys
import tabulate
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from . import cache
from . import index
from . import output
USAGE = """
rfc.py [view] RFC - Display the specified RFC.
rfc.py save ... |
#! /usr/bin/env python
import sys
import numpy as np
import ase
from ase.io import read, write
from ase.optimize import FIRE
from ase.md import Langevin
from ase.units import mol, fs, kB
from atomistica.logger import MDLogger
from liquid_tools import *
###
# For coordination counting
#densitie... |
"""Command for listing instance groups."""
from googlecloudsdk.api_lib.compute import base_classes
class List(base_classes.ZonalLister,
base_classes.InstanceGroupDynamicProperiesMixin):
"""List Google Compute Engine instance groups."""
@staticmethod
def Args(parser):
base_classes.ZonalLister.Arg... |
"""module which helps with porting to Python 3"""
import sys
PY3 = sys.version_info[0] == 3
if PY3:
# compat functions
from urllib.parse import quote as urllib_quote
from urllib.request import urlopen as urllib_urlopen
# compat types
integer_types = int,
string_types = str
text_type = s... |
"""
Search algorithms.
@sort: breadth_first_search, depth_first_search
"""
# Imports
from rez.vendor.pygraph.algorithms.filters.null import null
from sys import getrecursionlimit, setrecursionlimit
# Depth-first search
def depth_first_search(graph, root=None, filter=null()):
"""
Depth-first search.
@... |
#! /usr/bin/python
import addressbook_pb2
import sys
# Iterates though all people in the AddressBook and prints info about them.
def ListPeople(address_book):
for person in address_book.people:
print "Person ID:", person.id
print " Name:", person.name
if person.HasField('email'):
print " E-mail address:", p... |
__author__ = 'Javier'
class Project(object):
def __init__(self, forks, stars, watchs):
self._forks = int(forks)
self._stars = int(stars)
self._watchs = int(watchs)
@property
def forks(self):
return self._forks
@property
def stars(self):
return self._stars... |
import tempfile
import os
import pytest
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.serialization import PublicFormat, Encoding
import sysca.api as sysca
from helpers import demo_fn, new_root, demo_data
EC_KEYS = ["ec"] + ["ec:" + n for n in sysca.get_ec_curves()]
RS... |
import praw
import csv
import time
#The strings that will 'summon' the bot:
prawWords = ['!ithkuil', 'everybody']
botusername = 'IthkuilRobot'
botuserpass = 'password' #placeholder
#What to tell reddit my bot is called.
user_agent = ("/r/ithkuil Lookup Bot 1.0 by /u/Archare")
#The reddit object
r = praw.Reddit(user_... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Blog'
db.create_table(u'blog_blog', (
(u'cont... |
from __future__ import print_function
from bcc import BPF
import argparse
# arguments
examples = """examples:
./tcpconnect # trace all TCP connect()s
./tcpconnect -t # include timestamps
./tcpconnect -p 181 # only trace PID 181
"""
parser = argparse.ArgumentParser(
description="Trac... |
from __future__ import division
import os
import re
import socket
import time
from subprocess import Popen, PIPE
from munin import MuninPlugin
space_re = re.compile(r"\s+")
class MuninCassandraPlugin(MuninPlugin):
category = "Cassandra"
def __init__(self, *args, **kwargs):
super(MuninCassandraPlugi... |
"""
Box.net OAuth support.
This contribution adds support for GitHub OAuth service. The settings
SOCIAL_AUTH_BOX_KEY and SOCIAL_AUTH_BOX_SECRET must be defined with the values
given by Box.net application registration process.
Extended permissions are supported by defining BOX_EXTENDED_PERMISSIONS
setting, it must be... |
from ...core.memory_map import (FlashRegion, RamRegion, MemoryMap)
from ...debug.svd.loader import SVDFile
from ..family.target_imxrt import IMXRT
FLASH_ALGO_QUADSPI = {
'load_address' : 0x20000000,
# Flash algorithm as a hex string
'instructions': [
0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1... |
from __future__ import print_function, division
#
import sys,os
quspin_path = os.path.join(os.getcwd(),"../../")
sys.path.insert(0,quspin_path)
#
from quspin.operators import hamiltonian # Hamiltonians and operators
from quspin.basis import boson_basis_1d # bosonic Hilbert space
from quspin.tools.block_tools import blo... |
input = [1, 5, 2,
2, 4, 7,
3, 6, 9]
size = 3
input = [0, 2, 1, 3,
2, 1, 0, 4,
3, 3, 3, 3,
5, 5, 2, 1]
size = 4
input = [1, 0, 2, 5, 8,
2, 3, 4, 7, 9,
3, 5, 7, 8, 9,
1, 2, 5, 4, 2,
3, 3, 5, 2, 1]
size = 5
output = [0] * len(... |
import re
import sys
def MergeFilenames(filename1, filename2):
names = set()
if filename1 != '/dev/null':
assert filename1.startswith('a/')
names.add(filename1[2:])
if filename2 != '/dev/null':
assert filename2.startswith('b/')
names.add(filename2[2:])
assert len(names) == 1
return list(name... |
''' restart.py '''
from heron.common.src.python.utils.log import Log
import heron.tools.cli.src.python.args as args
import heron.tools.cli.src.python.cli_helper as cli_helper
import heron.tools.common.src.python.utils.config as config
def create_parser(subparsers):
'''
:param subparsers:
:return:
'''
parser ... |
#=======================================================================================================================
# getopt code copied since gnu_getopt is not available on jython 2.1
#=======================================================================================================================
class ... |
"""Download files from Google Storage based on SHA1 sums."""
import hashlib
import optparse
import os
import Queue
import re
import stat
import sys
import threading
import time
import subprocess2
GSUTIL_DEFAULT_PATH = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'gsutil.py')
# Maps sys.platform to... |
#!/usr/bin/python3
# coding: utf-8
try:
# Importação para uso direto do módulo
from funcoes_uteis import Fila, Tabela, input_tipo, validar_intervalo, pausar, limpar_tela
except ImportError:
# Importação para uso pelo pacote sources
from src.funcoes_uteis import Fila, Tabela, input_tipo, validar_interva... |
#!/usr/bin/env python3
'''
t3_verify.py - this file is part of S3QL (http://s3ql.googlecode.com)
Copyright © 2014 Nikolaus Rath <<EMAIL>>
This program can be distributed under the terms of the GNU GPLv3.
'''
if __name__ == '__main__':
import pytest
import sys
sys.exit(pytest.main([__file__] + sys.argv[1:... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2010 Esa-Matti Suuronen <<EMAIL>>
This file is part of subssh.
Subssh is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at yo... |
#!/usr/bin/env python
from setuptools import setup, find_packages, Extension
import platform
VERSION = (1, 1, 4)
VERSION_STR = ".".join([str(x) for x in VERSION])
CBF_VERSION = (0, 0, 1)
CBF_VERSION_STR = ".".join([str(x) for x in CBF_VERSION])
compile_args = []
if platform.system().lower() == 'windows':
macro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.