src stringlengths 721 1.04M |
|---|
"""
Exashare.com urlresolver XBMC Addon
Copyright (C) 2014 JUL1EN094
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 pro... |
#!/usr/bin/env python
#########################################################################################
#
# This function allows to run a function on a large dataset with a set of parameters.
# Results are extracted and saved in a way that they can easily be compared with another set.
#
# Data should be organiz... |
"""
Tests for the client
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import mock
import ga4gh.protocol as protocol
import ga4gh.backend as backend
import ga4gh.client as client
import ga4gh.datarepo as datarepo
import tests.utils a... |
#! /usr/bin/env python
# ======================================================================
# matscipy - Python materials science tools
# https://github.com/libAtoms/matscipy
#
# Copyright (2014) James Kermode, King's College London
# Lars Pastewka, Karlsruhe Institute of Technology
#
# This progr... |
#!/usr/bin/env python3
# Copyright (c) 2017 Genome Research Ltd.
# Author: Alistair Dunham
# 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 Licens... |
"""
Downloader for Reddit takes a list of reddit users and subreddits and downloads content posted to reddit either by the
users or on the subreddits.
Copyright (C) 2017, Kyle Hickey
This file is part of the Downloader for Reddit.
Downloader for Reddit is free software: you can redistribute it and/or modify
it und... |
#!/usr/bin/env python3
"""
Check that the domain described by DOMAIN.XML is running.
If the domain is not running, create it.
"""
import libvirt
import libxml2
from argparse import ArgumentParser
from typing import Tuple
# Parse the XML description of domU from FNAME
# and return a tuple (name, xmldesc) where NAME
#... |
from functools import reduce
from select import select
from threading import Thread
import approxeng.input.sys as sys
from approxeng.input.controllers import *
EV_KEY = 1
EV_REL = 2
EV_ABS = 3
class ControllerResource:
"""
General resource which binds one or more controllers on entry and unbinds the event l... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tests/client/application.py
#
# 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... |
#
#
# Copyright (C) 2006, 2007, 2008, 2010, 2011, 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:
#
# 1. Redistributions of source code must retain the above copyright notice,
... |
# Module-level documentation will automatically be shown as additional
# information for the modeler plugin in the web interface.
"""
FlexLM
An flexLM plugin that collects licenses under FlexLM control
"""
# When configuring modeler plugins for a device or device class, this plugin's
# name would be community.cmd.Flex... |
from adapt.intent import IntentBuilder
from mycroft.skills.core import MycroftSkill
from mycroft.util.log import getLogger
import unirest
import os
import time
import webbrowser
__author__ = 'jarbas'
LOGGER = getLogger(__name__)
class NEOSkill(MycroftSkill):
def __init__(self):
super(NEOSkill, self)._... |
from __future__ import division, absolute_import, print_function
import functools
import warnings
import operator
from . import numeric as _nx
from .numeric import (result_type, NaN, shares_memory, MAY_SHARE_BOUNDS,
TooHardError, asanyarray, ndim)
from numpy.core.multiarray import add_docstring
... |
#!/usr/bin/python
from generate_docs import build_documentation
from generate_docs import NoDoxygenError
from optparse import OptionParser
import os
import platform
import shutil
import stat
import subprocess
import sys
import tarfile
import tempfile
import traceback
import zipfile
g_script_dir = os.path.dirname(os.... |
from pywps.request.execute import Input
from pywps.inout.literal import Literal
from pywps import namespaces
import logging
class LiteralInput(Input):
datatype = "int"
uom = None
def __init__(self,identifier=None,value=None, title=None, abstract=None):
super(LiteralInput,self).__init__(identifie... |
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from functools import reduce
from docker.errors import APIError
from docker.errors import NotFound
from . import parallel
from .config import ConfigurationError
from .config.sort_services import get_service_name_from_net
fr... |
import unittest
from itertools import chain
from gn_django.video import facebook, twitch, youtube
class TestFacebook(unittest.TestCase):
"""
Test cases for Facebook helper functions
"""
valid_urls = (
'https://www.facebook.com/watch/live/?v=1844067005728897',
'http://www.facebook.com/... |
"""
Author: MrDupin
"""
class Node:
def __init__(self, v, p=None, w=False):
self.word = w #If the node represents the end of a word or not
self.parent = p
self.value = v
self.children = {}
class Trie:
def __init__(self):
self.root = Node('') #The root of the trie is al... |
import requests
from collections import defaultdict
import sys
FATED_UNIQUES = {
'Amplification Rod',
'Cragfall',
'Death\'s Opus',
'Deidbellow',
'Doomfletch\'s Prism',
'Ezomyte Hold',
'Hrimburn',
'Hrimnor\'s Dirge',
'Kaltensoul',
'Kaom\'s Way',
'Karui Charge',
'Martyr\'... |
import random
import traceback
import demistomock as demisto # noqa: F401
import urllib3
from CommonServerPython import * # noqa: F401
# Disable insecure warnings
urllib3.disable_warnings()
BASE_URL = 'https://api.chucknorris.io'
CATEGORIES = ['career', 'dev', 'history', 'money', 'movie', 'music', 'science', 'sp... |
import json
import os
import re
from optional_django import staticfiles
from webpack.compiler import webpack
from webpack.config_file import ConfigFile, JS
from js_host.conf import settings as js_host_settings
from react.exceptions import ComponentSourceFileNotFound
from react_router.conf import settings
def bundle_c... |
# *********************************************************************************************
# Copyright (C) 2017 Joel Becker, Jillian Anderson, Steve McColl and Dr. John McLevey
#
# This file is part of the tidyextractors package developed for Dr John McLevey's Networks Lab
# at the University of Waterloo. For mor... |
"""Gas blending functions (Very approximate).
Whenever a function calls for a gas mix it must be tuple in form (O2%, He%) e.g.
18/35Tx would be (18, 35)
Air would be (21, 00)
32% Nitrox would be (32, 00)."""
import math
from . import utils
def decant(s_cyl_size, s_cyl_pressure, r_cyl_size, r_cyl_pr... |
# -*- coding: utf-8 -*-
import os
import pygame
import random
from math import pi, cos, acos, sin, sqrt
import classes.board
import classes.extras as ex
import classes.game_driver as gd
import classes.level_controller as lc
import classes.simple_vector as sv
class Board(gd.BoardGame):
def __init__(self, mainloo... |
from PyQt5.QtWidgets import *
from electroncash.i18n import _
from electroncash_gui.qt.util import *
from electroncash.util import print_error
from electroncash.address import Address
from electroncash import networks
import copy
from btchip.btchip import BTChipException
helpTxt = [_("Your Ledger Wallet wants to te... |
# -*- coding: utf-8 -*-
import time
from data import Semester, TaskProgress, UserPrefs
from dataimport import RunScoutnetImport
from google.appengine.ext import deferred, ndb
from flask import Blueprint, render_template, request, make_response, redirect
import_page = Blueprint('import_page', __name__, template_folder... |
#!/usr/local/bin/python3
#
import configparser
import re
import argparse
import logging
import os
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument(
"--settings-file", help="DNS Setting file to be reviewed", default="DnsSettings.txt"
)
parser.add_argument(
"--prefix", help="Prefix of zon... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 25 13:17:15 2013
@author: Alan Yorinks
Copyright (c) 2013-14 Alan Yorinks All right reserved.
This program 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 Fre... |
#!/usr/bin/env python3
#Script (in progress) to report high-level folder information for offices transferring records to the University Archives.
#Dependencies: argparse, pathlib, python3.6 or above, csv, datetime
#Assumptions:
# 1.
import argparse, csv, datetime
from pathlib import Path, PurePath
from datetime imp... |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
# from iosDevCourse.users.models import User
from django.db import models
from embed_video.fields import EmbedVideoField
from django.core.urlresolvers import reverse
from mptt.models import MPTTModel, TreeForeignKey
from ckeditor.fields import RichT... |
import os
import tempfile
import unittest
from pyepw.epw import TypicalOrExtremePeriods, TypicalOrExtremePeriod, EPW
class TestTypicalOrExtremePeriods(unittest.TestCase):
def setUp(self):
self.fd, self.path = tempfile.mkstemp()
def tearDown(self):
os.remove(self.path)
def test_create_ty... |
# 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/.
# Common codegen classes.
from collections import defaultdict
import operator
import re
import string
import textwrap
... |
from json import dumps
from aiohttp.hdrs import CONTENT_TYPE
from aiohttp.multipart import MultipartWriter
from aiohttp.payload import get_payload
from multidict import CIMultiDict
from dirty_models.fields import ArrayField, ModelField
from dirty_models.models import BaseModel
from dirty_models.utils import ModelForm... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
"""
Classes supporting dataset serialization.
The interface is as follows::
class Serialization:
def dump(config, filename, **kwargs):
return None
def dumps(config, **kwargs):
return string
def load(filename, **kwargs):
return config
def loads(st... |
from cnfformula import RandomKCNF
from cnfformula.families.randomformulas import all_clauses
from . import TestCNFBase
class TestRandomCNF(TestCNFBase) :
def check_random_cnf(self,width,numvariables,numclauses) :
F = RandomKCNF(width,numvariables,numclauses)
self.assertListEqual(list(F.variables()... |
# Pyctools - a picture processing algorithm development kit.
# http://github.com/jim-easterbrook/pyctools
# Copyright (C) 2019-20 Pyctools contributors
#
# 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 Softwa... |
import numpy as np
import random
from q1_softmax_sol import softmax_sol as softmax
from q2_gradcheck import gradcheck_naive
from q2_sigmoid_sol import sigmoid_sol as sigmoid
from q2_sigmoid_sol import sigmoid_grad_sol as sigmoid_grad
def normalizeRows_sol(x):
""" Row normalization function """
# Implement a... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.utils.timezone import utc
import datetime
class Migration(migrations.Migration):
dependencies = [
('mm_transactions', '0019_auto_20141201_2338'),
]
operations = [
migrati... |
# 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 ... |
'''
Created on Feb. 23, 2019
Utility functions to extract data from xarray Dataset or DataArray classes.
@author: Andre R. Erler, GPL v3
'''
from warnings import warn
from datetime import datetime
import os
import numpy as np
import xarray as xr
import netCDF4 as nc
from dask.diagnostics import ProgressBar
# intern... |
from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.config import ConfigValidationError
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from txircd.utils import timestamp
from zope.interface import implements
from datetime import datetime
irc.RPL_TOPICW... |
from flask import Blueprint, jsonify, request, g
from decorators import is_user_logged_in, is_admin
from loggers import ActivityLog
import controllers
from models import User
users = Blueprint("users", __name__)
activity = ActivityLog.getInstance()
@users.route("/", methods=["GET"])
@is_user_logged_in("Illegal requ... |
# Generated by Django 2.2 on 2020-11-08 05:21
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('styles', '0001_initial'),
... |
"""
Copyright (c) 2015-2016 Cisco Systems, Inc. and others. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v1.0 which accompanies this distribution,
and is available at http:#www.eclipse.org/legal/epl-v10.html
"""
from ... |
# -*- coding: utf-8 -*-
"""
Django settings for telescope 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/
"""
from __future__ import absolute_import, unicode_l... |
import os
import re
import sys
from mtm.ioc.Inject import Inject
import mtm.util.Util as Util
from mtm.log.Logger import LogType
import shutil
from mtm.util.Assert import *
import mtm.log.ColorConsole as ColorConsole
class AnsiiCodes:
BLACK = "\033[1;30m"
DARKBLACK = "\033[0;30m"
RED = "\033[1;31m"
D... |
#!/usr/bin/python
import sys
import struct
EPSILON = 0.02
SAMPLE_RATE = 44100
ZERO_BIT_IN_SECS = 0.1
ONE_BIT_IN_SECS = 0.2
NEW_MINUTE_BEEP_THRESHOLD = 1.7
def read_word(inf):
return struct.unpack('<l', inf.read(struct.calcsize('=l')))[0]
def read_words(inf):
word = read_word(inf)
while True:
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Authr: João Juíz
'''
import sys,os,re,parsedatetime
import lxml.etree
from lxml.cssselect import CSSSelector
from myDb import ExtendedDB
import config
htmldir = os.path.expanduser("~/.motherless-dl/html")
class HTMLMixin(object):
def __call__(self):
#s... |
"""
Usage: (python) dbsnp_to_ids.py <dbsnp_matches.xml>
Counts all matches of rsids in <dbsnp_matches.xml> where the
submitter was either 1000GENOMES or HUMANGENOME_JCVI (Craig Venter).
Prints a list of the most likely matches.
"""
from collections import defaultdict
import operator
import sys
import xml.etree.cElemen... |
#!/usr/bin/env python
from __future__ import print_function, division
import bayesloop as bl
import numpy as np
class TestBuiltin:
def test_static(self):
S = bl.Study()
S.loadData(np.array([1, 2, 3, 4, 5]))
L = bl.om.Poisson('rate', bl.oint(0, 6, 100))
T = bl.tm.Static()
... |
from unittest import TestCase
from infection_monkey.system_info.windows_cred_collector.pypykatz_handler import (
_get_creds_from_pypykatz_session,
)
class TestPypykatzHandler(TestCase):
# Made up credentials, but structure of dict should be roughly the same
PYPYKATZ_SESSION = {
"authentication_id... |
#!/usr/bin/env python
"""
This module contains the Python 3 replacement for :mod:`csv`.
"""
import csv
import six
from agate.exceptions import FieldSizeLimitError
POSSIBLE_DELIMITERS = [',', '\t', ';', ' ', ':', '|']
class Reader(six.Iterator):
"""
A wrapper around Python 3's builtin :func:`csv.reader`.
... |
# -*- 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... |
import usb.core
import usb.util
from time import sleep
dev = usb.core.find(idVendor=0x046d, idProduct=0xc218)
if dev is None:
raise ValueError('Device not found')
interface = 0
endpoint = dev[0][(0,0)][0]
if dev.is_kernel_driver_active(interface) is True:
dev.detach_kernel_driver(interface)
usb.util.claim_inter... |
# (C) Copyright 2016-2017 Hewlett Packard Enterprise Development LP
#
# 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... |
# -*- coding: utf-8 -*-
'''
Created on 18 Νοε 2012
@author: tedlaz
'''
from PyQt4 import QtGui, QtCore
from gui import ui_fmy
from utils.fmy_etoys import makeFMYFile
class dlg(QtGui.QDialog):
def __init__(self, args=None, parent=None):
super(dlg, self).__init__(parent)
sel... |
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# 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.
#
# ... |
################################################################################
#
# RMG - Reaction Mechanism Generator
#
# Copyright (c) 2002-2017 Prof. William H. Green (whgreen@mit.edu),
# Prof. Richard H. West (r.west@neu.edu) and the RMG Team (rmg_dev@mit.edu)
#
# Permission is hereby granted, free of cha... |
import pytest
from sklearn.linear_model import LinearRegression as LR
from sklearn.linear_model import Ridge
from numpy import allclose, r_, asarray, newaxis, hstack
from numpy.random import randn
from thunder.series import fromarray
from regression import LinearRegression, FastLinearRegression, CustomRegression
pyt... |
#!/usr/bin/env python
from __future__ import with_statement
import sys
from distutils.core import setup, Extension, Command
from distutils.command.build_ext import build_ext
from distutils.errors import CCompilerError, DistutilsExecError, \
DistutilsPlatformError
IS_PYPY = hasattr(sys, 'pypy_translation_info')
VE... |
# Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
def prime_at(position):
""" returns the nth prime number
args:
position: the nth numbered prime
"""
primes_list = list(take(position, primes()))
return primes_list[-1]
def take(num, seq):
"""Generator takes num items from seq
Args:
num: number of items to take from list
... |
# -*- coding: utf-8 -*-
import minecraft.minecraft as minecraft
import minecraft.block as block
import time
from Tkinter import *
from Tkinter import StringVar
mc = minecraft.Minecraft.create()
pos = mc.player.getTilePos()
root = Tk()
def sayhi():
mc.postToChat('[Guest] Hi')
time.sleep(2)
def saybye():
... |
#!/usr/bin/env python
# Taiwanese Romanisation helper functions module
# - diacritic to numeric tone function
import json, re
# load diacritic tone to numeral mapping from data file
MappingDataFile = "Taiwanese-Romanisation-tones.json"
RawMappingData = json.load(open(MappingDataFile))
DiacriticToneMapping = RawMappin... |
#coding: utf-8
# Momentan in der Entwicklung befindliche Version!
import os
import random
import getpass
import time
import datetime
import sys
os.system('clear')
class oneTimePad(object):
def __init__(self):
NCF = noCryptoFunctions()
self.alphabet = NCF.alphabetGenerierung()
def steganoKrypto(self,klartext,ge... |
# -*- coding: utf-8 -*-
"""
The standard email backend is replaced by a custom
ModelBackend that supports getting the user based
on the stored hmac email value.
:subtitle:`Class definitions:`
"""
from django.contrib.auth.backends import ModelBackend
from apps.account.models import User
from django.contrib.auth.hashers... |
#coding=utf8
import ctypes
import lib
import const
import prototype
from pylibcurl.base import Base
### classes
class Multi(Base):
_pointer_type = ctypes.POINTER(const.CURLM)
_lib_init_func = lib.curl_multi_init
_lib_cleanup_func = lib.curl_multi_cleanup
def __init__(self, **kwargs):
self.... |
#!/usr/bin/env python
class Solution:
def __init__(self):
self.solution_dict = {}
self.n_set = set()
self.gcd = []
def pre_quit(self, in_n, in_b, up_bound):
if in_n < 0 or in_b < 0:
return True, -1 # impossible
if in_n == 0:
return True, ... |
# Copyright (C) 2003-2007 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko 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.1 of the License,... |
#
# @BEGIN LICENSE
#
# ambit: ambit: C++ library for the implementation of tensor product calculations
# through a clean, concise user interface.
#
# Copyright (c) 2014-2017 Ambit developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of a... |
from sys import float_info as sfi
def square_root (n):
'''Square root calculated using Netwton's method
'''
x = n/2.0
while True:
y = (x + n/x)/2
# As equality in floating numbers can be elusive,
# we check if the numbers are close to each other.
if abs(y-x) < sfi.epsil... |
import twitter
import yaml
import time
import pickle
import re
global match, api, msg, oldID
import random
msg = ''
#RegEx for parsing twitter handle from retrived
keyword = '';
#UTF_CHARS = ur'a-z0-9_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff'
#TAG_EXP = ur'(^|[^0-9A-Z&/]+)(#|\uff03)([0-9A-Z_]*[A-Z_]+[%s]*)' % UTF_CHARS... |
# GetJams - get some new jams for ya mental
# Released for Github on Oct 21 2014
import musicbrainzngs as jams
import random,sys,os,wx
jams.set_useragent("GetJams","1.0","inhumanundead@gmail.com")
def GetArtist(genre):
x = jams.search_artists(tag=genre)['artist-list']
y = []
y.append(x[random.randint(0,len(x)-1)]['s... |
# Copyright 2014 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.
from gpu_tests import cloud_storage_test_base
from gpu_tests import gpu_rasterization_expectations
import page_sets
from telemetry.page import page_test
fro... |
# Lint as: python3
# Copyright 2019 DeepMind Technologies Limited.
#
# 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... |
# ########################## Copyrights and License #############################
# #
# Copyright 2016 Yang Fang <yangfangscu@gmail.com> #
# ... |
#!/usr/bin/python
# Copyright 2012 Robie Basak
#
# 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, modify, merge, p... |
import unittest
import os
from ConfigParser import SafeConfigParser
from calabar.tunnels.vpnc import VpncTunnel
from calabar.tunnels import TunnelTypeDoesNotMatch
class TestDefaultTunnelConf(unittest.TestCase):
def setUp(self):
self.t = VpncTunnel(conf_file=None)
def test_cmd_builder(self):
"... |
'''
This module provides a quiver function which allows for error ellipses.
'''
import numpy as np
from matplotlib.quiver import Quiver as _Quiver
from matplotlib.collections import EllipseCollection
from matplotlib.backends import pylab_setup
from matplotlib.pyplot import sci
from matplotlib.pyplot import gca
from sc... |
# -*- coding: utf-8 -*-
from collections import defaultdict
import mock
from requests import Request
from searx.engines import wolframalpha_api
from searx.testing import SearxTestCase
class TestWolframAlphaAPIEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dicto = defaultdict(... |
import logging
import yaml
from typing import Dict
from labots.config import checker
from labots.common import meta
# Initialize logging
logger = logging.getLogger(__name__)
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__ = ... |
import re
WHITE_RGBA = (255, 255, 255)
BLACK_RGBA = (0, 0, 0)
def _get_size(size):
for m in _SIZE_RE:
match = m[0].match(size)
if match:
return m[1](match.groupdict())
raise ValueError('Invalid size')
def _get_RGBA(opt, index):
if len(opt) > index + 6:
return tuple(i... |
# Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
import sys
import logging
import os
from django.db import models
from django.conf import settings
from awx.main.utils.filters import SmartFilter
from awx.main.utils.pglock import advisory_lock
___all__ = ['HostManager', 'InstanceManager', 'InstanceGroupManag... |
import pygame
import math
import os
class Skybox:
def __init__(self, screen, color):
self.screen = screen
self.ratio = self.screen.get_size()[1] - 35
self.difference_y = self.screen.get_size()[1] - self.ratio
self.width = self.screen.get_size()[0]
self.height = self.screen.... |
# Copyright (C) 2014 GRNET S.A.
#
# 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 is distributed in the... |
from setuptools import find_packages
from setuptools import setup
package_name = 'ament_clang_format'
setup(
name=package_name,
version='0.11.2',
packages=find_packages(exclude=['test']),
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packag... |
# Copyright 2014-2015 Red Hat, Inc.
#
# 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... |
from .default import *
DEBUG = False
# region apps
INSTALLED_APPS = (
# Django PRE
'flat_responsive', # Mobile support for flat theme
'flat', # Admin flat theme
'colorfield', # colorpicker field for admin
# Django
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.con... |
# 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 ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from torchvision.models.resnet import BasicBlock, ResNet, model_urls
import math
class FaceModel(nn.Module):
def __init__(self,num_classes, pretrained=False, **kwargs):
super(FaceModel, self).__init... |
import os
import sys
# Open File
filename = ""
filename = input("Enter Input Filename: ")
if filename == "":
filename = "linkin.txt"
fin = open(filename, "r")
fout = open("out.txt", "w")
# Variable Prepare
PGBLOCKS = {}
MODIFY = []
OBJCODE = []
# Method Prepare
def splitline(line):
word = line.strip().split... |
# 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 ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
#!/usr/bin/env python
# Setup script for oBB.
from setuptools import setup
#from numpy.distutils.core import setup, Extension
from sys import version_info, exit
# Make sure the correct version of Python is installed.
if (version_info[:2] < (2,6))or(version_info[0] == 3):
print "oBB requires Python 2.6 to 2.7. Pyth... |
import itertools
import os
import re
# Isotopic abundances from Meija J, Coplen T B, et al, "Isotopic compositions
# of the elements 2013 (IUPAC Technical Report)", Pure. Appl. Chem. 88 (3),
# pp. 293-306 (2013). The "representative isotopic abundance" values from
# column 9 are used except where an interval is given... |
# -*- encoding: utf-8 -*-
from __future__ import print_function
from functools import partial
import os
import unittest
from autosklearn.util import set_auto_seed, get_auto_seed, del_auto_seed, \
check_pid
class TestUtilsCommon(unittest.TestCase):
_multiprocess_can_split_ = True
def setUp(self):
... |
#!/usr/bin/env python
import argparse
import os
import sys
import subprocess
def check_file(filename, excludes, extensions):
"""
Check if a file should be included in our check
"""
name, ext = os.path.splitext(filename)
if len(ext) > 0 and ext in extensions:
if len(excludes) == 0:
... |
import cv2
import datetime as dt
import time
import imutils
import multiprocessing
class videocam(object):
firstFrame = None
def __init__(self, rec_src, rec_type, rec_int, rec_path, alarm_text):
self.rec_src = rec_src
self.rec_type = rec_type
self.rec_int = rec_int
self.rec_pa... |
from StringIO import StringIO
import sys, os
import numpy as np
os.environ["CC"] = "gcc-4.9"
os.environ["CXX"] = "g++-4.9"
debug = False
n_max = False
if len(sys.argv) > 1: n_max = int(sys.argv[1])
input = sys.stdin
pmf_filename = input.readline().strip() # stores pmf
rho_filename = input.readline().strip() # stores... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.