filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_27967
import datetime import tensorflow as tf from tensorflow import keras from tensorflow.keras.callbacks import TensorBoard, LearningRateScheduler from tensorflow.keras.layers import GlobalMaxPooling2D, Dense, Dropout from tensorflow.keras.models import Model from tensorflow.keras.layers import Input, Conv2D, Dense, Flatt...
the-stack_106_27968
# -*- coding: utf-8 -*- import calendar from bson import ObjectId from datetime import datetime from modularodm import fields, Q from framework.mongo import StoredObject from framework.guid.model import GuidStoredObject from website.settings import DOMAIN from website.util import web_url_for, api_url_for from websi...
the-stack_106_27969
#!/usr/bin/env python """ Read the contents of the "show_arp.txt" file. Using a for loop, iterate over the lines of this file. Process the lines of the file and separate out the ip_addr and mac_addr for each entry into a separate variable. Add a conditional statement that searches for '10.220.88.1'. If 10.220.88.1 is ...
the-stack_106_27970
"""A CRFSuite-based mention annotator.""" import pickle import time from pathlib import Path from typing import IO, Dict, Iterable, List, Optional, Sequence, Union from attr import attrib, attrs from attr.validators import instance_of from nerpy.annotator import SequenceMentionAnnotator from nerpy.document import Doc...
the-stack_106_27972
""" Implementation of "Attention is All You Need" """ import os import random from typing import Any, Dict, List, Optional, Tuple import fairseq import torch.nn as nn import torch from fairseq.models.bart import BARTModel from onmt.encoders.encoder import EncoderBase import logging class BARTEncoder(EncoderBase): ...
the-stack_106_27977
# -*- coding: utf-8 -*- # file: checkpoint_manager.py # time: 2021/6/11 0011 # author: yangheng <yangheng@m.scnu.edu.cn> # github: https://github.com/yangheng95 # Copyright (C) 2021. All Rights Reserved. import json import os import sys import zipfile from autocuda import auto_cuda from findfile import find_files, fin...
the-stack_106_27979
# Copyright 2018 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 writing, s...
the-stack_106_27980
# Copyright 2019 Intelligent Robotics Lab # # 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...
the-stack_106_27985
# Copyright 2017 Lenovo, 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...
the-stack_106_27986
import sys import threading import time from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.chrome.options import Options from PyQt5 import QtWidgets, QtGui, QtCore class SeleniumManager(QtCore.QObject): started = QtCore.pyqtSignal() finished = QtCore.pyqtS...
the-stack_106_27988
import os import nni import csv import json import time import warnings import argparse import torch import torch.nn.functional as F from torch.utils.data import DataLoader from utils import * from model import get_model from dataset import load_data warnings.filterwarnings("ignore", category=Warning) device = torch...
the-stack_106_27990
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
the-stack_106_27991
from __future__ import unicode_literals import json import re import os import subprocess from collections import OrderedDict from distutils.spawn import find_executable from functools import partial from itertools import chain from typing import Text, Iterable, Union, Dict, Set, Sequence, Any import six import yaml ...
the-stack_106_27992
import time import torch from lib.Utility.metrics import AverageMeter from lib.Utility.metrics import accuracy def train(dataset, model, criterion, epoch, optimizer, lr_scheduler, device, args): """ Trains/updates the model for one epoch on the training dataset. Parameters: train_loader (torch.uti...
the-stack_106_27993
from typing_extensions import Final from opentrons.hardware_control.emulation.settings import ( Settings, SmoothieSettings, PipetteSettings ) from g_code_test_data.g_code_configuration import ProtocolGCodeConfirmConfig import pytest ################### # Shared Settings # ################### SWIFT_SMOOTHIE_SETT...
the-stack_106_27994
# Copyright The PyTorch Lightning team. # # 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 i...
the-stack_106_27995
#!/usr/bin/python #-*- coding: utf-8 -*- # (c) 2013, Yeukhon Wong <yeukhon@acm.org> # (c) 2014, Nate Coraor <nate@bx.psu.edu> # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_M...
the-stack_106_27997
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to us...
the-stack_106_27999
from freilanz.logging import logger from freilanz.helper import FREILANZ_ROOT_DIR, make_dir, CONFIG_FILE_NAME from freilanz.config import init_base_config log = logger(__name__) def init(click, *args, **kwargs): log.info('start init process') click.echo('Starting initializing process') root_dir = FREILANZ...
the-stack_106_28004
import types from collections import deque, namedtuple from pycsp3.classes.entities import Node, TypeNode from pycsp3.classes.main.constraints import ( ScalarProduct, PartialConstraint, ConstraintSum, ConstraintElement, ConstraintElementMatrix, ConstraintInstantiation, ECtr, auxiliary) from pycsp3.classes.main.var...
the-stack_106_28005
import argparse import json import requests import stix2 def get_data_from_branch(domain, branch="master"): dest = "https://raw.githubusercontent.com/" \ "mitre/cti/{}/{}/{}" \ ".json".format(branch, domain, domain) stix_json = requests.get(dest).json() return stix2.MemoryStore(stix_data=s...
the-stack_106_28006
# coding=utf-8 # Copyright 2019 The TensorFlow Datasets Authors. # # 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...
the-stack_106_28009
import os import sys from typing import List from urllib.parse import urlparse import cv2 import numpy as np import torch from torch.hub import download_url_to_file, get_dir def get_cache_path_by_url(url): parts = urlparse(url) hub_dir = get_dir() model_dir = os.path.join(hub_dir, "checkpoints") if n...
the-stack_106_28010
from django.apps import AppConfig from django.db.models.signals import post_save, pre_delete def save_symmetric_lexical_similarity(sender, instance, created, raw, **kwargs): if raw: return if created: # Create the reflexive similarity, avoiding infinite recursion ls = sender( ...
the-stack_106_28013
########################################################### ########################################################### ### Created on Wed May 24 11:27:54 2017 ### ### Updated on Thu May 25 13:36:15 2017 ### ### By Samuel Low ### ### Atmospheric D...
the-stack_106_28015
import math from animator import basic_func, objects def bernstein_basis(k, n): return lambda x: math.comb(n, k)*x**k*(1-x)**(n-k) def bernstein(foo, n): return lambda x: sum([foo(k/n)*bernstein_basis(k, n)(x) for k in range(1, n+1)]) def generate_frame(n, generate_png=False, foo=lambda x: 0 if x == 0 el...
the-stack_106_28020
#!/usr/bin/env python3 # 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, softwar...
the-stack_106_28022
"""Class to perform under-sampling using balace cascade.""" # Authors: Guillaume Lemaitre <g.lemaitre58@gmail.com> # Christos Aridas # License: MIT from collections import Counter import numpy as np from sklearn.base import ClassifierMixin from sklearn.neighbors import KNeighborsClassifier from sklearn.uti...
the-stack_106_28025
# Copyright [2021] Luis Alberto Pineda Cortés, # Rafael Morales Gamboa. # # 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 b...
the-stack_106_28026
from flask import Flask, request from flask_restful import Resource, Api from datetime import datetime from uuid import uuid4 from logger import Logger from models.advanced import from_files as advanced_from_files from models.basic import from_file as basic_from_file basic_recommender_fp = "../models/basic/recommendat...
the-stack_106_28028
# Written by: Nick Gerend, @dataoutsider # Viz: "", enjoy! import pandas as pd import numpy as np import os from datetime import datetime from math import pi, cos, sin, sqrt, exp def circle(diam, points): x = [] y = [] path = [] angle = 0. path_i = 1 for i in range(points): x.append(di...
the-stack_106_28029
import sys sys.path.append('../tytus/parser/team27/G-27/execution/abstract') sys.path.append('../tytus/parser/team27/G-27/execution/symbol') sys.path.append('../tytus/parser/team27/G-27/execution/querie') sys.path.append('../tytus/storage') from querie import * from environment import * from typ import * from add_colu...
the-stack_106_28031
import os import sys import mxnet as mx from random import shuffle import numpy as np def patch_path(path): return os.path.join(os.path.dirname(__file__), path) def main(): sys.path.append(patch_path('..')) output_dir_path = patch_path('output') model_dir_path = patch_path('models') from mxnet_...
the-stack_106_28034
# Python implementation of the MySQL client-server protocol # http://dev.mysql.com/doc/internals/en/client-server-protocol.html # Error codes: # https://dev.mysql.com/doc/refman/5.5/en/error-handling.html import errno import os import socket import struct import sys import traceback import warnings from . import _auth...
the-stack_106_28035
import os import requests class FBProfileBuilder: def __init__(self, userId, stateService): self.userId = userId self.stateService = stateService def _get_user_info(self): """ Get facebook user info for profile building :returns: user info :rtype: json/dictionary """ URL = 'https...
the-stack_106_28037
#!/usr/bin/env python3 # # O.MG Cable firware extraction and analysis tool # Copyright (C) 2021 Kevin Breen, Immersive Labs # https://github.com/Immersive-Labs-Sec/OMG-Extractor # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "S...
the-stack_106_28041
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import mmcv import numpy as np import torch.multiprocessing as mp from mmaction.localization import (generate_bsp_feature, generate_candidate_proposals) def load_video_infos(ann_file): ...
the-stack_106_28042
"""Support remote entity for Xiaomi Miot.""" import logging import time from functools import partial from homeassistant.const import * # noqa: F401 from homeassistant.components import remote from homeassistant.components.remote import ( DOMAIN as ENTITY_DOMAIN, RemoteEntity, ) from miio.chuangmi_ir import ...
the-stack_106_28044
# -*- coding: utf-8 -*- import re import subprocess from collections import namedtuple from typing import Any from typing import Optional from poetry.core.utils._compat import PY36 from poetry.core.utils._compat import WINDOWS from poetry.core.utils._compat import Path from poetry.core.utils._compat import decode p...
the-stack_106_28045
from mongoengine.errors import FieldDoesNotExist def serializable_value(self, field_name): """ Returns the value of the field name for this instance. If the field is a foreign key, returns the id value, instead of the object. If there's no Field object with this name on the model, the model attribute's...
the-stack_106_28046
import threading import discord import json import os import async_cleverbot as ac import cogs from discord.ext import commands import os import aiozaneapi import asyncio from datetime import datetime import aiosqlite from discord.ext.buttons import Paginator from helpe import Help from asyncdagpi import Client import ...
the-stack_106_28048
# -*- coding: utf-8 -*- """ MIT License Copyright (c) 2019-2020 Terbau 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, ...
the-stack_106_28049
#!/usr/bin/env python3 import os import numpy as np from common.realtime import sec_since_boot from common.numpy_fast import clip, interp from selfdrive.swaglog import cloudlog from selfdrive.modeld.constants import index_function from selfdrive.controls.lib.radar_helpers import _LEAD_ACCEL_TAU from selfdrive.config i...
the-stack_106_28050
#!/usr/bin/env python3 # coding: utf-8 # # Copyright (C) 2020 The SymbiFlow Authors. # # Use of this source code is governed by a ISC-style # license that can be found in the LICENSE file or at # https://opensource.org/licenses/ISC # # SPDX-License-Identifier: ISC import re def get_scale_fs(timescale): """Conve...
the-stack_106_28052
import numpy as np from ..objects import ServerDataSource try: import scipy import scipy.misc except ImportError as e: print(e) def source(**kwargs): kwargs['transform'] = {'resample':'heatmap'} kwargs['data'] = {'x': [0], 'y': [0], 'gl...
the-stack_106_28054
import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mdates from mpl_finance import candlestick_ohlc from statsmodels.tsa.stattools import adfuller from statsmodels.tsa.arima_model import ARIMA def load_csv_with_dates(file): ''' Loads csv files with first column dat...
the-stack_106_28056
# -*- coding: utf-8 -*- ''' Tools for Web Flayer ''' # Python import os import re import sys import time import random import pprint import urllib # 3rd party import requests from termcolor import colored import psycopg2 from psycopg2.extras import Json from bs4 import BeautifulSoup # Internal import flayer.event c...
the-stack_106_28059
"""Unit test for user usage.""" import os from unittest import TestCase import requests_mock from src.app import send_usage_statistics class TestUserUsage(TestCase): """Unit test class to test method send_user_usage.""" TEST_URL = 'https://test.zalan.do' @requests_mock.Mocker() def ...
the-stack_106_28060
from past.builtins import basestring from django.db.models.signals import post_delete, post_save from django.http import Http404, HttpResponseBadRequest from celery.result import AsyncResult from rest_framework import status from rest_framework.decorators import action from rest_framework.exceptions import ParseError...
the-stack_106_28063
# Configuration file for the Sphinx_PyAEDT documentation builder. # -- Project information ----------------------------------------------------- import sys import os import pathlib import warnings import pyvista import numpy as np import json from sphinx_gallery.sorting import FileNameSortKey local_path = os.path.d...
the-stack_106_28067
import os # 環境変数を設定する為に、 os モジュールをインポート import sys from PySide2.QtWidgets import QApplication from PySide2.QtQml import QQmlApplicationEngine from PySide2.QtCore import QUrl def main(): """ 環境変数に Qt Quick Controls 2 のコンフィグファイル設定 を追加する 環境変数 QT_QUICK_CONTROLS_CONF に対して、本 Code と同じ ディレクトリにある qtquickcon...
the-stack_106_28068
"""This module contains rules for the network genrules.""" load("//lib/bazel:c_rules.bzl", "makani_c_library") # This is a genrule for files that use network.yaml as a source. def makani_network_genrule(**kwargs): kwargs["cmd"] = " ".join([ "$(location %s) --autogen_root=$(GENDIR)" % kwargs["tools"][0], ...
the-stack_106_28069
def add_node(v): global node_count if v in nodes: print("Node already exists") else: node_count+=1 nodes.append(v) for n in graph: n.append(0) temp=[] for i in range(node_count): temp.append(0) graph.append(temp) def ...
the-stack_106_28070
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
the-stack_106_28071
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
the-stack_106_28073
# MIT License # # Copyright (C) IBM Corporation 2018 # # 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...
the-stack_106_28075
from aiohttp.test_utils import unittest_run_loop from OpenCast.app.command import playlist as PlaylistCmd from OpenCast.app.notification import WSResponse from OpenCast.domain.event import playlist as PlaylistEvt from OpenCast.domain.service.identity import IdentityService from .util import MonitorControllerTestCase ...
the-stack_106_28076
# Copyright 2020 kubeflow.org. # # 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,...
the-stack_106_28077
import unittest import rocksdbpy import shutil import tempfile from rocksdbpy import WriteBatch class TestIterator(unittest.TestCase): def setUp(self): self.temp = tempfile.mkdtemp() wb = WriteBatch() # add couple of keys and values wb.add(b'test_add_1', b'test_value') wb...
the-stack_106_28079
import torch from torch import nn from transformers import AutoModel class JointXLMR(nn.Module): def __init__(self, model_config, device, slot_dim, intent_dim, intent_weight=None): super(JointXLMR, self).__init__() self.slot_num_labels = slot_dim self.intent_num_labels = intent_dim ...
the-stack_106_28080
# https://realpython.com/beautiful-soup-web-scraper-python/ # Why i didnt stumble open this website a lot more earlier arg! - need to review this subject for sure! from splinter import Browser from selenium import webdriver from bs4 import BeautifulSoup as bs import pandas as pd import requests import time from flask...
the-stack_106_28081
# # MIT License # # (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP # # 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...
the-stack_106_28084
import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand requires = ['click', 'google-api-python-client', 'oauth2client'] tests_requires = ['pytest', 'pytest-cache', 'pytest-cov'] lint_requires = ['flake8', 'black'] dev_requires = requires + tests_requires + lint_...
the-stack_106_28085
""" Tiered shipping models """ from __future__ import unicode_literals import datetime import logging import operator from six.moves import reduce from six import python_2_unicode_compatible from decimal import Decimal from django.conf import settings from django.db import models from django.utils.translation import g...
the-stack_106_28086
# Copyright 2018 The Cirq Developers # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in ...
the-stack_106_28087
#!/usr/bin/env python3 import json from gimme.api import GimmeRequest, GimmeCall from gimme.auth import GimmeAuth class Gimme(object): def __init__(self, auth_token): self.auth_token = auth_token def request(self, check_sucsess=True, **kwargs): req = GimmeRequest(self.auth_token, **kwargs)...
the-stack_106_28089
import argparse import json import logging import sys import random as rand import numpy as np import experiments from experiments import plotting from datetime import datetime from data import loader # Configure logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(messa...
the-stack_106_28091
""" 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 argparse import pathlib class Args(argparse.ArgumentParser): """ Defines global default arguments. """ def __init__...
the-stack_106_28093
import json import uuid import numpy as np import pandas as pd from vgn.grasp import Grasp from vgn.perception import * from vgn.utils.transform import Rotation, Transform def write_setup(root, size, intrinsic, max_opening_width, finger_depth): data = { "size": size, "intrinsic": intrinsic.to_di...
the-stack_106_28094
import logging import random import signal import habitat from habitat.profiling.operation import OperationProfiler from database import Recorder logger = logging.getLogger(__name__) class Measurer: def __init__( self, op_name, recorder_config, index_to_config, config_to_...
the-stack_106_28095
from scipy.stats import beta def beta_pdf(a, b, values): probs = [] start = 0 for idx in range(len(values) - 1): end = values[idx] + (values[idx + 1] - values[idx]) / 2 w = end - start pdf = beta.pdf(values[idx], a, b).item() probs.append(pdf * w) start = end ...
the-stack_106_28098
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 """Lambda function to reserve available CIDR blocks""" import os import logging import traceback from utils import cidr_lookups, cidr_lock from utils.cidr_lookups import InputValidationError, NoValidSubnetError, Inval...
the-stack_106_28099
import os import random import argparse import numpy as np from sklearn.preprocessing import StandardScaler import joblib import tensorflow as tf from tensorflow import keras as K import gym from fn_framework import FNAgent, Trainer, Observer, Experience tf.compat.v1.disable_eager_execution() #########################...
the-stack_106_28101
# Copyright 2020 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 writing, ...
the-stack_106_28103
import os import discord import aiohttp import random import time import rethinkdb as r from discord.ext import commands from collections import Counter from datetime import datetime from pyfiglet import Figlet from config import database, prefixes, token, webhooks def _prefixes(bot, msg): return commands.when_m...
the-stack_106_28104
from .util import * from .query_result import QueryResult class Graph(object): """ Graph, collection of nodes and edges. """ def __init__(self, name, redis_con): """ Create a new graph. """ self.name = name self.redis_con = redis_con self.nodes = {} ...
the-stack_106_28109
import re import os import shutil rxDiacritics = re.compile('[ëç]') rxDiaPartsStem = re.compile('( stem:)( *[^\r\n]+)') rxDiaPartsFlex = re.compile('(-flex:)( *[^\r\n]+)') rxStemVariants = re.compile('[^ |/]+') rxFlexVariants = re.compile('[^ /]+') dictDiacritics = {'ë': 'e', 'ç': 'c'} def collect_lemmata(): lem...
the-stack_106_28112
#!/usr/bin/env python # -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2016 Ivo Tzvetkov # # 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 wit...
the-stack_106_28113
# # The ndarray object from _testbuffer.c is a complete implementation of # a PEP-3118 buffer provider. It is independent from NumPy's ndarray # and the tests don't require NumPy. # # If NumPy is present, some tests check both ndarray implementations # against each other. # # Most ndarray tests also check that memoryvi...
the-stack_106_28115
from __future__ import unicode_literals from django import forms from django.forms import ModelForm # Import from Models from .models import bug, folder, group, tag, User, change_task, customer, kanban_column, kanban_level, tag_assignment,\ kanban_card, kanban_board, permission_set, project, request_for_change, re...
the-stack_106_28116
# import necessary packages import tensorflow as tf from sklearn.preprocessing import LabelBinarizer from tensorflow.compat.v1 import ConfigProto from tensorflow.compat.v1 import InteractiveSession from tensorflow.keras.applications.densenet import DenseNet169 from tensorflow.keras.callbacks import CSVLogger, T...
the-stack_106_28119
#!/usr/bin/python # -*- coding: utf-8 -*- """ Program to (re)categorize images at commons. The program uses commonshelper for category suggestions. It takes the suggestions and the current categories. Put the categories through some filters and adds the result. The following command line parameters are supported: -o...
the-stack_106_28120
"""The example shows you how to convert all Earth Engine Python scripts in a GitHub repo to Jupyter notebooks. """ import os from geemap.conversion import * import subprocess try: from git import Repo except ImportError: print('gitpython package is not installed. Installing ...') subprocess.check_call(["...
the-stack_106_28121
from ulauncher.api.client.Extension import Extension from ulauncher.api.client.EventListener import EventListener from ulauncher.api.shared.event import KeywordQueryEvent, ItemEnterEvent from ulauncher.api.shared.item.ExtensionResultItem import ExtensionResultItem from ulauncher.api.shared.action.RenderResultListAction...
the-stack_106_28123
# -*- coding: utf-8 -*- """ remarks: commonly used functions related to intervals NOTE: `Interval` refers to interval of the form [a,b] `GeneralizedInterval` refers to some (finite) union of `Interval`s TODO: 1. unify `Interval` and `GeneralizedInterval`, by letting `Interval` be of the form [[a,b]] 2....
the-stack_106_28126
def _fromUtf8(s): return s import math from shutil import * from PyQt4.QtGui import * from PyQt4.QtCore import * from PyQt4 import QtCore, QtGui from PyQt4.phonon import Phonon from pydub import AudioSegment from main_const import * class ProcessAudioFiles(QThread): def __init__(self, listofaudiofiles): ...
the-stack_106_28127
'''Runs all tests for the coleco emulator''' import sys import unittest def main(): '''update the path to point to the coleco packages and run all tests''' # update the path sys.path.append('../') # find all of the tests to run discovered_suite = unittest.TestLoader().discover('.', pattern='tes...
the-stack_106_28128
from lbworkflow.views.generics import CreateView, UpdateView, WFListView from .forms import SimpleWorkFlowForm from .models import SimpleWorkFlow class SimpleWorkFlowCreateView(CreateView): form_classes = { "form": SimpleWorkFlowForm, } def get_initial(self, form_class_key): return {"con...
the-stack_106_28129
#!/usr/bin/env python """ Neural SPARQL Machines - Filter dataset by a given criterion. 'SPARQL as a Foreign Language' by Tommaso Soru and Edgard Marx et al., SEMANTiCS 2017 https://arxiv.org/abs/1708.07624 Version 1.0.0 """ import argparse import collections import json import os import sys from generator_utils i...
the-stack_106_28130
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
the-stack_106_28131
import time import argparse import numpy as np import random import torch import torch.nn.functional as F from utils import load_data, load_rand_split_data, accuracy from model import GCN # hyper-params dataset = 'citeseer' # Citeseer or cora seed = 24 # Random seed hidden = 16 # Number of hidden units dropout = 0.5...
the-stack_106_28132
from functools import partial from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QInputDialog, QLabel, QVBoxLayout, QLineEdit from electrum.i18n import _ from electrum.plugin import hook from electrum.wallet import Standard_Wallet from electrum.gui.qt.util import WindowModalDialog from .ledger import Le...
the-stack_106_28133
# coding=utf-8 # Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from textwrap import...
the-stack_106_28134
import election num_candidates = 150 num_spots = 25 num_voters = 50 # dataset.make_dataset(num_candidates, num_spots, num_voters) # name = "out.csv" # #name = "custom.csv" # elect = election.Election(num_candidates, name) # ret, extras = elect.run_election() # print(ret) # print(len(ret)) # print(extras) ### num...
the-stack_106_28136
import uuid from unittest.mock import patch import pytest import s3fs from rubicon import domain from rubicon.repository import S3Repository from rubicon.repository.utils import slugify def test_initialization(): s3_repo = S3Repository(root_dir="s3://bucket/root") assert s3_repo.PROTOCOL == "s3" assert...
the-stack_106_28138
""" Example demonstrating how to write Schema and Cred Definition on the ledger As a setup, Steward (already on the ledger) adds Trust Anchor to the ledger. After that, Steward builds the SCHEMA request to add new schema to the ledger. Once that succeeds, Trust Anchor uses anonymous credentials to issue and store cla...
the-stack_106_28139
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import requests import base64 import os import json # Disable insecure warnings requests.packages.urllib3.disable_warnings() ''' GLOBAL VARS ''' DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ' # Well known folder...
the-stack_106_28140
#!/usr/bin/python ''' Extract _("...") strings for translation and convert to Qt4 stringdefs so that they can be picked up by Qt linguist. ''' from subprocess import Popen, PIPE import glob import operator import os import sys OUT_CPP="qt/folstrings.cpp" EMPTY=['""'] def parse_po(text): """ Parse 'po' format ...
the-stack_106_28141
from pyspider.libs.base_handler import * class Handler(BaseHandler): crawl_config = { } @every(minutes=24 * 60) def on_start(self): self.crawl('http://scrapy.org/', callback=self.index_page) @config(age=10 * 24 * 60 * 60) def index_page(self, response): for each in response.do...
the-stack_106_28144
from thrift.protocol import TCompactProtocol from thrift.transport import THttpClient from ttypes import LoginRequest import json, requests, LineService nama = 'Aditmadzs' Headers = { 'User-Agent': "Line/2.1.5", 'X-Line-Application': "CHROMEOS\t2.1.5\t"+nama+"\t11.2.5", "x-lal": "ja-US...