content stringlengths 0 894k | type stringclasses 2
values |
|---|---|
from collections import Counter
def answer(q,inf):
s = Counter(q.split(' ')); r = [-1,-1]
for i,j in enumerate(inf):
check = sum(s.get(w,0) for w in j.split(' '))
if check != 0 and check > r[1]: r = [i,check]
return None if r == [-1,-1] else inf[r[0]]
| python |
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from ..core.widget import set_contents_margins
class QXVBoxLayout(QVBoxLayout):
def __init__(self, widgets=None, contents_margins=0, spacing=0):
super().__init__()
set_contents_margins(self, contents_margins)... | python |
# input_text = 'R5, L5, R5, R3'
input_text = open('input1.txt').read()
dir_x, dir_y = (0, 1) # North
dest_x, dest_y = (0, 0)
for step in input_text.split(', '):
side = step[0]
distance = int(step[1:])
if side == 'R':
dir_x, dir_y = dir_y, -dir_x
else:
dir_x, dir_y = -dir_y, dir_x
d... | python |
"""
Import from other sources to database.
"""
| python |
import itertools
from datetime import datetime
import requests
import rdflib
import os
import pandas as pd
from SPARQLWrapper import SPARQLWrapper, TURTLE, JSON, POST
# -----------------------------------------------------------------------------
def addTestData(target, loadConfig):
"""This function reads the test d... | python |
# -*- coding: utf-8 -*-
# Copyright (c) 2011 Plivo Team. See LICENSE for details
import base64
import re
import uuid
import os
import os.path
from datetime import datetime
import urllib
import urllib2
import urlparse
import traceback
import redis
import redis.exceptions
import flask
from flask import request
from wer... | python |
from rest_framework.response import Response
from resumes.serializers import BasicSerializer, ProfileSerializer, ResumeSerializer, VolunteerSerializer, WorkSerializer
from resumes.models import Basic, Profile, Resume, Volunteer, Work
from django.shortcuts import render
from rest_framework.decorators import action
from ... | python |
# "x" - Create. Creates the specified file, returns an error if the file exists
f = open("text1.txt", "x")
f.write("\nThis is new file")
f.close() | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
The iterative comb sort algorithm.
The comb sort algorithm was:
* designed by Włodzimierz Dobosiewicz and Artur Borowy in 1980;
* rediscovered and named by Stephen Lacey and Richard Box in 1991.
Notes
-----
The comb sort is a generalisation of the bubble ... | python |
from tkinter import *
from tkinter.ttk import *
from time import strftime
root=Tk()
root.title('clock')
def time():
string=strftime('%H:%M:%S')
label.config(text=string)
label.after(1000,time)
label= Label(root, font=('ds-digital',80), background="black",foreground='yellow') #install ds-digital font just... | python |
import re
from typing import Optional, Pattern
ESCAPE_STRING_RE = re.compile(r"(['\\])")
ESCAPE_COL_RE = re.compile(r"([`\\])")
NEGATE_RE = re.compile(r"^(-?)(.*)$")
SAFE_COL_RE = re.compile(r"^-?([a-zA-Z_][a-zA-Z0-9_\.]*)$")
# Alias escaping is different than column names when we introduce table aliases.
# Using the... | python |
from sys import argv
script, first, second, third = argv
print("The script is called:", script)
print("your first variable is:", first)
print("Your second variable is:", second)
print("Your third variable is:", third) | python |
# Copyright 2017 AT&T Intellectual Property. All other 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... | python |
#!/usr/bin/env python3
#
# example_filtering.py: demonstrates how to use `topf` with automated
# peak filtering.
import topf
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
if __name__ == '__main__':
data = np.genfromtxt('example.txt')
# This will automatically instruct the transfo... | python |
#
# This script will allow you to authenticate using OpenID Connect with KeyCloak
# To get more background information on how to use this script, go to
# https://augment1security.com/authentication/how-to-authenticate-with-openid-connect-angular2-spa-zap-part-1/
#
import json
import time
import datetime
import random... | python |
import pytest
from tournament_game import get_winner, Character
@pytest.mark.parametrize("name", ["текст", "42", "", 12, -345, 52.08, None, True])
def test_get_winner_solo(name):
character_sample = Character(name)
character_list = [character_sample]
assert str(name) == get_winner(character_list)
... | python |
import numpy as np
from UncertainSCI.ttr import predict_correct_discrete, stieltjes_discrete, \
aPC, hankel_deter, mod_cheb, lanczos_stable
from UncertainSCI.utils.compute_moment import compute_moment_discrete
from UncertainSCI.families import JacobiPolynomials
import time
from tqdm import tqdm
"""
We use six ... | python |
"""The Test file for CLI Formatters."""
import re
from sqlfluff.rules.base import RuleGhost
from sqlfluff.parser import RawSegment
from sqlfluff.parser.markers import FilePositionMarker
from sqlfluff.errors import SQLLintError
from sqlfluff.cli.formatters import format_filename, format_violation, format_path_violatio... | python |
from twitter import Twitter, OAuth
class TwitterAPI:
ACCESS_TOKEN = "223212203-5n4o9eTcRmKaxoPxtAelhufNzkdOTCSjn1dpku6U"
ACCESS_SECRET = "kmqNtVCtlyxJ7tS9U0C4HjfjAtE3Djqb3CDrIhFHEoJQt"
CONSUMER_KEY = "h5csBXeGpJmLma9IgnoV3JWfn"
CONSUMER_SECRET = "2OVIV2H7kG1TLaNI7FFZ0Gn6odOda8UuojyVkh8emgRnlxB1wW"
... | python |
"""
The customized image URL processing engine.
Author: Qing Wang
"""
import re
LC_LIST = ["a", "b", "c", "d", "e", "f", "g"]
CAP_LIST = ["A", "B", "C", "D", "E", "F", "G"]
NUM_LIST = ["0", "1", "2", "3", "4", "5", "6"]
class URLProcessor(object):
"""
Class for URLProcessor.
"""
def __init__(self... | python |
from collections import OrderedDict, defaultdict
from comet_ml import Experiment
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import os
from utils import *
from parse import get_parser
import pickle
from sklearn.manifold import TSNE
from math import sin, cos, sqrt, atan2, radians
class M... | python |
import rasiberryPiGPIOBaseController.RasiberryPiGPIO as RasiberryPiGPIO
import rasiberryPiGPIOBaseController.Pin as Pin
PI = RasiberryPiGPIO.RasiberryPiGPIO("3B+", "BCM") | python |
##############################################################################
#
# Copyright (c) 2014-2017, 2degrees Limited.
# All Rights Reserved.
#
# This file is part of hubspot-contacts
# <https://github.com/2degrees/hubspot-contacts>, which is subject to the
# provisions of the BSD at
# <http://dev.2degreesnetwor... | python |
# Solution 1
for e, n in enumerate(name):
print(e, n)
print(n, surname[e])
print("-----")
| python |
import util
import converter
class lexical:
def __init__(self, code, keys, keywords):
self.code = code
self.list = self.code.split('\n')
self.keys = keys
self.keywords = keywords
self.inter()
def list_str(self):
self.code = ''
... | python |
from .models import *
from decorator import *
from .views import *
from django.shortcuts import render
from django.http import HttpResponse
@service
def get_goods_info(param): # 获取商品信息
interface_id = "2000"
goods_id = param.get('goods_id', None)
try:
goods = getGoodsByID(goods_id)
except RF... | python |
#!/usr/bin/env python3
import argparse
import nnabla as nn
import nnabla.functions as F # it crashes without this
import numpy.random as R
import itertools as IT
from nn_circle import *
from nn_smt2 import *
from shared import *
parser = argparse.ArgumentParser(description='Generate ReLU neural network for unit ci... | python |
# usage: python setup.py pydexe
from pyd.support import setup, Extension, pydexe_sanity_check
import platform
pydexe_sanity_check()
projName = "object_"
setup(
name=projName,
version='1.0',
ext_modules=[
Extension("object_", ['object_.d'],
build_deimos=True,
d_lump=True,
... | python |
"""
Tester Suite:
**Purpose**
This one checks glglob (replaces glglob_test.py)
"""
import unittest, numpy
# get glbase
import sys, os
sys.path.append(os.path.realpath("../../"))
import glbase3
glbase3.config.SILENT = True
glbase3.config.set_log_level(None)
class Test_glglob(unittest.TestCase):
def setUp(se... | python |
# coding=utf-8
"""
This module contains the tokenizer functions supported by py_entitymatching.
"""
import logging
import pandas as pd
import six
import py_stringmatching as sm
import py_entitymatching.utils.generic_helper as gh
logger = logging.getLogger(__name__)
# Initialize global tokenizers
_global_tokenizers ... | python |
from hu import ObjectDict
def test_old_import():
"Verify that a backwards-compatible import still works."
from hu.object_dict import ObjectDict as OD
assert OD is ObjectDict
| python |
#!/usr/bin/env python
# coding=utf-8
# Created Time: 2017-03-17 14:59:15
# Modified Time: 2017-03-17 14:59:18
| python |
#!/usr/bin/python3
# *****************************************************************************
#
# 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 ... | python |
"""Implements the main DSE loop in spark."""
import maxbuild
import argparse
import itertools
import json
import os
import pprint
import re
import shutil
import subprocess
import sys
import pandas as pd
from tabulate import tabulate
from html import HTML
from bs4 import BeautifulSoup
from os import listdir
from os.pa... | python |
n,m = map(int,input().split())
l = list(map(int,input().split()))
l=sorted(l)
j = n-1
i=0
ans=0
while i <= j:
if l[i] + l[j] > m:
j-=1
else:
i+=1
j-=1
ans+=1
print(ans) | python |
from django.contrib.auth.models import User
from django.contrib.gis.db import models
from social_django.models import UserSocialAuth
from social_django.utils import load_strategy
from stravalib.client import Client as StravaClient
from homebytwo.importers.exceptions import StravaMissingCredentials
class Athlete(mod... | python |
# -*- coding: utf-8; -*-
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone
from django.utils.http import urlquote
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from django.db.models import Sum
from django.db.models.signals ... | python |
import os
import sys
import argparse
from cuttsum.event import read_events_xml
from cuttsum.nuggets import read_nuggets_tsv
from cuttsum.util import gen_dates
import cuttsum.wtmf
import streamcorpus as sc
from sklearn.metrics.pairwise import cosine_similarity
from collections import defaultdict
import numpy as np
def ... | python |
# Generated by Django 3.1.7 on 2021-06-01 15:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | python |
import logging
from cached_property import cached_property
from pymobiledevice3.exceptions import PyMobileDevice3Exception
from pymobiledevice3.restore.img4 import stitch_component
from pymobiledevice3.restore.tss import TSSResponse
class Component:
def __init__(self, build_identity, name: str, tss: TSSResponse ... | python |
from setuptools import setup, find_packages
from vrpcd import __version__, __author__
# Package info
PACKAGE_NAME = "tabu_vrpcd"
SHORT_DESCRIPTION = ('Tabu Search Algorithm for solving Vehicle Routing'
'Problem with Cross-Docking')
PACKAGES_ROOT = '.'
PACKAGES = find_packages(PACKAGES_ROOT)
# Pa... | python |
import os
import pytest
from app import create_app, db
@pytest.fixture
def app() -> None:
os.environ['APP_SETTINGS'] = 'app.configs.TestingConfig'
app = create_app()
with app.app_context():
# TODO: create test database with geographic modules
db.create_all()
yield app
with app... | python |
from itertools import combinations
# Define is_in_triangle()
def is_in_triangle(G, n):
"""
Checks whether a node `n` in graph `G` is in a triangle relationship or not.
Returns a boolean.
"""
in_triangle = False
# Iterate over all possible triangle relationship combinations
for n1, n2 in c... | python |
import threading
import unittest
import requests
from confident_metrics import record_event
from confident_metrics.metrics import ConfidentCounter, PreciseFloat
class MetricReader:
def __init__(self, port, addr="localhost"):
self.__is_running = False
self.__port = port
self.__addr = addr... | python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Palo Alto Networks, 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
#
#... | python |
import torch
import torch.optim as optim
import torch.utils.data as data_utils
import os
from pointnetae.model import PointNetAE
from pointnetae.config import *
from pointnetae.utils import *
from pointnetae.dataset import SceneDataset
# from torch.utils.data.dataloader import default_collate # for batching input scen... | python |
"""OpenAPI core responses module"""
from functools import lru_cache
from six import iteritems
from openapi_core.exceptions import InvalidContentType
from openapi_core.media_types import MediaTypeGenerator
from openapi_core.parameters import ParametersGenerator
class Response(object):
def __init__(
... | python |
# -*- coding: utf-8 -*-
"""
demo
~~~~
:copyright: (c) 2014 by Shipeng Feng.
:license: BSD, see LICENSE for more details.
"""
from plan import Plan
cron = Plan()
cron.command('ls /tmp', every='1.day', at='12:00')
cron.command('pwd', every='2.month')
cron.command('date', every='weekend')
if __name__ ... | python |
import numpy as np
from pycocotools.mask import iou
def np_iou(A, B):
def to_xywh(box):
box = box.copy()
box[:, 2] -= box[:, 0]
box[:, 3] -= box[:, 1]
return box
ret = iou(
to_xywh(A), to_xywh(B),
np.zeros((len(B),), dtype=np.bool))
return ret
| python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class BreakfastMenu(object):
def __init__(self):
self.items = []
def add_item(self, name, price):
self.items.append((name, price))
def __iter__(self):
""" return a Iterable object """
return iter(self.items)
class LaunchMen... | python |
import os
WORKDIR = os.path.dirname(__file__)
SWAGGER_PATH = os.path.join(WORKDIR, 'swagger')
def get_number_of_pages(num_of_items: int, page_size: int) -> int:
"""
Get number of pages
:param num_of_items: number of items in database
:param page_size: size of one page
:return: number of pages
... | python |
from importlib.machinery import SourceFileLoader
import io
import os.path
from setuptools import setup
parquetry = SourceFileLoader(
"parquetry", "./parquetry/__init__.py"
).load_module()
with io.open(os.path.join(os.path.dirname(__file__), "README.md"), encoding="utf-8") as f:
long_description = f.read()
p... | python |
#!/usr/bin/env python3
import re
import json
prometheus_batchnum = 0
prometheus_batchsize = 1000
prometheus_batch = []
opentsdb_batchnum = 0
opentsdb_batchsize = 1000
opentsdb_batch = []
input = open("data", "r")
for line in input:
m = re.match(r"ctr,some=(tag-\w+) n=(\d+)i (\d+)", line)
if m:
tagva... | python |
from httplib import OK
from unittest import SkipTest
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.contrib.auth.models import User, Group, Permission
from pycon.tests.factories import PyConTalkProposalFactory, PyCon... | python |
import datetime
from datetime import date
def from_external_date(s: str):
"""
Translates the data from external source file to the datetime.date object
:param s: String representation of a date
:return: The datetime.date object
"""
if '/' in s:
year, month = [int(x) for x in s.split('... | python |
import logging
import warnings
from typing import Dict, Tuple, Union
import numpy as np
import pandas as pd
from pandas.core.frame import DataFrame
import xarray as xr
from scipy import signal, spatial
import matlab.engine
# import pharedox_registration
# import matlab
from pharedox import utils
import pkgutil
de... | python |
from Bio.Align import MultipleSeqAlignment, AlignInfo
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
import pandas as pd
import numpy as np
import subprocess
from scipy.spatial.distance import pdist
from scipy.cluster.hierarchy import linkage, fcluster, dendrogram
from Levenshtein import ratio, distance
impo... | python |
from fastapi import FastAPI, Response, status
from fastapi.middleware.cors import CORSMiddleware
import os
import requests
from dotenv import load_dotenv
load_dotenv()
from .models import FromForm
from .database import db
from .payment import Payment
app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_... | python |
from django.contrib.auth.models import User
from project.models import Project
from django.test import TestCase, Client
from django.urls import reverse
from django.core import validators
import mongoengine
from decouple import config
import json
from faker import Faker
# def setUp(self):
# credentials = base64... | python |
import urllib.parse
from docutils import nodes, utils
arts_elements = ('group', 'variable', 'method', 'agenda')
arts_path = {el: el+'s' for el in arts_elements}
def make_arts_link(name, rawtext, text, lineno, inliner, options={}, content=[]):
parts = name.split(':')
if len(parts) < 2 or parts[1] not in art... | python |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
import argparse
musicConf = """CURRENTFILENAME="filename"
ELAPSED="0"
PLAYSTATUS="Stopped"
RESUME="OFF"
SHUFFLE="OFF"
LOOP="OFF"
SINGLE="OFF"
"""
audiobookConf = """CURRENTFILENAME="filename"
ELAPSED="0"
PLAYSTATUS="Stopped"
RESUME="ON"
SHUFFLE="O... | python |
# Copyright 2017-present Open Networking Foundation
#
# 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 agr... | python |
# Copyright 2020, Schuberg Philis B.V
#
# 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 ... | python |
from random import choice
from string import ascii_lowercase, digits
from django import forms
from django.contrib.auth.models import User
from django.db import models
from django.utils.importlib import import_module
from avocado.conf import settings
# 41 characters @ 30 characters per username = 3.16 billion permutat... | python |
birth_year = input('Birth year: ')
print(type(birth_year))
age = 2019 - int(birth_year)
print(type(age))
print(age)
#exercise
weight_in_lbs = input('What is your weight (in pounds)? ')
weight_in_kg = float(weight_in_lbs) * 0.454
print('Your weight is (in kg): ' + str(weight_in_kg))
| python |
from typing import Any, Dict, Iterable, List, Optional, TypedDict
ActionPayload = Iterable[Dict[str, Any]]
ActionPayloadWithLabel = TypedDict(
"ActionPayloadWithLabel", {"action": str, "data": ActionPayload}
)
Payload = List[ActionPayloadWithLabel]
ActionResponseResultsElement = Dict[str, Any]
ActionResponseRe... | python |
from setuptools import setup
setup(
name='vertvideo',
version="1.0.1",
description='python package to help you convert video/audio files.',
url='https://github.com/ellipyhub/vertvideo',
author='Ellipyhub',
license='MIT License',
packages=['vertvideo'],
long_description=open('README.md',... | python |
#! /usr/bin/env python3
import os, math
import requests
import sqlalchemy
from sqlalchemy import MetaData, create_engine, Column, BigInteger, DateTime, String, ForeignKey, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship, sessionmaker
# Environment variables
if ... | python |
import os
import sys
import soundfile as sf
import numpy as np
pcm = sys.argv[1]
wav = os.path.splitext(pcm)[0] + '.wav'
sig = np.fromfile(pcm, dtype=np.int16)
sf.write(wav, sig, 16000)
| python |
# Copyright (c) 2021 PaddlePaddle 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 ap... | python |
from types import SimpleNamespace
import pytest
from syncx import rollback
from syncx import tag
from syncx import untag
from syncx.manager import Manager
from syncx.wrappers import CustomObjectWrapper
from syncx.wrappers import DictWrapper
from syncx.wrappers import ListWrapper
from syncx.wrappers import SetWrapper
... | python |
# Copyright (c) 2021 Cloudification GmbH.
# 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 ... | python |
# Copyright 2021 Intel Corporation
#
# 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 wr... | python |
"""
Assingment No. 11 Part V
Name: Mohamed Gamal Zaid
ID: 201700399
"""
import numpy as np
from numpy import exp as E
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
import time
J=1
T=1
H=-5
n=20
total = np.power(n,2)
ts=1100
nCut = 100
plot = False
def interactingSpinsI... | python |
#Modified to store in the same txt file everytime
# prototype of vanilla LSTM for pedestrian modeling
# written by: Bryan Zhao and Ashish Roongta, Fall 2018
# carnegie mellon university
# import relevant libraries
import torch
import torch.nn as nn
import torch.optim as optim
import matplotlib
import numpy as np
impor... | python |
import os
import copy
import hashlib
import math
from typing import Union
from shapely.geometry import LineString
import pandas as pd
import geopandas as gpd
from shapely.geometry import LineString
from geographiclib.geodesic import Geodesic
from .logger import WranglerLogger
def point_df_to_geojson(df: pd.DataFra... | python |
import logging
from django.db import models
from jsonfield import JSONField
from django.conf import settings
from model_utils.models import TimeStampedModel
from .constants import LOG_LEVELS, LOG_TYPES
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericFo... | python |
# example = lambda: 'example'
| python |
import os.path
from crds.core import reftypes
HERE = os.path.abspath(os.path.dirname(__file__) or ".")
TYPES = reftypes.from_package_file("roman", __file__)
OBSERVATORY = TYPES.observatory
INSTRUMENTS = TYPES.instruments
EXTENSIONS = TYPES.extensions
TEXT_DESCR = TYPES.text_descr
FILEKINDS = TYPES.filekinds
INSTR... | python |
import re
from discord import AuditLogAction, Colour, Embed, Member
from discord.ext.commands import Bot, Cog, Context, command, has_any_role
from cdbot.constants import (
ADMIN_MENTOR_ROLE_ID,
ADMIN_ROLES,
CD_BOT_ROLE_ID,
LOGGING_CHANNEL_ID,
NICKNAME_PATTERNS,
PLACEHOLDER_NICKNAME,
ROOT_R... | python |
class Position:
def __init__(self, index, lineno, column):
# This is for tracking the position of the
# Lexer in the whole source
self.index = index
# This is for tracking new lines
self.lineno = lineno
# This is for tracking the position of the
# Lexer in t... | python |
from __future__ import print_function
import argparse
import os
import matplotlib.pyplot as plt
import torch
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import transforms
from datasets.breeds import BREEDSFactory
from models.util impor... | python |
import os
from datetime import datetime
from polyaxon_client.tracking import get_outputs_path
def define_prepare_tb_path():
logdir_tb = os.path.join(".", "tf_logs", "scalars") # ".\\tf_logs\\scalars\\"
outputs_path = get_outputs_path()
if outputs_path is not None: # polyaxon behavior
logdir_tb =... | python |
# This Python file uses the following encoding: utf-8
# !/usr/local/bin/python3.4
####################################################
# <Copyright (C) 2012, 2013, 2014, 2015 Yeray Alvarez Romero>
# This file is part of MULLPY.
####################################################
import numpy as np
from mullpy.pattern... | python |
import functools
import sys
__all__ = ('NiceDecorator',)
def available_attrs(fn):
"""
Return the list of functools-wrappable attributes on a callable.
This is required as a workaround for http://bugs.python.org/issue3445
under Python 2.
"""
if sys.version > '3.':
return functools.WRA... | python |
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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
#
# ht... | python |
"""
Authors: Elena Vasileva, Zoran Ivanovski
E-mail: elenavasileva95@gmail.com, mars@feit.ukim.edu.mk
Course: Mashinski vid, FEEIT, Spring 2021
Date: 09.03.2021
Description: function library
model operations: construction, loading, saving
Python version: 3.6
"""
# python imports
from keras.models import ... | python |
"""
Created on Jan 1, 2019
@author: CyberiaResurrection
"""
import unittest
import re
import sys
sys.path.append('../PyRoute')
from Star import Nobles
class TestNobles(unittest.TestCase):
def testDefaultString(self):
nobles = Nobles()
expected = ''
self.assertEqual(expected, nobles.__st... | python |
MMO_USER_ALREADY_ENABLED = "MMO features for your account are already enabled."
MMO_USER_ENABLE = "MMO features for your account are now enabled."
MMO_USER_ALREADY_DISABLED = "MMO features for your account are already disabled."
MMO_USER_DISABLE = "MMO features for your account are now disabled."
MMO_CURRENTLY_DISABLE... | python |
import datetime
import os
import re
from dateutil import tz
import sqlalchemy as sa
from sqlalchemy.engine.reflection import Inspector
from alembic import autogenerate
from alembic import command
from alembic import util
from alembic.environment import EnvironmentContext
from alembic.operations import ops
from alembi... | python |
print("Hello World")) # noqa: E902 | python |
from setuptools import setup, find_packages
setup(
name="mediafire-dl",
version="0.1.0",
description="UN script simple para descargar enlaces de mediafire basado en gdown",
url="https://github.com/fernandocaleo/mediafired-dlink",
author="Fernando Caleo",
author_email="fcaleo@nauta.cu",
clas... | python |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import sys
sys.path.append('../../framework')
sys.path.append('../../application')
from NetworkClass import Network
# In[9]:
model_dict = {
"network": {
'input_layer': {
"units": 784,
},
'hidden_layer': [... | python |
# core.py
#
# Copyright (c) 2007 Stephen Day
#
# This module is part of Creoleparser and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
#
import re
import genshi.builder as bldr
__docformat__ = 'restructuredtext en'
escape_char = '~'
esc_neg_look = '(?<!' + re... | python |
""" List of trading instruments and strategy portfolio """
from app_head import get_head
from app_body import get_body
from app_page import set_page
from app_ogp import set_ogp
from app_metatags import get_metatags
from app_title import get_title
from app_footer import get_page_footer
from bootstrap import get_bootstra... | python |
#-*- coding=utf-8 -*-
import cv2
import numpy as np
#直线检测
img = cv2.imread('lines.jpg')
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,50,120)
minLineLength = 20
maxLineGap = 5
lines = cv2.HoughLinesP(edges,1,np.pi/180,20,minLineLength,maxLineGap)
for x1,y1,x2,y2 in lines[0]:
cv2.line(img,(x1,y1... | python |
import unittest
import os
import logging
import datetime
from cryptoxlib.CryptoXLib import CryptoXLib
from cryptoxlib.clients.bitpanda import enums
from cryptoxlib.clients.bitpanda.BitpandaWebsocket import PricesSubscription, AccountSubscription, OrderbookSubscription, \
CandlesticksSubscription, CandlesticksSubsc... | python |
from time import gmtime, strftime
from django.contrib import admin
from django.contrib.gis.db import models as gis_models
from django.db import models as django_models
from mapwidgets.widgets import GooglePointFieldWidget
from . import models
class MyDate(admin.widgets.AdminSplitDateTime):
def __init__(self, ... | python |
# coding: utf-8
import sys
import random
from hpopt.datasets.uci.car import load_corpus
from ..sklearn import SklearnClassifier, SklearnGrammar
from sklearn.model_selection import train_test_split
def main():
X, y = load_corpus(representation='onehot')
Xtrain, Xtest, ytrain, ytest = train_test_split(X, y, t... | python |
from __future__ import print_function
from contextlib import contextmanager
from selecta.errors import NotSupportedError
from selecta.terminal import Keycodes
from selecta.renderers import MatchRenderer
from selecta.utils import is_printable, safeint
import re
__all__ = ["UI", "DumbTerminalUI", "SmartTerminalUI"]
... | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.