content stringlengths 5 1.05M |
|---|
import re
import os
from .. import FileBuilder
from .file_builder_test import FileBuilderTest
class ArithmeticTest(FileBuilderTest):
"""Tests a build process that executes arithmetic operations.
The build process reads an Operations.txt file containing a list of
operation names. Then, starting from some... |
from django.db import models
from datetime import datetime
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.contrib.auth.hashers import make_password
from django.db.models.fields import AutoField, IntegerField
from django.db.models.lookups import IsNull
#Modelo Us... |
from os.path import isfile
from socket import timeout
import sqlite3 as db
from sys import exit
from time import sleep
import praw
from praw.errors import *
from requests.exceptions import HTTPError
from simpleconfigparser import simpleconfigparser
if isfile("settings.cfg"):
config = simpleconfigparser()
conf... |
"""
__init__.py, nothing to look here
"""
|
# -*- coding: utf-8 -*-
"""
IBEIS CORE
Defines the core dependency cache supported by the image analysis api
Extracts annotation chips from imaages and applies optional image
normalizations.
TODO:
* interactive callback functions
* detection interface
* identification interface
NOTES:
HOW TO DESI... |
import pytest
import redshift_connector
"""
These functional tests ensure connections to Redshift serverless can be established when
using various authentication methods.
Please note the pre-requisites were documented while this feature is under public preview,
and are subject to change.
Pre-requisites:
1) Redshift... |
# Standard Library
import os
import time
# Third Party
import boto3
# First Party
from smdebug.profiler.algorithm_metrics_reader import S3AlgorithmMetricsReader
from smdebug.profiler.system_metrics_reader import S3SystemMetricsReader
from smdebug.profiler.utils import us_since_epoch_to_human_readable_time
class Tra... |
class InventoryFullError(Exception):
"""Exception raised when player inventory is full"""
pass
|
import ipywidgets as widgets
from zipfile import ZipFile
from IPython.display import display, clear_output
def import_file():
zipText = widgets.Text()
zipBtn = widgets.Button(
description='Unzip',
disabled=False,
button_style='success', # 'success', 'info', 'warning', 'danger' or ''
tool... |
from __future__ import print_function
import os
import time
import datetime
import dateutil.parser
import exifread
class GPSImage(object):
"""
GPS Image Class will contain all the geo-referenced information from the image.
@Attributes
lat - Latitude (Degrees)
lng - Longitude (Degrees)
alt... |
#JES- Jython Environment for Students
#Copyright (C) 2002 Jason Ergle, Claire Bailey, David Raines, Joshua Sklare
#See JESCopyright.txt for full licensing information
import JESConstants
import java.awt as awt
import java.lang as lang
import javax.swing as swing
ABOUT_TITLE = 'Welcome to JES!'
OK_BUTTON_CAPTION = 'O... |
import math
from functools import lru_cache
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy.optimize import leastsq
from astropy.stats import sigma_clipped_stats
from photutils import DAOStarFinder
from astropy.visualization import SqrtStretch
from astropy.visualization.mpl_norma... |
# -*- coding: utf-8 -*-
def vendas():
vendas = db(Vendas).select(Vendas.id, Vendas.created_on,
Vendas.total, Vendas.cliente,
orderby=~Vendas.created_on)
return dict(vendas=vendas)
def n_venda():
# Cria nova venda ou edita existente
vend... |
def nabeatu(num: int):
if num <= 0:
return False
if num % 3 == 0:
return True
s = str(num)
if '3' in s:
return True
return False
# main
for num in range(0, 401):
if nabeatu(num):
print(num)
|
from ctypes import Structure, c_int, c_byte
_VALUE_BUFFER_SIZE = 256
class action_t(Structure):
_fields_ = [
('action', c_int),
('length', c_int),
('value', c_byte * _VALUE_BUFFER_SIZE)]
class result_action_t(Structure):
_fields_ = [
# If error value contains a message
... |
from django.shortcuts import render, redirect
from my_music_app.demo.forms import CreateAlbumForm, EditAlbumForm, DeleteAlbumForm, CreateProfileForm, \
DeleteProfileForm
from my_music_app.demo.models import Profile, Album
def get_profile():
profile = Profile.objects.all()
if profile:
return profi... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Constants for pygatt Module.
"""
__author__ = 'Greg Albrecht <gba@orionlabs.co>'
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright 2015 Orion Labs'
import logging
LOG_LEVEL = logging.DEBUG
LOG_FORMAT = ('%(asctime)s %(levelname)s %(name)s.%(fu... |
#------------------------------------------------------------------------------
#
# DQN Demo
#
# Author : Igor Janos
#
#------------------------------------------------------------------------------
import gym
import yaml
import numpy as np
import torch
import cv2
from itertools import count
from backstage.model... |
from flask import Flask, request, redirect, g, render_template, make_response, session, url_for
from datetime import datetime, timedelta
from pytz import timezone
import urllib
import urllib.parse
import secrets
import string
import requests
from urllib.parse import urlencode
from api import spotify
app = Flask(__nam... |
'''
Testing parse.py
'''
import os.path
from seqlib.parse import Junc
def test_junc(tmpdir):
junc_bed = tmpdir.join('junc.bed')
junc_bed.write('\t'.join(['chr1', '17045', '17615', 'junc/11', '0', '+',
'17045', '17615', '0,0,0', '2', '10,10',
'0,560'... |
import fnmatch
import logging
import re
import pathlib
logger = logging.getLogger(__name__)
class IgnoreFile:
def __init__(self):
self.matches = []
def parse(self, file, relative='.'):
append_relative = (relative != '.')
for line in file:
if len(line) == 0:
... |
from pyduino import *
import time
board = Arduino('COM10')
pin = 11
board.pinMode(pin, OUTPUT)
while True:
board.digitalWrite(pin, HIGH)
time.sleep(1)
board.digitalWrite(pin, LOW)
time.sleep(1)
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
import random
from datetime import date
import hashlib
from src.File_Manager import *
class Utils():
extension = ['@gmail.com','@hotmail.com','@yahoo.com','@company.com']
extras = ['0','1','2','3','4','5','6','7','8','9']
consonantes = ['B','C','D','F','G','H','J','K',... |
from datetime import datetime
import logging
from pathlib import Path
from sec_certs.dataset import CCDataset
import sec_certs.constants as constants
logger = logging.getLogger(__name__)
def main():
file_handler = logging.FileHandler(constants.LOGS_FILENAME)
stream_handler = logging.StreamHandler()
form... |
# coding: utf-8
# truepy
# Copyright (C) 2014-2020 Moses Palmér
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Th... |
import os
from pyecca.replay import ULogReplay
from pyecca import uros
script_dir = os.path.abspath(os.path.dirname(__file__))
data_dir = os.path.join(script_dir, 'data')
def test_replay():
core = uros.Core()
ULogReplay(core, os.path.join(data_dir, '19_01_20.ulg'))
core.run()
|
"""
@author : ashwek
@date : 15/1/2019
"""
num = list(map(int, input("Enter numbers (space separated) = ").split()))
count = {}
for each in num:
if count.get(each) == None :
count[each] = 1
else:
count[each] += 1
for v,c in count.items():
print("\'" + str(v) + "\' is present " + str(c) + " time(s)")
|
import ml_collections
def get_config():
config = ml_collections.ConfigDict()
config.actor_lr = 3e-4
config.value_lr = 3e-4
config.critic_lr = 3e-4
config.hidden_dims = (256, 256)
config.discount = 0.99
config.expectile = 0.9 # The actual tau for expectiles.
config.temperature = 1.... |
import json
import os
import io
import csv
from dadmatools.datasets.base import BaseDataset, DatasetInfo, BaseIterator
from dadmatools.datasets.dataset_utils import download_dataset, unzip_dataset, is_exist_dataset, DEFAULT_CACHE_DIR
URLS = ['https://raw.githubusercontent.com/dml-qom/FarsTail/master/data/Test-word.csv'... |
from cbastats.GameStats import *
# todo: develop op_plr (player same position, watch there will be starter and sub)
class Player(GameStats):
def __init__(self, name,df):
GameStats.__init__(self,df)
self.__name = name
pass
@property
def plr_name(self):
if self.__name:
... |
# coding: utf-8
import uuid
import re
import json
from ..extractor.common import InfoExtractor
from ..extractor.yahoo import YahooIE as OldYahooIE
from ..compat import (
compat_urlparse,
compat_urllib_parse_urlencode,
)
from ..utils import (
int_or_none,
ExtractorError,
clean_html,
unescapeHTM... |
'''
this is the file which makes other file in the folder to be imported into any other
program works as a package or a module now we dont need to have anything into this file ,still
this will work
now here we are having this code which will ensure that what and how much thing we let the
other program to fetch from ... |
from vowpalwabbit import pyvw
import DistributionallyRobustUnitTestData as dro
import collections
import os
import random
import os
# this test was adapted from this tutorial: https://vowpalwabbit.org/tutorials/cb_simulation.html
class Simulator:
# VW tries to minimize loss/cost, therefore we will pass cost as ... |
import os
from timeit import default_timer
import mamba
import mamba.ast as ast
import mamba.symbol_table
import math
import random
import sys
def substr(s: str, start: int, length: int):
return s[start:start + length]
def str_pos(sub: str, string: str):
return string.index(sub)
def str_format(string, *ar... |
from collections import namedtuple
from leapp.libraries import stdlib
from leapp.libraries.actor import kernelcmdlineconfig
from leapp.libraries.common.config import architecture
from leapp.libraries.common.testutils import CurrentActorMocked
from leapp.libraries.stdlib import api
from leapp.models import InstalledTar... |
from collections import defaultdict
from dataclasses import dataclass
from math import floor
from math import log2
from typing import DefaultDict
from typing import Dict
from typing import Tuple
import pandas as pd
from rich.table import Table
from rich.text import Text
from scipy.special import gammaincc
from coinfl... |
from typing import Dict, Union
import dgl.function
import torch.nn.functional
from pydantic import BaseModel, Field
from typing_extensions import Literal
from nagl.nn import SequentialConfig, SequentialLayers
from nagl.nn.gcn import SAGEConvStack
from nagl.nn.pooling import PoolAtomFeatures, PoolBondFeatures, Pooling... |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright 2017-2019 ARM Ltd.
#
# 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
#
# ... |
from tomso import stars
import numpy as np
import unittest
class TestStarsFunctions(unittest.TestCase):
def test_load_out(self):
summaries, profiles = stars.load_out('data/stars.out')
np.testing.assert_allclose(profiles[0]['H1'], 0.7, atol=1e-9)
np.testing.assert_allclose(profiles[0]['He... |
"""
Copyright 2019 Skyscanner Ltd
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 dis... |
## Imports
import psutil
import distro
import platform
import discord
from app.utils import convert_size
from config import EMBED_COLOR, AUTHOR_DISCORD_NAME
from discord.ext import commands
## Commands
class General(commands.Cog):
def __init__(self, bot, prefix):
self.bot = bot
self.prefix = prefix... |
#!/usr/bin/env python
import argparse
from pathlib import Path
from astropy.time import Time
from scipy.optimize import leastsq
import fitsio
import numpy as np
import textwrap
from . import sdss_paths
try:
from bin import epics_fetch
except ImportError as e:
raise ImportError('Please add ObserverTools/bin to ... |
import logging
import dockercontainer
from icrawl_plugin import IContainerCrawler
from plugins.applications.nginx import nginx_crawler
from utils.crawler_exceptions import CrawlError
logger = logging.getLogger('crawlutils')
class NginxContainerCrawler(IContainerCrawler):
feature_type = 'application'
feature... |
# Copyright (c) 2010-2013 Turbulenz Limited
"""
Controller class for actions pertaining to a specified game
"""
import logging
import os.path
import simplejson as json
from pylons import request, response, tmpl_context as c, config
from pylons.controllers.util import abort
# pylint: disable=F0401
from paste.deploy.... |
# -*- coding: utf-8 -*-
# @Time : 2019-11-18 09:26
# @Author : Jason
# @FileName: setup.py
from setuptools import setup
from setuptools import find_packages
import os
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
if os.path.exists("requirements.txt"):
install_requires ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import re
import inspect
from django.contrib import admin
from django.contrib.admin.views import main
from . import models as mdl
class MyChangeList(main.ChangeList):
def get_query_set(self, request):
# First, we collect all the declared li... |
# Lai Wai Hang, IT01, 06-Aug-2021
from typing import Dict, List
def display_board(
board: List[List[str]],
building_remaining_list: List[str],
building_type_list: List[str],
) -> None:
"""
Display the board and the remaining building.
(Note: Board should be place at the le... |
# -*- coding: utf-8 -*-
# topology.py
# author: Antoine Passemiers
import numpy as np
class Topology:
def __init__(self, n_states):
self.n_states = n_states
self.transition_mask = np.zeros(
(self.n_states, self.n_states), dtype=np.bool)
def add_self_loop(self, src):
... |
# Copyright 2018 Max Shinn <max@maxshinnpotential.com>
#
# This file is part of Paranoid Scientist, and is available under the
# MIT license. Please see LICENSE.txt in the root directory for more
# information.
#__all__ = ['types', 'decorators']
from .types import *
from .decorators import *
from ._version import __... |
# Functions for OCR block identification script
#
import io, json, sys, os, psycopg2, logging, subprocess, swifter, re, dateparser
from glob import glob
from pathlib import Path
from psycopg2.extras import RealDictCursor
from time import localtime, strftime
from fuzzywuzzy import fuzz
import pandas as pd
from datetime... |
import sublime
from Tutkain.api import edn
from Tutkain.src import repl
from Tutkain.src.repl import formatter
from .mock import BabashkaServer
from .util import PackageTestCase
def input(val):
return edn.kwmap({"tag": edn.Keyword("in"), "val": val})
def ret(val):
return edn.kwmap({"tag": edn.Keyword("ret... |
import importlib
module = importlib.import_module("algorithms.0015_3sum")
def test_three_sum():
s = module.Solution()
assert s.threeSum([]) == []
assert s.threeSum([0]) == []
assert s.threeSum([0, 0, 0]) == [[0, 0, 0]]
assert s.threeSum([-1, 0, 1, 2, -1, -4]) == [[-1, -1, 2], [-1, 0, 1]]
asse... |
"""Module for functional data manipulation.
Defines the abstract class that should be implemented by the funtional data
objects of the package and contains some commons methods.
"""
from __future__ import annotations
import warnings
from abc import ABC, abstractmethod
from typing import (
TYPE_CHECKING,
Any,... |
import functools
import json
from typing import Any
from typing import Callable
from typing import Dict
from typing import List
from typing import Optional
from typing import Set
from typing import Type
from django.http.request import HttpRequest
from django.http.response import HttpResponse
from django.http.response ... |
#!/usr/bin/env python3
import sys
import os
import os.path
indir, intype, inaddress = sys.argv[1:]
with open(os.path.join(indir, "_FileInformation.txt"), "w") as writer:
writer.write("\r\n".join(["%s=Type(%s),AuxType(%s),Access(C3)" % (f, intype, inaddress) for f in os.listdir(indir)]))
|
import random
import torch
from mmf.common.sample import Sample, SampleList
from mmf.common.typings import MMFDatasetConfigType
from mmf.datasets.builders.retrieval.datasets import (
CaptionsDatabase,
COCOAnnotationDatabase,
ConceptualCaptionsDatabase,
)
from mmf.datasets.mmf_dataset import MMFDataset
AN... |
from discord.ext import commands
import discord
from resources import checks, support, GLOBAL_DATABASE, colours
from discord.ext.commands import cooldown, BucketType
class command(commands.Cog, name="channel"):
def __init__(self, client):
self.client = client
@checks.log()
@checks.default()
@ch... |
from leapp.actors import Actor
from leapp.messaging.commands import SkipPhasesUntilCommand
from leapp.reporting import Report
from leapp.tags import ChecksPhaseTag, IPUWorkflowTag
class CheckSkipPhase(Actor):
"""
Skip all the subsequent phases until the report phase.
The phases that follow after the Chec... |
# -*- coding: utf-8 -*-
"""Card view instance with more information about each instance.
Instances are grouped under groups. Groups are defined by `creator_label`
attribute on instance (Group defined by creator).
Only one item can be selected at a time.
```
<i> : Icon. Can have Warning icon when context is not right... |
"""
This script is deployed as Google Cloud Function.
It allows to scale-up the citation metadata extraction process.
This script also utilizes multiple PubMed API Keys, to scale-up the number of API
calls that can be made per second. Plesae make sure the API Keys included are
valid before executing this script.
"""
f... |
from .config import Config
from .visualization.plot_images_grid import plot_images_grid
from .misc import enumerate_discrete, log_sum_exp, binary_cross_entropy
|
# Copyright 2021, Red Hat, 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 writin... |
from flask import current_app as app
from flask import render_template, url_for, redirect, request, flash, make_response
from .models import User, Tweet, db, T_User, T_Tweet
from app.Services.twitter_service import twitter_api_client
from app.Services.basilica_service import basilica_api_client
@app.route('/', methods... |
from translators import apis # type: ignore
from md_translate import const
from md_translate.exceptions import UnknownServiceError
def get_translator_by_service_name(service_name: str) -> apis.Tse:
translator_class = const.TRANSLATOR_BY_SERVICE_NAME.get(service_name)
if translator_class is None:
rai... |
class ActivationFunction(object):
def __init__(self, fn, derivative):
self.fn = fn
self.derivative = derivative |
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
# Guillaume Favelier <guillaume.favelier@gmail.com>
#
# License: Simplified BSD
import numpy as np
from ...utils import warn
class _LinkViewer(object):
"""Class to link multiple Brain objects."""
... |
import os
import sys
import gc
import datetime
import pandas as pd
import numpy as np
from copy import deepcopy
from tqdm import tqdm
import cv2
import matplotlib
matplotlib.use('Agg') # For using matplot in server
import matplotlib.pyplot as plt
from matplotlib.ticker import NullFormatter
from IPython.display import... |
def number(the_number, arg):
return arg[0](the_number, arg[1]) if arg else the_number
def zero (arg = None): return number(0, arg)
def one (arg = None): return number(1, arg)
def two (arg = None): return number(2, arg)
def three(arg = None): return number(3, arg)
def four (arg = None): return number(4, arg)
def... |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'Glossary.ui'
##
## Created by: Qt User Interface Compiler version 6.2.3
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##################... |
import operator
from typing import List
import sqlalchemy
from sqlalchemy.dialects.postgresql.base import UUID
from sqlalchemy.sql.expression import cast
from pepys_import.core.store.data_store import DataStore
from pepys_import.utils.sqlalchemy_utils import UUIDType, get_primary_key_for_table
from pepys_import.utils... |
from utils import parse_input
DAY = 3
def b2d(binary_str, exp=0):
if len(binary_str) == 1:
return 2 ** exp * int(binary_str)
return 2 ** exp * int(binary_str[-1]) + b2d(binary_str[:-1], exp + 1)
def part1(data):
gamma = ''.join(
['0' if sum([int(binary_num[bit_idx]) for binary_num in... |
#!/usr/bin/env python
"""
cexbot.cexapi
"""
import requests
import requests.exceptions
import hmac
import hashlib
import json
import logging
from time import time
class CexAPI(object):
CEX_API_BASE = 'https://cex.io/api'
# format is (URI, private, required params)
api_methods = {
'ticker': ('/ticker/GHS... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 27 20:09:31 2022
@author:Jinyu-Sun
"""
import timeit
import sys
import numpy as np
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import pickle
from sklearn.metrics import roc_auc_score, roc_curve
from sklearn.m... |
import scrapy
import json
class RussianAlphabetSpider(scrapy.Spider):
name = "quotes"
start_urls = [
'https://www.russianforeveryone.com/',
]
def parse(self, response):
alphabets_urls = response.xpath('//a[contains(.,"alphabet")]')
yield from response.follow_all(alphabets_urls... |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is govered by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Unit tests for issuelist module."""
import mox
import unittest
import time
from google.appe... |
"""This module contains functionality to represent traces as different graph models."""
import os
import sys
sys.path.append("../features")
from abc import ABC, abstractmethod
import numpy as np
import trace_pre_processing as tpp
import pandas as pd
class AbstractTraceGraphModel(ABC):
"""
Abstract class provid... |
def get_file_data_and_column_styles():
return ([{'cells': ['head 1', 'head 2'], 'meta': {'name': 'header'}},
{'cells': ['data 1.1', 'data 1.2'], 'meta': {'name': 'row-1'}},
{'cells': ['data 2.1', 'data 2.2'], 'meta': {'name': 'row-2',
... |
from typing import Any, List, Literal, TypedDict
from .FHIR_decimal import FHIR_decimal
from .FHIR_Element import FHIR_Element
from .FHIR_string import FHIR_string
# Details and position information for a physical place where services are provided and resources and participants may be stored, found, contained, or acc... |
import unittest
from wildpath.tools import flatten
class TestTools(unittest.TestCase):
def test_flatten_string_items(self):
L = [["a", "b"], ["c", "d"], ["e", "f", "g"]]
self.assertEqual(flatten(L, depth=1), ['a', 'b', 'c', 'd', 'e', 'f', 'g']) |
"""
Upgrading Euler method to 4th-order Runge-Kutta
for 2nd-order ODEs
Srayan Gangopadhyay
2020-05-17
"""
import numpy as np
import matplotlib.pyplot as plt
"""
y' = dy/dx
For a function of form y'' = f(x, y, y')
Define y' = v so y'' = v'
"""
def func(x, y, v): # RHS of v' = in terms of x, y, v
return -y
# PAR... |
class MongoRestException(Exception):
def __init__(self, message):
self._message = message
def _get_message(self):
return self._message
def _set_message(self, message):
self._message = message
message = property(_get_message, _set_message)
class OperatorNotAllowed(MongoRestEx... |
from unittest import mock
from django.conf import settings
from django.http.cookie import SimpleCookie
from rest_framework.test import APITestCase
from rest_framework_simplejwt.exceptions import TokenError
from rest_framework_simplejwt.serializers import TokenObtainSerializer
from core.models import User
class Toke... |
# coding: utf-8
"""
IIMMPACT API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2020-09-14T13:01:14Z
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_i... |
import datetime
import functools
import importlib
import json
import os
import pathlib
import typing
from dataclasses import dataclass
from typing import cast
import click
from dataclasses_json import DataClassJsonMixin
from pytimeparse import parse
from flytekit import BlobType, Literal, Scalar
from flytekit.clis.sd... |
# -*- coding: utf-8 -*-
"""Early Stopping HPO Experiment."""
from pykeen.pipeline import pipeline
from pykeen_playtime.countries import Countries
from pykeen_playtime.utils import GridType, Runner, fix_logging
GRID: GridType = dict(
dataset=[Countries.get_normalized_name()],
model=['transe', 'complex', 'rota... |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for reraiser_thread.py."""
import threading
import unittest
import reraiser_thread
import watchdog_timer
class TestException(Exception):
p... |
# -- encoding:utf-8 --
import numpy as np
import tensorflow as tf
from tensorflow.contrib import slim
from nets.metric import Metrics
from nets import base_model
class Network(base_model.Network):
def __init__(self, with_word2vec=False, vocab_size=None, embedding_dimensions=None,
... |
# -*- coding: utf-8 -*-
import time
import random
import gevent
import zmq.green as zmq
TIME_OUT = 5000
WAITE_TIME = 10
CONSULT_CLIENT_NUM = 20
CONSULT_CLIENT_BUSY = []
CONSULT_CLIENT_DICT = {}
PLAN_CLIENT_NUM = 20
PLAN_CLIENT_BUSY = []
PLAN_CLIENT_DICT = {}
class Client:
msg_id = -1
def __init__(self,... |
import copy
import logging
from datetime import datetime
from typing import Dict, List, Optional, Union, NamedTuple
from attr import dataclass
from pandas import DataFrame
from grafener.logging_config import init_logging
from grafener.source import Source
init_logging()
class DataFrameCacheValue(NamedTuple):
"... |
from terrabot.events.events import Events
import logging
class Packet37Parser(object):
def parse(self, world, player, data, ev_man):
logging.debug("Received packet 37 (login password requested)")
ev_man.raise_event(Events.PasswordRequested, None)
|
import libnacl
import didery.crypto.eddsa
try:
import simplejson as json
except ImportError:
import json
from copy import deepcopy
from didery.db import dbing
from didery.help import helping as h
from tests.testing_utils.mocks.db.dbing import DBMock
DB_DIR_PATH = "/tmp/db_setup_test"
SK = b"\xb3\xd0\xbdL]\x... |
"""
History repository.
"""
from typing import Any
from project.utils import database_utils
from project.entities.history_entity import HistoryEntity
def insert(entity: HistoryEntity) -> Any:
"""
Insert a new history and return its id.
"""
sql = '''
INSERT INTO history
(context, table_... |
# Copyright (c) 2010-2011 Christopher D. Lasher
#
# This software is released under the MIT License. Please see
# LICENSE.txt for details.
"""Contains miscellaneous statistical tests and tools."""
# Configure all the logging stuff
import logging
logger = logging.getLogger('bpn.statstools')
logger.setLevel(logging.DEB... |
"""Module defining the script rules for Greek."""
separator = ' '
|
import logging
import django_tables2 as tables
import numpy as np
from django.core.urlresolvers import reverse_lazy
from django.db.utils import OperationalError
from table import Table
from table.columns import Column, LinkColumn, Link
from table.utils import Accessor
from django.utils import safestring
from standard... |
import os
import numpy as np
from functools import partial
import inspect
import time
import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH
from dev_submission.models import *
from dev_submission.models.helpers import build_model_with_cfg
from ingestion_program.nascomp.helpers import load_datasets
from ... |
import os
import glob
import time
import subprocess
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
def read_temp_raw():
catdata = subprocess.Popen(['cat',device_file], stdout=s... |
# ------------------------------------------------------------------------------
# File: observabledict.py
# Author: Remi Emonet
# Date: 8/2019
# Source: https://github.com/twitwi/vuejs-python/tree/master/vuejspython/observablecollections
# License: MIT
# -----------------------------------------------------------... |
import argparse
from typing import List
import torch
import numpy as np
from annoy import AnnoyIndex
from code_search import shared, utils
from code_search.torch_utils import np_to_torch, torch_gpu_to_np, get_device
from code_search.data_manager import DataManager, get_base_languages_data_manager
from code_search.mod... |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'interfaceSAPqGK.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
##... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.