src stringlengths 721 1.04M |
|---|
#### PATTERN | DE | RULE-BASED SHALLOW PARSER ######################################################
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Gerold Schneider, Martin Volk and University of Antwerp, Belgium
# Authors: Gerold Schneider & Martin Volk (German language model), Tom De Smedt <tom@organisms.be>
# License:... |
#!/usr/bin/python
# Copyright 2016 Google 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 appli... |
# Copyright (c) 2016 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
#
# Unless required by app... |
from cbc import CBC_encrypt
from ecb import ECB_encrypt
from bytestring_tools import xor, data
from math import ceil
def counter_function(n):
return int.to_bytes(n,9,'big')+b'\x00'*7
def CTR_keystream(key,counter_function,length,start):
# start = nonce = first byte we haven't generated keystream for yet
# I hav... |
from oldowan.mtconvert import seq2sites, sites2seq, str2sites
from string import translate
import pandas as pd
import sys
sys.path.append('../../scripts')
from utils import *
## load metadata
metadata = pd.read_csv('metadata.csv', index_col=0)
regionparts = metadata.ix[0,'SeqRange'].split(';')
region1 = range2region... |
from .solverwrapper import SolverWrapper
import logging
import numpy as np
from ..constraint import ConstraintType
from ..constants import CVXPY_MAXX, CVXPY_MAXU
logger = logging.getLogger(__name__)
try:
import cvxpy
FOUND_CVXPY = True
except ImportError:
logger.info("CVXPY installation not found.")
... |
# Copyright (C) 2015 Stefan C. Mueller
import unittest
from twisted.internet import defer
import twistit
class TestExtract(unittest.TestCase):
def test_success(self):
d = defer.succeed(42)
self.assertEqual(42, twistit.extract(d))
def test_fail(self):
d = defer.fail(ValueE... |
from __future__ import absolute_import, division, print_function
import collections
import numpy as np
import tensorflow as tf
from sklearn.mixture import GaussianMixture
from tensorflow.python import keras
from tensorflow.python.framework import tensor_shape
from tensorflow.python.keras.layers import Dense
from tens... |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License... |
#!/usr/bin/env python3
# Copyright (c) 2016 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... |
#!/usr/bin/env python
"""
* =========================================================================
* This file is part of math.linear-c++
* =========================================================================
*
* (C) Copyright 2004 - 2014, MDA Information Systems LLC
*
* math.linear-c++ is free softwa... |
#!/usr/bin/env python
#
# URLClassifier.py
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRA... |
# -*- encoding: utf-8 -*-
"""
Interactive demos for the h2o-py library.
:copyright: (c) 2016 H2O.ai
:license: Apache License Version 2.0 (see LICENSE for details)
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import linecache
import os
import sys
import h2o
# noinspection P... |
r"""
:mod:`~matplotlib.mathtext` is a module for parsing a subset of the
TeX math syntax and drawing them to a matplotlib backend.
For a tutorial of its usage see :ref:`mathtext-tutorial`. This
document is primarily concerned with implementation details.
The module uses pyparsing_ to parse the TeX expression.
.. _p... |
# -*- coding: ascii -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
from itertools import groupby
from lxml import etree
from odoo import api, fields, models
from odoo import tools
from odoo.addons.website.models import website
from odoo.http import request
_logger = lo... |
# 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 ... |
#!/usr/bin/env python
import re
import sys
import subprocess
import fjdisplay
usage = """fjclip.py src dest. src or dest can be named firejails or - for stdin or stdout.
firemon --x11 to see available running x11 firejails. firejail names can be shortened
to least ambiguous. for example 'work-libreoffice' can be shor... |
#!/usr/bin/env python
from json import loads
import hashlib
import base64
import os
import binascii
try:
from Crypto.Cipher import AES
import xml.etree.ElementTree as ET
has_crypto = True
except ImportError:
has_crypto = False
from ..common import *
from ..extractor import VideoExtractor
from ..util ... |
from __future__ import absolute_import, unicode_literals
import datetime
import json
import pytz
import requests
import six
import unittest
from mock import patch
from . import TembaClient, __version__
from .base import TembaObject, SimpleField, IntegerField, DatetimeField, ObjectListField, TembaException
from .base ... |
__source__ = 'https://leetcode.com/problems/print-binary-tree/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 655. Print Binary Tree
#
# Print a binary tree in an m*n 2D string array following these rules:
#
# The row number m should be equal to the height of the given binary tree.
# The column number n should ... |
# -*- coding: utf-8 -*-
import datetime
import json
from unittest import mock
from django.db.models import Q
from django.test import TestCase
from elasticsearch.serializer import JSONSerializer
from wagtail.search.backends.elasticsearch6 import Elasticsearch6SearchBackend
from wagtail.search.query import MATCH_ALL, ... |
"""
From https://fedoraproject.org/wiki/QA:Testcase_base_service_manipulation.
"""
import unittest
from .testutils import system
class TestServiceManipulation(unittest.TestCase):
def test_service(self):
"Tests the crond service."
out, err, eid = system('systemctl status crond.service')
o... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... |
import os
import uuid
from osipkd.tools import row2dict, xls_reader
from datetime import datetime
from sqlalchemy import not_, func
from pyramid.view import (view_config,)
from pyramid.httpexceptions import ( HTTPFound, )
import colander
from deform import (Form, widget, ValidationFailure, )
from osipkd.models import D... |
"""This module tests a binary search tree."""
import pytest
MEDIUM_TREE = [10, 15, 13, 7, 5, 8, 3]
@pytest.fixture
def e_tree():
"""Initialize an empty search tree."""
from bst import BinarySearchTree
return BinarySearchTree()
@pytest.fixture
def m_tree():
"""Initialize a search tree of medium co... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import traceback
from shadowsocks import shell, common
from configloader import load_config, get_config
import random
import getopt
import sys
import json
import base64
class MuJsonLoader(object):
def __init__(self):
self.json = None
def load(self, path):
l = "[]"
t... |
"""A collection of string operations (most are no longer used in Python 1.6).
Warning: most of the code you see here isn't normally used nowadays. With
Python 1.6, many of these functions are implemented as methods on the
standard string object. They used to be implemented by a built-in module
called strop, but strop... |
"""A wait callback to allow psycopg2 cooperation with eventlet.
Use `make_psycopg_green()` to enable eventlet support in Psycopg.
"""
# Copyright (C) 2010 Daniele Varrazzo <daniele.varrazzo@gmail.com>
# and licensed under the MIT license:
#
# Permission is hereby granted, free of charge, to any person obtaining a co... |
import os
import datetime
import hashlib
import unicodedata
from django.db import models
from django.utils.timezone import utc
from django.dispatch import receiver
from sorl.thumbnail import ImageField
def _now():
return datetime.datetime.utcnow().replace(tzinfo=utc)
class Location(models.Model):
name = m... |
"""Unit test for treadmill.runtime.linux._finish.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import datetime
import io
import json
import os
import shutil
import tarfile
import tempfile
import time
import uni... |
import pytest
from glotaran.parse.parser import load_yml_file
from glotaran.builtin.models.kinetic_image.initial_concentration \
import InitialConcentration
from glotaran.builtin.models.kinetic_image.irf import IrfGaussian
from glotaran.builtin.models.kinetic_image.kinetic_image_megacomplex \
import K... |
import ecdsa
from ecdsa.util import number_to_string, string_to_number
from electroncash.bitcoin import (generator_secp256k1, point_to_ser, EC_KEY,
Hash, InvalidPassword)
class CryptoError(Exception):
''' base class of a subset of the possible exceptions raised in this class
... |
#!/usr/bin/env python
import os, shutil, sys, glob, imp
import __builtin__
import ConfigParser
from cStringIO import StringIO
from optparse import OptionParser
import wx.stc
__builtin__._ = str
sys.path.append("..")
from peppy.debug import *
from facade import *
facade = EditraFacade()
class_attr_template = ''' ... |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
# 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
# distributed under the Li... |
from hwt.code import If
from hwt.hdl.assignment import Assignment
from hwt.hdl.operator import Operator
from hwt.hdl.types.defs import BIT
from hwt.hdl.types.struct import HStruct
from hwt.hdl.value import HValue
from hwt.synthesizer.interfaceLevel.unitImplHelpers import getSignalName
from hwt.synthesizer.rtlLevel.netl... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import math
import tempfile
import unittest
from chainer imp... |
import os
from copy import deepcopy
class RecursiveTree:
def __init__(self, dir_name):
self.dir_name = dir_name
self.files = []
self.folders = [] #Tuple Absolute address, branch, level
self.branches = []
self.children_n = []
self.currentlevel = 0
self.level=[... |
import requests
import uuid
import json
outlook_api_endpoint = 'https://outlook.office.com/api/v2.0{0}'
# Generic API Sending
def make_api_call(method, url, token, payload = None, parameters = None):
# Send these headers with all API calls
headers = { 'User-Agent' : 'django-tutorial/1.0',
'Aut... |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
import pytest
from azure.ai.formrecognizer._helpers import get_content_type
from testcase import FormRecognizerTest
class TestContentType(FormRecognize... |
# Copyright 2013-2015 DataStax, 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 writi... |
"""
Functions for working with the arXiv.org api.
"""
import urllib
import requests
from xml.etree import ElementTree
from refkit.util import arxivid
from refkit.metadata import Metadata
from refkit.format import author
def search(lookup):
"""
Search for a reference on arXiv.org given a lookup str... |
# encoding: utf-8
import hashlib
from django import forms
from django.db import models
from django.db.models.fields import CharField
from django.utils.text import capfirst
class HashField(models.CharField):
description = ('HashField is related to some other field in a model and'
'stores its ... |
"""
:mod: DataManager
.. module: DataManager
:synopsis: DataManager links the functionalities of StorageElement and FileCatalog.
This module consists of DataManager and related classes.
"""
# # RSCID
__RCSID__ = "$Id$"
# # imports
from datetime import datetime, timedelta
import fnmatch
import os
import time
from ... |
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import REDIRECT_FIELD_NAME
from django.http import HttpResponseForbidden
from django.http import HttpResponseRedirect
from django.utils.http import urlquote
from django.utils.decorators i... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# CherryMusic - a standalone music server
# Copyright (c) 2012 Tom Wallroth & Tilman Boerner
#
# Project page:
# http://fomori.org/cherrymusic/
# Sources on github:
# http://github.com/devsnd/cherrymusic/
#
# CherryMusic is based on
# jPlayer (GPL/MIT license) http://w... |
import sys
class KrakenRecord(object):
@classmethod
def parse_kraken_file(cls, kraken_f, iterate=False):
"""
Class method that returns a list of all kraken entries in the output
Also has the option to work as a generator and iterate back out objects (to selectively keep ... |
#!/usr/bin/env python
# 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.
"""Makes sure that all files contain proper licensing information."""
import json
import optparse
import os.path
import subproces... |
from filterDb import *
#from queriesDb import *
class Filter():
"""
permette di definire una serie di condizioni che il pv deve soddisfare, il metodo test applicato
sul singolo pv verifica che questo le rispetti, in particolare la logica dei filtri prevede che
piu' parametri della stessa classe siano in OR ... |
import sys
import re
from collections import Counter
#import collections
from itertools import combinations
from math import log
'''
def smoothing(data):
#print(len(data))
smdata=data
for key in smdata.keys():
smdata[key]=smdata[key]+1
return smdata
'''
traintext=sys.argv[2]
lmlist=sys.argv[1]... |
prov_cap = {
"Hebei": "Shijiazhuang",
"Shanxi": "Taiyuan",
"Liaoning": "Shenyang",
"Jilin": "Changchun",
"Heilongjiang": "Harbin",
"Jiangsu": "Nanjing",
"Zhejiang": "Hangzhou",
"Anhui": "Hefei",
"Fujian": "Fuzhou",
"Jiangxi": "Nanchang",
"Shandong": "Jinan",
"Henan": "Zhe... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2020-11-09 21:35
from __future__ import unicode_literals
from django.db import migrations
import django.db.models.deletion
import sentry.db.models.fields.foreignkey
class Migration(migrations.Migration):
# This flag is used to mark that a migration shouldn... |
""" Create a batch of single use discount coupons from a CSV file.
Parameters: <conference> <csv-file>
Creates coupons based on the CSV file contents:
code - coupon code
max_usage - max. number of uses
items_per_usage - max number of items per use
value - value of the coupon in percent
de... |
# -*- coding: utf-8 -*-
#
# Vision Egg documentation build configuration file, created by
# sphinx-quickstart on Fri Aug 29 21:31:07 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... |
#########################################################################
# #
# #
# copyright 2002 Paul Henry Tremblay #
# ... |
#! /usr/bin/env python
from __future__ import print_function
from builtins import str
import sys
import os
from vmrunner import vmrunner
import socket
# Get an auto-created VM from the vmrunner
vm = vmrunner.vms[0]
def UDP_test():
print("<Test.py> Performing UDP tests")
HOST, PORT = "10.0.0.55", 4242
sock = so... |
from rdr_service.model.code import CodeType
from tests.helpers.unittest_base import BaseTestCase
class CheckPpiDataApiTest(BaseTestCase):
def setUp(self):
super(CheckPpiDataApiTest, self).setUp(with_consent_codes=True)
self.participant_summary = self.data_generator.create_database_participant_sum... |
""" objective introduction
Author: Yi Zhang <beingzy@gmail.com>
Date: 2016/05/09
"""
from .UserClickSimulator import UserClickSimulatorMixin
def convert_pair_dictionary(user_connections):
""" translate user pairs into user-wise dictionary
"""
user_conn_dict = {}
for ii, (uid_a, uid_b) in enumerate(us... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-03-01 10:46
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migration... |
# The MIT License
#
# Copyright (c) 2009-2011 Andreas Stuehrk
#
# 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, mo... |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Microsoft Public License. A
# copy of the license can be found in the License.html file at the root of this... |
# -*- test-case-name: txdav -*-
##
# Copyright (c) 2012-2017 Apple 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
#
#... |
#!/usr/bin/env python
#
# $Id$
#
# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Print detailed information about a process.
"""
import os
import datetime
import socket
import sys
import... |
#!/usr/bin/env python
import os
from git import Repo
from shutil import rmtree
from glob import glob
import xml.etree.ElementTree as etree
import re
git_url = "https://github.com/chriskempson/base16.git"
repo_dir = "./base16"
scss_dir = "../scss/color-schemes"
labels = [
"base00",
"base01",
"base02",
... |
#!/usr/bin/python3
"""Analyze browser usage from Google Analytics.
In order to use this tool, export a .csv report of browsers (Audience >
Technology > Browser & OS), with Secondary dimension of Browser Version.
The mappings of some browser versions to their equivalent Chromium version may
need to be maintained every... |
#-*- coding: UTF-8 -*-
import time
from utilities import *
from culrcscrapers.alsong import lyricsScraper as lyricsScraper_alsong
from culrcscrapers.azlyrics import lyricsScraper as lyricsScraper_azlyrics
from culrcscrapers.baidu import lyricsScraper as lyricsScraper_baidu
from culrcscrapers.darklyrics import lyricsScr... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from selenium.webdriver.common.by import By
from pages.base import Base
from pages.user.user_profile_delete import User... |
#!/usr/bin/env python2.7
#
# Copyright (C) 2014 INRA
#
# 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 ... |
__author__ = 'civa'
import os
from shared.loaders import JsonDataLoader
class FieldMapCollection(object):
def __init__(self, providers):
self.all_maps = []
for provider, val in providers.iteritems():
map = FieldMap(provider, val)
self.all_maps.append(map)
def get(sel... |
# -------------------------------------------------------------------#
# Released under the MIT license (https://opensource.org/licenses/MIT)
# Contact: mrinal.haloi11@gmail.com
# Copyright 2017, Mrinal Haloi
# -------------------------------------------------------------------#
import tensorflow as tf
import numpy as ... |
#!@PYTHON@
# -*- mode: python; coding: utf-8; -*-
#
# This file is part of Invenio.
# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011 CERN.
#
# Invenio 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... |
import unittest
import sys, os, os.path
rootDirectory = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..')
if rootDirectory not in sys.path:
sys.path.append(rootDirectory)
from applicationinsights import channel
class TestSynchronousQueue(unittest.TestCase):
def test_construct(self):
... |
"""
SAPO OAuth support.
This adds support for SAPO OAuth service. An application must
be registered first on twitter and the settings SAPO_CONSUMER_KEY
and SAPO_CONSUMER_SECRET must be defined with they corresponding
values.
User screen name is used to generate username.
By default account id is stored in extra_data... |
"""
sentry.db.backends.redis
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from sentry.db.backends.base import SentryBackend
import datetime
import redis
class RedisBackend(Sent... |
#
# Copyright (C) 2005 Norwegian University of Science and Technology
# Copyright (C) 2007, 2011-2013 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published... |
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'Gnupyx'
SITENAME = u'Gnupyx'
SITEURL = 'http://gnupyx.ninja'
PATH = 'content'
TIMEZONE = 'Europe/Paris'
DEFAULT_LANG = u'fr'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = True
CATEGORY_FEED... |
""" mk CLI. """
from pathlib import Path
from typing import List
import typer
from rich.console import Console
from rich.table import Table
from creat.context import make_root_context
from . import get_console, setup_logger
from .find import update_index_from_roots
from .index import Index
from .run import run
from... |
"""Integration method that emulates by-hand techniques.
This module also provides functionality to get the steps used to evaluate a
particular integral, in the ``integral_steps`` function. This will return
nested namedtuples representing the integration rules used. The
``manualintegrate`` function computes the integra... |
# coding:utf-8
from importlib import import_module
from django.http import HttpResponse
from . import settings as USettings
import os
import json
from django.views.decorators.csrf import csrf_exempt
import datetime
import random
import urllib
from django.utils import six
if six.PY3:
long = int
de... |
import sys
import os
import datetime
import pickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import matplotlib.colors as colors
from pprint import pprint
import sqlite3
import calendar
from datetime import datetime
from datetime import timedelta
import math
import numpy.polynomial.po... |
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 Pierre Raybaut
# Licensed under the terms of the MIT License
# (see spyderlib/__init__.py for details)
"""Shell Interpreter"""
import sys
import atexit
import threading
import ctypes
import os
import re
import os.path as osp
import pydoc
from subproces... |
# Copyright (C) 2010, 2012 Google 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 an... |
# -*- 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... |
# coding: utf-8
#
# 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 requi... |
###########################################################
#
# Copyright (c) 2010, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... |
# -*- coding: utf-8 -*-
"""
This is part of WebScout software
Docs EN: http://hack4sec.pro/wiki/index.php/WebScout_en
Docs RU: http://hack4sec.pro/wiki/index.php/WebScout
License: MIT
Copyright (c) Anton Kuzmin <http://anton-kuzmin.ru> (ru) <http://anton-kuzmin.pro> (en)
Tests of Spider module
"""
import sys
import os... |
# Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
"""Optimization methods based on a forward-b... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 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.apac... |
from pat import getPayload
from collections import Counter
from concurrent import futures
import requests, bs4
from tqdm import tqdm
def getPage(session, page):
# print('getting page %d...' % page)
url = 'http://www.patest.cn/contests/pat-b-practise/submissions?page=%d' % page
res = session.get(url)
... |
# -*- coding: utf-8 -*-
"""
tests/test_sale.py
"""
import sys
import os
import unittest
import datetime
from decimal import Decimal
from dateutil.relativedelta import relativedelta
import trytond.tests.test_tryton
from trytond.tests.test_tryton import POOL, USER, DB_NAME, CONTEXT
from trytond.transaction import T... |
#!/usr/local/miniconda3/bin/python
def setupArguments():
"""
This is the function that sets up the flags and the arguements you can pass to the script.
:author: Neil A. Patel
"""
aParser = argparse.ArgumentParser("Setup the arguments.")
aparser.add_argument('-f', '--file', action='store', dest='file_targe... |
import demistomock as demisto
MOCK_PARAMS = {
'access-key': 'fake_access_key',
'secret-key': 'fake_access_key',
'server': 'http://123-fake-api.com/',
'unsecure': True,
'proxy': True
}
def test_fetch_incidents(mocker, requests_mock):
"""
Given: An existing last run time.
When: Running... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Build System Python Library
#
# Copyright (C) 2003 Holger Schurig
# Copyright (C) 2003, 2004 Chris Larson
#
# Based on Gentoo's portage.py.
#
# This program is free software; you can redistribute it and/or modify
# it... |
"""Parsing utilities for Wikipedia database dumps."""
from __future__ import print_function
from os.path import basename
from bz2 import BZ2File
from collections import Counter, namedtuple
import gzip
from HTMLParser import HTMLParser
from itertools import chain
import logging
import re
import xml.etree.ElementTree a... |
# -*- coding: utf-8 -*-
# Copyright (c) 2008 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing the helpbrowser using QWebView.
"""
from __future__ import unicode_literals
try:
str = unicode
except NameError:
pass
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QT_TRANSLAT... |
#
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... |
from feedly.activity import AggregatedActivity
from feedly.serializers.aggregated_activity_serializer import AggregatedActivitySerializer
import pickle
class CassandraAggregatedActivitySerializer(AggregatedActivitySerializer):
def __init__(self, model):
self.model = model
def dumps(self, aggregated)... |
import numpy as np
def rgb2lab(image):
""" Transforms an RGB-image to a LAB-image. """
return xyz2lab(rgb2xyz(image))
def lab2rgb(image):
""" Transforms a LAB-image to an RGB-image. """
return xyz2rgb(lab2xyz(image))
def rgb2xyz(image):
""" Transforms an RGB-mage to a XYZ-image. """
image ... |
#!/usr/bin/env python
import click
import os
import codecs
import json
import pandas as pd
from nlppln.utils import create_dirs, get_files
@click.command()
@click.argument('in_dir', type=click.Path(exists=True))
@click.option('--out_dir', '-o', default=os.getcwd(), type=click.Path())
@click.option('--name', '-n', de... |
###########################################################################
#
# 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/l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.