text stringlengths 1 927k |
|---|
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2020 shmilee
'''
Contains Converter core class.
'''
import re
from .base import BaseCore, AppendDocstringMeta
from ..glogger import getGLogger
__all__ = ['Converter']
clog = getGLogger('C')
class Converter(BaseCore, metaclass=AppendDocstringMeta):
'''
Convert ... |
def isValidSudoku(board: list()) -> bool:
row, col, block = {}, {}, {}
for i in range(9):
for j in range(9):
num = board[i][j]
if num != ".":
if i not in row.keys():
row[i] = []
if j not in col.keys():
col[j]... |
from typing import List
from ._mechanisms import *
from enum import Enum
import numpy as np
class Stat(Enum):
count = 1
sum_int = 2
sum_large_int = 3
sum_float = 4
sum_large_float = 5
threshold = 6
class Mechanisms:
def __init__(self):
self.classes = {
Mechanism.laplace... |
# 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 EnvironmentTestCase(Integ... |
# The remove_unused_levels defined here was copied based on the source code
# defined in pandas.core.indexes.muli.py
# For reference, here is a copy of the pandas copyright notice:
# (c) 2011-2012, Lambda Foundry, Inc. and PyData Development Team
# All rights reserved.
# Copyright (c) 2008-2011 AQR Capital Managemen... |
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Picscoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC HTTP basics."""
from test_framework.test_framework import PicscoinTestFramework
from tes... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import Type
from unittest.mock import patch
import pandas as pd
from ax.core.arm import Arm... |
import json
import ssl
import urllib
from osbot_aws.apis.Secrets import Secrets
from oss_bot.api.commands.OSS_Bot_Commands import OSS_Bot_Commands
class API_OSS_Bot:
def __init__(self):
self.slack_url = "https://slack.com/api/chat.postMessage"
self.bot_name = '@ossbot'
self.team_id ... |
from django import template
register = template.Library()
@register.simple_tag(takes_context=True)
def unique_html_id(context, prefix):
"""
Given a string, return a string that is guaranteed to be unique across all
calls to this template tag, suitable for use as an HTML `id` attribute.
Note that onl... |
"""The main API for the v3 notebook format.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distribute... |
from rest_framework import serializers
from .models import Order
class OrderSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Order
fields = ('user')
#TODO: aadproduct and quantity |
# Copyright (C) 2019 Electronic Arts Inc. All rights reserved.
import os
import struct
import cv2
import numpy as np
import lz4.block as lz4block
'''
Example Usage:
# This script extracts all frames of the recorded file test.ava and outputs them as JPG and TIF images.
from raw_file_format_readers import A... |
from django.conf.urls import url, include
from tenders_django_app.views import TendersView
from django.views.generic import TemplateView
urlpatterns = {
url(r'^$', TemplateView.as_view(template_name="index.html")),
url(r'^tenders/$', TendersView.as_view(), name="tenders"),
} |
# encoding=utf8
import json
import pandas
import numpy
from beam_search import dynamic_programming
from multiprocessing import Pool
import multiprocessing
import sys
import time
import argparse
import os
from APIs import *
parser = argparse.ArgumentParser()
parser.add_argument("--synthesize", default=False, action="st... |
import argparse
import pandas as pd
import psutil
import time
from cnvrg import Experiment
tic=time.time()
parser = argparse.ArgumentParser(description="""Preprocessor""")
parser.add_argument('-f','--filename', action='store', dest='filename', default='/data/movies_rec_sys/ratings_2.csv', required=True, help="""string... |
# Copyright (c) 2021 Teradici Corporation
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import requests
import retry
from retry import retry
class CASManager:
def __init__(self, auth_token, url='https://cas.teradici.com'):
se... |
from django.contrib import admin
from .models import RestaurantLocation, OrderLocation
# Register your models here.
admin.site.register(RestaurantLocation)
admin.site.register(OrderLocation) |
import matplotlib.pyplot as plt
from mmdet import cv_core
import numpy as np
import torch
from mmdet.cv_core.parallel import collate
from mmdet.cv_core.runner import load_checkpoint
from mmdet.datasets.pipelines import Compose
from mmdet.models import build_detector
from mmdet.datasets import build_dataset
def init_... |
# 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... |
import requests
from django.http import HttpResponse
from django.conf import settings
from django.shortcuts import render, redirect
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.auth import authenticate, get_user_model, login, logout
from django.contrib.auth.models import User
from dja... |
import numpy as np
import scipy as sp
import scipy.special
from tqdm import tqdm
import utils
from .model import HierarchicalVAE
def calculate_evidence(sess, data, iwhvae, iwae_samples, iwhvi_samples, batch_size, n_repeats,
tau_force_prior=False, tqdm_desc=None):
losses = utils.batched_run... |
# Copyright (C) 2020 GreenWaves Technologies, SAS
# 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
# License, or (at your option) any later version.
# This progr... |
# -*- coding: utf-8 -*-
import pytest
import time
import sys
sys.path.extend(["../"])
from bbc1.core import bbclib
from bbc1.core.message_key_types import KeyType
from testutils import prepare, get_core_client, start_core_thread, make_client, domain_setup_utility
LOGLEVEL = 'debug'
LOGLEVEL = 'info'
core_num = 1
cl... |
from django.core.exceptions import PermissionDenied
from django.contrib.auth.models import AnonymousUser
from django.contrib.sessions.middleware import SessionMiddleware
from django.contrib.messages.middleware import MessageMiddleware
from django.test import RequestFactory, TestCase
import datetime
import pytz
from p... |
import subprocess
import shutil
import os
subprocess.call("gcc ./lib/index.c -o index.go",shell=True)
subprocess.call("gcc ./lib/api.c -o api.go",shell=True)
dist = './js/'
pRoute = dist + 'route.js'
pComponent = dist + 'component.js'
if not os.path.exists(dist):
os.makedirs(dist)
if os.path.isfile (pComponent)... |
from django.urls import path
from kakao_i_hanyang.views import *
urlpatterns = [
path('shuttle', get_shuttle_departure_info),
path('shuttle/stop', get_shuttle_stop_info),
path('food', get_food_menu),
path('library/seats', get_reading_room_seat_info),
path('update/campus', update_campus)
] |
import gym
import gym_duckietown
def launch_env(id=None):
env = None
if id is None:
# Launch the environment
from gym_duckietown.simulator import Simulator
env = Simulator(
seed=123, # random seed
map_name="loop_empty",
max_steps=500001, # we don't wa... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Resource import *
class Environment(object):
"""Environment for machine param management
Class Environment is an singleton class.
set_machine is to Set Machine Info for Machine Layer.
set_function is to Set Function Info for Function Layer.
set_... |
# coding=utf-8
"""
Django settings for backend project.
Generated by 'django-admin startproject' using Django 1.8.17.
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# SECURITY WARNING: keep the secret key us... |
"""
Plugin instance app manager module that provides functionality to run and check the
execution status of a plugin instance's app (ChRIS / pfcon interface).
NOTE:
This module is executed as part of an asynchronous celery worker.
For instance, to debug 'check_plugin_instance_app_exec_status' method synchrono... |
# Generated by Django 2.2 on 2019-10-01 09:08
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('profiles_api', '0001_initial'),
]
operations = [
migrations.CreateModel(
... |
# /* ******************************************************************************
# * Copyright (c) 2021 Deeplearning4j Contributors
# *
# * This program and the accompanying materials are made available under the
# * terms of the Apache License, Version 2.0 which is available at
# * https://www.apache.org... |
#!/usr/bin/python
'''
A nearest neighbor learning algorithm example using TensorFlow library.
This example is using the MNIST database of handwritten digits
(http://yann.lecun.com/exdb/mnist/)
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
from __future__ import print_functi... |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... |
import time
import os
import sys
import asyncio
import functools
from bfxapi import Client
from bfxmongo import useMongo
from config import Config
from calfundingrate import calRate
sys.path.append('bfxapi')
from models import FundingCreditModel
API_KEY = Config.config()["bfxKey"]
API_SECRET = Config.config()["bfx... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tflclient import tflclient
tube_status = tflclient.get_mode_status('tube')
print('Tube status:')
for line in tube_status:
statuses = [st.statusSeverityDescription for st in line.lineStatuses]
disruption_details = {'detail': st.reason for st in line.lineStatu... |
# coding=utf-8
import os
import pathlib
from xml.etree.ElementTree import Element
from ..ast import create_ast_file, read_ast_file
from ..logger import log_debug
from ..utils import replace_node, delete_node, create_array_literal_values
def opt_invoke_expression(ast):
ret = False
p = pathlib.Path("tmp.ps1")
... |
import os
import tempfile
import boto3
from PIL import Image
s3 = boto3.client('s3')
DEST_BUCKET = os.environ['DEST_BUCKET']
SIZE = 128, 128
def lambda_handler(event, context):
for record in event['Records']:
source_bucket = record['s3']['bucket']['name']
key = record['s3']['object']['key']
... |
# -*- coding: UTF-8 -*-
import matplotlib.ticker as ticker
import matplotlib.pyplot as plt
import mpl_finance as mpf
# from mpl_finance import quotes_historical_yahoo
import numpy as np
from pandas import Series, DataFrame
# http://blog.csdn.net/xiaodongxiexie/article/details/53123371
class PlotShow(object):
def ... |
# 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... |
import os
class Config:
NEWS_API_BASE_URL= 'https://newsapi.org/v2/everything?q={}&apiKey={}'
NEWS_API_KEY = os.environ.get('NEWS_API_KEY')
SECRET_KEY = os.environ.get('SECRET_KEY')
class ProdConfig(Config):
pass
class DevConfig(Config):
DEBUG = True
config_options = {
'development': DevConf... |
import binascii
import math
import turtle
from Tkinter import *
from PIL import Image
# globals
FONT_SIZE = 4
FILE_NAME = "input.wav" # Name of file to get hex values from
IMAGE_NAME = "input.png" # Name of image file
DATA_OFFSET = 32 # Where to start reading data from (mp3 music data starts at 32 by... |
import json
import nltk
from nltk.stem import WordNetLemmatizer
from nltk.corpus import words
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
def normalizeUrl(url):
idx = url.find('url=')
url = url[idx+4:]
url = url.replace('%3A', ':')
url = url.replace('%2F', '/')
idx = ... |
from PreprocessData.all_class_files.Enumeration import Enumeration
import global_data
class ItemAvailability(Enumeration):
def __init__(self, additionalType=None, alternateName=None, description=None, disambiguatingDescription=None, identifier=None, image=None, mainEntityOfPage=None, name=None, potentialAction=No... |
class Solution:
def countAndSay(self, n: int) -> str:
s = '1'
for _ in range(1, n):
nextS = ''
countC = 1
for i in range(1, len(s) + 1):
if i == len(s) or s[i] != s[i - 1]:
nextS += str(countC) + s[i - 1]
cou... |
from .bases import DotloopObject
from .document import Document
class Folder(DotloopObject, id_field='folder_id'):
@property
def document(self):
return Document(parent=self)
def get(self, **kwargs):
return self.fetch('get', params=kwargs)
def patch(self, **kwargs):
return sel... |
from .cityscapes import CityscapesDataset
from .registry import DATASETS
import os.path as osp
@DATASETS.register_module
class CityscapesPanopticDataset(CityscapesDataset):
"""
Cityscapes/Carla Dataset loading semantic segmentation
without Instance support
"""
def prepare_train_img(self, idx):
... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
# Copyright 2016 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 appl... |
#Copyright ReportLab Europe Ltd. 2000-2018
#see license.txt for license details
__doc__="""The Reportlab PDF generation library."""
Version = "3.5.59"
__version__=Version
__date__='20210104'
import sys, os
__min_python_version__ = (3,6)
if sys.version_info[0:2]!=(2, 7) and sys.version_info< __min_python_version__:
... |
# Generated by Django 3.0.7 on 2020-06-18 13:56
from django.db import migrations
def move(apps, schema_editor):
Template = apps.get_model("linguistics", "Template")
Template.objects.filter(key=240009).update(key=240008)
Template.objects.filter(key=240011).update(key=240010)
Template.objects.filter(k... |
# 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... |
import os
import uuid
from typing import Dict, List, Optional
import pandas as pd
from feast import SnowflakeSource
from feast.data_source import DataSource
from feast.infra.offline_stores.snowflake import SnowflakeOfflineStoreConfig
from feast.infra.offline_stores.snowflake_source import SavedDatasetSnowflakeStorage... |
from gibson.envs.husky_env import HuskyNavigateEnv
from gibson.utils.play import play
from gibson.core.render.profiler import Profiler
import os
config_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'configs', 'benchmark.yaml')
print(config_file)
if __name__ == '__main__':
import argparse... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006,2009 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... |
"""Provides a base class for the processes to subclass"""
from liquid.defaults import SEARCH_PATHS
from pipen import Proc as PipenProc
from .filters import filtermanager
from .defaults import BIOPIPEN_DIR, REPORT_DIR
class Proc(PipenProc):
"""Base class for all processes in biopipen to subclass"""
template_... |
#!/usr/bin/env python3
# coding=utf-8
from random import choice
subject = (
"five year old children",
"progressive liberals",
"anyone",
"Gary Johnson and Bill Weld",
"The Mises Institute",
"The CATO institue",
"Austin Petersen and the Libertarian Republic",
"radical conservatives",
... |
from django.db import models
class Subject(models.Model):
name = models.CharField(max_length=256)
def __str__(self):
return self.name
class Tag(models.Model):
name = models.CharField(max_length=256)
subject = models.ForeignKey("Subject", on_delete=models.CASCADE)
def __str__(self):
... |
"""Collection of public bioimage datasets
"""
# import should not be sorted by isort
# #--- MaskDataset (mask anno) ---# #
# full anno
# instance
from ._dsb2018 import DSB2018
from ._stardist import StarDist
from ._compath import ComputationalPathology
from ._frunet import FRUNet
from ._s_bsst265 import S_BSST26... |
from collections import namedtuple
from flask import (
Blueprint,
abort,
current_app,
make_response,
render_template,
request,
)
from shorter.forms.short import ShortCreateForm, ShortDisplayForm
from shorter.models.short import Short
from shorter.start.environment import DELAY_DEF
from shorter... |
# coding: utf-8
import sys, os
sys.path.append('/Users/hxxnhxx/Documents/development/deep-learning-from-scratch') # 親ディレクトリのファイルをインポートするための設定
import pickle
import numpy as np
from collections import OrderedDict
from common.layers import *
from common.gradient import numerical_gradient
class SimpleConvNet:
"""単純な... |
# 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:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
#!/usr/bin/python
from fileutils import *
from data import constants
from data import Path
def convertToObjc(value):
return ("true" if value else "false");
class FileData(object):
def __init__(self, name):
prefix = constants.getFilePrefix()
self.name = (name if prefix is None else prefix + n... |
# =================================================================
# =================================================================
import re
from nova.compute.ibm import etree_wrapper as ElementTree
from nova import exception
from nova.openstack.common import log as logging
from nova.openstack.common.gettextuti... |
#!/usr/bin/env python3
# Modified from: https://github.com/ulfalizer/Kconfiglib/blob/master/examples/merge_config.py
import argparse
import os
import sys
import textwrap
from kconfiglib import Kconfig, Symbol, BOOL, STRING, TRISTATE, TRI_TO_STR
# Warnings that won't be turned into errors (but that will still be print... |
"""Test DysonDevice functionalities."""
from unittest.mock import MagicMock, patch
import pytest
from libdyson.const import MessageType
from libdyson.dyson_device import DysonDevice
from libdyson.exceptions import (
DysonConnectionRefused,
DysonConnectTimeout,
DysonInvalidCredential,
DysonNotConnected... |
# -*- coding: utf-8 -*-
import os
from terminal_table import Table
from hagworm.extend.logging import DEFAULT_LOG_FILE_ROTATOR
from hagworm.extend.interface import RunnableInterface
from hagworm.extend.asyncio.base import Launcher as _Launcher
from hagworm.extend.asyncio.base import Utils, MultiTasks, AsyncCirculato... |
# Information about OBD-II PIDs
# http://en.wikipedia.org/wiki/OBD-II_PIDs
# PID hex codes
PIDS_SUPPORTED_00_20 = "00"
MONITOR_STATUS_SINCE_DTC_CLEARED = "01"
FREEZE_DTC = "02"
VEHICLE_IDENTIFICATION_NUMBER = "02"
FUEL_SYSTEM_STATUS = "03"
CALCULATED_ENGINE_LOAD = "04"
ENGINE_COOLANT_TEMPERATURE = "05"
SHORT_TERM_FUEL... |
class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [i for i in range(n + 2)]
def find(self, a):
path = []
while self.parent[a] != a:
path.append(a)
a = self.parent[a]
for p in path:
self.parent[p] = a
... |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Hpctoolkit(AutotoolsPackage):
"""HPCToolkit is an integrated suite of tools for measuremen... |
# -*- coding: utf-8 -*-
import os
import string
from hashlib import md5
from io import BytesIO
from lxml import etree
from datetime import datetime
from scrapy.selector import Selector
from scrapy.spiders import Rule
from scrapy.linkextractors import LinkExtractor
from scrapy.contrib.linkextractors.sgml import SgmlL... |
import numpy as np
from math import sqrt
from skimage import data
from skimage.feature import blob_dog, blob_log, blob_doh
from skimage.color import rgb2gray
from pandas import DataFrame
import pandas as pd
import matplotlib.pyplot as plt
import os
from os import path
import glob
import cv2
import time
import math
im... |
import os
import imp
import thread
import signal
from argparse import Namespace
import psutil
from migrate.versioning import api
from common.SimpleDB import SimpleDB
from common_util import *
import time
def get_from_conf(config, key, default):
return config.get('root', key) \
if config.has_option('root... |
# -*- coding: utf-8 -*-
from genericpath import exists
from random import uniform
from time import sleep
import requests
import os
import textwrap
from datetime import datetime
import json
def WriteFailed():
failedTimeStamp = '1'
dateTime = datetime.now()
dateTimeFailed = dateTime.strftime("%d/%m/%Y %H:%... |
from random import randint
ls = [randint(-5, 5) for i in range(3)]
print(ls)
if ls[0] > ls[1]:
ls[0], ls[1] = ls[1], ls[0]
if ls[1] > ls[2]:
ls[1], ls[2] = ls[2], ls[1]
if ls[0] > ls[1]:
ls[0], ls[1] = ls[1], ls[0]
print(ls)
# le code précédent trie une liste de trois éléments
def bubbleSort(lis):
f... |
#超分倍率
scale=2
#参数路径,可更换
model_path2 = "weights_v3/up2x-latest-denoise3x.pth"
model_path3 = "weights_v3/up3x-latest-denoise3x.pth"
model_path4 = "weights_v3/up4x-latest-denoise3x.pth"
#早期显卡开半精度不会提速,但是开半精度可以省显存。
half=True
#tile分为0~4一共5个mode。0在推理时不对图像进行切块,最占内存,mode越提升越省显存,但是可能会降低GPU利用率,降低推理速度
tile=2
#超图像设置
device="cuda... |
from opentrons import containers, instruments
# a 12 row trough for sources
trough = containers.load('trough-12row', 'D2')
# plate to create dinosaur in
plate = containers.load('96-PCR-flat', 'C1')
# a tip rack for our pipette
p200rack = containers.load('tiprack-200ul', 'B2')
# wells to dispense dinosaur body in gr... |
import logging
from typing import NamedTuple
from async_service import Service
from eth_enr import ENRDatabaseAPI, IdentitySchemeRegistryAPI, UnsignedENR
from eth_enr.constants import IP_V4_ADDRESS_ENR_KEY, UDP_PORT_ENR_KEY
from eth_typing import NodeID
from eth_utils import encode_hex
from eth_utils.toolz import merg... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
aws_datagenerator_version = '1.8.0' |
import numpy as np
def R(theta):
"""
Returns the rotation matrix for rotating an object
centered around the origin with a given angle
Arguments:
theta: angle in degrees
Returns:
R: 2x2 np.ndarray with rotation matrix
"""
theta = np.radians(theta)
... |
from datetime import datetime
from locale import setlocale, LC_ALL # para trazer a localidade.
from calendar import mdays # vai retornar quantos dias tem cada mês.
# essa fução seta a localidade padrão do computador, caso o segundo parametro esteja
# em branco ou preencha o parametro par definir a localidade.
setlocal... |
import re
import json
from bs4 import BeautifulSoup
from decorators import parse_decorator
from logger import parser
@parse_decorator('')
def get_userid(html):
pattern = re.compile(r'\$CONFIG\[\'oid\'\]=\'(.*)\';')
m = pattern.search(html)
return m.group(1) if m else ''
@parse_decorator('')
def get_us... |
"""
Test lldb data formatter subsystem.
"""
from __future__ import print_function
import os
import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
class Radar9974002DataFormatterTestCase(TestBase):
# test for rdar://problem/9974002 ()
mydir = TestBase.comp... |
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as go
from dash.dependencies import Input, Output
import datetime as dt
import pandas_datareader as web
app = dash.Dash()
server = app.server
start = dt.datetime(2000,1,1)
end = dt.datetim... |
from io import BytesIO
import base64
def decode_image_base64(image_base64):
return BytesIO(base64.b64decode(image_base64)) |
"""
2-input XOR example -- this is most likely the simplest possible example.
"""
from __future__ import print_function
import sys
import neat
from MctsReproduction import MctsReproduction
# 2-input XOR inputs and expected outputs.
xor_inputs = [(0.0, 0.0), (0.0, 1.0), (1.0, 0.0), (1.0, 1.0)]
xor_outputs = [(0.0,), ... |
from typing import Union, Optional, Callable
import torch
import torch.nn.functional as F
from torch.nn import Linear
from torch_scatter import scatter
from torch_sparse import SparseTensor
from torch_geometric.nn import LEConv
from torch_geometric.utils import softmax
from torch_geometric.nn.pool.topk_pool import to... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='FlatPage',
fields=[
('id', models.AutoField(verbose_name='ID',
... |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
import os
# Only build certain parts of dwarf because the other ones break.
dwarf_dirs = [... |
##############################################################################
#
# Copyright Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS ... |
import os
import sys
import pytest
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
from base import TestBaseClass
class TestClassOelintFileUpstreamStatus(TestBaseClass):
@pytest.mark.parametrize('id', ['oelint.file.upstreamstatus'])
@pytest.mark.parametrize('occurrence', [1])
@pytest.ma... |
# -*- coding:utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import random
import string
import pytest
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
browsers = {
# 'firefox': webdriver.Firefox,
# 'chrome': webdriver.Chrom... |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the listtransactions API
from test_framework.test_framework import BitcoinTestFramework
from ... |
# coding=utf-8
# *** WARNING: this file was generated by the Kulado Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import json
import warnings
import kulado
import kulado.runtime
from .. import utilities, tables
class Store(kulado.CustomResource):
... |
import os
from .base import *
DEBUG = True
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-wa10ry&+mkywslsux+p50p=%d$)el1og6^nxsrlz2r0$(s+6(-'
# For development server django-debug-toolbar
_INTERNAL_IPS = ['127.0.0.1', "localhost"]
INTERNAL_IPS = _INTERNAL_IPS
ALLOWE... |
# Copyright 2010 New Relic, 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 writ... |
# brew install zbar
# Ubuntu: sudo apt-get install zbar-tools or libzbar
# pip install pyzbar
# pip install pillow
from pyzbar.pyzbar import decode
from PIL import Image
d = decode(Image.open("fm-qr-code.png"))
# print(d)
print(d[0].data.decode()) |
# Mathematics > Number Theory > Divisibility of Power
# Divisibility Test.
#
# https://www.hackerrank.com/challenges/divisibility-of-power/problem
# https://www.hackerrank.com/contests/infinitum-aug14/challenges/divisibility-of-power
# challenge id: 2597
#
import math
# if x = ∏ pi^ei, find(i,j) | x <=> Ai^(...) | x ... |
"""
Utilities for working with the local dataset cache. Copied from AllenNLP
"""
from pathlib import Path
from typing import Tuple, Union, Optional, Sequence, cast
import os
import base64
import logging
import shutil
import tempfile
import re
import functools
from urllib.parse import urlparse
import mmap
import reques... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.