src stringlengths 721 1.04M |
|---|
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import logging
log = logging.getLogger(__name__)
from ..helper import Helper as BaseHelper
from hydroffice.base.ftpconnector import FtpConnector
class Woa09Checker(object):
def __init__(self, force_downlo... |
from typing import TYPE_CHECKING
import claripy
import pyvex
from ...engines.vex.claripy.datalayer import value as claripy_value
from ...engines.light import SimEngineLightVEXMixin
from ..typehoon import typevars, typeconsts
from .engine_base import SimEngineVRBase, RichR
if TYPE_CHECKING:
from .variable_recover... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
## This file is part of ccsocket
## Copyright (C) Tomas Dragoun <drakoviens@gmail.com>
## This program is published under a GPLv3 license
########################################################
import nfqueue
import sys
import signal
from multiprocessing import Process, Pipe... |
"""
Scenario 1: Game 2
Two bodies (reduced game)
-------------------------
Hypothesize combination of bodies 1 & 4 and 2 & 3
provided trajectory stays sufficiently far from them
"""
from __future__ import division
from PyDSTool import *
import PyDSTool.Toolbox.phaseplane as pp
from bombardier import *
import bombard... |
###############################################################################
# Name: Cody Precord #
# Purpose: SourceControl implementation for Bazaar #
# Author: Cody Precord <cprecord@editra.org> #
... |
# -*- coding: utf-8 -*-
try:
set
except:
from sets import Set as set
from pynfe.entidades import Emitente, Cliente, Produto, Transportadora, NotaFiscal
from pynfe.excecoes import NenhumObjetoEncontrado, MuitosObjetosEncontrados
from pynfe.utils import etree, so_numeros, obter_municipio_por_codigo, obter_pais_p... |
# -*- coding: utf-8 -*-
import re
import unittest
import uuid
from datetime import date, datetime
from decimal import Decimal
from urllib.parse import quote_plus
import numpy as np
import pandas as pd
import sqlalchemy
from sqlalchemy import String
from sqlalchemy.engine import create_engine
from sqlalchemy.exc import... |
"""Tests for the :class:`jicimagelib.io.AutoName` class."""
import unittest
class AutoNameTests(unittest.TestCase):
def test_import_AutoName_class(self):
# This throws an error if the class cannot be imported.
from jicimagelib.io import AutoName
def test_count(self):
from jicimagelib... |
import sublime
import sys
import re
class CrossPlaformCodecs():
@classmethod
def decode_line(self, line):
line = line.rstrip()
decoded_line = self.force_decode(line) if sys.version_info >= (3, 0) else line
decoded_line = re.sub(r'\033\[(\d{1,2}m|\d\w)', '', str(decoded_line))
re... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
from __future__ import absolute_import
import codecs
import glob
import json
import os
import re
import six
import sys
import tct
from os.path import join as ospj
from tct import deepget
params = tct.readjson(sys.argv[1])
binabspath = sys.a... |
from subprocess import *
import re
import treetaggerwrapper
import sparqlQuerypy
from bs4 import BeautifulSoup
CONSTANTKEYVERBS="die, died, death, born, birth, sworn in" #Set of words that if present in the sentence, then don't discard the sentence, we are interested.
tagger = treetaggerwrapper.TreeTagger(TAGLANG = 'e... |
# -*- coding: utf-8 -*-
#
# SpamFighter, Copyright 2008, 2009 NetStream LLC (http://netstream.ru/, we@netstream.ru)
#
# This file is part of SpamFighter.
#
# SpamFighter 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... |
"""
.. module:: operators.dive_operator
:synopsis: DivePythonOperator for use with TaskRunner
.. moduleauthor:: Laura Lorenz <llorenz@industrydive.com>
.. moduleauthor:: Miriam Sexton <miriam@industrydive.com>
"""
from airflow.operators import PythonOperator
from .dive_operator import DiveOperator
class DivePy... |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico
## Copyright (C) 2002 - 2013 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 Foundation, either... |
#!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
# Copyright 2016 Tesora, Inc.
# 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 ... |
import csv
import datetime
import matplotlib.pyplot as plt
import matplotlib
import itertools
import numpy
import argparse
import sys
YMIN = 0
YMAX = 35000
"""
colors = ['b', 'g', 'r',
'c', 'm', 'y',
'k'
]
"""
def read_datafile(file_name, norm_time):
time = []
capacitance = []
... |
from __future__ import unicode_literals
from botocore.exceptions import ClientError
import pytest
from unittest import SkipTest
import base64
import ipaddress
import six
import boto
import boto3
from boto.ec2.instance import Reservation, InstanceAttribute
from boto.exception import EC2ResponseError
from freezegun i... |
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty, BooleanProperty
from kivy.lang import Builder
Builder.load_string('''
<FxDialog@Popup>
id: popup
title: 'Fiat Currency'
size_hint: 0.8, 0.8
pos_hint: {'top':0.9}
BoxLayout:
orientation: 've... |
"""
Security channels module for Zigbee Home Automation.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/zha/
"""
import logging
import zigpy.zcl.clusters.security as security
from homeassistant.core import callback
from homeassistant.helpers.dispatche... |
"""
PyOneNote.py
~~~~~~~~~~~~~~~~~
This module contains a basic OAuth 2 Authentication and basic handler for GET and POST operations.
This work was just a quick hack to migrate notes from and old database to onenote but should hep you to understand
the request structure of OneNote.
Copyright (c) 2016 Coffeemu... |
"""pygments-sisal module setup script for distribution."""
from __future__ import with_statement
import os
import setuptools
def get_version(filename):
with open(filename) as fh:
for line in fh:
if line.startswith('__version__'):
return line.split('=')[-1].strip()[1:-1]
set... |
import sys
from PyQt4 import QtGui, QtCore
import time, socket, json
from main import Ui_MainWindow
s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
IP = "localhost"
PORT = 8001
class main_menu(QtGui.QMainWindow):
def __init__(self):
super(main_menu, self).__init__()
self.ui=Ui_MainWindow()
... |
"""
StructureFactorConstraints contains classes for all constraints related experimental static structure factor functions.
.. inheritance-diagram:: fullrmc.Constraints.StructureFactorConstraints
:parts: 1
"""
# standard libraries imports
from __future__ import print_function
import itertools, re
# external libra... |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets('mnist_data',one_hot=True)
batch_size = 100
n_batch = mnist.train.num_examples // batch_size
def weight_variable(shape):
initial = tf.truncated_normal(shape,stddev=0.1)
return tf.V... |
# import packages
import matplotlib; matplotlib.use('Agg')
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn.feature_selection import chi2
from sklearn.metrics import roc_auc_score, roc_curve, auc, precision_score, f1_score, mean_squared_error, accuracy_score
# report coefficients
de... |
# Copyright 2013-present Barefoot Networks, 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 agr... |
# Copyright (c) 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 agreed to in writ... |
# Created by PyCharm Pro Edition
# User: Kaushik Talukdar
# Date: 24-04-17
# Time: 12:29 AM
# INHERITANCE
# We can create a new class, but instead of writing it from scratch, we can base it on an existing class.
# Lets understand inheritance better with an exa... |
import config
import smtplib
from contextlib import contextmanager
@contextmanager
def smtp_server():
server = smtplib.SMTP(config.lookup("smtp.server"))
def activate_tls():
server.starttls()
security = config.lookup("smtp.security")
if security:
{
"tls": activate_tls,
... |
"""
Cranelift base instruction set.
This module defines the basic Cranelift instruction set that all targets
support.
"""
from __future__ import absolute_import
from cdsl.operands import Operand, VARIABLE_ARGS
from cdsl.typevar import TypeVar
from cdsl.instructions import Instruction, InstructionGroup
from base.types ... |
# -*- coding: utf-8 -*-
"""
Django settings for saefacto project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the project like this: os.pa... |
'''Arsenal audit UI.'''
# Copyright 2015 CityGrid Media, 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 ap... |
# Copyright (C) 2015 Pure Storage, 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 la... |
from test_all_fixers import lib3to2FixerTestCase
class Test_unpacking(lib3to2FixerTestCase):
fixer = u'unpacking'
def test_unchanged(self):
s = u"def f(*args): pass"
self.unchanged(s)
s = u"for i in range(s): pass"
self.unchanged(s)
s = u"a, b, c = range(100)"
... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... |
import base64
from collections import namedtuple
from datetime import datetime, timedelta
import logging
import urllib
import urlparse
from django.utils.translation import ugettext_lazy as _
from requests.exceptions import Timeout, ConnectionError
from corehq.apps.cachehq.mixins import QuickCachedDocumentMixin
from co... |
from types import ClassType
import warnings
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models.fields.related import OneToOneField
from django.db.models.manager import Manager
from django.db.models.query import QuerySet
import django
class InheritanceQuerySe... |
#!/usr/bin/env python
'''
Class-based version....
Write a script that connects to the lab pynet-rtr1, logins, and executes the
'show ip int brief' command.
'''
import telnetlib
import time
import socket
import sys
import getpass
TELNET_PORT = 23
TELNET_TIMEOUT = 6
class TelnetConn(object):
'''
Telnet connect... |
# Copyright 2015-2016 Yelp 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 agreed to in writin... |
#-
# Copyright (c) 2011 Robert N. M. Watson
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @BERI_LICENSE_HEADER_START@
#
# License... |
import tensorflow as tf
import math
import numpy as np
import os
import pickle
import time
from learning.input_data import input_data
import sys
def learn_model(trainingset_path, model_path, model_restored_path = None, learning_rate = None, verbose = 1):
if not learning_rate :
learning_rate = 0.0005
... |
'''
Created on Jul 9, 2016
@author: farid
'''
from definitions import *
class chessman():
def __init__(self , cell , color):
'''
Constructor
'''
self._color = color
self._cell = cell
def is_legal_move(self):
pass
def is_legal_capture(self):
... |
#!/usr/bin/env python
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
# Support for excporting Qt's MenuBars/Menus over DBUS. The API is defined in... |
# Copyright (c) 2015-2016, 2018-2020 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2015-2016 Ceridwen <ceridwenv@gmail.com>
# Copyright (c) 2018 Bryce Guinta <bryce.paul.guinta@gmail.com>
# Copyright (c) 2018 Nick Drozd <nicholasdrozd@gmail.com>
# Copyright (c) 2018 Anthony Sottile <asottile@umich.edu>
# Copyrig... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 30 09:48:53 2015
@author: Alejandro Alcalde (elbauldelprogramador.com)
"""
from ej2 import LFSR
def geffe(coef1, s1, coef2, s2, coef3, s3, l):
l1 = LFSR(coef1, s1, l)
l2 = LFSR(coef2, s2, l)
l3 = LFSR(coef3, s3, l)
r = []
for i, j, k in zip(l1,l2... |
# -*- coding:utf-8 -*-
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
"""
链表中倒数第k个结点
题目描述
输入一个链表,输出该链表中倒数第k个结点。
特殊情况 k=0 k 超过长度 head 为空
思路:
如果我们在遍历时维持两个指针,第一个指针从链表的头指针开始遍历,在第k-1步之前,第二个指针保持不动;
在第k-1步开始,第二个指针也开始从链表的头指针开始遍历。
由于两个指针的距离保持在k-1,当第一个(走在前面的)指针到达链表的尾结点时,第二个... |
ENS = [
{
"constant": True,
"inputs": [
{
"name": "node",
"type": "bytes32"
}
],
"name": "resolver",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": False,
"type": "function"
},
{
"constant": True,
"inputs... |
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""
Example command module template
Copy this module up one level to gamesrc/commands/ and name it as
befits your use. You can then use it as a template to define your new
commands. To use them you also need to group them in a CommandSet (see
examples/cmdset.py)
"""
import time
from ev import Command as BaseCommand... |
from __future__ import print_function
import time
import logging
from py2neo import Graph,Node
from py2neo.ext import ogm
from py2neo.packages.httpstream.http import SocketError
log = logging.getLogger('flask.neo4j')
logging.basicConfig()
# Find the stack on which we want to store the GraphDatabaseService instance.
... |
"""
Read a directory of expression counts in ht-seq format. Each sample
should be an individual file in the directory. File names and
sample order are specified in the config file (order is determined
by order IN the config.)
This class is intended to return the raw dataframe of samples with
missing sample columns as ... |
import torch
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
import torch.distributed.deprecated as dist
from torch.nn.modules import Module
from collections import defaultdict
from torch.autograd import Variable
import torch.utils.hooks
class DistributedDataParallelCPU(Module):
r"""Impl... |
# seer2.py
# python 3.5
# Simple demo of super-basic neural-network weather prediction.
# This version is re-written and very cleaned-up.
# Chris Bugg
# Created: 2/1/15
# Updated: 3/23/17
# TODO: Add other things to track
# TODO: Add API to fetch WX data
# TODO: Create dynamic version
import ran... |
import os
import time
import glob
import re
from ..calculateError import run as calculateError
from ..loadParser.parseLabel import run as parseLabel
from ..loadParser.loadPeak import run as loadPeak
"""
These methods are common parts of learning processes which are in
learn****param.py.
"""
def parallel_learning(MAX... |
# -*- coding: utf-8 -*-
"""
Python documentation conversion utils
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: 2007-2008 by Georg Brandl.
:license: BSD.
"""
import re
from docutils.nodes import make_id
from .docnodes import TextNode, EmptyNode, NodeList
def umlaut(cmd, c):
try:
if... |
from django.db import IntegrityError
from rest_framework import exceptions
from rest_framework import serializers as ser
from api.base.exceptions import Conflict
from api.base.utils import absolute_reverse, get_user_auth
from api.base.serializers import JSONAPISerializer, LinksField, VersionedDateTimeField, Relationsh... |
# Files: Permutations.py
#
# Description: Creats permutations of an entered word.
#
__author__ = 'lothilius'
import math
class Permutations():
"""This module contains functions to generate all unique permutations
of a string, and to count permutations.
"""
def countOccurrences(word):
# c... |
import numpy as np
from sympy import Rational as frac
from sympy import cos, pi, sin, sqrt
from ..helpers import article, untangle
from ._helpers import CnScheme, _s
_source = article(
authors=["A.H. Stroud"],
title="Remarks on the Disposition of Points in Numerical Integration Formulas",
journal="Mathema... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
import datetime
import dateparser
import feedparser
import requests
import... |
import logging
import six
from oioioi.base.utils.db import require_transaction
from oioioi.contests.models import Submission
from oioioi.evalmgr.models import QueuedJob
logger = logging.getLogger(__name__)
@require_transaction
def mark_job_state(environ, state, **kwargs):
"""Sets status of given environ in job... |
"""
Basic Auth support.
Usage:
@graph.app.route("/path")
@graph.basic_auth.required
def must_be_authorized():
pass
"""
from base64 import b64encode
from flask_basicauth import BasicAuth
from microcosm.api import defaults
from werkzeug.exceptions import Unauthorized
from microcosm_flask.convent... |
# napper -- A REST Client for Python
# Copyright (C) 2016 by Yann Kaiser and contributors.
# See AUTHORS and COPYING for details.
import io
import json
import re
from .. import restspec
from ..errors import UnknownParameters
from .util import Tests
class ConfigTests(Tests):
def make_spec(self, **obj):
o... |
#!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the rawtransaction RPCs.
Test the following RPCs:
- createrawtransaction
- signrawtransacti... |
# This file is subject to the terms and conditions defined in
# file 'LICENSE', which is part of this source code package.
# Copyright (c) 2010 SKR Farms (P) LTD.
# -*- coding: utf-8 -*-
# Gotcha : none
# Notes : none
# Todo : none
# 1. Unit test case for this extension.
from zope.component impor... |
# -*- coding: utf-8 -*-
"""
Created on Tue May 30 13:13:44 2017
@author: larakamal
total evaluation evalutes the sorted documents
using precision and NDCG
change the directory of the sorted documents from lines 79-87
change the directory of the precision and NDCG graphs from
line 345 and 352
"""
from math import log... |
# -*- coding: utf-8 -*-
from operator import itemgetter
from unicodedata import normalize
import fnmatch
import logging
import os
import re
import string
import helpers
log = logging.getLogger("fileops")
class FileOps(object):
def __init__(self, casemode=0, countpos=0, dirsonly=False, exclude="",
... |
from PluginManager import PluginManager
from PluginDispatcher import PluginDispatcher
from Configuration import ConfigFile
from Util import call
from re import match
from sys import path
from os import getcwd
from Util import dictJoin
from Logging import LogFile
path.append(getcwd())
log = LogFile("Core")
class Cor... |
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 9 00:06:24 2014
@author: kristian
"""
from skumleskogen import *
import time
################## OPTIONS ##################
debug_on = True
write_to_file = True
hukommelse = {}
sti_totalt = ["inn"]
noder_med_lås = set()
forrige_retning = []
file = None
try:
del ... |
from orders import *
from gfxs import *
import ids
local_version = "v0.6.0" # major version
revision = "$Revision: 107 $" # updated by subversion
revisionSplitted = revision.split()
if len(revisionSplitted) > 2:
local_version = "%sr%s" % ( local_version, revisionSplitted[1] )
else:
local_version ... |
from __future__ import absolute_import
from __future__ import print_function
import autograd.numpy as np
from autograd import value_and_grad
from scipy.optimize import minimize
import matplotlib.pyplot as plt
import os
from builtins import range
rows, cols = 40, 60
# Fluid simulation code based on
# "Real-Time Flui... |
"""
sentry.models.project
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
import six
import warnings
from bitfield import BitField
from django.conf ... |
"""Implement Agents and Environments (Chapters 1-2).
The class hierarchies are as follows:
Thing ## A physical object that can exist in an environment
Agent
Wumpus
Dirt
Wall
...
Environment ## An environment holds objects, runs simulations
XYEnvironment
VacuumEnvironment
W... |
import unittest
import numpy as np
import scipy.stats as st
from ..analysis import Correlation
from ..analysis.exc import MinimumSizeError, NoDataError
from ..data import UnequalVectorLengthError, Vector
class MyTestCase(unittest.TestCase):
def test_Correlation_corr_pearson(self):
"""Test the Correlation... |
from __future__ import print_function, unicode_literals
import base64
import ntpath
import click
from pyinfra import logger
from pyinfra.api import Config
from pyinfra.api.exceptions import ConnectError, PyinfraError
from pyinfra.api.util import get_file_io, memoize, sha1_hash
from .pyinfrawinrmsession import Pyinf... |
import datetime
from couchdbkit.exceptions import ResourceNotFound
from casexml.apps.stock.consumption import ConsumptionConfiguration
from couchforms.models import XFormInstance
from corehq import Domain
from corehq.apps.accounting import generator
from corehq.apps.commtrack.models import CommtrackConfig, CommtrackAct... |
#
# (C) Copyright 2011 Jacek Konieczny <jajcus@jajcus.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful... |
# -*- coding: utf-8 -*-
'''
Created on 11 jan. 2017
@author: Fredrick
'''
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class Notifier(object):
'''
Sends email notifications.
'''
def __init__(self, args, conf):
'''
Constructor
... |
from galaxdustk.buttons import Button, CircularSelectButton, SelectButton
from galaxdustk.label import Label
from galaxdustk.screen import BaseScreen
import handlers
from gettext import gettext as _
class NewGameScreen(BaseScreen):
background_path = 'data/images/backgrounds/menu.png'
def __init__(self, cont... |
"""Table of Contents
-modified_huber
-hinge
-squared_hinge
-log
-squared
-huber
-epsilon_insensitive
-squared_epislon_insensitive
-alpha_huber
-absolute
"""
import numpy as np
def modified_huber(p, y):
"""Modified Huber loss for binary classification with y in {-1, 1}; equ... |
from os import path
from go.vumitools.tests.helpers import djangotest_imports
parser_classes = ['CSVFileParser', 'XLSFileParser']
with djangotest_imports(globals(), dummy_classes=parser_classes):
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.files.... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
"""
HTTP UNBEARBALE LOAD QUEEN
A HULK EDIT BY @OBN0XIOUS
THE ORIGINAL MAKER OF HULK PLEASE GO BACK TO CODECADEMY
"""
import sys
import argparse
import random
from threading import Thread
import hulqThreading
import hulqRequest
parser = argparse.ArgumentParser()
parser.add_argument('--threads', '-t', d... |
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
import json
import time
from .events import on_get as get_events
from collections import defaultdict
import requests
from ujson import dumps as json_dumps
from f... |
import os
import requests # pip install requests
# The authentication key (API Key).
# Get your own by registering at https://app.pdf.co/documentation/api
API_KEY = "**********************************************"
# Base URL for PDF.co Web API requests
BASE_URL = "https://api.pdf.co/v1"
# Direct URL of source PDF fi... |
'''Configuration file for the noise paper.'''
from __future__ import absolute_import, print_function
import os.path
import matplotlib.ticker as ti
from noisefigs.plotters.base import SeparateMultipageSaver
def get_config():
return _config
ROOT_DIR = ['simulation_data', 'ii_connections', 'gE_vs_gI']
_config =... |
import os
import os.path
import subprocess
import sys
from PIL import Image
LISTF = "_list.txt"
def get_dimensions(fpath):
#print(fpath)
return Image.open(fpath).size
def run(folder, outfile, framerate=30, outres=(1920,1080)):
jpglist = [os.path.join(folder, f) for f in os.listdir(folder) if f.startswith(... |
"""
Quadratic Discriminant Analysis
"""
# Author: Matthieu Perrot <matthieu.perrot@gmail.com>
#
# License: BSD Style.
import warnings
import numpy as np
import scipy.ndimage as ndimage
from .base import BaseEstimator, ClassifierMixin
# FIXME :
# - in fit(X, y) method, many checks are common with other models
# ... |
import os
import codecs
import csv
from collections import namedtuple
import dateutil.parser
Record = namedtuple('Record', 'datetime url email ip')
def read_tracker_file(tracker_dir: str, the_date: str, target: str, exclude_anonymous: bool = False):
"""
:param tracker_dir:
:param the_date:
:p... |
# Copyright (c) 2010-2013 Simplistix Ltd
#
# See license.txt for more details.
import re
from manuel import Document, Region, RegionContainer, Manuel
from mock import Mock
from testfixtures import compare, Comparison as C, TempDirectory
from testfixtures.manuel import Files,FileBlock,FileResult
from unittest import T... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------------
# Copyright © 2016, Continuum Analytics, Inc. All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
# -------------------------------------------------------------------... |
# Copyright 2017 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
'''Wireshark displays generic information about a packet's content in it's GUI
using a set of columns. Each column has one of several pre-defined column-types
which ``libwireshark`` knows about and fills with content while dissecting a
packets. This allows dissectors of all kinds to provide information about a
packet, ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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 So... |
# Natural Language Toolkit: Interface to Megam Classifier
#
# Copyright (C) 2001-2010 NLTK Project
# Author: Edward Loper <edloper@gradient.cis.upenn.edu>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
#
# $Id: naivebayes.py 2063 2004-07-17 21:02:24Z edloper $
"""
A set of functions used to i... |
# -*- coding: utf-8 -*-
# code for console Encoding difference. Dont' mind on it
import sys
import imp
imp.reload(sys)
try:
sys.setdefaultencoding('UTF8')
except Exception as E:
pass
import testValue
from popbill import ClosedownService, PopbillException
closedownService = ClosedownService(testValue.LinkID,... |
import numpy as np
import MDP
class RL:
def __init__(self,mdp,sampleReward):
'''Constructor for the RL class
Inputs:
mdp -- Markov decision process (T, R, discount)
sampleReward -- Function to sample rewards (e.g., bernoulli, Gaussian).
This function takes one argument: the... |
# -*- coding: utf-8 -*-
"""The app module, containing the app factory function."""
from flask import Flask
from remixvr.extensions import bcrypt, cache, db, migrate, jwt, cors
from remixvr import (commands, user, profile, project, theme, field,
space, activity, activitytype, classroom, school, sub... |
#!/usr/bin/env python
#
# Use the raw transactions API to spend ones received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a oned or One-Qt runn... |
# -*- coding: utf-8 -*-
from sfepy.base.base import *
##
# c: 22.07.2008
def youngpoisson_to_lame( young, poisson, plane = 'strain' ):
r"""
The relationship between Lame parameters and Young's modulus, Poisson's
ratio (see [1],[2]):
.. math::
\lambda = {\nu E \over (1+\nu)(1-2\nu)},\qquad \mu ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.