code stringlengths 1 199k |
|---|
"""
F-Droid (a repository of FOSS applications for Android)
@website https://f-droid.org/
@provide-api no
@using-api no
@results HTML
@stable no (HTML can change)
@parse url, title, content
"""
from cgi import escape
from urllib import urlencode
from searx.engines.xpath import extract_... |
"""
Common test utilities for courseware functionality
"""
from abc import ABCMeta, abstractmethod
from datetime import datetime
import ddt
from mock import patch
from urllib import urlencode
from lms.djangoapps.courseware.field_overrides import OverrideModulestoreFieldData
from lms.djangoapps.courseware.url_helpers im... |
from distutils.core import setup
import versioneer
versioneer.versionfile_build='malaprop/_version.py'
versioneer.versionfile_source='malaprop/_version.py'
versioneer.tag_prefix = 'malaprop-'
versioneer.parentdir_prefix = 'malaprop-'
setup(name='malaprop',
description='Tools for NLP evaluation using the adversari... |
from __future__ import absolute_import, print_function, unicode_literals, division
class ParkingPlaces(object):
def __init__(
self,
available=None,
occupied=None,
available_PRM=None,
occupied_PRM=None,
total_places=None,
available_ridesharing=None,
occ... |
from parsec import joint
from parsing import *
AntennaConfiguration = field('Deployment Disabled', boolean)
AntennaConfiguration >>= label_as('Antenna Configuration') |
"""Test notification behaviour for cross-distro package syncs."""
__metaclass__ = type
import os.path
from zope.component import getUtility
from lp.archiveuploader.nascentupload import (
NascentUpload,
UploadError,
)
from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.services.log.logg... |
app_name = "erpnext"
app_title = "ERPNext"
app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors"
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
app_icon = "icon-th"
app_color = "#e74c3c"
app_version = "4.9.2"
error_report_email = "support@erpnext.com"
app... |
{
'name': 'Advanced Events',
'category': 'Marketing',
'summary': 'Sponsors, Tracks, Agenda, Event News',
'version': '1.0',
'description': "",
'depends': ['website_event'],
'data': [
'security/ir.model.access.csv',
'security/event_track_security.xml',
'data/event_data.... |
from __future__ import absolute_import, print_function, division
from datetime import date
import unittest
from pony.orm.core import *
from pony.orm.core import Attribute
from pony.orm.tests.testutils import *
class TestAttribute(unittest.TestCase):
@raises_exception(TypeError, "Attribute Entity1.id has unknown opt... |
from .validate_for_publish import validate_for_publish, ValidationError
from nose.tools import assert_raises
from test_factory import SuperdeskTestCase
class ValidateForPublishTests(SuperdeskTestCase):
validator = {'_id': 'publish_text',
'act': 'publish',
'type': 'text',
... |
import os
import json as json_mod
try:
from mock import patch
except ImportError: # nocv
from unittest.mock import patch
from django.test import TestCase
from django.conf import settings
from django.core.validators import ValidationError
from requests import Response
from vstutils.utils import raise_context
fr... |
from __future__ import print_function
VERSION = "3.2"
from setuptools import setup, find_packages
import os
import sys
package_directory = os.path.realpath(os.path.dirname(__file__))
def get_file_contents(file_path):
"""Get the context of the file using full path name."""
content = ""
try:
full_path... |
import unittest
import requests
import base64
import json
import os
import io
import re
import zipfile
from hashlib import sha256
from email.mime.application import MIMEApplication
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header
class TestModules(unitt... |
from django.contrib import admin
from django.db import models
from django.contrib.auth.models import User
from pagedown.widgets import AdminPagedownWidget
from .models import Place, Award, MetaAward, MetaEvent, Diffusion
class AwardAdmin(admin.ModelAdmin):
list_display = ('get_year', 'get_award', 'get_artwork')
... |
"""
General formatting and rendering helpers for digest notifications.
"""
from contextlib import contextmanager
import logging
import struct
from django.conf import settings
from django.template.loader import get_template
from django.template import Context
from django.utils.html import strip_tags
from django.utils.tr... |
"""Support for the lp.registry.javascript.milestoneoverlay YUIXHR tests.
"""
__metaclass__ = type
__all__ = []
from lp.services.webapp.publisher import canonical_url
from lp.testing import person_logged_in
from lp.testing.factory import LaunchpadObjectFactory
from lp.testing.yuixhr import (
login_as_person,
mak... |
import re
import sys
from collections import defaultdict
from operator import itemgetter
from threading import RLock
from searx.engines import engines
from searx.url_utils import urlparse, unquote
if sys.version_info[0] == 3:
basestring = str
CONTENT_LEN_IGNORED_CHARS_REGEX = re.compile(r'[,;:!?\./\\\\ ()-_]', re.M... |
from django.db import migrations
from django.db.models import Count
def deduplicate_other_names(apps, schema_editor):
OtherName = apps.get_model("popolo", "OtherName")
people_with_duplicate_names = (
OtherName.objects.all()
.values("name", "object_id")
.annotate(count=Count("object_id"))... |
from __future__ import annotations
from typing import Optional, Tuple
import urllib.parse
from baseframe import _
from . import db
__all__ = ['VideoMixin', 'VideoError', 'parse_video_url']
class VideoError(Exception):
"""A video could not be processed (base exception)."""
def parse_video_url(video_url: str) -> Tupl... |
{
'name': 'MOZAIK: Chart of account',
'version': '1.0',
"author": "ACSONE SA/NV",
"maintainer": "ACSONE SA/NV",
"website": "http://www.acsone.eu",
'category': 'Localization/Account Charts',
'depends': [
'mozaik_retrocession',
'mozaik_membership',
],
'description': """... |
"""
Provides full versioning CRUD and representation for collections of xblocks (e.g., courses, modules, etc).
Representation:
* course_index: a dictionary:
** '_id': a unique id which cannot change,
** 'org': the org's id. Only used for searching not identity,
** 'course': the course's catalog number
*... |
from django.db import models
from django.urls.base import reverse
from django.utils.html import format_html
class ServerMOTD(models.Model):
class Meta:
ordering = ['display_order']
title = models.TextField()
html_content = models.TextField()
display_order = models.SmallIntegerField()
draft =... |
import math
from shinken.util import safe_print
from shinken.misc.perfdata import PerfDatas
def get_perfometer_table_values(elt):
# first try to get the command name called
cmd = elt.check_command.call.split('!')[0]
print "Looking for perfometer value for command", cmd
tab = {'check_http' : manage_check... |
from tools.translate import _
def digits_only(cc_in):
"""Discards non-numeric chars"""
cc = ""
for i in cc_in or '':
try:
int(i)
cc += i
except ValueError:
pass
return cc
def to_ascii(text):
"""Converts special characters such as those with accents... |
import json
import scrapy
from feeds.loaders import FeedEntryItemLoader
from feeds.spiders import FeedsSpider
class Oe1OrfAtSpider(FeedsSpider):
name = "oe1.orf.at"
start_urls = ["https://audioapi.orf.at/oe1/api/json/current/broadcasts"]
feed_title = "oe1.ORF.at"
feed_subtitle = "Ö1 Webradio"
feed_l... |
import json
import os
from locust import task, TaskSet
BASIC_AUTH_CREDENTIALS = None
if 'BASIC_AUTH_USER' in os.environ and 'BASIC_AUTH_PASSWORD' in os.environ:
BASIC_AUTH_CREDENTIALS = (
os.environ['BASIC_AUTH_USER'],
os.environ['BASIC_AUTH_PASSWORD']
)
class AutoAuthTasks(TaskSet):
"""
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import zoneinfo
from datetime import timedelta
from urllib.parse import quote
import mock
from django.test import override_settings
from django.urls import reverse
from django.utils import timezone
from dash.categories.models... |
import getopt, sys, json, zmq
def usage():
print
print
print "-h, --help : outputs help and quits"
print "-a <airline_code> : Code of the owner airline"
print "-f <flight_number> : Number of the flight to display"
print "-d <departure_date> : Departure date of the... |
"""@package Tools
This python script is responsible for precision generation replacements
as well as replacements of any kind in other files. Different types of
replacements can be defined such that no two sets can conflict. Multiple
types of replacements can, however, be specified for the same file.
@author Wesley A... |
import numpy as np
data = np.genfromtxt('test_data.txt')
data[:,0] /= 1000.0 #change from nm to um
data[:,1:] *= 1.0e9 #change from 1/nm^3 to 1/um^3 (*1.0e9)
f = open('new_data.txt','w')
for i in range(data.shape[0]):
for j in range(data.shape[1]):
f.write(" %.6e" %data[i,j])
f.write("\n")
f.close() |
__all__ = (
"IBUS_IFACE_IBUS",
"IBUS_SERVICE_IBUS",
"IBUS_PATH_IBUS",
"IBUS_IFACE_CONFIG",
"IBUS_IFACE_PANEL",
"IBUS_IFACE_ENGINE",
"IBUS_IFACE_ENGINE_FACTORY",
"IBUS_IFACE_INPUT_CONTEXT",
"IBUS_IFACE_NOTIFICATIONS",
"ORIENTATION_HORIZONTAL... |
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
gg = salome.ImportComponentGUI("GEOM")
p1 = geompy.MakeVertex(35, 40, 45)
p2 = geompy.MakeVertex(35, 45, 70)
v = geompy.MakeVector(p1, p2)
torus1 = geompy.MakeTorus(p1, v, 20, 10)
torus2 = geompy.... |
import sys
import re
import subprocess
__leak_regex__ = re.compile("Memory Leak:\s+(?P<caller>0x[A-Fa-f0-9]+):size=(?P<size>\d+)")
__track_regex__ = re.compile("pointer=0x[a-fA-F0-9]+\s+size=(?P<size>\d+)\s+location=[(](?P<caller>0x[a-fA-F0-9]+)[)]")
__track2_regex__ = re.compile("pointer=0x[a-fA-F0-9]+\s+size=(?P<size... |
class Table(object):
def config_db(self, pkg):
tbl = pkg.table('ticket', name_short='!!Ticket', name_long='!!Ticket',
name_plural='!!Tickets',pkey='id',rowcaption='subject')
tbl.column('id',size='22',group='_',readOnly='y',name_long='!!Id')
self.sysFields(tbl, id=F... |
import platform
import os.path
import re
def Check(context, version):
context.Message('Checking for TBB version >= %s.0... ' % (version))
ret = context.TryLink("""
int main()
{
return 0;
}
""" % int (version), '.cpp')
context.Result(ret)
return ret
def MakeOptions (opts):
arch = platform.uname()[0]
if arch ... |
""" The agent bundle, contains all metric classes and agent running code """
from optparse import OptionParser
import base64
import logging
import os
import glob
import re
import socket
import subprocess
import sys
import time
from threading import Thread
import traceback
import signal
import ConfigParser
import comman... |
'''
Utilities to pose 3D meshes and manipulate their bones.
'''
__all__ = ('BoneView', 'Bone', 'Constraints')
import math
import logging
import numpy as np
from pyrtist.lib2d import Point, Tri
from . import Matrix3, Point3
class BoneView(object):
def __init__(self, transform_matrix=None, proj_matrix=None,
... |
'''
Created on 10 Sep 2016
@author: sugesh
'''
__author__ = "Sugesh Chandran"
__copyright__ = "Copyright (C) The neoview team."
__license__ = "GNU Lesser General Public License"
__version__ = "1.0"
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from src.settings import NV_MID... |
import sys
from testrunner import run
TIMEOUT = 20
def testfunc(child):
for _ in range(4):
child.expect_exact("OK", timeout=TIMEOUT)
child.expect_exact("SUCCESS")
if __name__ == "__main__":
sys.exit(run(testfunc)) |
import argtypes
arg = argtypes.IntArg()
argtypes.matcher.register('vsgloc2', arg)
argtypes.matcher.register('vsgloc3', arg)
argtypes.matcher.register('vsgrloc2', arg)
argtypes.matcher.register('vsgrloc3', arg) |
__author__ = 'z'
def f(n):
return n * 10 + 5
print(f(f(f(10)))) |
"""
This module provides physical property data sets and models for gases.
"""
from sys import modules
from os.path import realpath, dirname, join
from auxi.tools.materialphysicalproperties.core import DataSet
from auxi.tools.materialphysicalproperties.polynomial import PolynomialModelT
from auxi.tools.materialphysical... |
from fenrirscreenreader.core import debug
from fenrirscreenreader.utils import mark_utils
from fenrirscreenreader.utils import line_utils
class command():
def __init__(self):
self.ID = '5'
def initialize(self, environment):
self.env = environment
def shutdown(self):
pass
def getD... |
import pytest
from trezorlib import messages as proto
from .common import TrezorTest
@pytest.mark.skip_t2
class TestMsgChangepin(TrezorTest):
def test_set_pin(self):
self.setup_mnemonic_nopin_nopassphrase()
features = self.client.call_raw(proto.Initialize())
assert features.pin_protection is... |
VERSION = (0, 0, 4) # PEP 386
__version__ = ".".join([str(x) for x in VERSION]) |
import views
from django.conf.urls import url
urlpatterns = [
url(r'^runspider$', views.runspider, name = 'runspider'),
url(r'^randitem', views.randitem, name = 'randitem'),
url(r'^analysis$', views.analysis, name = 'analysis'),
url(r'^register_spider$', views.register_spider, name = 'register_spider'),... |
from . import WebserviceSubject, WebserviceMixin, WebserviceMethods
def get_title_endpoint(title):
"""
Get the endpoint for the title string ID.
:param title:
:type title: str
:return: endpoint.
:rtype: str
"""
mapping = {
'SMStorm': 'storm',
'TMCanyon': 'canyon',
'SMStormRoyal@nadeolabs': 'royal',
'TMS... |
"""MyPy support.
TODO: Error codes
"""
from __future__ import annotations
from mypy import api
from pylama.context import RunContext
from pylama.lint import LinterV2 as Abstract
class Linter(Abstract):
"""MyPy runner."""
name = "mypy"
def run_check(self, ctx: RunContext):
"""Check code with mypy."""... |
from wsgiref.simple_server import make_server
from kruemelmonster import SimpleSessionMiddleware
def wrapped_app(environ, start_response):
session = environ.get('wsgisession')
# google chrome sends 2 requests ...
if environ['PATH_INFO'] != '/favicon.ico':
session["counter"] = session.get("counter", ... |
"""
RiakAlchemy - Object Mapper for Riak
Copyright (C) 2011 Linux2Go
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation.
This program is distributed in the hope that it ... |
from django.shortcuts import render
from django.http import HttpResponse
def currently_playing(request):
return HttpResponse('ok') |
from people import * |
"""Unit tests for the `cf_units.Unit` class."""
import unittest
import numpy as np
import cf_units
from cf_units import Unit
class Test___init__(unittest.TestCase):
def test_capitalised_calendar(self):
calendar = "GrEgoRian"
expected = cf_units.CALENDAR_GREGORIAN
u = Unit("hours since 1970-0... |
import time
import os
import roslib; roslib.load_manifest('meka_description')
import rospy
from sensor_msgs.msg import JointState
from std_msgs.msg import Header
rospy.init_node("joint_state_publisher")
pub = rospy.Publisher("/joint_states", JointState)
joints = []
positions = []
joints.append('X')
positions.append(0.0... |
import os, logging
from django.conf import settings
from django.test import TestCase
from utils import urls_to_zip
logger = logging.getLogger('zup')
class LoggerTest(TestCase):
def setUp(self):
'''
it will create LOGGING_ROOT
'''
if not os.path.exists(settings.LOGGING_ROOT):
os.mkdir(settings.LO... |
from __future__ import print_function
import os
import sys
sys.path.insert(0, '/home/peter/code/projects/MultiNEAT') # duh
import time
import random as rnd
import subprocess as comm
import numpy as np
import pickle as pickle
import MultiNEAT as NEAT
from MultiNEAT import GetGenomeList, ZipFitness, EvaluateGenomeList_Se... |
import mcl.status
ERR_SUCCESS = mcl.status.MCL_SUCCESS
ERR_INVALID_PARAM = mcl.status.framework.ERR_START
ERR_UNAVAILABLE_FULLPATH = mcl.status.framework.ERR_START + 1
ERR_UNABLE_TO_OPEN_FILE = mcl.status.framework.ERR_START + 2
ERR_MARSHAL_FAILED = mcl.status.framework.ERR_START + 3
ERR_NO_UNICODE = mcl.status.framewo... |
import simplejson
file=open("test.json", "r")
for line in file:
if line.strip()!='':
response_dict = simplejson.loads(line)
for info in response_dict:
print "\n"
for key in info.keys():
print key, ':', info[key]
file.close() |
import fractalmaker.fractal as fractal
import fractalmaker.fractal_image as fractal_image
x_dim = 800
y_dim = 800
scale = 1./(x_dim/3.)
center = [2.0, 1.5]
def main():
#frac = fractal.Mandelbrot(100)
#frac = fractal.BurningShip(100)
frac = fractal.JuliaSet(100)
frac_image = fractal_image.FractalImage(fr... |
import sys
def compute_difference(houses, house):
difference = 0
for h in houses:
difference += abs(h - house)
return difference
def main(input_file):
with open(input_file, 'r') as fh:
for line in fh:
houses = sorted([int(x) for x in line.split(' ')[1:]])
differen... |
"""
https://www.codewars.com/kata/54d7660d2daf68c619000d95
"""
from functools import reduce
def gcd(a,b):
while b:
a, b = b, a % b
return a
def lcm(a,b):
return a * b // gcd(a,b)
def convertFracts(lst):
nums = [i[0] for i in lst]
denoms = [i[1] for i in lst]
_lcm = reduce(lcm,denoms)
... |
import logging
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
import random
import time
import uuid
from flask import Flask, session, redirect, url_for, escape, request, render_template
app = Flask(__name__)
@app.errorhandler(404)
def page_not_found(error):
return render_template('404.html'), 404
"... |
import operator
def isEven(x):
return x % 2 == 0
def calc(x):
if isEven(x):
return x / 2
else:
return x * 3 + 1
limit = int(input('Limit: '))
start = limit - 1
terms = {1:1}
while start > 2:
no = start
termlist = [no]
while no > 1:
if no not in terms:
next = c... |
from haxosender import *
from time import sleep
black = (0, 0, 0, 0)
white = (255, 255, 255, 255)
blue = (0, 0, 255, 0)
green = (0, 255, 0, 0)
if __name__ == "__main__":
while True:
camp = Camp("31.22.123.224")
for i in range(20):
camp.add_light('bar', 1 + i*19, i*4)
camp.add_lig... |
import sys, os
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
templates_path = ['.templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'URLBlocks'
copyright = '2012, Zachary Voase'
version = '2.4.0'
release = '2.4.0'
exclude_patterns = ['.build']
pygments_style = 'sphinx'
html_theme = 'default'... |
from collections import Counter
import math
import random
def split_data(data, prob):
"""split data into fractions [prob, 1 - prob]"""
results = [], []
for row in data:
results[0 if random.random() < prob else 1].append(row)
return results
def train_test_split(x, y, test_pct):
# pair corresp... |
"""
Contains the Downloader class.
TODO: use GHTorrent instead of GitHub's alpha GraphQL API.
"""
import datetime
import io
import logging
import time
import zipfile
from pathlib import PurePosixPath
from typing import Any, Dict, Iterator, Tuple, Union, Optional
import dateutil.parser
import requests
from sensibility.l... |
from tkinter import *
class MyWin:
def __init__(self, parent):
self.master = parent
top = Frame(root)
top.pack(side='top')
# ---
self.banner = PhotoImage(file="banner.gif")
Label(top, image=self.banner).pack(side="top")
# ---
top2 = Frame(top)
... |
import acos_client.errors as acos_errors
import acos_client.v30.base as base
from virtual_port import VirtualPort
class VirtualServer(base.BaseV30):
url_prefix = '/slb/virtual-server/'
@property
def vport(self):
return VirtualPort(self.client)
def all(self):
return self._get(self.url_pre... |
import os
import shutil
import struct
import unittest
from kenshin.storage import Storage
from kenshin.agg import Agg
from kenshin.utils import mkdir_p, roundup
from kenshin.consts import NULL_VALUE
class TestStorageBase(unittest.TestCase):
data_dir = '/tmp/kenshin'
def setUp(self):
if os.path.exists(se... |
"""Class to represent a IBM Cloud Virtual Machine."""
import base64
import json
import logging
import os
import sys
import threading
import time
from absl import flags
from perfkitbenchmarker import disk
from perfkitbenchmarker import errors
from perfkitbenchmarker import linux_virtual_machine
from perfkitbenchmarker i... |
"""Simple tcp flow aggregation."""
import argparse
import os.path
import sys
from common import __version__
from packet_dumper import PacketDumper
from plotter import Plotter
def get_options(argv):
"""Generic option parser.
Args:
argv: list containing arguments
Returns:
argparse.ArgumentParser - generated... |
"""Converts image data to TFRecords file format with Example protos.
The image data set is expected to reside in JPEG files located in the
following directory structure.
data_dir/label_0/image0.jpeg
data_dir/label_0/image1.jpg
...
data_dir/label_1/weird-image.jpeg
data_dir/label_1/my-image.jpeg
...
where th... |
"""Contains the version string."""
VERSION = '1.9.0a0' |
"""mrestweb URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-bas... |
"""
Modified from
https://github.com/tensorflow/models/blob/master/tutorials/image/cifar10/cifar10_train.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
from datetime import datetime
import time
import numpy as np
import tensorflow... |
import logging
class Form(object):
"""
Represents a form in sqoop.
Example sqoop form dictionary received by server: [
{
"id": 1,
"inputs": [
{
"id": 1,
"name": "connection.jdbcDriver",
"value": "org.apache.derby.jdbc.EmbeddedDriver",
"type": "STRING... |
"""Contains the logic for `aq show chassis --all`."""
from sqlalchemy.orm import contains_eager
from aquilon.aqdb.model import Chassis, DnsRecord, DnsDomain, Fqdn
from aquilon.worker.broker import BrokerCommand
from aquilon.worker.formats.list import StringAttributeList
class CommandShowChassisAll(BrokerCommand):
r... |
from tests.test_app.models import User
def run(app=None):
print(User.objects.count())
print('hello world') |
def differentRightmostBit(n, m):
return 2 ** [i for i, e in enumerate(bin(n ^ m)[2:][::-1]) if e == '1'][0] |
import string
import time
from nova.api.openstack import wsgi
from turnstile import config
from turnstile import limits
from turnstile import tools
class ParamsDict(dict):
"""
Special dictionary for use with our URI formatter below. Unknown
keys default to '{key}'.
"""
def __missing__(self, key):
... |
from builtins import str
import sys
import subprocess
import subprocess32
import os
thread_timeout = 50
subprocess32.call(['./image.sh'], timeout=thread_timeout)
def cleanup():
subprocess.call(['./cleanup.sh'])
from vmrunner import vmrunner
vm = vmrunner.vms[0]
vm.on_exit(cleanup)
if len(sys.argv) > 1:
vm.boot(th... |
from django import forms
from techism2.models import Location
from techism2 import fields
class EventForm(forms.Form):
title = forms.CharField(max_length=200, label=u'Titel')
date_time_begin = forms.SplitDateTimeField(label=u'Beginn', input_date_formats= ['%d.%m.%Y'], widget=forms.SplitDateTimeWidget(date_forma... |
import calendar
import json
from logging import getLogger, NullHandler
from collections import defaultdict
from datetime import datetime, timedelta
from hashlib import sha256
from io import StringIO
from time import sleep, time
from functools import reduce
import six
from bigquery.errors import (BigQueryTimeoutExceptio... |
from .base import *
from .reports import *
from .thecb import * |
"""
Django settings for cococomments project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
B... |
"""
Remote Service Admin API
:author: Scott Lewis
:copyright: Copyright 2020, Scott Lewis
:license: Apache License 2.0
:version: 1.0.1
..
Copyright 2020 Scott Lewis
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may ob... |
import lib.record_rate
import lib.getconfig
import datetime
import lib.puylogger
check_type = 'system'
cluster_name = lib.getconfig.getparam('SelfConfig', 'cluster_name')
reaction = -3
def runcheck():
try:
#rv = []
local_vars = []
to = []
timestamp = int(datetime.datetime.now().strft... |
'''
Created on 3 Oct 2014
@author: s05nc4
'''
import unittest
import StringIO
from dotruralsepake.rdf.csv_to_rdf import CSV, PROV, row_graphs_from_file
from rdflib import RDF, RDFS, Graph
import csv
from rdflib.term import Literal
EXAMPLE = '''"A","B","C"
1,2,3
4,5,6
'''
class Test(unittest.TestCase):
def setUp(sel... |
import mlflow
import sklearn
mlflow.sklearn.autolog(log_models=False)
X, y = sklearn.datasets.load_diabetes(return_X_y=True)
X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(
X, y, test_size=0.2, random_state=0
)
with mlflow.start_run() as run:
print(f"MLflow run ID: {run.info.run_id}... |
"""Note: Keep in sync with changes to VTraceTFPolicy."""
from typing import Optional, Dict
import gym
import ray
from ray.rllib.agents.ppo.ppo_tf_policy import ValueNetworkMixin
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.evaluation.episode import Episode
from ray.rllib.evaluation.postprocessin... |
from ceilometer import sample
INSTANCE_PROPERTIES = [
# Identity properties
'reservation_id',
# Type properties
'architecture',
'OS-EXT-AZ:availability_zone',
'kernel_id',
'os_type',
'ramdisk_id',
]
def _get_metadata_from_object(conf, instance):
"""Return a metadata dictionary for th... |
import xlrd
from string import Template
import re
import time
from datetime import date
today = date.today()
excel_file = 'GW portal list of icons new structure 20170830.xlsx'
workbook = xlrd.open_workbook(excel_file)
worksheet_name = 'science domain categories'
worksheet = workbook.sheet_by_name(worksheet_name)
synony... |
"""Tests for Keras backend."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
import numpy as np
import scipy.sparse
from tensorflow.core.protobuf import config_pb2
from tensorflow.python import keras
from tensorflow.py... |
import server.tests
class TestAuth(server.tests.DCITestCase):
def test_authorized_as_partner(self):
# partner can read files
self.assertHTTPCode(self.partner_client('get', '/api/files'), 200)
# partner can create job (400 because of the missing parameters)
self.assertHTTPCode(self.pa... |
"""Building blocks for Qiskit validated classes.
This module provides the ``BaseSchema`` and ``BaseModel`` classes as the main
building blocks for defining objects (Models) that conform to a specification
(Schema) and are validated at instantiation, along with providing facilities
for being serialized and deserialized.... |
"""
Utilities for loading .nt RDF triple files.
"""
def load_literals(nt_filename, first=0):
"""
From an .nt file, produce a dict mapping between the first and last
elements.
We make some strong assumptions:
* the first element is DBpedia resource
* the middle element is always the same predicat... |
from __future__ import print_function
import glob
import os
import re
import subprocess
import sys
from collections import deque, namedtuple
dep_match_re = \
re.compile('^((python|f5-sdk|f5-icontrol-rest)[\w\-]*)' +
'\s([<>=]{1,2})\s(\S+)')
def usage():
print("fetch_dependencies.py working_dir")
... |
import catoclient.catocommand
from catoclient.param import Param
class ListAssets(catoclient.catocommand.CatoCommand):
Description = 'Lists Assets'
API = 'list_assets'
Examples = '''
_List all Assets with test in the name_
cato-list-assets -f "test"
_List all Assets that are active_
cato-list-assets... |
import logging
import time
from common import api
from common import util
from common import display
CONTACTS_PER_PAGE = 15
CHANNELS_PER_PAGE = 4
def get_inbox_entries(request, inbox, hide_comments=False, entries_per_page=20, filter=False, view=None):
entries = api.entry_get_entries(request.user, inbox, hide_comments... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.