filename
stringlengths
13
19
text
stringlengths
134
1.04M
the-stack_106_25144
import copy import matplotlib import matplotlib.pyplot as plt import numpy as np import torch import torchvision.transforms.functional as tv_tf from scipy import signal from torchvision.utils import make_grid matplotlib.use("agg") plt.style.use("bmh") MARKERS = [ ".", ",", "o", "v", "^", "<",...
the-stack_106_25145
# camera-ready import torch import torch.nn as nn import torch.nn.functional as F import os from resnet import ResNet18_OS16, ResNet34_OS16, ResNet50_OS16, ResNet101_OS16, ResNet152_OS16, ResNet18_OS8, ResNet34_OS8 from aspp import ASPP, ASPP_Bottleneck class DeepLabV3(nn.Module): def __init__(self, model_id, p...
the-stack_106_25148
# @lc app=leetcode id=488 lang=python3 # # [488] Zuma Game # # https://leetcode.com/problems/zuma-game/description/ # # algorithms # Hard (37.71%) # Likes: 309 # Dislikes: 341 # Total Accepted: 18.7K # Total Submissions: 49.4K # Testcase Example: '"WRRBBW"\n"RB"' # # You are playing a variation of the game Zuma....
the-stack_106_25150
from configs.models.backbone_2stream import backbone from configs.models.neck import neck from configs.models.bbox_head import set_num_classes from configs.models.ca_motion_head import set_params from configs.models.panoptic_head import panoptic_head from configs.experiments.general import * from configs.data.cscapesvp...
the-stack_106_25151
"""Tests for aiida_optimade.entry_collections.""" # pylint: disable=protected-access from typing import Any, Callable, Dict import pytest def test_insert(): """Test AiidaCollection.insert() raises NotImplentedError.""" from aiida_optimade.routers.structures import STRUCTURES with pytest.raises( ...
the-stack_106_25152
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings model = dict( type='FCOS', pretrained='open-mmlab://detectron/resnet50_caffe', backbone=dict( type='ResNet', depth=50, num_stages=4, ...
the-stack_106_25153
__all__ = [ "Node" , "Comment" , "NewLine" , "MacroBranch" , "Ifdef" , "CNode" , "Label" , "LoopWhile" , "LoopDoWhile" , "LoopFor" , "BranchIf" , "BranchSwitch" , "BranchElse" , "SwitchCase" , "Sw...
the-stack_106_25154
import sys import sqlite3 import datetime from random import randint connection = None cursor = None class Interface: def __init__(self): self.exit_app = False # set to TRUE when user attempts to quit application self.logged_in = False # set to TRUE when user has successfully logged in ...
the-stack_106_25156
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2013 VMware, Inc. # 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/lic...
the-stack_106_25157
from model.group import Group import random import string import os.path import jsonpickle import getopt import sys try: opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of groups", "file"]) except getopt.GetoptError as err: getopt.usage() sys.exit(2) n = 5 f = "data/groups.json" for o, a in ...
the-stack_106_25158
import os, sys import cv2 import math import numpy as np import _pickle as cPickle from PIL import Image import torch import torch.utils.data as data import torchvision.transforms as transforms from .utils import * #import open3d as o3d import matplotlib.pyplot as plt CLASS_MAP_FOR_CATEGORY = {'bottle':1, 'bowl':2...
the-stack_106_25159
#!/usr/bin/env python # # Copyright (c) 2016-2019 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 a...
the-stack_106_25161
""" Support for interface with a Sony Bravia TV. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/media_player.braviatv/ """ import logging import re import voluptuous as vol from homeassistant.components.media_player import ( PLATFORM_SCHEMA, SUPPOR...
the-stack_106_25162
# ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. # -------------------------------------------------------------------...
the-stack_106_25163
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
the-stack_106_25164
# 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 # distributed under the...
the-stack_106_25168
from setuptools import setup, find_packages from setuptools.command.install import install with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name="hyperparameter", version="0.2.0", description= "A hyper-parameter library for researchers, data scientists and m...
the-stack_106_25169
from django.shortcuts import render from django.forms import formset_factory from .forms import PizzaForm, MultiplePizzaForm def home(request): return render(request, 'pizza/home.html') def order(request): multiple_form = MultiplePizzaForm() form = PizzaForm() context = { 'pizzaform': form,...
the-stack_106_25171
from Okta_v2 import Client, get_user_command, get_group_members_command, create_user_command, \ verify_push_factor_command, get_groups_for_user_command, get_user_factors_command, get_logs_command, \ get_zone_command, list_zones_command, update_zone_command, list_users_command import pytest import json import io...
the-stack_106_25172
# -*- coding: utf-8 -*- # Copyright (C) 2014-2017 Andrey Antukh <niwi@niwi.nz> # Copyright (C) 2014-2017 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014-2017 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014-2017 Alejandro Alonso <alejandro.alonso@kaleidos.net> # This program is free software: you can r...
the-stack_106_25174
import optparse from scrapy.commands import ScrapyCommand from scrapy.commands.check import Command from scrapy.settings import BaseSettings parser = optparse.OptionParser(prog="Command", formatter=optparse.TitledHelpFormatter(), \ conflict_handler='resolve') parser.add_option("--logfile"...
the-stack_106_25176
import sys import json from aiohttp.client_exceptions import ClientError from kivy import base, utils from kivy.clock import Clock from kivy.core.window import Window from kivy.factory import Factory from kivy.lang import Builder from kivy.uix.label import Label from kivy.utils import platform from electrum_bynd.gui....
the-stack_106_25178
from django.contrib import admin from django.utils.translation import ugettext_lazy as _ import os from .models import ChunkedUpload from .settings import ABSTRACT_ADMIN_MODEL class ChunkedUploadAdmin(admin.ModelAdmin): list_display = ['file_type', 'id', 'creator', 'status', 'created_at', 'completed_at'] sear...
the-stack_106_25181
import dash import dash_labs as dl import plotly.express as px import plotly.graph_objects as go app = dash.Dash(__name__, plugins=[dl.plugins.FlexibleCallbacks()]) # Load gapminder dataset df = px.data.gapminder() years = sorted(df.year.drop_duplicates()) continents = list(df.continent.drop_duplicates()) # # Build ...
the-stack_106_25182
''' Properly implemented ResNet-s for CIFAR10 as described in paper [1]. The implementation and structure of this file is hugely influenced by [2] which is implemented for ImageNet and doesn't have option A for identity. Moreover, most of the implementations on the web is copy-paste from torchvision's resnet and has w...
the-stack_106_25185
from django.conf.urls import url from apps.hotelapp.views import Index, UsuarioCreate, UsuarioList, UsuarioDelete from apps.hotelapp.views import UsuarioUpdate, UsuarioShow, search, SucursalCreate from apps.hotelapp.views import SucursalList, SucursalDelete, SucursalUpdate, SucursalShow from apps.hotelapp.views import ...
the-stack_106_25186
# import libraries from pyspark.sql import SparkSession from pyspark import SparkConf from pyspark.sql.types import * from pyspark.sql.functions import col, count, lit, rand, when import pandas as pd from math import ceil ################################################# # spark config ##############################...
the-stack_106_25187
# the feature extraction script # include a complete list of features in the Tor website fingerprinting literature import os import sys from . import util from .Param import * # for CUMUL features and std import itertools import numpy # for int/int to be float from .FeatureUtil import * import multiprocessing ...
the-stack_106_25188
import bisect import typing def main() -> typing.NoReturn: n = int(input()) a = [i * (i + 1) // 2 for i in range(1, 10000)] s = [] n0 = n tot = 0 while n: i = bisect.bisect_right(a, n) n -= a[i - 1] s.append('7' * i) s = '1'.join(s) print(s) ...
the-stack_106_25190
"""Represents optimization strategy for group in PSO.""" # pylint: disable=redefined-variable-type import numpy as np from grortir.main.model.core.optimization_status import OptimizationStatus from grortir.main.pso.group_optimization_strategy import \ GroupOptimizationStrategy class CallsGroupOptimizationStrateg...
the-stack_106_25191
import logging import time from typing import Any, Dict, List, Optional, Set from blspy import G1Element from chaingreen.consensus.cost_calculator import calculate_cost_of_program, NPCResult from chaingreen.full_node.bundle_tools import simple_solution_generator from chaingreen.full_node.mempool_check_conditions impo...
the-stack_106_25192
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import codecs from setuptools import setup, find_packages def read(fname): file_path = os.path.join(os.path.dirname(__file__), fname) return codecs.open(file_path, encoding='utf-8').read() # Add your dependencies in requirements.txt # Note: you can ad...
the-stack_106_25199
#coding=utf-8 # Copyright (c) 2018 Baidu, Inc. 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 ...
the-stack_106_25203
import os from dotenv import load_dotenv load_dotenv() IMDB_CAST = "cast" IMDB_NAME = "name" MIN_NAME_SIZE = 0 SRC_ID = "src_id" DST_ID = "dst_id" WEIGHT = "weight" SUBTITLE_SLEEP_TIME = 3 EPISODE_ID = "id" EPISODE_NAME = "title" EPISODE_NUMBER = "episode" EPISODE_RATING = "rating" SEASON_ID = "seasonid" SEASON_NUM...
the-stack_106_25205
import os import base64 from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import (Mail, Attachment, FileContent, FileName, FileType, Disposition) change_url = f"https://github.com/{os.environ.get('GITHUB_REPOSITORY')}/commit/{os.environ.get('COMMIT_HASH')}" message = Mail( from_email=os.environ.get...
the-stack_106_25208
# 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 applicable law or agreed to in...
the-stack_106_25209
# vim: et:ts=4:sw=4:fenc=utf-8 from abc import ABC, abstractmethod import random from typing import * import json from pmevo_eval.utils.architecture import Architecture import pmevo_eval.utils.jsonable as jsonable class Mapping(jsonable.JSONable): """Abstract base class for port mappings.""" def __init__(s...
the-stack_106_25212
""" Salts RD Lite shared module Copyright (C) 2016 creits -2- tknorris 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...
the-stack_106_25213
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @date: December 2018, 7th @author: sainton@ipgp.fr - Greg Sainton @IPGP on Behalf InSight/SEIS collaboration @purpose: This module is a class "Mars Converter" designed mainly to convert UTC Time to LMST Time and LMST Time to UTC Time. With time, we added s...
the-stack_106_25214
# 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_25218
# Python script for rewriting a docker env file. # usage: patch_env dockerenv_input.env dockerenv_output.env # Copies each input line to the output, except when it is of the form # VAR_X=value # and an environment variable PATCH_VAR_X exists: then its value is used. # Performs no error handling. import os import re ...
the-stack_106_25219
# -*- coding: utf-8 -*- from __future__ import unicode_literals from rest_framework import serializers from irekua_database.models import CollectionType from irekua_database.models import LicenceType from irekua_rest_api.serializers.base import IrekuaModelSerializer from irekua_rest_api.serializers.base import Ireku...
the-stack_106_25220
"""Contains pipelines.""" from functools import partial import numpy as np import tensorflow as tf from hmmlearn import hmm import cardio.dataset as ds from batchflow import F, V, B from ..models.hmm import HMModel, prepare_hmm_input def hmm_preprocessing_pipeline(batch_size=20, features="hmm_features"): """P...
the-stack_106_25222
# Licensed to Elasticsearch B.V. under one or more contributor # license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright # ownership. Elasticsearch B.V. licenses this file to you under # the Apache License, Version 2.0 (the "License"); you may # not use this f...
the-stack_106_25225
''' 写的一个将博客转成markdown的脚本, 目前支持简书,知乎,CSDN,segmentfault,掘金 使用方法 python html2md.py -u <url> 由于博客类网站页面渲染方式和反爬技术的变化,这里不再维护。 基本思路是通过分析网页中正文部分,然后通过BeautifulSoup获取html,在通过tomd.py转换成markdown ''' import os import sys import getopt import requests import random import re import html2text from bs4 import BeautifulSoup useragen...
the-stack_106_25227
# coding=utf-8 # Copyright 2018 The Tensor2Tensor 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 applicable...
the-stack_106_25232
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="NatPy", version="0.1.1", author="Tomas Howson and Andre Scaffidi", author_email="tomas.howson@adelaide.edu.au, andre.scaffidi@adelaide.edu.au", description="Convert the units of particle p...
the-stack_106_25233
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) # from spack import * class Fluxbox(AutotoolsPackage): """Fluxbox is a windowmanager for X that was based on the Bla...
the-stack_106_25235
# Multiple Machine Learning Models in Predict Tetrahydrofolate from Whole Genome Methylation Data in Placenta Tissue # Load Packages import pandas as pd import numpy as np import random import sklearn from sklearn.model_selection import LeaveOneOut from sklearn import preprocessing from matplotlib import pyplot as plt...
the-stack_106_25236
from __future__ import unicode_literals, division, absolute_import import logging import smtplib import socket import sys from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText from smtplib import SMTPException from email.utils import formatdate from flexget import config_schema, manager, ...
the-stack_106_25241
# Copyright 2017-present Kensho Technologies, LLC. """Perform optimizations and lowering of the IR that allows the compiler to emit MATCH queries. The compiler IR allows blocks and expressions that cannot be directly compiled to Gremlin or MATCH. For example, ContextFieldExistence is an Expression that returns True if...
the-stack_106_25242
import traceback def dfs(adj, used, order, x): used[x] = 1 for v in adj[x]: if used[v] == 0: dfs(adj, used, order, v) used[x] = -1 order.append(x) def topological_sort(adj): # recursive dfs with used = [0] * len(adj) order = [] for x in range(len(adj)): if ...
the-stack_106_25243
import pytest # noinspection PyPackageRequirements import asyncio from aionetworking.compatibility import (supports_task_name, get_task_name, get_current_task_name, set_task_name, set_current_task_name, current_task) class TestTaskNames: @pytest.mark.asyncio async d...
the-stack_106_25247
# Copyright Niantic 2019. Patent Pending. All rights reserved. # # This software is licensed under the terms of the Monodepth2 licence # which allows for non-commercial use only, the full terms of which are made # available in the LICENSE file. from __future__ import absolute_import, division, print_function import o...
the-stack_106_25248
# 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 # # http://w...
the-stack_106_25249
from enum import Enum import tensorflow as tf from sticker_graph.model import Model from sticker_graph.weight_norm import WeightNorm class Sharing(Enum): none = 1 initial = 2 succeeding = 3 def mask_layer(layer, mask): return tf.multiply( tf.broadcast_to( tf.expand_dims( ...
the-stack_106_25250
import configparser from remove_errors import correct_ini_file def open_config(): config_file = 'config.ini' config = configparser.ConfigParser() try: config.read(config_file) except configparser.MissingSectionHeaderError: print('Found error in config file...') p...
the-stack_106_25254
from django import forms from contacts.models import Contact from common.models import Comment, Attachments from teams.models import Teams class ContactForm(forms.ModelForm): teams_queryset = [] teams = forms.MultipleChoiceField(choices=teams_queryset) def __init__(self, *args, **kwargs): assigne...
the-stack_106_25256
import pandas as pd from optparse import OptionParser def get_options(): parser = OptionParser(description = ("Plot")) parser.add_option("--f", dest = "flair", help = "FLAIR mock abundance file") parser.add_option("--t", dest ="talon", help = "TALON abundance file"...
the-stack_106_25257
# coding: utf-8 from __future__ import absolute_import from bitmovin_api_sdk.common import BaseApi, BitmovinApiLoggerBase from bitmovin_api_sdk.common.poscheck import poscheck_except from bitmovin_api_sdk.models.aes_encryption_drm import AesEncryptionDrm from bitmovin_api_sdk.models.bitmovin_response import BitmovinR...
the-stack_106_25264
""" Module for dataloader """ from typing import List, Tuple import numpy as np import torch from torch.utils.data import Dataset, Sampler from dataset.database import SedDoaDatabase class SedDoaChunkDataset(Dataset): """ Chunk dataset for SED or DOA task. For training and chunk evaluation. """ def ...
the-stack_106_25265
from PIL import Image import torch.utils.data as data import os from glob import glob import torch import torchvision.transforms.functional as F from torchvision import transforms import random import numpy as np class Crowd(data.Dataset): def __init__(self, root_path, crop_size, downsample_ratio...
the-stack_106_25269
# Copyright 2017 Lenovo # # 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, softw...
the-stack_106_25272
# Owner(s): ["oncall: distributed"] # Copyright 2019 Kakao Brain # # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import pytest import torch from torch import nn from ...
the-stack_106_25273
# Copyright (c) 2014-2020 Cloudify Platform Ltd. 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 b...
the-stack_106_25274
import sys import os from ppci import api from ppci.utils.reporting import HtmlReportGenerator from ppci.lang.basic.c64 import BasicLine, write_basic_program arch = api.get_arch('mcs6500') print('Using arch', arch) if len(sys.argv) > 1: with open(sys.argv[1], 'r') as f: text_message = f.read() else: ...
the-stack_106_25276
from attrdict import ( AttrDict, ) class AttributeDict(AttrDict): ''' See `AttrDict docs <https://github.com/bcj/AttrDict#attrdict-1>`_ This class differs only in that it is made immutable. This immutability is **not** a security guarantee. It is only a style-check convenience. ''' def __...
the-stack_106_25277
import urllib import requests from behance_python import ENDPOINTS, url_join from project import Project from user import User from wip import WIP from collection import Collection from behance import Behance import exceptions from requests.exceptions import ConnectionError, HTTPError, Timeout, TooManyRedirects class ...
the-stack_106_25278
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('statsy', '0004_auto_20151110_0935'), ] operations = [ migrations.AlterField( model_name='statsyevent', ...
the-stack_106_25279
""" Copyright: MAXON Computer GmbH Author: Maxime Adam. Description: - Gets the material linked to the first texture tag of the active object. Class/method highlighted: - BaseObject.GetTag() - TextureTag.GetMaterial() Compatible: - Win / Mac - R13, R14, R15, R16, R17, R18, R19, R20, R21, S22 """ ...
the-stack_106_25280
from __future__ import unicode_literals from parglare.parser import REDUCE, SHIFT, ACCEPT import codecs import sys from parglare import termui as t if sys.version < '3': text = unicode # noqa else: text = str HEADER = ''' digraph grammar { rankdir=LR fontname = "Bitstream Vera Sans" fontsize ...
the-stack_106_25282
""" Training a Convolutional Neural Network for Image Classification ================================================================ *Tutorial adapted from http://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.html* Generally, when you have to deal with image, text, audio or video data, you can use standard p...
the-stack_106_25283
"""Installation utilities for Python ISAPI filters and extensions.""" # this code adapted from "Tomcat JK2 ISAPI redirector", part of Apache # Created July 2004, Mark Hammond. import sys, os, imp, shutil, stat import operator from win32com.client import GetObject, Dispatch from win32com.client.gencache import EnsureMo...
the-stack_106_25285
import logging from typing import Dict import aiohttp from redbot.core import Config, checks, commands logger = logging.getLogger("snekeval") class SnekEval(commands.Cog): def __init__(self): self.conf = Config.get_conf( self, identifier=115110101107) # ord('snek') de...
the-stack_106_25286
def jaccard_similarity(setA, setB): intersection = set(setA).intersection(set(setB)) union = set(setA).union(set(setB)) return float(len(intersection))/float(len(union)) def makeWordcloudImages(model, path): from wordcloud import WordCloud import matplotlib.pyplot as plt for i in range(model.n...
the-stack_106_25287
import json import sys,os sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from request.RequestPostJson import RequestPostJson from session.Session import Session class RequestGetOtherPlayerTrades(RequestPostJson): def __init__(self, session: Session) -> None: super().__init_...
the-stack_106_25288
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
the-stack_106_25289
# -*- coding: UTF-8 -*- import os import pandas as pd import shutil import numpy as np import cv2 from tqdm import tqdm import pyfastcopy import json def main(): csv_file='D:/WWF_Det/WWF_Det/Raw_annoations/top14-part2.csv' df=pd.read_csv(csv_file) data_set='D:/top14-dataset-part1/' box_num=0 cat...
the-stack_106_25290
from django.conf.urls import include, url from django.contrib import admin from . import views urlpatterns = [ url(r'^$', views.home, name='forum'), url(r'^post/new/$', views.post_new, name='post_new'), url(r'^post/list/$', views.post_list, name='post_list'), url(r'^post/(?P<pk>[0-9]+)/$', view...
the-stack_106_25293
# Imports here import torch from torch import nn from torch import optim from torchvision import datasets, transforms, models import time from collections import OrderedDict import matplotlib.pyplot as plt import torch.nn.functional as F import numpy as np from sklearn.metrics import accuracy_score # TODO: Build the ...
the-stack_106_25294
import os import time from compress import _compress, _decompress, encode_latents from train import _train from pathlib import Path import sys import shutil ################## # Hyperparems # ################## args = { "model": "mbt2018", "checkpoint_dir": "checkpoints", "results_dir": "results", "i...
the-stack_106_25295
""" Helper functions for toil-luigi interfacing """ import bio import math import argparse from toil.fileStore import FileID from bd2k.util.humanize import human2bytes ### # Helper functions for luigi-toil pipelines ### def load_fasta_from_filestore(job, fasta_file_ids, prefix='genome', upper=False): """ Con...
the-stack_106_25296
# -*- coding: utf-8 -*- """ Module for Firing Events via PagerDuty .. versionadded:: 2014.1.0 :configuration: This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. For example: .. code-block:: yaml my-pagerduty-accou...
the-stack_106_25297
"""distutils.command.check Implements the Distutils 'check' command. """ __revision__ = "$Id: check.py 85197 2010-10-03 14:18:09Z tarek.ziade $" from distutils.core import Command from distutils.errors import DistutilsSetupError try: # docutils is installed from docutils.utils import Reporter from docuti...
the-stack_106_25300
# Copyright 2013 The Emscripten Authors. All rights reserved. # Emscripten is available under two separate licenses, the MIT license and the # University of Illinois/NCSA Open Source License. Both these licenses can be # found in the LICENSE file. import glob import hashlib import json import logging import os impor...
the-stack_106_25301
import json import os import subprocess import urllib.request import urllib.error from queue import Queue from bottle import route, run, Bottle, request, static_file from threading import Thread import mutagen from mutagen.id3 import ID3, APIC from mutagen.easyid3 import EasyID3 import yt_dlp from yt_dlp.postprocessor....
the-stack_106_25302
import esphome.codegen as cg import esphome.config_validation as cv from esphome.components import binary_sensor from esphome.const import CONF_DIRECTION, DEVICE_CLASS_MOVING from . import APDS9960, CONF_APDS9960_ID DEPENDENCIES = ["apds9960"] DIRECTIONS = { "UP": "set_up_direction", "DOWN": "set_down_directi...
the-stack_106_25303
# coding=utf-8 from random import randint import pygame, math from character import * class AICharacter(Character): def __init__(self, x, y, Vx, Vy, properties=('slime', -1, -1)): # Properties should be a tuple of the form (STRING mobName, INT leftLimit, # INT rightLimit) where leftLimit ...
the-stack_106_25306
#!/usr/bin/env python3 import sys import argparse def parse_arguments(): """ parse the arguments """ p = argparse.ArgumentParser() p.add_argument( "--words-file", help="file with list of words [/usr/share/dict/words]", default="words.txt", ) p.add_argument( "--t...
the-stack_106_25307
import numpy as np import numpy import os from tqdm import tqdm import numpy as np from tqdm import tqdm from scipy.io import wavfile import os, csv import tensorflow as tf import pickle import numpy as np import argparse from network_model import * from helper import * import argparse import librosa def argument_pars...
the-stack_106_25313
# Databricks notebook source from pyspark.sql import SparkSession from pyspark.sql.functions import col, lit, udf spark = SparkSession.builder.appName("Spark DataFrames").getOrCreate() # COMMAND ---------- df = spark.read.options(header='True', inferSchema='True').csv('/FileStore/tables/StudentData.csv') df.show() #...
the-stack_106_25315
#!/usr/bin/env python3 ''' Factutil: helper scripts for source code entities Copyright 2012-2021 Codinuum Software Lab <https://codinuum.com> 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...
the-stack_106_25318
""" 1101. The Earliest Moment When Everyone Become Friends Medium In a social group, there are N people, with unique integer ids from 0 to N-1. We have a list of logs, where each logs[i] = [timestamp, id_A, id_B] contains a non-negative integer timestamp, and the ids of two different people. Each log represents the ...
the-stack_106_25319
# IMPORTATION STANDARD from datetime import datetime # IMPORTATION THIRDPARTY import pandas as pd import pytest # IMPORTATION INTERNAL from gamestonk_terminal.stocks.options import alphaquery_view @pytest.mark.vcr def test_display_put_call_ratio(mocker): # MOCK CHARTS mocker.patch.object(target=alphaquery_v...
the-stack_106_25321
from rest_framework.decorators import action from rest_framework.response import Response from rest_framework import viewsets, mixins, status from rest_framework.authentication import TokenAuthentication from rest_framework.permissions import IsAuthenticated from core.models import Tag, Ingredient, Recipe from recipe i...
the-stack_106_25322
#Надо подправить!! import codecs import operator import os import re freq = {} pages = os.listdir('./corpora') for page in pages: f = codecs.open(u'C:/Users/M/Desktop/corpora/' + page, 'r', 'utf-8') text = f.read() f.close() words = text.split(u'|') for word in words: if word.startswith(...
the-stack_106_25323
from cmsfix.views import * from cmsfix.views.node import get_node, get_add_menu from cmsfix.views.node.node import ( nav, node_submit_bar, NodeViewer, ) from cmsfix.models.pagenode import PageNode from cmsfix.lib.workflow import get_workflow from cmsfix.lib import macro from rhombus.lib.utils import get_db...
the-stack_106_25324
from collections import defaultdict from dataclasses import dataclass from datetime import datetime from typing import Any, Dict, List from .time_util import datetime_to_ms_timestamp, round_single_commit_by_time # files we don't want to count towards lines of code EXCLUSION_LIST = [ '.lock', 'package.json' ] ...
the-stack_106_25325
import os import sys import textwrap import pytest from tests.lib import assert_all_changes, pyversion from tests.lib.local_repos import local_checkout def test_no_upgrade_unless_requested(script): """ No upgrade if not specifically requested. """ script.pip('install', 'INITools==0.1', expect_error...
the-stack_106_25328
#!/usr/bin/env vpython3 # Copyright 2012 The LUCI Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 # that can be found in the LICENSE file. import hashlib import io import json import logging import os import re import stat import subprocess import sys import te...