src stringlengths 721 1.04M |
|---|
#!/usr/bin/env python
import json
import logging
import os
import pprint
import unittest
from unittest import TestCase
import lief
from utils import get_sample
CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
lief.logging.set_level(lief.logging.LOGGING_LEVEL.DEBUG)
class TestVDEX(TestCase):
def setUp(s... |
#!/usr/bin/env python
import urllib
import json
import os
import constants
import accounts
from flask import Flask
from flask import request
from flask import make_response
# Flask app should start in global layout
app = Flask(__name__)
PERSON = constants.TEST_1
@app.route('/webhook', methods=['POST'])
def webhook... |
# -*- coding: utf-8 -*-
#
# 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
#... |
from django.db.models import BooleanField, Exists, F, OuterRef, Q
from django.db.models.expressions import RawSQL
from django.test import SimpleTestCase
from .models import Tag
class QTests(SimpleTestCase):
def test_combine_and_empty(self):
q = Q(x=1)
self.assertEqual(q & Q(), q)
self.ass... |
""" Implements ProcessActor """
from concurrent.futures import _base
from concurrent.futures import process
from multiprocessing.connection import wait
from ibeis.web.futures_utils import _base_actor
import os
import queue
import weakref
import threading
import multiprocessing
# Most of this code is duplicated from t... |
from gpm.utils.opt import opt_parser
from gpm.utils.log import Log
from gpm.utils.conf import GPMConf
from gpm.const import DEFAULT_MOD, GPM_SRC
from gpm.const.status import Status
from gpm.utils.operation import LocalOperation
import pkgutil
class CLI(object):
def __init__(self):
self.config = GPMConf()
... |
#
# Copyright (C) 2009-2016 Nexedi SA
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed... |
"""Proxy interfaces for cli print."""
import difflib
import json
import backoff
import botocore.exceptions
import click
import yaml
from .colormaps import CHANGESET_STATUS_TO_COLOR, CHANGESET_ACTION_TO_COLOR, \
CHANGESET_REPLACEMENT_TO_COLOR, DRIFT_STATUS_TO_COLOR, \
STACK_STATUS_TO_COLOR, CHANGESET_RESOURCE_... |
"""
Abstract base classes define the primitives that renderers and
graphics contexts must implement to serve as a matplotlib backend
:class:`RendererBase`
An abstract base class to handle drawing/rendering operations.
:class:`FigureCanvasBase`
The abstraction layer that separates the
:class:`matplotlib.fi... |
from numpy.distutils.core import Extension
f90periodogram = Extension(name='f90periodogram',
sources=['seismo/src/periodogram.f90'],
extra_f90_compile_args=["-fopenmp", "-lgomp"],
extra_link_args=["-lgomp"])
if __name__ == "__main__":
... |
resize_possible = True
try:
import cv2
resizer = lambda pic, newsize : cv2.resize(pic.astype('uint8'),
tuple(map(int, newsize)),
interpolation=cv2.INTER_AREA)
except ImportError:
try:
import Image
import numpy as np
... |
from unittest2 import TestCase
from httpclient import HTTPClient, __version__
from http import Request, Response
tests = {
'GET': {
'url': 'http://lumberjaph.net/',
'headers': {'Accept-Type': 'text/html'}
},
'POST': {
'url': 'http://lumberjaph.net/',
'headers': {'Content-Ty... |
"""
Tests for discussion pages
"""
import datetime
from pytz import UTC
from uuid import uuid4
from nose.plugins.attrib import attr
from .helpers import UniqueCourseTest
from ..pages.lms.auto_auth import AutoAuthPage
from ..pages.lms.courseware import CoursewarePage
from ..pages.lms.discussion import (
Discussion... |
# Copyright (c) 2016 Christopher Asakawa, Nicholas McHale, Matthew O'Brien, Corey Aing
# This code is available under the "MIT License".
# Please see the file COPYING in this distribution
# for license terms.
# Python script to run NIST tests against a bitstream found in a textfile
import sys
from subprocess import P... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import biplist
import os.path
import subprocess
# .. Useful stuff ..............................................................
application = 'dist/Knossos.app'
appname = os.path.basename(application)
def icon_from_app(app_path):
plist_path = os.p... |
#classes
import sqlalchemy
from ConfigParser import SafeConfigParser
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String,VARCHAR,TEXT,DATETIME, Sequence,func,Boolean, ForeignKey
from sqlalchemy.orm import relationship
# Config files! Yay!
config = SafeConfigParser()
... |
#-
# Copyright (c) 2012 Ben Thorner
# Copyright (c) 2013 Colin Rothwell
# All rights reserved.
#
# This software was developed by Ben Thorner as part of his summer internship
# and Colin Rothwell as part of his final year undergraduate project.
#
# @BERI_LICENSE_HEADER_START@
#
# Licensed to BERI Open Systems C.I.C. (... |
from functools import wraps
from .exception import UnauthorizedUser, UnsupportedHttpMethod
ß
def login_required(func):
@wraps(func)
def check_user_login(request, *args, **kwargs):
if not request.user.is_authenticated():
raise UnauthorizedUser()
return func(request, *args, **kwargs)... |
#!/usr/bin/env python
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
from contextlib import contextmanager
import psycopg2
import dbt.exceptions
from dbt.adapters.base import Credentials
from dbt.adapters.sql import SQLConnectionManager
from dbt.contracts.connection import AdapterResponse
from dbt.logger import GLOBAL_LOGGER as logger
from dbt.helper_types import Port
from dataclasse... |
from __future__ import unicode_literals
import re
from setuptools import find_packages, setup
def get_version(filename):
content = open(filename).read()
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", content))
return metadata['version']
setup(
name='Mopidy-BeetsLocal',
version=get_vers... |
# Patchwork - automated patch tracking system
# Copyright (C) 2018 Stephen Finucane <stephen@that.guru>
#
# SPDX-License-Identifier: GPL-2.0-or-later
import unittest
from django.conf import settings
from django.urls import reverse
from patchwork.tests.api import utils
from patchwork.tests.utils import create_cover
f... |
import datetime
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from pbench.server.database.database import Database
class ActiveTokens(Database.Base):
"""Token model for storing the active auth tokens at any given time"""
__tablename__ = "active_tokens"
id = Column(Integer, primary_... |
#! /usr/bin/env python
# coding: utf-8
#
# 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 later version.
#
# This program... |
"""
Copyright (c) 2017 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import absolute_import
from atomic_reactor.plugin import ExitPlugin
from atomic_reactor.constants import PLUGIN_REMOVE_WORKER... |
from gi.repository import Nautilus, GObject, Gtk
import functools
import os
import os.path
import urllib
import urlparse
import zipfile
try:
import rarfile
except ImportError:
rarfile = None
if rarfile:
# The default separator is '\\', which is different from what zipfile uses
rarfile.PATH_SEP = '/'
... |
############################################################################
#
# Copyright (C) 2014 tele <tele@rhizomatica.org>
#
# Subscription module
# This file is part of RCCN
#
# RCCN is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Public License as published by
# th... |
# -*- coding: utf-8 -*-
import PyQt5.QtWidgets as Qw
import PyQt5.QtCore as Qc
from . import dec
from . import db
from decimal import Decimal as tdec
class sortWidgetItem(Qw.QTableWidgetItem):
"""
"""
def __init__(self, text, sortKey):
super().__init__(text, Qw.QTableWidgetItem.UserType)
... |
import json
import time
import uuid
from os import environ
from dateutil.parser import parse
from flask import make_response, request
from plenario.api.common import crossdomain, unknown_object_json_handler
from plenario.api.response import bad_request
from plenario.api.validator import IFTTTValidator, sensor_network... |
import argparse
import os
import pytest
from tests.test_config import load_tests_params, clean_dirs
from data_engine.prepare_data import build_dataset
from nmt_keras.training import train_model
from nmt_keras.apply_model import sample_ensemble, score_corpus
def test_NMT_Unidir_deep_GRU_ConditionalLSTM():
params =... |
"""
This file is part of the LEd Wall Daemon (lewd) project
Copyright (c) 2009-2012 by ``brainsmoke'' and Merlijn Wajer (``Wizzup'')
lewd 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 ver... |
# Copyright 2018-21 ForgeFlow S.L. (https://www.forgeflow.com)
# (http://www.eficent.com)
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo.addons.mrp_multi_level.tests.common import TestMrpMultiLevelCommon
from odoo import fields
from datetime import date, datetime
class TestMrpMult... |
from setuptools import setup
setup(
name='pytest-autochecklog',
description='automatically check condition and log all the checks',
author='Steven LI',
author_email='steven004@gmail.com',
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Li... |
from alchemist import Parser
import re
class JavaParser(Parser):
def __init__(self, kwargs):
self._file_extension = "Java"
self._current_match = None
self._fields = []
self._classname = ""
Parser.__init__(self, kwargs)
def parse(self):
fh = open(self.file)
... |
"""
This module gathers tree-based methods, including decision, regression and
randomized trees. Single and multi-output problems are both handled.
"""
# Code is originally adapted from MILK: Machine Learning Toolkit
# Copyright (C) 2008-2011, Luis Pedro Coelho <luis@luispedro.org>
# License: MIT. See COPYING.MIT file... |
# coding: utf-8
"""
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... |
#
# Copyright 2009 Flavio Percoco Premoli
#
# This file is part of Ocvfw.
#
# Ocvfw is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License v2 as published
# by the Free Software Foundation.
#
# Ocvfw is distributed in the hope that it will be useful,
# but WITHOUT... |
from datetime import datetime, timedelta
from ragendja.template import render_to_response
from ragendja.dbutils import get_object_or_404
from tests.models import Comparison
def statistics(path):
results = {'path': path}
missing = []
seconds1 = []
seconds2 = []
total = errors = failures = 0
q... |
# Copyright 2013 Red Hat, Inc.
#
# 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 2011 OpenStack LLC.
# 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 b... |
"""CLI for chain.
This module is not intended to be used programmatically - if this is something you want, use chain.client instead.
"""
import click
from termcolor import colored
from chain.chain import ChainClient, Frequency, NoChainExistsException, ChainExistsException
# No docstrings for this file, as the functi... |
#!/usr/bin/env python
import threading
import time
import dns
from dnsdisttests import DNSDistTest
class TestRoutingPoolRouting(DNSDistTest):
_config_template = """
newServer{address="127.0.0.1:%s", pool="real"}
addAction(makeRule("poolaction.routing.tests.powerdns.com"), PoolAction("real"))
"""
... |
"""Test settings."""
import os
import sys
import pytest
from climatecontrol.env_parser import EnvParser # noqa: I100
from climatecontrol.fragment import Fragment
@pytest.mark.parametrize(
"attr, value, expected",
[
("prefix", "that", "THAT_"),
("settings_file_suffix", "suffix2", "suffix2")... |
##########################################################################
#
# Copyright (c) 2007-2009, Image Engine Design 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:
#
# * Redis... |
# Copyright (c) 2012 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.
import re
import android_commands
import json
import math
# Valid values of result type.
RESULT_TYPES = {'unimportant': 'RESULT ',
'def... |
#!/usr/bin/python
import time
import smbus
#from Adafruit_I2C import Adafruit_I2C
import Adafruit_GPIO.I2C as I2C
# ===========================================================================
# INA219 Class
# ===========================================================================
class INA219:
i2c = None
# ===... |
import numpy as np
from revrng.numpy_wrapper import ReversibleRandomState
SEED = 12345
N_ITER = 100
IN_RANGE_SAMPLES = 10000
SHAPES = [2, (1,), (5, 4), (3, 2, 1, 2)]
def test_shape():
state = ReversibleRandomState(SEED)
for shape in SHAPES:
# ndarray shape always tuple even if integer specified
... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... |
# -*- coding: utf-8 -*-
# script.module.python.koding.aio
# Python Koding AIO (c) by whufclee (info@totalrevolution.tv)
# Python Koding AIO is licensed under a
# Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
# You should have received a copy of the license along with this
# work... |
import os
import re
class pruebas:
nombre=""
lib=0
loc=0
def __init__(self, nombre, lib):
self.nombre=nombre
self.lib=lib
self.loc=0
def SetLoc(self,loc):
self.loc=loc
if __name__ == '__main__':
path = '/home/juannis/data-visualization-patterns/display-patterns/Hierarchies/Pruebas'
lstDir = os.wa... |
import argparse
import logging
import os
import subprocess
import sys
import psycopg2
import yaml
from .utils import get_in
DEFAULT_PK_COLUMN_NAME = 'id'
ANONYMIZE_DATA_TYPE = {
'timestamp with time zone': "'1111-11-11 11:11:11.111111+00'",
'date': "'1111-11-11'",
'boolean': 'random() > 0.5',
'int... |
# Copyright 2012 Cloudbase Solutions Srl
#
# 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 l... |
#A python bot sitting atop PyWikibot and Doxygen to automatically
#add doxygen docs to a wiki for your documentation pleasure
#The main goal of this is to take the power and placement of doxygen docs
#and combine it with the flexibility and remoteness of a wiki
import re
import os
import sys
import subprocess
import ... |
import datetime
import responses
from treeherder.model.models import Push
from treeherder.push_health.compare import (get_parent,
get_response_object)
def test_get_response_object(test_push, test_repository):
resp = get_response_object('1234', test_push, test_reposito... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2018 GWHAT Project Contributors
# https://github.com/jnsebgosselin/gwhat
#
# This file is part of GWHAT (Ground-Water Hydrograph Analysis Toolbox).
# Licensed under the terms of the GNU General Public License.
#
# Copyright (c) 2017 Spyder Project Contributors
# https://git... |
""" HierarchicalSampling test
"""
import unittest
import numpy as np
from numpy.testing import assert_array_equal
from sklearn import datasets
from sklearn.utils import shuffle
from libact.base.dataset import Dataset
from libact.models import SVM
from libact.query_strategies import UncertaintySampling
from libact.que... |
#!/usr/bin/env python
#rook
from __future__ import print_function
import base64
import itertools
import random
import Queue
import string
import sys
import subprocess
import re
import os
import datetime
from argparse import ArgumentParser, RawTextHelpFormatter
from twisted.internet import defer, stdio
from twisted.n... |
"""
"""
import logging
import settings
import tornado.gen as gen
from lib.auth import login, logout, is_authenticated
from lib.error.exceptions import AuthenticationError
class LoginHandler(BaseHandler):
"""
TODO
As designed, Tornado is stateless, which means that everything goes back to client
This... |
import Oger
import mdp.utils
from mdp import numx as numx
import numpy
from numpy import dot as dot
from mdp.utils import mult
# TODO: could we turn this in a generic "function" node?
class ThresholdNode(mdp.Node):
"""
Compute a threshold function of the input.
This node returns output_values[0] if x < thr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2014 Jonathan Labéjof <jonathan.labejof@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and assoc... |
from . import generate_map_matrix as gen_map
from globals import G
from helpers import join, inv
from .cell_and_map_classes import *
def generate_island_matrix_with_topology(m_type, name, size_params, options = {"topology" : "plane"}):
matrix = []
if m_type == 'one hex':
matrix, border_info = gen_map.... |
#!/usr/bin/env python
"""Reads a list of hosts to stdin and produces
a utilization report for those hosts.
"""
import functools
import json
import sys
from typing import Sequence
from a_sync import block
from paasta_tools.mesos.exceptions import MasterNotAvailableException
from paasta_tools.mesos_tools import get_mes... |
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
FramaLibre (It)
"""
from html import escape
from urllib.parse import urljoin, urlencode
from lxml import html
from searx.utils import extract_text
# about
about = {
"website": 'https://framalibre.org/',
"wikidata_id": 'Q30213882',
"official_api_documentati... |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
from __future__ import absolute_import, unicode_literals
from .core import *
from ctypes import c_int32, c_uint32, c_uint64, c_float, byref, pointer
__all__ = [
'Mode', 'Format7', 'mode_map'
]
class Mode(object):
"""
Video mode fo... |
# encoding=utf-8
import binascii
import json
from twisted.internet.protocol import Protocol
from app.proto.controller.XbeeController import XBeeController
class XBeeProtocol(Protocol):
def __init__(self):
self.ip = ''
self.port = ''
def connectionMade(self):
#import soc... |
##
# Copyright 2009-2019 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... |
#!/usr/bin/env python
# Copyright (C) 2009 GSyC/LibreSoft
#
# 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 pr... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import re
import webapp2
import jinja2
import logging
import StringIO
import json
from apirdflib import load_graph, getNss, getRevNss
from markupsafe import Markup, escape # https://pypi.python.org/pypi/MarkupSafe
import parsers
import threading
import itertool... |
# -*- coding: utf-8 -*-
# test_gateway.py
# Copyright (C) 2013 LEAP
#
# 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 later version.
#
... |
#
# Copyright (C) 2013-2015 RoboIME
#
# 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 (at your option) any later version.
#
# This program is distrib... |
# Generated by Django 2.2.24 on 2021-06-18 12:18
from django.db import migrations
def copy_data(apps, schema_editor):
Item = apps.get_model('a4modules', 'Item')
MBPoll = apps.get_model('meinberlin_polls', 'MBPoll')
Poll = apps.get_model('a4polls', 'Poll')
MBQuestion = apps.get_model('meinberlin_polls... |
# -*- coding: utf-8 -*-
from tests import HangulizeTestCase
from hangulize.langs.por import Portuguese
class PortugueseTestCase(HangulizeTestCase):
""" http://korean.go.kr/09_new/dic/rule/rule_foreign_0219.jsp """
lang = Portuguese()
def test_1st(self):
"""제1항
c, g는 a, o, u 앞에서는 각각 ‘ㅋ, ㄱ... |
from __future__ import division, absolute_import, print_function
__all__ = ['atleast_1d', 'atleast_2d', 'atleast_3d', 'block', 'hstack',
'stack', 'vstack']
import functools
import operator
import types
import warnings
from . import numeric as _nx
from . import overrides
from .numeric import array, asanyar... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import argparse
from avoin.scraper.scraper import DefaultScraper, xpath_parser, ScraperMissingElementError
from avoin.data.utils import read, write
def main(args):
if args.command == 'xpath':
scraper = DefaultScraper()
xpath = args.xpath
... |
#! usr/bin/env python
from MDAnalysis import *
#from MDAnalysis.analysis.align import *
import numpy
import math
u = Universe("init.pdb","temp.pos.pdb")
v = Universe("init.pdb")
# residues
a1 = u.selectAtoms("segid A and resid 50") # beginning of helixA1
b1 = u.selectAtoms("segid A and resid 176")
a2 = u.selectAtoms... |
# -*- coding: utf-8 -*-
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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
#
# U... |
# Author: Flavien Garcia <flavien.garcia@free.fr>
# Sylvain Takerkart <Sylvain.Takerkart@incm.cnrs-mrs.fr>
# License: BSD Style.
"""
Description
-----------
This script processes the oidata functions on some selected raw files.
The process is decomposed in 2 steps :
1. Model construction from a parameter file... |
__author__ = 'matt'
"""
Bar chart demo with pairs of bars grouped for easy comparison.
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#corps = [('NT', (0, 1, 2, 3, 4, 5)), ('LXX', (0, 1, 2, 3, 4, 5)), ('Josephus', (0, 1, 2, 3, 4, 5)), ('Philo', (0, 1, 2, 3, 4, 5)), ('Plutarch', (0, 1, 2, ... |
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing the generic stages."""
import contextlib
import fnmatch
import json
import os
import re
import sys
import time
import traceback
... |
import re
import ssl
import urllib.parse
import aioredis.sentinel
class SentinelConfigError(Exception):
'''
Exception raised if Configuration is not valid when instantiating a
Sentinel object.
'''
class Sentinel:
def __init__(self, connection, master=None, password=None, db=None, ssl_context=N... |
import socket
import random
import sys
import threading
from scapy.all import *
if len(sys.argv) != 5:
print "Usage: %s <TargetIp> <Port>" % sys.argv[0]
sys.exit(1)
target = sys.argv[1]
port = int(sys.argv[2])
total = 0
conf.iface = 'en1'
class syn(threading.Thread):
global target
global port
... |
import numpy as np
from unittest import skip
from ml_mnist.model_selection import TrainTestSplitter as TTS
class TestSplit(object):
def setUp(self):
self.y = np.array([1, 1, 1, 2, 2, 3, 3,
1, 1, 2, 2, 2, 3, 3,
1, 1, 2, 2, 3, 3, 3])
def test_split... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from django.contrib.sessions.middleware import SessionMiddleware
from django.template import Context
from django.template.base import Template
from django.template.loader import render_to_string
from django.test.client import RequestFactory... |
import os
import sys
import sysconfig
from pysam.libchtslib import *
from pysam.libcsamtools import *
from pysam.libcbcftools import *
from pysam.libcutils import *
import pysam.libcutils as libcutils
import pysam.libcfaidx as libcfaidx
from pysam.libcfaidx import *
import pysam.libctabix as libctabix
from pysam.libct... |
#todo: raise exceptions, then catch them to generate error images
import webapp2
from google.appengine.api import urlfetch
import json
from PIL import Image, ImageDraw, ImageFont
from google.appengine.api import memcache
import StringIO
import jinja2
import os
from decimal import * #used fixed point math for better ac... |
# Django settings for kguser project.
from os import path
from karaage.conf.defaults import *
TEMPLATE_DIRS += (
'/usr/share/kguser/templates',
)
ROOT_URLCONF = 'kguser.conf.urls'
SITE_ID = 2
STATIC_ROOT = '/var/lib/karaage-user/static'
STATIC_URL = '/kguser_media/'
LOGIN_URL = 'kgauth_login_select'
ALLOW_REG... |
import pyvkontakte
from collections import namedtuple
def get_names_of_users(set_of_users):
"""Takes set of user's ids and returns namedtuple
with their names, last names and link on their pages.
Caution: It can't work with more than 1000 people,
it's vkapi's feauture.
"""
VK_ADRE... |
__problem_title__ = "Matrix Sum"
__problem_url___ = "https://projecteuler.net/problem=345"
__problem_description__ = "We define the Matrix Sum of a matrix as the maximum sum of matrix " \
"elements with each element being the only one in his row and column. " \
"For ... |
import json
import re
from rest_framework import status
from rest_framework.views import APIView
from django.http import HttpResponse
from threepio import logger
from atmosphere import settings
from atmosphere.settings.local import AUTHENTICATION as auth_settings
from atmosphere.settings.local import TEST as test_set... |
#!/usr/bin/env python
#
# Copyright 2012 Ajay Narayan, Madhusudan C.S., Shobhit N.S.
#
#
# 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
#
# Unl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import os
from datetime import datetime
from FAiler.exceptions import FAError
class FAile():
"""
Represents a file downloaded from FurAffinity.
The base parameters of this class are public access read safe by design
FAile.directory: the directo... |
# Copyright 2015 Cloudbase Solutions Srl
# 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 r... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2017 Bitergia
#
# 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 la... |
#!/usr/bin/python
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
from ggrc import db
from ggrc.models import AccessGroup
from ggrc.models import ... |
########################################################################
#
# (C) 2013, James Cammarata <jcammarata@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software ... |
# Copyright 2013 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.
"""
Bitmap is a basic wrapper for image pixels. It includes some basic processing
tools: crop, find bounding box of a color and compute histogram of color va... |
#
# Copyright (c) 2013 Canonical Ltd.
#
# This file is part of: SST (selenium-simple-test)
# https://launchpad.net/selenium-simple-test
#
# 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 Licens... |
# coding=utf-8
import math
import smbus
import mpu6050
from time import time
# Sensor initialization
mpu = mpu6050.MPU6050(
address=mpu6050.MPU6050.MPU6050_DEFAULT_ADDRESS,
bus=smbus.SMBus(1))
mpu.dmpInitialize()
mpu.setDMPEnabled(True)
# get expected DMP packet size for later comparison
packetSize = mpu.dmpG... |
# -*- encoding: utf-8 -*-
import collections
from supriya.tools.systemtools.SupriyaObject import SupriyaObject
class Range(SupriyaObject):
r'''A range.
::
>>> synthdeftools.Range(-1., 1.)
Range(
minimum=-1.0,
maximum=1.0
)
::
>>> synthdeftool... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.