src stringlengths 721 1.04M |
|---|
from __future__ import absolute_import
from __future__ import print_function
from typing import Optional, Any
import sys
import unittest
try:
from tools.lib.template_parser import (
TemplateParserException,
is_django_block_tag,
tokenize,
validate,
)
except ImportError:
pri... |
#!/usr/bin/env python3
#
# Tests the basic methods of the CMAES optimiser.
#
# This file is part of PINTS.
# Copyright (c) 2017-2018, University of Oxford.
# For licensing information, see the LICENSE file distributed with the PINTS
# software package.
#
import unittest
import numpy as np
import pints
import pints.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
#
# Copyright (c) 2008-2014 University of Dundee.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# Licens... |
import chimera
import unittest
from os import path
import xlinkanalyzer
from xlinkanalyzer import gui
RUNME = False
description = "Base classes for testing gui"
class XlaBaseTest(unittest.TestCase):
def setUp(self, mPaths, cPath):
mPath = xlinkanalyzer.__path__[0]
xlaTestPath = path.join(path... |
#******************************************************************************
# *
# * ** * * * * *
# * * * * * * * * * *
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010 - Luca Invernizzi <invernizzi.l@gmail.com>
# 2012 - Izidor Matušov <izidor.matusov@gmail.com>
#
# 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
# Fou... |
input = """
% Date: Wed, 15 Jul 1998 15:11:06 -0500 (CDT)
% From: Esra Erdem <esra@cs.utexas.edu>
% To: Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>
% Subject: Re: experimentation
up(L,T1) :- latch(L), next(T,T1), up(L,T), not nup(L,T1).
nup(L,T1) :- latch(L), next(T,T1), nup(L,T), not up(L,T1).
open(T1) :- nex... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
from scannerpy import Database, DeviceType, Job
from scannerpy.stdlib import NetDescriptor
import numpy as np
import cv2
import struct
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')
import util
video_path = util.download_video() if len(sys.argv) <= 1 else sys.argv[1]
print('Pe... |
#!/usr/bin/env python
from __future__ import absolute_import
from setuptools.extension import Extension
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
import os
import io
import re
#import numpy
here = os.path.abspath(os.... |
#!/usr/bin/env python
##parse_codeml_pairwise_output.py
##written 6/26/14 by Groves Dixon
ProgramName = 'parse_codeml_pairwise_output.py'
LastUpdated = '6/26/14'
By = 'Groves Dixon'
VersionNumber = '1.0'
print "\nRunning Program {}...".format(ProgramName)
VersionString = '{} version {} Last Updated {} by {}'.format(Pr... |
"""
Copyright (C) 2016 Hector Sanjuan
This file is part of "dccpi".
"dccpi" 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... |
class Solution:
# @param matrix, a list of lists of 1 length string
# @return an integer
def maximalRectangle(self, matrix):
if not matrix: return 0
res = 0
line = [0] * len(matrix[0])
for i in matrix:
for j in range(len(matrix[0])):
if i[j] == '0'... |
import os
import pytest
import toml
from rest_framework.test import APIClient
from six import StringIO
from wurst.core.consts import StatusCategory
from wurst.core.models import IssueType, Priority, Project, Status
from wurst.core.utils.schema_import import SchemaImporter
BASIC_SCHEMA_PATH = os.path.join(
os.pat... |
# encoding: utf-8
"""
verify_student/start?course_id=MITx/6.002x/2013_Spring # create
/upload_face?course_id=MITx/6.002x/2013_Spring
/upload_photo_id
/confirm # mark_ready()
---> To Payment
"""
import json
import mock
import urllib
import decimal
from mock import patch, Mo... |
from collections import defaultdict
from warnings import warn
from tqdm import tqdm
from helpers.plots import bar_plot
from models import Plot, Site, Protein, DataError
from stats.plots import (
ptm_variability, proteins_variability, most_mutated_sites, active_driver, ptm_mutations,
gene_ontology, motifs, mim... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
""" Python version of transcoder.
Uses built-in library xml.etree.ElementTree,
rather than lxml.
Revised 02-20-2017 Regarding special handling of slp1 to deva;
search for regexCode variable, and fsmentry['regex'] for where this comes into play.
This ... |
import httpretty
from random import randint
from scraper.http import Http, COOK_COUNTY_JAIL_INMATE_DETAILS_URL, BAD_URL_NETWORK_PROBLEM
INMATE_URL = COOK_COUNTY_JAIL_INMATE_DETAILS_URL + '2014-0118034'
class Test_Http:
@httpretty.activate
def test_get_succeeds(self):
number_of_attempts = 2
... |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='NodeFinderGUI',
version='0.5.0',
description=('GUI Tool for node... |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class TaskChannelTestCase(Integ... |
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.exceptions import ObjectDoesNotExist
class Item(models.Model):
item_type = models.CharField(max_length=30, default="")
four_star = models.IntegerField(default=0)
three_star = mo... |
import sys
sys.path.append('../py')
from iroha import *
from iroha.iroha import *
d = IDesign()
mod = IModule(d, "mod")
tab1 = ITable(mod)
sreg = design_tool.CreateSharedReg(tab1, "o", 32)
wtab = ITable(mod)
w = design_tool.CreateSharedRegWriter(wtab, sreg)
wst1 = IState(wtab)
wst2 = IState(wtab)
wst3 = IState(wtab)... |
"""
Created by: Bryce Chung
Last modified: January 4, 2016
"""
import matplotlib.pyplot as plt
plt.ion()
global verbose
verbose = 3
class chartViz(object):
"""
This class is used to visualize chartData objects.
"""
def __init__(self):
self.data = {}
self.fig = None
... |
# -----------------------
# Game Test
# Using Scott Pilgrim
# By Puddim
# https://github.com/Puddim
# -----------------------
# IMPORT
import pygame
import os
import time
import random
import math
# ... |
#!/usr/bin/env python
'''
tag_generator.py
Copyright 2017 Long Qian
Contact: lqian8@jhu.edu
This script creates tags for your Jekyll blog hosted by Github page.
No plugins required.
'''
import glob
import os
import re
post_dir = '_posts/'
tag_dir = 'tag/'
filenames = glob.glob(post_dir + '*')
total_tags = []
for... |
"""
Test parsing of whole fortran files; 'blackbox' tests here.
"""
from fparser import api
import sys
from os.path import abspath, join, dirname
def test_use_module():
d = dirname(__file__)
sources = [join(d,'modfile.f95'), join(d,'funcfile.f95')]
file_to_parse = sources[1]
tree = api.parse(file_to_p... |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from django.template import loader
from .models import Question, Choice
from django.urls import reverse
from django.views import generic
from django.utils import timezone
from django.core.mail import EmailM... |
"""empty message
Revision ID: d8d1b418f41c
Revises: 7f5c9e993be1
Create Date: 2017-02-15 21:03:05.958000
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd8d1b418f41c'
down_revision = '7f5c9e993be1'
branch_labels = None
depends_on = None
def upgrade():
# ... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models imp... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
#!/usr/bin/env python3
############################################################################
# Copyright 2017 RIFT.IO Inc #
# #
# Licensed under the Apache License, Version 2.0 (the "License");... |
#!/usr/bin/env python
#
# Copyright (c) 2014 Coraid, Inc.
# All rights reserved.
#
# $Coraid$
#
"""
Interface to read, digest and display information regarding
AoE Targets and their corresponding system information.
"""
from os import stat, listdir, path
from stat import S_ISBLK
from pprint import pformat
import re
f... |
""" Handles database classes including search functions
"""
import re
import xml.etree.ElementTree as ET
import glob
import os.path
import io
import gzip
import requests
from .astroclasses import System, Binary, Star, Planet, Parameters, BinaryParameters, StarParameters, PlanetParameters
compactString = lambda strin... |
# pylint: disable=W0614,W0401,W0611
# flake8: noqa
import numpy as np
from pandas.core.algorithms import factorize, unique, value_counts
from pandas.core.dtypes.missing import isna, isnull, notna, notnull
from pandas.core.categorical import Categorical
from pandas.core.groupby import Grouper
from pandas.io.formats.f... |
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Functions for turning the Wikidata dump into Linked Data
import codecs
import glob
import gzip
import json
import math
import os
import sys
import time
import xml.etree.cElementTree as ET
import settings
def process_dump():
# Print some status info
print 'Proces... |
# Cheroke Admin: File Exists rule plug-in
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2009-2010 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free So... |
#
# Created by Aman LaChapelle on 3/23/17.
#
# pytorch-EMM
# Copyright (c) 2017 Aman LaChapelle
# Full license at pytorch-EMM/LICENSE.txt
#
import torch
import torch.nn as nn
import torch.nn.functional as Funct
from torch.autograd import Variable
import torch.optim as optim
import numpy as np
from Utils import num_fl... |
# Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
# reserved.
# Copyright (c) 2013 Intel Corporation. All rights reserved.
# Use of this source code is governed by a BSD-style license that
# can be found in the LICENSE file.
from optparse import OptionParser
import os
import sys
from patch_util ... |
from unittest import mock
from flask import g
from sqlalchemy import and_
from werkzeug.exceptions import NotFound
from mod_auth.models import Role
from mod_customized.models import CustomizedTest
from mod_regression.models import (Category, InputType, OutputType,
RegressionTest, Re... |
import difflib
import functools
import math
import numbers
import os
import warnings
import numpy as np
from tlz import frequencies, concat
from .core import Array
from ..highlevelgraph import HighLevelGraph
from ..utils import has_keyword, ignoring, is_arraylike
try:
AxisError = np.AxisError
except AttributeErr... |
#!/usr/bin/env python
# Description = Visualizes different output data from APRICOT analysis
from collections import defaultdict
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import sys
try:
import subprocess
except ImportError:
print('Python package subprocess is missing. ... |
import urllib.request
from bs4 import BeautifulSoup
import re
import urllib.parse
import xlsxwriter
import pandas as pd
import numpy as np
from urllib import request, parse
from urllib.error import URLError
import json
import multiprocessing
import time
# 详情页面的 地址 存放在这里面
urls_of_detail = []
total_pages = 0
# 要爬取的内容 ... |
from .View import *
import os
from ..Scene.GameScene import GameScene
from tkinter.filedialog import askopenfilename
class SelectScreenView(View):
def onInit(self):
self.red = gameapi.Color(255,0,0)
self.fileSelected = False
self.background = self.resizeImage(gameapi.image.load(os.path.joi... |
# We only import librairies needed for plotting
# Other librairies are imported in the class definition file, G3D_class.py,
# which contains all process and variables function definition.
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import datetime as dt
imp... |
import numpy as np
from . import utils
def c2e(cubemap, h, w, mode='bilinear', cube_format='dice'):
if mode == 'bilinear':
order = 1
elif mode == 'nearest':
order = 0
else:
raise NotImplementedError('unknown mode')
if cube_format == 'horizon':
pass
elif cube_forma... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... |
from __future__ import unicode_literals
from prompt_toolkit.utils import get_cwidth
__all__ = (
'token_list_len',
'token_list_width',
'token_list_to_text',
'explode_tokens',
'find_window_for_buffer_name',
)
def token_list_len(tokenlist):
"""
Return the amount of characters in this token ... |
"""
Dirsync options list
"""
import os
import sys
from argparse import ArgumentParser
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
try:
from ConfigParser import ConfigParser # python 2
except ImportError:
from configparser import Co... |
#Copyright (C) 2013 by Ngan Nguyen
#
#Released under the MIT license, see LICENSE.txt
'''
Object represents a TCR repertoire sample
'''
import os
import random
import copy
import time
import gzip
import cPickle as pickle
from jobTree.scriptTree.target import Target
from sonLib.bioio import system
from sonLib.bioio i... |
# -*- coding: utf8 -*-
import json
from datetime import date, datetime
import pytz
from django.conf import settings
from django.db import models
from django.db.models.query import QuerySet
from django.utils.timezone import make_aware
class JsonHelper(json.JSONEncoder):
def default(self, obj):
if isinsta... |
#!/usr/bin/env python
"""
Purpose : Extract next sequence number of auto-scaled instance and set new tag to self instance. Script will be running from new instance.
will take input from command line instead of from json file
Future Plan :
will associate instance to a role based IAM profile
Usage :
python ec2-autoscale-... |
# Copyright 2016 Ebay 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 writing, soft... |
from django import forms
from django.conf import settings
from markymark.renderer import initialize_renderer
class MarkdownTextarea(forms.Textarea):
"""
Extended forms Textarea which enables the javascript markdown editor.
"""
def __init__(self, *args, **kwargs):
"""
Sets the require... |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# Copyright (c) 2008-2021 pyglet contributors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follo... |
import os
import GlobalVars
def LoadFunction(path, loadAs=''):
loadType = 'l'
name = path
src = __import__('PythonFunctions.' + name, globals(), locals(), [])
if loadAs != '':
name = loadAs
if name in GlobalVars.functions:
loadType = 'rel'
reload(src)
components = name.spli... |
import asyncio
import json
import signal
import sys
import time
from asyncio.tasks import FIRST_COMPLETED
from config import Config
from pxgrid import PxgridControl
from websockets import ConnectionClosed
from ws_stomp import WebSocketStomp
async def future_read_message(ws, future):
try:
message = await ... |
from DistributedMinigameAI import *
from direct.fsm import ClassicFSM, State
from direct.fsm import State
import VineGameGlobals
class DistributedVineGameAI(DistributedMinigameAI):
def __init__(self, air, minigameId):
try:
self.DistributedVineGameAI_initialized
except:
self... |
#! /usr/bin/env python3.6
# -*- coding: utf-8 -*-
# This file was never intended for use in a production based program
# It is a collection of functions/classes to use in an interpreter such as iPython
#
# Some modules such as aiohttp have C implementations not under GPL
# Anything which is GPL compatible assumes GPL ... |
# import nltk
# from nltk.corpus import wordnet as wn
import pandas as pd
import string
import random
titles = [
'Analysis: What Xbox One Scorpio means for the future of the console wars',
'Ancient Humans Didn not Turn to Cannibalism For the Calories',
'Twitter co-founder Ev Williams is selling 30 percent of his stoc... |
from german_dictionary.db_handler import DatabaseHandler, DatabaseError
from german_dictionary.noun import Noun
from german_dictionary.verb import Verb
from german_dictionary.adjective import Adjective
from german_dictionary.trie import Trie
import sys
class Dictionary:
def __init__(self, database, trie=False):
... |
#!/usr/bin/env python3
import subprocess
import pytest
import os
import stat
import time
from os.path import join as pjoin
basename = pjoin(os.path.dirname(__file__), '..')
def wait_for_mount(mount_process, mnt_dir,
test_fn=os.path.ismount):
elapsed = 0
while elapsed < 30:
if test_f... |
""" Making inferences about driver.
This module supports:
1. Predict nMut
2. Burden test
3. Functional adjusted test
"""
import logging
import sys
import os
import numpy as np
from scipy.stats import binom_test, nbinom
from driverpower.dataIO import read_model, read_feature, read_response, read_fs
from driverpower.d... |
#!/usr/bin/python
import sys
from PyQt4 import QtCore, QtGui
from ui_mainview import Ui_MainWindow
import json
from jsonreader import JsonReader
##################################################
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, pare... |
import sqlalchemy
from raggregate.queries import users
from raggregate.queries import submission
from raggregate.queries import epistle as epistle_queries
from raggregate.queries import general
from pyramid.response import Response
from pyramid.view import view_config
from raggregate.models import DBSession
from ragg... |
from __future__ import unicode_literals
from django.db import models
from django.contrib.postgres import fields
from datetime import datetime
from croniter import croniter
from .constants import TRANSFORMATION_TYPES, PARAMETER_TYPES, COLUMN_TYPES
import json
class CustomJSONField(models.TextField):
def from_db... |
# -*- coding: utf-8 -*-
import json
import resources.lib.utils as utils
from resources.lib import globalvar
title = ['La 1ère', 'France 2', 'France 3', 'France 4', 'France 5', 'France Ô']
img = ['la_1ere', 'france2', 'france3', 'france4', 'france5', 'franceo']
readyForUse = True
channelCatalog = 'http://pluzz.webserv... |
import master.taskmgr
from concurrent import futures
import grpc
from protos.rpc_pb2 import *
from protos.rpc_pb2_grpc import *
import threading, json, time, random
from utils import env
class SimulatedNodeMgr():
def get_batch_nodeips(self):
return ['0.0.0.0']
class SimulatedMonitorFetcher():
def __init__(self,... |
from django.shortcuts import render
from .models import Image, FileCategory
from .forms import ImageForm
from django.views.generic import CreateView, DeleteView, UpdateView, ListView, View
from django.shortcuts import redirect, get_object_or_404
from django.http import HttpResponseRedirect, HttpResponse
from django.con... |
"""General storage engine utilities."""
import json
import logging
import functools
import collections.abc
from jacquard.plugin import plug
from jacquard.storage.exceptions import Retry
def retrying(fn):
"""Decorator: reissues the function if it raises Retry."""
logger = logging.getLogger("jacquard.storage.... |
#-
# 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... |
# Copyright 2013 OpenStack Foundation
#
# 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... |
# Copyright 2013 IBM Corporation.
# 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... |
# -*- coding: utf-8 -*-
"""
Various utilities useful for converting one Bitcoin format to another, including some
the human-transcribable format hashed_base58.
The MIT License (MIT)
Copyright (c) 2013 by Richard Kiss
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and a... |
# Copyright 2020 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Resource information of Alignak daemons
"""
def get_name(friendly=False):
"""Get name of this resource
:return: name of this resource
:rtype: str
"""
if friendly: # pragma: no cover
return 'Alignak daemons live state'
return 'alignakd... |
"""
Experiment to try to split it up in mixin classes
"""
import abc
class BaseNodeAbstract(object):
def __init__(self, *args, **kwargs):
super(BaseNodeAbstract, self).__init__(*args, **kwargs)
self._push_requested = False
__metaclass__ = abc.ABCMeta
def _process(self):
"""
... |
"""Camera properties"""
import os.path
import json
# TODO: don't allow updating of properties that don't exist in the
# default self.props set in __init__
from . exceptions import CameraPropertiesError
PATH = os.path.split(os.path.abspath(__file__))[0]
class CameraProperties(object):
"""Class used for... |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import (unicode_literals, division, absolute_import,
print_function)
import regex
from collections import deque
REGEX_FLAGS = regex.VERSION1 | regex.WORD | re... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
# //// / // : : --- (,------... |
# ----------------------------------------------
# Script Written by Jason W. Sidabras (jason.sidabras@cec.mpg.de)
# requires jsidabras/hycohanz as of 20-04-2017
# Loads a file with a list of 1s and 0s and implements it to HFSS as Silv/Vac
# used to load the best results per generation or final
# ----------------... |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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, publish... |
"""
Test that psuedo-binaries like image/svg+xml get treated
fairly and not wikified.
"""
from tiddlyweb.serializer import Serializer
from tiddlyweb.model.tiddler import Tiddler
from tiddlyweb.config import config
import tiddlywebwiki
def setup_module(module):
tiddlywebwiki.init(config)
module.serializer = Se... |
# -*- coding: utf-8 -*-
"""
Backend discover
================
"""
import os
from collections import OrderedDict
from ..exceptions import SettingsDiscoveryError
class Discover:
"""
Should be able to find a settings file without any specific backend given,
just a directory path (the base dir) is required.... |
# coding=utf-8
# Copyright 2015 The TensorFlow 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 requ... |
import numpy as np
import itertools
from collections import namedtuple, defaultdict
import math
from math import floor, ceil, radians, sin, cos, asin, sqrt, pi
import pandas as pd
from src.utils.geo import bb_center, GeoCoord, haversine
LocEstimate = namedtuple('LocEstimate', ['geo_coord', 'dispersion', 'dispersion_st... |
# Copyright 2019 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, ... |
import json
def import_json(path):
"""Decodes and returns the JSON object in the file at the specified path.
Args:
path (str): The path of the file to read.
"""
with open(path) as data_file:
return json.load(data_file)
# Import all files.
results_v = import_json('resul... |
"""Parameters of the IOCs of the AP discipline."""
from copy import deepcopy as _dcopy
_off = 0
_on = 1
def get_dict():
"""Return configuration type dictionary."""
module_name = __name__.split('.')[-1]
_dict = {
'config_type_name': module_name,
'value': _dcopy(_template_dict),
'ch... |
from scrapy.selector import HtmlXPathSelector
from scrapy.spider import Spider
import html2text
import re
import os.path
class scrape(Spider):
name = "googleBot2"
start_urls = []
with open('/home/ashish/Desktop/CloakingDetectionTool/url.txt','r') as f:
for line in f:
l=line.replac... |
# Authors:
# Rob Crittenden <rcritten@redhat.com>
#
# Copyright (C) 2010 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either... |
#!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# 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 us... |
"""
Django settings for thehichannel project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ..... |
# -*- coding: utf-8 -*-
"""
A series of tests to establish that the command-line managment tools work as
advertised - especially with regards to the handling of the DJANGO_SETTINGS_MODULE
and default settings.py files.
"""
from __future__ import unicode_literals
import codecs
import os
import re
import shutil
import s... |
#
import os
import ROOT
from ROOT import *
from array import array
import math
from math import *
import sys
import pdb
def ComputeDDT(name, point, nPtBins, nRhoBins, H):
DDT = TH2F(name, "", nRhoBins, 50, 250 , nPtBins, 380, 1000)
DDT.SetStats(0)
nXb = H.GetXaxis().GetNbins()
nYb = H.GetYaxis().GetNbins()
for x ... |
import tensorflow as tf
from tensorflow.contrib import rnn
import numpy as np
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"]="2"
class AttentionLayer():
"""Implements Context-to-Query Attention. Pays attention to different parts of the query when
reading the passage. Returns, for each word in the passage, a... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import urllib
import urllib2
import sys
import simplejson as json
from StringIO import StringIO
import gzip
from HTMLParser import HTMLParser
htmlParser = HTMLParser()
LRT_URL = 'http://www.lrt.lt/'
VIDEOS_COUNT_PER_PAGE = 100
LATEST_NEWS_URL = LRT_URL + 'data-s... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... |
import json
import urllib
import requests
import itertools
import time
class FreebaseUtil(object):
freebase_topic_url="https://www.googleapis.com/freebase/v1/topic{}?filter=/common/topic/description&key={}"
service_url = 'https://www.googleapis.com/freebase/v1/mqlread'
aliases=[]
def __init__(self,f... |
from datetime import date, timedelta
from django.contrib import admin
from django.test import TestCase
from .admin import CorporateMemberAdmin, StatusFilter
from .models import CorporateMember
class CorporateMemberAdminTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.member = CorporateMemb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.