code
stringlengths
1
199k
"""Operations for clipping (gradient, weight) tensors to min/max values.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import six from tensorflow.python.framework import ops from tensorflow.python.framework import types from tensorflow...
import socket HOST, PORT = '', 8888 listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) listen_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) listen_socket.bind((HOST, PORT)) listen_socket.listen(1) print 'Serving HTTP on port %s ...' % PORT while True: client_connection, client_address ...
import json import logging from typing import List from typing import Optional from click import Command from click import Context from click import Group from click import argument from click import group from click import option from click import pass_context from repokid import CONFIG from repokid import get_hooks f...
""" Copyright 2014-2016 University of Illinois 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...
''' cnt = sum_over_x, sum_over_y (x * y) = sum_over_x (x) * sum_over_y (y) = [(1 + width) * width / 2] * [(1 + length) * length / 2] ''' def rect_counter(width, length): cnt = 0 for x in range(1, width + 1): for y in range(1, length + 1): cnt += x * y return cnt def rect_counter_...
import base import requests import unittest import versa_plugin.operations import get_configuration as get_conf requests.packages.urllib3.disable_warnings() pool = """ instance: name: $pool_name ip-address: 1.2.3.4 """ organization = """ organization: name: $cms_name reso...
"""Test cases for eager execution using XLA.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.compiler.tests import xla_test from tensorflow.core.protobuf import config_pb2 from tensorflow.python.eager import backprop from...
import unittest from unittest import mock import time import dbt.exceptions from dbt.parser.partial import PartialParsing from dbt.contracts.graph.manifest import Manifest from dbt.contracts.graph.parsed import ParsedModelNode from dbt.contracts.files import ParseFileType, SourceFile, SchemaSourceFile, FilePath, FileHa...
from model.film import Film def test_login_empty(app): app.session.login(username="", password="") def test_login_valid(app): app.session.login(username="admin", password="admin") app.session.logout() def test_add_new_movie(app): app.session.login(username="admin", password="admin") app.film.click_o...
""" The goal of this module is making dvc functional tests setup a breeze. This includes a temporary dir, initializing git and DVC repos and bootstrapping some file structure. The cornerstone of these fixtures is `tmp_dir`, which creates a temporary dir and changes path to it, it might be combined with `scm` and `dvc` ...
from django.utils.translation import ugettext_lazy as _ import horizon from openstack_dashboard.dashboards.congress import dashboard class Overview(horizon.Panel): name = _("Overview") slug = "overview" dashboard.Congress.register(Overview)
class Solution: def minCostClimbingStairs(self, cost): ans = [0]*(len(cost)+1) for i in range(2, len(cost)+1): ans[i] = min(ans[i-1]+cost[i-1], ans[i-2]+cost[i-2]) return ans[len(cost)] print(Solution().minCostClimbingStairs([10, 15, 20])) print(Solution().minCostClimbingStairs([...
from __future__ import print_function from collections import OrderedDict import sys from catkin_pkg.package import parse_package_string from ros_buildfarm.common import get_default_node_label from ros_buildfarm.common import get_devel_job_name from ros_buildfarm.common import get_devel_view_name from ros_buildfarm.com...
from flask import Flask from flask.ext.restful import Api from werkzeug.serving import WSGIRequestHandler from mongoengine import connect from models import Tweet, Topic from models.routing import register_api_model from collecting.routes import (CollectorListResource, CollectorResource, CollectorPollingResourc...
# Copyright 2021 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 agreed to in ...
''' Created on October 25th, 2014 Subscribe to a resource, connect to the notification channel of an mDS instance and receive notifications from the subscribed resource Process the notifications and filter a set of endpoints and a particular resource path. Index the resource value from the notification and use it to ac...
""" programme: musique_bd.py - Le programme qui va afficher à l'écran la liste numérotée des artistes dans la BD. - Le programme va afficher la liste des albums d'un artiste en particulier (en saisissant son numéro au clavier) - Le fichier input_data.txt contient des données sur des albums de musique. Chaque ligne corr...
from random import Random class BloomFilter(object): def __init__(self, num_bytes, num_probes, iterable=()): """Bloom filter implementation Example: Check if number in set >>> bf = BloomFilter(8, 2, (123, 321, 213, 3123)) >>> 123 in bf True >>> 456 in bf False...
from setuptools import setup, find_packages import sys, os version = '1.0' setup(name='cephprimarystorage', version=version, description="ZStack ceph primary storage", long_description="""\ ZStack ceph primary storage""", classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=l...
''' ''' Test.Summary = "Test start up of Traffic server with configuration modification of starting port" Test.SkipUnless(Condition.HasProgram("curl", "Curl needs to be installed on your system for this test to work")) ts1 = Test.MakeATSProcess("ts1",select_ports=False) ts1.Setup.ts.CopyConfig('conf...
"""Copyright (c) <2016> <Yazan Obeidi> 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, distribute,...
from pathlib import Path import yaml __all__ = ("load_config", ) def load_config(settings, user_settings=None, src_files=None): """ Negotiate a group of settings from the global defaults, the user-provided values and config files. The keys in the `settings` argument are the only settings that are consid...
import logging import google.auth from google.auth import iam from google.auth.credentials import with_scopes_if_required from google.auth._default import _load_credentials_from_file from google.auth.transport import requests from google.oauth2 import service_account from googleapiclient import discovery logger = loggi...
""" Sponge Knowledge Base Triggers - Event pattern """ from java.util.concurrent.atomic import AtomicInteger def onInit(): # Variables for assertions only sponge.setVariable("countA", AtomicInteger(0)) sponge.setVariable("countAPattern", AtomicInteger(0)) class TriggerA(Trigger): def onConfigure(self): ...
"""Unit tests for types module.""" from __future__ import absolute_import import datetime import logging import unittest import future.tests.base # pylint: disable=unused-import import mock try: from google.cloud.datastore import client from google.cloud.datastore.helpers import GeoPoint from apache_beam.io.gcp....
''' Created on Oct 9, 2015 @author: akshah ''' from bgpDataEngine.bgpDataEngine import bgpDataEngine from customUtilities.helperFunctions import * if __name__ == '__main__': start_time,_=currentTime() bde=bgpDataEngine() #Just load files no fetching mrtFiles = [join('mrtFiles/', f) for f in listdir('mrt...
"""An overview window showing thumbnails of the image set. """ import sys import math from PySide import QtCore, QtGui class ThumbnailWidget(QtGui.QLabel): def __init__(self, image): super().__init__() self.setFrameStyle(self.Box | self.Plain) self.setLineWidth(4) palette = self.pale...
import factory import factory.fuzzy from .models import BreadLabelValueTestModel, BreadTestModel, BreadTestModel2 class BreadTestModel2Factory(factory.DjangoModelFactory): FACTORY_FOR = BreadTestModel2 text = factory.fuzzy.FuzzyText(length=10) class BreadTestModelFactory(factory.DjangoModelFactory): FACTORY...
"""Module defines a base class for Pulsar managers using DRMAA.""" import logging try: from drmaa import JobState except (OSError, ImportError, RuntimeError): JobState = None from .external import ExternalBaseManager from ..util.drmaa import DrmaaSessionFactory from pulsar.managers import status log = logging.g...
from models import logger from base_service import BaseServiceHandler import requests import json CLIENT_ID = "bt58rttvtqj7f85qqbk752mt" CLIENT_SECRET = "yHgCNwx2NaXuhqyB73cJ6mcK" HTTP_METADATA_URL = "https://api.cisco.com/software/v2.0/metadata/" HTTP_DOWNLOAD_URL = "https://api.cisco.com/software/v2.0/downloads/urls/...
import os import random import sys import time import conf import g from gwis import command from util_ import misc log = g.log.getLogger('cmd.lmrk.plog') class Op_Handler(command.Op_Handler): __slots__ = ( 'trial_num', 'node_id', 'p_num', ) # *** Constructor def __init__(self, req): ...
""":synopsis: Webrecorder session access class.""" from bottle import template, request, HTTPError from webrecorder.models.user import SessionUser from webrecorder.models.base import BaseAccess class SessionAccessCache(BaseAccess): """Webrecorder session access. :cvar str READ_PREFIX: Redis key prefix (read acc...
"""Tests for madi.datasets.smart_buildings_dataset.""" from madi.datasets import smart_buildings_dataset import pandas as pd from pandas.util.testing import assert_series_equal import pytest class TestSmartBuildingsDataset: def test_smart_buildings_dataset(self): pd.set_option('display.max_rows', None, 'display.m...
"""Key bindings for the emacs-like editor.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import curses import curses.ascii import os import re from app.curses_util import * import app.controller import app.log import app.text_buffer def parse_int(str): ...
import requests class GeonamesException(Exception): pass class GeonamesClient(object): '''Simple GeoNames.org client for searching and geocoding terms. :param username ''' base_url = 'http://api.geonames.org' def __init__(self, username): self.username = username def geocode(self, qu...
import errno import logging import os.path from hadoop import confparse from desktop.lib import security_util from libsentry.conf import SENTRY_CONF_DIR, HOSTNAME LOG = logging.getLogger(__name__) _SITE_DICT = None _CONF_HIVE_PROVIDER = 'hive.sentry.server' _CONF_SENTRY_SERVER_PRINCIPAL = 'sentry.service.server.princip...
""" Copyright 2012 Pontiflex, 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, software di...
""" Patternfly user interface module. This module contains models and pages classess for UI elements from patternfly library, see: https://www.patternfly.org/ """
from nltk.book import * fdist1 = FreqDist(FreqDist([len(w) for w in text1])) fdist2 = FreqDist(FreqDist([len(w) for w in text2])) print fdist1['that'] print fdist2['that'] print print fdist1.freq('that') print fdist2.freq('that') print print fdist1.N() print fdist2.N() print print fdist1.keys() print fdist2.keys() prin...
import os import sys import time from optparse import OptionParser from pyami import mem from appionlib import apParam from appionlib import apDisplay class BasicScript(object): #===================== def __init__(self,optargs=sys.argv[1:],quiet=False): """ Starts a new function and gets all the parameters """ ...
import json import urllib import urlparse import traceback import sys import log import re ESCAPE_PATTERN = re.compile('%|{') def prepareParams(request): if request.method == 'POST': params = dict(urlparse.parse_qsl(request.data)) elif request.method == 'GET': params = dict(request.args.items())...
__author__ = "Simone Campagna" __all__ = [ 'DbTable', ] import collections class DbTable(object): def __init__(self, fields, dict_type=None, singleton=False): self.fields = collections.OrderedDict(fields) if dict_type is None: dict_type = collections.namedtuple('DbTable_dict_type', s...
import os import sys from os.path import relpath, join from setuptools import find_packages, setup from setuptools.command.install import install import versioneer assert sys.version_info[:2] == (2, 7), "Sorry, this package requires Python 2.7." PACKAGE_NAME = 'moldesign' CLASSIFIERS = """\ Development Status :: 4 - Be...
import errno import logging import mimetypes import operator import os import parquet import posixpath import re import shutil import stat as stat_module import urllib from datetime import datetime from django.contrib import messages from django.contrib.auth.models import User, Group from django.core.urlresolvers impor...
''' The envi.memcanvas module is the home of the base MemoryRenderer object and MemoryCanvas objects. ''' import sys import logging import traceback import envi.symstore.resolver as e_resolv logger = logging.getLogger(__name__) class MemoryRenderer(object): """ A top level object for all memory renderers ""...
""" WSGI config for web_reflectivity project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_S...
from setuptools import setup setup( setup_requires=['pbr'], pbr=True, )
import sys import web import MySQLdb from DBUtils.PooledDB import PooledDB from json import JSONEncoder, JSONDecoder from log import initlog, logger import config from myfuntions import saveUrl, getUrl, toKey, batchSave def is_ip_deny(thisweb): '''只有重定向接口不用检查''' # print "REMOTE_ADDR=%s" % thisweb.ctx.env.get('R...
""" Support for Postfix This module is currently little more than a config file viewer and editor. It is able to read the master.cf file (which is one style) and files in the style of main.cf (which is a different style, that is used in multiple postfix configuration files). The design of this module is such that when ...
from clr import AddReference AddReference("System") AddReference("QuantConnect.Common") AddReference("QuantConnect.Algorithm") AddReference("QuantConnect.Algorithm.Framework") from QuantConnect import * from QuantConnect.Algorithm import * from QuantConnect.Algorithm.Framework import * from QuantConnect.Algorithm.Frame...
from python.decorators import euler_timer from python.functions import prime_factors def increment(value, list_): """ This updates the value according to the list. Since we seek 4 consecutive numbers with exactly 4 prime factors, we can jump 4 numbers if the last doesn't have 4 factors, can jump 3 if ...
__author__ = """Chris Tabor (dxdstudio@gmail.com)""" if __name__ == '__main__': from os import getcwd from os import sys sys.path.append(getcwd()) from MOAL.helpers.display import Section from MOAL.helpers.display import print_success from MOAL.helpers.display import print_info from random import randrange ...
from flask import url_for, flash, abort from flask_login import current_user from pycroft.lib.user import status from pycroft.model.user import User def user_btn_style(user): """Determine the icons and style of the button to a users page. First, add glyphicons concerning status warnings (finance, traffic, n...
import os import djcelery os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'findingaids.settings') os.environ['PYTHON_EGG_CACHE'] = '/tmp' if 'HTTP_PROXY' not in os.environ: os.environ['HTTP_PROXY'] = 'http://localhost:3128/' os.environ['VIRTUAL_ENV'] = '/home/httpd/findingaids/env/' djcelery.setup_loader() from dja...
""" Views for home page. """ from django import template from django import shortcuts from django.views.decorators import vary import horizon from horizon.views import auth as auth_views def qunit_tests(request): return shortcuts.render(request, "qunit.html") def user_home(user): if user.admin: return h...
""" WSGI config for gmusic project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MO...
__author__ = 'saeedamen' from findatapy.market.datavendor import DataVendor from findatapy.market.ioengine import IOEngine, SpeedCache from findatapy.market.market import Market, FXVolFactory, FXCrossFactory, FXConv, RatesFactory from findatapy.market.marketdatagenerator import MarketDataGenerator from findatapy.market...
""" Attribute nodes Knowing attributes of an object is very important, esp. when it comes to 'self' and objects and classes. There will be a methods "computeExpression*Attribute" to aid predicting them, with many variants for setting, deleting, and accessing. Also there is some complication in the form of special looku...
import warnings warnings.warn('The sre module is deprecated, please import re.', DeprecationWarning, 2) from re import * from re import __all__ from re import _compile
"""A tf.distribute.Strategy for running on a single device.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python.distribute import device_util from tensorflow.python.distribute import distribute_lib from tensorflow.python.distribute impor...
from tqdm.auto import tqdm from termcolor import cprint import codecs from itertools import permutations from geopy.distance import distance import numpy as np import json import sys FNAME_IN = "data/cities15000.txt" OUT_DIR = "data/" MAPPING = { 'name': 1, 'lat': 4, 'lon': 5, 'country_code': 8, 'po...
from __future__ import division, print_function, unicode_literals __doc__ = """ This is the first step to create narrow diacrits for /i and /j. It duplicates "dieresiscomb", "gravecomb", "acutecomb", "brevecomb", "tildecomb", "macroncomb", "ogonekcomb" addind a ".narrow" suffix. The next step will rename those glyphs t...
import sys if sys.version_info >= (3, 8): # noinspection PyUnresolvedReferences from typing import Protocol else: # noinspection PyUnresolvedReferences from typing_extensions import Protocol
from __future__ import absolute_import from __future__ import division from __future__ import print_function import random import pandas as pd import numpy as np class CSVReader(object): def __init__(self, filepath, batch_size): ''' Read in CSV. The format of the csv fshould be: <tokens><features><label>....
import os import requests import simplejson as json import settings as s from boxviewerror import raise_for_view_error DOCUMENTS_RESOURCE = '/documents' SESSIONS_RESOURCE = '/sessions' VIEW_RESOURCE = '/view' PROCESSING = 'processing' DONE = 'done' def _set_token_from_env(): box_view_token = os.environ.get('BOX_VIE...
import sys, os import cloud_sptheme as csp on_rtd = os.environ.get('READTHEDOCS', None) == 'True' extensions = ['sphinx.ext.autodoc','rst2pdf.pdfbuilder','sphinxcontrib.plantuml'] plantuml = ['java','-jar','/sbin/plantuml.jar'] templates_path = ['_templates'] source_suffix = '.rst' master_doc = 'contents' project = u'M...
''' Integration Test For NFS/SMP/Ceph/FusionStor Check: 1. Stop ha vm and check it changed to stopped. 2. Loop step 1 for totoally 10 times. 3. Force stop host ha vm located to check natural vm ha functionality. @author: SyZhao ''' import zstackwoodpecker.test_util as test_util import zstackwoodpecker.test_state as tes...
from google.cloud import bigquery_storage_v1beta2 def sample_split_read_stream(): # Create a client client = bigquery_storage_v1beta2.BigQueryReadClient() # Initialize request argument(s) request = bigquery_storage_v1beta2.SplitReadStreamRequest(name="name_value",) # Make the request response = ...
""" Copyright 2017-present Airbnb, 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, softwa...
import webapp2 import logging import json import urllib2 import datetime from google.appengine.api import urlfetch from google.appengine.api import mail from google.appengine.ext import ndb from user.models import User from models import Monster from lib import tools class MonsterMain(webapp2.RequestHandler): def g...
import sqlite3 schema_filename = 'todo_schema.sql' with sqlite3.connect(':memory:') as conn: conn.row_factory = sqlite3.Row print('Creating schema') with open(schema_filename, 'rt') as f: schema = f.read() conn.executescript(schema) print('Inserting initial data') conn.execute(""" in...
""" web.blueprints.finance ~~~~~~~~~~~~~~ This module defines view functions for /finance :copyright: (c) 2012 by AG DSN. """ from datetime import timedelta, datetime, date from functools import partial from itertools import groupby, zip_longest, chain from io import StringIO from flask import ( Blu...
"""Tests for tensorflow.python.client.session.Session.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import threading import time import numpy as np import six from six.moves import xrange # pylint: disable=redefined-builtin from tensorflow.core.lib.cor...
from setuptools import setup setup( name='cloudify-dsl-parser', version='6.4.0.dev1', packages=[], description='[DEPRECATED] A stub for the old cloudify-dsl-parser package', )
"""Tests for tf upgrader.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow.compat.v1 as tf from tensorflow.python.framework import test_util from tensorflow.python.platform import test as test_lib _TEST_VERSION = 1 class TestUpgrade(test_u...
"""This example displays the change logs of a specified advertiser object. A similar pattern can be applied to get change logs for many other object types. Tags: changelogs.list """ __author__ = ('api.jimper@gmail.com (Jonathon Imperiosi)') import argparse import sys from apiclient import sample_tools from oauth2client...
a = [1,5,10,10,5,1] b = [] x = 0 print(a) while x <= (len(a) - 2): if b == []: b.append(1) c = a[x] + a[x + 1] b.append(c) x = x + 1 b.append(1) print(b)
class SignatureError(Exception): pass
"""This example updates a line item to add custom criteria targeting. To determine which line items exist, run get_all_line_items.py. To determine which custom targeting keys and values exist, run get_all_custom_targeting_keys_and_values.py. """ import pprint from googleads import ad_manager LINE_ITEM_ID = 'INSERT_LINE...
from __future__ import print_function from future.standard_library import install_aliases install_aliases() from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request from urllib.error import HTTPError import json import os import re #retira etiquetas HTML de la descripción from flask impo...
import argparse import csv import datetime import os import numpy as np import torch from tqdm import tqdm import model import train from util import sst, mr, load_word_vectors, headerless_tsv def load_data(args): if args.dataset is None: return None, None, None, None, None # load data print("\nLoad...
import os, re import commands from time import time from TimerCommand import TimerCommand import SiteMover from futil import * from PilotErrors import PilotErrors from pUtil import tolog, readpar, verifySetupCommand, getSiteInformation, extractFilePaths, getExperiment from FileStateClient import updateFileState from Si...
"""This platform allows several lights to be grouped into one light.""" from collections import Counter import itertools import logging from typing import Any, Callable, Iterator, List, Optional, Tuple import voluptuous as vol from homeassistant.components import light from homeassistant.const import ( ATTR_ENTITY_...
from model.group import Group import random def test_modify_group_name(app,db,check_ui): if app.group.count() == 0: app.group.create(Group(name="test")) else : old_groups = db.get_group_list() group= random.choice(old_groups) group1=Group(id=group.id,name="fruit loop") ap...
import sys sys.stdin = open("/Users/seeva92/Workspace/Contests/1.txt", "r") sys.stdout = open("/Users/seeva92/Workspace/Contests/2.txt", "w") n = int(input()) string = input() def compute(): res = 0 for i in range(0,26): for j in range(0,26): flag = True curr = 0 pIdx = -1 while(True): if fla...
from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('event_cal', '0015_remove_eventshift_drivers'), ] operations = [ migrations.AddField( model_name='calendarevent', name='needs_COE_...
"""empty message Revision ID: 437126f00e1f Revises: 0e58be3d3d20 Create Date: 2017-06-05 22:41:37.902189 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import mysql revision = '437126f00e1f' down_revision = '0e58be3d3d20' branch_labels = None depends_on = None def upgrade(): # ### comma...
regions = { 0: 'eu', 1: 'kr', 2: 'sea', 3: 'tw', 4: 'us' }
class TreetaggerToWordnet(): """ Treetagger POS tags to wordnet morphological category mapper. """ def __init__(self): self.fr_mapping = { "ADJ" : "adv", "ADV" : "adj", "NAM" : "noun", ...
import sys import string from testutils import unittest, ConnectingTestCase, decorate_all_tests from testutils import skip_if_no_iobase, skip_before_postgres from cStringIO import StringIO from itertools import cycle, izip from subprocess import Popen, PIPE import psycopg2 import psycopg2.extensions from testutils impo...
import base64 import os import sys import subprocess import StringIO if len(sys.argv)<3: print >> sys.stderr, "syntax: diff-opencloud <localfn> <remotehost:remotefn>" sys.exit(-1) srcfn = sys.argv[1] dest = sys.argv[2] if not ":" in dest: print >> sys.stderr, "malformed desthost:destfn" sys.exit(-1) (ho...
from MaxFlow import FlowNetwork INF = 99999 area_count = int(raw_input()) project_count = int(raw_input()) areas = {} for i in xrange(1, area_count+1): cost = int(raw_input()) areas["req_" + str(i)] = cost projects_revenues = {} projects_reqs = {} for i in xrange(1, project_count+1): project_str = raw_input...
"""CATER (with masks) dataset reader.""" import functools import tensorflow as tf COMPRESSION_TYPE = 'ZLIB' IMAGE_SIZE = [64, 64] SEQUENCE_LENGTH = 33 MAX_NUM_ENTITIES = 11 BYTE_FEATURES = ['image', 'mask'] def feature_descriptions( sequence_length=SEQUENCE_LENGTH, max_num_entities=MAX_NUM_ENTITIES): return {...
import unittest class TestKaggleFootballMultiAgentEnv(unittest.TestCase): def test_football_env(self): from ray.rllib.env.wrappers.kaggle_wrapper import \ KaggleFootballMultiAgentEnv env = KaggleFootballMultiAgentEnv() obs = env.reset() self.assertEqual(list(obs.keys()), ...
""" Author: AsherYang Email: ouyangfan1991@gmail.com Date: 2017/9/22. Desc: sinaWeibo appkey @see: http://open.weibo.com/apps/2489615368/info/basic?action=review use sina author 52*****18@qq.com """ sina_domain="https://api.weibo.com/2/" sina_token="2.008qwMJEagKUiCa7196fa2370UKTrM" sina_appkey = "2489615368" sina...
import os import math import mxnet as mx import numpy as np ''' Author: luoyetx@github Github Repo: https://github.com/luoyetx/mx-lsoftmax/blob/master/lsoftmax.py ''' os.environ['MXNET_CPU_WORKER_NTHREADS'] = '2' class LSoftmaxOp(mx.operator.CustomOp): '''LSoftmax from <Large-Margin Softmax Loss for Convolutional N...
from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class AuditLogConfig(AppConfig): label = 'auditlog' name = 'cobra.apps.auditlog' verbose_name = _('Audit Log')
__version__ = '0.9.dev1'
import time import rospy from std_msgs.msg import String from sensor_msgs.msg import Joy def callback(data): #data.axes containes dpad up button info 1 for pressed, #0 for not pressed move = data.buttons[1] speed = 255 #ascii u=117 (for up) and ascii d=100 (for down) if move == 1: second...
from .api import * # NOQA from .index import * # NOQA from .inventory import * # NOQA from .setup import * # NOQA from .targets import * # NOQA