src stringlengths 721 1.04M |
|---|
from tests.common import TestCase
import mock
from functools import reduce
import numpy as np
import pytest
import torch
from cogitare.data import AbsDataHolder, TensorHolder, NumpyHolder, CallableHolder, AutoHolder
_data = torch.rand((100, 32))
def get_data(idx):
return _data[idx]
class _DataHolderAbs(object... |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2020 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
# Copyright 2015-2018 Daniel Schadt
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... |
################################### LICENSE ####################################
# Copyright 2016 Morphux #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); ... |
# -*- 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 'Testimonial.user'
db.add_column(u'sfpirgapp_testimonial', 'user',
self... |
#-------------------------------------------------------------------------------
#
# The MIT License (MIT)
#
# Copyright (c) 2015 William De Freitas
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the ... |
from flask_restful import Resource, reqparse
from flask_jwt import jwt_required
from models.item import ItemModel
class Item(Resource):
parser = reqparse.RequestParser()
parser.add_argument('price',
type=float,
required=True,
help='This field cannot be left blank!'
)
parser.add_... |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... |
import pickle
from dxtbx.format.image import ImageBool
from iotbx.phil import parse
import dials.util
help_message = """
This program augments a experiments JSON file with one or more masks specified by the
user. Its only function is to input the mask file paths to the experiments JSON file,
but means that the use... |
#!/usr/bin/python
# coding=utf8
import rrd_config as C
import os
import subprocess
from collections import namedtuple
import gzip
import sys
import itertools
from smart_attributes import names as smart_names
DataSource = namedtuple('DataSource', 'db_fname field legend is_area color stack')
DataSource.__new__.__defau... |
import logging
import logging.config
import re
import warnings
from asyncio import get_event_loop, ensure_future, CancelledError
from collections import deque, defaultdict
from functools import partial
from inspect import isawaitable, stack, getmodulename
from traceback import format_exc
from urllib.parse import urlenc... |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from os import getcwd
from os.path import join
from sys import path
import xbmc
from xbmc import log
from resources.lib import common
__settings__ = common.addon
__cwd__ = common.addonPath
# Add different library path
path.append(join(__cwd__, "resources",... |
import pyrow
import json
import asyncio
from autobahn.asyncio.websocket import WebSocketServerProtocol
from autobahn.asyncio.websocket import WebSocketServerFactory
class MyServerProtocol(WebSocketServerProtocol):
def __init__(self):
self.is_open = False
def onOpen(self):
try:
sel... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cffi_re2
import sys
import re as pyre
if sys.version_info < (2, 7):
from nose.tools import raises
from nose_extra_tools import assert_is_not_none, assert_is_none, assert_equal, assert_true, assert_false
else:
from nose.tools import raises, assert_is_not_n... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from distutils.spawn import find_executable
from distutils import sysconfig, log
import setuptools
import setuptools.command.build_py
import setuptools.command.develop
im... |
#***************************************************************************
#* *
#* Copyright (c) 2015 - Victor Titov (DeepSOIC) *
#* <vv.titov@gmail.com> *
#* ... |
"""
WORKING COMMAND:
./avrdude-x64 -p ATmega2560 -c wiring -P /dev/ttyACM0 -b 115200 -U flash:w:../XPArduinoSerial.ino.mega.hex -C ./avrdude.conf -D
Copyright 2011 Ryan Fobel
This file is part of dmf_control_board.
dmf_control_board is free software: you can redistribute it and/or modify
it under the terms of the ... |
"""
Django settings for vespapp project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
from decouple... |
from __future__ import unicode_literals
import os
import re
import sys
import time
from ..compat import compat_str
from ..utils import (
encodeFilename,
format_bytes,
timeconvert,
)
class FileDownloader(object):
"""File Downloader class.
File downloader objects are the ones responsible of downl... |
#
# test_Features.py: unit tests for Features module
# Copyright (C) University of Manchester 2011-5 Peter Briggs
from common import *
from rnachipintegrator.Features import Feature
from rnachipintegrator.Features import FeatureSet
import unittest
class TestFeature(unittest.TestCase):
def setUp(self):
... |
"""entree_project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... |
""" Module holding constants for Dash components.
Let's improve the naming convention.
For signals, it makes sense to me to place the type first (i.e. "SIGNAL_*"),
since we want to quickly identify that it's a signal and we often group signals together.
For other types of components, it's unclear if this is better.
F... |
"""
*** FROM https://github.com/davidadamojr/TextRank/blob/master/textrank.py ***
From this paper: http://acl.ldc.upenn.edu/acl2004/emnlp/pdf/Mihalcea.pdf
External dependencies: nltk, numpy, networkx
Based on https://gist.github.com/voidfiles/1646117
"""
import nltk
import itertools
from operator import itemgetter... |
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
# -*- coding: utf-8 -*-
"""
Binary Indexed Tree
-------------------
Based on the proposed C/C++ implementation by
Yannis Chatzimichos @ https://git.softlab.ntua.gr/public/pdp-camp/blob/master/2013/advanced_data_structures.pdf
Supports the operations
- ADD S X
Add X to the sum at posit... |
# Copyright (C) 2007 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 program is distributed in the ... |
"""
gitlab3
~~~~~~~
Python wrapper for GitLab API v3
:copyright: (c) 2013 by Alex Van't Hof.
:license: LGPLv3, see LICENSE for more details.
"""
import json
import re
import requests
from datetime import tzinfo, timedelta, datetime
from math import ceil
import urllib
from . import exceptions
from ._api_definition ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-07 02:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateMode... |
# import socket
# import select
# import dispatch
import socket
import errno
import json
'''
struct head{
int type;
int len;
}
'''
import struct
class Connection:
def __init__(self):
self.buf = bytes()
pass
def disconnect(self):
self.sock.close()
def read(self, size):
... |
# Version info: $Id: Test_DataConverterService.py 1 2012-01-07 22:20:43Z zunzun.com@gmail.com $
# the pyeq2 directory is located up one level from here
import sys, os, unittest
if os.path.join(sys.path[0][:sys.path[0].rfind(os.sep)], '..') not in sys.path:
sys.path.append(os.path.join(sys.path[0][:sys.path[0].r... |
# -*- coding: utf-8 -*-
##
## $id$
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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 Foundati... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import basetest
from basetest import BaseTest
import sys, os, re
import unittest
sys.path.insert(0, '..')
from zeroinstall.injector import model
from zeroinstall.support import escaping
safe = re.compile('^[-.a-zA-Z0-9_]*$')
class ... |
#***********************************************************************
# This code is part of CmplServer
#
# Copyright (C) 2013, 2014
# Mike Steglich - Technical University of Applied Sciences
# Wildau, Germany
#
# CmplServer is a project of the Technical University of
# Applied Sciences Wildau and t... |
# Copyright (c) 2013 OpenStack Foundation
#
# 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
#
# Unles... |
from pyrep.backend import sim, utils
from pyrep.robots.configuration_paths.mobile_configuration_path import (
MobileConfigurationPath)
from pyrep.const import PYREP_SCRIPT_TYPE
from math import sqrt
class HolonomicConfigurationPath(MobileConfigurationPath):
"""A path expressed in joint configuration space.
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
A Python binding for Aseba that relies on DBus for IPC.
Supports event sending/receiving as well as setting/getting an Aseba variable.
Typical usage:
def my_callback(evt):
pass
with Aseba as aseba:
aseba.on_event("evt_name", my_callback)
... |
#!/usr/bin/env python3
# This file is part of SunlightDPD - a home for open source software
# related to the dissipative particle dynamics (DPD) simulation
# method.
# Based on an original code copyright (c) 2007 Lucian Anton.
# Modifications copyright (c) 2008, 2009 Andrey Vlasov.
# Additional modifications copyri... |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... |
from checklist import views
from django.conf.urls import url
app_name="checklist"
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^all$', views.all, name='all'),
url(r'ajax/item_check$', views.item_check, name='ajax_item_check'),
url(r'ajax/emailvalidate$', views.emailvalidate, name="ajax... |
# Just for ordinalizing the number of district
def ordinal(numb):
if type(numb) is str:
numb = int(float(numb))
if numb < 20: #determining suffix for < 20
if numb == 1:
suffix = 'st'
elif numb == 2:
suffix = 'nd'
elif numb == 3:
suffix = 'rd'... |
import os
import sys
import logging
import json
import random
import string
from pipes import quote as shellquote
from path import path
import yaml
from kv import KV
import pkg_resources
import blinker
from .daemons import Supervisor
from . import deployer
log = logging.getLogger(__name__)
CFG_LINKS_FOLDER = 'active'... |
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Romain Bignon
#
# 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, version 3 of the License.
#
# This program is distributed in the hope that it will b... |
from __future__ import annotations
import re
from collections.abc import Iterable, Mapping
from typing import Optional
from . import AString, SequenceSet
from .. import Params, Parseable
from ..exceptions import NotParseable
from ..primitives import Number, List
from ...bytes import BytesFormat, rev
__all__ = ['Ext... |
import json
from optparse import make_option
import os
from django.core.management import BaseCommand
import sys
from casexml.apps.phone.checksum import Checksum
class Command(BaseCommand):
"""Compare sync logs to see mismatched case ids.
This is useful for debugging state mismatches
Can also pass in a h... |
# -*- coding: utf-8 -*-
#
# Copyright (©) 2013 Marcelo Jorge Vieira <metal@alucinados.com>
#
# 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 ... |
from timetable.models import Calendar, Classification, Color, Event, EventClassification
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
class CalendarAdmin(admin.ModelAdmin):
list_display = ('color_display', 'name', )
list_display_links = ('name', )
prepopulated_... |
# coding: utf-8
"""
Notifications API
Notifications # noqa: E501
The version of the OpenAPI document: 2.1.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import datetime
import telestream_cloud_not... |
# ==================================================================================================
# Copyright 2015 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... |
import json
from os.path import normpath
from http.client import HTTPSConnection, HTTPConnection
from urllib.parse import urlencode, urlparse
class APIException(Exception):
pass
class APIClient:
"""
A basic client to query the DPN REST API.
"""
def __init__(self, url, api_token):
self.set... |
# encoding: utf-8
# Copyright (C) 2013 John Törnblom
#
# This file is part of LLVM-P86.
#
# LLVM-P86 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... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# JewelCraft jewelry design toolkit for Blender.
# Copyright (C) 2015-2021 Mikhail Rachinskiy
#
# 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, eith... |
########################################################################
#
# File Name: ParsedAbbreviatedRelativeLocationPath.py
#
#
"""
A parsed token that represents a abbreviated relative location path.
WWW: http://4suite.org/XPATH e-mail: support@4suite.org
Copyright (c) 2000-2001 Fourthought Inc, USA. ... |
# Copyright (c) 2015, Thomas Chiroux - Link Care Services
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# list o... |
from override_kwargs import override_kwargs
from other_module import delegating_function, function
from datetime import datetime
from unittest import TestCase
def function_in_this_module(x=123):
"""hello I'm a docstring"""
return x
def MyClass(object):
def method_in_this_module(x=123):
return x
w... |
#! /usr/bin/env python
import sys
import os
from sys import argv
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
FILE = argv[1]
PLOT_FILE = os.path.splitext(FILE)[0]+'.png'
ERROR = 'er' in FILE.lower()
legend = argv[2:]
cols = len(... |
# Authors: Petr Viktorin <pviktori@redhat.com>
#
# Copyright (C) 2012 Red Hat
# see file 'COPYING' for use and warranty information
#
# 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 vers... |
# -*- coding: utf-8 -*-
# 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... |
from datetime import datetime, timedelta
from mock import patch
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.messages import constants as message_const
from django_dynamic_fixture import get
from django_dynamic_fixture import new
from readthedocs.core.models import ... |
#!/usr/bin/env python
r'''
Implementation of the agent algorithm in tables 33-1 and 33-2 of the IDEAL MOOC
lessons, with modifications required in the programming assignment.
For details see http://liris.cnrs.fr/ideal/mooc/lesson.php?n=033
'''
from collections import namedtuple
from itertools import cycle
# Defaul... |
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify it under
# the terms of the (LGPL) GNU Lesser 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 distributed i... |
from . import backends
from .backends.base import merge_traces, BaseTrace, MultiTrace
from .backends.ndarray import NDArray
import multiprocessing as mp
from time import time
from .core import *
from . import step_methods
from .progressbar import progress_bar
from numpy.random import seed
__all__ = ['sample', 'iter_sa... |
import logging
import math
import time
import moderngl
from OpenGL.GL import *
from OpenGL.arrays.vbo import VBO
import moderngl
import ghalton
from PIL import Image
from time import sleep
from enum import IntEnum
from ctypes import c_float
import numpy as np
from pyrr import Matrix44
from PyQt5 import QtCore
from ... |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, fields, api, _
from op... |
#!/usr/bin/env python
#
# Copyright (c) 2015 - 2021, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, thi... |
"""
Support for django_textfomat.
"""
import re
from bs4 import BeautifulSoup
from django_textformat.registry import registry
from .registry import ResolveError
from .pattern import get_object_reference_regex
@registry.register
def convert_link(value):
"""
Replaces ``page/123`` object links in ``<a href="pa... |
# (c) 2013, seth vidal <skvidal@fedoraproject.org> red hat, inc
# (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
name: first_found
a... |
JOHN = {
"id": 1,
"username": "john_smith",
"name": "John Smith",
"state": "active",
"avatar_url":
"http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
}
JACK = {
"id": 2,
"username": "jack_smith",
"name": "Jack Smith",
"state": "blocked",
"avatar_url": "http://gravatar.co... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
# Copyright (c) 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.
import ctypes
import subprocess
try:
import win32api # pylint: disable=F0401
import win32con # pylint: disable=F0401
import win32process # pylin... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
# -*- coding: utf-8 -*-
import logging
import httplib as http
import math
from itertools import islice
from flask import request
from modularodm import Q
from modularodm.exceptions import ModularOdmException, ValidationValueError
from framework import status
from framework.utils import iso8601format
from framework.mo... |
#!/usr/bin/env python
import gtk
import logging
import time
from ui.IWidget import IWidget
from core.data import logger
from core.log import addStreamHandler
#TODO: Implement file-like thread to show logging!
class loggerWidget(IWidget):
def __init__(self):
IWidget.__init__(self)
self.frame = gtk.Frame('Logger... |
import logging
from socketio.namespace import BaseNamespace
from socketio.mixins import RoomsMixin, BroadcastMixin
class WebhookrChannelMixin(object):
room_key = 'rooms'
def __init__(self, *args, **kwargs):
super(WebhookrChannelMixin, self).__init__(*args, **kwargs)
if self.room_key not in s... |
# This file is part of beets.
# Copyright 2013, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... |
# Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
import base64
from oslo_log import log as logging
import requests
from winrm import protocol
from winrm import exceptions as winrm_exceptions
from coriolis import exception
from coriolis import utils
AUTH_BASIC = "basic"
AUTH_KERBEROS = "kerberos"
AUTH... |
from . import lib
from .timeout import Timeout
import greenlet
import errno
import socket as stdsocket
from socket import * # for convenience
from socket import timeout as timeout_error
class socket(stdsocket.socket):
__slots__ = ()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kw... |
# Copyright (c) 2014, Salesforce.com, 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:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions... |
#!/usr/bin/python
####################################################
# Name: Donation Box WebSockets deamon
#
# Description:
# Provides the WebSockets Server which polls data from the DB, notifies any connected clients (browsers)
# and accepts messages (donations) from clients that then writes to the DB
#
# Author: D... |
# -*- 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):
# Changing field 'SurveySubmission.course_id'
db.alter_column('ga_survey_surveysubmission', 'course_id', se... |
from django.conf.urls import url, include
from skillingtryck import views
from django.contrib.sitemaps.views import sitemap
from django.contrib.sitemaps import GenericSitemap
from skillingtryck.models import Card
from django.views.decorators.cache import cache_page
info_dict = {
'queryset': Card.objects.all(),
... |
import codepy, codepy.jit, codepy.toolchain, codepy.bpl, codepy.cuda
from asp.util import *
import asp.codegen.cpp_ast as cpp_ast
import pickle
from variant_history import *
import sqlite3
import asp
import scala_module
class ASPDB(object):
def __init__(self, specializer, persistent=False):
"""
sp... |
from itertools import repeat
from .abstract_io import (AbstractDxlIO, _DxlControl, _DxlAccess,
DxlTimeoutError, DxlCommunicationError)
from .. import conversion as conv
from ..protocol import v2 as v2
class Dxl320IO(AbstractDxlIO):
_protocol = v2
def set_wheel_mode(self, ids):
... |
import ast
import pycodestyle
from flake8_import_order import ImportVisitor
from flake8_import_order.styles import (
Cryptography, Google, PEP8, Smarkets,
)
DEFAULT_IMPORT_ORDER_STYLE = 'cryptography'
class ImportOrderChecker(object):
visitor_class = ImportVisitor
options = None
def __init__(self,... |
"""Define tests for the OpenUV config flow."""
from regenmaschine.errors import RainMachineError
from homeassistant import data_entry_flow
from homeassistant.components.rainmachine import CONF_ZONE_RUN_TIME, DOMAIN, config_flow
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import (
... |
# Python package to perform quick analysis on topographic data
# Copyright (C) 2015 Christian Braedstrup
# This file is part of pyTopoTools.
#
# pyTopoTools 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.
#... |
'''
Computing the misclassification error distance between to 2 k-means clustering
according to Marina Meila, "The Uniqueness of a Good Optimum for K-Means", ICML 2006
Author : Diviyan Kalainathan
Date : 20/06/2016
'''
import csv,numpy,itertools
from sklearn import metrics
def Clustering_performance_evaluation(mode,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
# Author : tintinweb@oststrom.com <github.com/tintinweb>
'''
server:
#> openssl s_server -accept 443 -WWW -debug -cipher AES128-SHA
client:
#> openssl s_client -connect 192.168.220.131:443 -tls1
'''
if __name__=="__main__":
import scapy
fro... |
# Copyright 2011 Dorgival Guedes
#
# This file is part of POX.
# Some of the arp/openflow-related code was borrowed from dumb_l3_switch.
#
# POX 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... |
# coding=utf-8
# Copyright 2017 The Tensor2Tensor 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 applicable... |
from __future__ import division, print_function
import os, json
from glob import glob
import numpy as np
from scipy import misc, ndimage
from scipy.ndimage.interpolation import zoom
from keras import backend as K
from keras.layers.normalization import BatchNormalization
from keras.utils.data_utils import get_file
fro... |
"""
Unit tests for the stem.exit_policy.ExitPolicyRule class.
"""
import unittest
from stem.exit_policy import AddressType, ExitPolicyRule
class TestExitPolicyRule(unittest.TestCase):
def test_accept_or_reject(self):
self.assertTrue(ExitPolicyRule("accept *:*").is_accept)
self.assertFalse(ExitPolicyRule("r... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/yc/code/calibre/calibre/src/calibre/gui2/add_wizard/welcome.ui'
#
# Created: Thu Oct 25 16:54:55 2012
# by: PyQt4 UI code generator 4.8.5
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
t... |
##############################################################################
#
# Copyright 2015-2016 Bastien Mottiaux
#
# 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.apac... |
#!/usr/bin/env python
# This file is part of ObjectPath released under AGPL v3 license.
# Copyright (C) 2010-2014 Adrian Kalbarczyk
import sys, re
from .parser import parse
from objectpath.core import *
import objectpath.utils.colorify as color # pylint: disable=W0614
from objectpath.utils import flatten, filter_dict... |
# Author: Roberto Cavada <roboogle@gmail.com>
#
# Copyright (C) 2012-2015 by Roberto Cavada
#
# gtkmvc3 is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at yo... |
#-*- coding: utf-8 -*-
from django import forms
from django.utils.translation import ugettext as _
from spirit.models.comment_like import CommentLike
class LikeForm(forms.ModelForm):
class Meta:
model = CommentLike
fields = []
def __init__(self, user=None, comment=None, *args, **kwargs):
... |
########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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... |
import datetime
DATA = dict(
subject='REDACTED',
from_='redacted@attglobal.net',
to=('', '@mailman.enron.com'),
cc=(),
bcc=(),
reply_to=(),
date=datetime.datetime(2001, 11, 27, 15, 2, 35, tzinfo=datetime.timezone(datetime.timedelta(-1, 57600))),
date_str='Tue, 27 Nov 2001 15:02:35 -... |
"""
A testcase which accesses *values* in a dll.
"""
import unittest
from ctypes import *
import _ctypes_test
class ValuesTestCase(unittest.TestCase):
def test_an_integer(self):
ctdll = CDLL(_ctypes_test.__file__)
an_integer = c_int.in_dll(ctdll, "an_integer")
x = an_intege... |
# -*- coding: utf-8 -*-
"""
Functions for handling encoding of web pages
"""
import re, codecs, encodings
from sys import version_info
_HEADER_ENCODING_RE = re.compile(r'charset=([\w-]+)', re.I)
def http_content_type_encoding(content_type):
"""Extract the encoding in the content-type header
>>> import w3lib.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.