text
stringlengths
1
927k
# Backport of the match_hostname logic introduced in python 3.2 # http://hg.python.org/releasing/3.3.5/file/993955b807b3/Lib/ssl.py import re class CertificateError(ValueError): pass def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 http://tools.ietf.o...
import argparse import subprocess from os import listdir, makedirs from os.path import isfile, join, exists import multiprocessing parser = argparse.ArgumentParser(description='Generate renditions ') parser.add_argument('-i', "--input", action='store', help='Folder where the renditions are', type=str, ...
# Getting into the main folder. import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from tests.details import lectioUsername, lectioPassword, schoolId from src.lectio import Lectio lec = Lectio(lectioUsername, lectioPassword, schoolId) print(lec.getExercises())
from rest_framework import viewsets from .models import User, Photo from .serializers import UserSerializer, PhotoSerializer from .mixins import RequestLogViewMixin from rest_framework.authentication import SessionAuthentication, BasicAuthentication from rest_framework.permissions import IsAuthenticated, IsAuthenticate...
import json import pdb import os.path import sys sys.path.append( "../lib" ) from iseclogger import Logger from datetime import datetime, timedelta import pdb class ScheduleObject: _sid= "" _hour = "" _duration = "" _minute = "" _everyXDay = "" class PeripheralSchedulesObject: _peripher...
#!C:\Users\Isaac\PycharmProjects\TicketSystem\venv\Scripts\python.exe # EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3' __requires__ = 'pip==19.0.3' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys....
# Copyright © 2019 Province of British Columbia # # 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...
import unittest from test.general_tests import NumericalizationTestSuite from protovoc.numericalization.cython.cython_1 import Numericalization from protovoc.vocab.cython import Vocab class TestCython1Numericalization(unittest.TestCase, NumericalizationTestSuite): _voc = Vocab _num = Numericalization if __...
""" Basic building blocks for generic class based views. We don't bind behaviour to http method handlers yet, which allows mixin classes to be composed in interesting ways. """ from __future__ import unicode_literals import json from rest_framework import status from rest_framework.response import Response from rest...
""" Implementation of Doubly Linked List. """ # Author: Nikhil Xavier <nikhilxavier@yahoo.com> # License: BSD 3 clause class Node: """Node class for Doubly Linked List.""" def __init__(self, value): self.value = value self.next_node = None self.prev_node = None
#!/usr/bin/python # A setup script to install the _twobit module # --- # from distutils.core import setup from distutils.extension import Extension extensions = [] extensions.append(Extension("_twobit", ["_twobit.pyx"])) def main(): setup(name="twobit", ext_modules=extensions, cmdclass={'build_ex...
from setuptools import find_packages, setup install_requires = [ 'django-oscar>=1.6', 'wagtail>=2.0,<2.4', ] docs_require = [ 'sphinx>=1.4.0', ] tests_require = [ 'pytest-cov>=2.3.1', 'pytest-django>=3.0.0', 'pytest-pythonpath>=0.7', 'pytest>=3.0.3', # Linting 'isort>=4.2.5', ...
from flask import Flask, render_template, redirect, flash app = Flask(__name__) #Cross Site Request Forgery estämiseen app.secret_key = "mikalegall" @app.route('/') def index(): message = "Tämä viesti on etusivun Flashin jonopuskurista" flash(message) return render_template('index.html') @app.route("/uudelleenoh...
import argparse import sys import typing from . import __version__ from . import advanced_repr from . import archiver from . import stream def make_subcommand_parser(subs: typing.Any, name: str, *, help: str, description: str, **kwargs: typing.Any) -> argparse.ArgumentParser: """Add a subcommand parser with some s...
"""Rainbow 1, by Al Sweigart al@inventwithpython.com Shows a simple rainbow animation. Press Ctrl-C to stop. Tags: tiny, artistic, bext, beginner, scrolling""" __version__ = 0 import time, sys try: import bext except ImportError: print('This program requires the bext module, which you') print('can install ...
# -*- coding: utf-8 -*- """ .. module:: trend :synopsis: Trend Indicators. .. moduleauthor:: Dario Lopez Padial (Bukosabino) """ import numpy as np import pandas as pd from .utils import * def macd(close, n_fast=12, n_slow=26, fillna=False): """Moving Average Convergence Divergence (MACD) Is a trend-fo...
from buildtest.cli.help import buildtest_help def test_buildtest_help(): buildtest_help(command="build") buildtest_help(command="buildspec") buildtest_help(command="config") buildtest_help(command="cdash") buildtest_help(command="history") buildtest_help(command="inspect") buildtest_help(c...
"""Create dataframe with messages required to run attitude tests. Store topics required for attitude tests. Add missing messages to the dataframe which are required for attitude tests. """ import pandas as pd import numpy as np import argparse import os import pyulog from pyulgresample import ulogconv as conv from py...
from typing import Dict, List, Tuple import torch import torch.nn as nn import torch.nn.functional as F from .module import ConvBnReLU, depth_regression from .patchmatch import PatchMatch class FeatureNet(nn.Module): """Feature Extraction Network: to extract features of original images from each view""" def ...
from typing import Optional, Dict, Union from requests import Session class Bazaar: def __init__(self, key: str): self.session = Session() self.session.headers.update({"API-KEY": key}) self.baseurl = "https://mb-api.abuse.ch/api/v1/" def query_hash(self, hash: str) -> Dict: r...
from rest_framework import exceptions from django.db.models import Q from dynamic_rest.viewsets import DynamicModelViewSet from tests.models import ( Car, Cat, Dog, Group, Horse, Location, Permission, Profile, User, Zebra ) from tests.serializers import ( CarSerializer, ...
import os import sys import copy import pickle import numpy as np import pandas as pd from tqdm import tqdm from pprint import pprint from sklearn.model_selection import train_test_split import utils from debug import ipsh sys.path.insert(0, '_data_main') try: from _data_main.fair_adult_data import * except: pri...
# Copyright 2015 Dyn Inc. # # Author: Yasha Bubnov <ybubnov@dyn.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 at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
class UserError(RuntimeError): pass class CommunicationError(RuntimeError): pass class ProtocolError(RuntimeError): pass class ManagementError(ProtocolError): def __init__(self, msg: str, script: str, out: str, err: str): super().__init__(self, msg) self.script = script sel...
import random from unittest import mock from django.conf import settings from posthog.models import EventDefinition, Organization, PluginConfig, PropertyDefinition, Team, User from posthog.plugins.test.mock import mocked_plugin_requests_get from .base import BaseTest class TestTeam(BaseTest): def test_team_has...
# -*- encoding: utf-8 -*- from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django.utils.translation import gettext_lazy as _ class LoginForm(forms.Form): username = forms.CharField( widget=forms.TextInput( attrs={...
class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right def isBalanced(root: TreeNode) -> bool: def check(root): if not root: return 0 l, r = check(root.left), check(root.right) if -1 in [...
import numpy as np from compmech.panel import Panel from compmech.analysis import Analysis from compmech.sparse import solve def test_panel_field_outputs(): m = 7 n = 6 #TODO implement for conical panels strain_field = dict(exx=None, eyy=None, gxy=None, kxx=None, kyy=None, kxy=None) stress_field =...
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
import time from mystic.data import penguin from mystic.data.mail import PenguinPostcard from mystic.handlers.play.pet import get_my_player_walking_puffle from mystic.spheniscidae import Spheniscidae class Penguin(Spheniscidae, penguin.Penguin): __slots__ = ( 'x', 'y', 'frame', 'toy', ...
_base_ = [ '../_base_/models/upernet_swinspectral.py', '../_base_/datasets/hsixoasissvgg.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_4k.py' ] norm_cfg = dict(type='BN', requires_grad=True) model = dict( backbone=dict( embed_dims=96, depths=[2, 2, 18, 2], num_he...
import string import random class Robot: def __init__(self): self.name = self.generate_name() def reset(self): self.name = self.generate_name() def generate_name(self): random.seed() return self.random_prefix(2) + self.random_suffix(3) def random_prefix(self, n): ...
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/ship/components/booster/shared_bst_koensayr_racer_mk2.iff" result.a...
""" Module containing DocumentPublisher class """ from ..common.common import SectionHandler # pylint: disable=too-few-public-methods class DocumentPublisher(SectionHandler): """ Responsible for converting the DocumentPublisher section: - /cvrf:cvrfdoc/cvrf:DocumentPublisher """ type_category_mappi...
#!/usr/bin/env python # # Copyright (c) 2015 Jonathan M. Lange <jml@mumak.net> # # 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 re...
#--------------------------------------------------------------------- # File Name : HypothesisTesting1.py # Author : Kunal K. # Description : Implementing hypothesis test methods # Date: : 9 Nov. 2020 # Version : V1.0 # Ref No : DS_Code_P_K07 #-----------------------------------------------------...
import logging import requests import os import copy from kubee2etests.helpers_and_globals import TEST_NAMESPACE, FLASK_PORT, StatusEvent LOGGER = logging.getLogger(__name__) class StatusSender(object): def __init__(self): self.errors = [] @property def results(self): passed = len(self.er...
# -*- coding: utf-8 -*- # # webapp2 documentation build configuration file, created by # sphinx-quickstart on Sat Jul 31 10:41:37 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All...
#!/bin/env python #========================================================================== # (c) 2004 Total Phase, Inc. #-------------------------------------------------------------------------- # Project : Aardvark Sample Code # File : aaspi_slave.py #-----------------------------------------------------------...
# coding=utf-8 # # Copyright 2014 Hewlett-Packard Development Company, L.P. # 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/l...
""" This file contains a collection of common indicators, which are based on third party or custom libraries """ from numpy.core.records import ndarray from pandas import Series, DataFrame import pandas as pd import numpy as np # from math import log def heikinashi(bars): bars = bars.copy() bars['ha_close'] ...
import RiemannSolver from RiemannSolver import * from pylab import plot, figure, suptitle rs = RiemannSolver(timeSteps =1, mwaves = 2, mx = 800, meqn = 2, maux = 2) rs.q = random.random((rs.meqn,rs.mx)) rs.aux = random.random((rs.maux,rs.mx)) waves1, s1 = rs.solveVectorized(timer = True) waves2, s2 = rs.solveP...
"""Check multiple key definition""" #pylint: disable=C0103 correct_dict = { 'tea': 'for two', 'two': 'for tea', } wrong_dict = { # [duplicate-key] 'tea': 'for two', 'two': 'for tea', 'tea': 'time', }
import numpy as np import pyqtgraph as pg import time import csv import os from PyQt5.Qsci import QsciScintilla, QsciLexerPython import matplotlib.pyplot as plt from spyre import Spyrelet, Task, Element from spyre.widgets.task import TaskWidget from spyre.plotting import LinePlotWidget from spyre.widgets.rangespace i...
from torch import nn import torch class LogisticRegression(nn.Module): def __init__(self, theta_params: int): super(LogisticRegression, self).__init__() self.__linear = nn.Linear(theta_params, 1) self.__sigmoid_layer = nn.Sigmoid() def forward(self, ...
#convert numbers to binary and hex upto a certain number print('decimal to binary/hex converter') num1 = int(input('To which number shall values be converted: ')) lst_b = [] lst_h = [] for i in range(1,num1+1): #print(i,' ',bin(i)) lst_b.append(bin(i)) for i in range(1,num1+1): #print(i,' ',hex(i)) ls...
load( "@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository", ) load(":genrule_repository.bzl", "genrule_repository") load(":patched_http_archive.bzl", "patched_http_archive") load(":repository_locations.bzl", "REPOSITORY_LOCATIONS") load(":target_recipes.bzl", "TARGET_RECIPES...
#!/usr/bin/env python3 import csv import sys import numpy as np import pandas as pd csv_name = sys.argv[1] fraction = float(sys.argv[2]) with open(sys.argv[1], 'r') as f: csv = csv.reader(f) for p in csv: ip = next(csv) m = int(p[0]) # Our probabilities p = ...
# # Copyright 2021 Splunk 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, so...
"""OpenAPI core responses generators module""" from six import iteritems from openapi_core.compat import lru_cache from openapi_core.schema.extensions.generators import ExtensionsGenerator from openapi_core.schema.links.generators import LinksGenerator from openapi_core.schema.media_types.generators import MediaTypeGe...
#!/usr/bin/env python3 # Copyright 2014 BitPay Inc. # Copyright 2016-2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test framework for pivx utils. Runs automatically during `make check`. Can a...
from torch.utils.data import Dataset import numpy as np import torch from . import functions class TokensDataset(Dataset): def __init__(self, X, Y): self.X = self.encode_x(X) self.y = Y @staticmethod def encode_x(x: list) -> list: max_len = len(max(x, key=lambda i: len(i))) ...
import filecmp import os from typing import Any, Dict, List, Mapping, Optional from unittest.mock import MagicMock, patch import orjson from django.core import mail from django.test import override_settings from zulip_bots.custom_exceptions import ConfigValidationError from zerver.lib.actions import ( do_change_s...
# Generated by Django 3.0.2 on 2020-01-13 18:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('books', '0007_auto_20200112_1759'), ] operations = [ migrations.AddField( model_name='book', name='read_online', ...
"""Support for the Microsoft Cognitive Services text-to-speech service.""" from http.client import HTTPException import logging from pycsspeechtts import pycsspeechtts import voluptuous as vol from homeassistant.components.tts import CONF_LANG, PLATFORM_SCHEMA, Provider from homeassistant.const import CONF_API_KEY, C...
# Generated by Django 3.1.3 on 2021-03-04 19:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('rest_api', '0040_project_loading_gtfs_job_id'), ] operations = [ migrations.AlterField( model_name='calendar', name=...
from adguardhome import AdGuardHome from keys import newpass,newuser import asyncio # variable de nombre y url nuevaLista = "pc block" urlLista = "https://raw.githubusercontent.com/manolixgt/agh_blocking_python/main/blocklists/pc_block.txt" async def main(): async with AdGuardHome("172.16.10.199",password=...
# -*- coding: utf-8 -*- # Copyright © 2012-2015 Roberto Alsina and others. # 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 t...
from datetime import datetime CERT = "Certificate" PUBKEY = "Public Key" PRIVKEY = "Private Key" # TODO: Replace dict with oid search X509_SIG_ALGORITHMS = { "MD2WITHRSAENCRYPTION": False, "MD2WITHRSA": False, "MD5WITHRSAENCRYPTION": False, "MD5WITHRSA": False, "SHA1WITHRSAENCRYPTION": False, ...
from datetime import date, datetime from dateutil.tz import tzutc import logging import json from gzip import GzipFile from requests.auth import HTTPBasicAuth from requests import sessions from io import BytesIO from posthog.version import VERSION from posthog.utils import remove_trailing_slash _session = sessions.Se...
from bson import DBRef, SON from base import (BaseDict, BaseList, TopLevelDocumentMetaclass, get_document) from fields import (ReferenceField, ListField, DictField, MapField) from connection import get_db from queryset import QuerySet from document import Document class DeReference(object): def __call__(self, i...
""" Convert the id.map file and seqs.dnadist file to a single matrix that we can use in an anova to test the relationship between sequences and locations Our current keys in the metadata are: address altitude country date latitude longitude name note source We want to use name, cou...
# Copyright 2015 SimpliVity Corp. # # 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 o...
#!/usr/bin/env python """ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");...
#!/usr/bin/python # # @author: Gaurav Rastogi (grastogi@avinetworks.com) # Eric Anderson (eanderson@avinetworks.com) # module_check: supported # Avi Version: 17.1.1 # # Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses...
from typing import cast, Generic, TypeVar, Union from intervals.infinity import Infinity from intervals.comparable import Comparable T = TypeVar('T', bound=Comparable) class Endpoint(Generic[T]): value: Union[T, Infinity] open: bool def __init__(self, value: Union[T, Infinity], ...
from OpenTCLFile import * def modeNumber(TCLFile): global numModes modeNumbers = OpenSeesTclRead(TCLFile, 'set numModes', 3) if str(modeNumbers): numModes = modeNumbers[:, 2]#.astype(int) return numModes
from src.metric.CompoundMetric import CompoundMetric from src.metric.SampleMetricManager import SampleMetricManager from src.core.Setupable import SetupMode from src.metric.CompoundMetricManager import CompoundMetricManager from typing import Any from cleanfid import fid from src.population.Population import Population...
# -*- coding: utf-8 -*- # Copyright 2019 Extreme 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 # # Unless required by appli...
import synapse.exc as s_exc import synapse.lib.gis as s_gis import synapse.lib.layer as s_layer import synapse.lib.types as s_types import synapse.lib.module as s_module import synapse.lib.grammar as s_grammar units = { 'mm': 1, 'millimeter': 1, 'millimeters': 1, 'cm': 10, 'centimeter': 10, '...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Project: Fast Azimuthal integration # https://github.com/silx-kit/pyFAI # # Copyright (C) 2017-2021 European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # # Permission is here...
__copyright__ = 'Copyright(c) Gordon Elliott 2018' """ """ from a_tuin.api import ( node_class, node_connection_field, get_update_mutation, get_create_mutation, get_local_fields ) from glod.api.pps_leaf import PPSLeaf from glod.db.pps import PPS, PPSQuery pps_fields = get_local_fields(PPS) PPS...
# ------------------------------------------------------------------------------ # Python API to access CodeHawk Binary Analyzer analysis results # Author: Henny Sipma # ------------------------------------------------------------------------------ # The MIT License (MIT) # # Copyright (c) 2016-2019 Kestrel Technology ...
#!/usr/bin/env python3 # ============================================================================== # convert eduroam database xml v1 format to new json v2 # parameters: # 1) directory with institution.xml files # 2) directory where to output corresponding converted json files # ====================================...
#------------------------------------------------------ # S.D. Peckham # March 25, 2009 # Speed tests for different uses of NumPy's "where" #------------------------------------------------------ import time import numpy from numpy import * def Speed_Test(n): a = reshape(arange(n*n, dtype='Float64'), (n,n)) ...
""" Run and Read the scans from VTST calculations """ import automol import autofile from routines.es._routines import sp from routines.es._routines import _wfn as wfn from routines.es._routines import _scan as scan from lib import filesys from lib.submission import qchem_params from lib.reaction import grid as rxngri...
class PasswordComplexityManager: def __init__(self, min_length, min_lower, min_upper, min_digits, min_special): self.min_length = int(min_length) self.min_lower = int(min_lower) self.min_upper = int(min_upper) self.min_digits = int(min_digits) self.min_special = int(min_speci...
# -*- coding: utf-8 -*- import os import json import tccli.options_define as OptionsDefine import tccli.format_output as FormatOutput from tccli import __version__ from tccli.utils import Utils from tccli.exceptions import ConfigurationError from tencentcloud.common import credential from tencentcloud.common.profile.ht...
from toga.platform import get_platform_factory class Image(object): """ Args: path (str): Path to the image. factory (:obj:`module`): A python module that is capable to return a implementation of this class with the same name. (optional & normally not needed) """ def __ini...
class AAR: ISO_639_1 = '' ISO_639 = 'aar' ENGLISH_NAME = 'Afar' class ABK: ISO_639_1 = '' ISO_639 = 'abk' ENGLISH_NAME = 'Abkhazian' class ACE: ISO_639_1 = '' ISO_639 = 'ace' ENGLISH_NAME = 'Achinese' class ACH: ISO_639_1 = '' ISO_639 = 'ach' ENGLISH_NAME = 'Acoli' ...
from model.contact import Contact testdata = [ Contact(firstname ="firstname", middlename ="middlename", lastname ="lastname", nickname ="nickname", title ="title", company ="company",address ="address", home ="home", mobile ="mobile", work ="work",fax ="fax", email = "email...
from skimage.filters import threshold_local import numpy as np import cv2 import imutils # https://github.com/yardstick17/image_text_reader/blob/master/image_preprocessing/remove_noise.py def _order_points_(pts): # initialzie a list of coordinates that will be ordered # such that the first entry in the list ...
import json import urllib from datasette import hookimpl from datasette.database import QueryInterrupted from datasette.utils import ( escape_sqlite, path_with_added_args, path_with_removed_args, detect_json1, sqlite3, ) def load_facet_configs(request, table_metadata): # Given a request and th...
from django.db import models from django.utils import timezone from django.contrib.auth import get_user_model # Create your models here. class Post(models.Model): author = models.ForeignKey(get_user_model(), on_delete=models.CASCADE) created = models.DateTimeField('Created Date', default=timezone.now) ti...
import sys import math import re import numpy as np FRONT = [ ( (2, 2), (2, 3), (3, 3), (3, 2), (2, 2) ), ( (1, 2), (2, 4), (4, 3), (3, 1), (1, 2) ), ( (1, 3), (3, 4), (4, 2), (2, 1), (1, 3) ) ] BACK = [ ( (2, 6), (2, 7), (3, 7), (3, 6), (2, 6) ), ( (2, 5), (0, 2), (3, 0), (5, 3), (2, 5) ), ( (0, 3),...
from __future__ import print_function import sys # USAGE # sys.argv[1] = genes.gtf # Example # $ python gtf2protein_coding_genes.py genes.gtf > protein_coding_genes.lst def get_value(mykey, lookup): try: myvalue = lookup[mykey] except KeyError: myvalue = '' return myvalue.strip('"').strip("'") def seperate...
class Solution: def canCross(self, stones: List[int]) -> bool:
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) 2007-2008 Noah Kantrowitz <noah@coderanger.net> # Copyright (C) 2012 Ryan J Ollos <ryan.j.ollos@gmail.com> # All rights reserved. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution....
def test_standard(hatch, config_file, helpers): result = hatch('config', 'set', 'project', 'foo') assert result.exit_code == 0, result.output assert result.output == helpers.dedent( """ New setting: project = "foo" """ ) config_file.load() assert config_file.mod...
import sys from . import sjvo, sjsrv class SungJukV3Main: #성적 처리 서비스 객체 생성 sjsrv = sjsrv.SungJukService() #메뉴표시 def displayMenu(self): str_list = [] str_list.append(' -= 성적 처리 프로그램 v3 =-\n') str_list.append('----------------------------\n') str_list.append(' 1: 새로운 성적데...
from typing import Tuple, Any, Dict import uuid from django.http import (HttpResponse, HttpRequest, Http404, HttpResponseRedirect, JsonResponse) from django.views.generic import ListView, View, TemplateView from django....
from django.conf.urls.defaults import patterns, url from notification.views import notice_settings urlpatterns = patterns("", url(r"^settings/$", notice_settings, name="notification_notice_settings"), )
import matplotlib.pyplot as plt import argparse import numpy as np class BarGraph(): """ Loads data from a log file Has ability to display three graphs: Speed, Acceleration and Power """ def load_data(self, path_to_data): """Parse necessary data from a file""" with open(path_to_da...
# Use snippet 'summarize_a_survey_module' to output a table and a graph of # participant counts by response for one question_concept_id # The snippet assumes that a dataframe containing survey questions and answers already exists # The snippet also assumes that setup has been run # Update the next 3 lines survey_df =...
import tarfile import os def untar(tar_name, root): ''' 解压 tar.gz 文件并返回路径 root:解压的根目录 ''' with tarfile.open(tar_name) as tar: tar.extractall(root) tar_root = tar.getnames()[0] return os.path.join(root, tar_root)
import logging from PIL import Image, ImageDraw import io import numpy as np from tensorflow import make_tensor_proto, make_ndarray import cv2 import inferencing_pb2 import media_pb2 import extension_pb2 import os import ovms import time from cascade.voe_to_ovms import load_voe_config_from_json, voe_config_to_ovms_con...
# coding=utf-8 # Copyright 2020 The TF-Agents 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable la...
from distutils.core import setup NAME = 'flexCE' # do not use x.x.x-dev. things complain. instead use x.x.xdev VERSION = '1.0.1dev' RELEASE = 'dev' not in VERSION setup(name=NAME, version=VERSION, description='Flexible Galactic Chemical Evolution Model', author='Brett Andrews', author_email=...
import copy import datetime import logging import math import operator import traceback from collections import namedtuple from typing import Any, Dict, Optional from pyparsing import ( CaselessKeyword, Combine, Forward, Group, Literal, ParseException, Regex, Suppress, Word, alp...
import argparse parser = argparse.ArgumentParser() parser.add_argument('--n_workers', type=int, default=10, help='number of data loading workers') parser.add_argument('--batch-size', type=int, default=100, help='input batch size') parse...